diff --git a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h index 699410b9b5dd79ec9561ada3c00eaab7ddd98ad5..68f600d640339a2e3ca0b9d44296ba35f5614796 100755 --- a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h +++ b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h @@ -84,13 +84,6 @@ public: virtual void makeCorrection(const EventContext& ctx, xAOD::CaloCluster* cluster) const override; - - // Temp workaround to keep IsolationTools happy. - void makeCorrection(xAOD::CaloCluster* cluster) const - { - return makeCorrection (Gaudi::Hive::currentContext(), cluster); - } - /* * @brief Return the seed position of a cluster. * @param helper Sampling calculation helper object. diff --git a/Calorimeter/CaloDetDescr/CMakeLists.txt b/Calorimeter/CaloDetDescr/CMakeLists.txt index 5f965d517daefd33a24314c06b2cee342b5d5226..74154f2e14908e07025911e283ef46e7c7b43b92 100644 --- a/Calorimeter/CaloDetDescr/CMakeLists.txt +++ b/Calorimeter/CaloDetDescr/CMakeLists.txt @@ -1,57 +1,36 @@ -################################################################################ -# Package: CaloDetDescr -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( CaloDetDescr ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloIdentifier - Control/AthenaBaseComps - Control/AthenaKernel - Control/AthContainers - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - GaudiKernel - LArCalorimeter/LArGeoModel/LArReadoutGeometry - PRIVATE - AtlasTest/TestTools - Calorimeter/CaloConditions - Calorimeter/CaloGeoHelpers - Control/StoreGate - Control/CxxUtils) +# External dependencies. +find_package( Boost ) -# External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) -find_package( Eigen ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( CaloDetDescrLib - src/*.cxx - PUBLIC_HEADERS CaloDetDescr - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} CaloIdentifier AthenaBaseComps AthenaKernel AthContainers GeoPrimitives Identifier GaudiKernel LArReadoutGeometry StoreGateLib SGtests GeoModelInterfaces - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CaloConditions CaloGeoHelpers CxxUtils) + CaloDetDescr/*.h src/*.h src/*.cxx + PUBLIC_HEADERS CaloDetDescr + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} GaudiKernel AthenaKernel AthContainers + AthenaBaseComps CxxUtils GeoModelInterfaces Identifier CaloIdentifier + CaloGeoHelpers GeoPrimitives LArReadoutGeometry + PRIVATE_LINK_LIBRARIES CaloConditions StoreGateLib ) atlas_add_component( CaloDetDescr - src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES CaloDetDescrLib ) + src/components/*.cxx + LINK_LIBRARIES CaloDetDescrLib ) atlas_add_dictionary( CaloDetDescrDict - CaloDetDescr/CaloDetDescrDict.h - CaloDetDescr/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloIdentifier AthenaBaseComps AthenaKernel AthContainers GeoPrimitives Identifier GaudiKernel LArReadoutGeometry CaloConditions CaloGeoHelpers StoreGateLib SGtests CaloDetDescrLib ) + CaloDetDescr/CaloDetDescrDict.h + CaloDetDescr/selection.xml + LINK_LIBRARIES CaloDetDescrLib ) -# Install files from the package: +# Install files from the package. atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) +atlas_install_joboptions( share/*.py + POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) +# Test(s) in the package. atlas_add_test( CaloConstIteratorAdaptor_test SOURCES test/CaloConstIteratorAdaptor_test.cxx LINK_LIBRARIES CaloDetDescrLib ) diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrDict.h b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrDict.h index 361ed6601744cdb86b38429c47575aca9a4a4855..52588cdee88940cd30f34075bbce2cd3cfbbfb4d 100644 --- a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrDict.h +++ b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrDict.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloDetDescr/CaloDetDescrManager.h" @@ -14,7 +14,6 @@ #include "CaloDetDescr/ICaloRecoMaterialTool.h" #include "CaloDetDescr/ICaloRecoSimpleGeomTool.h" #include "CaloDetDescr/ICaloSuperCellIDTool.h" -#include "CaloGeoHelpers/CaloPhiRange.h" struct CaloDetDescrDict diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h index da94c18af629fdd4290a795cdbb1aa0c3995505e..776dcb70d3104d58ddd8d22e68372088d9bdd011 100755 --- a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h +++ b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h @@ -72,10 +72,11 @@ class CaloDetDescrElement : public Identifiable @param onl2 [IN] online identifier for Tile (2) @param descriptor [IN] descriptor object */ - CaloDetDescrElement(const IdentifierHash subcaloHash, - const IdentifierHash onl1, - const IdentifierHash onl2, - const CaloDetDescriptor* descriptor); + CaloDetDescrElement(const IdentifierHash subcaloHash, + const IdentifierHash onl1, + const IdentifierHash onl2, + const CaloDetDescriptor* descriptor); + public: /** @brief virtual destructor */ @@ -166,8 +167,7 @@ class CaloDetDescrElement : public Identifiable void set_volume(double volume); /** @brief set cell online identifiers (Tile) */ - void set_online(const IdentifierHash onl1, - const IdentifierHash onl2); + void set_online(const IdentifierHash onl1, const IdentifierHash onl2); /** @brief cell identifier */ @@ -322,7 +322,10 @@ class CaloDetDescrElement : public Identifiable */ float m_dz; - + /** @bried the sampling for this element + */ + CaloCell_ID::CaloSample m_sample=CaloCell_ID::Unknown; + /** @brief Tiles need 2 online hashed id */ IdentifierHash m_onl1; @@ -388,6 +391,12 @@ inline float CaloDetDescrElement::sinPhi() const inline float CaloDetDescrElement::cosPhi() const { return m_cosPhi;} +inline CaloCell_ID::CaloSample +CaloDetDescrElement::getSampling() const +{ + return m_sample; +} + inline void CaloDetDescrElement::set_volume(double volume) { m_volume = static_cast<float> (volume);} diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/selection.xml b/Calorimeter/CaloDetDescr/CaloDetDescr/selection.xml index 1edebb87254f6a81e9656818df2cecee4babc2ed..8dc81b36916e9b3c114d81fcc6ccc15a79b61980 100644 --- a/Calorimeter/CaloDetDescr/CaloDetDescr/selection.xml +++ b/Calorimeter/CaloDetDescr/CaloDetDescr/selection.xml @@ -1,3 +1,4 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <class name="CaloDetDescrManager_Base"/> <class name="CaloDetDescrManager"/> @@ -16,7 +17,6 @@ <class name="EMECDescriptor"/> <class name="FCALDescriptor"/> <class name="HECDescriptor"/> - <class name="CaloPhiRange"/> <class name="CaloSubdetNames"/> <enum name="CaloSubdetNames::ALIGNVOL"/> <class name="ICaloCoordinateTool"/> diff --git a/Calorimeter/CaloDetDescr/src/CaloDetDescrElement.cxx b/Calorimeter/CaloDetDescr/src/CaloDetDescrElement.cxx index a93a164156f77fa76e8fce746bf9f101a86af99a..a46334aecea7eead5918921ad925456747c967fe 100755 --- a/Calorimeter/CaloDetDescr/src/CaloDetDescrElement.cxx +++ b/Calorimeter/CaloDetDescr/src/CaloDetDescrElement.cxx @@ -6,43 +6,55 @@ #include <iostream> #include <iomanip> -#include <cmath> +#include <cmath> CaloDetDescrElement::CaloDetDescrElement(const IdentifierHash subcaloHash, - const IdentifierHash onl1, - const IdentifierHash onl2, - const CaloDetDescriptor* descriptor ) - : - m_descriptor(descriptor), - m_caloHash(descriptor ? - IdentifierHash(subcaloHash + descriptor->caloCellMin()) : - subcaloHash), - m_eta(0.), - m_phi(0.), - m_sinTh(0.), - m_cosTh(0.), - m_deta(0.), - m_dphi(0.), - m_volume(0.), - m_sinPhi(0.), - m_cosPhi(0.), - m_r(0.), - m_eta_raw(0.), - m_phi_raw(0.), - m_r_raw(0.), - m_dr(0.), - m_x(0.), - m_y(0.), - m_z(0.), - m_x_raw(0.), - m_y_raw(0.), - m_z_raw(0.), - m_dx(0.), - m_dy(0.), - m_dz(0.), - m_onl1(onl1), - m_onl2(onl2) + const IdentifierHash onl1, + const IdentifierHash onl2, + const CaloDetDescriptor* descriptor) + : m_descriptor(descriptor) + , m_caloHash(descriptor + ? IdentifierHash(subcaloHash + descriptor->caloCellMin()) + : subcaloHash) + , m_eta(0.) + , m_phi(0.) + , m_sinTh(0.) + , m_cosTh(0.) + , m_deta(0.) + , m_dphi(0.) + , m_volume(0.) + , m_sinPhi(0.) + , m_cosPhi(0.) + , m_r(0.) + , m_eta_raw(0.) + , m_phi_raw(0.) + , m_r_raw(0.) + , m_dr(0.) + , m_x(0.) + , m_y(0.) + , m_z(0.) + , m_x_raw(0.) + , m_y_raw(0.) + , m_z_raw(0.) + , m_dx(0.) + , m_dy(0.) + , m_dz(0.) + , m_onl1(onl1) + , m_onl2(onl2) { + m_sample=CaloCell_ID::Unknown; + if(is_tile()) { + // Tile + m_sample = (CaloCell_ID::CaloSample)( + m_descriptor->getSampling() + + m_descriptor->get_calo_helper()->tile_idHelper()->sampling(identify())); + } else if (m_descriptor) { + // LAr + m_sample=m_descriptor->getSampling(); + } else{ + // MBTS + m_sample=CaloCell_ID::Unknown; + } } CaloDetDescrElement::~CaloDetDescrElement () @@ -52,10 +64,12 @@ CaloDetDescrElement::~CaloDetDescrElement () Identifier CaloDetDescrElement::identify() const { - if(m_descriptor) + if(m_descriptor){ return (m_descriptor->get_calo_helper())->cell_id(calo_hash()); - else // MBTS + } + else{ // MBTS return (customID()); + } } void @@ -69,22 +83,6 @@ CaloDetDescrElement::print() const std::cout << "r = " << m_r << std::endl; } -CaloCell_ID::CaloSample CaloDetDescrElement::getSampling() const -{ - if(is_tile()) { - // Tile - CaloCell_ID::CaloSample sample = (CaloCell_ID::CaloSample)(m_descriptor->getSampling()+ - m_descriptor->get_calo_helper()->tile_idHelper()->sampling(identify()) ) ; - return sample ; - } else if (m_descriptor) { - // LAr - return m_descriptor->getSampling(); - } else { - // MBTS - return CaloCell_ID::Unknown; - } -} - int CaloDetDescrElement::getLayer() const { return 0; @@ -92,63 +90,63 @@ int CaloDetDescrElement::getLayer() const bool CaloDetDescrElement::is_lar_em() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_em(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_em_barrel() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_em_barrel(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_em_endcap() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_em_endcap(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_em_endcap_inner() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_em_endcap_inner(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_em_endcap_outer() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_em_endcap_outer(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_hec() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_hec(); - else - return false; + } + return false; } bool CaloDetDescrElement::is_lar_fcal() const { - if(m_descriptor) + if(m_descriptor){ return m_descriptor->is_lar_fcal(); - else - return false; -} - + } + return false; +} -void CaloDetDescrElement::set_online (const IdentifierHash onl1, - const IdentifierHash onl2) +void +CaloDetDescrElement::set_online(const IdentifierHash onl1, + const IdentifierHash onl2) { m_onl1 = onl1; m_onl2 = onl2; diff --git a/Calorimeter/CaloEvent/CaloEvent/selection.xml b/Calorimeter/CaloEvent/CaloEvent/selection.xml index d3bda1520a875e14fece5773c91acbd1af11a4ce..a6374065a571e720a17fbd9987bd8d55d33093f2 100644 --- a/Calorimeter/CaloEvent/CaloEvent/selection.xml +++ b/Calorimeter/CaloEvent/CaloEvent/selection.xml @@ -1,3 +1,4 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <class name="CaloCellContainer" id="24626824-1DB4-4CDF-9B41-1B54114BE498" > @@ -34,7 +35,6 @@ <class name="CaloClusterMomentStore::CaloClusterMomentIterator" /> <class name="CaloShower" /> - <class name="CaloSampling" /> <class name="CaloSamplingData" /> <class name="CaloShowerContainer" diff --git a/Calorimeter/CaloGeoHelpers/CMakeLists.txt b/Calorimeter/CaloGeoHelpers/CMakeLists.txt index 6e67b89df319787eb0eef924ec823270c90f662b..e2a055a69e47320ab80b92dbaee917c989741062 100644 --- a/Calorimeter/CaloGeoHelpers/CMakeLists.txt +++ b/Calorimeter/CaloGeoHelpers/CMakeLists.txt @@ -1,30 +1,24 @@ -################################################################################ -# Package: CaloGeoHelpers -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( CaloGeoHelpers ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/CxxUtils - PRIVATE - AtlasTest/TestTools ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( CaloGeoHelpers - Root/*.cxx - PUBLIC_HEADERS CaloGeoHelpers - LINK_LIBRARIES CxxUtils - PRIVATE_LINK_LIBRARIES TestTools ) + CaloGeoHelpers/*.h CaloGeoHelpers/*.def Root/*.cxx + PUBLIC_HEADERS CaloGeoHelpers + LINK_LIBRARIES CxxUtils ) + +atlas_add_dictionary( CaloGeoHelpersDict + CaloGeoHelpers/CaloGeoHelpersDict.h + CaloGeoHelpers/selection.xml + LINK_LIBRARIES CaloGeoHelpers ) +# Test(s) in the package. atlas_add_test( CaloPhiRange_test - SOURCES - test/CaloPhiRange_test.cxx - LINK_LIBRARIES CxxUtils TestTools CaloGeoHelpers ) + SOURCES test/CaloPhiRange_test.cxx + LINK_LIBRARIES CaloGeoHelpers ) atlas_add_test( CaloSampling_test - SOURCES - test/CaloSampling_test.cxx - LINK_LIBRARIES CxxUtils TestTools CaloGeoHelpers ) - + SOURCES test/CaloSampling_test.cxx + LINK_LIBRARIES CaloGeoHelpers ) diff --git a/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloGeoHelpersDict.h b/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloGeoHelpersDict.h new file mode 100644 index 0000000000000000000000000000000000000000..d37ba171b9c9d451051d0e8e8f0dd71c779ce378 --- /dev/null +++ b/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloGeoHelpersDict.h @@ -0,0 +1,21 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef CALOGEOHELPERS_CALOGEOHELPERSDICT_H +#define CALOGEOHELPERS_CALOGEOHELPERSDICT_H + +// Local include(s). +#include "CaloGeoHelpers/CaloPhiRange.h" +#include "CaloGeoHelpers/CaloSampling.h" + +// System include(s). +#include <vector> + +namespace { + struct GCCXML_DUMMY_INSTANTIATION_CALOGEOHELPERS { + std::vector< CaloSampling::CaloSample > sample_vec; + }; +} + +#endif // CALOGEOHELPERS_CALOGEOHELPERSDICT_H diff --git a/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/selection.xml b/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..8929be9e0a88e1afc943151fd7a183165dfb75aa --- /dev/null +++ b/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/selection.xml @@ -0,0 +1,9 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> +<lcgdict> + + <class name="CaloPhiRange" /> + <class name="CaloSampling" /> + <enum name="CaloSampling::CaloSample" /> + <class name="std::vector<CaloSampling::CaloSample>" /> + +</lcgdict> diff --git a/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx index 38518c1c7da58de58e45ceae82c83d151be58bc3..fe4b5061ec5881cf4d562f0880e96d1c34b5c045 100755 --- a/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -19,14 +19,13 @@ //******************************************************************** -#include "CaloMonitoring/CaloClusterVecMon.h" +#include "CaloClusterVecMon.h" #include "AthenaMonitoring/DQBadLBFilterTool.h" #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" #include "RecBackgroundEvent/BeamBackgroundData.h" -#include "xAODEventInfo/EventInfo.h" #include "CaloGeoHelpers/CaloSampling.h" #include "AthenaKernel/Units.h" #include <math.h> @@ -67,8 +66,6 @@ CaloClusterVecMon::CaloClusterVecMon(const std::string& type, const std::string& { declareInterface<IMonitorToolBase>(this); - declareProperty("CaloClusterContainer", m_clusterContainerName="CaloCalTopoClusters"); - declareProperty("TimeGran",m_timeGran="lowStat"); declareProperty("lowEthresh", m_Ethresh[LOW_E]=0.0); @@ -169,6 +166,8 @@ StatusCode CaloClusterVecMon::initialize() { StatusCode sc = StatusCode::SUCCESS; sc = retrieveTools(); + //Initialize read handle key + ATH_CHECK( m_clusterContainerName.initialize() ); sc = ManagedMonitorToolBase::initialize(); if(sc.isFailure()){ @@ -225,7 +224,7 @@ StatusCode CaloClusterVecMon::bookHistograms(){ bookCellHists(theinterval); bookClusterHists(theinterval); bookClusterStatHists(theinterval); - if( m_clusterContainerName == "CaloCalTopoClusters" ) { + if( m_clusterContainerName.key() == "CaloCalTopoClusters" ) { fillTileHistRange(); bookTileHists(theinterval); } @@ -286,11 +285,11 @@ void CaloClusterVecMon::bookCellHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); - MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Time_Energy", theinterval); - MonGroup cluster_leadcell_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/LeadCell", theinterval); + MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); + MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Time_Energy", theinterval); + MonGroup cluster_leadcell_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/LeadCell", theinterval); - if ( m_clusterContainerName == "LArMuClusterCandidates" ) { + if ( m_clusterContainerName.key() == "LArMuClusterCandidates" ) { m_nCells = new TH1I("NCells","NCellsinCluster",20,0.,20.); }else { m_nCells = new TH1I("NCells","NCellsinCluster",200,0.,200.); @@ -365,16 +364,16 @@ void CaloClusterVecMon::bookClusterHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_1drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/1d_Rates", theinterval); - MonGroup cluster_2drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_Rates", theinterval); - MonGroup cluster_2drates_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_Rates", theinterval); - MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); - MonGroup cluster_2davge_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); - MonGroup cluster_1davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/1d_AvEnergy", theinterval); - MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TransEnergy", theinterval); - MonGroup cluster_2dTotale_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TotalEnergy", theinterval); - MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Time_Energy", theinterval); - MonGroup cluster_SummaryGroup_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Summary", theinterval); + MonGroup cluster_1drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/1d_Rates", theinterval); + MonGroup cluster_2drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_Rates", theinterval); + MonGroup cluster_2drates_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_Rates", theinterval); + MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_2davge_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_1davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/1d_AvEnergy", theinterval); + MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TransEnergy", theinterval); + MonGroup cluster_2dTotale_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TotalEnergy", theinterval); + MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Time_Energy", theinterval); + MonGroup cluster_SummaryGroup_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Summary", theinterval); bookBaseHists(&cluster_SummaryGroup_expert).ignore(); //from base class @@ -567,18 +566,18 @@ void CaloClusterVecMon::bookClusterStatHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TransEnergy", theinterval); - MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); - MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TransEnergy", theinterval); + MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); + MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); if (m_dataType == AthenaMonManager::cosmics ){ - if ( m_clusterContainerName == "LArMuClusterCandidates" ) { + if ( m_clusterContainerName.key() == "LArMuClusterCandidates" ) { m_nClusters = new TH1I("NClus","NCluster",200,0,200); }else { m_nClusters = new TH1I("NClus","NCluster",50,0,50); } }else { - if ( m_clusterContainerName == "EMTopoCluster" ){ + if ( m_clusterContainerName.key() == "EMTopoCluster" ){ m_nClusters = new TH1I("NClus","NCluster",300,0,300); }else { m_nClusters = new TH1I("NClus","NCluster",600,0,600); @@ -644,7 +643,7 @@ void CaloClusterVecMon::bookTileHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup tile_cluster_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); //SHIFT + MonGroup tile_cluster_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); //SHIFT m_clustersCellsRatioEta = new TProfile("TileCalXRatioXEta","Ratio: cluster E/ cluster cells",(int)m_binRangeEta[0],m_binRangeEta[1], m_binRangeEta[2]); m_clustersCellsRatioEta->GetXaxis()->SetTitle("Eta"); @@ -707,12 +706,9 @@ StatusCode CaloClusterVecMon::fillHistograms() { sc = checkFilters(ifPass); if(sc.isFailure() || !ifPass) return StatusCode::SUCCESS; - const xAOD::CaloClusterContainer* clusterCont = nullptr; - sc=evtStore()->retrieve( clusterCont, m_clusterContainerName); - if( sc.isFailure() || !clusterCont ) { - ATH_MSG_WARNING( "No CaloCluster container found in TDS"); - return sc; - } + SG::ReadHandle<xAOD::CaloClusterContainer> clusterContHandle{m_clusterContainerName}; + if (! clusterContHandle.isValid()) { ATH_MSG_WARNING("No CaloCluster container found in TDS"); return StatusCode::FAILURE; } + const xAOD::CaloClusterContainer* clusterCont = clusterContHandle.get(); initCounter(); @@ -734,7 +730,7 @@ StatusCode CaloClusterVecMon::fillHistograms() { fillClusterStatHist(clusterCont); - if( m_clusterContainerName == "CaloCalTopoClusters" ) fillTileHist(clusterCont); + if( m_clusterContainerName.key() == "CaloCalTopoClusters" ) fillTileHist(clusterCont); return sc; } diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.h similarity index 96% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloClusterVecMon.h index 8ae3c45e9367ef6330173018a099459e2e576af4..45420690513b4614379c3c23977ecca74298b3ca 100755 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h +++ b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -16,7 +16,7 @@ #ifndef CALOClusterVecMon_H #define CALOClusterVecMon_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" @@ -90,7 +90,7 @@ class CaloClusterVecMon : public CaloMonToolBase { }; // CaloClusterContainer name - std::string m_clusterContainerName; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerName{ this, "CaloClusterContainer", "CaloCalTopoClusters" }; // Time granularity std::string m_timeGran; diff --git a/Calorimeter/CaloMonitoring/src/CaloMonAlgBase.cxx b/Calorimeter/CaloMonitoring/src/CaloMonAlgBase.cxx index 8f44a52b1c0e97341b4eab087b053d58f5fb0f0a..3bdca909214d476b92a8770b3717db4e61bee04a 100644 --- a/Calorimeter/CaloMonitoring/src/CaloMonAlgBase.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloMonAlgBase.cxx @@ -1,9 +1,8 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloMonAlgBase.h" -#include "xAODEventInfo/EventInfo.h" CaloMonAlgBase::CaloMonAlgBase(const std::string& name, ISvcLocator* pSvcLocator) :AthMonitorAlgorithm(name, pSvcLocator), @@ -81,14 +80,9 @@ StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRe ifPass = 1; } - ATH_MSG_DEBUG("CaloCellVecMon::checkFilters() ATLAS Ready done"); + ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() ATLAS Ready done"); - const xAOD::EventInfo* eventInfo; - sc = evtStore()->retrieve(eventInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("Event info not found !" ); - return sc; - } + SG::ReadHandle<xAOD::EventInfo> eventInfo{GetEventInfo(ctx)}; if (m_useBadLBTool) { if (m_BadLBTool->accept()) { @@ -103,7 +97,7 @@ StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRe if(ifPass) {evtbin=3; fill(MonGroupName,evtbin);} } - ATH_MSG_DEBUG("CaloCellVecMon::checkFilters() BadLBTool done"); + ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() BadLBTool done"); // Filter the events identfied as collision by the LAr system // Useful in CosmicCalo to reject collision candidates @@ -126,7 +120,7 @@ StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRe else{ if(ifPass) {evtbin=4; fill(MonGroupName,evtbin);} } - ATH_MSG_DEBUG("CaloCellVecMon::checkFilters() CollisionFilterTool done"); + ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() CollisionFilterTool done"); passBeamBackgroundRemoval=true; @@ -153,7 +147,7 @@ StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRe if(ifPass) {evtbin=5; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background } - ATH_MSG_DEBUG("CaloCellVecMon::checkFilters() m_useBeamBackgroundRemoval done"); + ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() m_useBeamBackgroundRemoval done"); std::string TheTrigger; if ( m_vTrigChainNames.size()==0) { @@ -174,6 +168,6 @@ StatusCode CaloMonAlgBase::checkFilters(bool &ifPass, bool &passBeamBackgroundRe if(ifPass) {evtbin=7; fill(MonGroupName,evtbin);} //All events with ATLAS Ready and Good LB and Good LAr collision time and not Beam Background and Trigger Filter pass and no Lar Error } - ATH_MSG_DEBUG("CaloMonALgBase::checkFilters() is done"); + ATH_MSG_DEBUG("CaloMonAlgBase::checkFilters() is done"); return StatusCode::SUCCESS; } diff --git a/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx index f5fdee62837c02cf0e69c745a25d7f70f824dae1..c8eee256231c7ee826da25f04a6d0170c0acdcb2 100644 --- a/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx @@ -1,11 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "CaloMonitoring/CaloMonToolBase.h" -#include "xAODEventInfo/EventInfo.h" -#include "LArRecEvent/LArCollisionTime.h" -#include "RecBackgroundEvent/BeamBackgroundData.h" +#include "CaloMonToolBase.h" #include "TH1F.h" CaloMonToolBase::CaloMonToolBase(const std::string& type, const std::string& name,const IInterface* parent) @@ -13,27 +10,28 @@ CaloMonToolBase::CaloMonToolBase(const std::string& type, const std::string& nam m_lb(0), m_passBeamBackgroundRemoval(false), m_h_EvtRejSumm(nullptr), - m_BadLBTool(this, "DQBadLBFilterTool"), - m_ReadyFilterTool(this, "DQAtlasReadyFilterTool") + m_BadLBTool(this, "BadLBTool", "DQBadLBFilterTool"), + m_ReadyFilterTool(this, "ReadyFilterTool", "DQAtlasReadyFilterTool") { declareProperty("useBadLBTool", m_useBadLBTool=false); - declareProperty("BadLBTool", m_BadLBTool); declareProperty("useReadyFilterTool",m_useReadyFilterTool=true); - declareProperty("ReadyFilterTool",m_ReadyFilterTool); declareProperty("useLArCollisionFilterTool",m_useCollisionFilterTool=true); declareProperty("useLArNoisyAlg",m_useLArNoisyAlg=false); declareProperty("useBeamBackgroundRemoval",m_useBeamBackgroundRemoval=false); - //Key of the beam background object - declareProperty("BeamBackgroundKey",m_beamBackgroundKey="CSCBackgroundForCaloMon"); } CaloMonToolBase::~CaloMonToolBase() {} StatusCode CaloMonToolBase::initialize() { + // initialize keys + ATH_CHECK( m_EventInfoKey.initialize() ); + ATH_CHECK( m_LArCollisionTimeKey.initialize(m_useCollisionFilterTool) ); + ATH_CHECK( m_beamBackgroundKey.initialize() ); + // retrieve AtlasReadyFilter tool if(m_useReadyFilterTool){ StatusCode sc = m_ReadyFilterTool.retrieve(); @@ -113,11 +111,10 @@ StatusCode CaloMonToolBase::checkFilters(bool& ifPass){ ifPass = 1; } - const xAOD::EventInfo* eventInfo; - sc = evtStore()->retrieve(eventInfo); - if (sc.isFailure()) { + SG::ReadHandle<xAOD::EventInfo> eventInfo{m_EventInfoKey}; + if (!eventInfo.isValid()) { ATH_MSG_ERROR("Event info not found !" ); - return sc; + return StatusCode::SUCCESS; } m_lb = eventInfo->lumiBlock(); @@ -137,9 +134,8 @@ StatusCode CaloMonToolBase::checkFilters(bool& ifPass){ // Filter the events identfied as collision by the LAr system // Useful in CosmicCalo to reject collision candidates if (m_useCollisionFilterTool){ - const LArCollisionTime * larTime; - sc = evtStore()->retrieve(larTime,"LArCollisionTime"); - if(sc.isFailure()){ + SG::ReadHandle<LArCollisionTime> larTime{m_LArCollisionTimeKey}; + if(!larTime.isValid()){ ATH_MSG_WARNING("Unable to retrieve LArCollisionTime event store"); if(ifPass) m_h_EvtRejSumm->Fill(4); } @@ -160,9 +156,8 @@ StatusCode CaloMonToolBase::checkFilters(bool& ifPass){ m_passBeamBackgroundRemoval=true; if(m_useBeamBackgroundRemoval){ - const BeamBackgroundData* beamBackgroundData; - sc = evtStore()->retrieve(beamBackgroundData, m_beamBackgroundKey);// "BeamBackgroundData"); - if(sc.isFailure()){ + SG::ReadHandle<BeamBackgroundData> beamBackgroundData{m_beamBackgroundKey}; + if(!beamBackgroundData.isValid()){ ATH_MSG_WARNING("Unable to retrieve BeamBackgroundData"); } else { diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloMonToolBase.h b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.h similarity index 65% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloMonToolBase.h rename to Calorimeter/CaloMonitoring/src/CaloMonToolBase.h index d48e6d9ec12df869df1955abfe5d4d92929373b7..f62cc50ac98c80d06f8d1594646245d55ac0f33d 100644 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloMonToolBase.h +++ b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //Dear emacs, this is -*-c++-*- @@ -8,6 +8,9 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "AthenaMonitoring/IDQFilterTool.h" +#include "xAODEventInfo/EventInfo.h" +#include "LArRecEvent/LArCollisionTime.h" +#include "RecBackgroundEvent/BeamBackgroundData.h" class TH1F; @@ -41,7 +44,9 @@ class CaloMonToolBase : public ManagedMonitorToolBase { bool m_useCollisionFilterTool; bool m_useBeamBackgroundRemoval; - std::string m_beamBackgroundKey; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<LArCollisionTime> m_LArCollisionTimeKey{this, "LArCollisionTimeKey", "LArCollisionTime"}; + SG::ReadHandleKey<BeamBackgroundData> m_beamBackgroundKey{this, "BeamBackgroundKey", "CSCBackgroundForCaloMon"}; }; diff --git a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx index a14a847faf99dc972d3e42e7f864af005521f37c..050ba9d02af8209fbd8933f2e414256489fec884 100755 --- a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -13,7 +13,7 @@ // D. Hu (Jun 2011 - May 2012) // L. Sawyer (Dec 2013 - ) // ******************************************************************** -#include "CaloMonitoring/CaloTowerVecMon.h" +#include "CaloTowerVecMon.h" #include "AthenaMonitoring/DQBadLBFilterTool.h" #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloTowerVecMon.h b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloTowerVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloTowerVecMon.h diff --git a/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx index c11b12812825265dd01ae24ab7f5bc6514769ec6..2cb61e262dd1cc2b209ecfb3ca2fd1a1fd46ac4f 100755 --- a/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -11,7 +11,7 @@ //******************************************************************** -#include "CaloMonitoring/CaloTransverseBalanceVecMon.h" +#include "CaloTransverseBalanceVecMon.h" #include "xAODEventInfo/EventInfo.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloTransverseBalanceVecMon.h b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloTransverseBalanceVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.h diff --git a/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx b/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx index a5f4927aced29ad1b202708b0900f95ea4ebc50b..957b19207bf045bccd3e8217a8cbf3f1b621c4d2 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // *********************************************************** @@ -9,7 +9,7 @@ // LArCellMonTools class // // *********************************************************** -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <iostream> #include "TMath.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellBinning.h b/Calorimeter/CaloMonitoring/src/LArCellBinning.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/LArCellBinning.h rename to Calorimeter/CaloMonitoring/src/LArCellBinning.h diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h b/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h index 8617b0a2cf24fec14b3daa96219010d2f5560031..24a2d7a694089e73485b1ab91d29bfa302c1a212 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h +++ b/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h @@ -20,7 +20,7 @@ #include "TrigDecisionTool/TrigDecisionTool.h" -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <vector> #include <string> diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx b/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx index 3aaf9be6f91c310c0a2e50d1a28f6d6c1a875d6c..d7f8271769df8d8a873b42b1d57aa7a13eb3a867 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "CaloMonitoring/LArCellMonTool.h" +#include "LArCellMonTool.h" using namespace CaloMonitoring; void LArCellMonTool::setLArCellBinning() { diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx b/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx index f72bd2ec8ada686c0ac8f819c063dc266a1a889f..4c4d89b00d06d5dc6795c0a12385e51086f16686 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // NAME: LArCellMonTool.cxx // W.Lampl - Spring 2017: Major re-design // ******************************************************************** -#include "CaloMonitoring/LArCellMonTool.h" +#include "LArCellMonTool.h" #include "LArRecConditions/LArBadChannel.h" #include "LArRecConditions/LArBadChanBitPacking.h" @@ -51,9 +51,6 @@ LArCellMonTool::LArCellMonTool(const std::string& type, const std::string& name, declareProperty("DoSaveTempHists",m_doSaveTempHists=false,"Store temporary, intermediate histograms in a /Temp/ directory (for debugging"); - // CaloCellContainer name - declareProperty("CaloCellContainer", m_cellContainerName="AllCalo","SG key of the input cell container"); - // tools declareProperty("useElectronicNoiseOnly",m_useElectronicNoiseOnly=false,"Consider only electronic noise and ignore pile-up contributiuon)"); declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise Tool"); @@ -150,7 +147,7 @@ LArCellMonTool::~LArCellMonTool() { //////////////////////////////////////////// StatusCode LArCellMonTool::initialize() { - ATH_MSG_INFO("LArCellMonTool::initialize() start"); + ATH_MSG_DEBUG("LArCellMonTool::initialize() start"); //Identfier-helpers ATH_CHECK( detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID") ); @@ -207,11 +204,14 @@ StatusCode LArCellMonTool::initialize() { //Fill the LArCellBinning for each layer setLArCellBinning(); + //Initialize read handle key + ATH_CHECK( m_cellContainerName.initialize() ); + //Call base-call initialize methods ATH_CHECK( ManagedMonitorToolBase::initialize() ); ATH_CHECK( CaloMonToolBase::initialize() ); - ATH_MSG_INFO("LArCellMonTool::initialize() is done!"); + ATH_MSG_DEBUG("LArCellMonTool::initialize() is done!"); return StatusCode::SUCCESS; } @@ -660,8 +660,9 @@ StatusCode LArCellMonTool::fillHistograms(){ return StatusCode::FAILURE; } - const CaloCellContainer* cellCont = nullptr; - ATH_CHECK(evtStore()->retrieve(cellCont, m_cellContainerName)); + SG::ReadHandle<CaloCellContainer> cellContHandle{m_cellContainerName}; + if (! cellContHandle.isValid()) { return StatusCode::FAILURE; } + const CaloCellContainer* cellCont = cellContHandle.get(); if (!m_oncePerJobHistosDone) { ATH_CHECK(createPerJobHistograms(cellCont)); diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h b/Calorimeter/CaloMonitoring/src/LArCellMonTool.h similarity index 98% rename from Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h rename to Calorimeter/CaloMonitoring/src/LArCellMonTool.h index ea2539c5bcda564831dee5759a6c50a1be6722ec..820eaec12634cbea183718d669cb5a9607d08011 100644 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h +++ b/Calorimeter/CaloMonitoring/src/LArCellMonTool.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -10,7 +10,7 @@ #ifndef CALOMONITORING_LARCELLMONTOOL_H #define CALOMONITORING_LARCELLMONTOOL_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" #include "LArRecConditions/ILArBadChannelMasker.h" @@ -25,7 +25,7 @@ #include "TrigDecisionTool/TrigDecisionTool.h" -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <vector> #include <string> @@ -155,7 +155,7 @@ private: //Job Properties and other private variables bool m_oncePerJobHistosDone=false; - std::string m_cellContainerName; + SG::ReadHandleKey<CaloCellContainer> m_cellContainerName { this, "CaloCellContainer", "AllCalo", "SG key of the input cell container" }; bool m_useElectronicNoiseOnly; ICalorimeterNoiseTool::CalorimeterNoiseType m_noiseType=ICalorimeterNoiseTool::TOTALNOISE; diff --git a/Calorimeter/CaloMonitoring/src/ROIMon.cxx b/Calorimeter/CaloMonitoring/src/ROIMon.cxx index eb7922932829d9d19ef1ea70d251d715cf7fe4eb..81c04d2710313a711ea5666b7c326724b6440888 100755 --- a/Calorimeter/CaloMonitoring/src/ROIMon.cxx +++ b/Calorimeter/CaloMonitoring/src/ROIMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -7,7 +7,7 @@ // // AUTHORS: F Spano' 06/15/2006 // ******************************************************************** -#include "CaloMonitoring/ROIMon.h" +#include "ROIMon.h" #include <stdint.h> #include <algorithm> diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h b/Calorimeter/CaloMonitoring/src/ROIMon.h similarity index 92% rename from Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h rename to Calorimeter/CaloMonitoring/src/ROIMon.h index ef46a04be7581511026e7af9d1d75e0bbcbc8a36..e1c9419051461177618920c7fc7df680116b8bc9 100755 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h +++ b/Calorimeter/CaloMonitoring/src/ROIMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //=========================== diff --git a/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx index 87db9b1fc2f7a2596243cd8982a2d2b9ceb4c108..4692e5028c151a6d032a2b2edd64792e1f91a644 100644 --- a/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx +++ b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // NAME: TileCalCellMonTool.cxx -#include "CaloMonitoring/TileCalCellMonTool.h" +#include "TileCalCellMonTool.h" #include "CaloIdentifier/TileID.h" @@ -33,9 +33,6 @@ TileCalCellMonTool::TileCalCellMonTool(const std::string& type, const std::strin { declareInterface<IMonitorToolBase>(this); - // CaloCellContainer name - declareProperty("CaloCellContainer", m_cellContainerName="AllCalo","SG key of the input cell container"); - // tools declareProperty("useElectronicNoiseOnly",m_useElectronicNoiseOnly=false,"Consider only electronic noise and ignore pile-up contributiuon)"); declareProperty("useTwoGaus", m_useTwoGaus=true,"Use double-gaussian noise description for Tile-cells"); @@ -55,7 +52,7 @@ TileCalCellMonTool::~TileCalCellMonTool() { //////////////////////////////////////////// StatusCode TileCalCellMonTool::initialize() { - ATH_MSG_INFO("TileCalCellMonTool::initialize() start"); + ATH_MSG_DEBUG("TileCalCellMonTool::initialize() start"); ATH_CHECK( detStore()->retrieve(m_tile_id) ); @@ -71,11 +68,13 @@ StatusCode TileCalCellMonTool::initialize() { initParam(); - + //Initialize read handle key + ATH_CHECK( m_cellContainerName.initialize() ); + ATH_CHECK( ManagedMonitorToolBase::initialize() ); ATH_CHECK( CaloMonToolBase::initialize() ); - ATH_MSG_INFO("TileCalCellMonTool::initialize() is done!"); + ATH_MSG_DEBUG("TileCalCellMonTool::initialize() is done!"); return StatusCode::SUCCESS; } @@ -299,12 +298,9 @@ StatusCode TileCalCellMonTool::fillHistograms(){ // CaloCell info //============================ - const CaloCellContainer* cellCont = nullptr; - sc=evtStore()->retrieve(cellCont, m_cellContainerName); - if( sc.isFailure() || !cellCont ) { - ATH_MSG_WARNING("No CaloCell container found in TDS"); - return sc; - } + SG::ReadHandle<CaloCellContainer> cellContHandle{m_cellContainerName}; + if (! cellContHandle.isValid()) { ATH_MSG_WARNING("No CaloCell container found in TDS"); return StatusCode::FAILURE; } + const CaloCellContainer* cellCont = cellContHandle.get(); CaloCellContainer::const_iterator it = cellCont->beginConstCalo(CaloCell_ID::TILE); diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h similarity index 92% rename from Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h rename to Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h index 299ff376687e9fd5da1493a06c704031fd6cf261..8679cbee697bb54acc0130b94ccbad5be1af0af7 100644 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h +++ b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h @@ -1,13 +1,13 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TILEMONTOOL_H #define TILEMONTOOL_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" @@ -47,7 +47,7 @@ private: void getRMSdevNoise(TProfile *t1, TProfile *t2, TH1F *t3); //Job Properties and other private variables - std::string m_cellContainerName; + SG::ReadHandleKey<CaloCellContainer> m_cellContainerName { this, "CaloCellContainer", "AllCalo", "SG key of the input cell container" }; bool m_useElectronicNoiseOnly; bool m_useTwoGaus; diff --git a/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx b/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx index 6d47955193bf9075eed4cdca33cb40dafcd623a0..c6da5d71d1e531d170c5b1be1dcb0adc0abdb90a 100755 --- a/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx +++ b/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx @@ -1,8 +1,8 @@ -#include "CaloMonitoring/LArCellMonTool.h" -#include "CaloMonitoring/TileCalCellMonTool.h" -#include "CaloMonitoring/CaloClusterVecMon.h" -#include "CaloMonitoring/CaloTowerVecMon.h" -#include "CaloMonitoring/CaloTransverseBalanceVecMon.h" +#include "../LArCellMonTool.h" +#include "../TileCalCellMonTool.h" +#include "../CaloClusterVecMon.h" +#include "../CaloTowerVecMon.h" +#include "../CaloTransverseBalanceVecMon.h" #include "../CaloBaselineMonAlg.h" #include "../TileCalCellMonAlg.h" #include "../LArCellMonAlg.h" diff --git a/Calorimeter/CaloRec/CMakeLists.txt b/Calorimeter/CaloRec/CMakeLists.txt index 3eeb4ff05f3bdb2deee57e5fc79f680aa765585c..abb8d3b5f12229135d067c30373631b16906d28f 100644 --- a/Calorimeter/CaloRec/CMakeLists.txt +++ b/Calorimeter/CaloRec/CMakeLists.txt @@ -125,13 +125,13 @@ atlas_add_test( CaloCellContainerAliasAlg_test atlas_add_test( CaloThinCellsBySamplingAlg_test SCRIPT python -m CaloRec.CaloThinCellsBySamplingAlg_test - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 LOG_SELECT_PATTERN "ERROR|error|WARNING [^U]|FATAL|processing" ) atlas_add_test( CaloThinCellsByClusterAlg_test SCRIPT python -m CaloRec.CaloThinCellsByClusterAlg_test - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 LOG_SELECT_PATTERN "ERROR|error|WARNING [^U]|FATAL|processing" ) diff --git a/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.cxx b/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.cxx index 65f627d171fa0dd5ab83cffaa21b90f2b61c852f..340ac2826054829ee7736df8a151904b8af5a24e 100644 --- a/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.cxx +++ b/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.cxx @@ -51,6 +51,8 @@ CaloCellContainerCheckerTool::CaloCellContainerCheckerTool( ///////////////////////////////////////////////////////////////////// StatusCode CaloCellContainerCheckerTool::initialize() { + + ATH_CHECK(detStore()->retrieve(m_theCaloCCIDM,"CaloCell_ID")); return StatusCode::SUCCESS; } @@ -189,9 +191,7 @@ CaloCellContainerCheckerTool::doProcess (const CaloCellContainer* theCont, // check find methods // count number of holes - const CaloCell_ID* theCaloCCIDM = nullptr; - ATH_CHECK(detStore()->retrieve(theCaloCCIDM,"CaloCell_ID")); - unsigned int hashMax=theCaloCCIDM->calo_cell_hash_max(); + const unsigned int hashMax=m_theCaloCCIDM->calo_cell_hash_max(); unsigned int nHoles =0; ATH_MSG_DEBUG("Now check all hashes give meaningful answer"); @@ -201,12 +201,12 @@ CaloCellContainerCheckerTool::doProcess (const CaloCellContainer* theCont, ++nHoles; if (msgLvl(MSG::VERBOSE)) { //const CaloDetDescrElement* theCaloDDM->dde=get_element(theHash); - const Identifier id=theCaloCCIDM->cell_id(theHash); - const int subcalo=theCaloCCIDM->sub_calo(theHash); - const int sampling=theCaloCCIDM->calo_sample(theHash); - const int pos_neg=theCaloCCIDM->pos_neg(id); - const int region=theCaloCCIDM->region(id); - const int sample=theCaloCCIDM->sample(id); + const Identifier id=m_theCaloCCIDM->cell_id(theHash); + const int subcalo=m_theCaloCCIDM->sub_calo(theHash); + const int sampling=m_theCaloCCIDM->calo_sample(theHash); + const int pos_neg=m_theCaloCCIDM->pos_neg(id); + const int region=m_theCaloCCIDM->region(id); + const int sample=m_theCaloCCIDM->sample(id); msg(MSG::VERBOSE) << "Cell not found: id=0x" << std::hex << id << std::dec << ", SubCalo=" <<subcalo <<", sampling="<< sampling << ", pos_neg=" << pos_neg << ", region=" << region << ", sample=" << sample << endmsg; diff --git a/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.h b/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.h index 7e285ffffca623fddc0b1425dc235f7b85fa75ad..cee3f6ab4d10569ce39b818a1f7a535cf7f98705 100644 --- a/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.h +++ b/Calorimeter/CaloRec/src/CaloCellContainerCheckerTool.h @@ -10,6 +10,9 @@ #include "CaloInterface/ICaloCellMakerTool.h" #include "CaloInterface/ICaloConstCellMakerTool.h" + +class CaloCell_ID; + class CaloCellContainerCheckerTool : public extends<AthAlgTool, ICaloCellMakerTool, ICaloConstCellMakerTool> { @@ -33,6 +36,8 @@ public: const EventContext& ctx) const; size_t m_eventsToCheck; + const CaloCell_ID* m_theCaloCCIDM = nullptr; + }; #endif diff --git a/Calorimeter/CaloUtils/CMakeLists.txt b/Calorimeter/CaloUtils/CMakeLists.txt index fb1d8a2953cbf9b7843e7bc40e69f1e91307c54d..2f5116be2162b4807d3d1f6cd157ace86309950f 100644 --- a/Calorimeter/CaloUtils/CMakeLists.txt +++ b/Calorimeter/CaloUtils/CMakeLists.txt @@ -81,6 +81,10 @@ atlas_add_test( CaloVertexedCluster_test LOG_IGNORE_PATTERN "^lar decode|mask/zero|initialize_from_dict|^ channel range|^AtlasDetectorID::" ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" ) +atlas_add_test( exceptions_test + SOURCES test/exceptions_test.cxx + LINK_LIBRARIES CaloUtilsLib ) + atlas_add_test( CaloTowerStore_test SCRIPT test/CaloTowerStore_test.sh LOG_IGNORE_PATTERN "Reading file|Unable to locate catalog|Cache alignment" @@ -92,5 +96,9 @@ atlas_add_test( CaloTowerBuilderTool_test ENVIRONMENT "ATLAS_REFERENCE_TAG=CaloUtils/CaloUtils-01-00-11" PROPERTIES TIMEOUT 500 ) +atlas_add_test( ToolWithConstants_test + SCRIPT test/ToolWithConstants_test.py + LOG_IGNORE_PATTERN "no dictionary for|by peeking into|Current filenames:" ) + # Install files from the package: atlas_install_joboptions( share/*.txt share/*.py ) diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloCellList.h b/Calorimeter/CaloUtils/CaloUtils/CaloCellList.h index cba0a2df7edb719da2b30b1b209657f59a4caaad..fbc18e951fb7a1c4f0f641a366edaea7bfa9df7c 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloCellList.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloCellList.h @@ -9,102 +9,117 @@ H. Ma Sept 2000 The constructor takes a pointer to ObjectVector<CaloCell> Two selection implemented: - delta_eta, delta_phi around a fix eta,phi, and + delta_eta, delta_phi around a fix eta,phi, and a cone of size dR around a fixed eta,phi An optional sampling layer requirement. - Using the templated method, Tselect, user can write a + Using the templated method, Tselect, user can write a function object with the operator()(CaloCell*) to select - the wanted cells. - Each select call clears previous selection. - methods et() and energy() return et and energy. + the wanted cells. + Each select call clears previous selection. + methods et() and energy() return et and energy. list of cells can also be accessed through iterators. Mod 17 Jun 2004 David Rousseau: work off big CaloCellContainer Mod 21 Sep 2004 Damir Lelas: -speeding up using "CaloDetDescr/CaloDetDescrManager" class. - -vector of cells added to an exsisting list of cells + -vector of cells added to an exsisting list of cells Mod 11 Oct 2004 Damir Lelas: -new method "select_nstrips" added; possibility to get number - of strips around given (eta,phi) direction for + of strips around given (eta,phi) direction for (ncell_eta,ncell_phi) specified. The List of cells replaced - by the Vector of cells. + by the Vector of cells. */ class CaloCellContainer; class CaloCell; - -#include <math.h> -#include "CaloIdentifier/CaloCell_ID.h" #include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloIdentifier/CaloCell_ID.h" class CaloCellList { - public: +public: + typedef std::vector<const CaloCell*> vector_type; + typedef vector_type::const_iterator list_iterator; - typedef std::vector<const CaloCell*> vector_type; - typedef vector_type::const_iterator list_iterator; - -// CaloCellList(); + // CaloCellList(); CaloCellList(const CaloCellContainer* cell_container); CaloCellList(const CaloCellContainer* cell_container, const CaloCell_ID::SUBCALO caloNum); - CaloCellList(const CaloCellContainer* cell_container, const std::vector<CaloCell_ID::SUBCALO> & caloNums); + CaloCellList(const CaloCellContainer* cell_container, const std::vector<CaloCell_ID::SUBCALO>& caloNums); ~CaloCellList(); // deta/dphi are the half-widths of the window. - // That is, we select cells within eta-deta .. eta+deta and similarly for phi. - void select(double eta,double phi,double deta,double dphi); - void select(double eta,double phi,double deta,double dphi,int sam); - void select(double eta,double phi,double dR ); - void select(double eta,double phi,double dR,int sam); - //Add overload accepting const CaloDetDescrManager& - void select(const CaloDetDescrManager& mgr,double eta,double phi,double deta,double dphi); - void select(const CaloDetDescrManager& mgr,double eta,double phi,double deta,double dphi,int sam); - void select(const CaloDetDescrManager& mgr,double eta,double phi,double dR ); - void select(const CaloDetDescrManager& mgr,double eta,double phi,double dR,int sam); - + // That is, we select cells within eta-deta .. eta+deta and similarly for + // phi. + + void select(double eta, double phi, double deta, double dphi); + void select(double eta, double phi, double deta, double dphi, int sam); + void select(double eta, double phi, double dR); + void select(double eta, double phi, double dR, int sam); + + // Add overload accepting const CaloDetDescrManager& + void select(const CaloDetDescrManager& mgr, double eta, double phi, double deta, double dphi); + + void select(const CaloDetDescrManager& mgr, double eta, double phi, double deta, double dphi, int sam); + + void select(const CaloDetDescrManager& mgr, double eta, double phi, double dR); + + void select(const CaloDetDescrManager& mgr, double eta, double phi, double dR, int sam); + list_iterator begin() const; list_iterator end() const; - double energy() const; // returns the energy of the selected cells - double et() const; // returns the et of the selected cells - int ncells() const; // returns the number of cells + double energy() const; // returns the energy of the selected cells + double et() const; // returns the et of the selected cells + int ncells() const; // returns the number of cells - private: +private: void doSelect(const CaloDetDescrManager& mgr, - double eta,double phi,double deta,double dphi, + double eta, + double phi, + double deta, + double dphi, double dR, CaloCell_ID::CaloSample sam = CaloCell_ID::Unknown); - - const CaloCellContainer* m_cellcont; - std::vector<CaloCell_ID::SUBCALO> m_caloNums; - vector_type m_theCellVector; + const CaloCellContainer* m_cellcont; + std::vector<CaloCell_ID::SUBCALO> m_caloNums; + vector_type m_theCellVector; + double m_energy; + double m_et; }; - -inline CaloCellList::list_iterator CaloCellList::begin() const +inline CaloCellList::list_iterator +CaloCellList::begin() const { return m_theCellVector.begin(); } -inline CaloCellList::list_iterator CaloCellList::end() const +inline CaloCellList::list_iterator +CaloCellList::end() const { return m_theCellVector.end(); } -inline int CaloCellList::ncells() const +inline double +CaloCellList::energy() const { - return m_theCellVector.size(); + return m_energy; } -#endif - - - - +inline double +CaloCellList::et() const +{ + return m_et; +} +inline int +CaloCellList::ncells() const +{ + return m_theCellVector.size(); +} +#endif diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloUtilsDict.h b/Calorimeter/CaloUtils/CaloUtils/CaloUtilsDict.h index 42c10507c743d91788db2f7f9953b8a11c42e522..c95341861110c2bcd04d0732374ca91dcf528d4f 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloUtilsDict.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloUtilsDict.h @@ -1,7 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloUtils/CaloClusterSignalState.h" #include "CaloUtils/CaloClusterStoreHelper.h" #include "CaloUtils/CaloCellDetPos.h" +#include "CaloUtils/ToolWithConstantsTestTool.h" diff --git a/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.h b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.h new file mode 100644 index 0000000000000000000000000000000000000000..ab861b18228f18e13baf567f6839a991d4f6fead --- /dev/null +++ b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.h @@ -0,0 +1,549 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/ToolWithConstants.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Hold constants for a tool. + * + * An extension to Gaudi componts to manage a set of Constants, + * which are like properties but are set from COOL with the possibility + * of overriding them from job options. + * + * See the class @c ToolWithConstants below for more information. + */ + +#ifndef CALOUTILS_TOOLWITHCONSTANTS_H +#define CALOUTILS_TOOLWITHCONSTANTS_H + + +#include "CaloUtils/exceptions.h" +#include "CaloConditions/ToolConstants.h" +#include "AthenaBaseComps/AthCheckMacros.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadCondHandle.h" +#include "AthenaKernel/errorcheck.h" +#include "CxxUtils/concepts.h" +#include "GaudiKernel/Property.h" +#include <string> +#include <sstream> +#include <type_traits> + + +namespace Gaudi { +namespace Parsers { + + +// Unused, because we override fromString() below, but required +// in order to compile the overridden fromString() from Gaudi. +template <unsigned int N> +StatusCode parse (CaloRec::Array<N>&, const std::string&) +{ + return StatusCode::FAILURE; +} + + +}} // namespace Gaudi::Parsers + + +namespace CaloUtils { + + +/** + * @brief Context object for retrieving @c ToolConstant values. + * + * Should be treated as opaque by clients, except to call ctx(). + */ +struct ToolConstantsContext +{ +public: + const EventContext& ctx() const { return m_ctx; } + + ToolConstantsContext (const CaloRec::ToolConstants* constants, + const EventContext& ctx) + : m_constants (constants), + m_ctx (ctx) + { + } + const CaloRec::ToolConstants* m_constants; + const EventContext& m_ctx; +}; + + + +/** + * @brief Internal interface for dealing with a collection of @c ToolConstants. + */ +class IToolConstant +{ +public: + /// Virtual destructor. + virtual ~IToolConstant() = default; + + /// The name of the constant. + virtual std::string name() const = 0; + + /// True if this constant was initialized from job options. + virtual bool setFromJO() const = 0; +}; + + +//*********************************************************************** + + +/** + * @brief Internal implementation object. + * + * Allows factoring out code which doesn't depend on template parameters. + */ +class ToolWithConstantsImpl +{ +public: + using Context = ToolConstantsContext; + + + /** + * @brief Constructor + * @param toolName Name of the tool. + * @param prefix Constant prefix in COOL. + * @param DBHandle Handle key for the conditions object. + */ + ToolWithConstantsImpl (const std::string& toolName, + const std::string& prefix, + SG::ReadCondHandleKey<CaloRec::ToolConstants>& DBHandle); + + + /** + * @brief Initialize. + */ + StatusCode initialize(); + + + /** + * @brief Create a @c Context object. + * + * This can then be passed to @c Constant::operator(). + */ + Context context (const EventContext& ctx) const; + + + /** + * @brief Add a new constant to the tool. + * @param c Constant to add. + */ + void addConstant (IToolConstant* c); + + + /** + * @brief Dump method (for debugging) + * @param stream Ostream to which to write. + * @param name Name to go in output + * @param ctx Event context. + */ + void writeConstants (std::ostream& stream, + const std::string& name, + const EventContext& ctx) const; + + + /** + * @brief Merge our constants into @c out with the proper prefix. + * @param typeName Name of the type of the tool. + * @param toolVersion Version of the tool. + * @param myctx Internal Context structure. + * @param isDummy isDummy constant from the tool + * @param[out] out Object to receive our constants. + */ + StatusCode + mergeConstants (const std::string& typeName, + int toolVersion, + Context& myctx, + bool isDummy, + CaloRec::ToolConstants& out) const; + + + /// Name of the owning tool. + std::string m_toolName; + + /// The prefix of this constant in COOL. + // Note: Held by a reference, not by value. + // This comes from a property of the owning tool, and is not set + // until we run initialize() on that tool. + const std::string& m_prefix; + + /// For settings made from JO. + CaloRec::ToolConstants m_constants; + + /// Handle to a ToolConstants conditions object. + SG::ReadCondHandleKey<CaloRec::ToolConstants>& m_DBHandle; + + /// All constants declared to this tool. + std::vector<IToolConstant*> m_declaredConstants; +}; + + +//*********************************************************************** + + +/** + * @brief Constant of a ToolWithConstants. + * + * See @c ToolWithContants below for usage information. + */ +template <class T> + // Must be able to initialize a T with fromArrayrep + // Doesn't actaully work like this, though, as there's a conflict + // with the friend declaration below. + //ATH_REQUIRES( requires (T t, const CxxUtils::Arrayrep& rep) { { CxxUtils::fromArrayrep (rep, t); } } ) +class ToolConstant + : public IToolConstant +{ +public: + /// Alias for the context object + using Context = ToolConstantsContext; + + + /** + * @brief Declare a constant with no default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param doc Documentation string. + */ + template <class OWNER> + ToolConstant (OWNER* owner, + const std::string& name, + const std::string& doc = ""); + + + /** + * @brief Declare a constant with no default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param doc Documentation string. + * + * (Needed in addition to the previous signature in order to avoid ambiguities; + * otherwise, if a char* is given for the third argument, it would + * match the following signature instead of the previous one.) + */ + template <class OWNER> + ToolConstant (OWNER* owner, + const std::string& name, + const char* doc); + + + /** + * @brief Declare a constant with a default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param deflt Default value. + * @param doc Documentation string. + * + * Only possible for arithmetic types, not @c Array<N>. + */ + template <class OWNER, + typename U = T, + typename = std::enable_if_t<std::is_arithmetic_v<U> > > + ToolConstant (OWNER* owner, + const std::string& name, + const T& deflt, + const std::string& doc = ""); + + + /** + * @brief Retrieve the value of a constant. + * @param c Context for accessing condtions (as returned from context()). + */ + T operator() (const Context& c) const; + + + /** + * @brief Retrieve the value of a constant. + * + * This variant may only be used if the constant was initialized via JO. + */ + T operator()() const; + + + /** + * @brief Return the name of this constant. + */ + virtual std::string name() const override; + + + /** + * @brief Was this constant set through job options? + */ + virtual bool setFromJO() const override; + + +private: + /** + * @brief Internal wrapper for Gaudi::Property. + * Handles the setFromJO flag and the Arrayrep conversion. + */ + class CProperty + : public Gaudi::Property<T> + { + public: + /** + * @brief Constructor, no default value. + * @param name Constant name. + * @param doc Documentation string. + * @param impl Internal implementation object. + */ + CProperty (const std::string& name, + const std::string& doc, + ToolWithConstantsImpl& impl); + + + /** + * @brief Constructor, with default value. + * @param name Constant name. + * @param doc Documentation string. + * @param impl Internal implementation object. + * @param deflt Default value. + */ + CProperty (const std::string& name, + const std::string& doc, + ToolWithConstantsImpl& impl, + const T& deflt); + + + // To be able to assign to this wrapper. + using Gaudi::Property<T>::operator=; + + + /** + * @brief Return the value of this property as a string. + */ + virtual std::string toString() const override; + + + /** + * @brief Print the value of this property to a stream. + * @param out Stream to which to print. + */ + virtual void toStream( std::ostream& out ) const override; + + + /** + * @brief Initialize this propery's value from a string. + * @param value String from which to initialize. + */ + virtual StatusCode fromString( const std::string& value ) override; + + + /// Reference to implementation object. + ToolWithConstantsImpl& m_impl; + + /// Has this constant been set from JO? + bool m_setFromJO = false; + + /// Does this constant have a default? + bool m_hasDefault = false; + }; + + + /// Internal Property instance, for getting JO settings from Gaudi. + CProperty m_prop; + + /// Version of the owning tool. + int m_toolVersion; +}; + + +//*************************************************************************** + + +/** + * @brief Hold constants for a tool. + * + * Certain tools, such as correction tools, have a large number of constants + * associated with them. One does not want to hard-code these constants; + * instead, the tools should be able to get them either from job options + * or from a COOL database. + * + * This class extends Gaudi components to manage a set of `Constants', + * which are like properties but can be set either from job options + * or from COOL (or possibly defaulted). The constants may either + * be scalar arithmetic types (floating-point, integer, boolean) + * or an specialization of CxxUtils::Array<N>. (Note, however, that + * the values are always stored as single-precision floating-point.) + * + * A Constant may be declared similarly to a Gaudi property. To retrieve + * its value, call context() and then pass that to the operator() method + * of the Constant. + * + * This is probably best shown as an example. + * + *@code + * + * class MyTool + * : public CaloUtils::ToolWithConstants<AthAlgTool> + * { + * // Define a floating-point constant, with a default value. + * Constant<float> m_cf + * { this, "FloatConst", 1.5, "A description" }; + * + * // Define an integer constant, with no default value. + * Constant<int> m_ci + * { this, "IntConst", "A description" }; + * + * // Define a two-dimensional array constant. + * // Array constants do not have defaults. + * Constant<CxxUtils::Array<2> > m_ca + * { this, "ArrayConst", "A description" }; + * + * public: + * // The constructor can be delegated to the base class. + * using base_base::base_class; + * + * // If you have an initialize() method, you must call the + * // base class version. + * virtual StatusCode initialize() override + * { + * ATH_CHECK( base_class::initialize() ); + * return StatusCode::SUCCESS; + * } + * + * void doit (const EventContext& ctx) const + * { + * // Make a local context object. + * Context myctx = context (ctx); + * + * // Retrieve the constants. + * float cf = m_cf (myctx); + * int ci = m_ci (myctx); + * CxxUtils::Array<2> ca = m_ca (myctx); + @endcode + * + * Constants that come from COOL are kept in a @c ToolConstants conditions + * object; the key of this object is set from the @c DBHandleKey property. + * Constants for multiple tools may be combined in a single @c ToolConstants + * object. Each tool has a string prefix (unique within such a group) + * that is added to the constant name when it is looked up in the + * @c ToolConstants object. + * + * For data that are stored as inline COOL data, a conditions algorithm + * is used to populate a @c ToolConstants object from COOL. + * + * Settings from COOL may be overridden with settings from job options. + * For values that are arrays, the value should be set as a string. + */ +template <class BASE> + ATH_REQUIRES( requires (BASE& b, Gaudi::Property<int>& p) { { b.declareProperty(p) }; } ) +class ToolWithConstants + : public BASE +{ +public: + /// Shorthand for derived classes. + typedef ToolWithConstants base_class; + + + /// Inherit constructor. + using BASE::BASE; + + + /// Convenient alias for the Context type. + using Context = CaloUtils::ToolConstantsContext; + + + /// Alias for the Constant type. + template <class T> + using Constant = ToolConstant<T>; + + + /** + * @brief Initialize method. Derived classes must call this. + */ + virtual StatusCode initialize() override; + + + /** + * @brief Create a @c Context object. + * + * This can then be passed to @c Constant::operator(). + */ + Context context (const EventContext& ctx) const; + + + /** + * @brief Dump method (for debugging) + * @param stream Ostream to which to write. + * @param name Name to go in output + * @param ctx Event context. + */ + virtual void writeConstants (std::ostream& stream, + const std::string& name, + const EventContext& ctx) const; + + + /** + * @brief Merge our constants into @c out with the proper prefix. + * @param[out] out Object to receive our constants. + * @param ctx Event context. + */ + virtual StatusCode mergeConstants (CaloRec::ToolConstants& out, + const EventContext& ctx) const; + + + /** + * @brief Return the version number for this tool. + * + * A saved set of constants includes both the C++ class name and + * a version number. The idea is that the version number can + * be bumped whenever there's a backwards-incompatible change; + * this gives some protection against trying to use an old version + * of a tool with an incompatible newer set of constants. + * + * If you want a tool to have a version number, override this method. + * Otherwise, it will default to a version number of 0. + */ + virtual int toolVersion() const; + + +private: + // Make this a friend so it can access m_impl. + template <class T> + friend class CaloUtils::ToolConstant; + + /// Handle to a ToolConstants conditions object. + SG::ReadCondHandleKey<CaloRec::ToolConstants> m_DBHandle + { this, "DBHandleKey", "", "" }; + + /// Prefix for finding our constants within the ToolConstants object. + StringProperty m_prefix + { this, "prefix", "", "" }; + + /// Internal implementation object. + ToolWithConstantsImpl m_impl { this->name(), m_prefix, m_DBHandle }; + + /// Used to fix the ordering of tools when we're initializing from COOL + /// based on a hierarchical tag. Tools should be executed in order + /// of increasing m_order. + Constant<int> m_order + { this, "order", 0 }; + + /// If true, then this is a dummy tool that should not be executed. + /// This is used for the case of reading from COOL using hierarchical + /// tags: we need to have such tags associated with some object in + /// each folder, regardless of whether or not the correction from + /// that folder is actually used. + /// [Every folder that IOVDbSvc knows about at configuration time + /// needs to have a valid object for the configured tag, else IOVDbSvc + /// will raise a fatal error. But we don't know at configuration time + /// which folders we're actually going to need, so we gotta configure + /// all of them.] + Constant<bool> m_isdummy + {this, "isDummy", false }; +}; + + +} // namespace CaloUtils + + +#include "CaloUtils/ToolWithConstants.icc" + + +#endif // not CALOUTILS_TOOLWITHCONSTANTS_H diff --git a/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.icc b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.icc new file mode 100644 index 0000000000000000000000000000000000000000..34d783569bc742508c3053da9d58a26434febfc7 --- /dev/null +++ b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstants.icc @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/ToolWithConstants.icc + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Hold constants for a tool. + */ + + +namespace CaloUtils { + + +/** + * @brief Declare a constant with no default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param doc Documentation string. + */ +template <class T> +template <class OWNER> +ToolConstant<T>::ToolConstant (OWNER* owner, + const std::string& name, + const std::string& doc /*= ""*/) + : m_prop (name, doc, owner->m_impl), + m_toolVersion (owner->toolVersion()) +{ + owner->declareProperty (m_prop); + owner->m_impl.addConstant (this); + m_prop.template setOwnerType<OWNER>(); +} + + +/** + * @brief Declare a constant with no default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param doc Documentation string. + * + * (Needed in addition to the previous signature in order to avoid ambiguities; + * otherwise, if a char* is given for the third argument, it would + * match the following signature instead of the previous one.) + */ +template <class T> +template <class OWNER> +ToolConstant<T>::ToolConstant (OWNER* owner, + const std::string& name, + const char* doc) + : ToolConstant (owner, name, std::string(doc)) +{ +} + + +/** + * @brief Declare a constant with a default. + * @param owner The owning @c ToolWithConstants. + * @param name Name of the constant. + * @param deflt Default value. + * @param doc Documentation string. + * + * Only possible for arithmetic types, not @c Array<N>. + */ +template <class T> +template <class OWNER, + typename U /*= T*/, + typename /*= std::enable_if_t<std::is_arithmetic_v<U> >*/ > +ToolConstant<T>::ToolConstant (OWNER* owner, + const std::string& name, + const T& deflt, + const std::string& doc /*= ""*/) + : m_prop (name, doc, owner->m_impl, deflt), + m_toolVersion (owner->toolVersion()) +{ + owner->declareProperty (m_prop); + owner->m_impl.addConstant (this); + m_prop.template setOwnerType<OWNER>(); +} + + +/** + * @brief Retrieve the value of a constant. + * @param c Context for accessing condtions (as returned from context()). + */ +template <class T> +T ToolConstant<T>::operator() (const Context& c) const +{ + // If it's been set from JO, just return the value. + if (m_prop.m_setFromJO) { + return static_cast<T> (m_prop); + } + + // Check for a setting from COOL. + if (c.m_constants) { + // Verify version. + if (c.m_constants->version() > m_toolVersion) { + throw ExcBadToolConstantVersion (m_prop.m_impl.m_toolName, + m_prop.name(), + m_toolVersion, + c.m_constants->version()); + } + + // Convert form the Arrayrep stored in COOL. + const CxxUtils::Arrayrep& rep = + c.m_constants->getrep (m_prop.m_impl.m_toolName, + m_prop.m_impl.m_prefix + m_prop.name()); + + T ret; + CxxUtils::fromArrayrep (rep, ret); + return ret; + } + + // If we have a default value, return it. + if (m_prop.m_hasDefault) { + return static_cast<T> (m_prop); + } + + // Otherwise it's an error. + throw CaloUtils::ExcConstantNotSet (m_prop.m_impl.m_toolName, m_prop.name()); +} + + +/** + * @brief Retrieve the value of a constant. + * + * This variant may only be used if the constant was initialized via JO. + */ +template <class T> +inline +T ToolConstant<T>::operator()() const +{ + if (!m_prop.m_setFromJO) { + throwBadContextlessRetrieve (m_prop.m_impl.m_toolName, m_prop.name()); + } + return static_cast<T> (m_prop); +} + + +/** + * @brief Return the name of this constant. + */ +template <class T> +std::string ToolConstant<T>::name() const +{ + return m_prop.name(); +} + + +/** + * @brief Was this constant set through job options? + */ +template <class T> +bool ToolConstant<T>::setFromJO() const +{ + return m_prop.m_setFromJO; +} + + +/** + * @brief Constructor, no default value. + * @param name Constant name. + * @param doc Documentation string. + * @param impl Internal implementation object. + */ +template <class T> +ToolConstant<T>::CProperty::CProperty (const std::string& name, + const std::string& doc, + ToolWithConstantsImpl& impl) + : Gaudi::Property<T> (name, T(), doc), + m_impl (impl), + m_hasDefault (false) +{ +} + + +/** + * @brief Constructor, with default value. + * @param name Constant name. + * @param doc Documentation string. + * @param impl Internal implementation object. + * @param deflt Default value. + */ +template <class T> +ToolConstant<T>::CProperty::CProperty (const std::string& name, + const std::string& doc, + ToolWithConstantsImpl& impl, + const T& deflt) + : Gaudi::Property<T> (name, deflt, doc), + m_impl (impl), + m_hasDefault (true) +{ + // Install the default value in our internal constats representation. + CaloRec::Arrayrep rep; + rep.m_data.push_back (deflt); + m_impl.m_constants.setrep (this->name(), std::move (rep)); +} + + +/** + * @brief Return the value of this property as a string. + */ +template <class T> +std::string ToolConstant<T>::CProperty::toString() const +{ + // Do this in terms of toStream(). + std::ostringstream ss; + toStream (ss); + return ss.str(); +} + + +/** + * @brief Print the value of this property to a stream. + * @param out Stream to which to print. + */ +template <class T> +void ToolConstant<T>::CProperty::toStream( std::ostream& out ) const +{ + out << static_cast<T> (*this); +} + + +/** + * @brief Initialize this property's value from a string. + * @param value String from which to initialize. + */ +template <class T> +StatusCode ToolConstant<T>::CProperty::fromString( const std::string& value ) +{ + // A given constant should not be set from JO more than once. + if (m_setFromJO) { + throw ExcConstantReset (m_impl.m_toolName, this->name()); + } + + // Convert from string and sae as the value of the property. + CaloRec::Arrayrep rep (value, m_impl.m_toolName); + m_impl.m_constants.setrep (this->name(), rep); + T val; + CxxUtils::fromArrayrep (m_impl.m_constants.getrep (m_impl.m_toolName, + this->name()), val); + *this = val; + + // Remember that this property was set from JO. + m_setFromJO = true; + return StatusCode::SUCCESS; +} + + +//*************************************************************************** + + + +/** + * @brief Initialize method. Derived classes must call this. + */ +template <class BASE> +StatusCode ToolWithConstants<BASE>::initialize() +{ + ATH_CHECK( m_impl.initialize() ); + ATH_CHECK( BASE::initialize() ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Create a @c Context object. + * + * This can then be passed to @c Constant::operator(). + */ +template <class BASE> +inline +typename ToolWithConstants<BASE>::Context +ToolWithConstants<BASE>::context (const EventContext& ctx) const +{ + return m_impl.context (ctx); +} + + +/** + * @brief Dump method (for debugging) + * @param stream Ostream to which to write. + * @param name Name to go in output + * @param ctx Event context. + */ +template <class BASE> +void ToolWithConstants<BASE>::writeConstants (std::ostream& stream, + const std::string& name, + const EventContext& ctx) const +{ + m_impl.writeConstants (stream, name, ctx); +} + + +/** + * @brief Merge our constants into @c out with the proper prefix. + * @param[out] out Object to receive our constants. + * @param ctx Event context. + */ +template <class BASE> +StatusCode +ToolWithConstants<BASE>::mergeConstants (CaloRec::ToolConstants& out, + const EventContext& ctx) const +{ + Context myctx = context (ctx); + return m_impl.mergeConstants (this->type(), + toolVersion(), + myctx, + m_isdummy (myctx), + out); +} + + +/** + * @brief Return the version number for this tool. + * + * A saved set of constants includes both the C++ class name and + * a version number. The idea is that the version number can + * be bumped whenever there's a backwards-incompatible change; + * this gives some protection against trying to use an old version + * of a tool with an incompatible newer set of constants. + * + * If you want a tool to have a version number, override this method. + * Otherwise, it will default to a version number of 0. + */ +template <class BASE> +int ToolWithConstants<BASE>::toolVersion() const +{ + return 0; +} + + +} // namespace CaloUtils diff --git a/Calorimeter/CaloUtils/CaloUtils/ToolWithConstantsTestTool.h b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstantsTestTool.h new file mode 100644 index 0000000000000000000000000000000000000000..dc6451f6889a06d8b9f11c3bc3bfa0d9d69ea999 --- /dev/null +++ b/Calorimeter/CaloUtils/CaloUtils/ToolWithConstantsTestTool.h @@ -0,0 +1,69 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/ToolWithConstantsTestTool.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Algorithm used for testing ToolWithConstants. + */ + + +#ifndef CALOUTILS_TOOLWITHCONSTANTSTESTTOOL_H +#define CALOUTILS_TOOLWITHCONSTANTSTESTTOOL_H + + +#include "CaloUtils/ToolWithConstants.h" +#include "AthenaBaseComps/AthAlgTool.h" + + +namespace CaloUtils { + + +/** + * @brief Algorithm used for testing ToolWithConstants. + */ +class ToolWithConstantsTestTool + : public CaloUtils::ToolWithConstants<AthAlgTool> +{ +public: + /// Inherit constructor. + using base_class::base_class; + + + /// Gaudi initialize method. + StatusCode initialize () override; + + + /// Gaudi execute method. + StatusCode execute (const EventContext& ctx) const; + + + /// A non-default tool version, for testing. + virtual int toolVersion() const override; + + + /// For testing writeConstants(). + void testWriteConstants (const EventContext& ctx) const; + + +private: + StringProperty m_condKey + { this, "CondKey", "", "" }; + + IntegerProperty m_runNumber + { this, "RunNumber", 284500, "" }; + + Constant<float> m_cf1 { this, "cf1", 1.5, "cf1 doc" }; + Constant<int> m_ci1 { this, "ci1", "ci1 doc" }; + Constant<bool> m_cb1 { this, "cb1", "cb1 doc" }; + Constant<CaloRec::Array<1> > m_ca1 { this, "ca1", "ca1 doc" }; + Constant<CaloRec::Array<2> > m_ca2 { this, "ca2", "ca2 doc" }; +}; + + +} // namespace CaloUtils + + +#endif // not CALOUTILS_TOOLWITHCONSTANTSTESTTOOL_H diff --git a/Calorimeter/CaloUtils/CaloUtils/exceptions.h b/Calorimeter/CaloUtils/CaloUtils/exceptions.h new file mode 100644 index 0000000000000000000000000000000000000000..914895a08fcacc9aba6bf9cc621b72ad7f0c8c0c --- /dev/null +++ b/Calorimeter/CaloUtils/CaloUtils/exceptions.h @@ -0,0 +1,120 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/exceptions.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Exceptions that can be thrown from CaloUtils. + */ + + +#ifndef CALOUTILS_EXCEPTIONS_H +#define CALOUTILS_EXCEPTIONS_H + + +#include <stdexcept> +#include <string> + + +namespace CaloUtils { + + +/** + * @brief Exception --- version mismatch for tool. + * + * The version of the constants read from COOL was larger than the + * version of the tool being used. + */ +class ExcBadToolConstantVersion + : public std::runtime_error +{ +public: + /** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being accessed. + * @param toolVersion Version of the tool. + * @param constVersion Version of the constants read from COOL. + */ + ExcBadToolConstantVersion (const std::string& toolName, + const std::string& constName, + unsigned int toolVersion, + unsigned int constVersion); +}; + + +/** + * @brief Exception --- constant not set + * + * The constant was not set from JO, not found in COOL, and has no default. + */ +class ExcConstantNotSet + : public std::runtime_error +{ +public: + /** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being accessed. + */ + ExcConstantNotSet (const std::string& toolName, + const std::string& constName); +}; + + +/** + * @brief Exception --- constant set more than once. + * + * A constant should only be set once from JO. + */ +class ExcConstantReset + : public std::runtime_error +{ +public: + /** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being set. + */ + ExcConstantReset (const std::string& toolName, + const std::string& constName); +}; + + +/** + * @brief Exception --- Bad contextless retrieve. + * + * The Constant::operator() overload that does not take a Context argument + * may be used only for constants that were initialzed from job options. + */ +class ExcBadContextlessRetrieve + : public std::runtime_error +{ +public: + /** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being retrieved. + */ + ExcBadContextlessRetrieve (const std::string& toolName, + const std::string& constName); +}; + + + +/** + * @brief Throw a CaloUtils::ExcBadContextlessRetrieve exception. + * @param toolName Name of the tool being used. + * @param constName Name of the constant being retrieved. + */ +[[noreturn]] +void throwExcBadContextlessRetrieve (const std::string& toolName, + const std::string& constName); + + +} // namespace CaloUtils + + +#endif // not CALOUTILS_EXCEPTIONS_H diff --git a/Calorimeter/CaloUtils/CaloUtils/selection.xml b/Calorimeter/CaloUtils/CaloUtils/selection.xml index c66f715df0cbb9afd3c642f97e5e04cbdcea41e5..ccaeed5f4d72e09b376d0b84484f079b6162d35d 100644 --- a/Calorimeter/CaloUtils/CaloUtils/selection.xml +++ b/Calorimeter/CaloUtils/CaloUtils/selection.xml @@ -1,4 +1,5 @@ <lcgdict> <class name="CaloClusterStoreHelper"/> <class name="CaloCellDetPos"/> + <class name="CaloUtils::ToolWithConstantsTestTool"/> </lcgdict> diff --git a/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref b/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..66128c494658b61bc0d2fa66a593528234e94828 --- /dev/null +++ b/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref @@ -0,0 +1,261 @@ +Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root +Py:MetaReader INFO Current mode used: peeker +Py:MetaReader INFO Current filenames: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root'] +Py:MetaReader INFO MetaReader is called with the parameter "unique_tag_info_values" set to True. This is a workaround to remove all duplicate values from "/TagInfo" key +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus723.cern.ch on Tue May 26 21:09:45 2020 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +PublicTool tool1 +PublicTool tool2 +CoreDumpSvc INFO install f-a-t-a-l handler... (flag = 438) +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 +PyComponentMgr INFO Initializing PyComponentMgr... +TestAlg INFO Initializing TestAlg... +ClassIDSvc INFO getRegistryEntries: read 21188 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 423 CLIDRegistry entries for module ALL +EventSelector INFO Enter McEventSelector Initialization +AthenaEventLoopMgr INFO Setup EventSelector service EventSelector +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr SUCCESS ****************************** Algorithm Sequence **************************** +ApplicationMgr SUCCESS AthSequencer/AthMasterSeq +ApplicationMgr SUCCESS AthSequencer/AthAlgEvtSeq +ApplicationMgr SUCCESS AthSequencer/AthBeginSeq +ApplicationMgr SUCCESS AthIncFirerAlg/BeginIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg1 +ApplicationMgr SUCCESS AthSequencer/AthAllAlgSeq +ApplicationMgr SUCCESS AthSequencer/AthCondSeq +ApplicationMgr SUCCESS AthSequencer/AthAlgSeq +ApplicationMgr SUCCESS PyAthena::Alg/TestAlg +ApplicationMgr SUCCESS AthSequencer/AthEndSeq +ApplicationMgr SUCCESS AthIncFirerAlg/EndIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg2 +ApplicationMgr SUCCESS AthSequencer/AthOutSeq +ApplicationMgr SUCCESS AthSequencer/AthRegSeq +ApplicationMgr SUCCESS ****************************************************************************** +ApplicationMgr INFO Application Manager Started successfully +EventPersistenc... INFO Added successfully Conversion service:McCnvSvc +AthenaEventLoopMgr INFO ===>>> start of run 284500 <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #0, run #284500 0 events processed so far <<<=== +284500 0 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 0 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 [ + [4, 5], + [10, 9], + [2.5, 1] + ] + +ToolSvc.tool2 INFO Member: m_constants +ToolSvc.tool2.ca1 = [3, 4.5, 6] +ToolSvc.tool2.cf1 = 2.5 +ToolSvc.tool2.ci1 = 10 +ToolSvc.tool2.isDummy = 0 +ToolSvc.tool2.order = 0 + +Member: m_DBconstants +ToolSvc.tool2.test.ca2 = [ + [4, 5], + [10, 9], + [2.5, 1] + ] +ToolSvc.tool2.test.cb1 = 0 + + +testMerge: CaloUtils::ToolWithConstantsTestTool 2 .test.ca1 = [3, 4.5, 6] +.test.ca2 = [ + [4, 5], + [6, 7], + [9, 8] + ] +.test.cb1 = 0 +.test.cf1 = 2.5 +.test.ci1 = 10 +.test.isDummy = 0 +.test.order = 0 + + +ToolSvc.tool1 ERROR CaloUtils/src/ToolWithConstants.cxx:112 (StatusCode CaloUtils::ToolWithConstantsImpl::mergeConstants(const std::string&, int, CaloUtils::ToolWithConstantsImpl::Context&, bool, CaloRec::ToolConstants&) const): code FAILURE: Trying to write to ToolConstants for tools of differing types: foofoo and CaloUtils::ToolWithConstantsTestTool +ToolSvc.tool1 ERROR CaloUtils/src/ToolWithConstants.cxx:118 (StatusCode CaloUtils::ToolWithConstantsImpl::mergeConstants(const std::string&, int, CaloUtils::ToolWithConstantsImpl::Context&, bool, CaloRec::ToolConstants&) const): code FAILURE: Trying to write to ToolConstants for differing versions of tool CaloUtils::ToolWithConstantsTestTool: 10 and 2 +AthenaEventLoopMgr INFO ===>>> done processing event #0, run #284500 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #1, run #284500 1 events processed so far <<<=== +284500 0 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 0 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 [ + [4, 5], + [10, 9], + [2.5, 1] + ] + +AthenaEventLoopMgr INFO ===>>> done processing event #1, run #284500 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #2, run #284500 2 events processed so far <<<=== +284500 1 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 1 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 [ + [14, 15], + [1, 19], + [12.5, 11] + ] + +AthenaEventLoopMgr INFO ===>>> done processing event #2, run #284500 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #3, run #284500 3 events processed so far <<<=== +284500 1 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 1 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 [ + [14, 15], + [1, 19], + [12.5, 11] + ] + +AthenaEventLoopMgr INFO ===>>> done processing event #3, run #284500 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #4, run #284500 4 events processed so far <<<=== +284500 2 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 ExcBadToolConstantVersion: version mismatch for tool ToolSvc.tool2 constant cb1 constant version 3 is larger than tool version 2 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 ExcBadToolConstantVersion: version mismatch for tool ToolSvc.tool2 constant ca2 constant version 3 is larger than tool version 2 +AthenaEventLoopMgr INFO ===>>> done processing event #4, run #284500 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #5, run #284500 5 events processed so far <<<=== +284500 2 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 ExcBadToolConstantVersion: version mismatch for tool ToolSvc.tool2 constant cb1 constant version 3 is larger than tool version 2 +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 ExcBadToolConstantVersion: version mismatch for tool ToolSvc.tool2 constant ca2 constant version 3 is larger than tool version 2 +AthenaEventLoopMgr INFO ===>>> done processing event #5, run #284500 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #6, run #284500 6 events processed so far <<<=== +284500 3 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 Can't find key +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 Can't find key +AthenaEventLoopMgr INFO ===>>> done processing event #6, run #284500 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #7, run #284500 7 events processed so far <<<=== +284500 3 1000 +ToolSvc.tool1 INFO m_cf1 2.5 +ToolSvc.tool1 INFO m_ci1 10 +ToolSvc.tool1 INFO m_cb1 0 +ToolSvc.tool1 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool1 INFO m_ca2 [ + [4, 5], + [6, 7], + [9, 8] + ] + +ToolSvc.tool2 INFO m_cf1 2.5 +ToolSvc.tool2 INFO m_ci1 10 +ToolSvc.tool2 INFO m_cb1 Can't find key +ToolSvc.tool2 INFO m_ca1 [3, 4.5, 6] + +ToolSvc.tool2 INFO m_ca2 Can't find key +AthenaEventLoopMgr INFO ===>>> done processing event #7, run #284500 8 events processed so far <<<=== +ApplicationMgr INFO Application Manager Stopped successfully +IncidentProcAlg1 INFO Finalize +TestAlg INFO Finalizing TestAlg... +IncidentProcAlg2 INFO Finalize +EventSelector INFO finalize +ToolSvc INFO Removing all tools created by ToolSvc +PyComponentMgr INFO Finalizing PyComponentMgr... +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully diff --git a/Calorimeter/CaloUtils/share/exceptions_test.ref b/Calorimeter/CaloUtils/share/exceptions_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..850601adb369e21829d3fc4de61637568fc13bfa --- /dev/null +++ b/Calorimeter/CaloUtils/share/exceptions_test.ref @@ -0,0 +1,6 @@ +CaloUtils/exceptions_test +test1 +ExcBadToolConstantVersion: version mismatch for tool tool constant const constant version 2 is larger than tool version 1 +ExcConstantNotSet: constant const in tool tool was not set. +ExcConstantReset: constant const in tool tool set more than once. +ExcBadContextlessRetrieve: constant const in tool tool bad contextless retrieve. diff --git a/Calorimeter/CaloUtils/src/CaloCellList.cxx b/Calorimeter/CaloUtils/src/CaloCellList.cxx index 828918fcc8cd3e21031d7f2d036a6e9854cd2439..8e857dd84d31b0781a04a9e77aaacdf6b29ee6ec 100644 --- a/Calorimeter/CaloUtils/src/CaloCellList.cxx +++ b/Calorimeter/CaloUtils/src/CaloCellList.cxx @@ -5,176 +5,179 @@ // Given an input eta,phi, deta,dphi - this class will return you // either an iterator over a list of cells (pointers) in this cone // and the total cell energy of the cells in this cone. -// (11/10/2004) Method added: returns number of strips for an input +// (11/10/2004) Method added: returns number of strips for an input // eta,phi,ncell_eta,ncell_phi. The List of cells replaced by // the Vector of cells. #include "CaloUtils/CaloCellList.h" +#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloEvent/CaloCell.h" #include "CaloEvent/CaloCellContainer.h" #include "CaloGeoHelpers/CaloSampling.h" #include "CaloGeoHelpers/proxim.h" -#include "CaloDetDescr/CaloDetDescrManager.h" + +#include <cmath> namespace { -inline -double square(double x) { return x*x; } +inline double +square(double x) +{ + return x * x; +} } -CaloCellList::CaloCellList(const CaloCellContainer* cell_container) -:m_cellcont(cell_container) - +CaloCellList::CaloCellList(const CaloCellContainer* cell_container) + : m_cellcont(cell_container) + , m_energy(0) + , m_et(0) { - m_caloNums.clear(); - //NSUBCALO indicate take them all + m_caloNums.clear(); + // NSUBCALO indicate take them all m_caloNums.push_back(CaloCell_ID::NSUBCALO); } -//specify one calo number -CaloCellList::CaloCellList(const CaloCellContainer* cell_container, const CaloCell_ID::SUBCALO caloNum) -:m_cellcont(cell_container) +// specify one calo number +CaloCellList::CaloCellList(const CaloCellContainer* cell_container, const CaloCell_ID::SUBCALO caloNum) + : m_cellcont(cell_container) + , m_energy(0) + , m_et(0) { - m_caloNums.clear(); - m_caloNums.push_back(caloNum); + m_caloNums.clear(); + m_caloNums.push_back(caloNum); } -// specify a vector of calonumber +// specify a vector of calonumber // (if all calo it is more efficient to not specify anything) -CaloCellList::CaloCellList(const CaloCellContainer* cell_container, const std::vector<CaloCell_ID::SUBCALO> & caloNums) -:m_cellcont(cell_container) +CaloCellList::CaloCellList(const CaloCellContainer* cell_container, + const std::vector<CaloCell_ID::SUBCALO>& caloNums) + : m_cellcont(cell_container) + , m_energy(0) + , m_et(0) + { - m_caloNums.clear(); - std::copy(caloNums.begin(),caloNums.end(),back_inserter(m_caloNums)); + m_caloNums.clear(); + std::copy(caloNums.begin(), caloNums.end(), back_inserter(m_caloNums)); } +CaloCellList::~CaloCellList() {} -CaloCellList::~CaloCellList() -{ } - -void CaloCellList::select(double eta,double phi,double deta,double dphi){ +void +CaloCellList::select(double eta, double phi, double deta, double dphi) +{ const CaloDetDescrManager* mgr = CaloDetDescrManager::instance(); - doSelect(*mgr,eta,phi,deta,dphi,-1); + doSelect(*mgr, eta, phi, deta, dphi, -1); } -void CaloCellList::select(double eta,double phi,double deta,double dphi,int sam){ +void +CaloCellList::select(double eta, double phi, double deta, double dphi, int sam) +{ const CaloDetDescrManager* mgr = CaloDetDescrManager::instance(); - doSelect(*mgr,eta,phi,deta,dphi, -1, static_cast<CaloCell_ID::CaloSample>(sam)); + doSelect(*mgr, eta, phi, deta, dphi, -1, static_cast<CaloCell_ID::CaloSample>(sam)); } -void CaloCellList::select(double eta,double phi,double dR){ +void +CaloCellList::select(double eta, double phi, double dR) +{ const CaloDetDescrManager* mgr = CaloDetDescrManager::instance(); - doSelect(*mgr,eta,phi,dR,dR,dR); + doSelect(*mgr, eta, phi, dR, dR, dR); } -void CaloCellList::select(double eta,double phi,double dR, int sam){ +void +CaloCellList::select(double eta, double phi, double dR, int sam) +{ const CaloDetDescrManager* mgr = CaloDetDescrManager::instance(); - doSelect(*mgr,eta,phi,dR,dR, dR, static_cast<CaloCell_ID::CaloSample>(sam)); + doSelect(*mgr, eta, phi, dR, dR, dR, static_cast<CaloCell_ID::CaloSample>(sam)); } -void CaloCellList::select(const CaloDetDescrManager& mgr, double eta,double phi,double deta,double dphi){ - doSelect(mgr,eta,phi,deta,dphi,-1); +void +CaloCellList::select(const CaloDetDescrManager& mgr, double eta, double phi, double deta, double dphi) +{ + doSelect(mgr, eta, phi, deta, dphi, -1); } -void CaloCellList::select(const CaloDetDescrManager& mgr, double eta,double phi,double deta,double dphi,int sam){ - doSelect(mgr,eta,phi,deta,dphi, -1, static_cast<CaloCell_ID::CaloSample>(sam)); +void +CaloCellList::select(const CaloDetDescrManager& mgr, + double eta, + double phi, + double deta, + double dphi, + int sam) +{ + doSelect(mgr, eta, phi, deta, dphi, -1, static_cast<CaloCell_ID::CaloSample>(sam)); } -void CaloCellList::select(const CaloDetDescrManager& mgr, double eta,double phi,double dR){ - doSelect(mgr,eta,phi,dR,dR,dR); +void +CaloCellList::select(const CaloDetDescrManager& mgr, double eta, double phi, double dR) +{ + doSelect(mgr, eta, phi, dR, dR, dR); } -void CaloCellList::select(const CaloDetDescrManager& mgr, double eta,double phi,double dR, int sam){ - doSelect(mgr,eta,phi,dR,dR, dR, static_cast<CaloCell_ID::CaloSample>(sam)); +void +CaloCellList::select(const CaloDetDescrManager& mgr, double eta, double phi, double dR, int sam) +{ + doSelect(mgr, eta, phi, dR, dR, dR, static_cast<CaloCell_ID::CaloSample>(sam)); } -void CaloCellList::doSelect(const CaloDetDescrManager& mgr, - double eta,double phi,double deta,double dphi, - double dR, - CaloCell_ID::CaloSample sam /*= CaloCell_ID::Unknown*/) +void +CaloCellList::doSelect(const CaloDetDescrManager& mgr, + double eta, + double phi, + double deta, + double dphi, + double dR, + CaloCell_ID::CaloSample sam /*= CaloCell_ID::Unknown*/) { - - m_theCellVector.clear(); - if (m_cellcont->size() == 0) return; + m_theCellVector.clear(); + m_energy = 0; + m_et = 0; + if (m_cellcont->size() == 0){ + return; + } std::vector<IdentifierHash> calo_mgr_vect; std::vector<CaloCell_ID::SUBCALO>::const_iterator itrCaloNum = m_caloNums.begin(); - std::vector<CaloCell_ID::SUBCALO>::const_iterator itrEndCaloNum = m_caloNums.end(); - - for ( ; itrCaloNum!=itrEndCaloNum ; ++itrCaloNum) { - - CaloCell_ID::SUBCALO caloNum=*itrCaloNum; - + std::vector<CaloCell_ID::SUBCALO>::const_iterator itrEndCaloNum = m_caloNums.end(); + + for (; itrCaloNum != itrEndCaloNum; ++itrCaloNum) { + CaloCell_ID::SUBCALO caloNum = *itrCaloNum; if (sam != CaloCell_ID::Unknown) { - mgr.cellsInZone(eta-deta,eta+deta,phi-dphi,phi+dphi,sam, - calo_mgr_vect); + mgr.cellsInZone(eta - deta, eta + deta, phi - dphi, phi + dphi, sam, calo_mgr_vect); itrCaloNum = itrEndCaloNum - 1; - } - else if (caloNum==CaloCell_ID::NSUBCALO) - { - mgr.cellsInZone(eta-deta,eta+deta,phi-dphi,phi+dphi, - calo_mgr_vect); - } - else if (caloNum!=CaloCell_ID::NOT_VALID) - { - mgr.cellsInZone(eta-deta,eta+deta,phi-dphi,phi+dphi,caloNum, - calo_mgr_vect); - - } - else { + } else if (caloNum == CaloCell_ID::NSUBCALO) { + mgr.cellsInZone(eta - deta, eta + deta, phi - dphi, phi + dphi, calo_mgr_vect); + } else if (caloNum != CaloCell_ID::NOT_VALID) { + mgr.cellsInZone(eta - deta, eta + deta, phi - dphi, phi + dphi, caloNum, calo_mgr_vect); + } else { continue; } - - m_theCellVector.reserve (m_theCellVector.size() + calo_mgr_vect.size()); + m_theCellVector.reserve(m_theCellVector.size() + calo_mgr_vect.size()); if (dR > 0) { - double dR2 = dR*dR; - for ( unsigned int i = 0; i<calo_mgr_vect.size(); i++ ){ - const CaloCell* cell = m_cellcont->findCell (calo_mgr_vect[i]); + double dR2 = dR * dR; + for (unsigned int i = 0; i < calo_mgr_vect.size(); i++) { + const CaloCell* cell = m_cellcont->findCell(calo_mgr_vect[i]); if (cell) { double pphi = proxim(cell->phi(), phi); - if (square(eta - cell->eta()) + square(pphi - phi) < dR2) + if (square(eta - cell->eta()) + square(pphi - phi) < dR2) { m_theCellVector.push_back(cell); + m_energy += cell->energy(); + m_et += cell->et(); + } } } - } - else { - for ( unsigned int i = 0; i<calo_mgr_vect.size(); i++ ){ - const CaloCell* cell = m_cellcont->findCell (calo_mgr_vect[i]); + } else { + for (unsigned int i = 0; i < calo_mgr_vect.size(); i++) { + const CaloCell* cell = m_cellcont->findCell(calo_mgr_vect[i]); if (cell) { double pphi = proxim(cell->phi(), phi); - if (fabs(eta-cell->eta()) < deta && fabs(phi-pphi) < dphi) + if (std::fabs(eta - cell->eta()) < deta && std::fabs(phi - pphi) < dphi) { m_theCellVector.push_back(cell); + m_energy += cell->energy(); + m_et += cell->et(); + } } } } - } // end loop on calorimeters } - - -double CaloCellList::energy() const -{ - list_iterator first = m_theCellVector.begin(); - list_iterator last = m_theCellVector.end(); - double etot = 0; - - for (; first!=last; ++first) - { - etot += (*first)->energy(); - } - return etot; -} - -double CaloCellList::et() const -{ - list_iterator first = m_theCellVector.begin(); - list_iterator last = m_theCellVector.end(); - double etot = 0; - - for (; first!=last; ++first) - { - etot += (*first)->et(); - } - return etot; -} diff --git a/Calorimeter/CaloUtils/src/ToolWithConstants.cxx b/Calorimeter/CaloUtils/src/ToolWithConstants.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d84ebd38d8fb67c2059d971a3e68320e03d05ce6 --- /dev/null +++ b/Calorimeter/CaloUtils/src/ToolWithConstants.cxx @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/src/ToolWithConstants.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Hold constants for a tool. Out-of-line implementations. + */ + + +#include "CaloUtils/ToolWithConstants.h" + + +namespace CaloUtils { + + +/** + * @brief Constructor + * @param toolName Name of the tool. + * @param prefix Constant prefix in COOL. + * @param DBHandle Handle key for the conditions object. + */ +ToolWithConstantsImpl::ToolWithConstantsImpl + (const std::string& toolName, + const std::string& prefix, + SG::ReadCondHandleKey<CaloRec::ToolConstants>& DBHandle) + : m_toolName (toolName), + m_prefix (prefix), + m_DBHandle (DBHandle) +{ +} + + +/** + * @brief Initialize. + */ +StatusCode ToolWithConstantsImpl::initialize() +{ + ATH_CHECK( m_DBHandle.initialize (SG::AllowEmpty) ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Create a @c Context object. + * + * This can then be passed to @c Constant::operator(). + */ +ToolWithConstantsImpl::Context +ToolWithConstantsImpl::context (const EventContext& ctx) const +{ + const CaloRec::ToolConstants* constants = nullptr; + if (!m_DBHandle.empty()) { + SG::ReadCondHandle<CaloRec::ToolConstants> consts (m_DBHandle, ctx); + constants = consts.retrieve(); + } + return Context (constants, ctx); +} + + +/** + * @brief Add a new constant to the tool. + * @param c Constant to add. + */ +void ToolWithConstantsImpl::addConstant (IToolConstant* c) +{ + m_declaredConstants.push_back (c); +} + + +/** + * @brief Dump method (for debugging) + * @param stream Ostream to which to write. + * @param name Name to go in output + * @param ctx Event context. + */ +void ToolWithConstantsImpl::writeConstants (std::ostream& stream, + const std::string& name, + const EventContext& ctx) const +{ + stream << "Member: m_constants" << std::endl; + m_constants.writeConstants (stream,name); + if (!m_DBHandle.empty()) { + SG::ReadCondHandle<CaloRec::ToolConstants> consts (m_DBHandle, ctx); + stream << "Member: m_DBconstants" << std::endl; + consts->writeConstants (stream,name); + } +} + + +/** + * @brief Merge our constants into @c out with the proper prefix. + * @param typeName Name of the type of the tool. + * @param toolVersion Version of the tool. + * @param myctx Internal Context structure. + * @param isDummy isDummy constant from the tool + * @param[out] out Object to receive our constants. + */ +StatusCode +ToolWithConstantsImpl::mergeConstants (const std::string& typeName, + int toolVersion, + Context& myctx, + bool isDummy, + CaloRec::ToolConstants& out) const +{ + if (out.clsname().empty()) { + out.clsname (typeName); + out.version (toolVersion); + } + else if (out.clsname() != typeName) { + REPORT_ERROR_WITH_CONTEXT(StatusCode::FAILURE, m_toolName) + << "Trying to write to ToolConstants for tools of differing types: " + << out.clsname() << " and " << typeName; + return StatusCode::FAILURE; + } + else if (out.version() != toolVersion) { + REPORT_ERROR_WITH_CONTEXT(StatusCode::FAILURE, m_toolName) + << "Trying to write to ToolConstants for differing versions of tool " + << out.clsname() << ": " << out.version() << " and " << toolVersion; + return StatusCode::FAILURE; + } + + for (IToolConstant* c : m_declaredConstants) { + std::string cname = c->name(); + std::string prefname = this->m_prefix + cname; + const CaloRec::Arrayrep* rep = nullptr; + if (m_constants.hasrep (cname)) { + rep = &m_constants.getrep (m_toolName, cname); + } + if (!c->setFromJO() && + myctx.m_constants && + myctx.m_constants->hasrep (prefname)) + { + rep = &myctx.m_constants->getrep (m_toolName, prefname); + } + if (!rep) { + throw ExcConstantNotSet (m_toolName, cname); + } + + if (!isDummy || cname == "isDummy") + out.setrep (this->m_prefix + cname, *rep); + } + return StatusCode::SUCCESS; +} + + +} // namespace CaloUtils diff --git a/Calorimeter/CaloUtils/src/ToolWithConstantsTestTool.cxx b/Calorimeter/CaloUtils/src/ToolWithConstantsTestTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7bc528485aa635c1d85ba2658f0789a479594d6d --- /dev/null +++ b/Calorimeter/CaloUtils/src/ToolWithConstantsTestTool.cxx @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/src/ToolWithConstantsTestTool.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Algorithm used for testing ToolWithConstants. + */ + + +#include "CaloUtils/ToolWithConstantsTestTool.h" +#include "StoreGate/StoreGateSvc.h" +#include "AthenaKernel/IRCUSvc.h" +#include "AthenaKernel/ClassID_traits.h" +#include "GaudiKernel/ServiceHandle.h" + + +namespace CaloUtils { + + +/** + * @brief Gaudi initialize method. + * + * Make some ToolConstants conditions objects for testing. + */ +StatusCode +ToolWithConstantsTestTool::initialize() +{ + ATH_CHECK( base_class::initialize() ); + if (m_condKey.empty()) { + return StatusCode::SUCCESS; + } + + ServiceHandle<StoreGateSvc> condStore ("ConditionStore", name()); + ATH_CHECK( condStore.retrieve() ); + + ServiceHandle<Athena::IRCUSvc> rcusvc ("Athena::RCUSvc", name()); + ATH_CHECK( rcusvc.retrieve() ); + + typedef CondCont<CaloRec::ToolConstants> CondCont_t; + DataObjID id (ClassID_traits<CondCont_t>::ID(), m_condKey); + auto cc = std::make_unique<CondCont_t> (*rcusvc.get(), id); + + auto lbn = [&](int l) { return EventIDBase (m_runNumber, + EventIDBase::UNDEFEVT, + EventIDBase::UNDEFNUM, + EventIDBase::UNDEFNUM, + l); }; + auto range = [&](int l1, int l2) { return EventIDRange (lbn(l1), lbn(l2)); }; + + { + auto tc = std::make_unique<CaloRec::ToolConstants>(); + tc->version (2); + tc->clsname (name()); + tc->newrep (name(), "test.cb1", "0"); + tc->newrep (name(), "test.ca2", "[[4, 5], [10, 9], [2.5, 1]]"); + ATH_CHECK( cc->insert (range(0, 1), std::move (tc)) ); + } + + { + auto tc = std::make_unique<CaloRec::ToolConstants>(); + tc->version (2); + tc->clsname (name()); + tc->newrep (name(), "test.cb1", "1"); + tc->newrep (name(), "test.ca1", "[10, 9, 8, 7]"); + tc->newrep (name(), "test.ca2", "[[14, 15], [1, 19], [12.5, 11]]"); + ATH_CHECK( cc->insert (range(1, 2), std::move (tc)) ); + } + + { + auto tc = std::make_unique<CaloRec::ToolConstants>(); + tc->version (3); + tc->clsname (name()); + tc->newrep (name(), "test.cb1", "1"); + tc->newrep (name(), "test.caa", "[10, 9, 8, 7]"); + tc->newrep (name(), "test.ca2", "[[14, 15], [1, 19], [12.5, 11]]"); + ATH_CHECK( cc->insert (range(2, 3), std::move (tc)) ); + } + + { + auto tc = std::make_unique<CaloRec::ToolConstants>(); + tc->version (2); + tc->clsname (name()); + ATH_CHECK( cc->insert (range(3, 4), std::move (tc)) ); + } + + ATH_CHECK( condStore->record (std::move (cc), m_condKey) ); + + return StatusCode::SUCCESS; +} + + +/** + * @brief Gaudi execute method. + * + * Dump out current values of the constants. + */ +StatusCode +ToolWithConstantsTestTool::execute (const EventContext& ctx) const +{ + Context myctx = context (ctx); +#define CHECKCONST(V) \ + do { \ + try { \ + auto val = V (myctx); \ + ATH_MSG_INFO (#V << " " << val); \ + } \ + catch (const std::exception& e) { \ + ATH_MSG_INFO (#V << " " << e.what()); \ + } \ + } while(0) + CHECKCONST (m_cf1); + CHECKCONST (m_ci1); + CHECKCONST (m_cb1); + CHECKCONST (m_ca1); + CHECKCONST (m_ca2); + return StatusCode::SUCCESS; +} + + +/** + * @brief A non-default tool version, for testing. + */ +int ToolWithConstantsTestTool::toolVersion() const +{ + return 2; +} + + +/** + * @brief For testing writeConstants(). + */ +void ToolWithConstantsTestTool::testWriteConstants (const EventContext& ctx) const +{ + std::ostringstream ss; + this->writeConstants (ss, name(), ctx); + ATH_MSG_INFO (ss.str()); +} + + +} // namespace CaloUtils diff --git a/Calorimeter/CaloUtils/src/components/CaloUtils_entries.cxx b/Calorimeter/CaloUtils/src/components/CaloUtils_entries.cxx index bcbef33f5ff2af64a2b8a5d8044ba054cfcaa101..8a66152ada32aef0958d31e9c74975dfe33dc353 100644 --- a/Calorimeter/CaloUtils/src/components/CaloUtils_entries.cxx +++ b/Calorimeter/CaloUtils/src/components/CaloUtils_entries.cxx @@ -9,6 +9,7 @@ #include "CaloUtils/xAODClusterCompressor.h" #include "../CaloTowerStoreTestAlg.h" #include "../CaloTowerBuilderToolTestAlg.h" +#include "CaloUtils/ToolWithConstantsTestTool.h" DECLARE_COMPONENT( CaloCellWeightCorrection ) @@ -23,4 +24,5 @@ DECLARE_COMPONENT( xAODClusterCompressor ) DECLARE_COMPONENT( CaloTowerStoreTestAlg ) DECLARE_COMPONENT( CaloTowerBuilderToolTestAlg ) +DECLARE_COMPONENT( CaloUtils::ToolWithConstantsTestTool ) diff --git a/Calorimeter/CaloUtils/src/exceptions.cxx b/Calorimeter/CaloUtils/src/exceptions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6fc62ad94ea1ceb64064001179c5b4ecaa5f0a79 --- /dev/null +++ b/Calorimeter/CaloUtils/src/exceptions.cxx @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file CaloUtils/src/exceptions.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Exceptions that can be thrown from CaloUtils. + */ + + +#include "CaloUtils/exceptions.h" +#include <sstream> + + +namespace CaloUtils { + + +/// Helper: Format exception string. +std::string excBadToolConstantVersion_format (const std::string& toolName, + const std::string& constName, + unsigned int toolVersion, + unsigned int constVersion) +{ + std::ostringstream os; + os << "ExcBadToolConstantVersion: version mismatch for tool " << toolName + << " constant " << constName + << " constant version " << constVersion + << " is larger than tool version " << toolVersion; + return os.str(); +} + + +/** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being accessed. + * @param toolVersion Version of the tool. + * @param constVersion Version of the constants read from COOL. + */ +ExcBadToolConstantVersion::ExcBadToolConstantVersion + (const std::string& toolName, + const std::string& constName, + unsigned int toolVersion, + unsigned int constVersion) + : std::runtime_error (excBadToolConstantVersion_format (toolName, + constName, + toolVersion, + constVersion)) +{ +} + + +//************************************************************************* + + +/// Helper: Format exception string. +std::string excConstantNotSet_format (const std::string& toolName, + const std::string& constName) +{ + std::ostringstream os; + os << "ExcConstantNotSet: constant " << constName << " in tool " << toolName + << " was not set."; + return os.str(); +} + + +/** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being accessed. + */ +ExcConstantNotSet::ExcConstantNotSet + (const std::string& toolName, + const std::string& constName) + : std::runtime_error (excConstantNotSet_format (toolName, + constName)) +{ +} + + +//************************************************************************* + + +/// Helper: Format exception string. +std::string excConstantReset_format (const std::string& toolName, + const std::string& constName) +{ + std::ostringstream os; + os << "ExcConstantReset: constant " << constName << " in tool " << toolName + << " set more than once."; + return os.str(); +} + + +/** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being set. + */ +ExcConstantReset::ExcConstantReset + (const std::string& toolName, + const std::string& constName) + : std::runtime_error (excConstantReset_format (toolName, + constName)) +{ +} + + +//************************************************************************* + + +/// Helper: Format exception string. +std::string excBadContextlessRetrieve_format (const std::string& toolName, + const std::string& constName) +{ + std::ostringstream os; + os << "ExcBadContextlessRetrieve: constant " << constName << " in tool " << toolName + << " bad contextless retrieve."; + return os.str(); +} + + +/** + * @brief Constructor + * @param toolName Name of the tool being used. + * @param constName Name of the constant being retrieved. + */ +ExcBadContextlessRetrieve::ExcBadContextlessRetrieve + (const std::string& toolName, + const std::string& constName) + : std::runtime_error (excBadContextlessRetrieve_format (toolName, + constName)) +{ +} + + + +/** + * @brief Throw a CaloUtils::ExcBadContextlessRetrieve exception. + * @param toolName Name of the tool being used. + * @param constName Name of the constant being retrieved. + */ +void throwBadExcContextlessRetrieve (const std::string& toolName, + const std::string& constName) +{ + throw ExcBadContextlessRetrieve (toolName, constName); +} + + +} // namespace CaloUtils diff --git a/Calorimeter/CaloUtils/test/ToolWithConstants_test.py b/Calorimeter/CaloUtils/test/ToolWithConstants_test.py new file mode 100755 index 0000000000000000000000000000000000000000..01951871be1a8156a95a881e74933d229d5a207c --- /dev/null +++ b/Calorimeter/CaloUtils/test/ToolWithConstants_test.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. +# +# File: CaloRec/python/ToolWithConstants_test.py +# Author: scott snyder +# Date: Apr, 2020 +# Brief: Test for ToolWithConstants. +# + +from __future__ import print_function + + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaPython.PyAthenaComps import Alg, StatusCode +from AthenaConfiguration.ComponentFactory import CompFactory +import sys +import ROOT + + +class TestAlg (Alg): + def initialize (self): + toolh = ROOT.ToolHandle(ROOT.CaloUtils.ToolWithConstantsTestTool) + self.tool1 = toolh ('CaloUtils::ToolWithConstantsTestTool/tool1') + if not self.tool1.retrieve(): + return StatusCode.Failure + self.tool2 = toolh ('CaloUtils::ToolWithConstantsTestTool/tool2') + if not self.tool2.retrieve(): + return StatusCode.Failure + return StatusCode.Success + def execute (self): + ctx = self.getContext() + print (ctx.eventID().run_number(), ctx.eventID().lumi_block(), + ctx.eventID().time_stamp()) + sys.stdout.flush() + self.tool1.execute (ctx).ignore() + self.tool2.execute (ctx).ignore() + + if ctx.evt() == 0: + self.tool2.testWriteConstants (ctx) + self.testMerge (ctx) + + return StatusCode.Success + + + def testMerge (self, ctx): + tc = ROOT.CaloRec.ToolConstants() + assert self.tool1.mergeConstants (tc, ctx).isSuccess() + print ('testMerge: ', tc.clsname(), tc.version(), tc.toString ('')) + sys.stdout.flush() + + tc = ROOT.CaloRec.ToolConstants() + tc.clsname ('foofoo') + assert self.tool1.mergeConstants (tc, ctx).isFailure() + + tc = ROOT.CaloRec.ToolConstants() + tc.clsname ('CaloUtils::ToolWithConstantsTestTool') + tc.version (10) + assert self.tool1.mergeConstants (tc, ctx).isFailure() + return + + +def testCfg (configFlags): + result = ComponentAccumulator() + + tool1 = CompFactory.CaloUtils.ToolWithConstantsTestTool \ + ('tool1', + prefix = 'test.', + cf1 = 2.5, + ci1 = 10, + cb1 = False, + ca1 = "[3, 4.5, 6]", + ca2 = "[[4, 5], [6, 7], [9, 8]]") + result.addPublicTool (tool1) + + tool2 = CompFactory.CaloUtils.ToolWithConstantsTestTool \ + ('tool2', + CondKey = 'test2Cond', + DBHandleKey = 'test2Cond', + prefix = 'test.', + cf1 = 2.5, + ci1 = 10, + ca1 = "[3, 4.5, 6]") + result.addPublicTool (tool2) + + result.addEventAlgo (TestAlg ('TestAlg')) + return result + + +from AthenaCommon.Configurable import Configurable +Configurable.configurableRun3Behavior=1 +from AthenaConfiguration.AllConfigFlags import ConfigFlags +from AthenaConfiguration.TestDefaults import defaultTestFiles + +ConfigFlags.Input.Files = defaultTestFiles.RDO +ConfigFlags.addFlag("Input.InitialTimeStamp", 1000) + +ConfigFlags.lock() +from AthenaConfiguration.MainServicesConfig import MainServicesCfg +acc=MainServicesCfg (ConfigFlags) + +from McEventSelector.McEventSelectorConfig import McEventSelectorCfg +acc.merge (McEventSelectorCfg (ConfigFlags, EventsPerLB = 2)) + +acc.merge (testCfg (ConfigFlags)) +acc.run(8) diff --git a/Calorimeter/CaloUtils/test/exceptions_test.cxx b/Calorimeter/CaloUtils/test/exceptions_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..eeca1893378dc0f70a93231cd90c6f813dc873c8 --- /dev/null +++ b/Calorimeter/CaloUtils/test/exceptions_test.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file CaloUtils/test/exceptions_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2020 + * @brief Regression tests for exceptions. + */ + +#undef NDEBUG +#include "CaloUtils/exceptions.h" +#include <iostream> + + +void test1() +{ + std::cout << "test1\n"; + + std::cout << CaloUtils::ExcBadToolConstantVersion ("tool", "const", 1, 2).what() << "\n"; + + std::cout << CaloUtils::ExcConstantNotSet ("tool", "const").what() << "\n"; + + std::cout << CaloUtils::ExcConstantReset ("tool", "const").what() << "\n"; + std::cout << CaloUtils::ExcBadContextlessRetrieve ("tool", "const").what() << "\n"; +} + + +int main() +{ + std::cout << "CaloUtils/exceptions_test\n"; + test1(); + return 0; +} diff --git a/Control/AthenaCommon/CMakeLists.txt b/Control/AthenaCommon/CMakeLists.txt index 43006ac420060436f451227ff1a7a25dd3501e87..a8197ba6b870b417f1078aeecae63cf517a52e8f 100644 --- a/Control/AthenaCommon/CMakeLists.txt +++ b/Control/AthenaCommon/CMakeLists.txt @@ -13,7 +13,7 @@ atlas_install_python_modules( python/*.py python/Utils POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/Preparation.py share/Execution.py share/Atlas.UnixStandardJob.py test/*.py share/zeroJO.py share/Atlas_Gen.UnixStandardJob.py share/MemTraceInclude.py share/runbatch.py) -atlas_install_scripts( share/athena.py share/athena3.py share/athena_preload.sh share/chappy.py share/find_cfg_dups.py share/test_cfg_pickling.py ) +atlas_install_scripts( share/athena.py share/athena3.py share/athena_preload.sh share/chappy.py share/find_cfg_dups.py share/test_cfg_pickling.py share/ThinCAWrapper.sh) atlas_install_runtime(share/*.pkl) # Aliases: diff --git a/Control/AthenaCommon/python/CFElements.py b/Control/AthenaCommon/python/CFElements.py index 03c46d4f82fa3986457a7015710379afdcf7a238..df7e9e47a92ce2926fcee1756df14b28a6dfcc72 100755 --- a/Control/AthenaCommon/python/CFElements.py +++ b/Control/AthenaCommon/python/CFElements.py @@ -154,6 +154,9 @@ def findAlgorithm( startSequence, nameToLookFor, depth = 1000000 ): return None def findAllAlgorithms(sequence, nameToLookFor=None): + """ + Returns flat listof of all algorithm instances in this, and in sub-sequences + """ algorithms = [] for child in getSequenceChildren(sequence): if isSequence(child): @@ -165,7 +168,14 @@ def findAllAlgorithms(sequence, nameToLookFor=None): def findAllAlgorithmsByName(sequence, namesToLookFor=None): - """Finds all algorithms in sequence and groups them by name""" + """ + Finds all algorithms in sequence and groups them by name + + Resulting dict has a following structure + {"Alg1Name":(Alg1Instance, parentSequence, indexInThisSequence), + "Alg2Name":(Alg2Instance, parentSequence, indexInThisSequence), + ....} + """ algorithms = collections.defaultdict(list) for idx, child in enumerate(getSequenceChildren(sequence)): if (compName(child) == compName(sequence)): diff --git a/Control/AthenaCommon/share/ThinCAWrapper.sh b/Control/AthenaCommon/share/ThinCAWrapper.sh new file mode 100755 index 0000000000000000000000000000000000000000..83c1c43fd63fef487287e45d73d638349bb6cafe --- /dev/null +++ b/Control/AthenaCommon/share/ThinCAWrapper.sh @@ -0,0 +1,73 @@ +#!/bin/sh +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# Thin wrapper to execute configurations with the CA. +# Might be called from athena.py +# + + +#otherargs is set if we are sourced from inside athena.py +#if not yet set, resort of reguar CL arguments +if [ -z ${otherargs+x} ] + then + otherargs=${@} +fi + + +#Separate the top-level python script (ending with .py) from +#arguments passed to that script +scriptargs="" +for a in $otherargs +do + case "$a" in + *.py) topscriptfile=$a;; + *) scriptargs="$scriptargs $a";; + esac +done + +#Check if we got a top-level script +#Improve: Check if there is exactly one! +if [ -z ${topscriptfile} ] + then + echo "ERROR: No top-level python script given" + exit 1 +fi + +#Assemble the search path for top-level jobOption files. +#Search the local directoy, a possible WorkDir and the installed Athena +#Note: We could also search $PYTHONPATH but that's a much longer list +topScriptSearchPath="." + +if [ ! -z "${WorkDir_DIR}" ] + then + topScriptSearchPath="$topScriptSearchPath $WorkDir_DIR_DIR/python" +fi + +if [ ! -z "${Athena_DIR}" ] + then + topScriptSearchPath="$topScriptSearchPath $Athena_DIR/python" +fi + +#Now search for the top-level script: +for pp in $topScriptSearchPath +do + if [ -f "$pp/$topscriptfile" ] + then + topscript="$pp/$topscriptfile" + break + fi +done + + +if [[ -z $topscript ]]; + then + echo "Could not find python script $topscriptfile" + exit 1 +fi + +#Finally: Execute it! +python $topscript $scriptargs + + + diff --git a/Control/AthenaCommon/share/athena.py b/Control/AthenaCommon/share/athena.py index 1cc99b8102a5f5f78df4a64fff8b78c52062fb44..4efe84d8b7477633b8a8cbbc6a01c9fed6192dcb 100755 --- a/Control/AthenaCommon/share/athena.py +++ b/Control/AthenaCommon/share/athena.py @@ -9,7 +9,8 @@ # defaults export USETCMALLOC=0 export USEIMF=0 - +USECA=0 +otherargs="" # but use tcmalloc by default if TCMALLOCDIR is defined if [ -n "$TCMALLOCDIR" ]; then export USETCMALLOC=1 @@ -27,12 +28,20 @@ do --imf) USEIMF=1;; --preloadlib*) export ATHENA_ADD_PRELOAD=${a#*=};; --drop-and-reload) export ATHENA_DROP_RELOAD=1;; + --CA) USECA=1;; + *) otherargs="$otherargs $a";; esac done # Do the actual preloading via LD_PRELOAD source `which athena_preload.sh ` +if [ $USECA -eq 1 ] +then + source `which ThinCAWrapper.sh` + exit 0 +fi + # Now resurrect ourselves as python script python_path=`which python` "exec" "$python_path" "-tt" "$0" "$@"; diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py index 064cb5301a14adae47d1b77815ccb7cd62321bf3..12ba8defa33909d35452297b1cd08a64a7c246b8 100644 --- a/Control/AthenaConfiguration/python/AthConfigFlags.py +++ b/Control/AthenaConfiguration/python/AthConfigFlags.py @@ -262,18 +262,56 @@ class AthConfigFlags(object): f.get(self) return - - def fillFromArgs(self,listOfArgs=None): + # scripts calling AthConfigFlags.fillFromArgs can extend this parser, and pass their version to fillFromArgs + def getArgumentParser(self): + import argparse + parser= argparse.ArgumentParser() + parser.add_argument("-d","--debug",default=None,help="attach debugger (gdb) before run, <stage>: conf, init, exec, fini") + parser.add_argument("--evtMax",type=int,default=None,help="Max number of events to process") + parser.add_argument("--skipEvents",type=int,default=None,help="Number of events to skip") + parser.add_argument("--filesInput",default=None,help="Input file(s)") + parser.add_argument("-l", "--loglevel",default=None,help="logging level (ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, or FATAL") + return parser + + # parser argument must be an ArgumentParser returned from getArgumentParser() + def fillFromArgs(self,listOfArgs=None,parser=None): """ - Expects a list of strings of key=value pairs representing configuration flags. + Used to set flags from command-line parameters, like ConfigFlags.fillFromArgs(sys.argv[1:]) """ + import sys + if parser is None: + parser = self.getArgumentParser() + (args,leftover)=parser.parse_known_args(listOfArgs or sys.argv[1:]) + + #First, handle athena.py-like arguments: + + if args.debug: + from AthenaCommon.Debugging import DbgStage + if args.debug not in DbgStage.allowed_values: + raise ValueError("Unknown debug stage, allowed values {}".format(DbgStage.allowed_values)) + self.Exec.DebugStage=args.debug + + if args.evtMax: + self.Exec.MaxEvents=args.evtMax + + if args.skipEvents: + self.Exec.SkipEvents=args.skipEvents + + if args.filesInput: + self.Input.Files=args.filesInput.split(",") - if listOfArgs is None: - import sys - listOfArgs=sys.argv[1:] + if args.loglevel: + from AthenaCommon import Constants + if hasattr(Constants,args.loglevel): + self.Exec.OutputLevel=getattr(Constants,args.loglevel) + else: + raise ValueError("Unknown log-level, allowed values are ALL, VERBOSE, DEBUG,INFO, WARNING, ERROR, FATAL") + + #All remaining arguments are assumed to be key=value pairs to set arbitrary flags: + - for arg in listOfArgs: + for arg in leftover: #Safety check on arg: Contains exactly one '=' and left side is a valid flag argsplit=arg.split("=") if len(argsplit)!=2: @@ -283,7 +321,6 @@ class AthConfigFlags(object): if not self.hasFlag(key): raise KeyError("{} is not a known configuration flag".format( key ) ) - value=argsplit[1].strip() try: @@ -404,6 +441,30 @@ class TestOverwriteFlags(TestFlagsSetupDynamic): copyf.dump() print("") +class flagsFromArgsTest(unittest.TestCase): + def setUp(self): + self.flags = AthConfigFlags() + self.flags.addFlag('Exec.OutputLevel',3) #Global Output Level + self.flags.addFlag('Exec.MaxEvents',-1) + self.flags.addFlag("Exec.SkipEvents",0) + self.flags.addFlag("Exec.DebugStage","") + self.flags.addFlag('Input.Files',[]) + self.flags.addFlag('detA.flagB',0) + + def runTest(self): + argline="-l VERBOSE --debug exec --evtMax=10 --skipEvents=3 --filesInput=bla1.data,bla2.data detA.flagB=7" + print ("Interpreting arguments:") + print (argline) + self.flags.fillFromArgs(argline.split()) + self.assertEqual(self.flags.Exec.OutputLevel,1,"Failed to set output level from args") + self.assertEqual(self.flags.Exec.MaxEvents,10,"Failed to set MaxEvents from args") + self.assertEqual(self.flags.Exec.SkipEvents,3,"Failed to set SkipEvents from args") + self.assertEqual(self.flags.Exec.DebugStage,"exec","Failed to set DebugStage from args") + self.assertEqual(self.flags.Input.Files,["bla1.data","bla2.data"],"Failed to set FileInput from args") + self.assertEqual(self.flags.detA.flagB,7,"Failed to set arbitrary from args") + + + if __name__ == "__main__": suite = unittest.TestSuite() suite.addTest(TestAccess()) diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index c9f564fb9ba789a03c7a7720550e13218af72af7..50d4323dcf812bcf1b01354d493b05fa26745161 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -9,7 +9,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.Debugging import DbgStage import GaudiKernel.GaudiHandles as GaudiHandles - +import GaudiConfig2 from AthenaConfiguration.Deduplication import deduplicate, DeduplicationFailed import collections @@ -34,7 +34,7 @@ def printProperties(msg, c, nestLevel = 0): continue propval=getattr(c,propname) # Ignore empty lists - if propval==[]: + if isinstance(propval,GaudiConfig2.semantics._ListHelper) and propval.data is None: continue # Printing EvtStore could be relevant for Views? if propname in ["DetStore","EvtStore"]: @@ -442,7 +442,9 @@ class ComponentAccumulator(object): return self._primarySvc else: return self.__getOne( self._services, name, "Services") - + + def getAppProps(self): + return self._theAppProps def setAppProperty(self,key,value,overwrite=False): if (overwrite or key not in (self._theAppProps)): @@ -729,6 +731,7 @@ class ComponentAccumulator(object): pt.name="ToolSvc."+pt.name addCompToJos(pt) pass + sys.stdout.flush() return app @@ -957,7 +960,7 @@ def appendCAtoAthena(ca): _log.info( "Merging of CA to global ..." ) - from AthenaCommon.AppMgr import ServiceMgr,ToolSvc,athCondSeq,athOutSeq,athAlgSeq,topSequence + from AthenaCommon.AppMgr import ServiceMgr,ToolSvc,theApp,athCondSeq,athOutSeq,athAlgSeq,topSequence if len(ca.getServices()) != 0: _log.info( "Merging services" ) for comp in ca.getServices(): @@ -976,6 +979,23 @@ def appendCAtoAthena(ca): instance = conf2toConfigurable( comp, indent=" " ) ToolSvc += instance + if len( ca.getAppProps() ) != 0: + _log.info( "Merging ApplicationMgr properties" ) + for (propName, propValue) in six.iteritems(ca.getAppProps()): + # Same logic as in ComponentAccumulator.setAppProperty() + if not hasattr(theApp, propName): + setattr(theApp, propName, propValue) + else: + origPropValue = getattr(theApp, propName) + if origPropValue == propValue: + _log.debug("ApplicationMgr property '%s' already set to '%s'.", propName, propValue) + elif isinstance(origPropValue, collections.Sequence) and not isinstance(origPropValue, str): + propValue = unifySet(origPropValue, propValue) + _log.info("ApplicationMgr property '%s' already set to '%s'. Overwriting with %s", propName, origPropValue, propValue) + setattr(theApp, propName, propValue) + else: + raise DeduplicationFailed("ApplicationMgr property %s set twice: %s and %s" % (propName, origPropValue, propValue)) + _log.info( "Merging sequences and algorithms" ) from AthenaCommon.CFElements import findSubSequence @@ -1011,12 +1031,12 @@ def appendCAtoAthena(ca): merged = False for pre in preconfigured: if seq.getName() == pre.getName(): - _log.info( "{}found sequence {} to have the same name as predefined {}".format( __indent(), seq.getName(), pre ) ) + _log.info( "{}found sequence {} to have the same name as predefined {}".format( __indent(), seq.getName(), pre.getName() ) ) __mergeSequences( pre, seq ) merged = True break if findSubSequence( pre, seq.name ): - _log.info( "{}found sequence {} in predefined {}".format( __indent(), seq.getName(), pre ) ) + _log.info( "{}found sequence {} in predefined {}".format( __indent(), seq.getName(), pre.getName() ) ) __mergeSequences( pre, seq ) merged = True break diff --git a/Control/AthenaExamples/AthAsgExUnittest/CMakeLists.txt b/Control/AthenaExamples/AthAsgExUnittest/CMakeLists.txt index d48708fdea2b1bff398c8155daafd59e18cb95b4..0a3ab24abf76c7dd7e745a7f4a2d17b2be162adb 100644 --- a/Control/AthenaExamples/AthAsgExUnittest/CMakeLists.txt +++ b/Control/AthenaExamples/AthAsgExUnittest/CMakeLists.txt @@ -1,6 +1,6 @@ # -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # ################################################################################ @@ -37,7 +37,7 @@ atlas_add_test( gt_AthAsgExUnittest atlas_add_test( gt_AthExUnittest SOURCES test/gt_AthExUnittest.cxx - LINK_LIBRARIES GaudiKernel GoogleTestTools AthenaBaseComps ) + LINK_LIBRARIES GaudiKernel GoogleTestTools AthenaBaseComps AsgTools ) atlas_add_test( gt_MockxAODJet SOURCES test/gt_MockxAODJet.cxx diff --git a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx index ae0382c34cbbfbea747ea785b2343ce08cfa04c6..5c46484f21e9407f51ba01b1eaaa1fbe604191de 100644 --- a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx +++ b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx @@ -65,9 +65,6 @@ StatusCode AthenaSharedMemoryTool::initialize() { ATH_MSG_FATAL("Cannot get IncidentSvc"); return(StatusCode::FAILURE); } - std::ostringstream pidstr; - pidstr << getpid(); - m_sharedMemory.setValue(m_sharedMemory.value() + std::string("_") + pidstr.str()); return(StatusCode::SUCCESS); } @@ -114,6 +111,7 @@ StatusCode AthenaSharedMemoryTool::makeServer(int num) { m_num = num; m_isServer = true; ATH_MSG_DEBUG("Creating shared memory object with name \"" << m_sharedMemory.value() << "\""); + boost::interprocess::shared_memory_object::remove(m_sharedMemory.value().c_str()); boost::interprocess::shared_memory_object shm(boost::interprocess::create_only, m_sharedMemory.value().c_str(), boost::interprocess::read_write); diff --git a/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx b/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0230a7147fbde7b455b2c6d08b20ce1aa4e7b3d2 --- /dev/null +++ b/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** @file AthenaSharedWriter.cxx + * @brief This file contains the implementation for the AthenaSharedWriter class. + * @author Peter van Gemmeren <gemmeren@anl.gov> + **/ + +#include "AthenaBaseComps/AthCnvSvc.h" +#include "AthenaKernel/IDataShare.h" + +#include "AthenaSharedWriter.h" + +//___________________________________________________________________________ +AthenaSharedWriter::AthenaSharedWriter(const std::string& name, ISvcLocator* pSvcLocator) + : AthFilterAlgorithm(name, pSvcLocator) , m_cnvSvc(nullptr) { +} +//___________________________________________________________________________ +AthenaSharedWriter::~AthenaSharedWriter() { +} +//___________________________________________________________________________ +StatusCode AthenaSharedWriter::initialize() { + ATH_MSG_INFO("in initialize()"); + + StatusCode sc = serviceLocator()->service("AthenaPoolCnvSvc", m_cnvSvc); + if (sc.isFailure() || m_cnvSvc == nullptr) { + ATH_MSG_FATAL("Could not retrieve AthenaPoolCnvSvc"); + return StatusCode::FAILURE; + } + // Use IDataShare to make ConversionSvc a Share Server + IDataShare* dataShare = dynamic_cast<IDataShare*>(m_cnvSvc); + if (dataShare == nullptr || !dataShare->makeServer(-m_numberOfClients.value() - 1).isSuccess()) { + ATH_MSG_FATAL("Could not make AthenaPoolCnvSvc a share server: " << dataShare); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG("Successfully made the conversion service a share server"); + } + return StatusCode::SUCCESS; +} +//___________________________________________________________________________ +StatusCode AthenaSharedWriter::execute() { + ATH_MSG_DEBUG("in execute()"); + int counter = 0; + bool doCommit = false; + StatusCode sc = m_cnvSvc->commitOutput("", false); + ATH_MSG_VERBOSE("Start commitOutput loop"); + while (sc.isSuccess() || sc.isRecoverable()) { + if (sc.isRecoverable()) { + usleep(100); + } else { + counter++; + if (m_autoSend.value() > 0 && counter% m_autoSend.value() == 0) { + doCommit = true; + ATH_MSG_INFO("commitOutput sending data."); + } else { + doCommit = false; + } + } + sc = m_cnvSvc->commitOutput("", doCommit); + } + + AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_cnvSvc); + if (cnvSvc == nullptr || !cnvSvc->disconnectOutput("").isSuccess()) { + ATH_MSG_FATAL("Could not disconnectOutput"); + return StatusCode::FAILURE; + } + + setFilterPassed(false); // don't output events + return StatusCode::SUCCESS; +} +//___________________________________________________________________________ +StatusCode AthenaSharedWriter::finalize() { + ATH_MSG_INFO("in finalize()"); + return StatusCode::SUCCESS; +} diff --git a/Control/AthenaIPCTools/src/AthenaSharedWriter.h b/Control/AthenaIPCTools/src/AthenaSharedWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..80562df0fb39c0d81774a3570845709ef2faa2d3 --- /dev/null +++ b/Control/AthenaIPCTools/src/AthenaSharedWriter.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ATHENASHAREDWRITER_H +#define ATHENASHAREDWRITER_H + +/** @file AthenaSharedWriter.h + * @brief This file contains the class definition for the AthenaSharedWriter class. + * @author Peter van Gemmeren <gemmeren@anl.gov> + **/ + +#include "AthenaBaseComps/AthFilterAlgorithm.h" + +class IConversionSvc; + +/** @class AthenaSharedWriter + * @brief This class provides an example for writing event data objects to Pool. + **/ +class AthenaSharedWriter : public AthFilterAlgorithm { +public: // Constructor and Destructor + /// Standard Service Constructor + AthenaSharedWriter(const std::string& name, ISvcLocator* pSvcLocator); + /// Destructor + virtual ~AthenaSharedWriter(); + +public: +/// Gaudi Service Interface method implementations: + virtual StatusCode initialize() override; + virtual StatusCode execute () override; + virtual StatusCode finalize() override; + +private: // properties + IntegerProperty m_numberOfClients{this,"NumberOfClients",1}; + IntegerProperty m_autoSend{this,"AutoSend",-1}; + +private: + IConversionSvc* m_cnvSvc; +}; + +#endif diff --git a/Control/AthenaIPCTools/src/components/AthenaIPCTools_entries.cxx b/Control/AthenaIPCTools/src/components/AthenaIPCTools_entries.cxx index c0d8e999d83da4cb90af2db5892db16daf722c13..e87d47baee5563bc1510800b92ea67e8005e7651 100644 --- a/Control/AthenaIPCTools/src/components/AthenaIPCTools_entries.cxx +++ b/Control/AthenaIPCTools/src/components/AthenaIPCTools_entries.cxx @@ -1,6 +1,8 @@ +#include "../AthenaSharedWriter.h" #include "../AthenaSharedMemoryTool.h" #include "../AthenaYamplTool.h" +DECLARE_COMPONENT( AthenaSharedWriter ) DECLARE_COMPONENT( AthenaSharedMemoryTool ) DECLARE_COMPONENT( AthenaYamplTool ) diff --git a/Control/AthenaKernel/AthenaKernel/IAthenaOutputStreamTool.h b/Control/AthenaKernel/AthenaKernel/IAthenaOutputStreamTool.h index b14d4ecad6650b179b4eb03c3088142ba1805f53..7f7356bf929c43428a3f7699d764a7fabc18337b 100644 --- a/Control/AthenaKernel/AthenaKernel/IAthenaOutputStreamTool.h +++ b/Control/AthenaKernel/AthenaKernel/IAthenaOutputStreamTool.h @@ -85,7 +85,7 @@ public: /// Commit the output stream after having streamed out objects /// Must commitOutput AFTER streaming - virtual StatusCode commitOutput() = 0; + virtual StatusCode commitOutput(bool doCommit = false) = 0; /// Finalize the output stream after the last commit, e.g. in /// finalize diff --git a/Control/AthenaMP/python/PyComps.py b/Control/AthenaMP/python/PyComps.py index 6a2a659779abdd8d40addea2d08c0ff200a18896..36ec82c33772e9784a9b0cc12e40c846723a0aa9 100644 --- a/Control/AthenaMP/python/PyComps.py +++ b/Control/AthenaMP/python/PyComps.py @@ -105,14 +105,14 @@ class MpEvtLoopMgr(AthMpEvtLoopMgr): if use_shared_reader: from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaIPCTools.AthenaIPCToolsConf import AthenaSharedMemoryTool - svcMgr.EventSelector.SharedMemoryTool = AthenaSharedMemoryTool("EventStreamingTool") + svcMgr.EventSelector.SharedMemoryTool = AthenaSharedMemoryTool("EventStreamingTool", SharedMemoryName="EventStream"+str(os.getpid())) if 'AthenaPoolCnvSvc.ReadAthenaPool' in sys.modules: - svcMgr.AthenaPoolCnvSvc.InputStreamingTool = AthenaSharedMemoryTool("InputStreamingTool") + svcMgr.AthenaPoolCnvSvc.InputStreamingTool = AthenaSharedMemoryTool("InputStreamingTool", SharedMemoryName="InputStream"+str(os.getpid())) if use_shared_writer: if 'AthenaPoolCnvSvc.WriteAthenaPool' in sys.modules: from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaIPCTools.AthenaIPCToolsConf import AthenaSharedMemoryTool - svcMgr.AthenaPoolCnvSvc.OutputStreamingTool += [ AthenaSharedMemoryTool("OutputStreamingTool_0") ] + svcMgr.AthenaPoolCnvSvc.OutputStreamingTool += [ AthenaSharedMemoryTool("OutputStreamingTool_0", SharedMemoryName="OutputStream"+str(os.getpid())) ] from AthenaMPTools.AthenaMPToolsConf import SharedEvtQueueProvider self.Tools += [ SharedEvtQueueProvider(UseSharedReader=use_shared_reader, diff --git a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py index 119b17b44c6b76712953b8c201e92564f0b3c7ed..c41366416bc1231bb09da3f468f5f51992425859 100644 --- a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py +++ b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # '''@file ExampleMonitorAlgorithm.py @@ -79,7 +79,7 @@ def ExampleMonitoringConfig(inputFlags): path='ToRuleThemAll',xbins=40,xmin=0.0,xmax=80.0) myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events', path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight') - myGroup.defineHistogram('random', title='LB;x;Events', + myGroup.defineHistogram('random;random2', title='LB;x;Events', path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10') myGroup.defineHistogram('random', title='title;x;y',path='ToBringThemAll', xbins=[0,.1,.2,.4,.8,1.6]) diff --git a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py index 6780f16fbc368a805fb60bbaea1b4df6a3cccab4..783cbad9b3d6750432d1869dc738b4e048807beb 100644 --- a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py +++ b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py @@ -124,12 +124,6 @@ if DQMonFlags.doMonitoring(): # LAr monitoring # #------------------# if DQMonFlags.doLArMon(): - # FIXME: don't use global flags here - if 'doLArCollisionTimeMon' not in dir(): - doLArCollisionTimeMon=True - if doLArCollisionTimeMon: - include ("LArCellRec/LArCollisionTime_jobOptions.py") - include("LArClusterRec/LArClusterCollisionTime_jobOptions.py") try: LArMon = AthenaMonManager(name="LArMonManager", FileKey = DQMonFlags.monManFileKey(), @@ -250,6 +244,13 @@ if DQMonFlags.doMonitoring(): #--------------------------# # Post-setup configuration # #--------------------------# + # force conditions update because the converter can't do it + if DQMonFlags.monManEnvironment in ('tier0ESD', 'AOD'): + from AthenaCommon.AlgSequence import AthSequencer + from AthenaMonitoring.AthenaMonitoringConf import ForceIDConditionsAlg + asq = AthSequencer("AthBeginSeq") + asq += [ForceIDConditionsAlg()] + if rec.triggerStream()=='express': include("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py") local_logger.debug('DQ Post-Setup Configuration') diff --git a/Control/AthenaMonitoring/share/Run3DQTestingDriver.py b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py index 120d5aded063972edd98d1e0fdfd0ffcd69366d5..fc30f1f78ab8d0694d5923bdac761ce78c64f63b 100755 --- a/Control/AthenaMonitoring/share/Run3DQTestingDriver.py +++ b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py @@ -12,18 +12,22 @@ if __name__=='__main__': import sys + from AthenaConfiguration.AllConfigFlags import ConfigFlags from argparse import ArgumentParser - parser = ArgumentParser() + parser = ConfigFlags.getArgumentParser() parser.add_argument('--preExec', help='Code to execute before locking configs') parser.add_argument('--postExec', help='Code to execute after setup') parser.add_argument('--dqOffByDefault', action='store_true', help='Set all DQ steering flags to False, user must then switch them on again explicitly') + # keep for compatibility reasons + parser.add_argument('--inputFiles', + help='Comma-separated list of input files (alias for --filesInput)') + # keep for compatibility reasons parser.add_argument('--maxEvents', type=int, - help='Maximum number of events to process') - parser.add_argument('--loglevel', type=int, default=3, - help='Verbosity level') - parser.add_argument('flags', nargs='*', help='Config flag overrides') - args = parser.parse_args() + help='Maximum number of events to process (alias for --evtMax)') + parser.add_argument('--printDetailedConfig', action='store_true', + help='Print detailed Athena configuration') + args, _ = parser.parse_known_args() # Setup the Run III behavior from AthenaCommon.Configurable import Configurable @@ -35,15 +39,22 @@ if __name__=='__main__': log.setLevel(INFO) # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.AutoConfigFlags import GetFileMD - ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q431/21.0/myESD.pool.root'] + # default input if nothing specified + ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/AthenaMonitoring/q431/21.0/f946/myESD.pool.root'] ConfigFlags.Output.HISTFileName = 'ExampleMonitorOutput.root' if args.dqOffByDefault: from AthenaMonitoring.DQConfigFlags import allSteeringFlagsOff allSteeringFlagsOff() - ConfigFlags.fillFromArgs(args.flags) + ConfigFlags.fillFromArgs(parser=parser) + # override Input.Files with result from our own arguments + # if --filesInput was specified as well (!) this will override + if args.inputFiles is not None: + ConfigFlags.Input.Files = args.inputFiles.split(',') + # if --evtMax was specified as well this will override + if args.maxEvents is not None: + ConfigFlags.Exec.MaxEvents = args.maxEvents isReadingRaw = (GetFileMD(ConfigFlags.Input.Files).get('file_type', 'POOL') == 'BS') if isReadingRaw: if ConfigFlags.DQ.Environment not in ('tier0', 'tier0Raw', 'online'): @@ -85,7 +96,7 @@ if __name__=='__main__': from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg = MainServicesCfg(ConfigFlags) - + if isReadingRaw: # attempt to start setting up reco ... from CaloRec.CaloRecoConfig import CaloRecoCfg @@ -113,9 +124,7 @@ if __name__=='__main__': log.info('Executing postExec: %s', args.postExec) exec(args.postExec) - # If you want to turn on more detailed messages ... - # exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG - cfg.printConfig(withDetails=False) # set True for exhaustive info + cfg.printConfig(withDetails=args.printDetailedConfig) # set True for exhaustive info - sc = cfg.run(args.maxEvents, args.loglevel) + sc = cfg.run() sys.exit(0 if sc.isSuccess() else 1) diff --git a/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref b/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref index e7c989dbf079cc25e06c117a051b4fc94a49fc56..0c725ce1863dcc959e9d3298eb350686408ce2ff 100644 --- a/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref +++ b/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref @@ -1,12 +1,13 @@ TH1F /run_311321/top/run: 4000554 uncompressed, 17768 on file (hash 2879974139) TEfficiency /run_311321/OneRing/AndInTheDarkness/random_vs_pT_vs_pT_passed: 21034 uncompressed, 1551 on file (hash 3769596744) -TTree /run_311321/OneRing/BindThem/testtree: 2979 uncompressed, 860 on file (hash 3604726262) +TTree /run_311321/OneRing/BindThem/testtree: 2979 uncompressed, 856 on file (hash 3604726262) TEfficiency /run_311321/OneRing/AndInTheDarkness/pT_vs_pT_passed: 2965 uncompressed, 684 on file (hash 3294946318) TH2F /run_311321/OneRing/ToBringThemAll/pT_vs_random: 909 uncompressed, 426 on file (hash 552182390) TH1F /run_311321/OneRing/ToFindThem/lb: 12574 uncompressed, 387 on file (hash 3672452440) TH1F /run_311321/OneRing/AndInTheDarkness/pT_with_cut: 759 uncompressed, 356 on file (hash 3784147481) -TH1F /run_311321/OneRing/ToBringThemAll/random: 667 uncompressed, 322 on file (hash 3343153471) +TH1F /run_311321/OneRing/ToBringThemAll/random2: 668 uncompressed, 315 on file (hash 2041017371) TH1F /run_311321/OneRing/ToRuleThemAll/lumiPerBCID_merge: 748 uncompressed, 304 on file (hash 1181712869) +TH1F /run_311321/OneRing/ToBringThemAll/random: 613 uncompressed, 298 on file (hash 1269065538) TH1F /run_311321/OneRing/ToRuleThemAll/lumiPerBCID: 742 uncompressed, 297 on file (hash 3154673526) TH1F /run_311321/top/Keys/clusterX/c_layer2_clusterX: 979 uncompressed, 254 on file (hash 1589876658) TH1F /run_311321/top/Keys/clusterX/c_layer1_clusterX: 979 uncompressed, 254 on file (hash 1382455216) diff --git a/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx b/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx index 498a378bc5589a8d15c230443362d26df6ad856a..a8158c190faeb99204172e5bfdffe35b52a6fd03 100644 --- a/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx +++ b/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx @@ -29,4 +29,4 @@ DECLARE_COMPONENT( DQBadLBFilterAlg ) DECLARE_COMPONENT( TriggerTranslatorToolSimple ) DECLARE_COMPONENT( ExampleMonitorAlgorithm ) DECLARE_COMPONENT( ForceIDConditionsAlg ) -DECLARE_COMPONENT( ForceMSConditionsAlg ) +DECLARE_COMPONENT( ForceMSConditionsAlg ) \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh index e169d04cb2a02138aa1697f414cc415b18d14947..9bf85fae4aed2cc0100c01d46c216079bcbf3484 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh @@ -1,6 +1,7 @@ #!/bin/bash # art-description: ESD->HIST, R21 data ESD # art-type: grid +# art-memory: 3072 # art-include: master/Athena # art-output: ExampleMonitorOutput.root # art-output: log* diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh index b758be28ca0ffbf347a409ef355c81f9b2336ac9..fbde1dae4c9f682dd7583b25c9a50847ccc3347e 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh @@ -1,6 +1,7 @@ #!/bin/bash # art-description: ESD->HIST, R21 data ESD, MT # art-type: grid +# art-memory: 3072 # art-include: master/Athena # art-output: ExampleMonitorOutput.root # art-output: log* diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh index eab4b4943d7a86c858a74bee2fb07031a227d688..171b265f584bd8237e0490030eaae84bda1e325f 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh @@ -1,6 +1,7 @@ #!/bin/bash # art-description: AOD->HIST, R22 MC, Trigger Only # art-type: grid +# art-memory: 3072 # art-include: master/Athena # art-output: ExampleMonitorOutput.root # art-output: log* diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh index 0d24b33513d4bdc491a491625de9a6bb5089d8d9..26a81ffdfb3dae7c5f1dd31d015bfa7608718b07 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh @@ -1,6 +1,7 @@ #!/bin/bash # art-description: AOD->HIST, R22 MC, Trigger Only # art-type: grid +# art-memory: 3072 # art-include: master/Athena # art-output: ExampleMonitorOutput.root # art-output: log* diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh index 6d4175434fd1aa027802aef1bbcbc0c248ded9cd..323b46be93b7ce980c64b21a6d2c953fa3a334f7 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh @@ -1,6 +1,7 @@ #!/bin/bash # art-description: ESD->HIST, R22 data ESD # art-type: grid +# art-memory: 3072 # art-include: master/Athena # art-output: ExampleMonitorOutput.root # art-output: log* diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h index 946db53bc492caeb9ba24951c087cf0c503af5bf..4240937a3dba98c155e7b4a269907a49de2c5d63 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h @@ -70,6 +70,7 @@ public: virtual const ServiceHandle<ITHistSvc>& histogramService() { return m_histSvc; } virtual uint32_t runNumber(); virtual uint32_t lumiBlock(); + private: @@ -78,6 +79,7 @@ private: Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" }; Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"}; Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." }; + Gaudi::Property<bool> m_failOnEmpty { this, "FailOnEmpty", true, "Fail in initialize() if no histograms defined" }; std::unordered_map<std::string, std::vector<std::shared_ptr<Monitored::HistogramFiller>>> m_fillerMap; //!< map from variables to fillers mutable std::mutex m_fillMutex; diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h index 8263005a8f2ff8ed8c58b0feddcc275bd94a78e0..96b7bf5db3a8b11a4867a092f52552dbff5a43f5 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramFiller.h @@ -17,8 +17,12 @@ namespace Monitored { // Forward declare generic histogram filler (see HistogramFillerUtils.h) namespace detail { - template<typename H, typename W, typename C, typename ...Vs> - unsigned fill(H* hist, W weight, C cut, const Vs&... v); + template<typename H, typename W, typename M, typename ...Ms> + void doFill(H* hist, W weight, size_t i, const M& m1, const Ms&... m); + template<typename W> + void doFill(TProfile*, W, size_t, const double&, const char* const&); + template<typename W> + void doFill(TProfile*, W, size_t, const char* const&, const char* const&); } /** @@ -107,16 +111,15 @@ namespace Monitored { std::function<bool(size_t)> cutMaskValue = [] (size_t){ return true; }; // default is true size_t maskSize = 1; if ( m_monCutMask != nullptr ) { - const std::vector<double> cutMaskVector{m_monCutMask->getVectorRepresentation()}; - maskSize = cutMaskVector.size(); + maskSize = m_monCutMask->size(); if (maskSize == 1) { - if (!cutMaskVector[0]) { + if (!m_monCutMask->get(0)) { // globally fails cut; zero first argument is a signal that one can abort return std::make_pair(0, [](size_t){ return false; }); // otherwise, default cutMaskValue is sufficient } } else { - return std::make_pair(maskSize, [cutMaskVector=std::move(cutMaskVector)](size_t i){ return bool(cutMaskVector[i]); }); + return std::make_pair(maskSize, [this](size_t i){ return static_cast<bool>(m_monCutMask->get(i)); }); } } return std::make_pair(maskSize, cutMaskValue); @@ -130,20 +133,19 @@ namespace Monitored { * @tparam H histogram type (TH1, TH2, ...) * @param weight weight accessor (use detail::noWeight if not needed) * @param cut cut mask accessor (use detail::noCut if not needed) - * @param m1,m... IMonitoredVariable list to fill from + * @param m... IMonitoredVariable list to fill from */ - template<class H, typename W, typename C, typename M, typename ...Ms> - unsigned fill(W weight, C cut, const M& m1, const Ms&... m) const { - // Template magic: Recursively convert all M to std::vector - if constexpr(std::is_same_v<M, Monitored::IMonitoredVariable>) { - if (not m1.hasStringRepresentation()) - return fill<H>(weight, cut, m..., m1.getVectorRepresentation()); - else - return fill<H>(weight, cut, m..., m1.getStringVectorRepresentation()); - } else { - // All IMonitoreVariables have been converted to vector<double/string> - return detail::fill(this->histogram<H>(), weight, cut, m1, m...); + template<class H, typename W, typename C, typename ...Ms> + unsigned fill(W weight, C cut, const Ms&... m) const { + auto hist = this->histogram<H>(); + + size_t i = 0; + for (; i < std::max({m.size()...}); ++i ) { + if ( cut(i) ) { + detail::doFill(hist, weight, i, m...); + } } + return i; } std::shared_ptr<HistogramDef> m_histDef; diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/IMonitoredVariable.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/IMonitoredVariable.h index e01f26d92302577517d745ee11297d4f06c83424..a71e8c674e71263e83d670ee60f25440d5df486c 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/IMonitoredVariable.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/IMonitoredVariable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AthenaMonitoringKernel_IMonitoredVariable_h @@ -17,8 +17,8 @@ namespace Monitored { virtual ~IMonitoredVariable() {} const std::string& name() const { return m_name; } - virtual std::vector<double> getVectorRepresentation() const = 0; - virtual std::vector<std::string> getStringVectorRepresentation() const = 0; + virtual double get(size_t) const = 0; + virtual std::string getString(size_t) const = 0; virtual bool hasStringRepresentation() const = 0; //!< indcates that the stored content can be converted to strings virtual size_t size() const = 0; //!< gives size of vector representation diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredCollection.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredCollection.h index 4044ef0884e1520a4cf9fa112a75fb2debdd8d5b..616673cd14cafaf370577886ae40120795a5a0d2 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredCollection.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredCollection.h @@ -113,16 +113,24 @@ namespace Monitored { ValuesCollection(ValuesCollection&&) = default; - std::vector<double> getVectorRepresentation() const override { - return convertToDouble( m_collection ); + virtual double get([[maybe_unused]] size_t i) const override { + if constexpr (std::is_convertible_v<value_type, double>) + return m_collection[i]; + else + return -1; } - virtual std::vector<std::string> getStringVectorRepresentation() const override { - return convertToString( m_collection ); + virtual std::string getString([[maybe_unused]] size_t i) const override { + if constexpr (std::is_constructible_v<std::string, value_type>) + return m_collection[i]; + else + return {}; } + virtual bool hasStringRepresentation() const override { return std::is_constructible<std::string, value_type>::value; } + virtual size_t size() const override { return std::size(m_collection); } @@ -137,26 +145,6 @@ namespace Monitored { ValuesCollection(ValuesCollection const&) = delete; ValuesCollection& operator=(ValuesCollection const&) = delete; - - template< typename U, typename = typename std::enable_if< std::is_constructible<std::string, typename detail::get_value_type<U>::value_type>::value >::type > - std::vector<std::string> convertToString( const U& collection ) const { - return std::vector<std::string>(std::begin(collection), std::end(collection)); - } - - template< typename U, typename = typename std::enable_if< ! std::is_constructible<std::string, typename detail::get_value_type<U>::value_type>::value >::type, typename = void > - std::vector<std::string> convertToString( const U& ) const { - return {}; - } - - template< typename U, std::enable_if_t< !std::is_convertible<typename detail::get_value_type<U>::value_type, double>::value, int> = 0> - std::vector<double> convertToDouble( const U& ) const { - return {}; - } - - template< typename U, std::enable_if_t< std::is_convertible<typename detail::get_value_type<U>::value_type, double>::value, int> = 0> - std::vector<double> convertToDouble(const U& collection ) const { - return std::vector<double>(std::begin(collection), std::end(collection)); - } }; /** @@ -186,13 +174,20 @@ namespace Monitored { ObjectsCollection(ObjectsCollection&&) = default; - std::vector<double> getVectorRepresentation() const override { - return convertToDouble<R>(); + virtual double get([[maybe_unused]] size_t i) const override { + if constexpr (std::is_convertible_v<R, double>) + return m_converterToR(m_collection[i]); + else + return -1; + } + + virtual std::string getString([[maybe_unused]] size_t i) const override { + if constexpr (std::is_constructible_v<std::string, R>) + return m_converterToR(m_collection[i]); + else + return {}; } - virtual std::vector<std::string> getStringVectorRepresentation() const override { - return convertToString<R>(); - }; virtual bool hasStringRepresentation() const override { return std::is_constructible<std::string, R>::value; }; @@ -214,36 +209,6 @@ namespace Monitored { ObjectsCollection& operator=(ObjectsCollection const&) = delete; - template< typename U, std::enable_if_t< std::is_convertible<U, double>::value, int> = 0> - inline std::vector<double> convertToDouble() const { - // Reserve space and fill vector - std::vector<double> result; - result.reserve(std::size(m_collection)); - for (const auto& value : m_collection) result.push_back(m_converterToR(value)); - return result; - } - - template< typename U, std::enable_if_t< !std::is_convertible<U, double>::value, int> = 0> - inline std::vector<double> convertToDouble() const { - return {}; - } - - template< typename U, std::enable_if_t< std::is_constructible<U, std::string>::value, int> = 0> - inline std::vector<std::string> convertToString() const { - // Reserve space and fill vector - std::vector<std::string> result; - result.reserve(std::size(m_collection)); - for (const auto& value : m_collection) result.push_back(m_converterToR(value)); - return result; - } - - template< typename U, std::enable_if_t< !std::is_constructible<U, std::string>::value, int> = 0> - inline std::vector<std::string> convertToString() const { - return {}; - } - - - }; diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredScalar.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredScalar.h index 4a080d552ff971075f720a49b34e6a5997282442..b98afe02f0ca70c0f1783f86c7055a520a4db92f 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredScalar.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredScalar.h @@ -103,12 +103,19 @@ namespace Monitored { T operator--() { return --m_value; } T operator--(int) { return m_value--; } - std::vector<double> getVectorRepresentation() const override { - return { convertToDouble( m_value, m_valueTransform, m_valueGenerator ) }; + virtual double get(size_t) const override { + if constexpr (std::is_convertible_v<double, T>) { + return (m_valueGenerator ? static_cast<double>(m_valueGenerator()) : + m_valueTransform ? m_valueTransform(m_value) : static_cast<double>(m_value)); + } + else return 0; } - std::vector<std::string> getStringVectorRepresentation() const override{ - return { convertToString( m_value, m_valueGenerator ) }; + virtual std::string getString(size_t) const override { + if constexpr (std::is_constructible_v<std::string, T>) { + return (m_valueGenerator ? m_valueGenerator() : m_value); + } + else return {}; } virtual bool hasStringRepresentation() const override { @@ -123,36 +130,8 @@ namespace Monitored { T m_value{}; std::function<double(const T&)> m_valueTransform; std::function<T()> m_valueGenerator; - - template< typename U, typename Generator, - typename = typename std::enable_if< std::is_constructible<std::string, U>::value >::type > - std::string convertToString( const U& value, Generator g ) const { - return ( g ? g() : value ); - } - - template< typename U, typename Generator, - typename = typename std::enable_if< ! std::is_constructible<std::string, U>::value >::type, typename = void > - std::string convertToString( const U&, Generator ) const { - return ""; - } - - template< typename U, typename Transformer, typename Generator, typename = typename std::enable_if< !std::is_convertible<double, U>::value >::type > - double convertToDouble( const U&, Transformer, Generator ) const { - return 0; - } - - template< typename U, typename Transformer, typename Generator, typename = typename std::enable_if< std::is_convertible<double, U>::value >::type, typename = void > - double convertToDouble(const U& value, Transformer t, Generator g ) const { - return ( g ? static_cast<double>(g()) : t ? t(value) : static_cast<double>(value) ); - } - - }; - - - - } // namespace Monitored #endif /* AthenaMonitoringKernel_MonitoredScalar_h */ diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredTimer.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredTimer.h index 7be4215c8e767434b7da6ce17ee71a7261dce970..5dc6bdec91b52a950702e69db14ff4e04ca92b5b 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredTimer.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/MonitoredTimer.h @@ -39,9 +39,8 @@ namespace Monitored { operator double() const; //!< duration (in unit) between start and stop (or current time) - std::vector<double> getVectorRepresentation() const override { return {double(*this)}; } - - virtual std::vector<std::string> getStringVectorRepresentation() const override { return std::vector<std::string>(); }; + virtual double get(size_t) const override { return double(*this); } + virtual std::string getString([[maybe_unused]] size_t i) const override { return {}; } virtual bool hasStringRepresentation() const override { return false; }; virtual size_t size() const override { return 1; } diff --git a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py index fe3d775d808ec0e83f4c5227c36cdde9ffb0fa4f..b3566a6910cba6f34e8730efc5e047459c57618a 100644 --- a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py +++ b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py @@ -5,6 +5,7 @@ from AthenaCommon.Logging import logging from AthenaCommon.Configurable import Configurable from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + import json import six @@ -179,6 +180,21 @@ class GenericMonitoringArray: accessorDict[acckey] = [str(i)] + accval return postList, accessorDict + +## Check if name is an allowed histogram/branch name +# +# Certain characers are best avoided in ROOT histogram names as it makes interactive +# use awkward. Also there are additional constraints from OH and MDA archiving for +# online running (ATR-15173). +# +# @param name string to check +# @return set of forbidden characters found +def _invalidName(name): + blacklist = '/\\' + if athenaCommonFlags.isOnline(): + blacklist += '=,:.()' + return set(name).intersection(blacklist) + ## Generate an alias for a set of variables # # A helper function is useful for this operation, since it is used both by the module @@ -244,6 +260,7 @@ def _options(opt): # # For full details see the GenericMonitoringTool documentation. # @param varname one (1D) or two (2D) variable names separated by comma +# optionally give histogram name by appending ";" plus the name # @param type histogram type # @param path top-level histogram directory (e.g. EXPERT, SHIFT, etc.) # @param title Histogram title and optional axis title (same syntax as in TH constructor) @@ -257,7 +274,7 @@ def _options(opt): # @param merge Merge method to use for object, if not default. Possible algorithms for offline DQM # are given in https://twiki.cern.ch/twiki/bin/view/Atlas/DQMergeAlgs def defineHistogram(varname, type='TH1F', path=None, - title=None, weight=None, alias=None, + title=None, weight=None, xbins=100, xmin=0, xmax=1, xlabels=None, ybins=None, ymin=None, ymax=None, ylabels=None, zmin=None, zmax=None, zlabels=None, @@ -266,10 +283,10 @@ def defineHistogram(varname, type='TH1F', path=None, # All of these fields default to an empty string stringSettingsKeys = ['xvar', 'yvar', 'zvar', 'type', 'path', 'title', 'weight', - 'cutMask', 'convention', 'alias', 'treeDef', 'merge'] + 'cutMask', 'convention', 'alias', 'treeDef', 'merge'] # All of these fileds default to 0 numberSettingsKeys = ['xbins', 'xmin', 'xmax', 'ybins', 'ymin', 'ymax', 'zbins', - 'zmin', 'zmax'] + 'zmin', 'zmax'] # All of these fields default to an empty array arraySettingsKeys = ['allvars', 'xlabels', 'xarray', 'ylabels', 'yarray', 'zlabels'] # Initialize a dictionary with all possible fields @@ -281,6 +298,13 @@ def defineHistogram(varname, type='TH1F', path=None, varList, alias = _alias(varname) if alias is None: return '' + + invalid = _invalidName(alias) + if invalid: + log.warning('%s is not a valid histogram name. Illegal characters: %s', + alias, ' '.join(invalid)) + return '' + settings['alias'] = alias # Variable names @@ -295,18 +319,18 @@ def defineHistogram(varname, type='TH1F', path=None, # Type if athenaCommonFlags.isOnline() and type in ['TEfficiency', 'TTree']: - log.warning('Object %s of type %s is not supported for online running and '+\ - 'will not be added.', varname, type) + log.warning('Object %s of type %s is not supported for online running and ' + 'will not be added.', varname, type) return '' # Check that the histogram's dimension matches the number of monitored variables # Add TTree to the lists, it can have any number of vars hist2D = ['TH2','TProfile','TEfficiency', 'TTree'] hist3D = ['TProfile2D','TEfficiency', 'TTree'] if nVars==2: - assert any([valid2D in type for valid2D in hist2D]),'Attempting to use two ' \ + assert any([valid2D in type for valid2D in hist2D]),'Attempting to use two ' 'monitored variables with a non-2D histogram.' elif nVars==3: - assert any([valid3D in type for valid3D in hist3D]),'Attempting to use three ' \ + assert any([valid3D in type for valid3D in hist3D]),'Attempting to use three ' 'monitored variables with a non-3D histogram.' settings['type'] = type @@ -408,10 +432,9 @@ def defineHistogram(varname, type='TH1F', path=None, # @param opt TTree options (none currently) # @param convention Expert option for how the objects are placed in ROOT -def defineTree(varname, treedef, path=None, - title=None, alias=None, - opt='', convention=None, - cutmask=None): - return defineHistogram(varname, type='TTree', path=path, title=title, alias=alias, - treedef=treedef, opt=opt, convention=convention, - cutmask=cutmask) +def defineTree(varname, treedef, path=None, title=None, + opt='', convention=None, + cutmask=None): + return defineHistogram(varname, type='TTree', path=path, title=title, + treedef=treedef, opt=opt, convention=convention, + cutmask=cutmask) diff --git a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx index 77dadc9eecd213d9f38123ddef57aabfd37a2c42..15bc0bb6aef566f0192a28dfbfb613a6ada3d87f 100644 --- a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx @@ -85,7 +85,7 @@ StatusCode GenericMonitoringTool::book() { ATH_MSG_DEBUG( "Monitoring for variable " << def.name << " prepared" ); } - if ( fillers.empty() ) { + if ( fillers.empty() && m_failOnEmpty ) { std::string hists; for (const auto &h : m_histograms) hists += (h+","); ATH_MSG_ERROR("No monitored variables created based on histogram definition: [" << hists << diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h index d534622e6ce2ec6b7bab017fcffa8f24a3883225..195ce9c23b6617da681aca6580d8c4a20ece2e6c 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/CumulativeHistogramFiller1D.h @@ -40,17 +40,14 @@ namespace Monitored { unsigned i(0); auto histogram = this->histogram<TH1>(); - auto valuesVector{m_monVariables[0].get().getVectorRepresentation()}; - size_t idx = 0; - for (auto value : valuesVector) { - if (!cutMaskValue(idx++)) { continue; } - unsigned bin = histogram->FindBin(value); + const IMonitoredVariable& var = m_monVariables[0].get(); + for (size_t i = 0; i < var.size(); i++) { + if (!cutMaskValue(i)) { continue; } + const unsigned bin = histogram->FindBin(var.get(i)); for (unsigned j = bin; j > 0; --j) { histogram->AddBinContent(j); } - - ++i; } return i; diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.cxx b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.cxx index bd337dd87440e05ca8ab46e13f9bb024a96c67ca..844fa9ef4338944e6a1db39e1b0b2a34485f11b8 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.cxx +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.cxx @@ -247,11 +247,14 @@ void HistogramFactory::setLabels(TAxis* axis, const std::vector<std::string>& la } } +namespace { + const static std::set<std::string> onlinePaths( { "EXPERT", "SHIFT", "DEBUG", "RUNSTAT", "EXPRESS" } ); +} std::string HistogramFactory::getFullName(const HistogramDef& def) const { - const static std::set<std::string> online( { "EXPERT", "SHIFT", "DEBUG", "RUNSTAT", "EXPRESS" } ); + std::string path; - if ( online.count( def.path)!=0 ) { + if ( onlinePaths.count( def.path)!=0 ) { path = "/" + def.path + "/" + m_streamName + "/" + m_groupName; } else if ( def.path=="DEFAULT" ) { path = "/" + m_streamName + "/" + m_groupName; @@ -268,3 +271,16 @@ std::string HistogramFactory::getFullName(const HistogramDef& def) const { return fullName; } + +void HistogramFactory::remove(const HistogramDef& def) { + std::string path = getFullName( def ); + + // see docu here: + // https://acode-browser1.usatlas.bnl.gov/lxr/source/Gaudi/GaudiSvc/src/THistSvc/THistSvc.h#0146 + // and here: + // https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/HLT/Trigger/TrigControl/TrigServices/src/TrigMonTHistSvc.cxx#0216 + // online implementation actually claims ownership of the object and we ever need to call this in online situation + // + if ( m_histSvc->exists( path) ) + m_histSvc->deReg(path).ignore(); // we actually ignore if that was sucessfull as we plan to use is eagerly to cleanup LumiBlock histograms history +} diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.h index cf619e7cc345faf6ff1c01760318473d6eb25137..7667e3eb1181c52899f1c8ac0496fcdb5172c949 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFactory.h @@ -60,6 +60,11 @@ namespace Monitored { */ std::string getFullName(const HistogramDef& def) const; + /** + * @brief Removes histogram (used online to get rid of old LB tagged histograms) + **/ + virtual void remove(const HistogramDef& def); + private: /** * @brief Create and register histogram diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h index 60fd3be779eec61d2aa6bcc2691f59dffd7a0466..4d0232d865496375faec67f200669a61fc6016bb 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller1D.h @@ -46,13 +46,12 @@ namespace Monitored { } if (m_monWeight) { - const std::vector<double> weightVector{m_monWeight->getVectorRepresentation()}; - auto weightAccessor = [&](size_t i){ return weightVector[i]; }; + auto weightAccessor = [&](size_t i){ return m_monWeight->get(i); }; - if (ATH_UNLIKELY(weightVector.size() != var.size())) { + if (ATH_UNLIKELY(m_monWeight->size() != var.size())) { MsgStream log(Athena::getMessageSvc(), "HistogramFiller1D"); log << MSG::ERROR << "Weight does not match the size of plotted variable: " - << weightVector.size() << " " << var.size() << endmsg; + << m_monWeight->size() << " " << var.size() << endmsg; } // Need to fill here while weightVector is still in scope if (not m_monCutMask) return HistogramFiller::fill<TH1>(weightAccessor, detail::noCut, var); diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h index b9e05773c82d1e744a98cc1229cb8e6b88d4cba1..302e6f3c293874f748e6bf08414d65e4f9718244 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2D.h @@ -65,14 +65,13 @@ namespace Monitored { } if (m_monWeight) { - const std::vector<double> weightVector{m_monWeight->getVectorRepresentation()}; - auto weightAccessor = [&](size_t i){ return weightVector[i]; }; + auto weightAccessor = [&](size_t i){ return m_monWeight->get(i); }; if (ATH_UNLIKELY(size1 > 1 && size2 > 1 && - weightVector.size() > 1 && size1 != weightVector.size())) { + m_monWeight->size() > 1 && size1 != m_monWeight->size())) { MsgStream log(Athena::getMessageSvc(), "HistogramFiller2D"); log << MSG::ERROR << "Weight does not match the size of plotted variable: " - << weightVector.size() << " " << size1 << endmsg; + << m_monWeight->size() << " " << size1 << endmsg; return 0; } // Need to fill here while weightVector is still in scope diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h index 3c4f1912592602235c4830d3fff478f4500d17b5..e8f8e150b19a248d42680300bfa93387b5f04012 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFiller2DProfile.h @@ -35,9 +35,10 @@ namespace Monitored { auto cutMaskAccessor = cutMaskValuePair.second; auto histogram = this->histogram<TProfile2D>(); - const auto valuesVector1{m_monVariables[0].get().getVectorRepresentation()}; - const auto valuesVector2{m_monVariables[1].get().getVectorRepresentation()}; - const auto valuesVector3{m_monVariables[2].get().getVectorRepresentation()}; + const IMonitoredVariable& var1 = m_monVariables[0].get(); + const IMonitoredVariable& var2 = m_monVariables[1].get(); + const IMonitoredVariable& var3 = m_monVariables[2].get(); + /*HERE NEED TO INCLUDE CASE IN WHICH SOME VARIABLES ARE SCALAR AND SOME VARIABLES ARE VECTORS unsigned i(0); if (m_variable1->size() != m_variable2->size() || m_variable1->size() != m_variable3->size() || m_variable2->size() != m_variable3->size() ) { @@ -45,26 +46,22 @@ namespace Monitored { }*/ //For now lets just consider the case in which all variables are of the same length - if ( m_monWeight && m_monWeight->getVectorRepresentation().size()==valuesVector1.size() ) { + if ( m_monWeight && m_monWeight->size()==var1.size() ) { // Weighted fill - const auto weightVector{m_monWeight->getVectorRepresentation()}; - double value1,value2,value3,weight; - size_t idx = 0; - for (const auto& zipped : boost::combine(valuesVector1,valuesVector2,valuesVector3,weightVector)) { - if (cutMaskAccessor(idx++)) { - boost::tie(value1,value2,value3,weight) = zipped; - histogram->Fill(value1,value2,value3,weight); + for (unsigned i = 0; i < var1.size(); ++i) { + if (cutMaskAccessor(i)) { + histogram->Fill(var1.get(i), var2.get(i), var3.get(i), m_monWeight->get(i)); } } } else { // Unweighted fill - for (unsigned i = 0; i < std::size(valuesVector1); ++i) { + for (unsigned i = 0; i < var1.size(); ++i) { if (cutMaskAccessor(i)) { - histogram->Fill(valuesVector1[i], valuesVector2[i], valuesVector3[i]); + histogram->Fill(var1.get(i), var2.get(i), var3.get(i)); } } } - return std::size(valuesVector1); + return var1.size(); } }; } diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h index 475e0c89a3cf444341b6cc0bfcfd4a4af93ef544..2cd1f38d003ed449de1d7481d93aeeb76f088056 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerEfficiency.h @@ -5,10 +5,10 @@ #ifndef AthenaMonitoringKernel_HistogramFiller_HistogramFillerEfficiency_h #define AthenaMonitoringKernel_HistogramFiller_HistogramFillerEfficiency_h -#include "CxxUtils/checker_macros.h" #include "TEfficiency.h" #include "AthenaMonitoringKernel/HistogramFiller.h" +#include "HistogramFillerUtils.h" namespace Monitored { /** @@ -24,85 +24,54 @@ namespace Monitored { } virtual unsigned fill() const override { - size_t varVecSize = m_monVariables.at(0).get().size(); + const size_t nMonVar = m_monVariables.size(); + if ( nMonVar<2 ) return 0; + + const IMonitoredVariable& var0 = m_monVariables[0].get(); auto cutMaskValuePair = getCutMaskFunc(); if (cutMaskValuePair.first == 0) { return 0; } - if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != varVecSize)) { + if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != var0.size())) { MsgStream log(Athena::getMessageSvc(), "HistogramFillerEfficiency"); log << MSG::ERROR << "CutMask does not match the size of plotted variable: " - << cutMaskValuePair.first << " " << varVecSize << endmsg; + << cutMaskValuePair.first << " " << var0.size() << endmsg; } auto cutMaskAccessor = cutMaskValuePair.second; - auto efficiency = this->histogram<TEfficiency>(); + TEfficiency* efficiency = this->histogram<TEfficiency>(); + const TH1* efftot = efficiency->GetTotalHistogram(); - int nMonVar = m_monVariables.size(); if ( nMonVar==2 ) { // Single observable (1D TEfficiency) - const auto valuesVector0 = m_monVariables[0].get().getVectorRepresentation(); - const auto valuesVector1 = retrieveVariable(efficiency, 1); - for (unsigned i = 0; i < std::size(valuesVector0); ++i) { + for (unsigned i = 0; i < var0.size(); ++i) { if (cutMaskAccessor(i)) { - efficiency->Fill(valuesVector0[i], valuesVector1[i]); + efficiency->Fill(var0.get(i), + detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i)); } } - return std::size(valuesVector0); + return var0.size(); } else if ( nMonVar==3 ) { // Two observables (2D TEfficiency) - const auto valuesVector0 = m_monVariables[0].get().getVectorRepresentation(); - const auto valuesVector1 = retrieveVariable(efficiency, 1); - const auto valuesVector2 = retrieveVariable(efficiency, 2); - for (unsigned i = 0; i < std::size(valuesVector0); ++i) { + for (unsigned i = 0; i < var0.size(); ++i) { if (cutMaskAccessor(i)) { - efficiency->Fill(valuesVector0[i], valuesVector1[i], valuesVector2[i]); + efficiency->Fill(var0.get(i), + detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i), + detail::getFillValue<Axis::Y>(efftot, m_monVariables[2].get(), i)); } } - return std::size(valuesVector0); + return var0.size(); } else if ( nMonVar==4 ) { // Three observables (3D Efficiency) - const auto valuesVector0 = m_monVariables[0].get().getVectorRepresentation(); - const auto valuesVector1 = retrieveVariable(efficiency, 1); - const auto valuesVector2 = retrieveVariable(efficiency, 2); - const auto valuesVector3 = retrieveVariable(efficiency, 3); - for (unsigned i = 0; i < std::size(valuesVector0); ++i) { + for (unsigned i = 0; i < var0.size(); ++i) { if (cutMaskAccessor(i)) { - efficiency->Fill(valuesVector0[i], valuesVector1[i], valuesVector2[i], valuesVector3[i]); + efficiency->Fill(var0.get(i), + detail::getFillValue<Axis::X>(efftot, m_monVariables[1].get(), i), + detail::getFillValue<Axis::Y>(efftot, m_monVariables[2].get(), i), + detail::getFillValue<Axis::Z>(efftot, m_monVariables[3].get(), i)); } } - return std::size(valuesVector0); + return var0.size(); } else { return 0; } } - - const std::vector<double> retrieveVariable(TEfficiency* efficiency, int iVariable) const { - auto valueVariable = m_monVariables[iVariable]; - std::vector<double> valuesVector; - if ( valueVariable.get().hasStringRepresentation() ) { - TH1* tot ATLAS_THREAD_SAFE = const_cast<TH1*>(efficiency->GetTotalHistogram()); - const TAxis* axis = getAxis(tot, iVariable); - for ( const std::string& value : valueVariable.get().getStringVectorRepresentation() ) { - const int binNumber = axis->FindFixBin( value.c_str() ); - const double binCenter ATLAS_THREAD_SAFE = axis->GetBinCenter(binNumber); - valuesVector.push_back(binCenter); - } - } else { - valuesVector = valueVariable.get().getVectorRepresentation(); - } - return valuesVector; - } - - const TAxis* getAxis(TH1* hist, int iAxis) const { - if ( iAxis==1 ) { - return hist->GetXaxis(); - } else if ( iAxis==2 ) { - return hist->GetYaxis(); - } else if ( iAxis==3 ) { - return hist->GetZaxis(); - } else { - HistogramException("Invalid request for axis when defining TEfficiency."); - return nullptr; - } - } - }; } diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h index 077b61c87c28454c4252571aa4857fb328d4bb59..e609696d8bebd50d32548d61a2b972a0f1f394db 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerRebinable.h @@ -41,23 +41,26 @@ namespace Monitored { if (AXIS >= this->m_monVariables.size()) { return 0; } if (this->m_monVariables[AXIS].get().size()==0) { return 0; } - { // scope for mutex - const auto valuesVector = this->m_monVariables[AXIS].get().getVectorRepresentation(); + double min = std::numeric_limits<double>::max(); + double max = std::numeric_limits<double>::min(); + const IMonitoredVariable& var = this->m_monVariables[AXIS].get(); + for (size_t i = 0; i < var.size(); i++) { + const double v = var.get(i); + if (v < min) min = v; + if (v > max) max = v; + } - TH1* hist = this->template histogram<TH1>(); - TAxis* axis = detail::getAxis<TH1,AXIS>(hist); - if (m_rebinMode == RebinMode::AddBins) { - const auto max = std::max_element(begin(valuesVector), end(valuesVector)); - if (Monitored::detail::shouldRebinHistogram(axis, *max)) { - Monitored::detail::rebinHistogram<AXIS>(hist, *max); - } - } else { - hist->SetCanExtend(detail::axis_bit[AXIS]); - const auto [min,max] = std::minmax_element(begin(valuesVector), end(valuesVector)); - // ExtendAxis is an extremely expensive operation; only call if necessary - if (*max >= axis->GetXmax()) hist->ExtendAxis(*max, axis); - if (*min < axis->GetXmin()) hist->ExtendAxis(*min, axis); + TH1* hist = this->template histogram<TH1>(); + TAxis* axis = detail::getAxis<AXIS>(hist); + if (m_rebinMode == RebinMode::AddBins) { + if (Monitored::detail::shouldRebinHistogram(axis, max)) { + Monitored::detail::rebinHistogram<AXIS>(hist, max); } + } else { + hist->SetCanExtend(detail::axis_bit[AXIS]); + // ExtendAxis is an extremely expensive operation; only call if necessary + if (max >= axis->GetXmax()) hist->ExtendAxis(max, axis); + if (min < axis->GetXmin()) hist->ExtendAxis(min, axis); } return BASE::fill(); } diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h index 773da09c3a6eaccb5583bb1f04d63e3cb9d59602..f06b017558dc78eec1e485e2e7f14b8d3b712f1d 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerTree.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AthenaMonitoringKernel_HistogramFiller_HistogramFillerTree_h @@ -169,7 +169,7 @@ namespace Monitored { << branch->GetName() << endmsg; return; } - T tofill = var.getVectorRepresentation()[0]; + T tofill = var.get(0); T* ptr = &tofill; branch->SetAddress(ptr); branch->Fill(); @@ -184,7 +184,7 @@ namespace Monitored { << branch->GetName() << endmsg; return; } - std::string tofill{var.getStringVectorRepresentation()[0]}; + std::string tofill{var.getString(0)}; branch->SetObject(&tofill); //*static_cast<std::string*>(branch->GetObject()) = tofill; branch->Fill(); @@ -192,8 +192,11 @@ namespace Monitored { template <typename T> void vectorFillerFunc(TBranch* branch, const IMonitoredVariable& var) { - const auto sourcevec{var.getVectorRepresentation()}; - std::vector<T> tofill(sourcevec.begin(), sourcevec.end()); + std::vector<T> tofill; + tofill.reserve(var.size()); + for (size_t i = 0; i < var.size(); i++) { + tofill.push_back(var.get(i)); + } std::vector<T>* tofillptr = &tofill; branch->SetAddress(&tofillptr); branch->Fill(); @@ -202,7 +205,11 @@ namespace Monitored { // specialization for string template <> void vectorFillerFunc<std::string>(TBranch* branch, const IMonitoredVariable& var) { - std::vector<std::string> tofill{var.getStringVectorRepresentation()}; + std::vector<std::string> tofill; + tofill.reserve(var.size()); + for (size_t i = 0; i < var.size(); i++) { + tofill.push_back(var.getString(i)); + } auto* tofillptr = &tofill; branch->SetAddress(&tofillptr); branch->Fill(); diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h index 6c77ad828701a5eeba51dc04880e4dd389294243..3552810fe76032bf441e17625bc3371a399dba8d 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/HistogramFillerUtils.h @@ -8,6 +8,7 @@ #include <algorithm> #include <utility> +#include "AthenaMonitoringKernel/IMonitoredVariable.h" #include "AthenaMonitoringKernel/OHLockedHist.h" #include "CxxUtils/AthUnlikelyMacros.h" @@ -30,15 +31,36 @@ namespace Monitored { constexpr std::array axis_bit{TH1::kXaxis, TH1::kYaxis, TH1::kZaxis}; /** - * Helper to get corresponding TAxis selected by Monitored::Axis + * Helper to get corresponding TAxis selected by Monitored::Axis. + * (works for const/non-const TAxis/TH1 thanks to auto return type) */ - template<typename H, Axis AXIS> - constexpr TAxis* getAxis(H* hist) { + template<Axis AXIS, typename H> + constexpr auto getAxis(H* hist) { if constexpr (AXIS==Axis::X) return hist->GetXaxis(); else if constexpr (AXIS==Axis::Y) return hist->GetYaxis(); else return hist->GetZaxis(); } + /** + * Return value for filling i'th entry of var into AXIS for hist. + * If var is string-valued performs a bin lookup first. + * + * @tparam AXIS Histograms axis + * @param hist Histogram + * @param var MonitoredVariable for value lookup + * @param i index for IMonitoredVariable value lookup + */ + template<Axis AXIS, typename H> + double getFillValue(const H* hist, const IMonitoredVariable& var, size_t i) { + if ( var.hasStringRepresentation() ) { + const TAxis* axis = getAxis<AXIS>(hist); + const int binNumber = axis->FindFixBin( var.getString(i).c_str() ); + return axis->GetBinCenter(binNumber); + } else { + return var.get(i); + } + } + /** * Method checks if histogram should be rebinned. It should happen when the new value * is greater or equal to the greatest value of the histogram axis. @@ -64,7 +86,7 @@ namespace Monitored { template<Axis AXIS, typename H> void rebinHistogram(H* hist, const double value) { hist->SetCanExtend(axis_bit[AXIS]); - TAxis* a = getAxis<H,AXIS>(hist); + TAxis* a = getAxis<AXIS>(hist); // Rebinning requires to take OH lock in online (no-op offline) oh_scoped_lock_histogram lock; @@ -121,75 +143,48 @@ namespace Monitored { template<typename H, typename T, T... a, typename ...Vs> bool fillWillRebinHistogram(H* hist, std::integer_sequence<T, a...>, const Vs&... v) { // First check if axis is extensible, then if value would be outside of range - return (... || (getAxis<H, static_cast<Axis>(a)>(hist)->CanExtend() and - detail::fillWillRebinHistogram(getAxis<H, static_cast<Axis>(a)>(hist), v))); + return (... || (getAxis<static_cast<Axis>(a)>(hist)->CanExtend() and + detail::fillWillRebinHistogram(getAxis<static_cast<Axis>(a)>(hist), v))); } #pragma GCC diagnostic pop /** - * Return value that can be digested by TH1::Fill - * (We only support double and string) - */ - template<typename T> - constexpr auto toFill(const T& value) { - if constexpr(std::is_same_v<double,T>) return value; - else return value.c_str(); - } - - /** - * Perform generic histogram fill with weight - */ - template<typename H, typename ...Ts> - void doFill(H* hist, double weight, const Ts&... v) { - hist->Fill(toFill(v)..., weight); - } - - /** - * Perform TProfile fill with weight - */ - template<typename X, typename Y> - void doFill(TProfile* hist, [[maybe_unused]] double weight, const X& x, const Y& y) { - // TProfile does not support string as y-value. It would never be called that way - // but is required to make the pack expansion compile in HistogramFiller::fill - if constexpr(std::is_same_v<std::string,Y>) return; - else hist->Fill(toFill(x), y, weight); - } - - /** - * Generic histogram filling helper + * Perform (arbitrary dimension) histogram fill with weight * - * Works for any dimension and double/string-valued entries. - * If weight and/or cut are not needed use a lambda expression (instead of std::function) - * as this will allow the compiler to produce more optimal code. - * - * @param hist histogram to fill - * @param weight weight accessor - * @param cut cut mask accessor - * @param v... vectors used for filling (one for each dimension) - * @return number of fills performed + * @param hist histogram to fill + * @param weight weight accessor + * @param i IMonitoredVariable entry to fill + * @param m1,m... IMonitoredVariable list to fill from */ - template<typename H, typename W, typename C, typename ...Vs> - unsigned fill(H* hist, W weight, C cut, const Vs&... v) { - - // For >=2D: If one variable has a single entry, do repeated fills with that value - auto get = [](const auto& v, size_t i) { return v.size()==1 ? v[0] : v[i]; }; - - unsigned fills = 0; - for ( size_t i = 0; i < std::max({v.size()...}); ++i ) { - if ( cut(i) ) { - fills++; - // In case re-binning occurs need to take the OH lock for online (no-op offline) - if ( ATH_UNLIKELY(fillWillRebinHistogram(hist, std::index_sequence_for<Vs...>{}, - toFill(get(v,i))...)) ){ - oh_scoped_lock_histogram lock; - doFill(hist, weight(i), get(v,i)...); - } - else doFill(hist, weight(i), get(v,i)...); + template<typename H, typename W, typename M, typename ...Ms> + void doFill(H* hist, W weight, size_t i, const M& m1, const Ms&... m) { + + // Template magic: Recursively convert all M to double or string + if constexpr(std::is_same_v<M, Monitored::IMonitoredVariable>) { + // For >=2D: If one variable has a single entry, do repeated fills with that value + const size_t j = m1.size()==1 ? 0 : i; + if (not m1.hasStringRepresentation()) + doFill(hist, weight, i, m..., m1.get(j)); + else + doFill(hist, weight, i, m..., m1.getString(j).c_str()); + } else { + // In case re-binning occurs need to take the OH lock for online (no-op offline) + if ( ATH_UNLIKELY(fillWillRebinHistogram(hist, std::index_sequence_for<M, Ms...>{}, + m1, m...)) ){ + oh_scoped_lock_histogram lock; + hist->Fill(m1, m..., weight(i)); } + else hist->Fill(m1, m..., weight(i)); } - return fills; } + + // TProfile does not support string as y-value. + // (this terminates the above pack expansion) + template<typename W> + void doFill(TProfile*, W, size_t, const double&, const char* const&) {} + template<typename W> + void doFill(TProfile*, W, size_t, const char* const&, const char* const&) {} } } diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/LumiblockHistogramProvider.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/LumiblockHistogramProvider.h index 293d007e7a866802759e81cae343a0bf84f9f3d4..92cb39c23ca376120131977cddb3e05a12b3290c 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/LumiblockHistogramProvider.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/LumiblockHistogramProvider.h @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - +*/ + #ifndef AthenaMonitoringKernel_HistogramFiller_LumiblockHistogramProvider_h #define AthenaMonitoringKernel_HistogramFiller_LumiblockHistogramProvider_h @@ -16,21 +16,21 @@ namespace Monitored { /** * @brief Implementation of IHistogramProvider for lumi block based histograms - * - * This provider produces histograms that groups data based on current lumi block and defined histogry depth. + * + * This provider produces histograms that groups data based on current lumi block and defined histogry depth. * Note: kLBNHistoryDepth must be defined in histogram definition options */ class LumiblockHistogramProvider : public IHistogramProvider { public: /** * @brief Constructor - * + * * @param gmTool Source of the lumi block info - * @param factory ROOT object factory + * @param factory ROOT object factory * @param def General definition of a histogram */ - LumiblockHistogramProvider(GenericMonitoringTool* const gmTool, - std::shared_ptr<HistogramFactory> factory, + LumiblockHistogramProvider(GenericMonitoringTool* const gmTool, + std::shared_ptr<HistogramFactory> factory, const HistogramDef& histDef) : IHistogramProvider() , m_gmTool(gmTool) @@ -39,36 +39,57 @@ namespace Monitored { {} /** - * @brief Getter of ROOT object - * + * @brief Getter of ROOT object + * * Each time the method is called, factory produces ROOT object based on the current lumi block. * Note: ROOT objects are cached at the factory. Nevertheless, it is recommended to call this method as rarely as possible. - * + * * @return ROOT object */ TNamed* histogram() override { - HistogramDef def = *m_histDef; const unsigned lumiBlock = m_gmTool->lumiBlock(); + if (lumiBlock <= m_lastValidLumiBlock and m_currentHistogram != nullptr) + return m_currentHistogram; + + // a new histogram needed + HistogramDef def = *m_histDef; const int historyDepth = def.kLBNHistoryDepth; if (historyDepth<=0) { throw HistogramException("Histogram >"+ def.path + "< has invalid kLBNHistoryDepth."); } const unsigned lumiPage = lumiBlock/historyDepth; - const unsigned minLumi = lumiPage * historyDepth; - const unsigned maxLumi = minLumi + historyDepth - 1; - if ( historyDepth > 1 ) - def.alias = def.alias + "_LB" + std::to_string(minLumi) + "_" + std::to_string(maxLumi); - else - def.alias = def.alias + "_LB" + std::to_string(minLumi); + auto minLumiBlock = [=](unsigned lumiPage) { return lumiPage * historyDepth; }; + auto maxLumiBlock = [=](unsigned lumiPage) { return (lumiPage+1) * historyDepth - 1; }; + + // Helper function to set the alias in histogram definition + auto setAlias = [&](unsigned lumiPage, HistogramDef& def ) { + if (historyDepth > 1) + def.alias = def.alias + "_LB" + std::to_string(minLumiBlock(lumiPage)) + "_" + std::to_string(maxLumiBlock(lumiPage)); + else + def.alias = def.alias + "_LB" + std::to_string(minLumiBlock(lumiPage)); + }; + + + // deregister previous histogram (we actually may make severall additonal calls to clean the past even deeper) + if (lumiPage != 0) { + HistogramDef deregDef = def; + setAlias(lumiPage -1, deregDef ); + m_factory->remove(deregDef); + } - return m_factory->create(def); + setAlias(lumiPage, def); + m_currentHistogram = m_factory->create(def); + m_lastValidLumiBlock = maxLumiBlock(lumiPage); + return m_currentHistogram; } private: GenericMonitoringTool* const m_gmTool; std::shared_ptr<HistogramFactory> m_factory; std::shared_ptr<HistogramDef> m_histDef; + TNamed *m_currentHistogram = nullptr; + unsigned m_lastValidLumiBlock = 0; }; } diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h index 9aa930a7019dc35fea12bf13f860b042b0e5bd65..71424fa18f1c123a6a45e6a2d763ea805a1c725e 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/VecHistogramFiller1D.h @@ -35,18 +35,16 @@ namespace Monitored { } auto histogram = this->histogram<TH1>(); - const auto valuesVector{var.getVectorRepresentation()}; const unsigned offset = m_histDef->kVecUO ? 0 : 1; - - for (unsigned i = 0; i < std::size(valuesVector); ++i) { + for (unsigned i = 0; i < var.size(); ++i) { if (cutMaskAccessor && cutMaskAccessor(i)) { - const double value = valuesVector[i]; + const double value = var.get(i); histogram->AddBinContent(i+offset, value); histogram->SetEntries(histogram->GetEntries() + value); } } - return std::size(valuesVector); + return var.size(); } }; } diff --git a/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx b/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx index 0eac712c6dbed10e5e9c959da608dc70208fbf15..cf9dea2445bcb16e11af2cbc5ccab048a63427de 100644 --- a/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx +++ b/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx @@ -451,7 +451,7 @@ bool fillFromNonTrivialSources( ToolHandle<GenericMonitoringTool>& monTool, ITHi { //! [fillFromNonTrivialSources_collection] std::vector<float> eta( {0.2, 0.1} ); - std::set<double> phi( {-1, 1} ) ; + std::vector<double> phi( {-1, 1} ) ; auto vectorT = Monitored::Collection( "Eta", eta ); auto setT = Monitored::Collection( "Phi", phi ); auto group = Monitored::Group( monTool, vectorT, setT ); diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx index 64ff81dcf3548f34d98e2316d69aa6adc3c3a552..a16941c0cc10146ccd499318dcc83215f4795f70 100644 --- a/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx +++ b/Control/AthenaMonitoringKernel/test/HistogramFillerFactoryTestSuite.cxx @@ -90,6 +90,7 @@ class HistogramFillerFactoryTestSuite { } void test_shouldCreateStaticHistogramFiller1D() { + m_histDef->type = "TH1F"; performCreateFillerAndVerify<HistogramFiller1D, StaticHistogramProvider>(); } @@ -105,6 +106,7 @@ class HistogramFillerFactoryTestSuite { void test_shouldCreateStaticHistogramFillerRebinable1D() { m_histDef->kAddBinsDynamically = true; + m_histDef->type = "TH1F"; performCreateFillerAndVerify<HistogramFillerRebinable1D, StaticHistogramProvider>(); } diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx index 66ea679ec34db349ef2a5d7cec9d7f94d5fe9c1d..1744e3dd5e901e61349133e23bc20957df7f59a0 100644 --- a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx +++ b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable1DTestSuite.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #undef NDEBUG @@ -20,10 +20,10 @@ #include "TProfile.h" #include "TProfile2D.h" +#include "AthenaMonitoringKernel/MonitoredScalar.h" #include "../src/HistogramFiller/HistogramFillerRebinable.h" #include "mocks/MockHistogramProvider.h" -#include "mocks/MockMonitoredVariable.h" using namespace std; using namespace Monitored; @@ -53,11 +53,9 @@ class HistogramFillerRebinable1DTestSuite { void beforeEach() { m_histogramDef.kAddBinsDynamically = true; m_histogramProvider.reset(new MockHistogramProvider()); - m_monitoredVariable.reset(new MockMonitoredVariable("")); m_histogram.reset(new TH1D("MockHistogram", "Mock Histogram", 8, 1.0, 3.0)); m_testObj.reset(new HistogramFillerRebinable1D(m_histogramDef, m_histogramProvider)); - m_testObj->setMonitoredVariables({ *m_monitoredVariable }); m_histogramProvider->mock_histogram = [this]() { return m_histogram.get(); }; } @@ -65,10 +63,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldKeepNumberOfBinsForValueInHistogramsRange() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 2.9 }; - }; - + Monitored::Scalar<double> var("var", 2.9); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); VALUE(m_histogram->GetXaxis()->GetXmax()) EXPECTED(3.0); @@ -82,9 +78,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldDoubleNumberOfBinsForBoundaryValueOf3() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 3.0 }; - }; + Monitored::Scalar<double> var("var", 3.0); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -99,9 +94,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldDoubleNumberOfBinsForValueSlightlySmallerThan5() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 4.9 }; - }; + Monitored::Scalar<double> var("var", 4.9); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -116,9 +110,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldQuadrupleNumberOfBinsForBoundaryValueOf5() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 5.0 }; - }; + Monitored::Scalar<double> var("var", 5.0); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -133,9 +126,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldQuadrupleNumberOfBinsForValueSlightlyBiggerThan5() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 5.1 }; - }; + Monitored::Scalar<double> var("var", 5.1); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -150,9 +142,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldQuadrupleNumberOfBinsForValueSlightlySmallerThan9() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 8.9 }; - }; + Monitored::Scalar<double> var("var", 8.9); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -167,9 +158,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldOctupleNumberOfBinsForBoundaryValueOf9() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 9.0 }; - }; + Monitored::Scalar<double> var("var", 9.0); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -184,9 +174,8 @@ class HistogramFillerRebinable1DTestSuite { } void test_shouldOctupleNumberOfBinsForValueSlightlyBiggerThan9() { - m_monitoredVariable->mock_getVectorRepresentation = []() -> vector<double> { - return { 9.1 }; - }; + Monitored::Scalar<double> var("var", 9.1); + m_testObj->setMonitoredVariables({var}); VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); VALUE(m_histogram->GetXaxis()->GetXmin()) EXPECTED(1.0); @@ -234,7 +223,6 @@ class HistogramFillerRebinable1DTestSuite { HistogramDef m_histogramDef; shared_ptr<MockHistogramProvider> m_histogramProvider; - shared_ptr<MockMonitoredVariable> m_monitoredVariable; shared_ptr<TH1D> m_histogram; shared_ptr<HistogramFillerRebinable1D> m_testObj; diff --git a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx index d4eef99dc931a47a4b122ac53452541c60136b80..3986434f8673586094261287f63aa4b910a5d66f 100644 --- a/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx +++ b/Control/AthenaMonitoringKernel/test/HistogramFillerRebinable2DTestSuite.cxx @@ -23,10 +23,10 @@ #include "TH2D.h" +#include "AthenaMonitoringKernel/MonitoredScalar.h" #include "../src/HistogramFiller/HistogramFillerRebinable.h" #include "mocks/MockHistogramProvider.h" -#include "mocks/MockMonitoredVariable.h" using namespace std; using namespace Monitored; @@ -48,12 +48,9 @@ class HistogramFillerRebinable2DTestSuite { void beforeEach() { m_histogramDef.kAddBinsDynamically = true; m_histogramProvider.reset(new MockHistogramProvider()); - m_var1.reset(new MockMonitoredVariable("")); - m_var2.reset(new MockMonitoredVariable("")); m_histogram.reset(new TH2D("MockHistogram", "Mock Histogram", 8, 1.0, 3.0, 5, 1.0, 5.0)); m_testObj.reset(new HistogramFillerRebinable2D(m_histogramDef, m_histogramProvider)); - m_testObj->setMonitoredVariables({ *m_var1, *m_var2 }); m_histogramProvider->mock_histogram = [this]() { return m_histogram.get(); }; } @@ -61,8 +58,9 @@ class HistogramFillerRebinable2DTestSuite { } void test_shouldKeepNumberOfBinsForValueInHistogramsRange() { - m_var1->mock_getVectorRepresentation = []() -> vector<double> { return {2.9}; }; - m_var2->mock_getVectorRepresentation = []() -> vector<double> { return {4.9}; }; + Monitored::Scalar<double> var1("var1", 2.9); + Monitored::Scalar<double> var2("var2", 4.9); + m_testObj->setMonitoredVariables({var1, var2}); auto check = [&](){ VALUE(m_histogram->GetXaxis()->GetNbins()) EXPECTED(8); @@ -79,8 +77,9 @@ class HistogramFillerRebinable2DTestSuite { } void test_shouldDoubleNumberOfBinsForValueOutsideRange() { - m_var1->mock_getVectorRepresentation = []() -> vector<double> { return {3.0}; }; - m_var2->mock_getVectorRepresentation = []() -> vector<double> { return {5.0}; }; + Monitored::Scalar<double> var1("var1", 3.0); + Monitored::Scalar<double> var2("var2", 5.0); + m_testObj->setMonitoredVariables({var1, var2}); m_testObj->fill(); @@ -125,7 +124,6 @@ class HistogramFillerRebinable2DTestSuite { HistogramDef m_histogramDef; shared_ptr<MockHistogramProvider> m_histogramProvider; - shared_ptr<MockMonitoredVariable> m_var1, m_var2; shared_ptr<TH2D> m_histogram; shared_ptr<HistogramFillerRebinable2D> m_testObj; diff --git a/Control/AthenaMonitoringKernel/test/LumiblockHistogramProviderTestSuite.cxx b/Control/AthenaMonitoringKernel/test/LumiblockHistogramProviderTestSuite.cxx index 4f2f7fc3163e03336666b3a777e8739d0885081d..80e8933517b4e42311e70e5a376ec7b83046362d 100644 --- a/Control/AthenaMonitoringKernel/test/LumiblockHistogramProviderTestSuite.cxx +++ b/Control/AthenaMonitoringKernel/test/LumiblockHistogramProviderTestSuite.cxx @@ -41,7 +41,7 @@ class LumiblockHistogramProviderTestSuite { REGISTER_TEST_CASE(test_shouldThrowExceptionWhen_kLBNHistoryDepth_isNonPositive), REGISTER_TEST_CASE(test_shouldNotThrowExceptionWhen_kLBNHistoryDepth_isDefinedAsNumber), REGISTER_TEST_CASE(test_shouldCreateNewHistogramWithUpdatedAlias), - REGISTER_TEST_CASE(test_shouldCreateNewHistogramWithUpdatedLumiBlock), + REGISTER_TEST_CASE(test_shouldCreateNewHistogramWithUpdatedLumiBlock) }; } @@ -87,26 +87,36 @@ class LumiblockHistogramProviderTestSuite { make_tuple(9, "test alias_LB9_11"), }; - TNamed histogram; + TH1F histogram("h", "h", 1, 0, 1); HistogramDef histogramDef; histogramDef.alias = "test alias"; histogramDef.kLBNHistoryDepth = 3; + m_gmTool->histSvc().mock_always_empty = false; // the moc actually keeps track of registered histograms LumiblockHistogramProvider testObj(m_gmTool.get(), m_histogramFactory, histogramDef); for (auto input : expectedFlow) { const unsigned lumiBlock = get<0>(input); const string expectedAlias = get<1>(input); - m_gmTool->mock_lumiBlock = [lumiBlock]() { return lumiBlock; }; - m_histogramFactory->mock_create = [&histogram, expectedAlias](const HistogramDef& def) mutable { + m_gmTool->mock_lumiBlock = [&]() { return lumiBlock; }; + m_histogramFactory->mock_create = [&](const HistogramDef& def) mutable { VALUE(def.alias) EXPECTED(expectedAlias); + m_log << MSG::INFO << "Registering: " << def.alias << endmsg; + m_gmTool->histSvc().regHist(m_histogramFactory->getFullName(def), &histogram).ignore(); return &histogram; }; + m_histogramFactory->mock_remove = [&](const Monitored::HistogramDef& def) { + m_log << MSG::INFO << "Deregistering: " << def.alias << endmsg; + m_gmTool->histSvc().deReg(m_histogramFactory->getFullName(def)).ignore(); + return nullptr; + }; + TNamed* const result = testObj.histogram(); VALUE(result) EXPECTED(&histogram); } + VALUE( m_gmTool->histSvc().mock_registered.size() ) EXPECTED ( 1 ); } void test_shouldCreateNewHistogramWithUpdatedLumiBlock() { @@ -145,7 +155,7 @@ class LumiblockHistogramProviderTestSuite { // ==================== Initialization & run ==================== public: - LumiblockHistogramProviderTestSuite() + LumiblockHistogramProviderTestSuite() : m_log(Athena::getMessageSvc(), "LumiblockHistogramProviderTestSuite") { } diff --git a/Control/AthenaMonitoringKernel/test/MonitoredScalarTestSuite.cxx b/Control/AthenaMonitoringKernel/test/MonitoredScalarTestSuite.cxx index a7589f55824da8689861043c9ac4952a96ef1025..9ed684776992e3a6f3de4ff1949da8969de18762 100644 --- a/Control/AthenaMonitoringKernel/test/MonitoredScalarTestSuite.cxx +++ b/Control/AthenaMonitoringKernel/test/MonitoredScalarTestSuite.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #undef NDEBUG @@ -30,7 +30,7 @@ class MonitoredScalarTestSuite { REGISTER_TEST_CASE(test_shouldAcceptCustomTypeAndReturnOriginalValue), REGISTER_TEST_CASE(test_shouldAllowToProvideRepresentationConverter), REGISTER_TEST_CASE(test_shouldAllowToChangeUnderlayingValue), - REGISTER_TEST_CASE(test_shouldReturnSingleElementVectorRepresentation), + REGISTER_TEST_CASE(test_shouldReturnSingleElement), }; } @@ -60,10 +60,9 @@ class MonitoredScalarTestSuite { void test_shouldAllowToProvideRepresentationConverter() { auto phi = Monitored::Scalar<double>("phi", 4.123456789012345, [](double value) { return value * 1000; }); - std::vector<double> representation = phi.getVectorRepresentation(); assert(phi == 4.123456789012345); - assert(representation[0] == 4123.456789012345); + assert(phi.get(0) == 4123.456789012345); } void test_shouldAllowToChangeUnderlayingValue() { @@ -74,12 +73,11 @@ class MonitoredScalarTestSuite { assert(phi == 5.5); } - void test_shouldReturnSingleElementVectorRepresentation() { - auto phi = Monitored::Scalar("phi", 4.2); - std::vector<double> representation = phi.getVectorRepresentation(); + void test_shouldReturnSingleElement() { + auto phi = Monitored::Scalar("phi", 4.2); - assert(size(representation) == 1); - assert(representation[0] == 4.2); + assert(phi.size() == 1); + assert(phi.get(0) == 4.2); } // ==================== Helper methods ==================== diff --git a/Control/AthenaMonitoringKernel/test/mocks/MockHistogramFactory.h b/Control/AthenaMonitoringKernel/test/mocks/MockHistogramFactory.h index 076e24d96ce28068e78195dc801601e8a5b36b47..55e77e7d7c28a6ffa929f03d9e02de323e661d04 100644 --- a/Control/AthenaMonitoringKernel/test/mocks/MockHistogramFactory.h +++ b/Control/AthenaMonitoringKernel/test/mocks/MockHistogramFactory.h @@ -1,3 +1,4 @@ + #ifndef AthenaMonitoringKernel_test_mocks_MockHistogramFactory_h #define AthenaMonitoringKernel_test_mocks_MockHistogramFactory_h @@ -14,6 +15,10 @@ class MockHistogramFactory : public Monitored::HistogramFactory { TNamed* create(const Monitored::HistogramDef& def) override { return mock_create ? mock_create(def) : nullptr; } + std::function<TNamed*(const Monitored::HistogramDef& def)> mock_remove; + void remove( const Monitored::HistogramDef& def ) override { + if ( mock_remove ) mock_remove(def); + } }; -#endif /* AthenaMonitoringKernel_test_mocks_MockHistogramFactory_h */ \ No newline at end of file +#endif /* AthenaMonitoringKernel_test_mocks_MockHistogramFactory_h */ diff --git a/Control/AthenaMonitoringKernel/test/mocks/MockITHistSvc.h b/Control/AthenaMonitoringKernel/test/mocks/MockITHistSvc.h index b12f505ebd126557107daa38e609f7b80779d29b..28dfbdd351d60b92a270305be3d0eebc3255e7d5 100644 --- a/Control/AthenaMonitoringKernel/test/mocks/MockITHistSvc.h +++ b/Control/AthenaMonitoringKernel/test/mocks/MockITHistSvc.h @@ -6,7 +6,7 @@ class MockITHistSvc : public ITHistSvc { private: const std::string m_name = "MockITHistSvc"; - public: + public: virtual const std::string& name() const override { return m_name; }; Gaudi::StateMachine::State FSMState() const override { return Gaudi::StateMachine::OFFLINE; } Gaudi::StateMachine::State targetFSMState() const override { return Gaudi::StateMachine::OFFLINE; } @@ -26,7 +26,9 @@ class MockITHistSvc : public ITHistSvc { StatusCode stop() override { return StatusCode::SUCCESS; } StatusCode terminate() override { return StatusCode::SUCCESS; } StatusCode deReg(TObject*) override { return StatusCode::SUCCESS; } - StatusCode deReg(const std::string&) override { return StatusCode::SUCCESS; } + + StatusCode deReg(const std::string& path) override { mock_registered.erase( path ); return StatusCode::SUCCESS; } + StatusCode getEfficiency(const std::string&, TEfficiency*&) const override { return StatusCode::SUCCESS; } StatusCode getGraph(const std::string&, TGraph*&) const override { return StatusCode::SUCCESS; } StatusCode getHist(const std::string&, TH1*&, size_t) const override { return StatusCode::SUCCESS; } @@ -59,7 +61,9 @@ class MockITHistSvc : public ITHistSvc { StatusCode regGraph(const std::string&, TGraph*) override { return StatusCode::SUCCESS; } StatusCode regGraph(const std::string&, std::unique_ptr<TGraph>) override { return StatusCode::SUCCESS; } StatusCode regHist(const std::string&) override { return StatusCode::SUCCESS; } - StatusCode regHist(const std::string&, TH1*) override { return StatusCode::SUCCESS; } + + StatusCode regHist(const std::string& path, TH1* h) override { if ( not mock_always_empty ) mock_registered[path] = h; return StatusCode::SUCCESS; } + StatusCode regHist(const std::string&, std::unique_ptr<TH1>) override { return StatusCode::SUCCESS; } StatusCode regHist(const std::string&, std::unique_ptr<TH1>, TH1*) override { return StatusCode::SUCCESS; } StatusCode regShared(const std::string&, std::unique_ptr<TEfficiency>, LockedHandle<TEfficiency>&) override { return StatusCode::SUCCESS; } @@ -70,7 +74,9 @@ class MockITHistSvc : public ITHistSvc { StatusCode regTree(const std::string&) override { return StatusCode::SUCCESS; } StatusCode regTree(const std::string&, TTree*) override { return StatusCode::SUCCESS; } StatusCode regTree(const std::string&, std::unique_ptr<TTree>) override { return StatusCode::SUCCESS; } - bool exists(const std::string&) const override { return false; } + + bool exists(const std::string& path) const override { return mock_registered.find( path ) != mock_registered.end(); } + bool existsHist(const std::string&) const override { return false; } bool existsTree(const std::string&) const override { return false; } bool existsGraph(const std::string&) const override { return false; } @@ -82,6 +88,8 @@ class MockITHistSvc : public ITHistSvc { std::vector<std::string> getHists() const override { return {}; } std::vector<std::string> getTrees() const override { return {}; } void setServiceManager(ISvcManager*) override {} + bool mock_always_empty = true; + std::map<std::string, TObject*> mock_registered; }; #endif /* AthenaMonitoringKernel_test_mocks_MockITHistSvc_h */ diff --git a/Control/AthenaMonitoringKernel/test/mocks/MockMonitoredVariable.h b/Control/AthenaMonitoringKernel/test/mocks/MockMonitoredVariable.h deleted file mode 100644 index 0c1949d9e3bc9910367dd3f915de0f0122bf63a0..0000000000000000000000000000000000000000 --- a/Control/AthenaMonitoringKernel/test/mocks/MockMonitoredVariable.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef AthenaMonitoringKernel_test_mocks_MockMonitoredVariable_h -#define AthenaMonitoringKernel_test_mocks_MockMonitoredVariable_h - -#include <functional> - -#include "AthenaMonitoringKernel/IMonitoredVariable.h" - -class MockMonitoredVariable : public Monitored::IMonitoredVariable { - public: - MockMonitoredVariable(const std::string& name) : IMonitoredVariable(name) {} - - std::function<std::vector<double>()> mock_getVectorRepresentation; - std::vector<double> getVectorRepresentation() const override { - return mock_getVectorRepresentation ? mock_getVectorRepresentation() : std::vector<double>(); - } - bool hasStringRepresentation() const override { return false; } - std::vector<std::string> getStringVectorRepresentation() const override { return {}; } - size_t size() const override { return getVectorRepresentation().size(); } -}; - -#endif /* AthenaMonitoringKernel_test_mocks_MockMonitoredVariable_h */ diff --git a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py index 67a03cb3206900382037f9dde96c5f79929e620e..65002af012480216d831ee5548b9c27f2351f5c6 100644 --- a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py +++ b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py @@ -10,7 +10,7 @@ from AthenaMonitoringKernel.GenericMonitoringTool import defineHistogram, define class Test( unittest.TestCase ): def test_1D( self ): - check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', '', 10, 0.0, 10.0) + check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', 10, 0.0, 10.0) true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0.0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true)) @@ -86,7 +86,7 @@ class Test( unittest.TestCase ): self.assertEqual(json.loads(check), json.loads(true)) def test_merge( self ): - check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', '', 10, 0.0, 10.0, merge='weightedAverage') + check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', 10, 0.0, 10.0, merge='weightedAverage') true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "weightedAverage", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false}' self.assertEqual(json.loads(check), json.loads(true)) @@ -94,6 +94,20 @@ class Test( unittest.TestCase ): check = defineHistogram('var;alias;more') self.assertFalse(check) + def test_invalidAlias( self ): + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + athenaCommonFlags.isOnline = True + check = defineHistogram('var;myhist(', path='EXPERT') + self.assertIs(check, '') + check = defineHistogram('var;myhist', path='EXPERT') + self.assertNotEqual(check, '') + + athenaCommonFlags.isOnline = False + check = defineHistogram('var;my/hist') + self.assertIs(check, '') + check = defineHistogram('var;myhist(') + self.assertNotEqual(check, '') + def test_enforcePath( self ): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.isOnline = True @@ -111,11 +125,10 @@ class Test( unittest.TestCase ): athenaCommonFlags.isOnline = False def test_enforceMergeTypesTest( self ): - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags with self.assertRaises(AssertionError): - check = defineHistogram('var,pass', type='TEfficiency', merge='weightedAverage') + defineHistogram('var,pass', type='TEfficiency', merge='weightedAverage') with self.assertRaises(AssertionError): - check = defineHistogram('var,pass', type='TTree', merge='weightedAverage') + defineHistogram('var,pass', type='TTree', merge='weightedAverage') if __name__ == '__main__': diff --git a/Control/AthenaPython/python/Bindings.py b/Control/AthenaPython/python/Bindings.py index 6456984b4a51be9556a81d3467e4cbf0c4fb7aae..6672e2c2220045d61955e05b7c92c393e7924285 100644 --- a/Control/AthenaPython/python/Bindings.py +++ b/Control/AthenaPython/python/Bindings.py @@ -6,7 +6,6 @@ from __future__ import print_function ### data -__version__ = "$Revision: 1.30 $" __author__ = """ Sebastien Binet (binet@cern.ch) """ @@ -277,14 +276,6 @@ def _py_init_StoreGateSvc(): except Exception: pass # fwd compatibility from StoreGateBindings.Bindings import StoreGateSvc - ## merge aliases... - global _clid_typename_aliases - from AthenaServices.Dso import _load_typeregistry_dso - try: - _clid_typename_aliases.update(_load_typeregistry_dso()) - except OSError: - # no typeregistry file... - pass return StoreGateSvc @memoize diff --git a/Control/AthenaServices/python/Dso.py b/Control/AthenaServices/python/Dso.py index 1507ba5d31ba721df7ae43933f603d40b651b832..1eab8a54bcd51ae7ed80676067f71cbc5566109c 100644 --- a/Control/AthenaServices/python/Dso.py +++ b/Control/AthenaServices/python/Dso.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file: AthenaServices/python/Dso.py # @purpose: simple interface to the rootmap files to easily locate reflex @@ -23,8 +23,6 @@ __all__ = [ import os from PyUtils import Dso as _Dso from PyUtils.Dso import _aliases -from PyUtils.Decorators import memoize -_load_typeregistry_dso = memoize(_Dso.load_typeregistry_dso) try: # attempt at fixing up the pyroot iterators... @@ -114,23 +112,7 @@ class DsoDb(_Dso.PyDsoDb): return rflx_type return None - # FIXME: not yet -## def _to_rflx_name (self, typename): -## """helper method to massage a typename into something understandable -## by reflex (which doesn't understand the same thing than rootmaps). -## """ -## rflx_name = None -## try: -## rflx_names = _load_typeregistry_dso() -## except OSError: -## rflx_names = None -## if rflx_names: -## rflx_name = rflx_names.get(typename, None) -## if rflx_name: -## return rflx_name -## return _Dso.DsoDb._to_rflx_name(self, typename) - - + def visit(self, typename, visitor=None, ctx=None): self.msg.verbose("=== visiting %s", typename) if ctx is None: diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx index 08f9607bc043cd2bca2aa35395cc9e2c7136cbb2..ec733590e94640da25c49554d0b1f533fd0353a3 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.cxx +++ b/Control/AthenaServices/src/AthenaOutputStream.cxx @@ -611,7 +611,7 @@ StatusCode AthenaOutputStream::write() { // lock.unlock(); // Connect the output file to the service - if (!streamer->connectOutput(outputFN).isSuccess()) { + if (!streamer->connectOutput(connectStr).isSuccess()) { ATH_MSG_FATAL("Could not connectOutput"); return StatusCode::FAILURE; } @@ -626,7 +626,12 @@ StatusCode AthenaOutputStream::write() { ATH_MSG_DEBUG("streamObjects failed."); } } - if (!streamer->commitOutput().isSuccess()) { + bool doCommit = false; + if (m_events % m_autoSend.value() == 0 && outputFN.find("?pmerge=") != std::string::npos) { + doCommit = true; + ATH_MSG_DEBUG("commitOutput sending data."); + } + if (!streamer->commitOutput(doCommit).isSuccess()) { ATH_MSG_FATAL("commitOutput failed."); failed = true; } diff --git a/Control/AthenaServices/src/AthenaOutputStream.h b/Control/AthenaServices/src/AthenaOutputStream.h index 6071cefba9841e00e3d9d40708bc4da82d1fc91d..5085056a2bf3667713c18d5b85a3d34e64986cbe 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.h +++ b/Control/AthenaServices/src/AthenaOutputStream.h @@ -76,11 +76,13 @@ protected: ServiceHandle<OutputStreamSequencerSvc> m_outSeqSvc; /// Vector of item names - StringArrayProperty m_itemList{this,"ItemList",{},"List of items to write","Set<std::string>"}; + StringArrayProperty m_itemList{this,"ItemList",{},"List of items to write","Set<std::string>"}; /// Vector of item names StringArrayProperty m_metadataItemList; /// Vector of item names StringArrayProperty m_excludeList; + /// Number of commits after which to do a flush when using in memory files + IntegerProperty m_autoSend{this,"AutoSend",-1}; /// Vector of item names StringArrayProperty m_compressionListHigh; /// Vector of item names diff --git a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx index 30178802dbd2a2bff101996e0d871c219ffaeb31..372fbd78089c464006e76fd0313975f7da135af7 100644 --- a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx +++ b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx @@ -47,7 +47,7 @@ AthenaOutputStreamTool::AthenaOutputStreamTool(const std::string& type, m_conversionSvc("AthenaPoolCnvSvc", name), m_clidSvc("ClassIDSvc", name), m_decSvc("DecisionSvc/DecisionSvc", name), - m_dataHeader(0), + m_dataHeader(nullptr), m_dataHeaderKey(name), m_connectionOpen(false), m_extendProvenanceRecord(false) { @@ -292,7 +292,8 @@ StatusCode AthenaOutputStreamTool::connectOutput(const std::string& outputName) } // list property check // Record DataHeader in StoreGate - if (m_store->record(m_dataHeader, m_dataHeaderKey).isFailure()) { + SG::WriteHandle<DataHeader> wh(m_dataHeaderKey, m_store->name()); + if (wh.record(std::unique_ptr<DataHeader>(m_dataHeader)).isFailure()) { ATH_MSG_ERROR("Unable to record DataHeader with key " << m_dataHeaderKey); return(StatusCode::FAILURE); } else { @@ -304,11 +305,10 @@ StatusCode AthenaOutputStreamTool::connectOutput(const std::string& outputName) return(StatusCode::SUCCESS); } //__________________________________________________________________________ -StatusCode AthenaOutputStreamTool::commitOutput() { +StatusCode AthenaOutputStreamTool::commitOutput(bool doCommit) { ATH_MSG_DEBUG("In commitOutput"); - m_outputName.setValue(m_outputName.value().substr(0, m_outputName.value().find("["))); // Connect the output file to the service - if (m_conversionSvc->commitOutput(m_outputName.value(), false).isFailure()) { + if (m_conversionSvc->commitOutput(m_outputName.value(), doCommit).isFailure()) { ATH_MSG_ERROR("Unable to commit output " << m_outputName.value()); return(StatusCode::FAILURE); } @@ -434,7 +434,7 @@ StatusCode AthenaOutputStreamTool::streamObjects(const DataObjectVec& dataObject } } // End of loop over DataObjects, write DataHeader - if (m_conversionSvc.type() == "AthenaPoolCnvSvc") { + if (m_conversionSvc.type() == "AthenaPoolCnvSvc" && dataHeaderObj != nullptr) { IOpaqueAddress* addr = new TokenAddress(0, dataHeaderObj->clID(), outputConnectionString); if (m_conversionSvc->createRep(dataHeaderObj, addr).isSuccess()) { written.insert(std::pair<DataObject*, IOpaqueAddress*>(dataHeaderObj, addr)); @@ -470,7 +470,7 @@ StatusCode AthenaOutputStreamTool::streamObjects(const DataObjectVec& dataObject } } m_dataHeader->addHash(&*m_store); - if (m_conversionSvc.type() == "AthenaPoolCnvSvc") { + if (m_conversionSvc.type() == "AthenaPoolCnvSvc" && dataHeaderObj != nullptr) { // End of DataObjects, fill refs for DataHeader SG::DataProxy* proxy = dynamic_cast<SG::DataProxy*>(dataHeaderObj->registry()); if (proxy != nullptr && written.find(dataHeaderObj) != written.end()) { diff --git a/Control/AthenaServices/src/AthenaOutputStreamTool.h b/Control/AthenaServices/src/AthenaOutputStreamTool.h index b8fb5c431b8f16e8ab5b1a86d7712d7e8827ffbe..51a370d4ecb4f0b424b5e30e2d43e1e703922b10 100644 --- a/Control/AthenaServices/src/AthenaOutputStreamTool.h +++ b/Control/AthenaServices/src/AthenaOutputStreamTool.h @@ -55,7 +55,7 @@ public: /// Commit the output stream after having streamed out objects /// Must commitOutput AFTER streaming - StatusCode commitOutput(); + StatusCode commitOutput(bool doCommit = false); /// Finalize the output stream after the last commit, e.g. in /// finalize diff --git a/Control/AthenaServices/src/ThinningSvc.cxx b/Control/AthenaServices/src/ThinningSvc.cxx index e5b01788ad3e042e4d5102c1ceebb37d8f41061d..37e06352f8ded616da31ca69e258d19d6b90053b 100644 --- a/Control/AthenaServices/src/ThinningSvc.cxx +++ b/Control/AthenaServices/src/ThinningSvc.cxx @@ -111,10 +111,6 @@ StatusCode ThinningSvc::initialize() } ATH_MSG_INFO ("Thinning streams: [ " << streams.str() << "]"); } - if ( m_thinnedOutStreamNames.value().empty() ) { - ATH_MSG_WARNING - ("No stream labeled as to be thinned ! Check your configuration !"); - } return StatusCode::SUCCESS; } diff --git a/Control/AthenaServices/test/RecoMetadata_test.py b/Control/AthenaServices/test/RecoMetadata_test.py new file mode 100755 index 0000000000000000000000000000000000000000..acee94898c3e69fc9524b4dd409ce6a678529c6a --- /dev/null +++ b/Control/AthenaServices/test/RecoMetadata_test.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# art-description: Validate in-file metadata in MT q431 +# art-type: grid +# art-athena-mt: 8 +# +import argparse +import json +import os +from subprocess import Popen, STDOUT +import sys + +from AthenaCommon.Logging import logging +from PyUtils.MetaDiff import meta_diff + + +MSG = logging.getLogger('RecoMetadata_test') + +STEPS = ["BStoRAW", "BStoESD", "ESDtoAOD"] + +CONFIG = { + "execOnly": True, + "preInclude": ["mt.py"], + "AMI": "q431", + "inputBSFile": [ + "/eos/user/g/goetz/data/data17/data17_13TeV.00330470.physics_Main.daq.RAW.mix._0001.data", + "/eos/user/g/goetz/data/data17/data17_13TeV.00337215.physics_Main.daq.RAW.mix._0001.data", + "/eos/user/g/goetz/data/data18/data18_13TeV.00363979.physics_Main.daq.RAW.0250._0001.data"] +} + +SERIAL = {step: CONFIG.copy() for step in STEPS} +for k, v in SERIAL.items(): + if k == "BStoRAW": + v.update(outputDRAW_ZMUMUFile=["serial_DRAW"]) + if k == "BStoESD": + v.update(outputESDFile=["serial_ESD.pool.root"]) + if k == "ESDtoAOD": + v.update( + inputESDFile=SERIAL["BStoESD"]["outputESDFile"], + outputAODFile=["serial_AOD.pool.root"]) + del v["inputBSFile"] + +THREAD = {step: CONFIG.copy() for step in STEPS} +for k, v in THREAD.items(): + v["multithreaded"] = True + if k == "BStoRAW": + v.update(outputDRAW_ZMUMUFile=["threaded_DRAW"]) + if k == "BStoESD": + v.update(outputESDFile=["threaded_ESD.pool.root"]) + if k == "ESDtoAOD": + v.update( + inputESDFile=SERIAL["BStoESD"]["outputESDFile"], + outputAODFile=["threaded_AOD.pool.root"]) + del v["inputBSFile"] + + +PRE_INCLUDE = '''\ +rec.doMonitoring.set_Value_and_Lock(True); +from AthenaMonitoring.DQMonFlags import DQMonFlags; +DQMonFlags.doStreamAwareMon=False; +DQMonFlags.doMuonRawMon=False; +DQMonFlags.doMuonSegmentMon=False; +DQMonFlags.doMuonTrackMon=False; +DQMonFlags.doMuonAlignMon=False; +DQMonFlags.doMuonTrkPhysMon=False; +DQMonFlags.doMuonPhysicsMon=False; +DQMonFlags.doGlobalMon.set_Value_and_Lock(False); +DQMonFlags.doMonitoring.set_Value_and_Lock(False); + +rec.doTrigger = False + +# rec.doMuon = True +# rec.doMuonCombined = True +# from DiTauRec.DiTauRecFlags import jobproperties +# jobproperties.DiTauRecFlags.doDiTauRec = True + +from ParticleBuilderOptions.AODFlags import AODFlags +AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) + +if True : + from PerfMonComps.PerfMonFlags import jobproperties as pmon_properties + pmon_properties.PerfMonFlags.doSemiDetailedMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doFastMon.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doSemiDetailedMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doSemiDetailedMonitoringFullPrint.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doFullMon.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doMallocMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doExtraPrintouts.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doHephaestusMon.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doDsoMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doPersistencyMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doDataProxySizeMonitoring.set_Value_and_Lock(False) + pmon_properties.PerfMonFlags.doPostProcessing.set_Value_and_Lock(False) +''' + + +def build_transform_command(config): + """ + build command to hand to subproccess from configuration + """ + command = ["Reco_tf.py"] + + for key, value in config.items(): + MSG.debug("adding %s and %s to command", key, value) + + if isinstance(value, bool): + if value: + command.append("--{}".format(key)) + elif isinstance(value, list): + command.append("--{}".format(key)) + command += value + else: + command.append("--{}".format(key)) + command.append(value) + + MSG.debug("command list: %s", command) + + return command + + +def serial(config, verbose=False): + """ + Run threaded Reconstruction transform based on parameters provided in + config parameter + :param: config: configuration dictionary to hand to transform + :param: threads: number of threads to use + :param: verbose: whether to be laconic or not + :return: transform exit code + """ + return run_transform(config, env=os.environ, verbose=verbose) + + +def thread(config, threads=8, verbose=False): + """ + Run threaded Reconstruction transform based on parameters provided in + config parameter + :param: config: configuration dictionary to hand to transform + :param: threads: number of threads to use + :param: verbose: whether to be laconic or not + :return: transform exit code + """ + env = os.environ.copy() + env["ATHENA_CORE_NUMBER"] = str(threads) + + return run_transform(config, env=env, verbose=verbose) + + +def run_transform(config, env, verbose=False): + """ + run Reco_tf.py with given configuration + + :return: return value of transform + """ + # MSG.debug("job environment: %s", json.dumps(env, indent=2)) + MSG.debug("job config: %s", json.dumps(config)) + MSG.debug("job config: %s", json.dumps(config)) + + command = build_transform_command(config) + MSG.info('running: %s', ' '.join(command)) + + try: + if verbose: + proc = Popen(command, env=env) + else: + with open(os.devnull, 'w') as dev_null: + proc = Popen(command, env=env, stdout=dev_null, stderr=STDOUT) + + return proc.wait() + + except KeyboardInterrupt: + proc.kill() + MSG.debug('comparison cancelled') + sys.exit(0) + + +def get_args(): + """ + handle command line arguments + """ + parser = argparse.ArgumentParser(description='''\ + Run q431 reconstruction transform on the given input (default are + some of Goetz's files on EOS). Compare the in-file metadata of the + output files. + ''') + parser.add_argument('-v', '--verbose', action='store_true', + help='do not be laconic') + parser.add_argument('inputBS', metavar='FILE', type=str, nargs='*', + help='bytestream file(s) to use as input') + + args = parser.parse_args() + MSG.setLevel(logging.DEBUG if args.verbose else logging.INFO) + + input_files = args.inputBS if args.inputBS else CONFIG['inputBSFile'] + MSG.info("input files:") + MSG.info(' '.join(input_files)) + + for step, config in SERIAL.items(): + for key in config: + if key == "inputBSFile": + SERIAL[step][key] = input_files + + for step, config in THREAD.items(): + for key in config: + if key == "inputBSFile": + THREAD[step][key] = input_files + + return args + + +def main(): + """write pre-include to file, run transforms, compare results, report + """ + args = get_args() + + for file_name in CONFIG["preInclude"]: + with open(file_name, 'w') as handle: + handle.write(PRE_INCLUDE) + + for step in STEPS: + MSG.info('%s in serial mode', step) + s_status = serial(SERIAL[step], verbose=args.verbose) + print("art-result: {} {}_serial_transform".format(s_status, step)) + + MSG.info('%s in threaded mode', step) + t_status = thread(THREAD[step], verbose=args.verbose) + print("art-result: {} {}_threaded_transform".format(t_status, step)) + + try: + s_file = [value for key, value in SERIAL[step].items() if "output" in key.lower()] + s_file = s_file[0][0] + + t_file = [value for key, value in THREAD[step].items() if "output" in key.lower()] + t_file = t_file[0][0] + except IndexError: + MSG.error("missing output found for steo %s", step) + print("art-result: 1 can_read_metadata") + print("art-result: 1 {}".format(step)) + continue + + MSG.info('Comparing metadata in %s and %s', s_file, t_file) + try: + diff = meta_diff([s_file, t_file], mode='full', drop=['file_guid']) + + print("art-result: 0 can_read_metadata") + if diff: + MSG.warning(''.join(diff)) + print("art-result: {} {}".format(0 if len(diff) < 2 else 1, step)) + except (ReferenceError, StopIteration): + MSG.error('failed to read metadata from: %s and/or %s', s_file, t_file) + print("art-result: 1 can_read_metadata") + print("art-result: 1 {}".format(step)) + continue + + +if __name__ == "__main__": + main() diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p1.icc b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p1.icc index baa634995f7972a049a9ed086d82d16eaadf0d4f..9c328d99394f13ae2e1ff7c457ad7a01b24fb331 100755 --- a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p1.icc +++ b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p1.icc @@ -67,13 +67,13 @@ transToPers(const Link_t& trans, PersLink_t& pers, pers.m_SGKeyHash = tmp.key(); pers.m_elementIndex = persIdx; } - } #ifdef ELLINK_DEBUG - msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" - << ", Key Hash=" << pers.m_SGKeyHash - << ", IDX=" << pers.m_elementIndex << endmsg; + msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" + << ", Key Hash=" << pers.m_SGKeyHash + << ", IDX=" << pers.m_elementIndex << endmsg; #endif - return; + return; + } } // No thinning. diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p2.icc b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p2.icc index 8207acc4b81ee44572504984b0eba93b91bb535f..b2e9ae778a08139be8c86928d31c22964555058c 100755 --- a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p2.icc +++ b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p2.icc @@ -175,13 +175,13 @@ transToPers (State& state, pers.m_elementIndex = persIdx; } } - } #ifdef ELLINK_DEBUG - msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" - << ", Key Hash=" << pers.m_SGKeyHash - << ", IDX=" << pers.m_elementIndex << endmsg; + msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" + << ", Key Hash=" << pers.m_SGKeyHash + << ", IDX=" << pers.m_elementIndex << endmsg; #endif - return; + return; + } } Link_t tmp = trans; diff --git a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p3.icc b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p3.icc index d0185e661dfdec8dcfff4e1eec913c0364e3637f..1b89166839cb2e8ee916db323c4757c172cf3454 100644 --- a/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p3.icc +++ b/Control/DataModelAthenaPool/DataModelAthenaPool/ElementLinkCnv_p3.icc @@ -58,13 +58,13 @@ transToPers(const Link_t& trans, PersLink_t& pers, pers.m_SGKeyHash = tmp.key(); pers.m_elementIndex = persIdx; } - } #ifdef ELLINK_DEBUG - msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" - << ", Key Hash=" << pers.m_SGKeyHash - << ", IDX=" << pers.m_elementIndex << endmsg; + msg << MSG::INFO << "ElementLinkCnv_p3::transToPer(): SG Container=" + << ", Key Hash=" << pers.m_SGKeyHash + << ", IDX=" << pers.m_elementIndex << endmsg; #endif - return; + return; + } } // No thinning. diff --git a/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-plotter.py b/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-plotter.py index 391713010072e1195cc388faa478d365f1d12ba2..3a7e2cfbf50ed6e29e056d5cc73534b99cc21bfc 100644 --- a/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-plotter.py +++ b/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-plotter.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @author: Hasan Ozturk <haozturk@cern.ch> @@ -8,7 +8,6 @@ __author__ = "Hasan Ozturk <haozturk@cern.ch" __doc__ = "A python module which parses the PerfMonMTSvc results and makes plots" -import sys import json import matplotlib @@ -17,354 +16,342 @@ import matplotlib.pyplot as plt import numpy as np import operator +import argparse -if ( len(sys.argv) != 2 ): - print("Please give result file as an argument!") - sys.exit() +colors = { "dCPU" : "tab:blue", "dWall" : "tab:orange", + "dVmem" : "tab:blue", "dPss" : "tab:green", + "dRss" : "tab:orange", "dSwap" : "tab:red", + "cpuTime" : "tab:blue", "malloc" : "tab:orange", + "vmem" : "tab:blue", "pss" : "tab:green", + "rss" : "tab:orange", "swap" : "tab:red" } -# Get the result Json file -result_file = sys.argv[1] +def plotBarChart(params): + ax = params["ax"] + offset = 1 - len(params["vals"]) + for metric in params["vals"]: + vals = params["vals"][metric] + ax.barh(params["index"] + (offset*0.5)*params["width"], vals, params["width"], + color = colors[metric], alpha=0.8, label = metric) + offset += 2 -def snapshot_plotter(snapshot_data, plotname): - - - snapshot_steps = [ 'Finalize', 'Execute','Initialize'] - #snapshot_steps = [] - snapshot_cpu_times = [] - snapshot_wall_times = [] - - # Get rid of code duplication - cpu_time = snapshot_data['Finalize']['cpu_time'] - wall_time = snapshot_data['Finalize']['wall_time'] - snapshot_cpu_times.append(cpu_time) - snapshot_wall_times.append(wall_time) - - cpu_time = snapshot_data['Event Loop']['cpu_time'] - wall_time = snapshot_data['Event Loop']['wall_time'] - snapshot_cpu_times.append(cpu_time) - snapshot_wall_times.append(wall_time) - - cpu_time = snapshot_data['Initialize']['cpu_time'] - wall_time = snapshot_data['Initialize']['wall_time'] - snapshot_cpu_times.append(cpu_time) - snapshot_wall_times.append(wall_time) - - ind = np.arange(len(snapshot_steps)) - width = 0.35 - - fig, ax = plt.subplots() - - rects1 = ax.barh(ind - width/2, snapshot_cpu_times, width, label = 'CPU Time') - rects2 = ax.barh(ind + width/2, snapshot_wall_times, width, label = 'Wall Time') - ax.set_xlabel('Time(ms)') - ax.set_ylabel('Steps') - ax.set_title('CPU & Wall Time Summary') - ax.set_yticks(ind) - ax.set_yticklabels(snapshot_steps) - ax.legend() + ax.set_xlabel(params["xlabel"], fontsize=params['xlabelFontSize']) + ax.set_ylabel(params["ylabel"], fontsize=params['ylabelFontSize']) + ax.set_title(params["title"], fontsize=params['titleFontSize'], fontweight='bold') + ax.set_yticks(params["index"]) + ax.set_yticklabels(params["yTickLabels"]) + handles, labels = ax.get_legend_handles_labels() + ax.legend(reversed(handles), reversed(labels), prop={'size': params['legendFontSize']}) + ax.tick_params(axis='both', which='major', labelsize=30) + ax.grid(linestyle=':',linewidth=0.1) - fig.set_tight_layout( True ) - fig.savefig(plotname) +def plotLineChart(params): -def time_plotter(complevel_data, plotname): - # Plot Component Level Monitoring - - #fig = plt.figure(figsize=(31,150)) - fig = plt.figure(figsize=(50,150)) - stepNum = len(complevel_data) - - measurement_threshold = 5 # 5 ms + ax = params['ax'] - for i, step in enumerate(complevel_data): + for label, metric in params['yVals'].items(): + ax.plot(params['xVals'], metric, color = colors[label], label = label) - components = [] - cpu_times = [] - wall_times = [] - - for component in complevel_data[step]: - cpu_time = complevel_data[step][component]['cpu_time'] - wall_time = complevel_data[step][component]['wall_time'] - - # Only take components whose measurements are higher a certain threshold - if cpu_time + wall_time > measurement_threshold: - components.append(component) - cpu_times.append(cpu_time) # Clear! - wall_times.append(wall_time) - - # Sort the components - - # Prepare the necessary data structures for sorting ( could be more efficient! ) - cpu_wall_tuple_list = zip(cpu_times, wall_times) - comp_dict = dict( zip(components, cpu_wall_tuple_list) ) - sortby_list = [ cpu + wall for cpu, wall in zip(cpu_times, wall_times)] - sort_dict = dict(zip(components, sortby_list)) - - # Sort the components according to wall_time + cpu time - sorted_comp_tuple_list = sorted(sort_dict.items() , key = operator.itemgetter(1)) + ax.set_xlabel(params['xlabel']) + ax.set_ylabel(params['ylabel']) - sorted_components = [] - sorted_cpu_times = [] - sorted_wall_times = [] - - # Fill the necessary lists for plotting - for idx in sorted_comp_tuple_list: - curr_comp = idx[0] - curr_cpu = comp_dict[curr_comp][0] - curr_wall = comp_dict[curr_comp][1] - - sorted_components.append(curr_comp) - sorted_cpu_times.append(curr_cpu) - sorted_wall_times.append(curr_wall) - - # if there is no nonzero measurement in the step, then skip it - if len(sorted_components) == 0: - continue - - # Horizontal Bar Chart - ax = fig.add_subplot(stepNum,1,i+1) - - index = np.arange(len(sorted_components)) - bar_width = 0.35 - opacity = 0.8 - - rects1 = plt.barh(index + (1.5)*bar_width, sorted_cpu_times,bar_width, - alpha=opacity, - label='CPU Time') - - rects2 = plt.barh(index + bar_width/2, sorted_wall_times, bar_width, - alpha=opacity, - label='Wall Time') - - plt.ylabel('Components',fontsize = 50) - plt.xlabel('Time(ms)', fontsize = 35) - plt.title(step, fontsize = 60, fontweight = "bold") - plt.yticks(index + bar_width, sorted_components) - plt.legend(prop={'size': 30}) - - ax.tick_params(axis='both', which='minor', labelsize=40) - - - fig.set_tight_layout( True ) - - - fig.savefig(plotname) - -def mem_plotter(complevel_data, plotname): - - fig = plt.figure(figsize=(50,150)) - stepNum = len(complevel_data) - - measurement_threshold = 5 # 5 kB - - for i, step in enumerate(complevel_data): - - components = [] - vmem_measurements = [] - rss_measurements = [] - pss_measurements = [] - swap_measurements = [] + ax.set_xticklabels(params['xVals']) + ax.tick_params(axis='both', which='major', labelsize=10) + ax.set_title(params['title']) + ax.legend() + ax.grid(linestyle=':',linewidth=0.1) - - for component in complevel_data[step]: - - vmem = complevel_data[step][component]['vmem'] - rss = complevel_data[step][component]['rss'] - pss = complevel_data[step][component]['pss'] - swap = complevel_data[step][component]['swap'] - - # Only take components whose measurements are higher a certain threshold - if vmem + rss + pss + swap > measurement_threshold: - components.append(component) - vmem_measurements.append(vmem) - rss_measurements.append(rss) - pss_measurements.append(pss) - swap_measurements.append(swap) - - # Sort the components - - # Prepare the necessary data structures for sorting ( could be more efficient! ) - mem_stats_tuple_list = zip(vmem_measurements, rss_measurements,pss_measurements,swap_measurements) - comp_dict = dict( zip(components, mem_stats_tuple_list) ) - sortby_list = [ vmem + rss + pss + swap for vmem, rss, pss, swap in zip(vmem_measurements, rss_measurements,pss_measurements,swap_measurements)] - sort_dict = dict(zip(components, sortby_list)) - - # Sort the components according to vmem + rss + pss + swap - sorted_comp_tuple_list = sorted(sort_dict.items() , key = operator.itemgetter(1)) - - sorted_components = [] - sorted_vmem_measurements = [] - sorted_rss_measurements = [] - sorted_pss_measurements = [] - sorted_swap_measurements = [] - - # Fill the necessary lists for plotting - for idx in sorted_comp_tuple_list: - curr_comp = idx[0] - curr_vmem = comp_dict[curr_comp][0] - curr_rss = comp_dict[curr_comp][1] - curr_pss = comp_dict[curr_comp][2] - curr_swap = comp_dict[curr_comp][3] - - sorted_components.append(curr_comp) - - sorted_vmem_measurements.append(curr_vmem) - sorted_rss_measurements.append(curr_rss) - sorted_pss_measurements.append(curr_pss) - sorted_swap_measurements.append(curr_swap) - - # if there is no nonzero measurement in the step, then skip it - if len(sorted_components) == 0: - continue - - # Horizontal Bar Chart - ax = fig.add_subplot(stepNum,1,i+1) - - index = np.arange(len(sorted_components)) - bar_width = 0.20 - opacity = 0.8 - - rects1 = plt.barh(index + (2.5)*bar_width, sorted_vmem_measurements,bar_width, - alpha=opacity, - label='Virtual Memory') - - rects2 = plt.barh(index + (1.5)*bar_width, sorted_rss_measurements, bar_width, - alpha=opacity, - label='Resident Set Size') - - rects3 = plt.barh(index + (0.5)*bar_width, sorted_pss_measurements,bar_width, - alpha=opacity, - label='Proportional Set Size') - - rects4 = plt.barh(index - (0.5)*bar_width, sorted_swap_measurements, bar_width, - alpha=opacity, - label='Swap') - - plt.ylabel('Components',fontsize = 50) - plt.xlabel('Memory Size(kB)', fontsize = 45) - plt.title(step, fontsize = 70, fontweight = "bold") - plt.yticks(index + bar_width, sorted_components) - plt.legend(prop={'size': 60}) - - ax.tick_params(axis='both', which='minor', labelsize=40) +def sortComponents(compNames, measDict, compCountPerPlot): + metricToCompMeasDict = {} # This is a lookup map, we use it to map components to measurements after sorting + measList = [] + for metric, meas in measDict.items(): - fig.set_tight_layout( True ) - - - fig.savefig(plotname) + metricToCompMeasDict[metric] = dict(zip(compNames, meas)) + measList.append(meas) + # Sort by the sum of each metric: Ex: Sort by (vmem + malloc) for memMon + sortByList = [sum(x) for x in zip(*measList)] + sortedCompMeasTuple = sorted(dict(zip(compNames, sortByList)).items(), key = operator.itemgetter(1)) + sortedCompNames = [ compMeas[0] for compMeas in sortedCompMeasTuple] -def eventLevelTimeMon_plotter(eventlevel_data, plotname): + sortedMeasurements = {} + # Populate sortedMeasurements according to the sortedCompNames + for comp in sortedCompNames[-compCountPerPlot:]: + for metric, compMeas in metricToCompMeasDict.items(): - sorted_data = sorted(eventlevel_data.items(), key=lambda i: int(i[0])) + if metric not in sortedMeasurements: + sortedMeasurements[metric] = [] - - checkPoint_list = [] - cpu_list = [] - wall_list = [] + sortedMeasurements[metric].append(compMeas[comp]) - for entry in sorted_data: - checkPoint = entry[0] - measurement = entry[1] - cpu_time = measurement["cpu_time"] - wall_time = measurement["wall_time"] + return sortedCompNames[-compCountPerPlot:], sortedMeasurements - checkPoint_list.append(checkPoint) - cpu_list.append(cpu_time) - wall_list.append(wall_time) +def plotSnapshotLevel(snapshotData, plotname): - fig = plt.figure() + # Collect data + stepNames, dCPUVals, dWallVals, dVmemVals, dRssVals, dPssVals, dSwapVals = [],[],[],[],[],[],[] + for step in ['Finalize', 'Execute', 'Initialize', 'Configure']: + meas = snapshotData[step] + + # Show in seconds + dCPU = meas["dCPU"] * 0.001 + dWall = meas["dWall"] * 0.001 + + # Show in megabytes + dVmem = meas["dVmem"] * 0.001 + dRss = meas["dRss"] * 0.001 + dPss = meas["dPss"] * 0.001 + dSwap = meas["dSwap"] * 0.001 - plt.plot(checkPoint_list, cpu_list, label = "CPU Time") - plt.plot(checkPoint_list, wall_list, label = "Wall Time") - plt.xlabel('Events') - plt.ylabel('Time[ms]') + stepNames.append(step) + dCPUVals.append(dCPU) + dWallVals.append(dWall) + + dVmemVals.append(dVmem) + dRssVals.append(dRss) + dPssVals.append(dPss) + dSwapVals.append(dSwap) + + timeMonVals = { + "dCPU": dCPUVals, + "dWall": dWallVals + } + + memMonVals = { + "dVmem": dVmemVals, + "dRss": dRssVals, + "dPss": dPssVals, + "dSwap": dSwapVals, + } + + + timeMonFig, timeMonAx = plt.subplots(figsize=(20,15)) + memMonFig, memMonAx = plt.subplots(figsize=(20,15)) + + timeMonParams = { + "ax": timeMonAx, + "index": np.arange(len(stepNames)), + "width": 0.5/len(timeMonVals), + "vals": timeMonVals, + "yTickLabels": stepNames, + "xlabel": "Time [sec]", + "ylabel": "Steps", + "title": "Snapshot Level Monitoring: Time Metrics", + "titleFontSize": 40, + "xlabelFontSize": 40, + "ylabelFontSize": 40, + "legendFontSize": 30 + + } + + memMonParams = { + "ax": memMonAx, + "index": np.arange(len(stepNames)), + "width": 0.5/len(memMonVals), # Think about this + "vals": memMonVals, + "yTickLabels": stepNames, + "xlabel": "Memory [MB]", + "ylabel": "Steps", + "title": "Snapshot Level Monitoring: Memory Metrics", + "titleFontSize": 40, + "xlabelFontSize": 40, + "ylabelFontSize": 40, + "legendFontSize": 30 + } + - index = np.arange(len(checkPoint_list)) + plotBarChart(timeMonParams) + plotBarChart(memMonParams) - plt.xticks(index, checkPoint_list, rotation='vertical') - plt.tick_params(axis='x', labelsize=3) - plt.title('Event Level Time Measurements') - plt.legend() + timeMonFig.set_tight_layout( True ) + timeMonFig.savefig("Snaphot_Level_Time") - fig.set_tight_layout( True ) - - - fig.savefig(plotname) + memMonFig.set_tight_layout(True) + memMonFig.savefig("Snapshot_Level_Memory") -def eventLevelMemMon_plotter(eventlevel_data, plotname): - - # Sort by event check points - sorted_data = sorted(eventlevel_data.items(), key=lambda i: int(i[0])) +def plotComponentLevel(componentLevelData, compCountPerPlot): - checkPoint_list = [] - vmem_list = [] - rss_list = [] - pss_list = [] - swap_list = [] - - for entry in sorted_data: - - checkPoint = entry[0] - measurement = entry[1] - - vmem = measurement["vmem"] - rss = measurement["rss"] - pss = measurement["pss"] - swap = measurement["swap"] - - checkPoint_list.append(checkPoint) - vmem_list.append(vmem) - rss_list.append(rss) - pss_list.append(pss) - swap_list.append(swap) + timeMonFig = plt.figure(figsize=(35,105)) + memMonFig = plt.figure(figsize=(35,105)) + + for idx, step in enumerate(componentLevelData): + + compNames, vmemVals, cpuTimeVals, mallocVals, countVals = [],[],[],[],[] + for comp, meas in componentLevelData[step].items(): + + count = meas["count"] + cpuTime = meas["cpuTime"] * 0.001 # seconds + malloc = meas["malloc"] * 0.001 # MB + vmem = meas["vmem"] * 0.001 # MB + + # Discard negative measurements + if vmem < 0 or malloc < 0: + continue + + compNames.append(comp + " [" + str(count) + "]") + vmemVals.append(vmem) + cpuTimeVals.append(cpuTime) + mallocVals.append(malloc) + countVals.append(count) + + timeMonVals = { + "cpuTime": cpuTimeVals + } + + memMonVals = { + "vmem": vmemVals, + "malloc": mallocVals, + } + + # Sort the components + sortedTimeMonCompNames, sortedTimeMonVals = sortComponents(compNames, timeMonVals, compCountPerPlot) + sortedCompNamesMem, sortedMemMonVals = sortComponents(compNames, memMonVals, compCountPerPlot) + + timeMonAx = timeMonFig.add_subplot(len(componentLevelData),1,idx+1) + memMonAx = memMonFig.add_subplot(len(componentLevelData),1,idx+1) + + timeMonParams = { + "ax": timeMonAx, + "index": np.arange(len(sortedTimeMonCompNames)), + "width": 0.5/len(sortedTimeMonVals), # Think about this + "vals": sortedTimeMonVals, + "yTickLabels": sortedTimeMonCompNames, + "xlabel": "Time [sec]", + "ylabel": "Components", + "title": step, + "titleFontSize": 70, + "xlabelFontSize": 50, + "ylabelFontSize": 50, + "legendFontSize": 30 + } + + memMonParams = { + "ax": memMonAx, + "index": np.arange(len(sortedCompNamesMem)), + "width": 0.5/len(sortedMemMonVals), # Think about this + "vals": sortedMemMonVals, + "yTickLabels": sortedCompNamesMem, + "xlabel": "Memory [MB]", + "ylabel": "Components", + "title": step, + "titleFontSize": 70, + "xlabelFontSize": 50, + "ylabelFontSize": 50, + "legendFontSize": 30 + } + + plotBarChart(timeMonParams) + plotBarChart(memMonParams) + + timeMonFig.set_tight_layout( True ) + timeMonFig.savefig("Component_Level_Time") + + memMonFig.set_tight_layout( True ) + memMonFig.savefig("Component_Level_Memory") + + +def plotEventLevel(eventLevelData): + + sortedEventLevelData = sorted(eventLevelData.items(), key=lambda i: int(i[0])) + + eventVals, cpuTimeVals, vmemVals, rssVals, pssVals, swapVals = [], [], [], [], [], [] + + timeMonFig, timeMonAx = plt.subplots() + memMonFig, memMonAx = plt.subplots() + + for entry in sortedEventLevelData: + + event = entry[0] + meas = entry[1] + + # Time metrics in seconds, Memory metrics in megabytes + eventVals.append(event) + cpuTimeVals.append(meas['cpuTime'] * 0.001) + vmemVals.append(meas['vmem'] * 0.001) + rssVals.append(meas['rss'] * 0.001) + pssVals.append(meas['pss'] * 0.001) + swapVals.append(meas['swap'] * 0.001) + + + timeMonVals = { + "cpuTime": cpuTimeVals + } + + memMonVals = { + "vmem": vmemVals, + "rss": rssVals, + "pss": pssVals, + "swap": swapVals + } + + timeMonParams = { + "ax": timeMonAx, + "yVals": timeMonVals, + "xVals": eventVals, # Maybe x ticks? + "xlabel": "Events", + "ylabel": "Time [sec]", + "title": "Event Level Time Measurements" + } + + memMonParams = { + "ax": memMonAx, + "yVals": memMonVals, + "xVals": eventVals, # Maybe x ticks? + "xlabel": "Events", + "ylabel": "Memory [MB]", + "title": "Event Level Memory Measurements" + } + + + plotLineChart(timeMonParams) + plotLineChart(memMonParams) + + timeMonFig.set_tight_layout(True) + timeMonFig.savefig("Event_Level_Time") + + memMonFig.set_tight_layout(True) + memMonFig.savefig("Event_Level_Memory") + +def main(): + ''' Main function for producing plots from PerfMonMT JSON file.''' - fig = plt.figure() - - plt.plot(checkPoint_list, vmem_list, label = "Vmem") - plt.plot(checkPoint_list, rss_list, label= "Rss") - plt.plot(checkPoint_list, pss_list, label = "Pss") - plt.plot(checkPoint_list, swap_list, label = "Swap") - plt.xlabel('Events') - plt.ylabel('Memory[kB]') + parser = argparse.ArgumentParser() - index = np.arange(len(checkPoint_list)) + parser.add_argument("-i", "--inFile", dest = "inFile", + default = 'PerfMonMTSvc_result.json', + help = 'The input JSON file') + parser.add_argument("-n", "--numberOfCompsPerPlot", + dest = "numberOfCompsPerPlot", default = 20, + help = "The number of components to be plotted") - plt.xticks(index, checkPoint_list, rotation='vertical') - plt.tick_params(axis='x', labelsize=3) + args = parser.parse_args() - plt.title('Event Level Memory Measurements') - plt.legend() + inFile = args.inFile + numberOfCompsPerPlot = args.numberOfCompsPerPlot - fig.set_tight_layout( True ) - - fig.savefig(plotname) + with open( inFile ) as jsonFile: + data = json.load(jsonFile) - + if "snapshotLevel" in data["summary"]: + snapshotData = data["summary"]["snapshotLevel"] + plotSnapshotLevel(snapshotData, 'snapshotLevel.pdf') -with open( result_file ) as json_file: - data = json.load(json_file) + if "componentLevel" in data: + componentLevelData = data["componentLevel"] + plotComponentLevel(componentLevelData, int(numberOfCompsPerPlot)) - snapshot_data = data['Snapshot_level'] - snapshot_plotter(snapshot_data, 'snapshot_level.pdf') - - timeMon_serial_data = data['TimeMon_Serial'] - time_plotter(timeMon_serial_data, 'TimeMon_Serial.pdf') + if "eventLevel" in data: + eventLevelData = data["eventLevel"] + plotEventLevel(eventLevelData) - memMon_serial_data = data['MemMon_Serial'] - mem_plotter(memMon_serial_data, 'MemMon_Serial.pdf') - if 'TimeMon_Parallel' in data: - timeMon_parallel_data = data['TimeMon_Parallel'] - eventLevelTimeMon_plotter(timeMon_parallel_data, 'TimeMon_Parallel.pdf') +if __name__ == "__main__": + main() - if 'MemMon_Parallel' in data: - memMon_parallel_data = data['MemMon_Parallel'] - eventLevelMemMon_plotter(memMon_parallel_data, 'MemMon_Parallel.pdf') diff --git a/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py b/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py index 674bc5db73cfd7e96e55dbf2ce6ffd9c60bcc840..58650844c3ce03df9cbde75dbd84720b599d532b 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py +++ b/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py @@ -61,6 +61,9 @@ class PerfMonMTSvc ( _PerfMonMTSvc ): if jobproperties.PerfMonFlags.doFullMonMT(): handle.doComponentLevelMonitoring = True + ## Turn on JSON reporting + handle.reportResultsToJSON = True + return pass # class PerfMonMTSvc diff --git a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py index 0e2c7c2baf11e6ecc7a019b71693ca1e5440e41a..dcc0c03ecc1d3180193e38a20618fa9d274e8e8d 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py +++ b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py @@ -21,7 +21,7 @@ if not hasattr(svcMgr, 'PerfMonMTSvc'): # Enable event loop monitoring by default svcMgr.PerfMonMTSvc.doEventLoopMonitoring = True # Disable component level monitoring by default - svcMgr.PerfMonMTSvc.doComponentLeveMonitoring = False + svcMgr.PerfMonMTSvc.doComponentLevelMonitoring = False # Enable detailed table printing by default svcMgr.PerfMonMTSvc.printDetailedTables = True # Print only the top 50 components (sorted by CPU time) by default diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx index 7b9b0891019875fbb467b7fc03208b2196c5db14..6874925b87fb6a71edd82aa67bb5254cc7d1ca0d 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx @@ -338,7 +338,7 @@ void PerfMonMTSvc::report2Log_Description() const { if (m_reportResultsToJSON) { ATH_MSG_INFO("*** Full set of information can also be found in: " << m_jsonFileName.toString()); ATH_MSG_INFO("*** In order to make plots using the results run the following commands:"); - ATH_MSG_INFO("*** $ perfmonmt-plotter " << m_jsonFileName.toString()); + ATH_MSG_INFO("*** $ perfmonmt-plotter -i " << m_jsonFileName.toString()); ATH_MSG_INFO("======================================================================================="); } } @@ -503,22 +503,16 @@ void PerfMonMTSvc::report2JsonFile() { // CPU and Wall-time report2JsonFile_Summary(j); // Snapshots - if (m_doEventLoopMonitoring) { - report2JsonFile_EventLevel_Time(j); // Event-level - } - if (m_doComponentLevelMonitoring) { - report2JsonFile_ComponentLevel_Time(j); // Component-level - } // Memory const bool procExists = doesDirectoryExist("/proc"); if (procExists) { if (m_doComponentLevelMonitoring) { - report2JsonFile_ComponentLevel_Mem(j); // Component-level + report2JsonFile_ComponentLevel(j); // Component-level } if (m_doEventLoopMonitoring) { - report2JsonFile_EventLevel_Mem(j); // Event-level + report2JsonFile_EventLevel(j); // Event-level } } @@ -531,83 +525,98 @@ void PerfMonMTSvc::report2JsonFile() { * Report summary data to JSON */ void PerfMonMTSvc::report2JsonFile_Summary(nlohmann::json& j) const { + // Report snapshot level results - for (int i = 0; i < NSNAPSHOTS; i++) { - // Clean this part! - double wall_time = m_snapshotData[i].getDeltaWall(); - double cpu_time = m_snapshotData[i].getDeltaCPU(); + for(int i=0; i < NSNAPSHOTS; i++){ + + const std::string step = m_snapshotStepNames[i]; + const double dCPU = m_snapshotData[i].getDeltaCPU(); + const double dWall = m_snapshotData[i].getDeltaWall(); + const double cpuUtil = dCPU / dWall; + const long dVmem = m_snapshotData[i].getMemMonDeltaMap("vmem"); + const long dRss = m_snapshotData[i].getMemMonDeltaMap("rss"); + const long dPss = m_snapshotData[i].getMemMonDeltaMap("pss"); + const long dSwap = m_snapshotData[i].getMemMonDeltaMap("swap"); + + j["summary"]["snapshotLevel"][step] = {{"dCPU", dCPU}, + {"dWall", dWall}, + {"cpuUtil", cpuUtil}, + {"dVmem", dVmem}, + {"dRss", dRss}, + {"dPss", dPss}, + {"dSwap", dSwap}}; - j["Snapshot_level"][m_snapshotStepNames[i]] = {{"cpu_time", cpu_time}, {"wall_time", wall_time}}; } -} -/* - * Report component-level timing data to JSON - */ -void PerfMonMTSvc::report2JsonFile_ComponentLevel_Time(nlohmann::json& j) const { - // Report component level time measurements in serial steps - for (auto& it : m_compLevelDataMap) { - std::string stepName = it.first.stepName; - std::string compName = it.first.compName; + // Report Peaks + const long vmemPeak = m_measurement_events.vmemPeak; + const long rssPeak = m_measurement_events.rssPeak; + const long pssPeak = m_measurement_events.pssPeak; - double wall_time = it.second->getDeltaWall(); - double cpu_time = it.second->getDeltaCPU(); + j["summary"]["peaks"] = {{"vmemPeak", vmemPeak}, + {"rssPeak", rssPeak}, + {"pssPeak", pssPeak}}; - // nlohmann::json syntax - j["TimeMon_Serial"][stepName][compName] = {{"cpu_time", cpu_time}, {"wall_time", wall_time}}; - } -} + // Report leak estimates + const long vmemLeak = m_fit_vmem.slope(); + const long pssLeak = m_fit_pss.slope(); + const long nPoints = m_fit_vmem.nPoints(); -/* - * Report event-level timing data to JSON - */ -void PerfMonMTSvc::report2JsonFile_EventLevel_Time(nlohmann::json& j) const { - // Report event level CPU measurements - for (const auto& it : m_eventLevelData.getEventLevelData()) { - std::string checkPoint = std::to_string(it.first); - double cpu_time = it.second.cpu_time; - double wall_time = it.second.wall_time; + j["summary"]["leakEstimates"] = {{"vmemLeak", vmemLeak}, + {"pssLeak", pssLeak}, + {"nPoints", nPoints}}; - j["TimeMon_Parallel"][checkPoint] = {{"cpu_time", cpu_time}, {"wall_time", wall_time}}; - } + // Report Sys info + const std::string cpuModel = get_cpu_model_info(); + const int coreNum = get_cpu_core_info(); + + j["summary"]["sysInfo"] = {{"cpuModel", cpuModel}, + {"coreNum", coreNum}}; } -/* - * Report component-level memory data to JSON - */ -void PerfMonMTSvc::report2JsonFile_ComponentLevel_Mem(nlohmann::json& j) const { - // Report component level memory measurements in serial steps - for (auto& it : m_compLevelDataMap) { - std::string stepName = it.first.stepName; - std::string compName = it.first.compName; +void PerfMonMTSvc::report2JsonFile_ComponentLevel(nlohmann::json& j) const { + + for (const auto& dataMapPerStep : m_stdoutVec_serial) { + + for(const auto& meas : dataMapPerStep){ - long vmem = it.second->getMemMonDeltaMap("vmem"); - long rss = it.second->getMemMonDeltaMap("rss"); - long pss = it.second->getMemMonDeltaMap("pss"); - long swap = it.second->getMemMonDeltaMap("swap"); + const std::string step = meas.first.stepName; + const std::string component = meas.first.compName; + const uint64_t count = meas.second->getCallCount(); + const double cpuTime = meas.second->getDeltaCPU(); + const long vmem = meas.second->getDeltaVmem(); + const int mall = meas.second->getDeltaMalloc(); - // nlohmann::json syntax - j["MemMon_Serial"][stepName][compName] = {{"vmem", vmem}, {"rss", rss}, {"pss", pss}, {"swap", swap}}; + j["componentLevel"][step][component] = {{"count", count}, + {"cpuTime", cpuTime}, + {"vmem", vmem}, + {"malloc", mall}}; + } - // Free the dynamically allocated space - delete it.second; } + } -/* - * Report event-level memory data to JSON - */ -void PerfMonMTSvc::report2JsonFile_EventLevel_Mem(nlohmann::json& j) { - // Report event level memory measurements +void PerfMonMTSvc::report2JsonFile_EventLevel(nlohmann::json& j) const { + for (const auto& it : m_eventLevelData.getEventLevelData()) { - std::string checkPoint = std::to_string(it.first); + + const uint64_t event = it.first; + const double cpuTime = it.second.cpu_time; + const double wallTime = it.second.wall_time; + const long vmem = it.second.mem_stats.at("vmem"); + const long rss = it.second.mem_stats.at("rss"); + const long pss = it.second.mem_stats.at("pss"); + const long swap = it.second.mem_stats.at("swap"); + + j["eventLevel"][std::to_string(event)] = {{"cpuTime", cpuTime}, + {"wallTime", wallTime}, + {"vmem", vmem}, + {"rss", rss}, + {"pss", pss}, + {"swap", swap}}; - long vmem = it.second.mem_stats.at("vmem"); - long rss = it.second.mem_stats.at("rss"); - long pss = it.second.mem_stats.at("pss"); - long swap = it.second.mem_stats.at("swap"); - j["MemMon_Parallel"][checkPoint] = {{"vmem", vmem}, {"rss", rss}, {"pss", pss}, {"swap", swap}}; } } @@ -665,49 +674,27 @@ void PerfMonMTSvc::divideData2Steps() { } std::string PerfMonMTSvc::scaleTime(double timeMeas) const { - std::ostringstream ss; - ss << std::fixed; - ss << std::setprecision(2); - - double result = 0; - - std::string significance[5] = {"ms", "sec", "mins", "hours", "days"}; - int scaleFactor = 0; - - if (timeMeas > 1000 * 60 * 60 * 24) { - int dayCount = timeMeas / (1000 * 60 * 60 * 24); - timeMeas = std::fmod(timeMeas, (1000 * 60 * 60 * 24)); - result += dayCount; - scaleFactor++; - } - if (timeMeas > 1000 * 60 * 60) { - int hourCount = timeMeas / (1000 * 60 * 60); - timeMeas = std::fmod(timeMeas, (1000 * 60 * 60)); - result += hourCount * 1.e-3; - scaleFactor++; - } - if (timeMeas > 1000 * 60) { - int minCount = timeMeas / (1000 * 60); - timeMeas = std::fmod(timeMeas, (1000 * 60)); - result += minCount * 1.e-6; - scaleFactor++; - } - if (timeMeas > 1000) { - int secCount = timeMeas / 1000; - timeMeas = std::fmod(timeMeas, 1000); - result += secCount * 1.e-9; - scaleFactor++; - } - if (timeMeas >= 0) { - result += timeMeas * 1.e-12; - scaleFactor++; - } - result = result * std::pow(1000, (5 - scaleFactor)); - - ss << result; - std::string stringObj = ss.str() + " " + significance[scaleFactor - 1]; - - return stringObj; + // Not a huge fan of this, we should eventually unify the types + // Just want to be explicit about what's happening + long ms = (long) timeMeas; + + // Compute hrs and offset + auto hrs = ms / 3600000; + ms -= hrs * 3600000; + // Compute mins and offset + auto mins = ms / 60000; + ms -= mins * 60000; + // Compute secs and offset + auto secs = ms / 1000; + ms -= secs * 1000; + + // Primarily care about H:M:S + std::stringstream ss; + ss.fill('0'); + ss << std::setw(2) << hrs << "h" << + std::setw(2) << mins << "m" << + std::setw(2) << secs << "s"; + return ss.str(); } std::string PerfMonMTSvc::scaleMem(long memMeas) const { diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h index ce621aad00b9ed35cf68aa8ac58dfef4d8bd1766..2c5027476f640a901a5615071f77877db29965a2 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h @@ -86,10 +86,8 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, public AthService { /// Report to the JSON File void report2JsonFile(); void report2JsonFile_Summary(nlohmann::json& j) const; - void report2JsonFile_ComponentLevel_Time(nlohmann::json& j) const; - void report2JsonFile_EventLevel_Time(nlohmann::json& j) const; - void report2JsonFile_ComponentLevel_Mem(nlohmann::json& j) const; - void report2JsonFile_EventLevel_Mem(nlohmann::json& j); + void report2JsonFile_ComponentLevel(nlohmann::json& j) const; + void report2JsonFile_EventLevel(nlohmann::json& j) const; /// A few helper functions bool isPower(uint64_t input, uint64_t base); // check if input is power of base or not diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h index 7a06fc76f2e550ec87f32764ba5bb9a70c4e2303..6781bd045a1c748c0863394bff8d5c9d41c384ed 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h @@ -249,7 +249,7 @@ struct MeasurementData { int getDeltaMalloc() const { return m_delta_malloc; } void add2DeltaMalloc(int val) { m_delta_malloc += val; } - long getMemMonDeltaMap(std::string mem_stat) { return m_memMon_delta_map[mem_stat]; } + long getMemMonDeltaMap(std::string mem_stat) const { return m_memMon_delta_map.at(mem_stat); } MeasurementData() : m_call_count{0}, m_tmp_cpu{0.}, m_delta_cpu{0.}, m_tmp_wall{0.}, m_delta_wall{0.}, m_tmp_vmem{0}, m_delta_vmem{0}, m_tmp_malloc{0}, m_delta_malloc{0}, m_offset_wall{0.} { diff --git a/Control/StoreGateTests/share/PyClidsTestWriter.ref b/Control/StoreGateTests/share/PyClidsTestWriter.ref index 7196ae50b737ab8179981ecd7b01b46ace477728..216f21b5af6b6d29bb737cfce8ac8e983c11ebc0 100644 --- a/Control/StoreGateTests/share/PyClidsTestWriter.ref +++ b/Control/StoreGateTests/share/PyClidsTestWriter.ref @@ -1,203 +1,201 @@ -Thu Sep 6 18:32:16 CEST 2018 +Fri May 22 20:19:01 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3e/3410b0a5584] -- built on [2018-09-06T1513] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [atlas-work3/d0082ec79c63] -- built on [2020-05-22T1752] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" Py:Athena INFO including file "StoreGateTests/test_recordStlClids_jobOptions.py" -Py:ConfigurableDb INFO Read module info for 5528 configurables from 11 genConfDb files +Py:ConfigurableDb INFO Read module info for 5535 configurables from 45 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! Py:Athena INFO including file "AthenaCommon/runbatch.py" -[?1034hApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 +ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v30r3) - running on lxplus051.cern.ch on Thu Sep 6 18:32:35 2018 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus7106.cern.ch on Fri May 22 20:19:13 2020 ==================================================================================================================================== -ApplicationMgr INFO Successfully loaded modules : AthenaServices ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr INFO Application Manager Started successfully <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224dc0 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0fc70 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x21e3bf00 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224c80 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0f5e0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23154c00 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1d1e9200 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x217a6300 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2258ff00 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x18a938c0 --- key: TestDoubles <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x234ee690 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1d2e85a0 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x217a6300 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e030 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0xa6532c0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23545880 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122c9c0 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x21e3bf00 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224c80 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0fc70 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2124a100 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e350 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1cf4ff90 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122c9c0 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1d1e9200 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x21e3bf00 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x217a6300 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21225d60 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0xa653a40 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x235f41c0 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2354c440 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0f5e0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x21e3bf00 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x217a6300 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2124a100 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x234ee690 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0xa653270 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122cc80 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224b40 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0xa6532c0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x217a6300 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1d1e9200 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2124a100 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x235f41c0 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224c80 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1d2e85a0 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23588b80 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e080 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1cf4ff90 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2124a100 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x235f41c0 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122cc80 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21225d60 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0fc70 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x1b583e00 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224730 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0f5e0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x235f41c0 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1d1e9200 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122cc80 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23588b80 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x234ee690 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0xa653a40 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2258ff00 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e300 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0xa6532c0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2122cc80 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23588b80 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x1b583e00 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21224c80 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0xa653270 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23154c00 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e030 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1cf4ff90 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23588b80 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1d1e9200 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x1b583e00 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2258ff00 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> SGImplSvc(StoreGateSvc_Impl)::dump(): Found 1 proxy for ClassID 2101 (EventInfo): - flags: ( valid, UNLOCKED, reset) --- data: 0x21225d60 --- key: + flags: ( valid, UNLOCKED, reset) --- data: 0x1d2e85a0 --- key: Found 1 proxy for ClassID 22592129 (std::vector<int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23545880 --- key: TestInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8e940 --- key: TestInts Found 1 proxy for ClassID 55596997 (EventContext): - flags: ( valid, UNLOCKED, reset) --- data: 0x2359e350 --- key: EventContext + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca0f5e0 --- key: EventContext Found 1 proxy for ClassID 177480351 (std::vector<unsigned int>): - flags: ( valid, UNLOCKED, reset) --- data: 0x1b583e00 --- key: TestUInts + flags: ( valid, UNLOCKED, reset) --- data: 0x1cfaee00 --- key: TestUInts Found 1 proxy for ClassID 202242136 (std::vector<float>): - flags: ( valid, UNLOCKED, reset) --- data: 0x2258ff00 --- key: TestFloats + flags: ( valid, UNLOCKED, reset) --- data: 0x1ca8f580 --- key: TestFloats Found 1 proxy for ClassID 219400222 (std::vector<double>): - flags: ( valid, UNLOCKED, reset) --- data: 0x23154c00 --- key: TestDoubles + flags: ( valid, UNLOCKED, reset) --- data: 0x1d00b8c0 --- key: TestDoubles Found 1 proxy for ClassID 222376821 (DataHeader): - flags: (INVALID, UNLOCKED, reset) --- data: 0 --- key: stream_stl + flags: (INVALID, locked, reset) --- data: 0 --- key: stream_stl <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> ApplicationMgr INFO Application Manager Stopped successfully diff --git a/Control/xAODDataSource/test/dataFrame_test.py b/Control/xAODDataSource/test/dataFrame_test.py index 556d3c92a813578dffdfcd914f6a9ed4522ee8a5..aaba16a3353c6cf5a76a048153e0c6a465ee1c8c 100755 --- a/Control/xAODDataSource/test/dataFrame_test.py +++ b/Control/xAODDataSource/test/dataFrame_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # # Set up the runtime environment. @@ -11,6 +11,10 @@ ROOT.xAOD.Init().ignore() from xAODDataSource.Helpers import MakexAODDataFrame df = MakexAODDataFrame( "${ASG_TEST_FILE_DATA}" ) +# Instantiate an xAOD::ElectronContainer object explicitly, to help ROOT "sort +# out" that type's dictionary before the data frame would try to use it. +dummy = ROOT.xAOD.ElectronContainer() + # Test its histogramming. elPt = df.Define( "ElectronsPt", """ diff --git a/DataQuality/DataQualityTools/python/DataQualityToolsConfig.py b/DataQuality/DataQualityTools/python/DataQualityToolsConfig.py index 4af4843c9e5119ff2aabf64ff6af109a873413c3..34d2ae7b29cea32f5df844ce7b382ccf222ed522 100644 --- a/DataQuality/DataQualityTools/python/DataQualityToolsConfig.py +++ b/DataQuality/DataQualityTools/python/DataQualityToolsConfig.py @@ -15,7 +15,8 @@ def DataQualityToolsConfig(flags): # the following should not run in RAW to ESD, if we're in two-step if flags.DQ.Environment != 'tier0Raw': - result.merge(DQTLumiMonAlgConfig(flags)) + if flags.DQ.DataType != 'cosmics': + result.merge(DQTLumiMonAlgConfig(flags)) # only when input is RAW if flags.DQ.Environment in ('online', 'tier0', 'tier0Raw'): diff --git a/DataQuality/GoodRunsListsUser/share/LumiBlock_LumiCalc_GRL_dumper.py b/DataQuality/GoodRunsListsUser/share/LumiBlock_LumiCalc_GRL_dumper.py index 96e02447233e6f22b0beaa93463cd28503340b29..3b3e5a803e21a4563cd6aab8b6fd3dc4489cf738 100644 --- a/DataQuality/GoodRunsListsUser/share/LumiBlock_LumiCalc_GRL_dumper.py +++ b/DataQuality/GoodRunsListsUser/share/LumiBlock_LumiCalc_GRL_dumper.py @@ -30,13 +30,3 @@ job.ModSequence1 += DummyDumperAlg('DummyDumperAlg1') # job.ModSequence1.DummyDumperAlg1.RootFileName = 'selection1.root' THistSvc.Output = {"new DATAFILE='selection1.root' TYP='ROOT' OPT='NEW'"}; job.ModSequence1.DummyDumperAlg1.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ] - -# add LumiCalcSvc to ServiceMgr and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.UseMC = True -LumiCalcSvc.LBCollNames = ["LumiBlocks_GoodDQ0", "IncompleteLumiBlocks_GoodDQ0", "LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -svcMgr += LumiCalcSvc - diff --git a/DataQuality/GoodRunsListsUser/share/LumiCalc_twoFinalStates.py b/DataQuality/GoodRunsListsUser/share/LumiCalc_twoFinalStates.py index 4bf2247aa6927a9ab63ee2c5912ee942a9c3dda9..80cbed80ea4685f4fc252b0832eebff91c74fb33 100644 --- a/DataQuality/GoodRunsListsUser/share/LumiCalc_twoFinalStates.py +++ b/DataQuality/GoodRunsListsUser/share/LumiCalc_twoFinalStates.py @@ -1,6 +1,6 @@ ######################################## # Job to run RecExCommon, schedule -# LumiBlockMetaDataTool and LumiCalcSvc +# LumiBlockMetaDataTool # but don't write out any AOD outputfile ######################################## @@ -30,15 +30,6 @@ from GoodRunsListsUser.GoodRunsListsUserConf import DummyDumperAlg from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" ) -# add LumiCalcSvc and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.UseMC = True -LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.Verbose = False -svcMgr += LumiCalcSvc - ## This Athena job consists of algorithms that loop over events; ## here, the (default) top sequence is used: from AthenaCommon.AlgSequence import AlgSequence, AthSequencer diff --git a/Database/APR/PersistencySvc/src/UserDatabase.cpp b/Database/APR/PersistencySvc/src/UserDatabase.cpp index 181d442420578127ddfd3092f037216673403101..27a3c5cbe8f6eebaa46db62aaac39788657531d1 100644 --- a/Database/APR/PersistencySvc/src/UserDatabase.cpp +++ b/Database/APR/PersistencySvc/src/UserDatabase.cpp @@ -168,7 +168,7 @@ pool::PersistencySvc::UserDatabase::connectForWrite( const pool::DatabaseConnect // register in the catalog pool::DbType dbType( m_technology ); pool::DbType dbTypeMajor( dbType.majorType() ); - m_catalog.registerPFN( m_the_pfn, dbTypeMajor.storageName(), m_the_fid ); + m_catalog.registerPFN( m_the_pfn.substr(0, m_the_pfn.find("?")), dbTypeMajor.storageName(), m_the_fid ); DbPrint log("PersistencySvc::UserDB::connectForWrite()" ); log << DbPrintLvl::Debug << "registered PFN: " << m_the_pfn << " with FID:" << m_the_fid << endmsg; dbRegistered = true; diff --git a/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp b/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp index ee5faecda20afd8df9e339679bfd944a124520fe..5364d26c5f236beb2d201212bc3ee197511f8148 100644 --- a/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp +++ b/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp @@ -76,7 +76,7 @@ DbStatus RootTreeIndexContainer::transAct(Transaction::Action action) { DbStatus status = RootTreeContainer::transAct(action); if (action == Transaction::TRANSACT_FLUSH) { if (m_tree == nullptr) return Error; - if (m_index_ref != nullptr && m_tree->GetEntryNumberWithIndex(nextRecordId()) == -1) { + if (m_index_ref != nullptr && m_tree->GetEntries() > 0 && m_tree->GetEntryNumberWithIndex(nextRecordId()) == -1) { m_tree->BuildIndex("index_ref"); } } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCreateFuncs.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCreateFuncs.h index f9d4e0aaafd1c005c032907f58f700b22a7e7b47..72a905ee01ab2e15dfbf0f2dc9578b6cb2ed85dd 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCreateFuncs.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCreateFuncs.h @@ -29,8 +29,10 @@ #include "GaudiKernel/MsgStream.h" #include <memory> #include <type_traits> -class IdentifiableContainerBase; +namespace EventContainers{ + class IdentifiableContainerBase; +} namespace AthenaPoolCnvSvc { @@ -124,7 +126,7 @@ createTransient (TPCNV& cnv, MsgStream& log) { typedef typename TPCNV::Trans_t Trans_t; - if constexpr(std::is_base_of< IdentifiableContainerBase, Trans_t>::value && + if constexpr(std::is_base_of< EventContainers::IdentifiableContainerBase, Trans_t>::value && !std::is_default_constructible<Trans_t>::value) { log << "IdentifiableContainerBase is not compatible with createTransient" << endmsg; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx index 57327c0bbbf2728143d202c84703daeadab8ceed..e4d1fc2b680eca6eddf51336d1c8e0aaebfac1fc 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx @@ -280,28 +280,36 @@ StatusCode AthenaPoolCnvSvc::connectOutput(const std::string& outputConnectionSp //______________________________________________________________________________ StatusCode AthenaPoolCnvSvc::connectOutput(const std::string& outputConnectionSpec) { // This is called before DataObjects are being converted. - std::string outputConnection = outputConnectionSpec; + std::string outputConnection = outputConnectionSpec.substr(0, outputConnectionSpec.find("[")); // Extract the technology int tech = m_dbType.type(); if (!decodeOutputSpec(outputConnection, tech).isSuccess()) { ATH_MSG_ERROR("connectOutput FAILED extract file name and technology."); return(StatusCode::FAILURE); } - if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient()) { + if (m_makeStreamingToolClient.value() > 0 && !m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isServer() && !m_outputStreamingTool[0]->isClient()) { + m_outputStreamingTool[0]->makeClient(m_makeStreamingToolClient.value()).ignore(); + } + if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient() + && (!m_streamMetaDataOnly || outputConnectionSpec.find("[PoolContainerPrefix=" + m_metadataContainerProp.value() + "]") != std::string::npos)) { return(StatusCode::SUCCESS); } - if (!m_outputStreamingTool.empty()) { - if (m_streamServer == m_outputStreamingTool.size() || !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer()) { + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient()) { + if (m_streamMetaDataOnly && outputConnectionSpec.find("[PoolContainerPrefix=" + m_metadataContainerProp.value() + "]") == std::string::npos) { + ATH_MSG_DEBUG("connectOutput SKIPPED for metadata-only server: " << outputConnectionSpec); + return(StatusCode::SUCCESS); + } + if (!m_streamMetaDataOnly && (m_streamServer == m_outputStreamingTool.size() || !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer())) { ATH_MSG_DEBUG("connectOutput SKIPPED for expired server."); return(StatusCode::SUCCESS); } std::size_t streamClient = 0; for (std::vector<std::string>::const_iterator iter = m_streamClientFiles.begin(), last = m_streamClientFiles.end(); iter != last; iter++) { - if (*iter == outputConnectionSpec) break; + if (*iter == outputConnection) break; streamClient++; } if (streamClient == m_streamClientFiles.size()) { - m_streamClientFiles.push_back(outputConnectionSpec); + m_streamClientFiles.push_back(outputConnection); } } @@ -338,15 +346,17 @@ StatusCode AthenaPoolCnvSvc::connectOutput(const std::string& outputConnectionSp //______________________________________________________________________________ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpec, bool doCommit) { // This is called after all DataObjects are converted. - if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient()) { + std::string outputConnection = outputConnectionSpec.substr(0, outputConnectionSpec.find("[")); + if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient() + && (!m_streamMetaDataOnly || outputConnectionSpec.find("[PoolContainerPrefix=" + m_metadataContainerProp.value() + "]") != std::string::npos)) { std::size_t streamClient = 0; for (std::vector<std::string>::const_iterator iter = m_streamClientFiles.begin(), last = m_streamClientFiles.end(); iter != last; iter++) { - if (*iter == outputConnectionSpec) break; + if (*iter == outputConnection) break; streamClient++; } if (streamClient == m_streamClientFiles.size()) { if (m_streamClientFiles.size() < m_outputStreamingTool.size()) { - m_streamClientFiles.push_back(outputConnectionSpec); + m_streamClientFiles.push_back(outputConnection); } else { streamClient = 0; } @@ -356,35 +366,35 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe usleep(100); sc = m_outputStreamingTool[streamClient]->lockObject("release"); } - if (!this->cleanUp(outputConnectionSpec).isSuccess()) { + if (!this->cleanUp(outputConnection).isSuccess()) { ATH_MSG_ERROR("commitOutput FAILED to cleanup converters."); return(StatusCode::FAILURE); } return(StatusCode::SUCCESS); } - if (!m_outputStreamingTool.empty() && m_metadataContainerProp.value().empty() + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_metadataContainerProp.value().empty() && m_streamServer == m_outputStreamingTool.size()) { ATH_MSG_DEBUG("commitOutput SKIPPED for expired server."); return(StatusCode::SUCCESS); } - if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer()) { + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer()) { ATH_MSG_DEBUG("commitOutput SKIPPED for uninitialized server: " << m_streamServer << "."); return(StatusCode::SUCCESS); } - if (!m_outputStreamingTool.empty() && m_streamServer == m_outputStreamingTool.size()) { + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_streamServer == m_outputStreamingTool.size()) { std::size_t streamClient = 0; for (std::vector<std::string>::const_iterator iter = m_streamClientFiles.begin(), last = m_streamClientFiles.end(); iter != last; iter++) { - if (*iter == outputConnectionSpec) break; + if (*iter == outputConnection) break; streamClient++; } if (streamClient == m_streamClientFiles.size()) { - ATH_MSG_DEBUG("commitOutput SKIPPED for unconnected file: " << outputConnectionSpec << "."); + ATH_MSG_DEBUG("commitOutput SKIPPED for unconnected file: " << outputConnection << "."); return(StatusCode::SUCCESS); } } std::map<void*, RootType> commitCache; std::string fileName; - if (!m_outputStreamingTool.empty() && m_streamServer < m_outputStreamingTool.size() + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_streamServer < m_outputStreamingTool.size() && m_outputStreamingTool[m_streamServer]->isServer()) { auto& streamingTool = m_outputStreamingTool[m_streamServer]; // Clear object to get Placements for all objects in a Stream @@ -544,14 +554,17 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe } else { ATH_MSG_INFO("Failed to get Data for client: " << num); } - return StatusCode::FAILURE; + return(StatusCode::FAILURE); } } + if (m_streamMetaDataOnly && !fileName.empty()) { + ATH_MSG_DEBUG("commitOutput SKIPPED for metadata-only server: " << outputConnectionSpec); + return(StatusCode::SUCCESS); + } if (m_doChronoStat) { m_chronoStatSvc->chronoStart("commitOutput"); } std::unique_lock<std::mutex> lock(m_mutex); - std::string outputConnection = outputConnectionSpec; if (outputConnection.empty()) { outputConnection = fileName; } @@ -588,7 +601,7 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe ATH_MSG_ERROR("commitOutput - caught exception: " << e.what()); return(StatusCode::FAILURE); } - if (!this->cleanUp(outputConnectionSpec).isSuccess()) { + if (!this->cleanUp(outputConnection).isSuccess()) { ATH_MSG_ERROR("commitOutput FAILED to cleanup converters."); return(StatusCode::FAILURE); } @@ -616,10 +629,12 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe //______________________________________________________________________________ StatusCode AthenaPoolCnvSvc::disconnectOutput(const std::string& outputConnectionSpec) { - if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient()) { + std::string outputConnection = outputConnectionSpec.substr(0, outputConnectionSpec.find("[")); + if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient() + && (!m_streamMetaDataOnly || outputConnectionSpec.find("[PoolContainerPrefix=" + m_metadataContainerProp.value() + "]") != std::string::npos)) { return(StatusCode::SUCCESS); } - if (!m_outputStreamingTool.empty()) { + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient()) { if (m_metadataContainerProp.value().empty() && m_streamServer == m_outputStreamingTool.size()) { ATH_MSG_DEBUG("disconnectOutput SKIPPED for expired server."); return(StatusCode::SUCCESS); @@ -632,7 +647,7 @@ StatusCode AthenaPoolCnvSvc::disconnectOutput(const std::string& outputConnectio } ATH_MSG_DEBUG("disconnectOutput not SKIPPED for server: " << m_streamServer); } - return m_poolSvc->disconnect(outputContextId(outputConnectionSpec)); + return m_poolSvc->disconnect(outputContextId(outputConnection)); } //______________________________________________________________________________ @@ -650,8 +665,12 @@ Token* AthenaPoolCnvSvc::registerForWrite(Placement* placement, const void* obj, if (m_doChronoStat) { m_chronoStatSvc->chronoStart("cRepR_ALL"); } + if (m_makeStreamingToolClient.value() > 0 && !m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isServer() && !m_outputStreamingTool[0]->isClient()) { + m_outputStreamingTool[0]->makeClient(m_makeStreamingToolClient.value()).ignore(); + } Token* token = nullptr; - if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient()) { + if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient() + && (!m_streamMetaDataOnly || placement->containerName().substr(0, m_metadataContainerProp.value().size()) == m_metadataContainerProp.value())) { std::size_t streamClient = 0; std::string fileName = placement->fileName(); for (std::vector<std::string>::const_iterator iter = m_streamClientFiles.begin(), last = m_streamClientFiles.end(); iter != last; iter++) { @@ -737,19 +756,20 @@ Token* AthenaPoolCnvSvc::registerForWrite(Placement* placement, const void* obj, tempToken->fromString(tokenStr); tokenStr = nullptr; tempToken->setClassID(pool::DbReflex::guid(classDesc)); token = tempToken; tempToken = nullptr; +// Client Write Request } else { - if (!m_outputStreamingTool.empty() && m_metadataContainerProp.value().empty() + if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_metadataContainerProp.value().empty() && (m_streamServer == m_outputStreamingTool.size() || !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer())) { ATH_MSG_DEBUG("registerForWrite SKIPPED for expired server, Placement = " << placement->toString()); Token* tempToken = new Token(); tempToken->setClassID(pool::DbReflex::guid(classDesc)); token = tempToken; tempToken = nullptr; - } else if (!m_outputStreamingTool.empty() && m_streamServer != m_outputStreamingTool.size() && !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer()) { + } else if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_streamServer != m_outputStreamingTool.size() && !m_outputStreamingTool[m_streamServer < m_outputStreamingTool.size() ? m_streamServer : 0]->isServer()) { ATH_MSG_DEBUG("registerForWrite SKIPPED for uninitialized server, Placement = " << placement->toString()); Token* tempToken = new Token(); tempToken->setClassID(pool::DbReflex::guid(classDesc)); token = tempToken; tempToken = nullptr; - } else if (!m_outputStreamingTool.empty() && m_streamServer == m_outputStreamingTool.size()) { + } else if (!m_outputStreamingTool.empty() && !m_outputStreamingTool[0]->isClient() && m_streamServer == m_outputStreamingTool.size()) { std::size_t streamClient = 0; std::string fileName = placement->fileName(); for (std::vector<std::string>::const_iterator iter = m_streamClientFiles.begin(), last = m_streamClientFiles.end(); iter != last; iter++) { diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h index 291806cc2762bfb05097a275e060a4125b3455b2..17fc689c43323be76bb305d0137fa07208760deb 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h @@ -187,6 +187,8 @@ private: // data ToolHandleArray<IAthenaIPCTool> m_outputStreamingTool; //The following doesn't work because of Gaudi issue #122 //ToolHandleArray<IAthenaIPCTool> m_outputStreamingTool{this,"OutputStreamingTool", {} }; + IntegerProperty m_makeStreamingToolClient{this,"MakeStreamingToolClient",0}; + BooleanProperty m_streamMetaDataOnly{this,"StreamMetaDataOnly",false}; std::size_t m_streamServer=0; int m_metadataClient=0; diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt index 2315a986e6df9b2bb388927a31f2a8c2dc9386a0..e865fbf286c1b1462181767b22fecec84adde359 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleConverter/CMakeLists.txt @@ -25,7 +25,7 @@ atlas_add_library( AthenaPoolExampleConverter PUBLIC_HEADERS AthenaPoolExampleConverter INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolExampleData AthenaPoolUtilities DataModelAthenaPoolLib AthenaPoolCnvSvcLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolExampleData AthenaPoolUtilities DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolServicesLib ) atlas_add_poolcnv_library( AthenaPoolExampleConverterPoolCnv FILES AthenaPoolExampleData/ExampleHitContainer.h AthenaPoolExampleData/ExampleTrackContainer.h diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/CreateOutputStreams.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/CreateOutputStreams.py index bd799073cc868b667a1907f99a68ba13b3d12fc2..4e2bb65fb701bf60630faade098ef0e81ed4e103 100644 --- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/CreateOutputStreams.py +++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/CreateOutputStreams.py @@ -13,9 +13,17 @@ from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaServices.AthenaServicesConf import AthenaOutputStream from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool +_trigNavThinningSvcs = {} +def registerTrigNavThinningSvc (streamName, svc): + _trigNavThinningSvcs[streamName] = svc + return + def createOutputStream( streamName, fileName = "", asAlg = False, noTag = False, eventInfoKey = "EventInfo", decisionFilter="", trigNavThinningSvc = None ): + if trigNavThinningSvc is None: + trigNavThinningSvc = _trigNavThinningSvcs.get (streamName, None) + # define athena output stream writingTool = AthenaOutputStreamTool( streamName + "Tool" ) outputStream = AthenaOutputStream( diff --git a/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.cxx b/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.cxx index 0784c2c4898e0cb526e58a8201aa771d6d03dc76..2a7b1693cf1b808ddba2e594ede0309a1295149d 100755 --- a/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.cxx +++ b/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.cxx @@ -109,7 +109,7 @@ StatusCode RootOutputStreamTool::connectOutput(const std::string& outputName) { return StatusCode::SUCCESS; } -StatusCode RootOutputStreamTool::commitOutput() { +StatusCode RootOutputStreamTool::commitOutput(bool/* doCommit*/) { ATH_MSG_VERBOSE("commitOutput"); if (m_outputName.empty()) { ATH_MSG_ERROR("Unable to commit, no output connected."); diff --git a/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.h b/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.h index c6313d465a37ddd4ebb3fcdc827980714e0e5535..3865e2c8c6524aa652cff89bea907ebfb426490d 100755 --- a/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.h +++ b/Database/AthenaRoot/AthenaRootComps/src/RootOutputStreamTool.h @@ -54,7 +54,7 @@ public: /// Commit the output stream after having streamed out objects /// Must commitOutput AFTER streaming - StatusCode commitOutput(); + StatusCode commitOutput(bool doCommit = false); /// Finalize the output stream after the last commit, e.g. in /// finalize diff --git a/Database/AtlasSTLAddReflex/AtlasSTLAddReflex/selection.xml b/Database/AtlasSTLAddReflex/AtlasSTLAddReflex/selection.xml index 140dff74f6b2577aa5744a11fd0ae2b8ff2a28d4..7bc3c2968506391b0bbc60a605cdc41af7d09251 100755 --- a/Database/AtlasSTLAddReflex/AtlasSTLAddReflex/selection.xml +++ b/Database/AtlasSTLAddReflex/AtlasSTLAddReflex/selection.xml @@ -1,13 +1,12 @@ <lcgdict> - <class pattern="std::*pair*<unsigned int, unsigned int>" /> - <class pattern="std::*pair*<std::string, unsigned*" /> + <class pattern="std::*pair*<*string*,*unsigned int>" /> <class pattern="std::*pair*<*string*vector<int*"/> <class pattern="std::*pair*<*string*vector<double*"/> - + <class pattern="std::*pair*<std::pair<std::string, unsigned int>, std::pair<std::string, unsigned int> >"/> - <class pattern="std::*pair*<unsigned int, std::vector<float*"/> - <class pattern="std::*pair*<unsigned int, std::vector<unsigned int*"/> + <class pattern="std::*pair*<unsigned int*,*vector<float*"/> + <class pattern="std::*pair*<unsigned int*,*vector<unsigned int*"/> <class name="std::vector<long long>"/> <class name="std::vector<unsigned long long>"/> diff --git a/Database/TPTools/TPTools/TPConverter.icc b/Database/TPTools/TPTools/TPConverter.icc index 0a2b2209aa1b2c5b5e1a5134397c1ac605ddcf81..90ce12ed48f718ee18563ae74a92bb5f671d2e53 100644 --- a/Database/TPTools/TPTools/TPConverter.icc +++ b/Database/TPTools/TPTools/TPConverter.icc @@ -70,14 +70,15 @@ toPersistentWithKey_impl( const TRANS *trans, } return TPObjRef( this->m_pStorageTID, size ); } - +namespace EventContainers{ class IdentifiableContainerBase; +} class IdentifiableValueContainerBase; template< class TRANS_BASE, class TRANS, class PERS > TRANS* TPPolyCnvBase<TRANS_BASE, TRANS, PERS>:: createTransient ([[maybe_unused]] const PERS* persObj, MsgStream &log) { - if constexpr(std::is_base_of< IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { + if constexpr(std::is_base_of< EventContainers::IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { log << "IdentifiableContainerBase is not compatable with createTransient" << std::endl; return nullptr; }else if constexpr(std::is_base_of< IdentifiableValueContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value){ @@ -99,7 +100,7 @@ createTransientWithKey ([[maybe_unused]] const PERS* persObj, const std::string& key, MsgStream& log) { - if constexpr(std::is_base_of< IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { + if constexpr(std::is_base_of< EventContainers::IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { log << "IdentifiableContainerBase is not compatable with createTransient" << std::endl; return nullptr; }else if constexpr(std::is_base_of< IdentifiableValueContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value){ @@ -120,7 +121,7 @@ template< class TRANS, class PERS > TRANS* TPConverterConstBase<TRANS, PERS>::createTransientConst (const PERS* persObj, MsgStream& log) const { - if constexpr(std::is_base_of< IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { + if constexpr(std::is_base_of< EventContainers::IdentifiableContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value) { log << "IdentifiableContainerBase is not compatable with createTransient" << std::endl; return nullptr; }else if constexpr(std::is_base_of< IdentifiableValueContainerBase, TRANS>::value && !std::is_default_constructible<TRANS>::value){ diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h index 130fe43ee2c948638894db960ceb774cb336b893..01fb50e4f2e605029cd56daed7b20a76495ad9ad 100644 --- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h +++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h @@ -1,14 +1,15 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AGDD2GeoModelBuilder_H #define AGDD2GeoModelBuilder_H -class GeoMaterial; -class GeoElement; #include "GeoModelKernel/GeoPhysVol.h" +#include "AGDDKernel/AGDDBuilder.h" +class GeoMaterial; +class GeoElement; class AGDDComposition; class AGDDBox; class AGDDTubs; @@ -23,12 +24,10 @@ class AGDDUnion; class AGDDIntersection; class AGDDSubtraction; class AGDDVolume; - class AGDDBolt; class AGDDIbeam; class AGDDUbeam; -#include "AGDDKernel/AGDDBuilder.h" #include <string> @@ -36,10 +35,10 @@ class AGDD2GeoModelBuilder:public AGDDBuilder { public: // constructor AGDD2GeoModelBuilder(); - ~AGDD2GeoModelBuilder() {} + ~AGDD2GeoModelBuilder()=default; // elements & materials - GeoElement* CreateElement(std::string); - const GeoMaterial* CreateMaterial(std::string); + GeoElement* CreateElement(const std::string&); + const GeoMaterial* CreateMaterial(const std::string&); void CreateElements(); void CreateMaterial(); @@ -68,15 +67,9 @@ public: void BuildFromSection(std::string); void BuildFromVolume(std::string); -// std::map<std::string, GeoFullPhysVol*>* GetMSdetectors() const; - private: GeoPhysVol *m_mother; - - const GeoMaterial* GetMMMaterial(std::string); - -// std::map<std::string, GeoFullPhysVol*>* m_detectors; - + const GeoMaterial* GetMMMaterial(const std::string&); }; #endif diff --git a/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx b/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx index 8307f86984eaf8d7654f74472fb8d93920c7e169..7ea491175b8d3cf9079f1886f76be0251383076a 100644 --- a/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx +++ b/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx @@ -1,16 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "AGDDControl/AGDD2GeoModelBuilder.h" -#include "AGDDModel/AGDDMaterialStore.h" -#include "AGDDModel/AGDDMaterial.h" -#include "AGDDModel/AGDDMolecule.h" -#include "AGDDModel/AGDDMixture.h" -#include "AGDDModel/AGDDElement.h" + #include "AGDDKernel/AGDDDetector.h" #include "AGDDKernel/AGDDDetectorPositioner.h" #include "AGDDKernel/AGDDDetectorStore.h" +#include "AGDDKernel/TwoPoint.h" +#include "AGDDKernel/AGDDVolumeStore.h" +#include "AGDDKernel/AGDDSectionStore.h" +#include "AGDDKernel/AGDDSection.h" +#include "AGDDKernel/AliasStore.h" + #include "AGDDModel/AGDDBox.h" #include "AGDDModel/AGDDTubs.h" #include "AGDDModel/AGDDElcyl.h" @@ -26,23 +28,16 @@ #include "AGDDModel/AGDDSubtraction.h" #include "AGDDModel/AGDDIntersection.h" #include "AGDDModel/AGDDComposition.h" -#include "AGDDKernel/TwoPoint.h" -#include "AGDDKernel/AGDDVolumeStore.h" -#include "AGDDKernel/AGDDSectionStore.h" -#include "AGDDKernel/AGDDSection.h" - +#include "AGDDModel/AGDDMaterialStore.h" +#include "AGDDModel/AGDDMaterial.h" +#include "AGDDModel/AGDDMolecule.h" +#include "AGDDModel/AGDDMixture.h" +#include "AGDDModel/AGDDElement.h" #include "AGDDModel/AGDDBolt.h" #include "AGDDModel/AGDDIbeam.h" #include "AGDDModel/AGDDUbeam.h" -#include "AGDDKernel/AliasStore.h" - - - -#include "GeoModelKernel/GeoElement.h" -#include "GeoModelKernel/GeoMaterial.h" - -#include "GeoModelKernel/GeoShape.h" +#include "GeoModelKernel/Units.h" #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoTubs.h" #include "GeoModelKernel/GeoEllipticalTube.h" @@ -55,16 +50,14 @@ #include "GeoModelKernel/GeoShapeIntersection.h" #include "GeoModelKernel/GeoShapeSubtraction.h" #include "GeoModelKernel/GeoShapeShift.h" -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoPhysVol.h" -#include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoTransform.h" #include "GeoPrimitives/CLHEPtoEigenConverter.h" - #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/Bootstrap.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" #include "GeoModelInterfaces/StoredMaterialManager.h" #include "CLHEP/Vector/TwoVector.h" @@ -74,15 +67,14 @@ #include <iostream> #include <sstream> #include <vector> +#include <cmath> - -AGDD2GeoModelBuilder::AGDD2GeoModelBuilder():AGDDBuilder(),m_mother(0) -{ -// std::cout << "Creating AGDD2GeoModel Builder"<<std::endl; -// m_detectors = new std::map<std::string, GeoFullPhysVol*>; -// m_detectors->clear(); +AGDD2GeoModelBuilder::AGDD2GeoModelBuilder() : + AGDDBuilder(), + m_mother(nullptr) { } -GeoElement* AGDD2GeoModelBuilder::CreateElement(std::string name) + +GeoElement* AGDD2GeoModelBuilder::CreateElement(const std::string& name) { AGDDMaterialStore *ms=AGDDMaterialStore::GetMaterialStore(); AGDDElement *el=ms->GetElement(name); @@ -94,25 +86,22 @@ GeoElement* AGDD2GeoModelBuilder::CreateElement(std::string name) el->Created(true); GeoElement *g4el; g4el=new GeoElement(el->GetName(),el->GetSymbol(), - double(el->GetZ()),el->GetA()*(CLHEP::g/CLHEP::mole)); + double(el->GetZ()),el->GetA()*(GeoModelKernelUnits::gram/GeoModelKernelUnits::mole)); el->SetElement(g4el); return g4el; } else - return 0; + return nullptr; } -const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(std::string name) +const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(const std::string& name) { // give priority to GeoModel's Material Manager in retrieving materials const GeoMaterial* mmMaterial=GetMMMaterial(name); if (mmMaterial) { -// std::cout<<"material "<<name<<" found in Material Manager "<<std::endl; return mmMaterial; } - -// oh well... too bad.... AGDDMaterialStore *ms=AGDDMaterialStore::GetMaterialStore(); AGDDSimpleMaterial *mat=ms->GetMaterial(name); @@ -128,10 +117,11 @@ const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(std::string name) { AGDDMaterial* nmat=dynamic_cast<AGDDMaterial*>(mat); if (!nmat) { - std::cout<<"something is wrong, nmat=0!!!"<<std::endl; - return 0; - } - g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(CLHEP::g/CLHEP::cm3)); + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateMaterial() - AGDDMaterial is nullptr"<<endmsg; + return nullptr; + } + g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(GeoModelKernelUnits::gram/GeoModelKernelUnits::cm3)); AGDDElement *el=ms->GetElement(nmat->GetName()); if (el) { @@ -146,10 +136,11 @@ const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(std::string name) { AGDDMolecule* nmat=dynamic_cast<AGDDMolecule*>(mat); if (!nmat) { - std::cout<<"something is wrong, nmat=0!!!"<<std::endl; - return 0; - } - g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(CLHEP::g/CLHEP::cm3)); + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateMaterial() - AGDDMolecule is nullptr"<<endmsg; + return nullptr; + } + g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(GeoModelKernelUnits::gram/GeoModelKernelUnits::cm3)); for (int i=0;i<nmat->NComponents();i++) { AGDDElement *el=nmat->Element(i); @@ -162,14 +153,14 @@ const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(std::string name) } else if (mtype==Mixture) { -// std::cout<<"Mixture "<<mat->GetName()<<std::endl; AGDDMixture* nmat=dynamic_cast<AGDDMixture*>(mat); if (!nmat) { - std::cout<<"can't get the mixture, returning!"<<std::endl; - return 0; + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateMaterial() - AGDDMixture is nullptr"<<endmsg; + return nullptr; } - g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(CLHEP::g/CLHEP::cm3)); + g4mat=new GeoMaterial(nmat->GetName(),nmat->GetDensity()*(GeoModelKernelUnits::gram/GeoModelKernelUnits::cm3)); for (int i=0;i<nmat->NComponents();i++) { AGDDSimpleMaterial *el=nmat->Material(i); @@ -182,12 +173,13 @@ const GeoMaterial* AGDD2GeoModelBuilder::CreateMaterial(std::string name) } else { - std::cout<<" Help! unknown material type!!!"<<std::endl; - return 0; + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateMaterial() - Unknown material type "<<mtype<<endmsg; + return nullptr; } } else - return 0; + return nullptr; } void AGDD2GeoModelBuilder::CreateElements() { @@ -209,7 +201,6 @@ void AGDD2GeoModelBuilder::CreateMaterial() } void AGDD2GeoModelBuilder::CreateBox(AGDDBox* v) { -// std::cout<<"this is CreateBox"<<std::endl; void *p=v->GetSolid(); if (!p) { @@ -230,18 +221,16 @@ void AGDD2GeoModelBuilder::CreateTrd(AGDDTrd* v) void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) { // here begins a nasty piece of code - static GeoBox *box1=new GeoBox(1.*CLHEP::km,1*CLHEP::km,1*CLHEP::km); - CLHEP::Hep3Vector v1(0.,0.,-1*CLHEP::km); - CLHEP::Hep3Vector v2(0.,0.,+1*CLHEP::km); + static GeoBox *box1=new GeoBox(1.*GeoModelKernelUnits::km,1*GeoModelKernelUnits::km,1*GeoModelKernelUnits::km); + CLHEP::Hep3Vector v1(0.,0.,-1*GeoModelKernelUnits::km); + CLHEP::Hep3Vector v2(0.,0.,+1*GeoModelKernelUnits::km); CLHEP::HepRotation h; HepGeom::Transform3D ttt1(h,v1); HepGeom::Transform3D ttt2(h,v2); static GeoShape *s1=new GeoShapeShift(box1,Amg::CLHEPTransformToEigen(ttt1)); static GeoShape *s2=new GeoShapeShift(box1,Amg::CLHEPTransformToEigen(ttt2)); -// std::cout<<" Snake "<<v->GetName()<<" nr. of Points "<<v->NrOfPoints()<<std::endl; double radius=v->Radius(); -// std::cout<<" Snake radius "<<radius<<std::endl; CLHEP::Hep3Vector axis0=(v->GetPoint(0)-v->GetPoint(1)); CLHEP::Hep3Vector axis(v->GetPoint(1)-v->GetPoint(0)); CLHEP::Hep3Vector axis1; @@ -250,9 +239,9 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) double angle1=0; double angle2=std::abs(axis.angle(axis2))/2; double delta_l1=0; - double delta_l2=radius*tan(angle2); + double delta_l2=radius*std::tan(angle2); double lengthnew=length+delta_l2; - GeoShape* solid=new GeoTubs(0.,radius,lengthnew/2.,0.,4*asin(1.)); + GeoShape* solid=new GeoTubs(0.,radius,lengthnew/2.,0.,4*std::asin(1.)); const CLHEP::Hep3Vector vt(0.,0.,-lengthnew/2.+delta_l2+2.); CLHEP::HepRotation rrr; @@ -262,7 +251,6 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) GeoShape *ssnew=new GeoShapeShift(s1,Amg::CLHEPTransformToEigen(ttt)); solid = new GeoShapeSubtraction(solid,ssnew); -// std::cout<<" angles theta, phi "<<axis2.theta()<<" "<<axis2.phi()<<std::endl; CLHEP::Hep3Vector vref(0.,0.,-lengthnew/2.); CLHEP::HepRotation r; @@ -283,13 +271,13 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) length=axis.mag(); angle1=std::abs(axis.angle(axis1))/2; - delta_l1=radius*tan(angle1); + delta_l1=radius*std::tan(angle1); delta_l2=0; if (i<(v->NrOfPoints()-2)) { axis2=v->GetPoint(i+2)-v->GetPoint(i+1); angle2=std::abs(axis.angle(axis2))/2; - delta_l2=radius*tan(angle2); + delta_l2=radius*std::tan(angle2); } length=axis.mag(); lengthnew=length+delta_l1+delta_l2; @@ -298,7 +286,7 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) CLHEP::Hep3Vector vvref(0.,0.,-lengthnew/2+delta_l1); HepGeom::Transform3D ttref(rr,vvref); - GeoShape* ss=new GeoTubs(0.,radius,lengthnew/2.,0.,4*asin(1.)); + GeoShape* ss=new GeoTubs(0.,radius,lengthnew/2.,0.,4*std::asin(1.)); const CLHEP::Hep3Vector vt1(0.,0.,+lengthnew/2.-delta_l1-2.); const CLHEP::Hep3Vector vt2(0.,0.,-lengthnew/2.+delta_l2+2.); @@ -320,7 +308,6 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) ss=new GeoShapeShift(ss,Amg::CLHEPTransformToEigen(ttref)); - // std::cout<<" angles: theta "<<axis.theta()<<" phi "<<axis.phi()<<std::endl; CLHEP::HepRotation rr1; rr1.rotateY(axis0.theta()); @@ -337,22 +324,19 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) void AGDD2GeoModelBuilder::CreateCons(AGDDCons* v) { - const double mdeg=asin(1)/90.; void *p=v->GetSolid(); if (!p) { - GeoShape* solid=new GeoCons(v->rin1(),v->rin2(),v->rou1(),v->rou2(),v->z()/2.,v->phi0()*mdeg,v->dphi()*mdeg); + GeoShape* solid=new GeoCons(v->rin1(),v->rin2(),v->rou1(),v->rou2(),v->z()/2.,v->phi0()*GeoModelKernelUnits::degree,v->dphi()*GeoModelKernelUnits::degree); v->SetSolid(solid); } } void AGDD2GeoModelBuilder::CreateTubs(AGDDTubs* v) { - const double mdeg=asin(1.)/90.; void *p=v->GetSolid(); if (!p) { -// std::cout<<"++++++++ Tubs "<<v->phi0()<<" "<<v->dphi()<<std::endl; - GeoShape* solid=new GeoTubs(v->rin(),v->rou(),v->z()/2.,v->phi0()*mdeg,v->dphi()*mdeg); + GeoShape* solid=new GeoTubs(v->rin(),v->rou(),v->z()/2.,v->phi0()*GeoModelKernelUnits::degree,v->dphi()*GeoModelKernelUnits::degree); v->SetSolid(solid); } } @@ -370,7 +354,6 @@ void AGDD2GeoModelBuilder::CreateElcyl(AGDDElcyl* v) void AGDD2GeoModelBuilder::CreateGvxy(AGDDGvxy* v) { void *p=v->GetSolid(); -// std::cout<<"now creating BREP"<<v->GetName()<<std::endl; if (!p) { std::vector<CLHEP::Hep2Vector> points; @@ -381,21 +364,17 @@ void AGDD2GeoModelBuilder::CreateGvxy(AGDDGvxy* v) v->SetPoint(v->GetPoint(0)); for (int i=0;i<nPoint;i++) { -// std::cout << " \ttwo point "<<v->GetPoint(i).x()<<" "<<v->GetPoint(i).y()<<std::endl; int iplus=i+1; area+= v->GetPoint(i).x()*v->GetPoint(iplus).y()-v->GetPoint(iplus).x()*v->GetPoint(i).y(); } -// std::cout<< " area "<<area<<std::endl; bool clockwise=area<0?true:false; -// std::cout<< " clockwise? "<<clockwise<<std::endl; TwoPoint pV; for (int i=0;i<nPoint;i++) { if (clockwise) pV=v->GetPoint(nPoint-1-i); else pV=v->GetPoint(i); -// std::cout<<"\t\t Point "<<pV.x()<<" "<<pV.y()<<std::endl; solid->addVertex(pV.x(),pV.y()); } v->SetSolid(solid); @@ -407,7 +386,6 @@ void AGDD2GeoModelBuilder::CreateUnion(AGDDUnion* v) int nPos=v->NrOfDaughter(); AGDDPositioner* pos=v->GetDaughter(0); AGDDVolume *vol=pos->GetVolume(); -// std::cout<<" volume name "<<vol->GetName()<<std::endl; vol->CreateSolid(); GeoShape *sV=(GeoShape*)(vol->GetSolid()); sV=new GeoShapeShift(sV,Amg::CLHEPTransformToEigen(pos->Transform())); @@ -415,7 +393,6 @@ void AGDD2GeoModelBuilder::CreateUnion(AGDDUnion* v) { AGDDPositioner* pp=v->GetDaughter(i); AGDDVolume *vv=pp->GetVolume(); -// std::cout<<" \t secondary volume name "<<vv->GetName()<<std::endl; vv->CreateSolid(); GeoShape *nsV=(GeoShape*)(vv->GetSolid()); nsV=new GeoShapeShift(nsV,Amg::CLHEPTransformToEigen(pp->Transform())); @@ -472,7 +449,7 @@ void AGDD2GeoModelBuilder::CreatePcon(AGDDPcon* v) if (!p) { int nPlanes=v->NrOfPlanes(); - GeoPcon* solid=new GeoPcon(v->Phi0()*CLHEP::deg,v->Dphi()*CLHEP::deg); + GeoPcon* solid=new GeoPcon(v->Phi0()*GeoModelKernelUnits::degree,v->Dphi()*GeoModelKernelUnits::degree); for (int i=0;i<nPlanes;i++) { double ri=v->Rin(i); @@ -490,7 +467,7 @@ void AGDD2GeoModelBuilder::CreatePgon(AGDDPgon* v) if (!p) { int nPlanes=v->NrOfPlanes(); - GeoPgon* solid=new GeoPgon(v->Phi0()*CLHEP::deg,v->Dphi()*CLHEP::deg,v->_nbPhi); + GeoPgon* solid=new GeoPgon(v->Phi0()*GeoModelKernelUnits::degree,v->Dphi()*GeoModelKernelUnits::degree,v->_nbPhi); for (int i=0;i<nPlanes;i++) { double ri=v->Rin(i); @@ -511,14 +488,12 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) if (ifirst) { ifirst=0; -// ether=new GeoMaterial("special::Ether",0.); ether = GetMMMaterial("special::Ether"); - fakeVol=new GeoTubs(0.,500.,1000.,0.,4*asin(1.)); + fakeVol=new GeoTubs(0.,500.,1000.,0.,4*std::asin(1.)); } if (!v->GetVolume()) { - //std::cout<<"CreateComposition: Logical Volume "<<v->GetName()<<std::endl; GeoLogVol *a=new GeoLogVol(v->GetName(),fakeVol,ether); GeoPhysVol *a_phys=new GeoPhysVol(a); v->SetVolume(a_phys); @@ -528,8 +503,6 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) AGDDPositioner* pos=v->GetDaughter(i); AGDDVolume *vol=pos->GetVolume(); const std::string volName = vol->GetName(); - - //std::cout << "---> Daughter: " << volName << std::endl; bool isDetElement=vol->IsSensitiveVolume(); AGDDDetector *d=0; @@ -539,11 +512,16 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) { AGDDDetectorStore* ds=AGDDDetectorStore::GetDetectorStore(); d=ds->GetDetector(volName); - if (!d) std::cout<<" Help! can't retrieve Detector element for "<<volName<<std::endl; + if (!d) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateComposition() - Cannot retrieve Detector element for "<<volName<<endmsg; + } p=dynamic_cast<AGDDDetectorPositioner *>(pos); if (p) detFullTag=p->ID.detectorAddress; - else std::cout<<" something is very wrong!!!!"<<std::endl; - // if (isDetElement) std::cout<<"\t\t Detector: "<<volName<<" "<<detFullTag<<std::endl; + else { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateComposition() - AGDDDetectorPositioner is nullptr"<<endmsg; + } } HepGeom::Transform3D trf=pos->Transform(); GeoTransform *geotrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); @@ -558,7 +536,6 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) if (isDetElement) { detVol=(GeoFullPhysVol*)(vol->GetVolume()); if (p) p->theVolume=detVol; - // (*m_detectors)[detFullTag]=detVol; } } else { @@ -569,7 +546,6 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) { detVol=(GeoFullPhysVol*)temp; detVol=detVol->clone(); - //(*m_detectors)[detFullTag]=detVol; if (p) p->theVolume=detVol; } } @@ -583,16 +559,16 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) void AGDD2GeoModelBuilder::CreateVolume(AGDDVolume* v) { -// std::cout<<" this is CreateVolume"<<std::endl; - const GeoMaterial *mat=CreateMaterial(ALIAS(v->GetMaterial())); void* p=v->GetVolume(); if (!p) { -// std::cout<<" creating Volume "<<v->GetName()<<std::endl; GeoShape* sol=(GeoShape*)v->GetSolid(); - if (!sol) std::cout<<" Something wrong!!! solid is NULL "<<std::endl; + if (!sol) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"CreateVolume() - solid is nullptr!"<<endmsg; + } else { GeoLogVol* lv=new GeoLogVol(v->GetName(),sol,mat); @@ -614,10 +590,8 @@ void AGDD2GeoModelBuilder::BuildAllVolumes() for (it=vs->begin();it!=vs->end();it++) { AGDDVolume* vol=(*it).second; - // std::cout<<" Volume in the list "<<vol->GetName(); if (!vol->HasParent()) { -// std::cout<<" start building with "<<vol->GetName()<<std::endl; vol->CreateVolume(); AGDDComposition *vv=dynamic_cast<AGDDComposition *>(vol); @@ -628,10 +602,11 @@ void AGDD2GeoModelBuilder::BuildAllVolumes() { if (!m_mother) { - std::cout<<"AGDDController: mother not set!!"<<std::endl; + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildAllVolumes() - mother not set!"<<endmsg; return; } - GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); m_mother->add(gtrf); m_mother->add(vvv); } @@ -671,10 +646,10 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) GeoPhysVol *vvv=(GeoPhysVol*)(vol->GetVolume()); if (vvv) { - if (!m_mother) - { - std::cout<<"AGDDController: mother not set!!"<<std::endl; - return; + if (!m_mother) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildFromSection() - mother not set!"<<endmsg; + return; } GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); m_mother->add(gtrf); @@ -688,10 +663,8 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) for (it=sect->VolumeBegin();it!=sect->VolumeEnd();it++) { AGDDVolume* vol=(*it).second; - // std::cout<<" Volume in the list "<<vol->GetName(); if (!vol->HasParent()) { -// std::cout<<" start building with "<<vol->GetName()<<std::endl; vol->CreateVolume(); AGDDComposition *vv=dynamic_cast<AGDDComposition *>(vol); @@ -700,9 +673,9 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) GeoPhysVol *vvv=(GeoPhysVol*)(vol->GetVolume()); if (vvv) { - if (!m_mother) - { - std::cout<<"AGDDController: mother not set!!"<<std::endl; + if (!m_mother) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildFromSection() - mother not set (no top volume)!"<<endmsg; return; } GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); @@ -713,10 +686,10 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) } } } - else - std::cout<<" This section is flagged as not to be built!!"<<std::endl; - - + else { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildFromSection() - This section is flagged as not to be built!"<<endmsg; + } } void AGDD2GeoModelBuilder::BuildFromVolume(std::string s) { @@ -726,18 +699,18 @@ void AGDD2GeoModelBuilder::BuildFromVolume(std::string s) AGDDVolumeStore *vs=AGDDVolumeStore::GetVolumeStore(); AGDDVolume* vol=vs->GetVolume(s); - if (!vol) - { - std::cout<<"============>>>>>>> Warning!!! Volume "<<s<<" not found in the store!!!!!! quitting...."<<std::endl; + if (!vol) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildFromVolume() - Volume "<<s<<" not found in the store! Exiting..."<<endmsg; return; } vol->CreateVolume(); GeoPhysVol *vvv=(GeoPhysVol*)(vol->GetVolume()); if (vvv) { - if (!m_mother) - { - std::cout<<"AGDDController: mother not set!!"<<std::endl; + if (!m_mother) { + MsgStream log(Athena::getMessageSvc(),"AGDD2GeoModelBuilder"); + log<<MSG::WARNING<<"BuildFromVolume() - mother not set!"<<endmsg; return; } GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); @@ -748,14 +721,12 @@ void AGDD2GeoModelBuilder::BuildFromVolume(std::string s) void AGDD2GeoModelBuilder::CreateBolt(AGDDBolt *b) { - const double mdeg=asin(1.)/90.; void *p=b->GetSolid(); if (!p) { - //std::cout<<"creating bolt"<<std::endl; - GeoShape* solid=new GeoTubs(0,b->_diameter/2.,b->_length/2.,0.,360.*mdeg); + GeoShape* solid=new GeoTubs(0,b->_diameter/2.,b->_length/2.,0.,360.*GeoModelKernelUnits::degree); - GeoPgon* s=new GeoPgon(0.,360*mdeg,6); + GeoPgon* s=new GeoPgon(0.,360*GeoModelKernelUnits::degree,6); s->addPlane(-b->_length/2.,0,b->_headDiameter/2.); s->addPlane(-b->_length/2.+b->_headLength,0,b->_headDiameter/2.); solid=new GeoShapeUnion(solid,s); @@ -805,24 +776,17 @@ void AGDD2GeoModelBuilder::CreateUbeam(AGDDUbeam *b) } } -const GeoMaterial* AGDD2GeoModelBuilder::GetMMMaterial(std::string name) +const GeoMaterial* AGDD2GeoModelBuilder::GetMMMaterial(const std::string& name) { - StoreGateSvc* pDetStore=0; - ISvcLocator* svcLocator = Gaudi::svcLocator(); - StatusCode sc=svcLocator->service("DetectorStore",pDetStore); - if(sc.isSuccess()) - { - const StoredMaterialManager* theMaterialManager = nullptr; - sc = pDetStore->retrieve(theMaterialManager, "MATERIALS"); - if(sc.isSuccess()) - { - return theMaterialManager->getMaterial(name); + StoreGateSvc* pDetStore=nullptr; + ISvcLocator* svcLocator = Gaudi::svcLocator(); + StatusCode sc=svcLocator->service("DetectorStore",pDetStore); + if(sc.isSuccess()) { + const StoredMaterialManager* theMaterialManager = nullptr; + sc = pDetStore->retrieve(theMaterialManager, "MATERIALS"); + if(sc.isSuccess()) { + return theMaterialManager->getMaterial(name); } - } - return 0; + } + return nullptr; } - -//std::map<std::string, GeoFullPhysVol*>* AGDD2GeoModelBuilder::GetMSdetectors() const -//{ -// return m_detectors; -//} diff --git a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/ATLAS_CHECK_THREAD_SAFETY b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..dd644f981c3ead60f337d9a071d9eb69a7e8ddae --- /dev/null +++ b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/ATLAS_CHECK_THREAD_SAFETY diff --git a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrAddress.h b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrAddress.h index a2fb9587ec2405090d36a3368e31b2639ffb95b9..d971509ea7c00efd12c241404607ac1ce0e90936 100755 --- a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrAddress.h +++ b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrAddress.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //==================================================================== @@ -27,7 +27,7 @@ #include "GaudiKernel/GenericAddress.h" #include "GaudiKernel/StatusCode.h" -extern long DetDescr_StorageType; +const extern long DetDescr_StorageType; class DetDescrAddress : public GenericAddress { public: diff --git a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrCnvSvc.h b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrCnvSvc.h index 935ff52d0232648743cb93c646ad9ea0d99011e0..c0fb171387ee27bad2e3981e99a95df2e474e816 100755 --- a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrCnvSvc.h +++ b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrCnvSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DETDESCRCNVSVC_DETDESCRCNVSVC_H @@ -50,9 +50,6 @@ public: /// Convert address to string form virtual StatusCode convertAddress( const IOpaqueAddress* pAddress, std::string& refAddress); - - /// Provide access to Detector Store - StoreGateSvc * detStore() const; // /// AddressProvider interface // typedef IAddressProvider::tadList tadList; diff --git a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrConverter.h b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrConverter.h index d272d08e342c6b5ba78fbfb5bde71e350278aa3c..494d7c0ecaa2b3f6cf35460989fe928a6bf3cd46 100755 --- a/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrConverter.h +++ b/DetectorDescription/DetDescrCnvSvc/DetDescrCnvSvc/DetDescrConverter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -47,10 +47,6 @@ protected: DetDescrConverter(const CLID& myCLID, ISvcLocator* svcloc); // StatusCode addToDetStore(const CLID& clid, const std::string& name) const; - /// Provide access to Detector Store - StoreGateSvc * detStore() const; - - private: DetDescrCnvSvc* m_cnvSvc; //const CLID m_CLID; diff --git a/DetectorDescription/DetDescrCnvSvc/src/DetDescrAddress.cxx b/DetectorDescription/DetDescrCnvSvc/src/DetDescrAddress.cxx index bbff6ef758d62df58da1764ad694068a3120e8a2..23a750f50e26bfee15b89d4fff3c600a1da9397d 100755 --- a/DetectorDescription/DetDescrCnvSvc/src/DetDescrAddress.cxx +++ b/DetectorDescription/DetDescrCnvSvc/src/DetDescrAddress.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //==================================================================== @@ -22,9 +22,6 @@ #include "GaudiKernel/GenericAddress.h" #include "GaudiKernel/MsgStream.h" -// Externals -extern long DetDescr_StorageType; - /// Standard Constructor DetDescrAddress::DetDescrAddress(const CLID& clid, diff --git a/DetectorDescription/DetDescrCnvSvc/src/DetDescrCnvSvc.cxx b/DetectorDescription/DetDescrCnvSvc/src/DetDescrCnvSvc.cxx index afc1d4834383b3855efae5dc183b33180d1cbca0..49b7a840adafc5993946a5ee4f8ddfd364b98d96 100755 --- a/DetectorDescription/DetDescrCnvSvc/src/DetDescrCnvSvc.cxx +++ b/DetectorDescription/DetDescrCnvSvc/src/DetDescrCnvSvc.cxx @@ -20,7 +20,7 @@ // #include "SGTools/TransientAddress.h" //External definitions -long DetDescr_StorageType=0x44; +const long DetDescr_StorageType=0x44; //------------------------------------------------------------------------- @@ -233,14 +233,6 @@ DetDescrCnvSvc::initialize() { //------------------------------------------------------------------------- -StoreGateSvc * -DetDescrCnvSvc::detStore() const -{ - return (m_detStore); -} - -//------------------------------------------------------------------------- - /// Create a Generic address using explicit arguments to identify a single object. StatusCode DetDescrCnvSvc::createAddress(long /* svc_type */, const CLID& /* clid */, @@ -268,10 +260,10 @@ StatusCode DetDescrCnvSvc::createAddress( long /* svc_type */, return StatusCode::FAILURE; } if (ddAddr->fromString(refAddress).isFailure()) { - MsgStream log(msgSvc(),name()); - log << MSG::FATAL << "Could not assign address " << refAddress << endmsg; - return StatusCode::FAILURE; - } + MsgStream log(msgSvc(),name()); + log << MSG::FATAL << "Could not assign address " << refAddress << endmsg; + return StatusCode::FAILURE; + } } catch(...) { refpAddress = 0; diff --git a/DetectorDescription/DetDescrCnvSvc/src/DetDescrConverter.cxx b/DetectorDescription/DetDescrCnvSvc/src/DetDescrConverter.cxx index f4427802a1c06436626faa7424de8691f4e6cb1d..956b6e8a6a831ec126a1e2001ba799530813a66c 100755 --- a/DetectorDescription/DetDescrCnvSvc/src/DetDescrConverter.cxx +++ b/DetectorDescription/DetDescrCnvSvc/src/DetDescrConverter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -130,16 +130,3 @@ DetDescrConverter::DetDescrConverter(const CLID& myCLID, ISvcLocator* svcloc) : } } - - -/// Provide access to Detector Store -StoreGateSvc * DetDescrConverter::detStore() const -{ - if(m_cnvSvc) { - return (m_cnvSvc->detStore()); - } - else { - return (0); - } -} - diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt b/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt index cedf9ffba27b08d8965b47a7738a623f31af7d3f..96942605f8f4e9881749204e390b5b068d305204 100644 --- a/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt +++ b/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt @@ -14,8 +14,4 @@ atlas_depends_on_subdirs( PUBLIC ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - -atlas_add_test( flake8_test_dir - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt b/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt index e8538b691d8cc68e4a67e3f1938079b6f3f80abd..d144ff6623da7bd2319ab38a97c938af686ad1e4 100644 --- a/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt +++ b/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt @@ -23,5 +23,5 @@ if( NOT SIMULATIONBASE AND NOT GENERATIONBASE ) PROPERTIES TIMEOUT 300 ) atlas_add_test( AOD_InputGeo_test SCRIPT test/AtlasGeometryConfig_AOD_test.py - PROPERTIES TIMEOUT 300 ) + PROPERTIES TIMEOUT 600 ) endif() diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoMuonHits.icc b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoMuonHits.icc index 6bf443e9634c14132575b08515221a14791323f3..d263f8752012d1a6ddaf6b5d6694c270d64dc9fc 100755 --- a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoMuonHits.icc +++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoMuonHits.icc @@ -262,7 +262,7 @@ inline GeoMMHit::GeoMMHit (const MMSimHit & h) { inline Amg::Vector3D GeoMMHit::getGlobalPosition() const { HitID hitid = m_hit->MMId(); - MM_SimIdToOfflineId simToOffline(*s_mmID); + MM_SimIdToOfflineId simToOffline(s_mmID); Identifier offid = simToOffline.convert(hitid); if (offid == 0) @@ -285,7 +285,7 @@ inline Amg::Vector3D GeoMMHit::getGlobalPosition() const { inline Amg::Vector3D GeoMMHit::getTrkGlobalPosition() const { HitID hitid = m_hit->MMId(); - MM_SimIdToOfflineId simToOffline(*s_mmID); + MM_SimIdToOfflineId simToOffline(s_mmID); Identifier offid = simToOffline.convert(hitid); if (offid == 0) @@ -309,7 +309,7 @@ inline Amg::Vector3D GeoMMHit::getTrkLocalPosition() const { HitID hitid = m_hit->MMId(); - MM_SimIdToOfflineId simToOffline(*s_mmID); + MM_SimIdToOfflineId simToOffline(s_mmID); Identifier offid = simToOffline.convert(hitid); if (offid == 0) @@ -346,7 +346,7 @@ inline GeosTGCHit::GeosTGCHit (const sTGCSimHit & h) { inline Amg::Vector3D GeosTGCHit::getGlobalPosition() const { HitID hitid = m_hit->sTGCId(); - sTgcSimIdToOfflineId simToOffline(*s_stgcID); + sTgcSimIdToOfflineId simToOffline(s_stgcID); Identifier offid = simToOffline.convert(hitid); if (offid == 0) diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/GeoWrite/src/DumpGeoModelActionLocal.cpp b/DetectorDescription/GeoModel/GeoModelStandalone/GeoWrite/src/DumpGeoModelActionLocal.cpp index 274c1fc5eaf696b46dc90df713c124c32ecc7aea..e2bf7b0be746360614b80c21d37e0d86baf21dfa 100644 --- a/DetectorDescription/GeoModel/GeoModelStandalone/GeoWrite/src/DumpGeoModelActionLocal.cpp +++ b/DetectorDescription/GeoModel/GeoModelStandalone/GeoWrite/src/DumpGeoModelActionLocal.cpp @@ -6,6 +6,7 @@ // major updates: // - Aug 2018 - Riccardo Maria BIANCHI // - Sep 2018 - Riccardo Maria BIANCHI +// - May 2020 - J. Boudreau (write out GeoUnidentifiedShape // local includes #include "GeoWrite/DumpGeoModelActionLocal.h" @@ -32,7 +33,7 @@ #include "GeoModelKernel/GeoShapeShift.h" #include "GeoModelKernel/GeoShapeSubtraction.h" #include "GeoModelKernel/GeoShapeUnion.h" - +#include "GeoModelKernel/GeoUnidentifiedShape.h" // Qt includes #include <QSqlQuery> #include <QSqlError> @@ -1022,6 +1023,14 @@ QString DumpGeoModelActionLocal::getShapeParameters(const GeoShape* shape) pars << "opB=" + QString::number( shapeIdB.toUInt() ) ; shapePars = pars.join(";"); } + else if (shapeType=="UnidentifiedShape") { + QStringList pars; + const GeoUnidentifiedShape *shapeIn=dynamic_cast<const GeoUnidentifiedShape*>(shape); + pars << "name="+QString::fromStdString(shapeIn->name()); + pars << "asciiData="+QString::fromStdString(shapeIn->asciiData()); + shapePars=pars.join(";"); + } + else { qDebug() << "WARNING!!! - Shape '" << shapeType << "' needs to be customized!!"; } diff --git a/DetectorDescription/Identifier/Identifier/Identifier.h b/DetectorDescription/Identifier/Identifier/Identifier.h index f2dbfcbdfc0d1968db32c09510db98a9e0366c4e..502385156f627bdddf032e2aa6dc3d1f1210975c 100644 --- a/DetectorDescription/Identifier/Identifier/Identifier.h +++ b/DetectorDescription/Identifier/Identifier/Identifier.h @@ -245,7 +245,12 @@ inline Identifier::Identifier (Identifier32::value_type value) : m_id(max_value) { //std::cout << "Identifier(Identifier32::value_type) " << value << std::endl; - m_id = (static_cast<value_type>(value) << 32); + if (value == ~static_cast<Identifier32::value_type>(0)) { + m_id = max_value; + } + else { + m_id = (static_cast<value_type>(value) << 32); + } } inline Identifier::Identifier (int value) : m_id(max_value) @@ -318,7 +323,12 @@ inline Identifier& Identifier::operator = (Identifier32::value_type value) { //std::cout << "operator=(Identifier32::value_type) " << value << std::endl; - m_id = static_cast<value_type>(value) << 32; + if (value == ~static_cast<Identifier32::value_type>(0)) { + m_id = max_value; + } + else { + m_id = static_cast<value_type>(value) << 32; + } return (*this); } inline Identifier& diff --git a/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py b/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py index 73991be08613dd137e11fa7c5c97e08b0393f95d..489fdd523805b75c2cba882c5ae2d37907c4e9dd 100644 --- a/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py +++ b/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py @@ -61,51 +61,11 @@ def ByteStreamReadCfg( inputFlags, typeNames=[] ): proxy.ProviderNames += [ bsAddressProviderSvc.name ] acc.addService( proxy ) - bsCnvSvc.InitCnvs += [ "EventInfo",] - return acc -def TrigBSReadCfg(inputFlags): - - acc=ByteStreamReadCfg( inputFlags ) - - bsCnvSvc=acc.getService("ByteStreamCnvSvc") - bsCnvSvc.InitCnvs += ["HLT::HLTResult" ] - - bsAddressProviderSvc=acc.getService("ByteStreamAddressProviderSvc") - - bsAddressProviderSvc.TypeNames += [ - "TileCellIDC/TileCellIDC", - "MdtDigitContainer/MDT_DIGITS", - "RpcDigitContainer/RPC_DIGITS", - "TgcDigitContainer/TGC_DIGITS", - "CscDigitContainer/CSC_DIGITS", - "MuCTPI_RIO/MUCTPI_RIO", - "CTP_RIO/CTP_RIO" - ] - - bsAddressProviderSvc.TypeNames += [ - "LArRawChannelContainer/LArRawChannels", - "TileRawChannelContainer/TileRawChannelCnt", - "MuCTPI_RDO/MUCTPI_RDO", - "HLT::HLTResult/HLTResult_L2", - "HLT::HLTResult/HLTResult_EF", - "CTP_RDO/CTP_RDO", - "L1TopoRDOCollection/L1TopoRDOCollection" - ] - - - - if inputFlags.Input.isMC is False: - bsCnvSvc.GetDetectorMask=True - from IOVDbSvc.IOVDbSvcConfig import addFolders - acc.merge(addFolders(inputFlags,'/TDAQ/RunCtrl/SOR_Params','TDAQ' )) - # still need to figure out how conditions are setup in new system - #from IOVDbSvc.CondDB import conddb - #conddb.addFolder( 'TDAQ', '/TDAQ/RunCtrl/SOR_Params' ) - #acc.addService( conddb ) - - return acc +def TrigBSReadCfg( flags, typeNames=[] ): + # TODO: Search and replace all clients to use ByteStreamReadCfg directly, then remove TrigBSReadCfg + return ByteStreamReadCfg( flags, typeNames ) def ByteStreamWriteCfg( flags, typeNames=[] ): diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.cxx index 2494f4b0515c274dadbc7daba619d9e26abc6026..a562870a4f4afd7bd72f18769c6c357fedc0c444 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.cxx @@ -83,7 +83,7 @@ StatusCode ByteStreamOutputStreamCopyTool::connectOutput(const std::string& /*ou return(StatusCode::SUCCESS); } //__________________________________________________________________________ -StatusCode ByteStreamOutputStreamCopyTool::commitOutput() { +StatusCode ByteStreamOutputStreamCopyTool::commitOutput(bool/* doCommit*/) { MsgStream log(msgSvc(), name()); log << MSG::DEBUG << "In commitOutput" << endmsg; const RawEvent* re_c = m_inputSvc->currentEvent() ; diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.h b/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.h index aa5fc3fd025fe3f27b13ef7316eeb9069c1eef51..2664ae81a741cf4560638bc6fb1ab52930e022aa 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.h +++ b/Event/ByteStreamCnvSvc/src/ByteStreamOutputStreamCopyTool.h @@ -55,7 +55,7 @@ public: /// Commit the output stream after having streamed out objects /// Must commitOutput AFTER streaming - virtual StatusCode commitOutput() ; + virtual StatusCode commitOutput(bool doCommit = false) ; /// Finalize the output stream after the last commit, e.g. in /// finalize diff --git a/Event/EventCommonTPCnv/EventCommonTPCnv/OLD_selection.xml b/Event/EventCommonTPCnv/EventCommonTPCnv/OLD_selection.xml index 95150885f13685b5e5b25b3236ddd54f6b3577b1..34610b351da4786a01ba14ddcb09cbc0113ca984 100755 --- a/Event/EventCommonTPCnv/EventCommonTPCnv/OLD_selection.xml +++ b/Event/EventCommonTPCnv/EventCommonTPCnv/OLD_selection.xml @@ -5,6 +5,12 @@ <class name="INav4MomAssocs_p2" id="8040BEAA-BC65-43B8-B468-A7157C89ACB3" /> <class name="INav4MomAssocs_p2::Assocs_t" /> <!-- pick up INav4MomAssocs_p2::AssocElem_t and associated pair_base --> - <class pattern="std::*pair*<ElementLink_p2<unsigned int>,*"/> + <class pattern="std::*pair*<ElementLink_p2*unsigned*> > >"/> + <exclusion> + <!-- Exclude internal traits classes using pair that could be + matched by the previous rule. --> + <class pattern="*<std::pair*" /> + </exclusion> + </lcgdict> diff --git a/Event/EventCommonTPCnv/EventCommonTPCnv/selection.xml b/Event/EventCommonTPCnv/EventCommonTPCnv/selection.xml index e25f13d8d267b0f2fbe1085895574bc594725faf..e841fe58201007f7265ad6f1791bf7cb40d87164 100755 --- a/Event/EventCommonTPCnv/EventCommonTPCnv/selection.xml +++ b/Event/EventCommonTPCnv/EventCommonTPCnv/selection.xml @@ -19,9 +19,15 @@ <class name="INav4MomAssocs_p3" id="455AEE6B-9834-4E72-8F81-2532A52E3BE7" /> <class name="INav4MomAssocs_p3::Assocs_t" /> <!-- pick up INav4MomAssocs_p3::AssocElem_t and associated pair_base --> - <class pattern="std::*pair*<ElementLink_p3<unsigned int>,*"/> + <class pattern="std::*pair*<ElementLink_p3*unsigned*> > >"/> <class name="INav4MomLinkContainer_p1" id="A7F0A4C5-F343-4724-B317-FB5A890355FA" /> <class name="IParticleLinkContainer_p1" id="E82C71AF-AC5C-453B-9A35-FA45A849838E" /> + <exclusion> + <!-- Exclude internal traits classes using pair that could be + matched by the previous rules. --> + <class pattern="*<std::pair*" /> + </exclusion> + </lcgdict> diff --git a/Event/EventContainers/CMakeLists.txt b/Event/EventContainers/CMakeLists.txt index 3b2187e6cac8d061834500e0e4a6b89932af37be..35dd151127216a77fbab369f14f1a22420c19bcd 100644 --- a/Event/EventContainers/CMakeLists.txt +++ b/Event/EventContainers/CMakeLists.txt @@ -19,6 +19,14 @@ atlas_add_library( EventContainers PUBLIC_HEADERS EventContainers LINK_LIBRARIES AthenaKernel Identifier GaudiKernel ) + +atlas_add_dictionary( EventContainersDict + EventContainers/EventContainersDict.h + EventContainers/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} EventContainers ) + + atlas_add_test( IdCont SOURCES test/ID_ContainerTest.cxx INCLUDE_DIRS src test EventContainers LINK_LIBRARIES Identifier AthenaKernel GaudiKernel EventContainers @@ -38,3 +46,8 @@ atlas_add_test( IDCValueTest SOURCES test/IDCValueTest.cxx INCLUDE_DIRS src test EventContainers LINK_LIBRARIES Identifier AthenaKernel GaudiKernel EventContainers ) +atlas_add_test( IDBenchTest SOURCES test/IDC_Benchmark.cxx + INCLUDE_DIRS src test EventContainers + LINK_LIBRARIES Identifier AthenaKernel GaudiKernel EventContainers + LOG_IGNORE_PATTERN "time" + ) \ No newline at end of file diff --git a/Event/EventContainers/EventContainers/EventContainersDict.h b/Event/EventContainers/EventContainers/EventContainersDict.h new file mode 100644 index 0000000000000000000000000000000000000000..855f263565ef51ceb8751d3caa92f69e88487a17 --- /dev/null +++ b/Event/EventContainers/EventContainers/EventContainersDict.h @@ -0,0 +1,18 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + */ +/** + * @file EventContainers/EventContainersDict.h + * @author scott snyder <snyder@bnl.gov> + * @date May, 2020 + * @brief + */ + + +#ifndef EVENTCONTAINERS_EVENTCONTAINERSDICT_H +#define EVENTCONTAINERS_EVENTCONTAINERSDICT_H + +#include "EventContainers/IdentifiableContainerBase.h" + +#endif // not EVENTCONTAINERS_EVENTCONTAINERSDICT_H diff --git a/Event/EventContainers/EventContainers/IDC_WriteHandleBase.h b/Event/EventContainers/EventContainers/IDC_WriteHandleBase.h index 719404a7c1d2b166a2a53a7bc35c02767eb85a7e..1e25cf032621290754fce567534c282dea708597 100644 --- a/Event/EventContainers/EventContainers/IDC_WriteHandleBase.h +++ b/Event/EventContainers/EventContainers/IDC_WriteHandleBase.h @@ -14,13 +14,7 @@ namespace EventContainers { struct mutexPair{ std::condition_variable condition; std::mutex mutex; -#ifndef NDEBUG - std::atomic<int> counter; -#endif mutexPair() : condition(), mutex() { -#ifndef NDEBUG - counter.store(0); -#endif } }; diff --git a/Event/EventContainers/EventContainers/IIdentifiableCont.h b/Event/EventContainers/EventContainers/IIdentifiableCont.h index 1d9e18de2fded450ea7cab704e5794b832b16275..1d644f5e094998ad1e1752c351b173f47c978965 100644 --- a/Event/EventContainers/EventContainers/IIdentifiableCont.h +++ b/Event/EventContainers/EventContainers/IIdentifiableCont.h @@ -5,7 +5,7 @@ #ifndef EVENTCONTAINERS_IIDENTIFIABLECONT_H #define EVENTCONTAINERS_IIDENTIFIABLECONT_H -#include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" #include <memory> namespace EventContainers { diff --git a/Event/EventContainers/EventContainers/I_InternalIDC.h b/Event/EventContainers/EventContainers/I_InternalIDC.h new file mode 100644 index 0000000000000000000000000000000000000000..c336d4b964b0e4e5b47e9862b9aff113f065b705 --- /dev/null +++ b/Event/EventContainers/EventContainers/I_InternalIDC.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTCONTAINERS_I_INTERNALIDC_H +#define EVENTCONTAINERS_I_INTERNALIDC_H + +#include "Identifier/IdentifierHash.h" +#include "GaudiKernel/StatusCode.h" +#include <vector> +#include <utility> + +namespace EventContainers{ +class IDC_WriteHandleBase; +/* +The intention of the IdentifiableContainer is to provide a key-value map +for collection pointers. To increase memory and cpu efficiency the online trigger +system different “views†can share collection that are created concurrently. +To efficiently support these different uses while not imposing overhead on the +offline case and to maintain a consistent interface the internals of the class are +virtualised. + +A standard iterator is provided for fast iteration in a sequential order. +*/ +class I_InternalIDC{ +public: + typedef std::pair < IdentifierHash::value_type, const void* > hashPair; + typedef std::vector < hashPair >::const_iterator InternalConstItr; + #include "EventContainers/deleter.h" + virtual InternalConstItr cbegin() const=0; + virtual InternalConstItr cend() const=0; + virtual InternalConstItr indexFind( IdentifierHash hashId ) const =0; + virtual ~I_InternalIDC() = default; + virtual void wait() const = 0; + virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) = 0; + virtual bool tryAddFromCache(IdentifierHash hashId) = 0; + virtual std::vector<IdentifierHash> getAllCurrentHashes() const =0; + virtual const std::vector < hashPair >& getAllHashPtrPair() const = 0; + virtual size_t numberOfCollections() const = 0; + virtual size_t fullSize() const noexcept =0; + virtual StatusCode fetchOrCreate(IdentifierHash hashId) =0; + virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) =0; + virtual bool insert(IdentifierHash hashId, const void* ptr) =0; + virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept = 0; + virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) = 0; + virtual void* removeCollection( IdentifierHash hashId ) =0; + virtual void destructor(deleter_f*) noexcept =0; + virtual void cleanUp(deleter_f*) noexcept =0; +}; + +} +#endif \ No newline at end of file diff --git a/Event/EventContainers/EventContainers/IdentifiableCache.h b/Event/EventContainers/EventContainers/IdentifiableCache.h index 0c0d3aa7d2216f8552fead3e92a82c81b1504e79..e95325dfeda53d0710cc404a03b4b100d54d438d 100644 --- a/Event/EventContainers/EventContainers/IdentifiableCache.h +++ b/Event/EventContainers/EventContainers/IdentifiableCache.h @@ -71,12 +71,12 @@ public: return reinterpret_cast<const T*> (IdentifiableCacheBase::get (hash)); } - bool add (IdentifierHash hash, const T* p) + std::pair<bool, const void*> add (IdentifierHash hash, const T* p) { return IdentifiableCacheBase::add (hash, p); } - bool add (IdentifierHash hash, std::unique_ptr<T> p) + std::pair<bool, const void*> add (IdentifierHash hash, std::unique_ptr<T> p) { return IdentifiableCacheBase::add (hash, void_unique_ptr(std::move(p))); } diff --git a/Event/EventContainers/EventContainers/IdentifiableCacheBase.h b/Event/EventContainers/EventContainers/IdentifiableCacheBase.h index 92a12a85b8f8c8c099bfe1426a043d3e194eaeca..be173fe0913179ee46b17b7cb1707a76342f218d 100644 --- a/Event/EventContainers/EventContainers/IdentifiableCacheBase.h +++ b/Event/EventContainers/EventContainers/IdentifiableCacheBase.h @@ -5,12 +5,7 @@ */ // $Id: IdentifiableCacheBase.h 791541 2017-01-09 10:43:53Z smh $ -/** - * @file IdentifiableCacheBase.h - * @author scott snyder <snyder@bnl.gov> - * @date Mar, 2016 - * @brief - */ + #ifndef EVENTCONTAINERS_IDENTIFIABLECACHEBASE_H @@ -37,43 +32,13 @@ public: //here for access from other classes static constexpr uintptr_t INVALIDflag = UINTPTR_MAX; static constexpr uintptr_t ABORTEDflag = UINTPTR_MAX-1; -static constexpr size_t s_defaultBucketSize =6; +static constexpr size_t s_defaultBucketSize =2; typedef std::true_type thread_safe; typedef std::set<IdentifierHash> idset_t; -#if 0 - struct deleter - { - void operator() (const void* p); - }; -#endif - - typedef void deleter_f (const void* p); +#include "EventContainers/deleter.h" - class void_unique_ptr - : public std::unique_ptr<const void, deleter_f*> - { - public: - using std::unique_ptr<const void, deleter_f*>::unique_ptr; - - template <class T> - struct Deleter - { - static void deleter (const void* p) - { - delete reinterpret_cast<const T*>(p); - } - }; - - template <class T> - void_unique_ptr(std::unique_ptr<T> p) - : std::unique_ptr<const void, deleter_f*> (p.release(), - Deleter<T>::deleter) - { - } - }; - struct IMaker { bool m_IsReEntrant = false; @@ -92,13 +57,13 @@ typedef std::set<IdentifierHash> idset_t; ///In a threaded situation this collection will be valid but will not container hashes later added std::vector<IdentifierHash> ids(); - bool add (IdentifierHash hash, const void* p) noexcept; + std::pair<bool, const void*> add (IdentifierHash hash, const void* p) noexcept; // addLock is same as method above except we check for invalid state first, // more optimal for calling using writehandle lock method - bool addLock (IdentifierHash hash, const void* p) noexcept; - bool addLock (IdentifierHash hash, void_unique_ptr p) noexcept; - bool add (IdentifierHash hash, void_unique_ptr p) noexcept; + std::pair<bool, const void*> addLock (IdentifierHash hash, const void* p) noexcept; + std::pair<bool, const void*> addLock (IdentifierHash hash, void_unique_ptr p) noexcept; + std::pair<bool, const void*> add (IdentifierHash hash, void_unique_ptr p) noexcept; bool IMakerPresent() const { return m_maker!=nullptr; } @@ -128,9 +93,7 @@ typedef std::set<IdentifierHash> idset_t; size_t fullSize() const { return m_vec.size(); } ///In a concurrent situation this number isn't necessarily perfectly synchronised with ids().size() size_t numberOfHashes(); -#ifndef NDEBUG - void cancelWait(IdentifierHash hash); -#endif + protected: IdentifiableCacheBase (IdentifierHash maxHash, const IMaker* maker, size_t lockBucketSize); IdentifiableCacheBase (IdentifierHash maxHash, const IMaker* maker); @@ -140,7 +103,7 @@ protected: void notifyHash(IdentifierHash hash); private: std::vector<std::atomic<const void*> > m_vec; - + friend class InternalOnline; const IMaker* m_maker; typedef std::mutex mutex_t; diff --git a/Event/EventContainers/EventContainers/IdentifiableContainerBase.h b/Event/EventContainers/EventContainers/IdentifiableContainerBase.h index 86d697f8226acd5764e1601325ffabbdd9972341..b3b1d6d7ab0f0407bbfc7d48e63781f676a225c6 100644 --- a/Event/EventContainers/EventContainers/IdentifiableContainerBase.h +++ b/Event/EventContainers/EventContainers/IdentifiableContainerBase.h @@ -1,39 +1,44 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EVENTCONTAINERS_IDENTIFIABLECONTAINERBASE_H #define EVENTCONTAINERS_IDENTIFIABLECONTAINERBASE_H - -#include "EventContainers/IdentifiableCacheBase.h" +#include "EventContainers/I_InternalIDC.h" #include "CxxUtils/checker_macros.h" -class IdentifiableContainerBase{ +namespace EventContainers{ class IdentifiableCacheBase; +enum class Mode { OfflineLowMemory, OfflineFast }; +class IdentifiableContainerBase{ public: +#include "EventContainers/deleter.h" + typedef std::vector<IdentifierHash> Hash_Container; - IdentifiableContainerBase(EventContainers::IdentifiableCacheBase *cache, bool online); - static Hash_Container::const_iterator findHash(Hash_Container*, IdentifierHash); - ~IdentifiableContainerBase(); + IdentifiableContainerBase(EventContainers::IdentifiableCacheBase *cache); + IdentifiableContainerBase(size_t maxsize); + IdentifiableContainerBase(size_t maxsize, Mode mode); + ~IdentifiableContainerBase() = default; protected: - EventContainers::IdentifiableCacheBase *m_cacheLink; bool m_OnlineMode; - mutable std::atomic<bool> m_waitNeeded ATLAS_THREAD_SAFE; //These mutables are carefully thought out, do not change typedef EventContainers::IdentifiableCacheBase IdentifiableCacheBase; - mutable std::vector< IdentifierHash > m_waitlist ATLAS_THREAD_SAFE; - mutable std::mutex m_waitMutex ATLAS_THREAD_SAFE; - mutable std::vector<bool> m_mask ATLAS_THREAD_SAFE; - std::vector<IdentifierHash> GetAllCurrentHashes() const; - - void Wait() const; - bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock); - bool tryAddFromCache(IdentifierHash hashId); - void cleanup(); - size_t numberOfCollections() const; + std::unique_ptr<I_InternalIDC> m_link; + std::vector<IdentifierHash> GetAllCurrentHashes() const { return m_link->getAllCurrentHashes(); } + bool insert(IdentifierHash hashId, const void* ptr) { return m_link->insert(hashId, ptr); } + void Wait() const { m_link->wait(); } + bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) { + return m_link->tryAddFromCache(hashId, lock); } + bool tryAddFromCache(IdentifierHash hashId){ return m_link->tryAddFromCache(hashId); } + void cleanup(deleter_f* deleter); + size_t numberOfCollections() const { return m_link->numberOfCollections(); } void ResetMask(); - StatusCode fetchOrCreate(IdentifierHash hashId); - StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds); + StatusCode fetchOrCreate(IdentifierHash hashId){ return m_link->fetchOrCreate(hashId); } + StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) { return m_link->fetchOrCreate(hashIds); } + const void* indexFindPtr( IdentifierHash hashId ) const { return m_link->findIndexPtr(hashId); } }; +} + + #endif diff --git a/Event/EventContainers/EventContainers/IdentifiableContainerMT.h b/Event/EventContainers/EventContainers/IdentifiableContainerMT.h index cb1e7bb2fb375c27a159413526350881b8efa4f4..8791b57b881f699fa51b2edad021676cc006f323 100644 --- a/Event/EventContainers/EventContainers/IdentifiableContainerMT.h +++ b/Event/EventContainers/EventContainers/IdentifiableContainerMT.h @@ -16,48 +16,33 @@ */ #include "Identifier/Identifier.h" -#include "EventContainers/IdentifiableCache.h" #include "EventContainers/IIdentifiableCont.h" #include <memory> #include "GaudiKernel/DataObject.h" #include "EventContainers/IdentifiableContainerBase.h" #include "EventContainers/IDC_WriteHandleBase.h" #include "CxxUtils/AthUnlikelyMacros.h" -//const_iterator and indexFind are provided for backwards compatability. they are not optimal -/* -IT is faster to iterate over the container with this method: - auto hashes= m_container->GetAllCurrentHashes(); - for (auto hash : hashes) { - T* coll = m_container->indexFindPtr(hash); - //Use coll here - } -*/ +#include "EventContainers/IdentifiableCache.h" template < class T> -class IdentifiableContainerMT : public DataObject, public IdentifiableContainerBase, public EventContainers::IIdentifiableCont<T> +class IdentifiableContainerMT : public DataObject, public EventContainers::IdentifiableContainerBase, public EventContainers::IIdentifiableCont<T> { - public: class IDC_WriteHandle : EventContainers::IDC_WriteHandleBase { friend class IdentifiableContainerMT<T>; IdentifiableContainerMT<T> *m_IDC_ptr; IdentifierHash m_hashId; - bool m_alreadyPresent; public: - IDC_WriteHandle() : IDC_WriteHandleBase(), m_IDC_ptr(0), m_hashId(0), m_alreadyPresent(false) { } + IDC_WriteHandle() : IDC_WriteHandleBase(), m_IDC_ptr(0), m_hashId(0) { } IDC_WriteHandle& operator=(const IDC_WriteHandle& other) = delete; IDC_WriteHandle(const IDC_WriteHandle& other) = delete; - IDC_WriteHandle& operator=(IDC_WriteHandle&& other) noexcept{ - Swap(*this, other); - return *this; - } - void Swap(IDC_WriteHandle& a, IDC_WriteHandle& b) noexcept { + IDC_WriteHandle& operator=(IDC_WriteHandle&& other) noexcept = delete; + static void Swap(IDC_WriteHandle& a, IDC_WriteHandle& b) noexcept { if(&a == &b) return; std::swap(a.m_IDC_ptr, b.m_IDC_ptr); std::swap(a.m_hashId, b.m_hashId); - std::swap(a.m_alreadyPresent, b.m_alreadyPresent); std::swap(a.m_atomic, b.m_atomic); std::swap(a.m_mut, b.m_mut); } @@ -69,10 +54,11 @@ public: if(ATH_UNLIKELY(m_IDC_ptr==nullptr)) return StatusCode::FAILURE; StatusCode sc = m_IDC_ptr->addLock(std::move(ptr), m_hashId); IDC_WriteHandleBase::ReleaseLock(); - m_alreadyPresent = true; return sc; } - bool alreadyPresent() const { return m_alreadyPresent; } + bool alreadyPresent() { return m_IDC_ptr->m_link->tryAddFromCache(m_hashId, *this); } + ///This method is to avoid calling an expensive operation in the offline case + bool OnlineAndPresentInAnotherView() { return m_IDC_ptr->m_OnlineMode && m_IDC_ptr->m_link->tryAddFromCache(m_hashId, *this); } }; @@ -89,16 +75,13 @@ public: typedef T base_value_type; - ICACHE* castCache() { return static_cast<ICACHE*>(m_cacheLink); } - ICACHE* castCache() const { return static_cast<ICACHE*>(m_cacheLink); } - class const_iterator { public: /// iterator constructor - const_iterator() : m_sptr(), m_current(nullptr), m_hash(0), m_idContainer(nullptr), m_end(false) { } + const_iterator() : m_itr() {} const_iterator(const_iterator&&) = default; const_iterator(const const_iterator&) = default; const_iterator& operator = ( const const_iterator & ) = default; //move operators may be useful for shared_ptr @@ -108,41 +91,8 @@ public: /// increment operator const_iterator& operator ++ () { - if(m_end) return *this; - //If called on iterator created by "fast" iterator method const_iterator( const MyType* idC, IdentifierHash hash ) - if(!m_sptr) { - auto ids = m_idContainer->GetAllCurrentHashes(); - m_sptr = std::shared_ptr<Hash_Container> (new Hash_Container()); - m_sptr->swap(ids); - m_hashItr = IdentifiableContainerBase::findHash(m_sptr.get(), m_hash); - if(m_hashItr==m_sptr->end()) { - m_end = true; - m_sptr.reset(); - return *this; - } - } - -#ifdef IdentifiableCacheBaseRemove - do { - ++m_hashItr; - if(m_hashItr==m_sptr->end()) { - m_end = true; - m_sptr.reset(); - return *this; - } - m_current = m_idContainer->indexFindPtr(*m_hashItr); - } while(m_current==nullptr); //If we implement remove, this can happen - -#else - ++m_hashItr; - if(m_hashItr==m_sptr->end()) { - m_end = true; - m_sptr.reset(); - return *this; - } - m_current = m_idContainer->indexFindPtr(*m_hashItr); -#endif - return *this; + ++m_itr; + return *this; } /// increment operator @@ -153,82 +103,51 @@ public: } const T* cptr () const { - return m_current; + return reinterpret_cast<const T*>( m_itr->second ); } const T* operator * () const { - return m_current; + return reinterpret_cast<const T*>( m_itr->second ); } const T* operator ->() const { return (operator*()); } /// comparison operator bool operator != ( const const_iterator &it ) const { - if(m_end || it.m_end) return m_end!= it.m_end; - return m_current!= it.m_current; + return m_itr!= it.m_itr; } /// comparison operator bool operator == ( const const_iterator &it ) const { - if(m_end || it.m_end) return m_end == it.m_end; - return m_current == it.m_current; + return m_itr == it.m_itr; } /// hashId of the pointed-to element //Calling this on an end iterator is undefined behaviour IdentifierHash hashId() const { - return !m_sptr ? m_hash : *m_hashItr; + return m_itr->first; } protected: friend class IdentifiableContainerMT<T>; - const_iterator(const MyType* idC, bool end) : m_sptr(), m_current(nullptr), m_hash(0), - m_idContainer(idC), m_end(end) - { - if(!m_end) { - auto ids = m_idContainer->GetAllCurrentHashes(); - if(ids.empty()) {//For empty containers - m_end = true; - } else { - m_sptr = std::shared_ptr<Hash_Container> (new Hash_Container()); - m_sptr->swap(ids); - m_hashItr = m_sptr->begin(); - m_current = m_idContainer->indexFindPtr(*m_hashItr); -#ifdef IdentifiableCacheBaseRemove - if(m_current==nullptr){ ++(*this); } //If we implement remove, this can happen -#endif - } - } - } - + const_iterator(EventContainers::I_InternalIDC::InternalConstItr itr) : m_itr(std::move(itr)) {} - //Alot of existing code creates a lot of iterators but doesn't interator over it - //This constructor delays creation of hash vector until ++ is called - const_iterator( const MyType* idC, IdentifierHash hash ) :m_sptr(), - m_hash(hash), m_idContainer(idC) { - m_current = m_idContainer->indexFindPtr(hash); - m_end = m_current==nullptr; - } - - Hash_Container::const_iterator m_hashItr; - std::shared_ptr<Hash_Container> m_sptr; - const T* m_current; - IdentifierHash m_hash; - const MyType *m_idContainer; - bool m_end; + EventContainers::I_InternalIDC::InternalConstItr m_itr; }; - + friend class IDC_WriteHandle; /// constructor initializes the collection the hashmax, OFFLINE usages pattern IdentifiableContainerMT(IdentifierHash hashMax); + IdentifiableContainerMT(IdentifierHash hashMax, EventContainers::Mode); + /// constructor initializes with a link to a cache, ONLINE usage pattern IdentifiableContainerMT(ICACHE *cache); - ~IdentifiableContainerMT() { if(!m_OnlineMode) delete castCache(); } + ~IdentifiableContainerMT() { m_link->destructor(void_unique_ptr::Deleter<T>::deleter); } virtual bool hasExternalCache() const override final { return m_OnlineMode; } @@ -239,8 +158,7 @@ public: virtual const T* indexFindPtr( IdentifierHash hashId ) const override final; const_iterator indexFind( IdentifierHash hashId ) const { - const_iterator it(this, hashId); - return it; + return m_link->indexFind(hashId); } /// insert collection into container with id hash @@ -282,12 +200,12 @@ public: /// return full size of container virtual size_t fullSize() const override final { - return m_mask.size(); + return m_link->fullSize(); } ///Duplicate of fullSize for backwards compatability size_t size() const { - return m_mask.size(); + return m_link->fullSize(); } /// return number of collections @@ -295,6 +213,11 @@ public: return IdentifiableContainerBase::numberOfCollections(); } + const std::vector < std::pair<IdentifierHash::value_type, const T*> >& GetAllHashPtrPair() const{ + static_assert(sizeof(const T*) == sizeof(const void*) && std::is_pointer<const T*>::value); + return reinterpret_cast<const std::vector < std::pair<IdentifierHash::value_type, const T*> >&> + (m_link->getAllHashPtrPair()); + } ///Returns a collection of all hashes availiable in this IDC. ///If this is an "offline" mode IDC then this is identical to the cache @@ -306,14 +229,13 @@ public: /// return const_iterator for first entry const_iterator begin() const { - const_iterator it(this, false); - return it; + return const_iterator(m_link->cbegin()); } /// return const_iterator for end of container const_iterator end() const { - return const_iterator(nullptr, true); + return const_iterator(m_link->cend()); } [[nodiscard]] IDC_WriteHandle getWriteHandle(IdentifierHash hash) @@ -321,7 +243,6 @@ public: IDC_WriteHandle lock; lock.m_hashId = hash; lock.m_IDC_ptr = this; - lock.m_alreadyPresent = IdentifiableContainerBase::tryAddFromCache(hash, lock); return lock; } }; @@ -331,11 +252,7 @@ template < class T> T* //Please don't do this we want to get rid of this IdentifiableContainerMT<T>::removeCollection( IdentifierHash hashId ) { - using namespace EventContainers; - const T* ptr = reinterpret_cast<const T*> (castCache()->find (hashId)); - castCache()->remove(hashId); - m_mask[hashId] = false; - return const_cast<T*>(ptr); + return reinterpret_cast<T*>(m_link->removeCollection(hashId)); } #endif @@ -343,13 +260,19 @@ IdentifiableContainerMT<T>::removeCollection( IdentifierHash hashId ) // Constructor for OFFLINE style IDC template < class T> -IdentifiableContainerMT<T>::IdentifiableContainerMT(IdentifierHash maxHash) : IdentifiableContainerBase(new ICACHE(maxHash, nullptr), false) +IdentifiableContainerMT<T>::IdentifiableContainerMT(IdentifierHash maxHash) : IdentifiableContainerBase(maxHash) +{ +} + +template < class T> +IdentifiableContainerMT<T>::IdentifiableContainerMT(IdentifierHash maxHash, EventContainers::Mode mode) : + IdentifiableContainerBase(maxHash, mode) { } // Constructor for ONLINE style IDC template < class T> -IdentifiableContainerMT<T>::IdentifiableContainerMT(ICACHE *cache) : IdentifiableContainerBase(cache, true) +IdentifiableContainerMT<T>::IdentifiableContainerMT(ICACHE *cache) : IdentifiableContainerBase(cache) { } @@ -360,8 +283,7 @@ template < class T> const T* IdentifiableContainerMT<T>::indexFindPtr( IdentifierHash hashId ) const { - if((hashId < m_mask.size()) and m_mask[hashId]) return castCache()->findWait(hashId); - else return nullptr; + return reinterpret_cast<const T* > (IdentifiableContainerBase::indexFindPtr(hashId)); } // insert collection into container with id hash @@ -370,8 +292,7 @@ StatusCode IdentifiableContainerMT<T>::addCollection(const T* coll, IdentifierHash hashId) { // update m_hashids - if (ATH_UNLIKELY(! castCache()->add(hashId, coll))) return StatusCode::FAILURE; - m_mask[hashId] = true; + if (ATH_UNLIKELY(! IdentifiableContainerBase::insert(hashId, coll))) return StatusCode::FAILURE; return StatusCode::SUCCESS; } @@ -382,8 +303,7 @@ template < class T> void IdentifiableContainerMT<T>::cleanup() { - if(m_OnlineMode) { IdentifiableContainerBase::ResetMask(); } - else { castCache()->clearCache(); } + IdentifiableContainerBase::cleanup(void_unique_ptr::Deleter<T>::deleter); } template < class T> @@ -414,18 +334,20 @@ IdentifiableContainerMT<T>::naughtyRetrieve(IdentifierHash hashId, T* &collToRet { if(ATH_UNLIKELY(m_OnlineMode)) return StatusCode::FAILURE;//NEVER ALLOW FOR EXTERNAL CACHE else { - collToRetrieve = const_cast< T* > (castCache()->find(hashId));//collToRetrieve can be null on success + auto p = reinterpret_cast<const T* > (m_link->findIndexPtr(hashId));//collToRetrieve can be null on success + collToRetrieve = const_cast<T*>(p); return StatusCode::SUCCESS; } } template < class T> StatusCode -IdentifiableContainerMT<T>::addOrDelete(std::unique_ptr<T> ptr, IdentifierHash hashId) +IdentifiableContainerMT<T>::addOrDelete(std::unique_ptr<T> uptr, IdentifierHash hashId) { - if(ATH_UNLIKELY(hashId >= m_mask.size())) return StatusCode::FAILURE; - castCache()->add(hashId, std::move(ptr)); - m_mask[hashId] = true; //it wasn't added it is already present therefore mask could be true + if(ATH_UNLIKELY(hashId >= m_link->fullSize())) return StatusCode::FAILURE; + auto ptr = uptr.release(); + bool b = IdentifiableContainerBase::insert(hashId, ptr); + if(!b) delete ptr; return StatusCode::SUCCESS; } @@ -433,25 +355,18 @@ template < class T> StatusCode IdentifiableContainerMT<T>::addLock(std::unique_ptr<T> ptr, IdentifierHash hashId) { - if(ATH_UNLIKELY(hashId >= m_mask.size())) return StatusCode::FAILURE; - [[maybe_unused]] bool deleted = !castCache()->addLock(hashId, std::move(ptr)); -#ifndef NDEBUG - if(deleted){ - std::cout << "IDC WARNING Deletion shouldn't occur in addLock paradigm" << std::endl; - } -#endif - m_mask[hashId] = true; //it wasn't added it is already present therefore mask could be true - return StatusCode::SUCCESS; + return m_link->addLock(hashId, ptr.release()); } template < class T> StatusCode -IdentifiableContainerMT<T>::addOrDelete(std::unique_ptr<T> ptr, IdentifierHash hashId, bool &deleted) +IdentifiableContainerMT<T>::addOrDelete(std::unique_ptr<T> uptr, IdentifierHash hashId, bool &deleted) { - if(ATH_UNLIKELY(hashId >= m_mask.size())) return StatusCode::FAILURE; - bool added = castCache()->add(hashId, std::move(ptr)); - m_mask[hashId] = true; - deleted = !added; + if(ATH_UNLIKELY(hashId >= m_link->fullSize())) return StatusCode::FAILURE; + auto ptr = uptr.release(); + bool b = IdentifiableContainerBase::insert(hashId, ptr); + if(!b) delete ptr; + deleted = !b; return StatusCode::SUCCESS; } diff --git a/Event/EventContainers/EventContainers/InternalOffline.h b/Event/EventContainers/EventContainers/InternalOffline.h new file mode 100644 index 0000000000000000000000000000000000000000..ad24332d624588b5ba4f2b7d856278bcb142b27d --- /dev/null +++ b/Event/EventContainers/EventContainers/InternalOffline.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTCONTAINERS_INTERNALOFFLINE_H +#define EVENTCONTAINERS_INTERNALOFFLINE_H +#include "EventContainers/I_InternalIDC.h" + +namespace EventContainers{ +/* +This class implements the IdentifiableContainer code for the offline case. +To avoid excess memory usage just the key-value pair is stored and can be directly +iterated upon. + +Faster consecutive iteration, slower random access. +Prefer iteration over FindIndexPtr and indexFind +*/ +class InternalOffline final : public I_InternalIDC { +public: + InternalOffline(size_t max); + virtual ~InternalOffline()=default; + virtual InternalConstItr cbegin() const override; + virtual InternalConstItr cend() const override; + virtual InternalConstItr indexFind( IdentifierHash hashId ) const override; + virtual const std::vector < hashPair >& getAllHashPtrPair() const override; + std::vector<std::pair<IdentifierHash::value_type, const void*>> m_map; + size_t m_maximumSize; + virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override; + virtual bool tryAddFromCache(IdentifierHash hashId) override; + virtual void wait() const override; + virtual std::vector<IdentifierHash> getAllCurrentHashes() const override; + virtual size_t numberOfCollections() const override; + virtual void cleanUp(deleter_f* deleter) noexcept override; + virtual size_t fullSize() const noexcept override {return m_maximumSize;} + virtual StatusCode fetchOrCreate(IdentifierHash hashId) override; + virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) override; + virtual bool insert(IdentifierHash hashId, const void* ptr) override; + virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept override; + virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override; + virtual void* removeCollection( IdentifierHash hashId ) override; + virtual void destructor(deleter_f*) noexcept override; + +}; + +} +#endif diff --git a/Event/EventContainers/EventContainers/InternalOfflineFast.h b/Event/EventContainers/EventContainers/InternalOfflineFast.h new file mode 100644 index 0000000000000000000000000000000000000000..b32569e83eeef8e6ff6e414b620c56c4ecbbc97b --- /dev/null +++ b/Event/EventContainers/EventContainers/InternalOfflineFast.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTCONTAINERS_INTERNALOFFLINEFAST_H +#define EVENTCONTAINERS_INTERNALOFFLINEFAST_H +#include "EventContainers/I_InternalIDC.h" +#include "CxxUtils/checker_macros.h" +#include <atomic> +#include <mutex> + +namespace EventContainers{ +/* +This class implements the IdentifiableContainer code for the offline case. +This class may use excess memory for fast random access purposes + +Fast random access. +*/ +class InternalOfflineFast final : public I_InternalIDC { +public: + InternalOfflineFast(size_t max); + virtual ~InternalOfflineFast()=default; + virtual InternalConstItr cbegin() const override; + virtual InternalConstItr cend() const override; + virtual InternalConstItr indexFind( IdentifierHash hashId ) const override; + virtual const std::vector < hashPair >& getAllHashPtrPair() const override; + mutable std::vector<std::pair<IdentifierHash::value_type, const void*>> m_map; + std::vector<const void*> m_fullMap; + mutable std::mutex m_waitMutex ATLAS_THREAD_SAFE; + mutable std::atomic<bool> m_needsupdate ATLAS_THREAD_SAFE; //These mutables are carefully thought out, do not change + virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override; + virtual bool tryAddFromCache(IdentifierHash hashId) override; + virtual void wait() const override; + virtual std::vector<IdentifierHash> getAllCurrentHashes() const override; + virtual size_t numberOfCollections() const override; + virtual void cleanUp(deleter_f* deleter) noexcept override; + virtual size_t fullSize() const noexcept override {return m_fullMap.size();} + virtual StatusCode fetchOrCreate(IdentifierHash hashId) override; + virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) override; + virtual bool insert(IdentifierHash hashId, const void* ptr) override; + virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept override; + virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override; + virtual void* removeCollection( IdentifierHash hashId ) override; + virtual void destructor(deleter_f*) noexcept override; + +}; + +} +#endif diff --git a/Event/EventContainers/EventContainers/InternalOnline.h b/Event/EventContainers/EventContainers/InternalOnline.h new file mode 100644 index 0000000000000000000000000000000000000000..aa90b41816b3bac1d250e42651792e9f91043731 --- /dev/null +++ b/Event/EventContainers/EventContainers/InternalOnline.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTCONTAINERS_INTERNALONLINE_H +#define EVENTCONTAINERS_INTERNALONLINE_H + +#include "EventContainers/I_InternalIDC.h" +#include "CxxUtils/checker_macros.h" +#include <atomic> +#include <mutex> + +namespace EventContainers{ +class IdentifiableCacheBase; +/* +The online implementation keeps a pointer to an external cache which owns the collections +and can be filled concurrently. The container itself maintains a bit mask to identify which +collections can be accessed from this container. It also maintains a wait list which records +uncompleted objects that were added to the container. When a complete collection is +requested the wait-list is processed, locking the thread until all elements are completed. +The intention of this is to delay thread locking until the last possible moment and thus +hopefully avoid it altogether. +Random access is fast since it takes a direct index to the external cache element. +Ordered iteration is also fast after the lazily initialised collection is constructed. +*/ +class InternalOnline final : public I_InternalIDC { +public: + InternalOnline(EventContainers::IdentifiableCacheBase *cache); + virtual InternalConstItr cbegin() const override; + virtual InternalConstItr cend() const override; + virtual InternalConstItr indexFind( IdentifierHash hashId ) const override; + virtual const std::vector < hashPair >& getAllHashPtrPair() const override; + virtual ~InternalOnline()=default; + virtual void wait() const override; + virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override; + virtual bool tryAddFromCache(IdentifierHash hashId) override; + virtual std::vector<IdentifierHash> getAllCurrentHashes() const override; + virtual size_t numberOfCollections() const override; + void resetMask(); + virtual size_t fullSize() const noexcept override { return m_mask.size(); } + virtual StatusCode fetchOrCreate(IdentifierHash hashId) override; + virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) override; + virtual bool insert(IdentifierHash hashId, const void* ptr) override; + virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept override; + virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override; + virtual void* removeCollection( IdentifierHash hashId ) override; + virtual void destructor(deleter_f*) noexcept override; + virtual void cleanUp(deleter_f*) noexcept override; +private: + EventContainers::IdentifiableCacheBase *m_cacheLink; + mutable std::vector< IdentifierHash > m_waitlist ATLAS_THREAD_SAFE; + mutable std::vector<std::pair<IdentifierHash::value_type, const void*>> m_map ATLAS_THREAD_SAFE; + mutable std::mutex m_waitMutex ATLAS_THREAD_SAFE; + mutable std::vector<bool> m_mask ATLAS_THREAD_SAFE; + mutable std::atomic<bool> m_waitNeeded ATLAS_THREAD_SAFE; //These mutables are carefully thought out, do not change +}; + +} +#endif diff --git a/Event/EventContainers/EventContainers/SelectAllObjectMT.h b/Event/EventContainers/EventContainers/SelectAllObjectMT.h index 42a25c0f7c5eb0c240b8fed342ad64c04f3cece1..3adb448a5c15198c6c02ce4331615a3bd43d1a31 100644 --- a/Event/EventContainers/EventContainers/SelectAllObjectMT.h +++ b/Event/EventContainers/EventContainers/SelectAllObjectMT.h @@ -15,11 +15,12 @@ public: // typedef OBJECT OBJECT; typedef SelectAllObjectMT<DCC,OBJECT> MyType; typedef typename DC::const_iterator Object_const_iterator; - typedef typename DCC::Hash_Container::const_iterator Hash_iterator; + typedef typename DCC::const_iterator Cont_iterator; +// typedef typename DCC::Hash_Container::const_iterator Hash_iterator; class const_iterator { - Hash_iterator m_hash_itr; + Cont_iterator m_cont_itr; const SelectAllObjectMT<DCC,OBJECT>* m_Parent; Object_const_iterator m_digit_it; const DC* m_dc; // cache DC @@ -29,12 +30,9 @@ public: SKIPNEXT: - ++m_hash_itr; - if(m_hash_itr != m_Parent->m_hashes.cend()) { - m_dc = m_Parent->m_dcc->indexFindPtr(*m_hash_itr); -#ifdef IdentifiableCacheBaseRemove - if(m_dc == nullptr) goto SKIPNEXT;//In case we implement remove -#endif + ++m_cont_itr; + if(m_cont_itr != m_Parent->m_dcc->end()) { + m_dc = *m_cont_itr; m_digit_it = m_dc->begin(); if(m_digit_it == m_dc->end()) goto SKIPNEXT; } else { @@ -47,16 +45,16 @@ SKIPNEXT: const_iterator() : - m_hash_itr(), + m_cont_itr(), m_Parent(nullptr), m_digit_it(), m_dc(nullptr) {} - const_iterator(const Hash_iterator &itr, const SelectAllObjectMT<DCC,OBJECT>* parent, + const_iterator(const Cont_iterator &itr, const SelectAllObjectMT<DCC,OBJECT>* parent, Object_const_iterator digitit, const DC* dc ) : - m_hash_itr(itr), + m_cont_itr(itr), m_Parent(parent), m_digit_it(digitit), m_dc(dc) @@ -94,7 +92,7 @@ SKIPNEXT: bool operator != ( const const_iterator it ) const { - if( it.m_hash_itr != m_hash_itr || it.m_digit_it != m_digit_it ) + if( it.m_cont_itr != m_cont_itr || it.m_digit_it != m_digit_it ) return true; return false; @@ -102,25 +100,25 @@ SKIPNEXT: bool operator == ( const const_iterator it ) const { - return( it.m_hash_itr == m_hash_itr && it.m_digit_it == m_digit_it ); + return( it.m_cont_itr == m_cont_itr && it.m_digit_it == m_digit_it ); } }; - SelectAllObjectMT(const DCC* dcc) : m_dcc(dcc), m_hashes(dcc->GetAllCurrentHashes()) + SelectAllObjectMT(const DCC* dcc) : m_dcc(dcc) { } SelectAllObjectMT( ) = delete; const_iterator begin() { - Hash_iterator b = m_hashes.cbegin(); + auto b = m_dcc->begin(); NEXT: const DC* dc = nullptr; Object_const_iterator digit_it; - if(b!= m_hashes.cend()) { - dc = m_dcc->indexFindPtr(*b); + if(b!= m_dcc->end()) { + dc = *b; digit_it = dc->begin(); if(digit_it == dc->end()){ ++b; @@ -131,7 +129,7 @@ NEXT: } const_iterator end() { - Hash_iterator b = m_hashes.cend(); + auto b = m_dcc->end(); const DC* dc = nullptr; Object_const_iterator digit_it; return const_iterator(b, this, digit_it, dc); @@ -149,7 +147,6 @@ NEXT: private: // pointer to the container it is processing. const DCC* m_dcc; - const typename DCC::Hash_Container m_hashes; }; diff --git a/Event/EventContainers/EventContainers/deleter.h b/Event/EventContainers/EventContainers/deleter.h new file mode 100644 index 0000000000000000000000000000000000000000..6d43c66ed5675ca48b3b47647967c1f54de52175 --- /dev/null +++ b/Event/EventContainers/EventContainers/deleter.h @@ -0,0 +1,37 @@ +#ifndef EVENTCONTAINERS_DELETER_H +//#define EVENTCONTAINERS_DELETER_H + +#if 0 + struct deleter + { + void operator() (const void* p); + }; +#endif + + + typedef void deleter_f (const void* p); + + class void_unique_ptr + : public std::unique_ptr<const void, deleter_f*> + { + public: + using std::unique_ptr<const void, deleter_f*>::unique_ptr; + + template <class T> + struct Deleter + { + static void deleter (const void* p) + { + delete reinterpret_cast<const T*>(p); + } + }; + + template <class T> + void_unique_ptr(std::unique_ptr<T> p) + : std::unique_ptr<const void, deleter_f*> (p.release(), + Deleter<T>::deleter) + { + } + }; + +#endif diff --git a/Event/EventContainers/EventContainers/selection.xml b/Event/EventContainers/EventContainers/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..25538ce056cc7813d5c3379db834151f9b214d96 --- /dev/null +++ b/Event/EventContainers/EventContainers/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + <class name="EventContainers::I_InternalIDC"/> + <class name="EventContainers::IdentifiableContainerBase"> + <field name="m_link" transient="true"/> + </class> +</lcgdict> diff --git a/Event/EventContainers/share/IDBenchTest.ref b/Event/EventContainers/share/IDBenchTest.ref new file mode 100644 index 0000000000000000000000000000000000000000..bc19b99b74ce5d72ff4af1e98d1612ddf722885a --- /dev/null +++ b/Event/EventContainers/share/IDBenchTest.ref @@ -0,0 +1 @@ +Test Successful diff --git a/Event/EventContainers/share/IDStressTest.ref b/Event/EventContainers/share/IDStressTest.ref index ddc13f633d90eb848294738d70a1f0376f632836..252a5f9afbab811adf5ee332c0e9ca3e2d1442be 100644 --- a/Event/EventContainers/share/IDStressTest.ref +++ b/Event/EventContainers/share/IDStressTest.ref @@ -14,10 +14,11 @@ range 450 to 1450 30/50 40/50 NoLock -deleted 163825 -countHit 256975 +deleted 144501 +countHit 276299 fills 500000 reads 492300 +itreads 492300 aborted 7700 0/50 10/50 @@ -29,8 +30,9 @@ deleted 0 countHit 427500 fills 500000 reads 492300 +itreads 492300 aborted 7700 Total elements 500000 MyDigits left undeleted 0 -no lock time 2.60611 -lock time 1.12183 +no lock time 3.7096 +lock time 0.983746 diff --git a/Event/EventContainers/src/IDC_WriteHandleBase.cxx b/Event/EventContainers/src/IDC_WriteHandleBase.cxx index f555cbc46696e59a66affc8873113796d4b825f6..83710778c12ca69bd6f54fd1090c9d8d3498a376 100644 --- a/Event/EventContainers/src/IDC_WriteHandleBase.cxx +++ b/Event/EventContainers/src/IDC_WriteHandleBase.cxx @@ -23,7 +23,6 @@ void IDC_WriteHandleBase::ReleaseLock(){ //Running code assert(m_atomic->load() != ABORTstate); - assert(m_mut->counter >= 0); lockguard lk(m_mut->mutex); m_atomic->compare_exchange_strong(waitstate, ABORTstate); m_mut->condition.notify_all(); diff --git a/Event/EventContainers/src/IdentifiableCacheBase.cxx b/Event/EventContainers/src/IdentifiableCacheBase.cxx index 3298c38115fc78103a2a0dd8f86a58bc66dfe95a..9d1f1130daceed768b83c600452fdaccb3f6a271 100644 --- a/Event/EventContainers/src/IdentifiableCacheBase.cxx +++ b/Event/EventContainers/src/IdentifiableCacheBase.cxx @@ -58,10 +58,6 @@ int IdentifiableCacheBase::tryLock(IdentifierHash hash, IDC_WriteHandleBase &loc if(ptr1 == INVALID){ //Second call while not finished -#ifndef NDEBUG - size_t slot = hash % m_NMutexes; - m_HoldingMutexes[slot].counter++; -#endif wait.emplace_back(hash); return 1; } @@ -84,12 +80,6 @@ void IdentifiableCacheBase::clear (deleter_f* deleter) }else{ for (size_t i=0; i<s ;i++) m_vec[i].store(nullptr, std::memory_order_relaxed);//Need to clear incase of aborts } -#ifndef NDEBUG - for(size_t i =0; i<m_NMutexes; i++){ - if(m_HoldingMutexes[i].counter!=0) std::cout << " counter is " << m_HoldingMutexes[i].counter << std::endl; - assert(m_HoldingMutexes[i].counter==0); - } -#endif } @@ -103,12 +93,6 @@ void IdentifiableCacheBase::cleanUp (deleter_f* deleter) if(p && p < ABORTED) deleter (p); } } -#ifndef NDEBUG - for(size_t i =0; i<m_NMutexes; i++){ - if(m_HoldingMutexes[i].counter!=0) std::cout << "IdentifiableCacheBase counter is " << m_HoldingMutexes[i].counter << std::endl; - assert(m_HoldingMutexes[i].counter==0); - } -#endif } int IdentifiableCacheBase::itemAborted (IdentifierHash hash){ @@ -146,13 +130,7 @@ const void* IdentifiableCacheBase::waitFor(IdentifierHash hash) } return item; } -#ifndef NDEBUG -void IdentifiableCacheBase::cancelWait(IdentifierHash hash){ - assert(m_NMutexes > 0); - size_t slot = hash % m_NMutexes; - m_HoldingMutexes[slot].counter--; -} -#endif + const void* IdentifiableCacheBase::findWait (IdentifierHash hash) { if (ATH_UNLIKELY(hash >= m_vec.size())) return nullptr; @@ -248,56 +226,56 @@ std::vector<IdentifierHash> IdentifiableCacheBase::ids() } -bool IdentifiableCacheBase::add (IdentifierHash hash, const void* p) noexcept +std::pair<bool, const void*> IdentifiableCacheBase::add (IdentifierHash hash, const void* p) noexcept { - if (ATH_UNLIKELY(hash >= m_vec.size())) return false; - if(p==nullptr) return false; + if (ATH_UNLIKELY(hash >= m_vec.size())) return std::make_pair(false, nullptr); + if(p==nullptr) return std::make_pair(false, nullptr); const void* nul=nullptr; if(m_vec[hash].compare_exchange_strong(nul, p)){ m_currentHashes++; - return true; + return std::make_pair(true, p); } const void* invalid = INVALID; if(m_vec[hash].compare_exchange_strong(invalid, p)){ m_currentHashes++; - return true; + return std::make_pair(true, p); } - return false; + return std::make_pair(false, invalid); } -bool IdentifiableCacheBase::addLock (IdentifierHash hash, const void* p) noexcept +std::pair<bool, const void*> IdentifiableCacheBase::addLock (IdentifierHash hash, const void* p) noexcept { //Same as method above except we check for invalid state first, // more optimal for calling using writehandle lock method assert(hash < m_vec.size()); - if(p==nullptr) return false; + if(p==nullptr) return std::make_pair(false, nullptr); const void* invalid = INVALID; if(m_vec[hash].compare_exchange_strong(invalid, p)){ m_currentHashes++; - return true; + return std::make_pair(true, p); } const void* nul=nullptr; if(m_vec[hash].compare_exchange_strong(nul, p)){ m_currentHashes++; - return true; + return std::make_pair(true, p); } - return false; + return std::make_pair(false, nul); } -bool IdentifiableCacheBase::addLock (IdentifierHash hash, +std::pair<bool, const void*> IdentifiableCacheBase::addLock (IdentifierHash hash, void_unique_ptr p) noexcept { - bool b = addLock(hash, p.get()); - if(b) p.release(); + std::pair<bool, const void*> b = addLock(hash, p.get()); + if(b.first) p.release(); return b; } -bool IdentifiableCacheBase::add (IdentifierHash hash, +std::pair<bool, const void*> IdentifiableCacheBase::add (IdentifierHash hash, void_unique_ptr p) noexcept { - bool b = add(hash, p.get()); - if(b) p.release(); + std::pair<bool, const void*> b = add(hash, p.get()); + if(b.first) p.release(); return b; } diff --git a/Event/EventContainers/src/IdentifiableContainerBase.cxx b/Event/EventContainers/src/IdentifiableContainerBase.cxx index da1eb7af93048f9f4447b0f5002d8ef87f848fbf..3c6fdcc09acb4f510c297fd022165761455de6c5 100644 --- a/Event/EventContainers/src/IdentifiableContainerBase.cxx +++ b/Event/EventContainers/src/IdentifiableContainerBase.cxx @@ -5,106 +5,34 @@ #include <algorithm> #include "EventContainers/IDC_WriteHandleBase.h" #include "CxxUtils/AthUnlikelyMacros.h" +#include "EventContainers/InternalOnline.h" +#include "EventContainers/InternalOffline.h" +#include "EventContainers/InternalOfflineFast.h" - IdentifiableContainerBase::IdentifiableContainerBase(EventContainers::IdentifiableCacheBase *cache, bool online) - { - m_cacheLink = cache; - m_OnlineMode = online; - m_mask.assign(cache->fullSize(), !online); - m_waitNeeded.store(false, std::memory_order_relaxed); - } - - IdentifiableContainerBase::Hash_Container::const_iterator IdentifiableContainerBase::findHash(IdentifiableContainerBase::Hash_Container* container, IdentifierHash hash){ - return std::find(container->begin(), container->end(), hash); - } - - IdentifiableContainerBase::~IdentifiableContainerBase(){ -#ifndef NDEBUG - //Deregister unused interest - while(!m_waitlist.empty()){ - IdentifierHash hash = m_waitlist.back(); - m_cacheLink->cancelWait(hash); - m_waitlist.pop_back(); - } -#endif - } - - void IdentifiableContainerBase::Wait() const{ - //lockguard to protect m_waitlist from multiple wait calls - typedef std::lock_guard<decltype(m_waitMutex)> lockguard; - lockguard lock(m_waitMutex); - - const void* ABORTstate = reinterpret_cast<const void*>(IdentifiableCacheBase::ABORTEDflag); - while(!m_waitlist.empty()){ - IdentifierHash hash = m_waitlist.back(); - const void* ptr = m_cacheLink->waitFor(hash); -#ifndef NDEBUG - m_cacheLink->cancelWait(hash); -#endif - if(ptr == ABORTstate) m_mask[hash] = false;//reset flag - m_waitlist.pop_back(); - - } - m_waitNeeded.store(false); - } +using namespace EventContainers; - bool IdentifiableContainerBase::tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) + IdentifiableContainerBase::IdentifiableContainerBase(EventContainers::IdentifiableCacheBase *cache) { - if(!m_OnlineMode){ - return tryAddFromCache(hashId);//No point calling expensive lock method - } - int flag = m_cacheLink->tryLock(hashId, lock, m_waitlist); - //Relaxed since this should not be running in threaded situation. - if(!m_waitlist.empty()) m_waitNeeded.store(true, std::memory_order_relaxed); - if(flag > 0) { - m_mask[hashId] = flag!=3; - return true; - } - return false; - } - - bool IdentifiableContainerBase::tryAddFromCache(IdentifierHash hashId) - { - auto ptr = m_cacheLink->find(hashId); - if(ptr==nullptr){ - return false; - } - m_mask[hashId] = true; - return true; + m_link = std::make_unique<EventContainers::InternalOnline>(cache); + m_OnlineMode = true; } - std::vector<IdentifierHash> IdentifiableContainerBase::GetAllCurrentHashes() const { - if(not m_OnlineMode) return m_cacheLink->ids(); - else{ - if(m_waitNeeded) Wait(); - std::vector<IdentifierHash> ids; - for(size_t i =0 ; i < m_mask.size(); ++i) if(m_mask[i]) ids.emplace_back(i); - return ids; - } + IdentifiableContainerBase::IdentifiableContainerBase(size_t max){ + m_OnlineMode = false; + m_link = std::make_unique<EventContainers::InternalOffline>(max); } - size_t IdentifiableContainerBase::numberOfCollections() const{ - if(!m_OnlineMode) return m_cacheLink->numberOfHashes(); - if(m_waitNeeded) Wait(); - size_t count =std::accumulate(m_mask.begin(), m_mask.end(), 0); - return count; - } - - void IdentifiableContainerBase::ResetMask(){ - m_mask.assign(m_cacheLink->fullSize(), false); - } - - StatusCode IdentifiableContainerBase::fetchOrCreate(IdentifierHash hashId){ - if(ATH_UNLIKELY(!m_cacheLink->IMakerPresent())) return StatusCode::FAILURE; - auto ptr = m_cacheLink->get(hashId); - m_mask[hashId] = ptr !=nullptr; - return StatusCode::SUCCESS; + IdentifiableContainerBase::IdentifiableContainerBase(size_t max, Mode mode){ + m_OnlineMode = false; + if(mode == Mode::OfflineLowMemory) m_link = std::make_unique<EventContainers::InternalOffline>(max); + else if(mode == Mode::OfflineFast) m_link = std::make_unique<EventContainers::InternalOfflineFast>(max); + else{ + throw std::runtime_error("Invalid Mode specified"); + } } - StatusCode IdentifiableContainerBase::fetchOrCreate(const std::vector<IdentifierHash> &hashIds){ - if(ATH_UNLIKELY(!m_cacheLink->IMakerPresent())) return StatusCode::FAILURE; - m_cacheLink->createSet(hashIds, m_mask); - return StatusCode::SUCCESS; + void IdentifiableContainerBase::cleanup(deleter_f* deleter){ + if(m_OnlineMode) throw std::runtime_error("Not implemented in online mode"); + m_link->cleanUp(deleter); } - diff --git a/Event/EventContainers/src/InternalOffline.cxx b/Event/EventContainers/src/InternalOffline.cxx new file mode 100644 index 0000000000000000000000000000000000000000..000b7629a7f90d8e393ecf1ab14d6558796e42dd --- /dev/null +++ b/Event/EventContainers/src/InternalOffline.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EventContainers/InternalOffline.h" +#include <algorithm> +#include "EventContainers/IDC_WriteHandleBase.h" + +using namespace EventContainers; +typedef I_InternalIDC::InternalConstItr InternalConstItr; +InternalOffline::InternalOffline(size_t max) : m_maximumSize(max) {} + + +bool InternalOffline::tryAddFromCache(IdentifierHash hash, EventContainers::IDC_WriteHandleBase&) { + return indexFind(hash) != m_map.cend();//No Cache in offline mode +} + +bool InternalOffline::tryAddFromCache(IdentifierHash hash) +{ + return indexFind(hash) != m_map.cend();//No Cache in offline mode +} + +void InternalOffline::wait() const { + //No need to wait in offline, deliberately empty method +} + +std::vector<IdentifierHash> InternalOffline::getAllCurrentHashes() const { + std::vector<IdentifierHash> ids; + ids.reserve(m_map.size()); + for(auto &x : m_map) { + ids.emplace_back(x.first); + } + return ids; +} + +InternalConstItr + InternalOffline::cend() const { + return m_map.cend(); +} + +const std::vector < I_InternalIDC::hashPair >& InternalOffline::getAllHashPtrPair() const{ return m_map; } + +InternalConstItr + InternalOffline::cbegin() const { + return m_map.cbegin(); +} + +InternalConstItr InternalOffline::indexFind( IdentifierHash hashId ) const{ + auto itr = std::lower_bound( m_map.cbegin(), m_map.cend(), hashId.value(), [](const hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } ); + if(itr!= m_map.cend() && itr->first==hashId) return itr; + return m_map.cend(); +// return std::find_if(m_map.begin(), m_map.end(), [hashId](const hashPair &lhs) -> bool { return lhs.first == hashId; }); +} + +size_t InternalOffline::numberOfCollections() const { + return m_map.size(); +} + +void InternalOffline::cleanUp(deleter_f* deleter) noexcept { + for(const auto& x : m_map) deleter(x.second); + m_map.clear(); +} + +bool InternalOffline::insert(IdentifierHash hashId, const void* ptr) { + if(m_map.empty() || m_map.back().first < hashId){ + m_map.emplace_back(hashId, ptr); + return true; + } + auto itr = std::lower_bound( m_map.begin(), m_map.end(), hashId.value(), [](const hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } ); + if(itr == std::end(m_map) || itr->first != hashId) + { + m_map.emplace(itr, hashId, ptr); + return true; + } + return false; +} + +const void* InternalOffline::findIndexPtr(IdentifierHash hashId) const noexcept{ + auto itr = indexFind(hashId); + if(itr != m_map.end()) return itr->second; + return nullptr; +} + +StatusCode InternalOffline::addLock(IdentifierHash hashId, const void* ptr) { + bool added = insert(hashId, ptr); + if(!added) { +#ifndef NDEBUG + std::cout << "IDC WARNING Deletion shouldn't occur in addLock paradigm" << std::endl; +#endif + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void* InternalOffline::removeCollection( IdentifierHash hashId ) { + auto itr = std::lower_bound( m_map.begin(), m_map.end(), hashId.value(), [](hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } ); + if(itr== m_map.end() || itr->first!=hashId) return nullptr; + void* ptr = const_cast< void* > (itr->second); + m_map.erase(itr); + return ptr; +} + +StatusCode InternalOffline::fetchOrCreate(IdentifierHash) { + throw std::runtime_error("Not implemented in offline mode"); +} +StatusCode InternalOffline::fetchOrCreate(const std::vector<IdentifierHash>&) +{ + throw std::runtime_error("Not implemented in offline mode"); +} + +void InternalOffline::destructor(deleter_f* deleter) noexcept { + for(const auto& x : m_map) deleter(x.second); +} diff --git a/Event/EventContainers/src/InternalOfflineFast.cxx b/Event/EventContainers/src/InternalOfflineFast.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3a799015a1db9bcd37499418c0ef409c6eeaf65 --- /dev/null +++ b/Event/EventContainers/src/InternalOfflineFast.cxx @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EventContainers/InternalOfflineFast.h" +#include <algorithm> +#include "EventContainers/IDC_WriteHandleBase.h" + +using namespace EventContainers; +typedef I_InternalIDC::InternalConstItr InternalConstItr; +InternalOfflineFast::InternalOfflineFast(size_t max) : m_fullMap(max, nullptr), m_needsupdate(false) {} + + +bool InternalOfflineFast::tryAddFromCache(IdentifierHash hash, EventContainers::IDC_WriteHandleBase&) { + return m_fullMap[hash] != nullptr; +} + +bool InternalOfflineFast::tryAddFromCache(IdentifierHash hash) +{ + return m_fullMap[hash] != nullptr; +} + +void InternalOfflineFast::wait() const { + std::lock_guard lock (m_waitMutex); + if(m_needsupdate == false) return; + m_map.clear(); + for(size_t i=0 ;i < m_fullMap.size(); ++i){ + if(m_fullMap[i]) m_map.emplace_back(i, m_fullMap[i]); + } + m_needsupdate.store(true); +} + +std::vector<IdentifierHash> InternalOfflineFast::getAllCurrentHashes() const { + if(m_needsupdate) wait(); + std::vector<IdentifierHash> ids; + ids.reserve(m_map.size()); + for(auto &x : m_map) { + ids.emplace_back(x.first); + } + return ids; +} + +InternalConstItr + InternalOfflineFast::cend() const { + if(m_needsupdate) wait(); + return m_map.cend(); +} + +const std::vector < I_InternalIDC::hashPair >& InternalOfflineFast::getAllHashPtrPair() const{ + if(m_needsupdate) wait(); + return m_map; +} + +InternalConstItr + InternalOfflineFast::cbegin() const { + if(m_needsupdate) wait(); + return m_map.cbegin(); +} + +InternalConstItr InternalOfflineFast::indexFind( IdentifierHash hashId ) const{ + if(m_needsupdate) wait(); + auto itr = std::lower_bound( m_map.cbegin(), m_map.cend(), hashId.value(), [](const hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } ); + if(itr!= m_map.cend() && itr->first==hashId) return itr; + return m_map.cend(); +} + +size_t InternalOfflineFast::numberOfCollections() const { + if(m_needsupdate) wait(); + return m_map.size(); +} + +void InternalOfflineFast::cleanUp(deleter_f* deleter) noexcept { + for(const auto& x : m_map) { deleter(x.second); m_fullMap[x.first] = nullptr; } + m_map.clear(); +} + +bool InternalOfflineFast::insert(IdentifierHash hashId, const void* ptr) { + if(hashId >= m_fullMap.size()) return false; + if(m_fullMap[hashId]!= nullptr) return false; //already in + m_fullMap[hashId] = ptr; + m_needsupdate.store(true, std::memory_order_relaxed); + return true; +} + +const void* InternalOfflineFast::findIndexPtr(IdentifierHash hashId) const noexcept{ + if(hashId >= m_fullMap.size()) return nullptr; + return m_fullMap[hashId]; +} + +StatusCode InternalOfflineFast::addLock(IdentifierHash hashId, const void* ptr) { + bool added = insert(hashId, ptr); + if(!added) { +#ifndef NDEBUG + std::cout << "IDC WARNING Deletion shouldn't occur in addLock paradigm" << std::endl; +#endif + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void* InternalOfflineFast::removeCollection( IdentifierHash hashId ) { + void* ptr = const_cast< void* > (m_fullMap[hashId]); + m_fullMap[hashId] = nullptr; + m_needsupdate.store(true, std::memory_order_relaxed); + return ptr; +} + +StatusCode InternalOfflineFast::fetchOrCreate(IdentifierHash) { + throw std::runtime_error("Not implemented in offline mode"); +} +StatusCode InternalOfflineFast::fetchOrCreate(const std::vector<IdentifierHash>&) +{ + throw std::runtime_error("Not implemented in offline mode"); +} + +void InternalOfflineFast::destructor(deleter_f* deleter) noexcept { + for(const auto& x : m_map) deleter(x.second); +} diff --git a/Event/EventContainers/src/InternalOnline.cxx b/Event/EventContainers/src/InternalOnline.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9c175b30c0d5bee499af8f69bbd416c57d14beec --- /dev/null +++ b/Event/EventContainers/src/InternalOnline.cxx @@ -0,0 +1,162 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EventContainers/InternalOnline.h" +#include <algorithm> +#include "EventContainers/IDC_WriteHandleBase.h" +#include "CxxUtils/AthUnlikelyMacros.h" +#include "EventContainers/IdentifiableCacheBase.h" + + +using namespace EventContainers; +typedef I_InternalIDC::InternalConstItr InternalConstItr; + + +InternalOnline::InternalOnline(EventContainers::IdentifiableCacheBase *cache) : m_cacheLink(cache), + m_mask(cache->fullSize(), false), m_waitNeeded(false) {} + +const std::vector < I_InternalIDC::hashPair >& InternalOnline::getAllHashPtrPair() const{ + if(m_waitNeeded) wait(); + return m_map; +} + + +InternalConstItr + InternalOnline::cend() const { + if(m_waitNeeded) wait(); + return m_map.cend(); +} + +InternalConstItr + InternalOnline::cbegin() const { + if(m_waitNeeded) wait(); + return m_map.cbegin(); +} + +InternalConstItr InternalOnline::indexFind( IdentifierHash hashId ) const{ + if(m_waitNeeded) wait(); + auto itr = std::lower_bound( m_map.begin(), m_map.end(), hashId.value(), [](hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } ); + if(itr!= m_map.end() && itr->first==hashId) return itr; + return m_map.end(); +} + +void InternalOnline::wait() const { + //lockguard to protect m_waitlist from multiple wait calls + std::lock_guard lock (m_waitMutex); + if(m_waitNeeded == false) return; + using namespace EventContainers; + const void* ABORTstate = reinterpret_cast<const void*>(IdentifiableCacheBase::ABORTEDflag); + while(!m_waitlist.empty()) { + IdentifierHash hash = m_waitlist.back(); + const void* ptr = m_cacheLink->waitFor(hash); + if(ptr == ABORTstate) { + m_mask[hash] = false; + } + m_waitlist.pop_back(); + } + m_map.clear(); + for(size_t i =0;i<m_mask.size();i++){ + if(m_mask[i]) m_map.emplace_back(i, m_cacheLink->m_vec[i].load()); + } + m_waitNeeded.store(false); +} + +bool InternalOnline::tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) { + int flag = m_cacheLink->tryLock(hashId, lock, m_waitlist); + //Relaxed since this should not be running in threaded situation. + if(!m_waitlist.empty()) m_waitNeeded.store(true, std::memory_order_relaxed); + if(flag > 0) { + if(flag!=3){ + m_mask[hashId] = true; + m_waitNeeded.store(true, std::memory_order_relaxed); + } + return true; + } + return false; +} + +bool InternalOnline::tryAddFromCache(IdentifierHash hashId) +{ + auto ptr = m_cacheLink->find(hashId); + if(ptr==nullptr) { + return false; + } + m_mask[hashId] = true; + m_waitNeeded.store(true, std::memory_order_relaxed); + return true; +} + +std::vector<IdentifierHash> InternalOnline::getAllCurrentHashes() const { + if(m_waitNeeded) wait(); + std::vector<IdentifierHash> ids; + ids.reserve(m_map.size()); + for(auto &x : m_map) { + ids.emplace_back(x.first); + } + return ids; +} + +size_t InternalOnline::numberOfCollections() const { + if(m_waitNeeded) wait(); + return m_map.size(); +} + +void InternalOnline::resetMask() { + if(m_waitNeeded) wait(); + m_mask.assign(m_cacheLink->fullSize(), false); + m_map.clear(); + m_waitNeeded.store(true, std::memory_order_relaxed); +} + +StatusCode InternalOnline::fetchOrCreate(IdentifierHash hashId) { + if(ATH_UNLIKELY(!m_cacheLink->IMakerPresent())) return StatusCode::FAILURE; + auto ptr = m_cacheLink->get(hashId); + if(ptr) { m_mask[hashId] =true; m_waitNeeded.store(true, std::memory_order_relaxed); } + return StatusCode::SUCCESS; +} + +StatusCode InternalOnline::fetchOrCreate(const std::vector<IdentifierHash> &/*hashIds*/) { + throw std::runtime_error("Not implemented"); +// if(ATH_UNLIKELY(!m_cacheLink->IMakerPresent())) return StatusCode::FAILURE; +// m_cacheLink->createSet(hashIds, m_mask); +// return StatusCode::SUCCESS; +} + + +bool InternalOnline::insert(IdentifierHash hashId, const void* ptr) { + std::pair<bool, const void*> cacheinserted = m_cacheLink->add(hashId, ptr); + m_mask[hashId] = true; //it wasn't added it is already present therefore mask could be true + m_waitNeeded.store(true, std::memory_order_relaxed); + return ptr == cacheinserted.second; +} + +const void* InternalOnline::findIndexPtr(IdentifierHash hashId) const noexcept { + if(hashId < m_mask.size() and m_mask[hashId]) return m_cacheLink->findWait(hashId); + return nullptr; +} + +StatusCode InternalOnline::addLock(IdentifierHash hashId, const void* ptr) { + if(ATH_UNLIKELY(hashId >= m_mask.size())) return StatusCode::FAILURE; + [[maybe_unused]] std::pair<bool, const void*> added = m_cacheLink->addLock(hashId, ptr); +#ifndef NDEBUG + if(!added.first) { + std::cout << "IDC WARNING Deletion shouldn't occur in addLock paradigm" << std::endl; + } +#endif + m_mask[hashId] = true; //it wasn't added it is already present therefore mask could be true + m_waitNeeded.store(true, std::memory_order_relaxed); + return StatusCode::SUCCESS; +} + +void* InternalOnline::removeCollection( IdentifierHash ) { + throw std::runtime_error("Do not remove things from an online IDC"); +} + +void InternalOnline::destructor(deleter_f*) noexcept { + //deliberately empty +} + +void InternalOnline::cleanUp(deleter_f*) noexcept { + resetMask(); +} diff --git a/Event/EventContainers/test/IDC_Benchmark.cxx b/Event/EventContainers/test/IDC_Benchmark.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6e7b9bfddfe43d1ea168e9398288d63c969ee498 --- /dev/null +++ b/Event/EventContainers/test/IDC_Benchmark.cxx @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#include "EventContainers/IdentifiableContainerMT.h" +#include "EventContainers/IdentifiableCache.h" +#include <chrono> + +using namespace EventContainers; + + +template<typename T> +void timedelete(std::string name, T* ptr){ + auto start1 = std::chrono::steady_clock::now(); + delete ptr; + auto end1 = std::chrono::steady_clock::now(); + std::chrono::duration<double> time = end1-start1; + std::cout << name << " delete time " << time.count() << std::endl; +} + +void timebackwardsfill(std::string name, IdentifiableContainerMT<long unsigned int> *ptr){ + auto start1 = std::chrono::steady_clock::now(); + for(size_t i =50000-2;i>=3;i-=3){ + ptr->addCollection(new long unsigned int(i) ,i).ignore(); + } + auto end1 = std::chrono::steady_clock::now(); + std::chrono::duration<double> time = end1-start1; + std::cout << name << " backwardsfill time " << time.count() << std::endl; +} + + +void accessTime(std::string name, IdentifiableContainerMT<long unsigned int>& container){ + + auto start3 = std::chrono::steady_clock::now(); + auto offlinecnt = container.GetAllCurrentHashes(); + for(auto hash : offlinecnt) if(hash != *container.indexFindPtr(hash) ) std::abort(); + auto end3 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinerandom = end3-start3; + std::cout << name << " random time " << offlinerandom.count() << std::endl; + + auto start4 = std::chrono::steady_clock::now(); + size_t i=0; + for(auto hash : container) {if(*hash != offlinecnt[i].value() ) std::abort(); i++; } + auto end4 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlineit = end4-start4; + std::cout << name << " iteration time " << offlineit.count() << std::endl; + + auto start5 = std::chrono::steady_clock::now(); + const auto& directaccess = container.GetAllHashPtrPair(); + for(const auto &[hashId, ptr] : directaccess) {if(hashId != *ptr ) std::abort(); i++; } + auto end5 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinedir = end5-start5; + std::cout << name << " direct time " << offlinedir.count() << std::endl; +} + +int main(){ + + auto start1 = std::chrono::steady_clock::now(); + auto offline = new IdentifiableContainerMT<long unsigned int>(50000); + for(size_t i =3;i<50000;i+=3){ + offline->addCollection(new long unsigned int(i) ,i).ignore(); + } + auto end1 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinefill = end1-start1; + std::cout << "offline fill time " << offlinefill.count() << std::endl; + auto start2 = std::chrono::steady_clock::now(); + auto cache = new IdentifiableCache<long unsigned int>(50000, nullptr); + auto online = new IdentifiableContainerMT<long unsigned int>(cache); + + for(size_t i =3;i<50000;i+=3){ + online->addCollection(new long unsigned int(i) , i).ignore(); + } + auto end2 = std::chrono::steady_clock::now(); + std::chrono::duration<double> onlinefill = end2-start2; + std::cout << "online fill time " << onlinefill.count() << std::endl; + + auto start3 = std::chrono::steady_clock::now(); + auto offlinefast = new IdentifiableContainerMT<long unsigned int>(50000, EventContainers::Mode::OfflineFast); + for(size_t i =3;i<50000;i+=3){ + offlinefast->addCollection(new long unsigned int(i) ,i).ignore(); + } + auto end3 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinefillfast = end3-start3; + std::cout << "offlinefast fill time " << offlinefillfast.count() << std::endl; + accessTime("online ", *online); + accessTime("offline ", *offline); + accessTime("offlinefast ", *offlinefast); + timedelete("onlineCont ", online); + timedelete("onlineCache ", cache); + timedelete("offline ", offline); + timedelete("offlinefast ", offlinefast); + + auto offlinefast2 = new IdentifiableContainerMT<long unsigned int>(50000, EventContainers::Mode::OfflineFast); + auto cache2 = new IdentifiableCache<long unsigned int>(50000, nullptr); + auto online2 = new IdentifiableContainerMT<long unsigned int>(cache2); + auto offline2 = new IdentifiableContainerMT<long unsigned int>(50000); + timebackwardsfill("offlinefast", offlinefast2); + timebackwardsfill("offline", offline2); + timebackwardsfill("online", online2); + delete offline2; + delete online2; + delete cache2; + delete offlinefast2; + std::cout << "Test Successful" << std::endl; + return 0; +} diff --git a/Event/EventContainers/test/IDC_Realistic_Test.cxx b/Event/EventContainers/test/IDC_Realistic_Test.cxx index f84599a82e88182eff650311d198599721def317..37497319ac0e75a5d8ea76ccc167358551da8334 100644 --- a/Event/EventContainers/test/IDC_Realistic_Test.cxx +++ b/Event/EventContainers/test/IDC_Realistic_Test.cxx @@ -134,12 +134,14 @@ struct counters { int cachehit=0; int fills =0; int reads =0; + int itreads =0; int aborted =0; void Add(const counters &rh) { deletedcount+= rh.deletedcount; cachehit+= rh.cachehit; fills+= rh.fills; reads+= rh.reads; + itreads+= rh.itreads; aborted += rh.aborted; } void Print() const { @@ -147,6 +149,7 @@ struct counters { std::cout << "countHit " << cachehit << '\n'; std::cout << "fills " << fills << '\n'; std::cout << "reads " << reads << '\n'; + std::cout << "itreads " << itreads << '\n'; std::cout << "aborted " << aborted << '\n'; } counters() { @@ -154,6 +157,7 @@ struct counters { cachehit=0; fills =0; reads =0; + itreads=0; aborted=0; } }; @@ -176,10 +180,16 @@ public: int wrong = 0; auto hashes = container.GetAllCurrentHashes(); + auto countall = container.numberOfCollections(); + if(hashes.size() != countall){ + std::cout << "Counts don't match" << std::endl; + std::abort(); + } if(hashes.size()!=(size_t) 1000-c.aborted) { std::cout << "Error container is " << hashes.size() << " not " << 1000-c.aborted << std::endl; std::abort(); } + //Check random access method for(const auto x : hashes) { auto p = container.indexFindPtr(x); int j =0; @@ -192,6 +202,36 @@ public: } c.reads++; } + //check iterator method + int orig=0; + for(auto p : container){ + int j =0; + for(auto q : *p) { + if(q->val() != (initialdata[hashes[orig]]->at(j++))->val()) wrong++; + } + if(j!=ndigits) { + std::cout << "n digits wrong"<<std::endl; + std::abort(); + } + c.itreads++; + orig++; + } + int orig2=0; + const auto& directaccess = container.GetAllHashPtrPair(); + for(const auto &[hashId, ptr] : directaccess){ + int j =0; + if(hashes[orig2] != hashId){ + std::cout << "directaccess broke " << std::endl; + std::abort(); + } + for(auto q : *ptr) { + if(q->val() != (initialdata[hashes[orig2]]->at(j++))->val()) { + std::cout << "directaccess broke " << std::endl; + std::abort(); + } + } + orig2++; + } if(wrong > 0) { std::cout << "Thread " << threads << " found wrong data " << wrong << std::endl; std::abort(); @@ -361,7 +401,7 @@ int main() { } std::cout << "NoLock\n"; c.Print(); - if(c.fills!=c.reads+c.aborted) { + if(c.fills!=c.reads+c.aborted || c.fills!=c.itreads+c.aborted ) { std::cout << "Fills do not equal reads " << std::endl; std::abort(); } @@ -378,7 +418,7 @@ int main() { } std::cout << "Lock\n"; c.Print(); - if(c.fills!=c.reads+c.aborted) { + if(c.fills!=c.reads+c.aborted || c.fills!=c.itreads+c.aborted ) { std::cout << "Fills do not equal reads " << std::endl; std::abort(); } diff --git a/Event/EventContainers/test/IDMT_ContainerTest.cxx b/Event/EventContainers/test/IDMT_ContainerTest.cxx index df8ec1d3517f27da8976c36a92bfce15c0ca0aa8..17207fdb4df387ff2952061a69d60e0020a4215e 100644 --- a/Event/EventContainers/test/IDMT_ContainerTest.cxx +++ b/Event/EventContainers/test/IDMT_ContainerTest.cxx @@ -5,7 +5,7 @@ // This is a test cxx file for IdentifiableContainerMT. // #include "EventContainers/IdentifiableContainerMT.h" -#include "EventContainers/SelectAllObjectMT.h" +#include "EventContainers/SelectAllObject.h" #include "EventContainers/IdentifiableContTemp.h" #include "ID_ContainerTest.h" #include "GaudiKernel/System.h" @@ -154,7 +154,7 @@ return 0;} int ID_ContainerTest::execute(){ - typedef SelectAllObjectMT<MyCollectionContainer,MyDigit> SELECTOR ; + typedef SelectAllObject<MyCollectionContainer,MyDigit> SELECTOR ; typedef SELECTOR::const_iterator digit_const_iterator; // typedef MyCollectionContainer::const_iterator collection_iterator; @@ -604,14 +604,49 @@ int ID_ContainerTest::execute(){ } { MyCollectionContainer::IDC_WriteHandle lock; - lock = containerOnline->getWriteHandle(IdentifierHash(50)); - lock = containerOnline->getWriteHandle(IdentifierHash(50));//Try to break the locks - lock = containerOnline->getWriteHandle(IdentifierHash(60)); - lock = containerOnline->getWriteHandle(IdentifierHash(70)); + MyCollectionContainer::IDC_WriteHandle lock2 = containerOnline->getWriteHandle(IdentifierHash(50)); + MyCollectionContainer::IDC_WriteHandle::Swap(lock, lock2); + //lock = containerOnline->getWriteHandle(IdentifierHash(50));//Try to break the locks + //lock = containerOnline->getWriteHandle(IdentifierHash(60)); + //lock = containerOnline->getWriteHandle(IdentifierHash(70)); } delete containerOnline; delete cache; + + + auto containerordertest = new MyCollectionContainer(500); + containerordertest->addCollection(nullptr, 4).ignore(); + containerordertest->addCollection(nullptr, 3).ignore(); + containerordertest->addCollection(nullptr, 2).ignore(); + containerordertest->addCollection(nullptr, 1).ignore(); + containerordertest->addCollection(nullptr, 5).ignore(); + containerordertest->addCollection(nullptr, 4).ignore(); //Deliberate duplicate + containerordertest->addCollection(nullptr, 7).ignore(); + + auto hashes = containerordertest->GetAllCurrentHashes(); + size_t last =0; + for(auto i : hashes){ + if(last >= i) { + std::cout << "Ordering error" <<std::endl; + std::abort(); + } + last =i; + } + last =0; + for(auto [hash,ptr] : containerordertest->GetAllHashPtrPair() ){ + if(last >= hash) { + std::cout << "Ordering error" <<std::endl; + std::abort(); + } + last =hash; + } + if(containerordertest->numberOfCollections() != 6){ + std::cout << "Duplicate got added " << std::endl; + std::abort(); + } + + delete containerordertest; std::cout << "MyDigits left undeleted " << MyDigit::s_total << std::endl; } return 0; diff --git a/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.cxx b/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.cxx index 4c7b493ac812bf6e966afc3edde00af9039d7a0a..fa189a5539cde56418304f273bea6f517227f614 100644 --- a/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.cxx +++ b/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.cxx @@ -310,7 +310,7 @@ StatusCode ByteStreamMultipleOutputStreamCopyTool::connectOutput(const std::stri return StatusCode::SUCCESS; } //__________________________________________________________________________ -StatusCode ByteStreamMultipleOutputStreamCopyTool::commitOutput() { +StatusCode ByteStreamMultipleOutputStreamCopyTool::commitOutput(bool/* doCommit*/) { ATH_MSG_DEBUG( "In commitOutput" ); const RawEvent* re_c = m_inputSvc->currentEvent() ; if(!re_c){ diff --git a/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.h b/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.h index b417768974fc95421eafc878a594bdf10415c08f..e5485fe7f23609288986e42eca27c251fa155b23 100644 --- a/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.h +++ b/Event/EventOverlay/OverlayByteStreamAlgs/src/ByteStreamMultipleOutputStreamCopyTool.h @@ -66,7 +66,7 @@ public: /// Commit the output stream after having streamed out objects /// Must commitOutput AFTER streaming - virtual StatusCode commitOutput() ; + virtual StatusCode commitOutput(bool doCommit = false) ; /// Finalize the output stream after the last commit, e.g. in /// finalize diff --git a/Event/PyDumper/python/Dumpers.py b/Event/PyDumper/python/Dumpers.py index a20efaacfda0e939973c386a1580937eca430f10..f509e614f295c1bb5b8fe5e45df7fd3bc7f6ffb6 100644 --- a/Event/PyDumper/python/Dumpers.py +++ b/Event/PyDumper/python/Dumpers.py @@ -4100,7 +4100,7 @@ def dump_SCT_RDORawData (p, f): def dump_IDC (payload_dumper, p, f): beg = p.begin() end = p.end() - nextfunc = beg.__next__ if hasattr (beg, '__next__') else beg.next + nextfunc = beg.__next__ if hasattr (beg.__class__, '__next__') else beg.next while beg != end: coll = beg.cptr() fprint (f, 'IDC', beg.hashId().value(), coll.identifyHash().value(), coll.size()) @@ -4265,7 +4265,7 @@ def dump_TileDigitsContainer (p, f): fwrite (f, '\n') beg = p.begin() end = p.end() - nextfunc = beg.__next__ if hasattr (beg, '__next__') else beg.next + nextfunc = beg.__next__ if hasattr (beg.__class__, '__next__') else beg.next while beg != end: coll = beg.cptr() fprint (f, 'TDC', diff --git a/Event/xAOD/xAODAssociations/xAODAssociations/xAODAssociationsDict.h b/Event/xAOD/xAODAssociations/xAODAssociations/xAODAssociationsDict.h index 6350678bb1806a758f3ff3b3411619389d05a644..caa256a45e20649b0103ae2c3b078b5af989f1a1 100644 --- a/Event/xAOD/xAODAssociations/xAODAssociations/xAODAssociationsDict.h +++ b/Event/xAOD/xAODAssociations/xAODAssociations/xAODAssociationsDict.h @@ -16,4 +16,16 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODASSOCIATIONS { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + TrackParticleClusterAssociationContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloClusterContainer ); + }; +} + #endif // XAODASSOCIATIONS_XAODASSOCIATIONSDICT_H diff --git a/Event/xAOD/xAODBTagging/CMakeLists.txt b/Event/xAOD/xAODBTagging/CMakeLists.txt index 4e166259db4799962bf4d5ba73784c51462a906f..9cf5cafbfac512d40ee18d4ff9f4dbdb25d50808 100644 --- a/Event/xAOD/xAODBTagging/CMakeLists.txt +++ b/Event/xAOD/xAODBTagging/CMakeLists.txt @@ -1,29 +1,25 @@ -# $Id: CMakeLists.txt 744481 2016-05-03 13:36:43Z krasznaa $ -################################################################################ -# Package: xAODBTagging -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODBTagging ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODTracking - Control/AthLinks - Control/CxxUtils) +# Pull in the helper CMake code. +find_package( xAODUtilities ) # Component(s) in the package: atlas_add_library( xAODBTagging xAODBTagging/*.h xAODBTagging/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODBTagging - LINK_LIBRARIES AthContainers AthLinks xAODBase xAODCore xAODTracking CxxUtils) + LINK_LIBRARIES AthContainers AthLinks xAODBase xAODCore xAODTracking + CxxUtils ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODBTagging/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::BTaggingContainer_v1" "xAOD::BTagVertexContainer_v1" ) atlas_add_dictionary( xAODBTaggingDict xAODBTagging/xAODBTaggingDict.h - xAODBTagging/selection.xml - LINK_LIBRARIES xAODBTagging + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODBTagging EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODBTagging/xAODBTagging/selection.xml b/Event/xAOD/xAODBTagging/xAODBTagging/selection.xml index 613f87c7c51b222bb365b5182642220485056040..5130d025d0ebda309bd62929b609bbabd0392268 100644 --- a/Event/xAOD/xAODBTagging/xAODBTagging/selection.xml +++ b/Event/xAOD/xAODBTagging/xAODBTagging/selection.xml @@ -1,54 +1,34 @@ -<!-- $Id: selection.xml 688348 2015-08-10 09:03:52Z kleney $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- BTagging_v1 dictionaries: --> - <class name="xAOD::BTagging_v1" /> - <class name="xAOD::BTaggingContainer_v1" - id="5D19F171-E07E-4F65-BC1F-FC4F4099E9F1" /> - <class name="xAOD::BTaggingAuxContainer_v1" - id="5E1973D2-D860-4BB1-B8EF-C9AD8E6C66A2" /> - <class name="xAOD::BTaggingTrigAuxContainer_v1" - id="1B738105-2F3E-4DCB-9DAE-DA3A4964486E" /> - - <!-- Smart pointers to BTagging_v1 objects: --> - <class name="DataLink<xAOD::BTaggingContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::BTaggingContainer_v1> >" /> - - <class name="ElementLink<xAOD::BTaggingContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::BTaggingContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::BTaggingContainer_v1> > >" /> - - <!-- BTagVertex_v1 dictionaries: --> - <class name="xAOD::BTagVertex_v1" /> - <class name="xAOD::BTagVertexContainer_v1" - id="E225A9EC-9782-43F7-B7BF-1B215187C11C" /> - <class name="xAOD::BTagVertexAuxContainer_v1" - id="09CD44BA-0F40-4FDB-BB30-2F4226FF3E18" /> - - <!-- Smart pointers to BTagVertex_v1 objects: --> - <class name="DataLink<xAOD::BTagVertexContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::BTagVertexContainer_v1> >" /> - - <class name="ElementLink<xAOD::BTagVertexContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::BTagVertexContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::BTagVertexContainer_v1> > >" /> - - - <class name="std::vector< std::vector< bool > >" /> - <class name="std::vector< std::vector< int > >" /> - - <!--Add Helper Functions --> - <function pattern="xAOD::SecVtxHelper::*" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class pattern="xAOD::TrackParticle*" /> - <class pattern="DataVector<xAOD::TrackParticle*" /> - <class pattern="ElementLink<DataVector<xAOD::TrackParticle*" /> - <class name="DataVector<xAOD::IParticle>" /> - </exclusion> + <!-- xAOD::BTagging interface type(s). --> + <class name="xAOD::BTagging_v1" /> + <class name="xAOD::BTaggingContainer_v1" + id="5D19F171-E07E-4F65-BC1F-FC4F4099E9F1" /> + <typedef name="xAOD::BTagging" /> + <typedef name="xAOD::BTaggingContainer" /> + + <!-- xAOD::BTagging auxiliary type(s). --> + <class name="xAOD::BTaggingAuxContainer_v1" + id="5E1973D2-D860-4BB1-B8EF-C9AD8E6C66A2" /> + <class name="xAOD::BTaggingTrigAuxContainer_v1" + id="1B738105-2F3E-4DCB-9DAE-DA3A4964486E" /> + <typedef name="xAOD::BTaggingAuxContainer" /> + <typedef name="xAOD::BTaggingTrigAuxContainer" /> + + <!-- xAOD::BTagVertex interface type(s). --> + <class name="xAOD::BTagVertex_v1" /> + <class name="xAOD::BTagVertexContainer_v1" + id="E225A9EC-9782-43F7-B7BF-1B215187C11C" /> + <typedef name="xAOD::BTagVertex" /> + <typedef name="xAOD::BTagVertexContainer" /> + + <!-- xAOD::BTagVertex auxiliary type(s). --> + <class name="xAOD::BTagVertexAuxContainer_v1" + id="09CD44BA-0F40-4FDB-BB30-2F4226FF3E18" /> + <typedef name="xAOD::BTagVertexAuxContainer" /> + + <!-- Additional helper functions. --> + <function pattern="xAOD::SecVtxHelper::*" /> </lcgdict> diff --git a/Event/xAOD/xAODBTagging/xAODBTagging/xAODBTaggingDict.h b/Event/xAOD/xAODBTagging/xAODBTagging/xAODBTaggingDict.h index c165c4d1c6bb618c8a3a6b940dadd15ab0b9eab1..4a36d87343514712ca8256a17783bc71c3033845 100644 --- a/Event/xAOD/xAODBTagging/xAODBTagging/xAODBTaggingDict.h +++ b/Event/xAOD/xAODBTagging/xAODBTagging/xAODBTaggingDict.h @@ -1,60 +1,40 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODBTaggingDict.h 688348 2015-08-10 09:03:52Z kleney $ #ifndef XAODBTAGGING_XAODBTAGGINGDICT_H #define XAODBTAGGING_XAODBTAGGINGDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// System include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODBTagging/BTagging.h" #include "xAODBTagging/BTaggingContainer.h" #include "xAODBTagging/BTaggingAuxContainer.h" #include "xAODBTagging/BTaggingTrigAuxContainer.h" -#include "xAODBTagging/BTagVertexContainer.h" -#include "xAODBTagging/BTagVertexAuxContainer.h" -// #include "xAODBTagging/versions/BTaggingContainer_v1.h" -// #include "xAODBTagging/versions/BTaggingAuxContainer_v1.h" -// #include "xAODBTagging/versions/BTaggingTrigAuxContainer_v1.h" -// #include "xAODBTagging/versions/BTagVertexContainer_v1.h" -// #include "xAODBTagging/versions/BTagVertexAuxContainer_v1.h" - -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODBTAGGING { - xAOD::BTaggingContainer_v1 c1; - DataLink< xAOD::BTaggingContainer_v1 > dl1; - std::vector< DataLink< xAOD::BTaggingContainer_v1 > > dl2; - ElementLink< xAOD::BTaggingContainer_v1 > el1; - std::vector< ElementLink< xAOD::BTaggingContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::BTaggingContainer_v1 > > > el3; +#include "xAODBTagging/versions/BTagging_v1.h" +#include "xAODBTagging/versions/BTaggingContainer_v1.h" +#include "xAODBTagging/versions/BTaggingAuxContainer_v1.h" +#include "xAODBTagging/versions/BTaggingTrigAuxContainer_v1.h" +#include "xAODBTagging/BTagVertex.h" +#include "xAODBTagging/BTagVertexContainer.h" +#include "xAODBTagging/BTagVertexAuxContainer.h" +#include "xAODBTagging/versions/BTagVertex_v1.h" +#include "xAODBTagging/versions/BTagVertexContainer_v1.h" +#include "xAODBTagging/versions/BTagVertexAuxContainer_v1.h" - std::vector< std::vector< bool > > atmp; - std::vector< std::vector< int > > anothertmp; +#include "xAODBTagging/SecVtxHelper.h" - - xAOD::BTagVertexContainer_v1 cx1; - DataLink< xAOD::BTagVertexContainer_v1 > dlx1; - std::vector< DataLink< xAOD::BTagVertexContainer_v1 > > dlx2; - ElementLink< xAOD::BTagVertexContainer_v1 > elx1; - std::vector< ElementLink< xAOD::BTagVertexContainer_v1 > > elx2; - std::vector< std::vector< ElementLink< xAOD::BTagVertexContainer_v1 > > > elx3; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - ElementLink< xAOD::TrackParticleContainer > auxlink1; - std::vector<ElementLink< xAOD::TrackParticleContainer > > auxlink2; +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODBTAGGING { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, BTaggingContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, BTagVertexContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); }; } diff --git a/Event/xAOD/xAODBTaggingCnv/CMakeLists.txt b/Event/xAOD/xAODBTaggingCnv/CMakeLists.txt index d09bdb5241c53c23895ec72b07131a9402842ff0..0b0a965c15201f0723f6ab56ffa17fcd8a784c68 100644 --- a/Event/xAOD/xAODBTaggingCnv/CMakeLists.txt +++ b/Event/xAOD/xAODBTaggingCnv/CMakeLists.txt @@ -14,12 +14,16 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel Trigger/TrigEvent/TrigParticle ) +atlas_add_library( xAODBTaggingCnvLib + xAODBTaggingCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODBTaggingCnv + LINK_LIBRARIES GaudiKernel xAODBTagging ) + + # Component(s) in the package: atlas_add_component( xAODBTaggingCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODBTagging AthenaBaseComps AthenaKernel GaudiKernel TrigParticle ) - -# Install files from the package: -atlas_install_headers( xAODBTaggingCnv ) + LINK_LIBRARIES xAODBTaggingCnvLib xAODBTagging AthenaBaseComps AthenaKernel GaudiKernel TrigParticle ) diff --git a/Event/xAOD/xAODBase/CMakeLists.txt b/Event/xAOD/xAODBase/CMakeLists.txt index 60db4aa1e07c0d97966edf07542b1997e650a8e7..97c640fda79fad99ba7e6784d4c0f636712cfc9c 100644 --- a/Event/xAOD/xAODBase/CMakeLists.txt +++ b/Event/xAOD/xAODBase/CMakeLists.txt @@ -1,29 +1,19 @@ -# $Id: CMakeLists.txt 744422 2016-05-03 11:34:39Z krasznaa $ -################################################################################ -# Package: xAODBase -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODBase ) -# Extra dependencies based on what environment we are in: +# Extra dependencies based on what environment we are in. +set( extra_libs ) if( NOT XAOD_STANDALONE ) - set( extra_deps Control/AthenaKernel ) set( extra_libs AthenaKernel ) endif() -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - ${extra_deps} - PRIVATE - Control/AthLinks ) - -# External dependencies: +# External dependencies. find_package( ROOT COMPONENTS Core Physics ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODBase xAODBase/*.h Root/*.cxx PUBLIC_HEADERS xAODBase @@ -31,21 +21,27 @@ atlas_add_library( xAODBase LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers ${extra_libs} PRIVATE_LINK_LIBRARIES AthLinks ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODBase/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::IParticleContainer" ) + atlas_add_dictionary( xAODBaseDict xAODBase/xAODBaseDict.h - xAODBase/selection.xml - LINK_LIBRARIES xAODBase ) + ${_selectionFile} + LINK_LIBRARIES AthContainers AthLinks xAODBase ) atlas_add_dictionary( xAODBaseObjectTypeDict xAODBase/xAODBaseObjectTypeDict.h - xAODBase/selection-ObjectType.xml) + xAODBase/selection-ObjectType.xml ) +# Install files from the package. atlas_install_python_modules( python/*.py ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( ut_xAODObjectType_test SOURCES test/ut_xAODObjectType_test.cxx LINK_LIBRARIES xAODBase ) atlas_add_test( ut_xAODObjectType_pytest - SCRIPT test/ut_xAODObjectType_pytest.py) + SCRIPT test/ut_xAODObjectType_pytest.py ) diff --git a/Event/xAOD/xAODBase/xAODBase/ObjectType.h b/Event/xAOD/xAODBase/xAODBase/ObjectType.h index 6bf91465a64980fba9f127402e516ee5f22947e0..de3a8ba8372bae910ec2620bc4153d03dfc957d7 100644 --- a/Event/xAOD/xAODBase/xAODBase/ObjectType.h +++ b/Event/xAOD/xAODBase/xAODBase/ObjectType.h @@ -49,6 +49,7 @@ enum ObjectType { Tau = 9, ///< The object is a tau (jet) TrackCaloCluster = 10, ///< The object is a track-calo-cluster + FlowElement = 11, ///< The object is a track-calo-cluster // } diff --git a/Event/xAOD/xAODBase/xAODBase/selection.xml b/Event/xAOD/xAODBase/xAODBase/selection.xml index 89f4f352ab142c612210b546f0003c83d76fbb1a..e6cc6e4c323132d8a701069bfb91189933c463ed 100644 --- a/Event/xAOD/xAODBase/xAODBase/selection.xml +++ b/Event/xAOD/xAODBase/xAODBase/selection.xml @@ -1,4 +1,4 @@ -<!-- $Id: selection.xml 618909 2014-09-29 10:16:52Z krasznaa $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <!-- All the dictionaries for xAOD::IParticle: --> @@ -6,22 +6,7 @@ <class name="xAOD::IParticleContainer" /> <class name="std::vector<xAOD::IParticle*>" /> - <!-- All smart pointer dictionaries for xAOD::IParticle --> - <class name="DataLink<xAOD::IParticleContainer>" /> - <class name="std::vector<DataLink<xAOD::IParticleContainer> >" /> - - <class name="ElementLink<xAOD::IParticleContainer>" /> - <class name="std::vector<ElementLink<xAOD::IParticleContainer> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::IParticleContainer> > >" /> - <!-- The helper functions: --> <function pattern="xAOD::*" /> - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - </exclusion> - </lcgdict> diff --git a/Event/xAOD/xAODBase/xAODBase/xAODBaseDict.h b/Event/xAOD/xAODBase/xAODBase/xAODBaseDict.h index 62bf3ed6647e63f1bf5cd1adf5e19f1a0ff9e53a..fe51d07835b9c794658d7b1c560146b8293f110f 100644 --- a/Event/xAOD/xAODBase/xAODBase/xAODBaseDict.h +++ b/Event/xAOD/xAODBase/xAODBase/xAODBaseDict.h @@ -1,10 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODBaseDict.h 618909 2014-09-29 10:16:52Z krasznaa $ #ifndef XAODBASE_XAODBASEDICT_H #define XAODBASE_XAODBASEDICT_H @@ -14,12 +11,13 @@ // EDM include(s): #include "AthLinks/DataLink.h" #include "AthLinks/ElementLink.h" +#include "AthContainers/tools/AuxTypeVectorFactory.h" // Local include(s): -#include "xAODBase/ObjectType.h" #include "xAODBase/IParticleContainer.h" #include "xAODBase/IParticleHelpers.h" +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODBASE { xAOD::IParticleContainer c1; @@ -28,79 +26,37 @@ namespace { ElementLink< xAOD::IParticleContainer > l3; std::vector< ElementLink< xAOD::IParticleContainer > > l4; std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > l5; + SG::AuxTypeVectorFactory< DataLink< xAOD::IParticleContainer > > l6; + SG::AuxTypeVectorFactory< ElementLink< xAOD::IParticleContainer > > l7; + SG::AuxTypeVectorFactory< std::vector< ElementLink< xAOD::IParticleContainer > > > l8; }; } +// Not sure if this line is necessary but it shouldn't hurt... template class DataVector<xAOD::IParticle>; -template -bool& xAOD::IParticle::auxdata< bool >( const std::string& name, - const std::string& clsname = "" ); - -template -float& xAOD::IParticle::auxdata< float >( const std::string& name, - const std::string& clsname = "" ); - -template -int& xAOD::IParticle::auxdata< int >( const std::string& name, - const std::string& clsname = "" ); -template -unsigned int& -xAOD::IParticle::auxdata< unsigned int >( const std::string& name, - const std::string& clsname = "" ); - -template -uint8_t& xAOD::IParticle::auxdata< uint8_t >( const std::string& name, - const std::string& clsname = "" ); - -template -const bool& -xAOD::IParticle::auxdata< bool >( const std::string& name, - const std::string& clsname = "" ) const; - -template -const float& -xAOD::IParticle::auxdata< float >( const std::string& name, - const std::string& clsname = "" ) const; - -template -const int& -xAOD::IParticle::auxdata< int >( const std::string& name, - const std::string& clsname = "" ) const; - -template -const unsigned int& -xAOD::IParticle::auxdata< unsigned int >( const std::string& name, - const std::string& clsname = "" ) const; - -template -const uint8_t& -xAOD::IParticle::auxdata< uint8_t >( const std::string& name, - const std::string& clsname = "" ) const; - -template -bool -xAOD::IParticle::isAvailable< bool >( const std::string& name, - const std::string& clsname = "" ) const; - -template -bool -xAOD::IParticle::isAvailable< float >( const std::string& name, - const std::string& clsname = "" ) const; - -template -bool -xAOD::IParticle::isAvailable< int >( const std::string& name, - const std::string& clsname = "" ) const; - -template -bool -xAOD::IParticle::isAvailable< unsigned int >( const std::string& name, - const std::string& clsname = "" ) const; - -template -bool -xAOD::IParticle::isAvailable< uint8_t >( const std::string& name, - const std::string& clsname = "" ) const; +/// Helper macro for instantiating all the template functions that we need a +/// dictionary for. +#define INST_AUXFUNC( TYPE ) \ + template TYPE& \ + xAOD::IParticle::auxdata< TYPE >( const std::string& name, \ + const std::string& clsname = "" ); \ + template const TYPE& \ + xAOD::IParticle::auxdata< TYPE >( const std::string& name, \ + const std::string& clsname = "" ) const; \ + template bool \ + xAOD::IParticle::isAvailable< TYPE >( const std::string& name, \ + const std::string& clsname = "" ) const + +// Instantiate the functions for a couple of regularly used types. +INST_AUXFUNC( bool ); +INST_AUXFUNC( float ); +INST_AUXFUNC( double ); +INST_AUXFUNC( int ); +INST_AUXFUNC( unsigned int ); +INST_AUXFUNC( uint8_t ); + +// Clean up. +#undef INST_AUXFUNC #endif // XAODBASE_XAODBASEDICT_H diff --git a/Event/xAOD/xAODCaloEvent/CMakeLists.txt b/Event/xAOD/xAODCaloEvent/CMakeLists.txt index 231c2f98588f4e89bb088cb705c8cfd1028d646b..6bcb2e19799bb64798d66221b2272ee2bd369b1e 100644 --- a/Event/xAOD/xAODCaloEvent/CMakeLists.txt +++ b/Event/xAOD/xAODCaloEvent/CMakeLists.txt @@ -1,57 +1,38 @@ -# $Id: CMakeLists.txt 774010 2016-09-20 07:09:26Z krasznaa $ -################################################################################ -# Package: xAODCaloEvent -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODCaloEvent ) -# Extra dependencies, based on what environment we're in: +# Extra dependencies and sources, based on what environment we're in. +set( extra_libs ) +set( extra_sources ) if( NOT XAOD_ANALYSIS AND NOT SIMULATIONBASE AND NOT GENERATIONBASE ) - set( extra_deps Calorimeter/CaloEvent ) set( extra_libs CaloEvent ) + set( extra_sources src/*.cxx ) endif() -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs ${extra_libs} GenVector ) - endif() -endif() - -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Calorimeter/CaloGeoHelpers - Control/AthContainers - Control/CxxUtils - DetectorDescription/GeoPrimitives - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Control/AthLinks - ${extra_deps} ) - -# External dependencies: -find_package( Eigen ) +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) - -# Extra source(s), based on what environment we are in: -if( NOT XAOD_ANALYSIS AND NOT SIMULATIONBASE AND NOT GENERATIONBASE ) - set( extra_sources src/*.cxx ) -endif() +find_package( xAODUtilities ) # Component(s) in the package: atlas_add_library( xAODCaloEvent xAODCaloEvent/*.h xAODCaloEvent/versions/*.h Root/*.cxx ${extra_sources} PUBLIC_HEADERS xAODCaloEvent - INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${ROOT_LIBRARIES} CaloGeoHelpers AthContainers + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} CaloGeoHelpers AthContainers CxxUtils GeoPrimitives xAODBase xAODCore AthLinks ${extra_libs} ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODCaloEvent/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::CaloClusterContainer_v1" "xAOD::CaloTowerContainer_v1" ) + atlas_add_dictionary( xAODCaloEventDict xAODCaloEvent/xAODCaloEventDict.h - xAODCaloEvent/selection.xml - LINK_LIBRARIES xAODCaloEvent + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODCaloEvent EXTRA_FILES Root/dict/*.cxx ) -# Generate CLIDs for the library explicitly: +# Generate CLIDs for the library explicitly. atlas_generate_cliddb( xAODCaloEvent ) diff --git a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/selection.xml b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/selection.xml index 59d077c39fee2d25e9ec0b6dea4c06fc710bf39c..f0cabd38785e87197627149363dc5d75701cd960 100644 --- a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/selection.xml +++ b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/selection.xml @@ -1,93 +1,58 @@ -<!-- $Id: selection.xml 706724 2015-11-09 14:16:39Z wlampl $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- CaloCluster(Container> --> - - <class name="xAOD::CaloCluster_v1" > - <field name="m_signalState" transient="true" /> - <field name="m_cellLinks" transient="true" /> - <field name="m_recoStatus" transient="true" /> - </class> - <read sourceClass="xAOD::CaloCluster_v1" version="[1-]" - targetClass="xAOD::CaloCluster_v1" source="" target="m_signalState" > - <![CDATA[ - m_signalState=xAOD::CaloCluster_v1::CALIBRATED; - ]]> - </read> - <read sourceClass="xAOD::CaloCluster_v1" version="[1-]" - targetClass="xAOD::CaloCluster_v1" source="" target="m_cellLinks" > - <![CDATA[ - m_cellLinks=0; - ]]> - </read> - <class name="xAOD::CaloClusterContainer_v1" - id="24997BCA-3F6A-4530-8826-822EE9FC3C08" /> - <typedef name="xAOD::CaloClusterContainer" /> - <typedef name="xAOD::CaloCluster" /> - - <class name="xAOD::CaloClusterAuxContainer_v1" - id="CE498B3B-A32D-43A3-B9B3-C13D136BACFC" /> - - <class name="xAOD::CaloClusterAuxContainer_v2" - id="451393B0-69CD-11E4-A739-02163E00A64D" /> - <typedef name="xAOD::CaloClusterAuxContainer" /> - - <!-- Link types pointing at clusters: --> - <class name="DataLink<xAOD::CaloClusterContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::CaloClusterContainer_v1> >" /> - - <class name="ElementLink<xAOD::CaloClusterContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::CaloClusterContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::CaloClusterContainer_v1> > >" /> - - - <class name="xAOD::CaloClusterBadChannelData_v1" /> - <class name="std::vector<xAOD::CaloClusterBadChannelData_v1>" /> - <class name="std::vector< std::vector<xAOD::CaloClusterBadChannelData_v1> >" /> - <typedef name="xAOD::CaloClusterBadChannelData" /> - <typedef name="xAOD::CaloClusterBadChannelList" /> + <!-- xAOD::CaloCluster interface type(s). --> + <class name="xAOD::CaloCluster_v1" > + <field name="m_signalState" transient="true" /> + <field name="m_cellLinks" transient="true" /> + <field name="m_recoStatus" transient="true" /> + </class> + <read sourceClass="xAOD::CaloCluster_v1" version="[1-]" + targetClass="xAOD::CaloCluster_v1" source="" target="m_signalState" > + <![CDATA[ + m_signalState = xAOD::CaloCluster_v1::CALIBRATED; + ]]> + </read> + <read sourceClass="xAOD::CaloCluster_v1" version="[1-]" + targetClass="xAOD::CaloCluster_v1" source="" target="m_cellLinks" > + <![CDATA[ + m_cellLinks = 0; + ]]> + </read> + <class name="xAOD::CaloClusterContainer_v1" + id="24997BCA-3F6A-4530-8826-822EE9FC3C08" /> + <typedef name="xAOD::CaloCluster" /> + <typedef name="xAOD::CaloClusterContainer" /> + + <!-- xAOD::CaloCluster auxiliary type(s). --> + <class name="xAOD::CaloClusterAuxContainer_v1" + id="CE498B3B-A32D-43A3-B9B3-C13D136BACFC" /> + <class name="xAOD::CaloClusterAuxContainer_v2" + id="451393B0-69CD-11E4-A739-02163E00A64D" /> + <typedef name="xAOD::CaloClusterAuxContainer" /> + + <!-- xAOD::CaloClusterBadChannelData type(s). --> + <class name="xAOD::CaloClusterBadChannelData_v1" /> + <class name="std::vector<xAOD::CaloClusterBadChannelData_v1>" /> + <class name="std::vector<std::vector<xAOD::CaloClusterBadChannelData_v1> >" /> + <typedef name="xAOD::CaloClusterBadChannelData" /> + <typedef name="xAOD::CaloClusterBadChannelList" /> - - <!-- CaloTower(Container) --> - <class name="xAOD::CaloTower_v1" > - <field name="v_fourmom" transient="true" /> - <field name="m_eta" transient="true" /> - <field name="m_phi" transient="true" /> - <field name="m_invcosheta" transient="true" /> - </class> - - <class name="xAOD::CaloTowerContainer_v1" - id="EEA02A0F-98D3-464D-BAF1-1C944A700B8A" /> - <typedef name="xAOD::CaloTowerContainer" /> - <typedef name="xAOD::CaloTower" /> - - <class name="xAOD::CaloTowerAuxContainer_v1" - id="CE74E4D1-D2F4-4CED-8191-EC26D8836575" /> - <typedef name="xAOD::CaloTowerAuxContainer" /> - - <class name="xAOD::CaloTowerContainerBase_v1" /> - - <!-- Link types potentially pointing at Towers: --> - <class name="DataLink<xAOD::CaloTowerContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::CaloTowerContainer_v1> >" /> - - <class name="ElementLink<xAOD::CaloTowerContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::CaloTowerContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::CaloTowerContainer_v1> > >" /> - - - <!-- Additional type(s) needed: --> - <class name="std::bitset<3>" /> - <class name="xAOD::CaloVertexedClusterBase"/> - <class name="xAOD::CaloVertexedTopoCluster"/> - <class name="std::vector<std::vector<std::pair<unsigned int, double > > >"/> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - </exclusion> + <!-- xAOD::CaloTower interface type(s). --> + <class name="xAOD::CaloTower_v1" /> + <class name="xAOD::CaloTowerContainerBase_v1" /> + <class name="xAOD::CaloTowerContainer_v1" + id="EEA02A0F-98D3-464D-BAF1-1C944A700B8A" /> + <typedef name="xAOD::CaloTower" /> + <typedef name="xAOD::CaloTowerContainer" /> + + <!-- xAOD::CaloTower auxiliary type(s). --> + <class name="xAOD::CaloTowerAuxContainer_v1" + id="CE74E4D1-D2F4-4CED-8191-EC26D8836575" /> + <typedef name="xAOD::CaloTowerAuxContainer" /> + + <!-- Additional type(s) used in reconstruction. --> + <class name="xAOD::CaloVertexedClusterBase" /> + <class name="xAOD::CaloVertexedTopoCluster" /> </lcgdict> diff --git a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/xAODCaloEventDict.h b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/xAODCaloEventDict.h index 7272a5c0b670e45d0623805ac34051d32c032ba5..29d9afc6223871c797a0f5e958db92f473bc0579 100644 --- a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/xAODCaloEventDict.h +++ b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/xAODCaloEventDict.h @@ -1,41 +1,19 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODCaloEventDict.h 700669 2015-10-15 08:31:13Z wlampl $ #ifndef XAODCALOEVENT_XAODCALOEVENTDICT_H #define XAODCALOEVENT_XAODCALOEVENTDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - - -// System include(s): -#include <vector> -#include <bitset> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - // Local include(s): #include "xAODCaloEvent/CaloCluster.h" #include "xAODCaloEvent/CaloClusterContainer.h" +#include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODCaloEvent/versions/CaloCluster_v1.h" #include "xAODCaloEvent/versions/CaloClusterContainer_v1.h" #include "xAODCaloEvent/versions/CaloClusterAuxContainer_v1.h" #include "xAODCaloEvent/versions/CaloClusterAuxContainer_v2.h" -#include "xAODCaloEvent/CaloClusterAuxContainer.h" -#include "xAODCaloEvent/CaloVertexedClusterBase.h" -#include "xAODCaloEvent/CaloVertexedTopoCluster.h" -#include "xAODCaloEvent/CaloClusterBadChannelData.h" -//#include "xAODCaloEvent/CaloTowerDescriptor.h" -//#include "xAODCaloEvent/CaloTowerGrid.h" #include "xAODCaloEvent/CaloTower.h" #include "xAODCaloEvent/CaloTowerContainer.h" #include "xAODCaloEvent/CaloTowerAuxContainer.h" @@ -43,38 +21,23 @@ #include "xAODCaloEvent/versions/CaloTowerContainer_v1.h" #include "xAODCaloEvent/versions/CaloTowerAuxContainer_v1.h" +#include "xAODCaloEvent/CaloClusterBadChannelData.h" +#include "xAODCaloEvent/versions/CaloClusterBadChannelData_v1.h" -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODCALOEVENT { - // Container(s): - xAOD::CaloClusterContainer_v1 c1; - // Data link(s): - DataLink< xAOD::CaloClusterContainer_v1 > dl1; - std::vector< DataLink< xAOD::CaloClusterContainer_v1 > > dl2; - // Element link(s): - ElementLink< xAOD::CaloClusterContainer_v1 > el1; - std::vector< ElementLink< xAOD::CaloClusterContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::CaloClusterContainer_v1 > > > el3; - // Additional type(s) needed: - std::bitset< 3 > type1; // Using 3 instead of CaloCluster::NSTATES... - std::vector<std::vector<std::pair<unsigned int, double > > > calHitDecoratorType; - - //BadChannel lists - xAOD::CaloClusterBadChannelData_v1 bcd; - std::vector<xAOD::CaloClusterBadChannelData_v1> vbcd; - std::vector<std::vector<xAOD::CaloClusterBadChannelData_v1> > vvbcd; +#include "xAODCaloEvent/CaloVertexedClusterBase.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" - // CaloTower containers - xAOD::CaloTowerContainer_v1 t1; - xAOD::CaloTowerContainerBase_v1 dvt; - // Data link(s) - DataLink< xAOD::CaloTowerContainer_v1 > tdl1; - std::vector< DataLink< xAOD::CaloTowerContainer_v1 > > tdl2; - // Element link(s) - ElementLink< xAOD::CaloTowerContainer_v1 > tel1; - std::vector< ElementLink< xAOD::CaloTowerContainer_v1 > > tel2; - std::vector< std::vector< ElementLink< xAOD::CaloTowerContainer_v1 > > > tel3; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODCALOEVENT { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloClusterContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloTowerContainer_v1 ); + std::vector< xAOD::CaloClusterBadChannelData_v1 > v1; + std::vector< std::vector< xAOD::CaloClusterBadChannelData_v1 > > v2; }; } diff --git a/Event/xAOD/xAODCaloEventCnv/CMakeLists.txt b/Event/xAOD/xAODCaloEventCnv/CMakeLists.txt index 59e1c7cc4b6cad16ecb571421709f6dd4bfd641c..f9e353c36dac77d64b04beccbb68244212029089 100644 --- a/Event/xAOD/xAODCaloEventCnv/CMakeLists.txt +++ b/Event/xAOD/xAODCaloEventCnv/CMakeLists.txt @@ -19,14 +19,21 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( xAODCaloEventCnvLib + xAODCaloEventCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODCaloEventCnv + LINK_LIBRARIES GaudiKernel xAODCaloEvent ) + # Component(s) in the package: atlas_add_component( xAODCaloEventCnv src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} xAODCaloEvent CaloEvent AthenaBaseComps AthenaKernel EventKernel GaudiKernel ) + LINK_LIBRARIES ${ROOT_LIBRARIES} xAODCaloEventCnvLib xAODCaloEvent CaloEvent AthenaBaseComps AthenaKernel EventKernel GaudiKernel ) # Install files from the package: -atlas_install_headers( xAODCaloEventCnv ) atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODCaloRings/CMakeLists.txt b/Event/xAOD/xAODCaloRings/CMakeLists.txt index c3f123c709c830347a7663ba04e30b857e386a20..138bc70e0b9acbca2ca30370c10b5ab71194d3eb 100644 --- a/Event/xAOD/xAODCaloRings/CMakeLists.txt +++ b/Event/xAOD/xAODCaloRings/CMakeLists.txt @@ -1,27 +1,28 @@ -################################################################################ -# Package: xAODCaloRings -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODCaloRings ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Calorimeter/CaloGeoHelpers - Control/AthContainers - Control/AthLinks - Control/AthToolSupport/AsgTools - Event/xAOD/xAODCore ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODCaloRings xAODCaloRings/*.h xAODCaloRings/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODCaloRings - LINK_LIBRARIES CaloGeoHelpers AthContainers AthLinks AsgTools xAODCore ) + LINK_LIBRARIES CaloGeoHelpers AthContainers AthLinks xAODCore ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODCaloRings/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::RingSetContainer_v1" "xAOD::RingSetConfContainer_v1" + "xAOD::CaloRingsContainer_v1" ) atlas_add_dictionary( xAODCaloRingsDict xAODCaloRings/xAODCaloRingsDict.h - xAODCaloRings/selection.xml - LINK_LIBRARIES xAODCaloRings + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODCaloRings EXTRA_FILES Root/dict/*.cxx ) + +# Generate CLIDs for the library explicitly. +atlas_generate_cliddb( xAODCaloRings ) diff --git a/Event/xAOD/xAODCaloRings/Root/CaloRings_v1.cxx b/Event/xAOD/xAODCaloRings/Root/CaloRings_v1.cxx index c2d61d7a77785ac49983e5cc689f871e61a4176a..16c48ed0ee1f471538393b9ff2433c8b5b702b8b 100644 --- a/Event/xAOD/xAODCaloRings/Root/CaloRings_v1.cxx +++ b/Event/xAOD/xAODCaloRings/Root/CaloRings_v1.cxx @@ -1,38 +1,31 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: CaloRings_v1.cxx 767576 2016-08-11 13:53:42Z ssnyder $ - // standard library includes: +#include <iostream> #include <stdexcept> #include <sstream> -#include <memory> // EDM include(s): #include "xAODCore/AuxStoreAccessorMacros.h" // Local include(s): #include "xAODCaloRings/versions/CaloRings_v1.h" -#include "xAODCaloRings/versions/RingSet_v1.h" - -// NOTE: This shall be removed after upgrade to v2 (and kept in the v2 file) #include "xAODCaloRings/RingSetContainer.h" namespace xAOD { -namespace { - SG::AuxElement::Accessor< RingSetLinks_v1 > - accRingSetLinks( "ringSetLinks" ); - SG::AuxElement::ConstAccessor< RingSetLinks_v1 > - constAccRingSetLinks( "ringSetLinks" ); -} +static const SG::AuxElement::Accessor< RingSetLinks > + accRingSetLinks( "ringSetLinks" ); +static const SG::AuxElement::ConstAccessor< RingSetLinks > + constAccRingSetLinks( "ringSetLinks" ); /// @name RingSet Collection direct interation methods: /// @{ //============================================================================== AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, - RingSetLinks_v1, + RingSetLinks, ringSetLinks, setRingSetLinks) @@ -57,39 +50,39 @@ void CaloRings_v1::clear() } //============================================================================== -RingSetLinks_v1::iterator CaloRings_v1::begin() +RingSetLinks::iterator CaloRings_v1::begin() { return (accRingSetLinks.isAvailable( *this ) )? (accRingSetLinks( *this ).begin()): - (RingSetLinks_v1::iterator()); + (RingSetLinks::iterator()); } //============================================================================== -RingSetLinks_v1::iterator CaloRings_v1::end() +RingSetLinks::iterator CaloRings_v1::end() { return (accRingSetLinks.isAvailable( *this ) )? (accRingSetLinks( *this ).end()): - (RingSetLinks_v1::iterator()); + (RingSetLinks::iterator()); } //============================================================================== -RingSetLinks_v1::const_iterator CaloRings_v1::begin() const +RingSetLinks::const_iterator CaloRings_v1::begin() const { return (constAccRingSetLinks.isAvailable( *this ) )? (constAccRingSetLinks( *this ).begin()): - (RingSetLinks_v1::const_iterator()); + (RingSetLinks::const_iterator()); } //============================================================================== -RingSetLinks_v1::const_iterator CaloRings_v1::end() const +RingSetLinks::const_iterator CaloRings_v1::end() const { return (constAccRingSetLinks.isAvailable( *this ) )? (constAccRingSetLinks( *this ).end()): - (RingSetLinks_v1::const_iterator()); + (RingSetLinks::const_iterator()); } //============================================================================== -RingSet_v1 *CaloRings_v1::at(const unsigned int i) +RingSet *CaloRings_v1::at(const unsigned int i) { if ( i > nRingSets() ) return 0; @@ -98,11 +91,11 @@ RingSet_v1 *CaloRings_v1::at(const unsigned int i) return 0; } // If we want to use it as an left operand, we must do this: - return const_cast<RingSet_v1*>(*rsEL); + return const_cast<RingSet*>(*rsEL); } //============================================================================== -RingSet_v1 *CaloRings_v1::operator[](const unsigned int i) +RingSet *CaloRings_v1::operator[](const unsigned int i) { if ( i > nRingSets() ) return 0; @@ -111,11 +104,11 @@ RingSet_v1 *CaloRings_v1::operator[](const unsigned int i) return 0; } // If we want to use it as an left operand, we must do this: - return const_cast<RingSet_v1*>(*rsEL); + return const_cast<RingSet*>(*rsEL); } //============================================================================== -const RingSet_v1 *CaloRings_v1::at(const unsigned int i) const +const RingSet *CaloRings_v1::at(const unsigned int i) const { if ( i > nRingSets() ) return 0; @@ -128,7 +121,7 @@ const RingSet_v1 *CaloRings_v1::at(const unsigned int i) const } //============================================================================== -const RingSet_v1 *CaloRings_v1::operator[](const unsigned int i) const +const RingSet *CaloRings_v1::operator[](const unsigned int i) const { if ( i > nRingSets() ) return 0; @@ -146,7 +139,7 @@ const RingSet_v1 *CaloRings_v1::operator[](const unsigned int i) const //============================================================================== float CaloRings_v1::ringAt(const unsigned rsIdx, const unsigned ringIdx) const { - const RingSet_v1 *rs = this->at(rsIdx); + const RingSet *rs = this->at(rsIdx); if (!rs) { throw std::runtime_error("The element link is invalid."); } @@ -158,7 +151,7 @@ float CaloRings_v1::ringAt(const unsigned ringIdx) const { unsigned ringStripPartialSize = 0; for (unsigned rsELIdx = 0; rsELIdx < this->nRingSets(); ++rsELIdx){ - const RingSet_v1 *rs = this->at(rsELIdx); + const RingSet *rs = this->at(rsELIdx); if ( !rs ) { throw std::runtime_error("There is an invalid element link."); } @@ -197,7 +190,7 @@ void CaloRings_v1::exportRingsTo( ringStrip.clear(); for ( unsigned idx = rsIdxStart; idx <= rsIdxEnd ; ++idx ) { - const RingSet_v1 *rs = this->at( idx ); + const RingSet *rs = this->at( idx ); if ( !rs ) { throw std::runtime_error("Found invalid ElementLink"); } @@ -231,7 +224,7 @@ void CaloRings_v1::exportRingsTo( bool foundStartLayer = false; for ( unsigned rsIdx = 0; rsIdx < nRingSets; ++rsIdx ) { - const RingSet_v1* rs = this->at(rsIdx); + const RingSet* rs = this->at(rsIdx); if ( !rs ) { throw std::runtime_error( std::string( "Found invalid ElementLink") ); @@ -275,7 +268,7 @@ void CaloRings_v1::exportRingsTo( for ( unsigned rsIdx = 0; rsIdx < nRingSets; ++rsIdx) { if ( clRingsRawConfCol[rsIdx].calJointSection == sectionType) { foundSection = true; - const RingSet_v1* rs = this->at(rsIdx); + const RingSet* rs = this->at(rsIdx); if ( !rs ) { throw std::runtime_error( std::string( "Found invalid ElementLink") ); @@ -308,22 +301,6 @@ CaloRings_v1& CaloRings_v1::operator=(const CaloRings_v1& cl_rings ) /// Print-out methods: /// @{ -//============================================================================== -void CaloRings_v1::print(MsgStream &stream, MSG::Level level ) const -{ - if( stream.level() <= level ) { - stream << level << "CaloRings are : " << endmsg; - for (unsigned rsIdx = 0; rsIdx < this->nRingSets(); ++rsIdx) { - stream << level << "Ringset #" << rsIdx << " : "; - const RingSet_v1* rs = this->at(rsIdx); - if ( !rs ) { - throw std::runtime_error( std::string( - "Found invalid ElementLink") ); - } - rs->print(stream,level); - } - } -} //============================================================================== void CaloRings_v1::print( std::ostream &stream ) const @@ -331,7 +308,7 @@ void CaloRings_v1::print( std::ostream &stream ) const stream << "CaloRings are : " << std::endl; for (unsigned rsIdx = 0; rsIdx < this->nRingSets(); ++rsIdx) { stream << "Ringset #" << rsIdx << " : "; - const RingSet_v1* rs = this->at(rsIdx); + const RingSet* rs = this->at(rsIdx); if ( !rs ) { throw std::runtime_error( std::string( "Found invalid ElementLink") ); diff --git a/Event/xAOD/xAODCaloRings/Root/RingSetConf_v1.cxx b/Event/xAOD/xAODCaloRings/Root/RingSetConf_v1.cxx index 19ebc3408bc59ca757c9bc85bcd3561f8fe0eaa1..0751fb9089c4e97541bb57cc4d518d91e489d97f 100644 --- a/Event/xAOD/xAODCaloRings/Root/RingSetConf_v1.cxx +++ b/Event/xAOD/xAODCaloRings/Root/RingSetConf_v1.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: RingSetConf_v1.cxx 767576 2016-08-11 13:53:42Z ssnyder $ +// Local include(s). #include "xAODCaloRings/versions/RingSetConf_v1.h" - #include "xAODCaloRings/versions/RingSetConfContainer_v1.h" +// System include(s). #include <iostream> namespace xAOD { @@ -202,30 +202,6 @@ Ringer::CalJointLayer RingSetConf_v1::whichLayer( /// RawConf methods /// @{ -//============================================================================== -void RingSetConf_v1::print( const RawConf &raw, - MsgStream &stream, MSG::Level level ) -{ - - if( stream.level() <= level ) { - - stream << level << "| "; - - stream << raw.nRings << " Rings, Layer: " << raw.calJointLayer << - " (" << raw.layerStartIdx << " -> " << raw.layerEndIdx << - ") Section: " << raw.calJointSection << - " (" << raw.sectionStartIdx << " -> " << raw.sectionEndIdx << - "), etaWidth = " << raw.etaWidth << ", phiWidth = " << raw.phiWidth << - ", cellMaxDEtaDist = " << raw.cellMaxDEtaDist << - ", cellMaxDPhiDist = " << raw.cellMaxDPhiDist << - ", doEtaAxesDivision = " << raw.doEtaAxesDivision << - ", doPhiAxesDivision = " << raw.doPhiAxesDivision; - - stream << "|" << endmsg; - - } -} - //============================================================================== void RingSetConf_v1::print( const RawConf &raw, std::ostream &stream ) { @@ -339,19 +315,6 @@ void RingSetConf_v1::addRawConfColBounderies( RawConfCollection &clRingsConf ) } } -//============================================================================== -void RingSetConf_v1::print( const RawConfCollection &rawCol, - MsgStream &stream, MSG::Level level ) -{ - if( stream.level() <= level ) { - stream << level << "RawConfCollection is : " << endmsg; - for (unsigned rsIdx = 0; rsIdx < rawCol.size(); ++rsIdx) { - stream << level << "RawConf #" << rsIdx << " : "; - RingSetConf_v1::print(rawCol.at(rsIdx),stream,level); - } - } -} - //============================================================================== void RingSetConf_v1::print( const RawConfCollection &rawCol, std::ostream &stream ) @@ -733,28 +696,6 @@ RingSetConf_v1& RingSetConf_v1::operator=(const RingSetConf_v1& rsConf ){ return *this; } -//============================================================================== -void RingSetConf_v1::print( MsgStream &stream, MSG::Level level ) const { - - if( stream.level() <= level ) { - - stream << level << "| "; - - stream << nRings() << " Rings, Layer: " << calJointLayer() << - " (" << layerStartIdx() << " -> " << layerEndIdx() << - ") Section: " << calJointSection() << - " (" << sectionStartIdx() << " -> " << sectionEndIdx() << - "), etaWidth = " << etaWidth() << ", phiWidth = " << phiWidth() << - ", cellMaxDEtaDist = " << cellMaxDEtaDist() << - ", cellMaxDPhiDist = " << cellMaxDPhiDist() << - ", doEtaAxesDivision = " << doEtaAxesDivision() << - ", doPhiAxesDivision = " << doPhiAxesDivision(); - - stream << "|" << endmsg; - - } -} - //============================================================================== void RingSetConf_v1::print( std::ostream &stream ) const { stream << "| "; diff --git a/Event/xAOD/xAODCaloRings/Root/RingSet_v1.cxx b/Event/xAOD/xAODCaloRings/Root/RingSet_v1.cxx index 38cccd50a7d2dc99495816d2546ae2987f593547..f9ceebb3994a6065ef82012a902c2ae986fef226 100644 --- a/Event/xAOD/xAODCaloRings/Root/RingSet_v1.cxx +++ b/Event/xAOD/xAODCaloRings/Root/RingSet_v1.cxx @@ -1,19 +1,42 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: RingSet_v1.cxx 767576 2016-08-11 13:53:42Z ssnyder $ +// Local include(s). #include "xAODCaloRings/versions/RingSet_v1.h" -#include "xAODCaloRings/tools/PrintHelperFcns.h" -namespace xAOD { +// EDM include(s). +#include "xAODCore/AuxStoreAccessorMacros.h" namespace { -// Instantiate the needed accessors: -SG::AuxElement::Accessor< std::vector<float> > accRingsE("ringsE"); -SG::AuxElement::ConstAccessor< std::vector<float> > constAccRingsE("ringsE"); + +/// Helper operator for printing the contents of float vectors +std::ostream& operator<< ( std::ostream& out, const std::vector< float >& vec ) +{ + // A little prefix: + out << "["; + // Print the contents: + for( size_t i = 0; i < vec.size(); ++i ) { + out << vec[ i ]; + if( i < vec.size() - 1 ) { + out << ", "; + } + } + // A little postfix: + out << "]"; + // Return the stream: + return out; +} + } // private namespace +namespace xAOD { + +// Instantiate the needed accessors: +static const SG::AuxElement::Accessor< std::vector<float> > accRingsE("ringsE"); +static const SG::AuxElement::ConstAccessor< std::vector<float> > + constAccRingsE("ringsE"); + // @name RingSet_v1 accessors: //============================================================================== float &RingSet_v1::at(const unsigned int i) { @@ -88,14 +111,6 @@ void RingSet_v1::copyTo(std::vector<float> &vec) const { } -//============================================================================== -void RingSet_v1::print( MsgStream &stream, MSG::Level level ) const { - const std::vector<float> &ringsE = constAccRingsE( *this ); - if( stream.level() <= level ) { - stream << ringsE << endmsg; - } -} - //============================================================================== void RingSet_v1::print( std::ostream &stream ) const { const std::vector<float> &ringsE = constAccRingsE( *this ); diff --git a/Event/xAOD/xAODCaloRings/Root/getCaloRingsDecorator.cxx b/Event/xAOD/xAODCaloRings/Root/getCaloRingsDecorator.cxx index 2baa2c5d80dcd3565bd2ca9ab231dc1908c95307..edf876323042c3db61c927dc65c3d99ff8ff1774 100644 --- a/Event/xAOD/xAODCaloRings/Root/getCaloRingsDecorator.cxx +++ b/Event/xAOD/xAODCaloRings/Root/getCaloRingsDecorator.cxx @@ -1,18 +1,17 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: getCaloRingsDecorator.cxx 707323 2015-11-12 02:45:01Z wsfreund $ // Local includes: #include "xAODCaloRings/tools/getCaloRingsDecorator.h" namespace xAOD { //============================================================================== -caloRingsReader_t* getCaloRingsReader() +const caloRingsReader_t& getCaloRingsReader() { - static caloRingsReader_t caloRingsReader( caloRingsLinksDecorKey() ); - return &caloRingsReader; + static const caloRingsReader_t caloRingsReader( caloRingsLinksDecorKey() ); + return caloRingsReader; } } // namespace xAOD diff --git a/Event/xAOD/xAODCaloRings/Root/xAODCaloRingsCLIDs.cxx b/Event/xAOD/xAODCaloRings/Root/xAODCaloRingsCLIDs.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cf16bd511e8ff6adb64530eb693d4d364337bd96 --- /dev/null +++ b/Event/xAOD/xAODCaloRings/Root/xAODCaloRingsCLIDs.cxx @@ -0,0 +1,16 @@ +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// + +// Include all the versionless headers of the package, which hold CLIDs. +#include "xAODCaloRings/CaloRings.h" +#include "xAODCaloRings/CaloRingsContainer.h" +#include "xAODCaloRings/CaloRingsAuxContainer.h" + +#include "xAODCaloRings/RingSet.h" +#include "xAODCaloRings/RingSetContainer.h" +#include "xAODCaloRings/RingSetAuxContainer.h" + +#include "xAODCaloRings/RingSetConf.h" +#include "xAODCaloRings/RingSetConfContainer.h" +#include "xAODCaloRings/RingSetConfAuxContainer.h" diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRings.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRings.h index dc06429ebb77cbbd425ed579ae092459e248158d..3161fc208a54b61a389d6bfe35369a09f2b53c65 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRings.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRings.h @@ -1,24 +1,22 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRings.h 659538 2015-04-08 17:29:18Z wsfreund $ #ifndef XAODCALORINGS_CALORINGS_H #define XAODCALORINGS_CALORINGS_H // Local include(s): #include "xAODCaloRings/versions/CaloRings_v1.h" -// It is expected that the last version of CaloRings also contains the last -// RingSet version. To avoid any mistake, let's include it here. -#include "xAODCaloRings/RingSet.h" - /// Namespace holding all the xAOD EDM classes namespace xAOD { + /// Definition of the current "CaloRings version" typedef CaloRings_v1 CaloRings; + } // namespace xAOD +// CLID declaration for the type. #include "xAODCore/CLASS_DEF.h" CLASS_DEF( xAOD::CaloRings , 156466847 , 1 ) diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsAuxTypes.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsAuxTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..386082d64191c94b52c0696263cc8a56e9be9b53 --- /dev/null +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsAuxTypes.h @@ -0,0 +1,23 @@ +// Dear emacs, this is -*- c++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODCALORINGS_CALORINGSAUXTYPES_H +#define XAODCALORINGS_CALORINGSAUXTYPES_H + +// Local include(s). +#include "xAODCaloRings/CaloRingsContainer.h" + +// EDM include(s). +#include "AthContainers/AuxElement.h" + +namespace xAOD { + +/// The CaloRings element links decorator type: +typedef SG::AuxElement::Decorator< xAOD::CaloRingsLinks > caloRingsDeco_t; +/// The CaloRings element links reader type: +typedef SG::AuxElement::ConstAccessor< xAOD::CaloRingsLinks > caloRingsReader_t; + +} // namespace xAOD + +#endif // XAODCALORINGS_CALORINGSAUXTYPES_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainer.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainer.h index af428f334e07a478dd3e272ab0becea05ae8fe52..fa99a1655144adb82670f37eeb03bd5a4bce9ef5 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainer.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainer.h @@ -1,39 +1,28 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODCALORINGS_CALORINGSCONTAINER_H #define XAODCALORINGS_CALORINGSCONTAINER_H -// STL include(s): -#include <vector> - -// Core include(s): -#include "AthLinks/ElementLink.h" -#ifndef XAOD_STANDALONE -# include "StoreGate/ReadDecorHandle.h" -# include "StoreGate/WriteDecorHandle.h" -#endif // XAOD_STANDALONE - // Local include(s): #include "xAODCaloRings/CaloRings.h" #include "xAODCaloRings/versions/CaloRingsContainer_v1.h" +// EDM include(s). +#include "AthLinks/ElementLink.h" + +// System include(s). +#include <vector> + namespace xAOD { + /// Definition of the current "CaloRings container version" typedef CaloRingsContainer_v1 CaloRingsContainer; -/// Declare element links vector + +/// ElementLink type pointing at such objects. typedef std::vector< ElementLink< CaloRingsContainer > > CaloRingsLinks; -/// The CaloRings element links decorator type: -typedef SG::AuxElement::Decorator< xAOD::CaloRingsLinks > caloRingsDeco_t; -/// The CaloRings element links reader type: -typedef SG::AuxElement::ConstAccessor< xAOD::CaloRingsLinks > caloRingsReader_t; -#ifndef XAOD_STANDALONE -/// The CaloRings element links write decorator type: -template<typename T> using caloRingsDecoH_t = SG::WriteDecorHandle<T, CaloRingsLinks>; -/// The CaloRings element links write decorator type: -template<typename T> using caloRingsReaderH_t = SG::ReadDecorHandle<T, CaloRingsLinks>; -#endif // XAOD_STANDALONE + } // namespace xAOD // Set up a CLID for the container: diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainerFwd.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainerFwd.h index 92c59de752c2577e383993750dce899f13c1d8aa..aeb5eb8892a6c8b92ccde94118ecf323c6dd6c7e 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainerFwd.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/CaloRingsContainerFwd.h @@ -1,30 +1,30 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRingsContainerFwd.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_CALORINGSCONTAINERFWD_H #define XAODCALORINGS_CALORINGSCONTAINERFWD_H // This is a forward declaration for the latest CaloRings container type. -// Core include(s): -#include "AthLinks/ElementLink.h" - -// Local include(s): -#include "xAODCaloRings/tools/DataVectorFwd.h" +// Local include(s). #include "xAODCaloRings/CaloRingsFwd.h" -/// Declare that this is a vector of CaloRings-derived objects -//DATAVECTOR_BASE_FWD( xAOD::CaloRings, SG::AuxElement ); +// Core include(s). +#include "AthContainers/DataVector.h" +#include "AthLinks/ElementLink.h" + +// System include(s). +#include <vector> namespace xAOD { + /// Forward declaration of CaloRingsContainer typedef DataVector< CaloRings > CaloRingsContainer; /// Declare element links vector typedef std::vector< ElementLink< CaloRingsContainer > > CaloRingsLinks; + } // namespace xAOD #endif // XAODCALORINGS_CALORINGSCONTAINERFWD_H - diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetConfContainerFwd.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetConfContainerFwd.h index f6a9f8be3cc0c152f0f66c2010be97a12bda0b61..3ecbf2fefaeb470a291401b6fedb27c2506e5d15 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetConfContainerFwd.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetConfContainerFwd.h @@ -1,29 +1,30 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetConfContainerFwd.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_RINGSETCONFCONTAINERFWD_H #define XAODCALORINGS_RINGSETCONFCONTAINERFWD_H // This is a forward declaration for the latest RingSetConf container type. -// Core include(s): -#include "AthLinks/ElementLink.h" - -// Local include(s): -#include "xAODCaloRings/tools/DataVectorFwd.h" +// Local include(s). #include "xAODCaloRings/RingSetConfFwd.h" -/// Declare that this is a vector of CaloRings-derived objects -//DATAVECTOR_BASE_FWD( xAOD::RingSetConf, SG::AuxElement ); +// EDM include(s). +#include "AthContainers/DataVector.h" +#include "AthLinks/ElementLink.h" + +// System include(s). +#include <vector> namespace xAOD { + /// Forward declaration of RingSetConfContainer typedef DataVector< RingSetConf > RingSetConfContainer; /// Declare element links vector typedef std::vector< ElementLink< RingSetConfContainer > > RingSetConfLinks; + } // namespace xAOD #endif // XAODCALORINGS_RINGSETCONFCONTAINERFWD_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainer.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainer.h index 60dd1b9a0272b478c26239e1ea0a25b12d5ce091..ee0ec99e8dd8191401ffa033eac937b9790e8d1c 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainer.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainer.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetContainer.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_RINGSETCONTAINER_H #define XAODCALORINGS_RINGSETCONTAINER_H @@ -14,14 +13,17 @@ #include "AthContainers/AuxElement.h" // Local include(s): +#include "xAODCaloRings/RingSet.h" #include "xAODCaloRings/versions/RingSetContainer_v1.h" namespace xAOD { + /// Definition of the current "RingSet container version" typedef RingSetContainer_v1 RingSetContainer; /// Declare element links vector typedef std::vector< ElementLink< RingSetContainer > > RingSetLinks; + } // namespace xAOD // Set up a CLID for the container: diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainerFwd.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainerFwd.h index 6c77ad08d9c407ae317795c2b4c67faae533b3ca..044b9e075a1816b72ef0c415086e903c70e6ac0d 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainerFwd.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/RingSetContainerFwd.h @@ -1,29 +1,28 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetContainerFwd.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_RINGSETCONTAINERFWD_H #define XAODCALORINGS_RINGSETCONTAINERFWD_H -// STL include(s): -#include <vector> +// Local include(s): +#include "xAODCaloRings/RingSetFwd.h" -// This is a forward declaration for the latest RingSet container type. -// Core include(s): +// EDM include(s). +#include "AthContainers/DataVector.h" #include "AthLinks/ElementLink.h" -// Local include(s): -#include "xAODCaloRings/tools/DataVectorFwd.h" -#include "xAODCaloRings/RingSetFwd.h" +// System include(s). +#include <vector> namespace xAOD { + /// Forward declaration of RingSetContainer typedef DataVector< RingSet > RingSetContainer; /// Declare element links vector typedef std::vector< ElementLink< RingSetContainer > > RingSetLinks; + } // namespace xAOD #endif // XAODCALORINGS_RINGSETCONTAINERFWD_H - diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/selection.xml b/Event/xAOD/xAODCaloRings/xAODCaloRings/selection.xml index 5945f639bc6e8d834065b068ccb54e08e3a87edb..d7ef4dbcd1e84e4320ad4476b8a343edf52c8d79 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/selection.xml +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/selection.xml @@ -1,92 +1,46 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <enum pattern="Ringer::*"/> - - <!-- RingSet dictionaries: --> - <class name="xAOD::RingSet_v1" /> - <class name="AtlasGeoPoint" /> - - <!-- RingSet_v1 (Aux)Container --> - <class name="xAOD::RingSetContainer_v1" - id="C9CFE7DE-44E4-40AF-8CBF-6CCCB8FB0A8F" /> - <class name="xAOD::RingSetAuxContainer_v1" - id="18C4774A-EE60-4E78-843D-02B6235FBCF4" /> - - <!-- Smart pointers to RingSet_v1: --> - <class name="DataLink<xAOD::RingSetContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::RingSetContainer_v1> >" /> - <class name="ElementLink<xAOD::RingSetContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::RingSetContainer_v1> >" /> - <class name="ElementLinkVector<xAOD::RingSetContainer_v1>" /> - <class name="std::vector<ElementLinkVector<xAOD::RingSetContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<DataVector<xAOD::RingSet_v1> > > >" /> - - <!-- RingSetConf dictionaries: --> - <class name="xAOD::RingSetConf_v1" /> - <class name="xAOD::RingSetConf_v1::RawConf" /> - <class name="xAOD::RingSetConf_v1::RawConfCollection" /> - - <!-- RingSet_v1 (Aux)Container --> - <class name="xAOD::RingSetConfContainer_v1" - id="A3E47D26-235E-49BC-8D9A-52A9CA097D7D" /> - <class name="xAOD::RingSetConfAuxContainer_v1" - id="B080CC3F-D375-49BE-B400-F4B3115417FD" /> - - <!-- Smart pointers to RingSet_v1: --> - <class name="DataLink<xAOD::RingSetConfContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::RingSetConfContainer_v1> >" /> - <class name="ElementLink<xAOD::RingSetConfContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::RingSetConfContainer_v1> >" /> - <class name="ElementLinkVector<xAOD::RingSetConfContainer_v1>" /> - <class name="std::vector<ElementLinkVector<xAOD::RingSetConfContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<DataVector<xAOD::RingSetConf_v1> > > >" /> - - <!-- Needed by RootCore --> - <class name="std::vector<CaloSampling::CaloSample>" /> - - <!-- CaloRings_v1 dictionaries: --> - <class name="xAOD::CaloRings_v1"> - <!--<field name="m_ringsets" transient="true" /> --> - </class> - - <!-- Pool read xAOD::CaloRings_v1 --> - <!-- - <read sourceClass="xAOD::CaloRings_v1" version="[1-]" - targetClass="xAOD::CaloRings_v1" source="" - target="m_isRingSetCached" > - <![CDATA[ - m_isRingSetCached = false; - ]]> - </read> - --> - - <!-- CaloRings_v1 (Aux)Container --> - <class name="xAOD::CaloRingsContainer_v1" - id="AC758B30-A488-4AC5-AB42-34B1C97CFE44" /> - <class name="xAOD::CaloRingsAuxContainer_v1" - id="581CAE9D-55D9-445A-9D64-2013091FE019" /> - - <!-- Smart pointers to CaloRings_v1: --> - <class name="DataLink<xAOD::CaloRingsContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::CaloRingsContainer_v1> >" /> - <class name="ElementLink<xAOD::CaloRingsContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::CaloRingsContainer_v1> >" /> - <class name="ElementLinkVector<xAOD::CaloRingsContainer_v1>" /> - <class name="std::vector<ElementLinkVector<xAOD::CaloRingsContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<DataVector<xAOD::CaloRings_v1> > > >" /> - - <!-- FIXME Copied from xAODEgamma. Kept for future reference, if needed. --> - - <!-- Objects from the namespace --> - <!-- <variable pattern="xAOD::EgammaParameters::*" /> --> - - <!--Add Helper Functions --> - <!--<function pattern="xAOD::EgammaHelpers::*" /> --> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <!-- <exclusion> - <class pattern="*CollectionItr*" /> - </exclusion> --> + <!-- xAOD::RingSet interface type(s). --> + <class name="xAOD::RingSet_v1" /> + <class name="xAOD::RingSetContainer_v1" + id="C9CFE7DE-44E4-40AF-8CBF-6CCCB8FB0A8F" /> + <typedef name="xAOD::RingSet" /> + <typedef name="xAOD::RingSetContainer" /> + + <!-- xAOD::RingSet auxiliary type(s). --> + <class name="xAOD::RingSetAuxContainer_v1" + id="18C4774A-EE60-4E78-843D-02B6235FBCF4" /> + <typedef name="xAOD::RingSetAuxContainer" /> + + <!-- xAOD::RingSetConf interface type(s). --> + <class name="xAOD::RingSetConf_v1" /> + <class name="xAOD::RingSetConf_v1::RawConf" /> + <class name="xAOD::RingSetConf_v1::RawConfCollection" /> + <class name="xAOD::RingSetConfContainer_v1" + id="A3E47D26-235E-49BC-8D9A-52A9CA097D7D" /> + <typedef name="xAOD::RingSetConf" /> + <typedef name="xAOD::RingSetConfContainer" /> + + <!-- xAOD::RingSetConf auxiliary type(s). --> + <class name="xAOD::RingSetConfAuxContainer_v1" + id="B080CC3F-D375-49BE-B400-F4B3115417FD" /> + <typedef name="xAOD::RingSetConfAuxContainer" /> + + <!-- xAOD::CaloRings interface type(s). --> + <class name="xAOD::CaloRings_v1" /> + <class name="xAOD::CaloRingsContainer_v1" + id="AC758B30-A488-4AC5-AB42-34B1C97CFE44" /> + <typedef name="xAOD::CaloRings" /> + <typedef name="xAOD::CaloRingsContainer" /> + + <!-- xAOD::CaloRings auxiliary type(s). --> + <class name="xAOD::CaloRingsAuxContainer_v1" + id="581CAE9D-55D9-445A-9D64-2013091FE019" /> + <typedef name="xAOD::CaloRingsAuxContainer" /> + + <!-- Additional type(s). --> + <class name="AtlasGeoPoint" /> + <enum pattern="Ringer::*" /> </lcgdict> diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/DataVectorFwd.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/DataVectorFwd.h deleted file mode 100644 index 2a21a9fa9280bf57378cd6ce3e30e7c2eca78bda..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/DataVectorFwd.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: DataVectorFwd.h 767579 2016-08-11 13:57:39Z ssnyder $ -#ifndef XAODCALORINGS_TOOLS_DATAVECTORFWD_H -#define XAODCALORINGS_TOOLS_DATAVECTORFWD_H - -/// Forward declare DataVector: -template<class T, class BASE> class DataVector; - -#endif // XAODCALORINGS_TOOLS_DATAVECTORFWD_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/PrintHelperFcns.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/PrintHelperFcns.h deleted file mode 100644 index 32c87d1b1df5bb1a1ea6ae1dcefa792c606fad18..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/PrintHelperFcns.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: PrintHelperFcns.h 767576 2016-08-11 13:53:42Z ssnyder $ -#ifndef XAODCALORINGS_TOOLS_PRINTHELPERFCNS_H -#define XAODCALORINGS_TOOLS_PRINTHELPERFCNS_H - -// STL includes: -#include <vector> - -// Asg includes: -#include "AsgTools/MsgStream.h" -#include "AsgTools/MsgStreamMacros.h" - -#define ATH_MSG_LVL_DISP_VAR( lvl, var) \ - do { \ - if ( msgLvl(lvl) ) { \ - msg(lvl) << #var << " : " << var << endmsg; \ - } \ - } while (0) - -// ============================================================================= -/// Helper operator for printing the contents of vectors (MsgStream) -template <typename T> -MsgStream& operator<< ( MsgStream& out, const std::vector< T >& vec ) -{ - - // A little prefix: - out << "["; - // Print the contents: - for( size_t i = 0; i < vec.size(); ++i ) { - out << vec[ i ]; - if( i < vec.size() - 1 ) { - out << ", "; - } - } - // A little postfix: - out << "]"; - // Return the stream: - return out; -} - -// ============================================================================= -/// Helper operator for printing the contents of vector pointers (MsgStream) -template <typename T> -MsgStream& operator<< ( MsgStream& out, const std::vector< T >* vec) -{ - return out.operator<<(*vec); -} - -// ============================================================================= -/// Helper operator for printing the contents of vectors (ostream) -template <typename T> -std::ostream& operator<< ( std::ostream& out, const std::vector< T >& vec ) -{ - // A little prefix: - out << "["; - // Print the contents: - for( size_t i = 0; i < vec.size(); ++i ) { - out << vec[ i ]; - if( i < vec.size() - 1 ) { - out << ", "; - } - } - // A little postfix: - out << "]"; - // Return the stream: - return out; -} - -// ============================================================================= -/// Helper operator for printing the contents of vector pointers (ostream) -template <typename T> -std::ostream& operator<< ( std::ostream& out, const std::vector< T >* vec) -{ - return out.operator<<(*vec); -} - - -#endif // XAODCALORINGS_TOOLS_PRINTHELPERFCNS_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/getCaloRingsDecorator.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/getCaloRingsDecorator.h index d3e57357ee1eaf622ed1b0e2b781b318103057e4..be97b069bd3a16504999f502002ec8075e3c7007 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/getCaloRingsDecorator.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/tools/getCaloRingsDecorator.h @@ -1,17 +1,15 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: getCaloRingsDecorator.h 668862 2015-05-20 20:15:30Z wsfreund $ #ifndef XAODCALORINGS_UTILS_GETCALORINGSDECORATOR_H #define XAODCALORINGS_UTILS_GETCALORINGSDECORATOR_H -// Athena includes: -#include "AthContainers/AuxElement.h" - // Local includes: -#include "xAODCaloRings/CaloRingsContainer.h" +#include "xAODCaloRings/CaloRingsAuxTypes.h" +// System include(s). +#include <string> namespace xAOD { @@ -23,7 +21,7 @@ std::string caloRingsLinksDecorKey(){ /** * @brief Get CaloRings accessor with read only permissions. **/ -caloRingsReader_t* getCaloRingsReader(); +const caloRingsReader_t& getCaloRingsReader(); } // namespace xAOD diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsAuxContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsAuxContainer_v1.h index 4841fa1f389c74642cd0de790270fb665f89aedc..f3c8fd418b1f8ccf3940d742f16f18ea30557ab6 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsAuxContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsAuxContainer_v1.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRingsAuxContainer_v1.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_CALORINGSAUXCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_CALORINGSAUXCONTAINER_V1_H @@ -12,42 +11,30 @@ // EDM include(s): #include "xAODCore/AuxContainerBase.h" -#include "xAODCaloRings/versions/RingSetContainer_v1.h" +// Local include(s). +#include "xAODCaloRings/RingSetContainer.h" namespace xAOD { -/// Temporary container used until we have I/O for AuxStoreInternal -/// -/// This class is meant to serve as a temporary way to provide an auxiliary -/// store with Athena I/O capabilities for the CaloRings EDM. Will be exchanged for -/// a generic auxiliary container type (AuxStoreInternal) later on. Copied -/// from xAOD::Egamma. -/// -/// $Revision: 707323 $ -/// $Date: 2015-11-12 03:45:01 +0100 (Thu, 12 Nov 2015) $ -/// - +/// Auxiliary store for @c xAOD::CaloRingsContainer class CaloRingsAuxContainer_v1 : public AuxContainerBase { public: - /// @name xAOD::CaloRingsAuxContainer constructors CaloRingsAuxContainer_v1(); private: - /// @{ /// The RingSet ElementLink Vector: - std::vector< RingSetLinks_v1 > ringSetLinks; + std::vector< RingSetLinks > ringSetLinks; /// @} - }; // class CaloRingsAuxContainer_v1 } // namespace xAOD +// Base declaration for the class. #include "xAODCore/BaseInfo.h" SG_BASE( xAOD::CaloRingsAuxContainer_v1, xAOD::AuxContainerBase ); #endif // XAODCALORINGS_VERSIONS_CALORINGSAUXCONTAINER_V1_H - diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsContainer_v1.h index f144684e1a334ef98dc67d7e070b2acbac4e09f2..ca8a42b90ac1077012c72d6c96cfb53578022c2c 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRingsContainer_v1.h @@ -1,24 +1,21 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRingsContainer_v1.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_CALORINGSCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_CALORINGSCONTAINER_V1_H // Core include(s): #include "AthContainers/DataVector.h" -#include "AthContainers/AuxElement.h" // Local include(s): #include "xAODCaloRings/versions/CaloRings_v1.h" namespace xAOD { + /// The container is a simple typedef for now typedef DataVector< xAOD::CaloRings_v1 > CaloRingsContainer_v1; -/// Define EL vector for this version: -typedef std::vector< ElementLink< CaloRingsContainer_v1 > > - CaloRingsLinks_v1; + } #endif // XAODCALORINGS_VERSIONS_CALORINGSCONTAINER_V1_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRings_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRings_v1.h index d8e6a516e27fe191eb6d4c907d05c0872600fafc..d3083b8cf5890194fddb703c40f4cb3e6ecd9b9c 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRings_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/CaloRings_v1.h @@ -1,25 +1,20 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRings_v1.h 708162 2015-11-16 16:03:49Z ssnyder $ #ifndef XAODCALORINGS_VERSIONS_CALORINGS_V1_H #define XAODCALORINGS_VERSIONS_CALORINGS_V1_H // STL include(s): #include <vector> -#include <ostream> - -// Athena framework includes: -#include "AsgTools/MsgStream.h" +#include <iosfwd> // EDM include(s): #include "AthContainers/AuxElement.h" -#include "xAODCore/AuxStoreAccessorMacros.h" // Local include(s): -#include "xAODCaloRings/versions/RingSetContainer_v1.h" -#include "xAODCaloRings/versions/RingSetConf_v1.h" +#include "xAODCaloRings/RingSetContainer.h" +#include "xAODCaloRings/RingSetConf.h" namespace xAOD { @@ -52,8 +47,6 @@ namespace xAOD { * * This package was based on xAODEgamma implementation. * - * $Revision: 708162 $ - * $Date: 2015-11-16 17:03:49 +0100 (Mon, 16 Nov 2015) $ **/ class CaloRings_v1 : public SG::AuxElement { @@ -97,47 +90,47 @@ class CaloRings_v1 : public SG::AuxElement { /** * @brief returns iterator to the beginning of RingSet Collection. **/ - RingSetLinks_v1::iterator begin(); + RingSetLinks::iterator begin(); /** * @brief returns iterator to the ending of RingSet EL Collection. **/ - RingSetLinks_v1::iterator end(); + RingSetLinks::iterator end(); /** * @brief returns const_iterator to the beginning of RingSet Collection. **/ - RingSetLinks_v1::const_iterator begin() const; + RingSetLinks::const_iterator begin() const; /** * @brief returns const_iterator to the ending of RingSet EL Collection. **/ - RingSetLinks_v1::const_iterator end() const; + RingSetLinks::const_iterator end() const; /** * @brief Return ith RingSet **/ - RingSet_v1 *at(const unsigned index); + RingSet *at(const unsigned index); /** * @brief Return ith RingSet **/ - RingSet_v1 *operator [](const unsigned index); + RingSet *operator [](const unsigned index); /** * @brief Return ith RingSet **/ - const RingSet_v1 *at(const unsigned index) const; + const RingSet *at(const unsigned index) const; /** * @brief Return ith RingSet **/ - const RingSet_v1 *operator [](const unsigned index) const; + const RingSet *operator [](const unsigned index) const; /** * @brief Returns constant ringsets collection. * * Set via AUXSTORE_OBJECT_SETTER_AND_GETTER marcro. **/ - const RingSetLinks_v1 &ringSetLinks() const; + const RingSetLinks &ringSetLinks() const; /** * @brief Set this CaloRings RingSet Collection. * * Set via AUXSTORE_OBJECT_SETTER_AND_GETTER marcro. **/ - void setRingSetLinks(const RingSetLinks_v1 &ringsets); + void setRingSetLinks(const RingSetLinks &ringsets); /// @} /// @name CaloRings_v1 operators overload: @@ -200,11 +193,7 @@ class CaloRings_v1 : public SG::AuxElement { /// Print @name CaloRings_v1 methods: - /// @{ - /** - * @brief Print @name CaloRings_v1 using AsgTool MsgStream: - **/ - void print( MsgStream &stream, MSG::Level level = MSG::DEBUG ) const; + /// @{ /** * @brief Print @name CaloRings_v1 using ostream: **/ diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetAuxContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetAuxContainer_v1.h index 797885db0c130a1cbd9f8c0571a3ac0f3cfe9add..bb2c5a40fdd280932a511e88fcb7c1edb6c9f433 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetAuxContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetAuxContainer_v1.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetAuxContainer_v1.h 659533 2015-04-08 17:05:53Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSETAUXCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_RINGSETAUXCONTAINER_V1_H @@ -14,17 +13,7 @@ namespace xAOD { -/// Temporary container used until we have I/O for AuxStoreInternal -/// -/// This class is meant to serve as a temporary way to provide an auxiliary -/// store with Athena I/O capabilities for the RingSet EDM. Will be exchanged for -/// a generic auxiliary container type (AuxStoreInternal) later on. Copied -/// from xAOD::Egamma. -/// -/// $Revision: 659533 $ -/// $Date: 2015-04-08 19:05:53 +0200 (Wed, 08 Apr 2015) $ -/// - +/// Auxiliary store for @c xAOD::RingSetContainer class RingSetAuxContainer_v1 : public AuxContainerBase { public: @@ -44,6 +33,7 @@ private: } // namespace xAOD +// Base declaration for the class. #include "xAODCore/BaseInfo.h" SG_BASE( xAOD::RingSetAuxContainer_v1, xAOD::AuxContainerBase ); diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfAuxContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfAuxContainer_v1.h index 85652a637a1024d9df0e31407d5bf3e6ee9b7e6c..ea41b8f98bc56122ab9f1da2e6d37d6b91d01cbd 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfAuxContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfAuxContainer_v1.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetConfAuxContainer_v1.h 704590 2015-10-29 17:47:12Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSETCONFAUXCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_RINGSETCONFAUXCONTAINER_V1_H @@ -14,17 +13,7 @@ namespace xAOD { -/// Temporary container used until we have I/O for AuxStoreInternal -/// -/// This class is meant to serve as a temporary way to provide an auxiliary -/// store with Athena I/O capabilities for the Metadata containing the RingSet -/// configuration EDM. Will be exchanged for a generic auxiliary container type -/// (AuxStoreInternal) later on. Copied from xAOD::Egamma. -/// -/// $Revision: 704590 $ -/// $Date: 2015-10-29 18:47:12 +0100 (Thu, 29 Oct 2015) $ -/// - +/// Auxiliary store for @c xAOD::RingSetConfContainer class RingSetConfAuxContainer_v1 : public AuxContainerBase { public: @@ -70,6 +59,7 @@ private: } // namespace xAOD +// Base declaration for the class. #include "xAODCore/BaseInfo.h" SG_BASE( xAOD::RingSetConfAuxContainer_v1, xAOD::AuxContainerBase ); diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfContainer_v1.h index 304a91d3f1f849901f8d594e4704c728de77dc98..bfd39811abfcff04dcec39daafe020d5737df7bf 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConfContainer_v1.h @@ -1,17 +1,12 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetConfContainer_v1.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSETCONFCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_RINGSETCONFCONTAINER_V1_H -// STL includes(s): -#include <vector> - // Core include(s): #include "AthContainers/DataVector.h" -#include "AthLinks/ElementLink.h" // Local include(s): #include "xAODCaloRings/versions/RingSetConf_v1.h" @@ -20,9 +15,7 @@ namespace xAOD { /// The container is a simple typedef for now typedef DataVector< xAOD::RingSetConf_v1 > RingSetConfContainer_v1; -/// Declare element links vector -typedef std::vector< ElementLink< RingSetConfContainer_v1 > > - RingSetConfLinks_v1; + } // namespace xAOD #endif // XAODCALORINGS_VERSIONS_RINGSETCONFCONTAINER_V1_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConf_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConf_v1.h index 200a91664da340ff184f662909b316ff541f97c3..945e16e963c25a8bc3fbecb014b765c65b4a43b0 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConf_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetConf_v1.h @@ -1,17 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetConf_v1.h 704590 2015-10-29 17:47:12Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSETCONF_V1_H #define XAODCALORINGS_VERSIONS_RINGSETCONF_V1_H // std includes: #include <vector> -#include <ostream> +#include <iosfwd> // Athena framework includes: -#include "AsgTools/MsgStream.h" #include "CaloGeoHelpers/CaloSampling.h" #include "AthContainers/DataVector.h" @@ -34,8 +31,6 @@ typedef DataVector< xAOD::RingSetConf_v1 > RingSetConfContainer_v1; * * @author Werner Spolidoro Freund <wsfreund@cern.ch> * - * $Revision: 704590 $ - * $Date: 2015-10-29 18:47:12 +0100 (Thu, 29 Oct 2015) $ **/ class RingSetConf_v1 : public SG::AuxElement { @@ -153,8 +148,6 @@ class RingSetConf_v1 : public SG::AuxElement { /// @} /// Prints rawConf /// @{ - static void print( const RawConf &raw, - MsgStream &stream, MSG::Level level = MSG::DEBUG ); static void print( const RawConf &raw, std::ostream &stream); /// @} /** @@ -181,8 +174,6 @@ class RingSetConf_v1 : public SG::AuxElement { static void addRawConfColBounderies( RawConfCollection &clRingsConf ); /// Prints RawConfCollection /// @{ - static void print( const RawConfCollection &raw, MsgStream &stream, - MSG::Level level = MSG::DEBUG ); static void print( const RawConfCollection &raw, std::ostream &stream ); /// @} /** @@ -444,10 +435,6 @@ class RingSetConf_v1 : public SG::AuxElement { /// @} /// @{ Print @name RingSetConf_v1 methods: - /** - * @brief Print @name RingSetConf_v1 using AsgTool MsgStream: - **/ - void print( MsgStream &stream, MSG::Level level = MSG::DEBUG ) const; /** * @brief Print @name RingSetConf_v1 using ostream: **/ diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetContainer_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetContainer_v1.h index 5710582d7b15a85f610437719496b3e4522759b6..ad2cf34d99860cec07ffe8e6a24b7a65d3202488 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetContainer_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSetContainer_v1.h @@ -1,24 +1,21 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSetContainer_v1.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSETCONTAINER_V1_H #define XAODCALORINGS_VERSIONS_RINGSETCONTAINER_V1_H // Core include(s): #include "AthContainers/DataVector.h" -#include "AthLinks/ElementLink.h" // Local include(s): #include "xAODCaloRings/versions/RingSet_v1.h" namespace xAOD { + /// The container is a simple typedef for now typedef DataVector< xAOD::RingSet_v1 > RingSetContainer_v1; -/// Define EL vector for this version: -typedef std::vector< ElementLink< RingSetContainer_v1 > > - RingSetLinks_v1; + } // namespace xAOD #endif // XAODCALORINGS_VERSIONS_RINGSETCONTAINER_V1_H diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSet_v1.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSet_v1.h index 0bb36c13ca97f61c741669a65a0efbfd0e95da1e..0587e51e1405351659f4149e6eb8b5c98403ba79 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSet_v1.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/versions/RingSet_v1.h @@ -1,24 +1,16 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: RingSet_v1.h 670601 2015-05-28 14:22:49Z wsfreund $ #ifndef XAODCALORINGS_VERSIONS_RINGSET_V1_H #define XAODCALORINGS_VERSIONS_RINGSET_V1_H // std includes: #include <vector> -#include <memory> -#include <ostream> -#include <algorithm> - -// Athena framework includes: -#include "AsgTools/MsgStream.h" +#include <iosfwd> // EDM include(s): #include "AthContainers/AuxElement.h" -#include "xAODCore/AuxStoreAccessorMacros.h" - #include "xAODCaloRings/CaloRingsDefs.h" namespace xAOD { @@ -35,8 +27,6 @@ namespace xAOD { * @author Danilo Enoque Ferreira de Lima * (first implementation) * - * $Revision: 670601 $ - * $Date: 2015-05-28 16:22:49 +0200 (Thu, 28 May 2015) $ **/ class RingSet_v1 : public SG::AuxElement { @@ -143,10 +133,6 @@ class RingSet_v1 : public SG::AuxElement { /// @} /// @{ Print @name RingSet_v1 methods: - /** - * @brief Print @name RingSet_v1 using AsgTool MsgStream: - **/ - void print( MsgStream &stream, MSG::Level level = MSG::DEBUG ) const; /** * @brief Print @name RingSet_v1 using ostream: **/ diff --git a/Event/xAOD/xAODCaloRings/xAODCaloRings/xAODCaloRingsDict.h b/Event/xAOD/xAODCaloRings/xAODCaloRings/xAODCaloRingsDict.h index 0d869af87162711342705ef0f40faa24866d71b0..b59dc71d4f6e84ceb4edaa9587184b666d14dab0 100644 --- a/Event/xAOD/xAODCaloRings/xAODCaloRings/xAODCaloRingsDict.h +++ b/Event/xAOD/xAODCaloRings/xAODCaloRings/xAODCaloRingsDict.h @@ -1,79 +1,49 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODCaloRingsDict.h 707323 2015-11-12 02:45:01Z wsfreund $ #ifndef XAODCALORINGS_XAODCALORINGSDICT_H #define XAODCALORINGS_XAODCALORINGSDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> -#include <memory> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" -#include "AthLinks/ElementLinkVector.h" - // Local include(s): - #include "xAODCaloRings/tools/AtlasGeoPoint.h" +#include "xAODCaloRings/RingSet.h" #include "xAODCaloRings/RingSetContainer.h" +#include "xAODCaloRings/RingSetAuxContainer.h" +#include "xAODCaloRings/versions/RingSet_v1.h" #include "xAODCaloRings/versions/RingSetContainer_v1.h" #include "xAODCaloRings/versions/RingSetAuxContainer_v1.h" +#include "xAODCaloRings/RingSetConf.h" #include "xAODCaloRings/RingSetConfContainer.h" +#include "xAODCaloRings/RingSetConfAuxContainer.h" +#include "xAODCaloRings/versions/RingSetConf_v1.h" #include "xAODCaloRings/versions/RingSetConfContainer_v1.h" #include "xAODCaloRings/versions/RingSetConfAuxContainer_v1.h" +#include "xAODCaloRings/CaloRings.h" #include "xAODCaloRings/CaloRingsContainer.h" +#include "xAODCaloRings/CaloRingsAuxContainer.h" +#include "xAODCaloRings/versions/CaloRings_v1.h" #include "xAODCaloRings/versions/CaloRingsContainer_v1.h" #include "xAODCaloRings/versions/CaloRingsAuxContainer_v1.h" #include "xAODCaloRings/CaloRingsDefs.h" -namespace { - -struct GCCXML_DUMMY_INSTANTIATION_XAODCALORINGS { - - DataLink< xAOD::RingSetContainer_v1 > ringset_v1_l1; - ElementLink< xAOD::RingSetContainer_v1 > ringset_v1_l2; - ElementLinkVector< xAOD::RingSetContainer_v1 > ringset_v1_l3; - std::vector< DataLink< xAOD::RingSetContainer_v1 > > ringset_v1_l4; - std::vector< ElementLink< xAOD::RingSetContainer_v1 > > ringset_v1_l5; - std::vector< ElementLinkVector< xAOD::RingSetContainer_v1 > > ringset_v1_l6; - std::vector< std::vector< ElementLink< DataVector< xAOD::RingSet_v1 > > > > ringset_v1_l7; - - DataLink< xAOD::RingSetConfContainer_v1 > ringsetconf_v1_l1; - ElementLink< xAOD::RingSetConfContainer_v1 > ringsetconf_v1_l2; - ElementLinkVector< xAOD::RingSetConfContainer_v1 > ringsetconf_v1_l3; - std::vector< DataLink< xAOD::RingSetConfContainer_v1 > > ringsetconf_v1_l4; - std::vector< ElementLink< xAOD::RingSetConfContainer_v1 > > ringsetconf_v1_l5; - std::vector< ElementLinkVector< xAOD::RingSetConfContainer_v1 > > ringsetconf_v1_l6; - std::vector< std::vector< ElementLink< DataVector< xAOD::RingSetConf_v1 > > > > ringsetconf_v1_l7; - - DataLink< xAOD::CaloRingsContainer_v1 > clrings_v1_l1; - ElementLink< xAOD::CaloRingsContainer_v1 > clrings_v1_l2; - ElementLinkVector< xAOD::CaloRingsContainer_v1 > clrings_v1_l3; - std::vector< DataLink< xAOD::CaloRingsContainer_v1 > > clrings_v1_l4; - std::vector< ElementLink< xAOD::CaloRingsContainer_v1 > > clrings_v1_l5; - std::vector< ElementLinkVector< xAOD::CaloRingsContainer_v1 > > clrings_v1_l6; - std::vector< std::vector< ElementLink< DataVector< xAOD::CaloRings_v1 > > > > clrings_v1_l7; - - // Instantiate sample used by xAOD::RingSet, so that - // Reflex would see them with their "correct type". Note that the - // dictionary for these types comes from other places. This instantiation - // is just needed for "Reflex related technical reasons"... - std::vector< CaloSampling::CaloSample > sample_vec; - -}; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODCALORINGS { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, RingSetContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, RingSetConfContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloRingsContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + std::vector< CaloSampling::CaloSample > sample_vec; + }; } // private namespace #endif // XAODCALORINGS_XAODCALORINGSDICT_H diff --git a/Event/xAOD/xAODCore/CMakeLists.txt b/Event/xAOD/xAODCore/CMakeLists.txt index 45b8e7b8d509882d4ea2f54841ac2da782c2b45e..dc2c153a0e782a64adde2f8b950e5ce7be88fbec 100644 --- a/Event/xAOD/xAODCore/CMakeLists.txt +++ b/Event/xAOD/xAODCore/CMakeLists.txt @@ -27,11 +27,15 @@ atlas_add_library( xAODCore LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks CxxUtils RootUtils ${extra_libs} ) -atlas_add_dictionary( xAODCoreRflxDict - xAODCore/xAODCoreRflxDict.h +atlas_add_dictionary( xAODCoreDict + xAODCore/xAODCoreDict.h xAODCore/selection.xml LINK_LIBRARIES xAODCore ) +atlas_add_dictionary( xAODCoreSTLDict + xAODCore/xAODCoreSTLDict.h + xAODCore/selectionSTL.xml ) + # Install the CMake code from the package: atlas_install_generic( cmake/xAODUtilitiesConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) diff --git a/Event/xAOD/xAODCore/xAODCore/selectionAthSuppress.xml b/Event/xAOD/xAODCore/xAODCore/selectionAthSuppress.xml deleted file mode 100644 index f8c523940e396093d59710bf971a41444146738c..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCore/xAODCore/selectionAthSuppress.xml +++ /dev/null @@ -1,12 +0,0 @@ - <exclusion> - <class name="std::vector<char>"/> - <class name="std::vector<signed char>"/> - <class name="std::vector<unsigned char>"/> - <class name="std::vector<unsigned int>"/> - <class name="std::vector<std::vector<char> >"/> - <class name="std::vector<std::vector<unsigned char> >"/> - <class name="std::vector<std::vector<int> >"/> - <class name="std::vector<std::vector<unsigned int> >"/> - <class name="std::vector<std::vector<float> >"/> - </exclusion> - diff --git a/Event/xAOD/xAODCore/xAODCore/selectionAthena.xml b/Event/xAOD/xAODCore/xAODCore/selectionAthena.xml deleted file mode 100644 index 3fe9ebb4aebed8dff7f22c6b3036f38a125f41a6..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCore/xAODCore/selectionAthena.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- $Id: selectionAthena.xml 572298 2013-11-25 15:22:26Z krasznaa $ --> -<lcgdict> - - <!-- These are dictionaries that we need until we can make proper use --> - <!-- of the ROOT CINT dictionaries while writing a POOL file. --> - - <class name="ROOT::Math::PtEtaPhiM4D<double>" > - <field name="fEta" iotype="Double32_t" /> - <field name="fM" iotype="Double32_t" /> - <field name="fPhi" iotype="Double32_t" /> - <field name="fPt" iotype="Double32_t" /> - </class> - <class name="ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> >" /> - - <exclusion> - <class name="ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> >" > - <method name="SetPz"/> - <method name="SetPy"/> - <method name="SetPx"/> - <method name="SetE"/> - </class> - </exclusion> - -</lcgdict> diff --git a/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml b/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml new file mode 100644 index 0000000000000000000000000000000000000000..214d4b5177a6cb64cb296a45b70472d76db54353 --- /dev/null +++ b/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml @@ -0,0 +1,55 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> +<lcgdict> + + <!-- "Single" vector type(s). --> + <class name="std::vector<char>" /> + <class name="std::vector<signed char>" /> + <class name="std::vector<unsigned char>" /> + <class name="std::vector<uint32_t>" /> + + <!-- "Double" vector type(s). --> + <class name="std::vector<std::vector<bool> >" /> + <class name="std::vector<std::vector<char> >" /> + <class name="std::vector<std::vector<signed char> >" /> + <class name="std::vector<std::vector<unsigned char> >" /> + <class name="std::vector<std::vector<int> >" /> + <class name="std::vector<std::vector<size_t> >" /> + <class name="std::vector<std::vector<uint16_t> >" /> + <class name="std::vector<std::vector<uint32_t> >" /> + <class name="std::vector<std::vector<unsigned long> >" /> + <class name="std::vector<std::vector<unsigned long long> >" /> + <class name="std::vector<std::vector<std::string> >" /> + + <!-- "Triple" vector type(s). --> + <class name="std::vector<std::vector<std::vector<int> > >" /> + <class name="std::vector<std::vector<std::vector<unsigned char> > >" /> + <class name="std::vector<std::vector<std::vector<size_t> > >" /> + <class name="std::vector<std::vector<std::vector<uint16_t> > >" /> + <class name="std::vector<std::vector<std::vector<uint32_t> > >" /> + <class name="std::vector<std::vector<std::vector<unsigned long> > >" /> + <class name="std::vector<std::vector<std::vector<unsigned long long> > >" /> + <class name="std::vector<std::vector<std::vector<float> > >" /> + <class name="std::vector<std::vector<std::vector<std::string> > >" /> + + <!-- "Quadruple" vector type(s). --> + <class name="std::vector<std::vector<std::vector<std::vector<std::string> > > >" /> + + <!-- "Special" vector type(s). --> + <class name="std::vector<std::set<uint32_t> >" /> + <class name="std::vector<std::vector<std::set<uint32_t> > >" /> + <class name="std::vector<std::pair<std::string,std::string> >" /> + <class name="std::vector<std::vector<std::pair<std::string,std::string> > >" /> + <class name="std::vector<std::vector<std::pair<unsigned int,double> > >" /> + + <!-- Map type(s). --> + <class name="std::map<std::string,std::vector<int> >" /> + <class name="std::map<std::string,std::vector<float> >" /> + <class name="std::map<std::string,std::vector<std::vector<int> > >" /> + <class name="std::map<std::string,std::vector<std::vector<float> > >" /> + + <!-- "Other" type(s). --> + <class name="std::bitset<3>" /> + <class name="std::bitset<11>" /> + <class name="std::set<uint32_t>" /> + +</lcgdict> diff --git a/Event/xAOD/xAODCore/xAODCore/tools/DictHelpers.h b/Event/xAOD/xAODCore/xAODCore/tools/DictHelpers.h index b19c04e1bc66f0eb7348f7f49bdb469bd81af783..e8c503b898815ceb6427eae1e0439c975002a192 100644 --- a/Event/xAOD/xAODCore/xAODCore/tools/DictHelpers.h +++ b/Event/xAOD/xAODCore/xAODCore/tools/DictHelpers.h @@ -13,4 +13,49 @@ // System include(s). #include <vector> +/// Macro instantiating all the container "interface" and smart pointer types +/// that we need a dictionary for. +#define XAOD_INSTANTIATE_CONTAINER_TYPES( TYPE ) \ + TYPE dummy_##TYPE##_1; \ + DataLink< TYPE > dummy_##TYPE##_2; \ + ElementLink< TYPE > dummy_##TYPE##_3; \ + std::vector< DataLink< TYPE > > dummy_##TYPE##_4; \ + std::vector< ElementLink< TYPE > > dummy_##TYPE##_5; \ + std::vector< std::vector< ElementLink< TYPE > > > dummy_##TYPE##_6; \ + SG::AuxTypeVectorFactory< DataLink< TYPE > > dummy_##TYPE##_7; \ + SG::AuxTypeVectorFactory< ElementLink< TYPE > > dummy_##TYPE##_8; \ + SG::AuxTypeVectorFactory< std::vector< ElementLink< TYPE > > > \ + dummy_##TYPE##_9 + +/// Macro instantiating all the container "interface" and smart pointer types +/// that we need a dictionary for. +#define XAOD_INSTANTIATE_NS_CONTAINER_TYPES( NS, TYPE ) \ + NS::TYPE dummy_##NS##_##TYPE##_1; \ + DataLink< NS::TYPE > dummy_##NS##_##TYPE##_2; \ + ElementLink< NS::TYPE > dummy_##NS##_##TYPE##_3; \ + std::vector< DataLink< NS::TYPE > > dummy_##NS##_##TYPE##_4; \ + std::vector< ElementLink< NS::TYPE > > dummy_##NS##_##TYPE##_5; \ + std::vector< std::vector< ElementLink< NS::TYPE > > > \ + dummy_##NS##_##TYPE##_6; \ + SG::AuxTypeVectorFactory< DataLink< NS::TYPE > > dummy_##NS##_##TYPE##_7; \ + SG::AuxTypeVectorFactory< ElementLink< NS::TYPE > > dummy_##NS##_##TYPE##_8;\ + SG::AuxTypeVectorFactory< std::vector< ElementLink< NS::TYPE > > > \ + dummy_##NS##_##TYPE##_9 + +/// Macro instantiating all the single object smart pointer types that we need +/// a dictionary for. +#define XAOD_INSTANTIATE_OBJECT_TYPES( TYPE ) \ + TYPE dummy_##TYPE##_1; \ + DataLink< TYPE > dummy_##TYPE##_2; \ + std::vector< DataLink< TYPE > > dummy_##TYPE##_3; \ + SG::AuxTypeVectorFactory< DataLink< TYPE > > dummy_##TYPE##_4 + +/// Macro instantiating all the single object smart pointer types that we need +/// a dictionary for. +#define XAOD_INSTANTIATE_NS_OBJECT_TYPES( NS, TYPE ) \ + NS::TYPE dummy_##NS##_##TYPE##_1; \ + DataLink< NS::TYPE > dummy_##NS##_##TYPE##_2; \ + std::vector< DataLink< NS::TYPE > > dummy_##NS##_##TYPE##_3; \ + SG::AuxTypeVectorFactory< DataLink< NS::TYPE > > dummy_##NS##_##TYPE##_4 + #endif // XAODCORE_TOOLS_DICTHELPERS_H diff --git a/Event/xAOD/xAODCore/xAODCore/xAODCoreAthenaDict.h b/Event/xAOD/xAODCore/xAODCore/xAODCoreAthenaDict.h deleted file mode 100644 index 4da729df26215567c696ba9fafac2f994d29f26e..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCore/xAODCore/xAODCoreAthenaDict.h +++ /dev/null @@ -1,25 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: xAODCoreAthenaDict.h 591472 2014-04-05 11:23:29Z krasznaa $ -#ifndef XAODCORE_XAODCOREATHENADICT_H -#define XAODCORE_XAODCOREATHENADICT_H - -// These are classes for which we need Reflex dictionaries just in Athena. - -// ROOT include(s): -#include <Rtypes.h> -#include <Math/Vector4D.h> - -#ifdef __GCCXML__ -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODCORE2 { - ROOT::Math::PtEtaPhiM4D< Double_t > dummy1; - ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< Double_t > > dummy2; - }; -} -#endif // __GCCXML__ -#endif // XAODCORE_XAODCOREATHENADICT_H diff --git a/Event/xAOD/xAODCore/xAODCore/xAODCoreDict.h b/Event/xAOD/xAODCore/xAODCore/xAODCoreDict.h index 5a238f659a20cd9bab54030a6cd3345a48ee92f0..9073a7f5fd1eb311511d8f46b1bd03a8d6bece06 100644 --- a/Event/xAOD/xAODCore/xAODCore/xAODCoreDict.h +++ b/Event/xAOD/xAODCore/xAODCore/xAODCoreDict.h @@ -1,18 +1,48 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODCoreDict.h 579782 2014-01-23 15:40:31Z krasznaa $ #ifndef XAODCORE_XAODCOREDICT_H #define XAODCORE_XAODCOREDICT_H -// This header is here for technical reasons. It is needed for a -// successful RootCore compilation. (But it would mess up if used -// in a CMT compilation.) +// System include(s): +#include <vector> +extern "C" { +# include <stdint.h> +} + +// ROOT include(s): +#include <Rtypes.h> +#include <Math/Vector4D.h> + +// EDM include(s): +#include "AthContainers/DataVector.h" // Local include(s): -#include "xAODCore/xAODCoreRflxDict.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/AuxInfoBase.h" +#include "xAODCore/ShallowAuxContainer.h" +#include "xAODCore/ShallowAuxInfo.h" +#include "xAODCore/tools/TDVCollectionProxy.h" +#include "xAODCore/tools/PrintHelpers.h" + +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODCORE { + DataVector< xAOD::TDVCollectionProxyDummy > dummy1; + // Instantiations necessary for the std::vector<ROOT::Math::LorentzVector> + // dictionary: + ROOT::Math::PtEtaPhiM4D< Double_t > root1; + ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< Double_t > > root2; + std::vector< ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< Double_t > > > root3; + // Additional ROOT-only dictionaries: + std::vector< unsigned char > root4; + std::vector< std::vector< unsigned char > > root5; + std::vector<signed char> root6; + std::vector< std::vector<signed char> > root7; + std::vector< std::vector<char> > root8; + std::vector< uint32_t > root9; + std::vector< std::vector< uint32_t > > root10; + }; +} // private namespace #endif // XAODCORE_XAODCOREDICT_H diff --git a/Event/xAOD/xAODCore/xAODCore/xAODCoreRflxDict.h b/Event/xAOD/xAODCore/xAODCore/xAODCoreRflxDict.h deleted file mode 100644 index 4fa44cc1249f4890a0f624782f8c182357b3d7de..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODCore/xAODCore/xAODCoreRflxDict.h +++ /dev/null @@ -1,51 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: xAODCoreRflxDict.h 750677 2016-05-30 10:24:50Z krasznaa $ -#ifndef XAODCORE_XAODCORERFLXDICT_H -#define XAODCORE_XAODCORERFLXDICT_H - -// System include(s): -#include <vector> -extern "C" { -# include <stdint.h> -} - -// ROOT include(s): -#include <Rtypes.h> -#include <Math/Vector4D.h> - -// EDM include(s): -#include "AthContainers/DataVector.h" - -// Local include(s): -#include "xAODCore/AuxContainerBase.h" -#include "xAODCore/AuxInfoBase.h" -#include "xAODCore/ShallowAuxContainer.h" -#include "xAODCore/ShallowAuxInfo.h" -#include "xAODCore/tools/TDVCollectionProxy.h" -#include "xAODCore/tools/PrintHelpers.h" - -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODCORE1 { - DataVector< xAOD::TDVCollectionProxyDummy > dummy1; - // Instantiations necessary for the std::vector<ROOT::Math::LorentzVector> - // dictionary: - ROOT::Math::PtEtaPhiM4D< Double_t > root1; - ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< Double_t > > root2; - std::vector< ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< Double_t > > > root3; - // Additional ROOT-only dictionaries: - std::vector< unsigned char > root4; - std::vector< std::vector< unsigned char > > root5; - std::vector<signed char> root6; - std::vector< std::vector<signed char> > root7; - std::vector< std::vector<char> > root8; - std::vector< uint32_t > root9; - std::vector< std::vector< uint32_t > > root10; - }; -} // private namespace - -#endif // XAODCORE_XAODCORERFLXDICT_H diff --git a/Event/xAOD/xAODCore/xAODCore/xAODCoreSTLDict.h b/Event/xAOD/xAODCore/xAODCore/xAODCoreSTLDict.h new file mode 100644 index 0000000000000000000000000000000000000000..a1decebaf9173f7c1599927a26274f67374c3466 --- /dev/null +++ b/Event/xAOD/xAODCore/xAODCore/xAODCoreSTLDict.h @@ -0,0 +1,73 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODCORE_XAODCORESTLDICT_H +#define XAODCORE_XAODCORESTLDICT_H + +// System include(s). +#include <bitset> +#include <cstdint> +#include <map> +#include <set> +#include <string> +#include <vector> + +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODCORESTL { + + // "Single" vector type(s). + std::vector< char > stl_v1; + std::vector< signed char > stl_v2; + std::vector< unsigned char > stl_v3; + std::vector< uint32_t > stl_v4; + + // "Double" vector type(s). + std::vector< std::vector< bool > > stl_vv1; + std::vector< std::vector< char > > stl_vv2; + std::vector< std::vector< signed char > > stl_vv3; + std::vector< std::vector< unsigned char > > stl_vv4; + std::vector< std::vector< int > > stl_vv5; + std::vector< std::vector< size_t > > stl_vv6; + std::vector< std::vector< uint16_t > > stl_vv7; + std::vector< std::vector< uint32_t > > stl_vv8; + std::vector< std::vector< unsigned long > > stl_vv9; + std::vector< std::vector< unsigned long long > > stl_vv10; + std::vector< std::vector< std::string > > stl_vv11; + + // "Triple" vector type(s). + std::vector< std::vector< std::vector< int > > > stl_vvv1; + std::vector< std::vector< std::vector< unsigned char > > > stl_vvv2; + std::vector< std::vector< std::vector< size_t > > > stl_vvv3; + std::vector< std::vector< std::vector< uint16_t > > > stl_vvv4; + std::vector< std::vector< std::vector< uint32_t > > > stl_vvv5; + std::vector< std::vector< std::vector< unsigned long > > > stl_vvv6; + std::vector< std::vector< std::vector< unsigned long long > > > stl_vvv7; + std::vector< std::vector< std::vector< float > > > stl_vvv8; + std::vector< std::vector< std::vector< std::string > > > stl_vvv9; + + // "Quadruple" vector type(s). + std::vector< std::vector< std::vector< std::vector< std::string > > > > + stl_vvvv1; + + // "Special" vector type(s). + std::vector< std::set< uint32_t > > stl_sv1; + std::vector< std::vector< std::set< uint32_t > > > stl_sv2; + std::vector< std::pair< std::string, std::string > > stl_sv3; + std::vector< std::vector< std::pair< std::string, std::string > > > stl_sv4; + std::vector< std::vector< std::pair< unsigned int, double > > > stl_sv5; + + // Map type(s). + std::map< std::string, std::vector< int > > stl_m1; + std::map< std::string, std::vector< float > > stl_m2; + std::map< std::string, std::vector< std::vector< int > > > stl_m3; + std::map< std::string, std::vector< std::vector< float > > > stl_m4; + + // "Other" type(s). + std::bitset< 3 > stl_o1; // 3 == CaloCluster::NSTATES + std::bitset< 11 > stl_o2; // 11 == xAOD::NumberOfTrackRecoInfo + std::set< uint32_t > stl_o3; + }; +} + +#endif // XAODCORE_XAODCORESTLDICT_H diff --git a/Event/xAOD/xAODCutFlow/xAODCutFlow/xAODCutFlowDict.h b/Event/xAOD/xAODCutFlow/xAODCutFlow/xAODCutFlowDict.h index 2de68b28bd85862a9bd25eb7453f123379b4afd2..ed07a009729182bd9474adf251e5b4d4082f67d5 100644 --- a/Event/xAOD/xAODCutFlow/xAODCutFlow/xAODCutFlowDict.h +++ b/Event/xAOD/xAODCutFlow/xAODCutFlow/xAODCutFlowDict.h @@ -18,4 +18,12 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODCUTFLOW { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CutBookkeeperContainer_v1 ); + }; +} + #endif // XAODCUTFLOW_XAODCUTFLOWDICT_H diff --git a/Event/xAOD/xAODEgamma/CMakeLists.txt b/Event/xAOD/xAODEgamma/CMakeLists.txt index e1659e43fec256ed5834a84520dd418359996367..67cc3c2c713b79d45eceab56759e62a120935ff2 100644 --- a/Event/xAOD/xAODEgamma/CMakeLists.txt +++ b/Event/xAOD/xAODEgamma/CMakeLists.txt @@ -1,47 +1,29 @@ -# $Id$ -################################################################################ -# Package: xAODEgamma -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( xAODEgamma ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - DetectorDescription/GeoPrimitives - Event/EventPrimitives - Event/xAOD/xAODBase - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODCore - Event/xAOD/xAODPrimitives - Event/xAOD/xAODTracking - Event/xAOD/xAODTruth ) - -# External dependencies: -find_package( Eigen ) +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) - -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() +find_package( xAODUtilities ) # Component(s) in the package: atlas_add_library( xAODEgamma xAODEgamma/*.h xAODEgamma/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODEgamma - INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthLinks - GeoPrimitives EventPrimitives xAODBase xAODCaloEvent xAODCore - xAODPrimitives xAODTracking xAODTruth ${extra_libs} ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks GeoPrimitives + EventPrimitives xAODBase xAODCaloEvent xAODCore xAODPrimitives xAODTracking + xAODTruth ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODEgamma/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::EgammaContainer_v1" "xAOD::ElectronContainer_v1" + "xAOD::PhotonContainer_v1" ) atlas_add_dictionary( xAODEgammaDict xAODEgamma/xAODEgammaDict.h - xAODEgamma/selection.xml - LINK_LIBRARIES xAODEgamma + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODEgamma EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx index 0d3506586a3d243b5d929ff76638815ee8f646de..7bafae29c31145972105cc4d174998e6ade3db44 100644 --- a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx +++ b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx @@ -15,12 +15,50 @@ // ================================================================== -const xAOD::Electron* xAOD::EgammaHelpers::getRecoElectron(const xAOD::TruthParticle* particle){ - return getLink<xAOD::Electron>(particle, "recoElectronLink"); +/// Accessor for the "recoElectronLink" dynamic variable +/// +/// It is declared outside of the @c xAOD::EgammaHelpers::getRecoElectron(...) +/// call to make sure that the auxiliary ID registry would know about this type +/// as soon as the library holding this code is loaded. +/// +static const SG::AuxElement::Accessor< ElementLink< xAOD::ElectronContainer > > + recoElectronLinkAcc( "recoElectronLink" ); + +const xAOD::Electron* +xAOD::EgammaHelpers::getRecoElectron( const xAOD::TruthParticle* particle ) { + + if( ! recoElectronLinkAcc.isAvailable( *particle ) ) { + return nullptr; + } + const ElementLink< xAOD::ElectronContainer >& link = + recoElectronLinkAcc( *particle ); + if( ! link.isValid() ) { + return nullptr; + } + return *link; } -const xAOD::Photon* xAOD::EgammaHelpers::getRecoPhoton(const xAOD::TruthParticle* particle){ - return getLink<xAOD::Photon>(particle, "recoPhotonLink"); +/// Accessor for the "recoPhotonLink" dynamic variable +/// +/// It is declared outside of the @c xAOD::EgammaHelpers::getRecoPhoton(...) +/// call to make sure that the auxiliary ID registry would know about this type +/// as soon as the library holding this code is loaded. +/// +static const SG::AuxElement::Accessor< ElementLink< xAOD::PhotonContainer > > + recoPhotonLinkAcc( "recoPhotonLink" ); + +const xAOD::Photon* +xAOD::EgammaHelpers::getRecoPhoton( const xAOD::TruthParticle* particle ) { + + if( ! recoPhotonLinkAcc.isAvailable( *particle ) ) { + return nullptr; + } + const ElementLink< xAOD::PhotonContainer >& link = + recoPhotonLinkAcc( *particle ); + if( ! link.isValid() ) { + return nullptr; + } + return *link; } // ================================================================== diff --git a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx index 32ef4d44e6252e30783f2ca3e805401e63dd98cb..9f5c2e0304077bd374354b6e98220d7dbe734bbe 100644 --- a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx @@ -2,8 +2,6 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: Egamma_v1$ - // EDM include(s): #include "xAODCore/AuxStoreAccessorMacros.h" // Local include(s): @@ -183,13 +181,26 @@ void Egamma_v1::setAuthor(uint16_t newAuthor) { acc(*this) = newAuthor; } +/// Accessor for the "ambiguityLink" dynamic variable +/// +/// It is declared outside of the @c xAOD::Egamma_v1::ambiguousObject() call to +/// make sure that the auxiliary ID registry would know about this type as soon +/// as the library holding this code is loaded. +/// +static const SG::AuxElement::Accessor< ElementLink< xAOD::EgammaContainer > > + ambiguityLinkAcc( "ambiguityLink" ); + /// ambiguous -const Egamma_v1* Egamma_v1::ambiguousObject() const{ - static const SG::AuxElement::Accessor<ElementLink<xAOD::EgammaContainer> > acc("ambiguityLink"); - if(acc.isAvailable(*this) && acc(*this).isValid()){ - return (*acc(*this)); - } - return nullptr; +const Egamma_v1* Egamma_v1::ambiguousObject() const { + + if( ! ambiguityLinkAcc.isAvailable( *this ) ) { + return nullptr; + } + const ElementLink< xAOD::EgammaContainer >& link = ambiguityLinkAcc( *this ); + if( ! link.isValid() ) { + return nullptr; + } + return *link; } diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml b/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml index e9fe8311ccab142b45ac9202780ce1a85d14a147..b9fe932f106567ab5aca25fb6ca3d8f5411c6382 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml +++ b/Event/xAOD/xAODEgamma/xAODEgamma/selection.xml @@ -1,99 +1,65 @@ -<!-- $Id: selection.xml 789134 2016-12-11 02:15:53Z christos $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- Egamma_v1 dictionaries: --> - <class name="xAOD::Egamma_v1" /> - - <class name="xAOD::EgammaContainer_v1" - id="CE53CD7A-0B8E-44F5-9AB1-997E87713BC5" /> - - <class name="xAOD::EgammaAuxContainer_v1" - id="01A7F3AA-D5CA-4FCF-A314-20F822FF6CA0" /> - - <!-- Smart pointers to Egamma_v1: --> - <class name="DataLink<xAOD::EgammaContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::EgammaContainer_v1> >" /> - <class name="ElementLink<xAOD::EgammaContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::EgammaContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::EgammaContainer_v1> > >" /> - <class name="SG::AuxTypeVectorFactory<ElementLink< xAOD::EgammaContainer_v1 > >"/> - - <!-- Electron_v1 dictionaries: --> - <class name="xAOD::Electron_v1" > - </class> - <class name="xAOD::ElectronContainer_v1" - id="9CA52CF4-E219-45B8-9971-6DAA89125952" /> - <class name="xAOD::ElectronAuxContainer_v1" - id="85A46300-3F57-454C-8B7E-94B653AA70CF" /> - - <!-- Electron_v2 dictionaries: --> - <class name="xAOD::ElectronAuxContainer_v2" - id="7160FC1C-937D-474C-909B-2C0FCE1DD755" /> - - <!-- Electron_v3 dictionaries: --> - <class name="xAOD::ElectronAuxContainer_v3" - id="5435686E-4B00-11E4-AEAA-02163E00A5BB" /> - - <!-- Smart pointers to Electron_v1: --> - <class name="DataLink<xAOD::ElectronContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::ElectronContainer_v1> >" /> - <class name="ElementLink<xAOD::ElectronContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::ElectronContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::ElectronContainer_v1> > >" /> - - <!-- Photon_v1 dictionaries: --> - <class name="xAOD::Photon_v1" > - </class> - <class name="xAOD::PhotonContainer_v1" - id="5F045AAE-DBD8-47E4-90AC-9162530A9565" /> - <class name="xAOD::PhotonAuxContainer_v1" - id="67A1818E-4591-4100-B8BD-9A3C9E0D4EBB" /> - - <!-- Photon_v2 dictionaries: --> - <class name="xAOD::PhotonAuxContainer_v2" - id="CAE4C9A6-B3D0-429B-9A4F-1F174D892CA5" /> - - <!-- Photon_v3 dictionaries: --> - <class name="xAOD::PhotonAuxContainer_v3" - id="5C389DEC-4B00-11E4-B9F0-02163E00A5BB" /> - - - <!-- Smart pointers to Photon_v1: --> - <class name="DataLink<xAOD::PhotonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::PhotonContainer_v1> >" /> - <class name="ElementLink<xAOD::PhotonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::PhotonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::PhotonContainer_v1> > >" /> - - <!-- Objects from the namespace --> - <variable pattern="xAOD::EgammaParameters::*" /> - <class name="xAOD::EgammaParameters::ROOT6_NamespaceAutoloadHook" /> - - <!-- Enums --> - <enum pattern="xAOD::EgammaParameters::*" /> - - <!--Add Helper Functions --> - <function pattern="xAOD::EgammaHelpers::*" /> - - <!--Returned by helper functions --> - <class name="std::set<const xAOD::TrackParticle*>" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class pattern="xAOD::TrackParticle*" /> - <class pattern="DataVector<xAOD::TrackParticle*" /> - <class pattern="ElementLink<DataVector<xAOD::TrackParticle*" /> - <class pattern="xAOD::Vertex*" /> - <class pattern="DataVector<xAOD::Vertex*" /> - <class pattern="ElementLink<DataVector<xAOD::Vertex*" /> - <class pattern="xAOD::CaloCluster*" /> - <class pattern="DataVector<xAOD::CaloCluster*" /> - <class pattern="ElementLink<DataVector<xAOD::CaloCluster*" /> - <function pattern="xAOD::EgammaHelpers::getLink*" /> - </exclusion> - + <!-- xAOD::Egamma interface type(s). --> + <class name="xAOD::Egamma_v1" /> + <class name="xAOD::EgammaContainer_v1" + id="CE53CD7A-0B8E-44F5-9AB1-997E87713BC5" /> + <typedef name="xAOD::Egamma" /> + <typedef name="xAOD::EgammaContainer" /> + + <!-- xAOD::Egamma auxiliary type(s). --> + <class name="xAOD::EgammaAuxContainer_v1" + id="01A7F3AA-D5CA-4FCF-A314-20F822FF6CA0" /> + <typedef name="xAOD::EgammaAuxContainer" /> + + <!-- xAOD::Electron interface type(s). --> + <class name="xAOD::Electron_v1" /> + <class name="xAOD::ElectronContainer_v1" + id="9CA52CF4-E219-45B8-9971-6DAA89125952" /> + <typedef name="xAOD::Electron" /> + <typedef name="xAOD::ElectronContainer" /> + + <!-- xAOD::Electron auxiliary type(s). --> + <class name="xAOD::ElectronAuxContainer_v1" + id="85A46300-3F57-454C-8B7E-94B653AA70CF" /> + <class name="xAOD::ElectronAuxContainer_v2" + id="7160FC1C-937D-474C-909B-2C0FCE1DD755" /> + <class name="xAOD::ElectronAuxContainer_v3" + id="5435686E-4B00-11E4-AEAA-02163E00A5BB" /> + <typedef name="xAOD::ElectronAuxContainer" /> + + <!-- xAOD::Photon interface type(s). --> + <class name="xAOD::Photon_v1" /> + <class name="xAOD::PhotonContainer_v1" + id="5F045AAE-DBD8-47E4-90AC-9162530A9565" /> + <typedef name="xAOD::Photon" /> + <typedef name="xAOD::PhotonContainer" /> + + <!-- xAOD::Photon auxiliary type(s). --> + <class name="xAOD::PhotonAuxContainer_v1" + id="67A1818E-4591-4100-B8BD-9A3C9E0D4EBB" /> + <class name="xAOD::PhotonAuxContainer_v2" + id="CAE4C9A6-B3D0-429B-9A4F-1F174D892CA5" /> + <class name="xAOD::PhotonAuxContainer_v3" + id="5C389DEC-4B00-11E4-B9F0-02163E00A5BB" /> + <typedef name="xAOD::PhotonAuxContainer" /> + + <!-- Objects from the namespace. --> + <variable pattern="xAOD::EgammaParameters::*" /> + <class name="xAOD::EgammaParameters::ROOT6_NamespaceAutoloadHook" /> + + <!-- Enum(s). --> + <enum pattern="xAOD::EgammaParameters::*" /> + + <!-- Helper Function(s). --> + <function pattern="xAOD::EgammaHelpers::*" /> + + <!-- Type returned by helper function(s). --> + <class name="std::set<const xAOD::TrackParticle*>" /> + + <!-- Suppress the unwanted classes/symbols. --> + <exclusion> + <function pattern="xAOD::EgammaHelpers::getLink*" /> + </exclusion> </lcgdict> diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h b/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h index 5958e037fafecff25fae1eba301b77818bc7ffd5..02ac71800c800fd5bdeb3c592bd30d00cf730cd1 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h +++ b/Event/xAOD/xAODEgamma/xAODEgamma/xAODEgammaDict.h @@ -1,37 +1,31 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODEgammaDict.h 789134 2016-12-11 02:15:53Z christos $ #ifndef XAODEGAMMA_XAODEGAMMADICT_H #define XAODEGAMMA_XAODEGAMMADICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - // Local include(s): +#include "xAODEgamma/Egamma.h" #include "xAODEgamma/EgammaContainer.h" +#include "xAODEgamma/EgammaAuxContainer.h" +#include "xAODEgamma/versions/Egamma_v1.h" #include "xAODEgamma/versions/EgammaContainer_v1.h" #include "xAODEgamma/versions/EgammaAuxContainer_v1.h" +#include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/ElectronAuxContainer.h" +#include "xAODEgamma/versions/Electron_v1.h" #include "xAODEgamma/versions/ElectronContainer_v1.h" #include "xAODEgamma/versions/ElectronAuxContainer_v1.h" #include "xAODEgamma/versions/ElectronAuxContainer_v2.h" #include "xAODEgamma/versions/ElectronAuxContainer_v3.h" +#include "xAODEgamma/Photon.h" #include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/versions/Photon_v1.h" #include "xAODEgamma/versions/PhotonContainer_v1.h" #include "xAODEgamma/versions/PhotonAuxContainer_v1.h" #include "xAODEgamma/versions/PhotonAuxContainer_v2.h" @@ -43,46 +37,24 @@ #include "xAODEgamma/EgammaTruthxAODHelpers.h" #include "xAODEgamma/EgammaEnums.h" #include "xAODEgamma/EgammaDefs.h" -#include "AthContainers/tools/AuxTypeVectorFactory.h" -namespace { -struct GCCXML_DUMMY_INSTANTIATION_XAODEGAMMA { - xAOD::EgammaContainer_v1 eg_c1; - DataLink< xAOD::EgammaContainer_v1 > eg_l1; - ElementLink< xAOD::EgammaContainer_v1 > eg_l2; - std::vector< DataLink< xAOD::EgammaContainer_v1 > > eg_l3; - std::vector< ElementLink< xAOD::EgammaContainer_v1 > > eg_l4; - std::vector< std::vector< ElementLink< xAOD::EgammaContainer_v1 > > > eg_l5; - SG::AuxTypeVectorFactory<ElementLink< xAOD::EgammaContainer_v1 > > eg_l6; - - xAOD::ElectronContainer_v1 el_c1; - DataLink< xAOD::ElectronContainer_v1 > el_l1; - ElementLink< xAOD::ElectronContainer_v1 > el_l2; - std::vector< ElementLink< xAOD::ElectronContainer_v1 > > el_l3; - std::vector< DataLink< xAOD::ElectronContainer_v1 > > el_l4; - std::vector< std::vector< ElementLink< xAOD::ElectronContainer_v1 > > > el_l5; - - xAOD::PhotonContainer_v1 ph_c1; - DataLink< xAOD::PhotonContainer_v1 > ph_l1; - ElementLink< xAOD::PhotonContainer_v1 > ph_l2; - std::vector< ElementLink< xAOD::PhotonContainer_v1 > > ph_l3; - std::vector< DataLink< xAOD::PhotonContainer_v1 > > ph_l4; - std::vector< std::vector< ElementLink < xAOD::PhotonContainer_v1 > > > ph_l5; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - // Instantiate the classes used by xAOD::Electron, xAODPhoton so that - // Reflex would see them with their "correct type". Note that the - // dictionary for these types comes from other places. This instantiation - // is just needed for "Reflex related technical reasons"...OA - ElementLink< xAOD::TrackParticleContainer > auxlink1; - std::vector< ElementLink< xAOD::TrackParticleContainer > > auxlink2; - ElementLink< xAOD::CaloClusterContainer > auxlink3; - std::vector< ElementLink< xAOD::CaloClusterContainer > > auxlink4; - ElementLink< xAOD::VertexContainer > auxlink5; - std::vector< ElementLink< xAOD::VertexContainer > > auxlink6; - - std::set<const xAOD::TrackParticle*> setTP; - -}; +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODEGAMMA { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, EgammaContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, ElectronContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, PhotonContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloClusterContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, VertexContainer ); + // Type returned by helper function(s). + std::set< const xAOD::TrackParticle* > setTP; + }; } #endif // XAODEGAMMA_XAODEGAMMADICT_H diff --git a/Event/xAOD/xAODEventInfo/CMakeLists.txt b/Event/xAOD/xAODEventInfo/CMakeLists.txt index 8d096f0b68e16c1314c01041f37209b63f8e7980..dbeda530389898b05db47e1f627ca821dca55675 100644 --- a/Event/xAOD/xAODEventInfo/CMakeLists.txt +++ b/Event/xAOD/xAODEventInfo/CMakeLists.txt @@ -1,35 +1,31 @@ -################################################################################ -# Package: xAODEventInfo -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODEventInfo ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PRIVATE - AtlasTest/TestTools - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODCore ) - -# External dependencies: +# External dependencies. find_package( ROOT COMPONENTS Core Tree RIO ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODEventInfo - xAODEventInfo/*.h Root/*.cxx + xAODEventInfo/versions/*.h xAODEventInfo/*.h Root/*.cxx PUBLIC_HEADERS xAODEventInfo LINK_LIBRARIES AthContainers AthLinks xAODCore ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODEventInfo/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::EventInfoContainer_v1" + OBJECTS "xAOD::EventInfo_v1" ) + atlas_add_dictionary( xAODEventInfoDict xAODEventInfo/xAODEventInfoDict.h - xAODEventInfo/selection.xml - LINK_LIBRARIES xAODEventInfo + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODEventInfo EXTRA_FILES Root/dict/*.cxx ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( ut_xaodeventinfo_evtstore_test SOURCES test/ut_xaodeventinfo_evtstore_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} @@ -47,12 +43,12 @@ atlas_add_test( ut_xaodeventinfo_subevent_test atlas_add_test( ut_xaodeventinfo_eventauxinfo_test SOURCES test/ut_xaodeventinfo_eventauxinfo_test.cxx - LINK_LIBRARIES AthLinks xAODCore xAODEventInfo TestTools ) + LINK_LIBRARIES AthContainers TestTools xAODEventInfo ) atlas_add_test( ut_xaodeventinfo_eventinfoauxcontainer_v1_test SOURCES test/ut_xaodeventinfo_eventinfoauxcontainer_v1_test.cxx - LINK_LIBRARIES AthLinks xAODCore xAODEventInfo TestTools ) + LINK_LIBRARIES AthContainers TestTools xAODEventInfo ) atlas_add_test( ut_xaodeventinfo_eventinfo_v1_test SOURCES test/ut_xaodeventinfo_eventinfo_v1_test.cxx - LINK_LIBRARIES AthLinks xAODCore xAODEventInfo ) + LINK_LIBRARIES xAODEventInfo ) diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/selection.xml b/Event/xAOD/xAODEventInfo/xAODEventInfo/selection.xml index df7f3851026484c9bf03e296f25ddf268b3ac80c..d8b5c399a9b2cf2e958d6e30940efdee0a74c53c 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/selection.xml +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/selection.xml @@ -1,6 +1,7 @@ <!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> + <!-- xAOD::EventInfo interface type(s). --> <class name="xAOD::EventInfo_v1" id="AE8BED6D-1D41-4CAF-994B-42613FC91A0A" > <field name="m_streamTags" transient="true" /> @@ -15,7 +16,12 @@ newObj->toTransient(); ]]> </read> + <class name="xAOD::EventInfoContainer_v1" + id="8F061263-D744-4D72-9377-1573FE21CDCE" /> + <typedef name="xAOD::EventInfo" /> + <typedef name="xAOD::EventInfoContainer" /> + <!-- xAOD::EventInfo auxiliary type(s). --> <class name="xAOD::EventAuxInfo_v1" id="2CFD72A2-D3AA-4C18-9B40-E5ACBA20D785"> <field name="m_decorFlags" transient="true" /> @@ -38,9 +44,6 @@ ]]> </read> - <class name="xAOD::EventInfoContainer_v1" - id="8F061263-D744-4D72-9377-1573FE21CDCE" /> - <class name="xAOD::EventInfoAuxContainer_v1" id="742479C0-2699-4949-A9D0-01DBC421BE5B"> <field name="m_decorFlags" transient="true" /> @@ -52,27 +55,7 @@ ]]> </read> - <!-- Smart pointer dictionaries: --> - <class name="DataLink<xAOD::EventInfo_v1>" /> - <class name="std::vector<DataLink<xAOD::EventInfo_v1> >" /> - - <class name="ElementLink<xAOD::EventInfoContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::EventInfoContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::EventInfoContainer_v1> > >" /> - - <!-- Additional dictionaries for the payload: --> - <!-- MN: removing class name="std::pair<std::string,std::string>" as it is already in RELAX --> - <class name="std::vector<std::pair<std::string,std::string> >" /> - <class name="std::vector<std::vector<std::pair<std::string,std::string> > >" /> - <class name="std::set<uint32_t>" /> - <class name="std::vector<std::set<uint32_t> >" /> - <class name="std::vector<std::vector<std::set<unsigned> > >" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - </exclusion> + <typedef name="xAOD::EventAuxInfo" /> + <typedef name="xAOD::EventInfoAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/selectionAthSuppress.xml b/Event/xAOD/xAODEventInfo/xAODEventInfo/selectionAthSuppress.xml deleted file mode 100644 index 49435cfbbe55d9d31a2da1cfbe6fd4b126b280dc..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/selectionAthSuppress.xml +++ /dev/null @@ -1,4 +0,0 @@ -<exclusion> - <class name="std::set<uint32_t>" /> - <class name="std::vector<std::pair<std::string,std::string> >" /> -</exclusion> diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/xAODEventInfoDict.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/xAODEventInfoDict.h index 95aa563f9e7bdadd3bfc81524461e7506a27f193..273f8bf432ef350a4c58765190aeb769ce4b8a26 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/xAODEventInfoDict.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/xAODEventInfoDict.h @@ -1,23 +1,13 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODEventInfoDict.h 630576 2014-11-24 12:36:44Z krasznaa $ #ifndef XAODEVENTINFO_XAODEVENTINFODICT_H #define XAODEVENTINFO_XAODEVENTINFODICT_H -// System include(s): -#include <vector> -#include <set> - -// EDM include(s): -#include "AthLinks/ElementLink.h" -#include "AthLinks/DataLink.h" - -// Local include(s): +// Local include(s). #include "xAODEventInfo/EventInfo.h" +#include "xAODEventInfo/EventAuxInfo.h" #include "xAODEventInfo/EventInfoContainer.h" #include "xAODEventInfo/versions/EventInfo_v1.h" #include "xAODEventInfo/versions/EventAuxInfo_v1.h" @@ -25,21 +15,15 @@ #include "xAODEventInfo/versions/EventInfoContainer_v1.h" #include "xAODEventInfo/versions/EventInfoAuxContainer_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODEVENTINFO { - - xAOD::EventInfoContainer_v1 c1; - - DataLink< xAOD::EventInfo_v1 > dl1; - std::vector< DataLink< xAOD::EventInfo_v1 > > dl2; - - ElementLink< xAOD::EventInfoContainer_v1 > el1; - std::vector< ElementLink< xAOD::EventInfoContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::EventInfoContainer_v1 > > > el3; - - std::set< uint32_t > set1; - std::vector< std::set< uint32_t > > set2; - + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, EventInfoContainer_v1 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, EventInfo_v1 ); }; } // private namespace diff --git a/Event/xAOD/xAODEventShape/xAODEventShape/xAODEventShapeDict.h b/Event/xAOD/xAODEventShape/xAODEventShape/xAODEventShapeDict.h index 76b2cacf40e77a76cf75293643dca40dbfe84af6..640ade665ee303a2de4842420d2148bb46b637bf 100644 --- a/Event/xAOD/xAODEventShape/xAODEventShape/xAODEventShapeDict.h +++ b/Event/xAOD/xAODEventShape/xAODEventShape/xAODEventShapeDict.h @@ -14,4 +14,12 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODEVENTSHAPE { + // Local type(s). + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, EventShape_v1 ); + }; +} + #endif // XAODEVENTSHAPE_XAODEVENTSHAPEDICT_H diff --git a/Event/xAOD/xAODForward/xAODForward/xAODForwardDict.h b/Event/xAOD/xAODForward/xAODForward/xAODForwardDict.h index 8ff5083ab832a6493019fb88c2983190a7972316..db909621bc8c091c2dc5b219a616a3e0d8f40b5f 100644 --- a/Event/xAOD/xAODForward/xAODForward/xAODForwardDict.h +++ b/Event/xAOD/xAODForward/xAODForward/xAODForwardDict.h @@ -75,4 +75,30 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODFORWARD { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPDataContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPToFHitContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPSiHitContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPSiHitContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPSiHitsClusterContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPTrackContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPTrackContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, AFPProtonContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, ALFADataContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, ZdcModuleContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MBTSModuleContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, ForwardEventInfoContainer_v1 ); + + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TriggerTowerContainer ); + }; +} + #endif // XAODFORWARD_XAODFORWARDDICT_H diff --git a/Event/xAOD/xAODHIEvent/xAODHIEvent/xAODHIEventDict.h b/Event/xAOD/xAODHIEvent/xAODHIEvent/xAODHIEventDict.h index 922dd5699368fd6970e647594d1f48b73d4be582..f6288ac13b686da730e3861efd2d16b362ae1791 100644 --- a/Event/xAOD/xAODHIEvent/xAODHIEvent/xAODHIEventDict.h +++ b/Event/xAOD/xAODHIEvent/xAODHIEvent/xAODHIEventDict.h @@ -19,4 +19,13 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODHIEVENT { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, HIEventShapeContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, HIEventShapeContainer_v2 ); + }; +} + #endif // XAODEVENTINFO_XAODEVENTINFODICT_H diff --git a/Event/xAOD/xAODJet/CMakeLists.txt b/Event/xAOD/xAODJet/CMakeLists.txt index ffb4340a36bc8744a7f045b716ab7259ee6e8201..1e14f3ca880e9b78dad0aaa69137366716958e3a 100644 --- a/Event/xAOD/xAODJet/CMakeLists.txt +++ b/Event/xAOD/xAODJet/CMakeLists.txt @@ -4,9 +4,7 @@ atlas_subdir( xAODJet ) # Optional dependencies: -set( extra_deps ) set( extra_libs ) -set( extra_private_deps ) set( extra_test_libs ) # Extra dependencies, when we are not in a standalone build: @@ -16,17 +14,15 @@ else() set( extra_test_libs xAODRootAccess ) endif() +set( extra_srcs ) if( NOT SIMULATIONBASE AND NOT GENERATIONBASE ) set( extra_srcs Root/JetTrigAuxContainer*.cxx ) set( extra_libs xAODBTagging xAODPFlow xAODTrigger ) endif() -if( BUILDVP1LIGHT AND ( BUILDVP1LIGHT_DIST STREQUAL "ubuntu" ) ) - list( APPEND extra_libs GenVector ) -endif() - # External dependencies: find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) # Component(s) in the package: atlas_add_library( xAODJet @@ -39,10 +35,15 @@ atlas_add_library( xAODJet xAODBase xAODCore ${extra_libs} PRIVATE_LINK_LIBRARIES CxxUtils xAODCaloEvent ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODJet/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::JetContainer_v1" ) + atlas_add_dictionary( xAODJetDict xAODJet/xAODJetDict.h - xAODJet/selection.xml - LINK_LIBRARIES xAODJet ${extra_libs} + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODJet EXTRA_FILES Root/dict/*.cxx ) # Test(s) in the package: diff --git a/Event/xAOD/xAODJet/src/JetTrigAuxContainer_v2.cxx b/Event/xAOD/xAODJet/src/JetTrigAuxContainer_v2.cxx deleted file mode 100644 index 0dfba36705a0b74ae7ecc4022080c45da0241b52..0000000000000000000000000000000000000000 --- a/Event/xAOD/xAODJet/src/JetTrigAuxContainer_v2.cxx +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - - -// Local include(s): -#include "xAODJet/versions/JetTrigAuxContainer_v2.h" - -namespace xAOD { - - JetTrigAuxContainer_v2::JetTrigAuxContainer_v2() - : ByteStreamAuxContainer_v1() { - - AUX_VARIABLE( momentum ); - AUX_VARIABLE( constituentLinks ); - AUX_VARIABLE( GhostTrack ); - AUX_VARIABLE( constituentWeights ); - } - -} // namespace xAOD diff --git a/Event/xAOD/xAODJet/xAODJet/selection.xml b/Event/xAOD/xAODJet/xAODJet/selection.xml index 2c61a5cf299f6c166d0cd1d86f72a76c31fb2db9..d49c09fed951d1fc6361a7be7c12f7dbb58e6e95 100644 --- a/Event/xAOD/xAODJet/xAODJet/selection.xml +++ b/Event/xAOD/xAODJet/xAODJet/selection.xml @@ -1,51 +1,35 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- Jet_v1 dictionaries: --> - <class name="xAOD::Jet_v1" > - <field name="m_fastJetLink" transient="true" /> - </class> - -<!-- <class name="std::vector< xAOD::JetFourMom_t >" /> --> - - <class name="xAOD::JetContainer_v1" - id="646342DF-D1E1-422A-975D-EA6DBF13CB6D" /> - <class name="xAOD::JetAuxContainer_v1" - id="17E48A73-2219-44A0-8913-D59DB61F4B15" /> - <class name="xAOD::JetTrigAuxContainer_v1" - id="89AE2C6B-A862-499C-8BDA-11D24FAC83F1" /> - <class name="xAOD::JetTrigAuxContainer_v2" - id="6A1FD5C8-E636-4C39-A8B2-36A8D1F81D5E" /> - - <!-- Smart pointers to Jet_v1: --> - <class name="DataLink<xAOD::JetContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::JetContainer_v1> >" /> - - <class name="ElementLink<xAOD::JetContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::JetContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::JetContainer_v1> > >" /> - - - <class name="std::pair<std::string,std::vector<const xAOD::IParticle*> >" /> - <class pattern="std::*pair*<*string*vector<*vector<int*" /> - <!--pair<string,vector<float> >, pair<string,vector<vector<float> > >, - and associated pair_base if existing. --> - <class pattern="std::*pair*<*string*vector<float*"/> - - - <class name="xAOD::JetAttribute" /> - - - <!-- <class name="std::vector<const xAOD::IParticle* >" /> Is this - existing somewhere else ? --> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class pattern="ElementLink<DataVector<xAOD::IParticle*" /> - </exclusion> - + <!-- xAOD::Jet interface type(s). --> + <class name="xAOD::Jet_v1" > + <field name="m_fastJetLink" transient="true" /> + </class> + <read sourceClass="xAOD::Jet_v1" version="[1-]" + targetClass="xAOD::Jet_v1" source="" target="m_fastJetLink" > + <![CDATA[ + m_fastJetLink = nullptr; + ]]> + </read> + <class name="xAOD::JetContainer_v1" + id="646342DF-D1E1-422A-975D-EA6DBF13CB6D" /> + <typedef name="xAOD::Jet" /> + <typedef name="xAOD::JetContainer" /> + + <!-- xAOD::Jet auxiliary type(s). --> + <class name="xAOD::JetAuxContainer_v1" + id="17E48A73-2219-44A0-8913-D59DB61F4B15" /> + <class name="xAOD::JetTrigAuxContainer_v1" + id="89AE2C6B-A862-499C-8BDA-11D24FAC83F1" /> + <class name="xAOD::JetTrigAuxContainer_v2" + id="6A1FD5C8-E636-4C39-A8B2-36A8D1F81D5E" /> + <typedef name="xAOD::JetAuxContainer" /> + <typedef name="xAOD::JetTrigAuxContainer" /> + + <!-- Additional type(s). --> + <class name="xAOD::JetAttribute" /> + <enum name="xAOD::JetConstitScale" /> + <enum name="xAOD::JetScale" /> + <typedef name="xAOD::JetFourMom_t" /> </lcgdict> diff --git a/Event/xAOD/xAODJet/xAODJet/xAODJetDict.h b/Event/xAOD/xAODJet/xAODJet/xAODJetDict.h index 856d28909d73c2e8ec51fbd4aaab6e524484e2a2..942805712ba18690597137cb4dd0d803cbcf8255 100644 --- a/Event/xAOD/xAODJet/xAODJet/xAODJetDict.h +++ b/Event/xAOD/xAODJet/xAODJet/xAODJetDict.h @@ -1,97 +1,76 @@ // Dear emacs, this is -*- c++ -*- - /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef XAODJET_XAODJETDICT_H #define XAODJET_XAODJETDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// System include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODJet/Jet.h" #include "xAODJet/JetContainer.h" +#include "xAODJet/JetAuxContainer.h" +#include "xAODJet/versions/Jet_v1.h" #include "xAODJet/versions/JetContainer_v1.h" #include "xAODJet/versions/JetAuxContainer_v1.h" + #if !defined(SIMULATIONBASE) and !defined(GENERATIONBASE) #include "xAODJet/versions/JetTrigAuxContainer_v1.h" #include "xAODJet/versions/JetTrigAuxContainer_v2.h" #endif // not SIMULATIONBASE or GENERATIONBASE -#include "xAODJet/versions/Jet_v1.h" -#include "xAODJet/JetTypes.h" - -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODJET { - // Instantiate the container for gccxml: - xAOD::JetContainer_v1 c1; - - // Smart pointers to Jet_v1: - DataLink< xAOD::JetContainer_v1 > e1; - std::vector< DataLink< xAOD::JetContainer_v1 > > e2; - ElementLink< xAOD::JetContainer_v1 > e3; - std::vector< ElementLink< xAOD::JetContainer_v1 > > e4; - std::vector< std::vector< ElementLink< xAOD::JetContainer_v1 > > > e5; - // Instantiations to create the EL member dictionaries correctly: - xAOD::IParticleContainer pc1; - ElementLink<xAOD::IParticleContainer> e10; +#include "xAODJet/JetTypes.h" - std::pair<std::string,std::vector<const xAOD::IParticle*> > bug1; - std::pair<std::string,std::vector<float> > bug2; - std::pair<std::string,std::vector<std::vector<int> > > bug3; - std::pair<std::string,std::vector<std::vector<float> > > bug4; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - // momentums - //xAOD::JetFourMom_t jet4mom; - std::vector<xAOD::JetFourMom_t> vjet4mom; +// System include(s). +#include <vector> - //std::vector<const xAOD::IParticle*> vpart; not yet : not sure this belongs elsewhere ? - // +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODJET { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, IParticleContainer ); + xAOD::JetFourMom_t dummy; }; } - -template float xAOD::Jet_v1::getAttribute<float> (xAOD::JetAttribute::AttributeID) const ; -template int xAOD::Jet_v1::getAttribute<int> (xAOD::JetAttribute::AttributeID) const ; -template xAOD::JetFourMom_t xAOD::Jet_v1::getAttribute<xAOD::JetFourMom_t> (xAOD::JetAttribute::AttributeID) const ; -template std::vector<float> xAOD::Jet_v1::getAttribute< std::vector<float> > (xAOD::JetAttribute::AttributeID) const ; -template std::vector<int> xAOD::Jet_v1::getAttribute< std::vector<int> > (xAOD::JetAttribute::AttributeID) const ; - -template float xAOD::Jet_v1::getAttribute<float> (const std::string &) const ; -template int xAOD::Jet_v1::getAttribute<int> (const std::string &) const ; -template xAOD::JetFourMom_t xAOD::Jet_v1::getAttribute<xAOD::JetFourMom_t> (const std::string &) const ; -template std::vector<float> xAOD::Jet_v1::getAttribute< std::vector<float> > (const std::string &) const ; -template std::vector<int> xAOD::Jet_v1::getAttribute< std::vector<int> > (const std::string &) const ; - - -template void xAOD::Jet_v1::setAttribute<float>(const std::string &, const float& ) ; -template void xAOD::Jet_v1::setAttribute<int>(const std::string &, const int& ) ; - -template void xAOD::Jet_v1::setAttribute<std::vector<float> >(const std::string &, const std::vector<float>& ) ; -template void xAOD::Jet_v1::setAttribute<std::vector<int> >(const std::string &, const std::vector<int>& ) ; - - - -template std::vector<const xAOD::IParticle*> xAOD::Jet_v1::getAssociatedObjects<xAOD::IParticle >( xAOD::JetAttribute::AssoParticlesID ) const; -template std::vector<const xAOD::IParticle*> xAOD::Jet_v1::getAssociatedObjects<xAOD::IParticle >( const std::string & ) const ; - -template void xAOD::Jet_v1::setAssociatedObjects<xAOD::IParticle >( const std::string &, const std::vector<const xAOD::IParticle*>& ) ; - - -template const xAOD::IParticle* xAOD::Jet_v1::getAssociatedObject<xAOD::IParticle>( const std::string &) const ; -template const xAOD::IParticle* xAOD::Jet_v1::getAssociatedObject<xAOD::IParticle>( xAOD::JetAttribute::AssoParticlesID ) const ; -template void xAOD::Jet_v1::setAssociatedObject<xAOD::IParticle>( const std::string &, const xAOD::IParticle* ) ; - - +/// Helper macro for instantiating the "attribute function(s)" +#define INST_JET_ATTRIB( TYPE ) \ + template TYPE \ + xAOD::Jet::getAttribute< TYPE >( xAOD::JetAttribute::AttributeID ) const; \ + template TYPE xAOD::Jet::getAttribute< TYPE >( const std::string& ) const; \ + template void \ + xAOD::Jet::setAttribute< TYPE >( xAOD::JetAttribute::AttributeID, \ + const TYPE& ); \ + template void xAOD::Jet::setAttribute< TYPE >( const std::string&, \ + const TYPE& ) + +INST_JET_ATTRIB( float ); +INST_JET_ATTRIB( int ); +INST_JET_ATTRIB( std::vector< float > ); +INST_JET_ATTRIB( std::vector< int > ); +INST_JET_ATTRIB( xAOD::JetFourMom_t ); + +// Clean up. +#undef INST_JET_ATTRIB + +template std::vector< const xAOD::IParticle* > +xAOD::Jet::getAssociatedObjects< xAOD::IParticle >( xAOD::JetAttribute::AssoParticlesID ) const; +template std::vector< const xAOD::IParticle* > +xAOD::Jet::getAssociatedObjects< xAOD::IParticle >( const std::string& ) const; +template void +xAOD::Jet::setAssociatedObjects< xAOD::IParticle >( const std::string&, + const std::vector< const xAOD::IParticle* >& ); + +template const xAOD::IParticle* +xAOD::Jet::getAssociatedObject< xAOD::IParticle >( xAOD::JetAttribute::AssoParticlesID ) const; +template const xAOD::IParticle* +xAOD::Jet::getAssociatedObject< xAOD::IParticle >( const std::string& ) const; +template void +xAOD::Jet::setAssociatedObject< xAOD::IParticle >( const std::string&, + const xAOD::IParticle* ); #endif // XAODJET_XAODJETDICT_H diff --git a/Event/xAOD/xAODJetCnv/CMakeLists.txt b/Event/xAOD/xAODJetCnv/CMakeLists.txt index a9b0bfcd3483dfb522356f151e02783916819857..ebe42202f99268948a68dd4a93b6caea76a25e7c 100644 --- a/Event/xAOD/xAODJetCnv/CMakeLists.txt +++ b/Event/xAOD/xAODJetCnv/CMakeLists.txt @@ -17,14 +17,20 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate Reconstruction/Jet/JetEvent ) +atlas_add_library( xAODJetCnvLib + xAODJetCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODJetCnv + LINK_LIBRARIES GaudiKernel xAODJet xAODBase AthLinks ) + + # Component(s) in the package: atlas_add_component( xAODJetCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthLinks xAODBase xAODJet GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests JetEvent ) + LINK_LIBRARIES xAODJetCnvLib xAODJet GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests JetEvent ) # Install files from the package: -atlas_install_headers( xAODJetCnv ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODLuminosity/xAODLuminosity/xAODLuminosityDict.h b/Event/xAOD/xAODLuminosity/xAODLuminosity/xAODLuminosityDict.h index 848d3e12ee60303a1e38a1e4658ac0298550bb3e..ec088d2927c7219716f9f2bea29ca1ee53014cbf 100644 --- a/Event/xAOD/xAODLuminosity/xAODLuminosity/xAODLuminosityDict.h +++ b/Event/xAOD/xAODLuminosity/xAODLuminosity/xAODLuminosityDict.h @@ -23,4 +23,13 @@ // EDM include(s). #include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODLUMINOSITY { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, BCMRawDataContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, LumiBlockRangeContainer_v1 ); + }; +} + #endif // XAODLUMINOSITY_XAODLUMINOSITYDICT_H diff --git a/Event/xAOD/xAODMetaData/CMakeLists.txt b/Event/xAOD/xAODMetaData/CMakeLists.txt index a64542e880812cf5b58d7324d29fad1ed95015d0..f77376ca1b5f729c340a7ac9b95cf18173de94ed 100644 --- a/Event/xAOD/xAODMetaData/CMakeLists.txt +++ b/Event/xAOD/xAODMetaData/CMakeLists.txt @@ -1,31 +1,28 @@ -# $Id: CMakeLists.txt 761521 2016-07-13 07:27:10Z krasznaa $ -################################################################################ -# Package: xAODMetaData -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODMetaData ) -find_package( ROOT ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Event/xAOD/xAODCore ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODMetaData xAODMetaData/*.h xAODMetaData/version/*.h Root/*.h Root/*.cxx PUBLIC_HEADERS xAODMetaData LINK_LIBRARIES AthContainers xAODCore ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODMetaData/selection.xml + OUTPUT _selectionFile + OBJECTS "xAOD::FileMetaData_v1" ) + atlas_add_dictionary( xAODMetaDataDict xAODMetaData/xAODMetaDataDict.h - xAODMetaData/selection.xml - LINK_LIBRARIES ${ROOT_LIBRARIES} xAODMetaData ) + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODMetaData ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( ut_xAODFileMetaData_MetaDataType_test SOURCES test/ut_xAODFileMetaData_MetaDataType_test.cxx LINK_LIBRARIES xAODMetaData ) @@ -34,5 +31,5 @@ atlas_add_test( ut_xaodmetadata_filemetadata_eq_test SOURCES test/ut_xaodmetadata_filemetadata_eq_test.cxx LINK_LIBRARIES xAODMetaData ) -# Generate CLIDs from the library: +# Generate CLIDs from the library. atlas_generate_cliddb( xAODMetaData ) diff --git a/Event/xAOD/xAODMetaData/xAODMetaData/selection.xml b/Event/xAOD/xAODMetaData/xAODMetaData/selection.xml index aa2342c6d0000f9e1ce82932bf190f1dc656714e..95134b98a4074104da607162d5fb4269ad054155 100644 --- a/Event/xAOD/xAODMetaData/xAODMetaData/selection.xml +++ b/Event/xAOD/xAODMetaData/xAODMetaData/selection.xml @@ -1,10 +1,14 @@ -<!-- $Id: selection.xml 670157 2015-05-27 11:52:51Z krasznaa $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- FileMetaData_v1 dictionaries: --> - <class name="xAOD::FileMetaData_v1" - id="C87E3828-4A7A-480A-95DE-0339539F6A0F" /> - <class name="xAOD::FileMetaDataAuxInfo_v1" - id="BEE2BECF-A936-4078-9FDD-AD703C9ADF9F" /> + <!-- xAOD::FileMetaData interface type(s). --> + <class name="xAOD::FileMetaData_v1" + id="C87E3828-4A7A-480A-95DE-0339539F6A0F" /> + <typedef name="xAOD::FileMetaData" /> + + <!-- xAOD::FileMetaData auxiliary type(s). --> + <class name="xAOD::FileMetaDataAuxInfo_v1" + id="BEE2BECF-A936-4078-9FDD-AD703C9ADF9F" /> + <typedef name="xAOD::FileMetaDataAuxInfo" /> </lcgdict> diff --git a/Event/xAOD/xAODMetaData/xAODMetaData/xAODMetaDataDict.h b/Event/xAOD/xAODMetaData/xAODMetaData/xAODMetaDataDict.h index 4a802bad686ff48c697c2d4591b4a7ecba273589..181101e08b0b66b8d0ea7c06d53e2907ecadfafd 100644 --- a/Event/xAOD/xAODMetaData/xAODMetaData/xAODMetaDataDict.h +++ b/Event/xAOD/xAODMetaData/xAODMetaData/xAODMetaDataDict.h @@ -1,15 +1,25 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODMetaDataDict.h 670157 2015-05-27 11:52:51Z krasznaa $ #ifndef XAODMETADATA_XAODMETADATADICT_H #define XAODMETADATA_XAODMETADATADICT_H -// Local include(s): +// Local include(s). +#include "xAODMetaData/FileMetaData.h" +#include "xAODMetaData/FileMetaDataAuxInfo.h" #include "xAODMetaData/versions/FileMetaData_v1.h" #include "xAODMetaData/versions/FileMetaDataAuxInfo_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODMETADATA { + // Local type(s). + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, FileMetaData_v1 ); + }; +} + #endif // XAODMETADATA_XAODMETADATADICT_H diff --git a/Event/xAOD/xAODMissingET/CMakeLists.txt b/Event/xAOD/xAODMissingET/CMakeLists.txt index 4c067e509de4a5c325102663acac2fac840e49eb..ad1cfc64818636688e24151fc2870ae4a196392c 100644 --- a/Event/xAOD/xAODMissingET/CMakeLists.txt +++ b/Event/xAOD/xAODMissingET/CMakeLists.txt @@ -1,28 +1,13 @@ -# $Id: CMakeLists.txt 766460 2016-08-04 14:17:04Z khoo $ -################################################################################ -# Package: xAODMissingET -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODMissingET ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODJet - PRIVATE - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODTracking - Event/xAOD/xAODTruth ) - -# External dependencies: +# External dependencies. find_package( Boost COMPONENTS unit_test_framework ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODMissingET xAODMissingET/*.h xAODMissingET/versions/*.h xAODMissingET/versions/*.icc Root/*.cxx @@ -31,17 +16,23 @@ atlas_add_library( xAODMissingET LINK_LIBRARIES AthContainers AthLinks xAODBase xAODCore xAODJet PRIVATE_LINK_LIBRARIES xAODCaloEvent xAODTracking xAODTruth ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODMissingET/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::MissingETContainer_v1" "xAOD::MissingETComponentMap_v1" + "xAOD::MissingETAssociationMap_v1" ) + atlas_add_dictionary( xAODMissingETDict xAODMissingET/xAODMissingETDict.h - xAODMissingET/selection.xml - LINK_LIBRARIES xAODMissingET + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODMissingET EXTRA_FILES Root/dict/*.cxx ) atlas_add_executable( xAODMissingET_testMETHash util/testMETHash.cxx LINK_LIBRARIES xAODMissingET ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( edm_test SOURCES test/edm_test.cxx LINK_LIBRARIES xAODMissingET ) @@ -50,4 +41,3 @@ atlas_add_test( ut_edmTest SOURCES test/ut_edmTest.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} xAODMissingET CxxUtils) - diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/selection.xml b/Event/xAOD/xAODMissingET/xAODMissingET/selection.xml index 344c91e0dffc75dbf6af20c44ead7a33ed2c4dd1..781949aae28e37c11a61a29a9cc654cbd8de74e9 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/selection.xml +++ b/Event/xAOD/xAODMissingET/xAODMissingET/selection.xml @@ -1,82 +1,68 @@ -<!-- $Id: selection.xml 742675 2016-04-25 14:50:23Z rsmith $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- MissingET_v1 dictionaries: --> - <class name="xAOD::MissingET_v1"> - <field name="m_nameHash" transient="true" /> - </class> - <class name="DataVector<xAOD::MissingET_v1>" /> - <class name="xAOD::MissingETContainer_v1" id="F49162FE-6BC0-49BC-A7DA-A792136BD939" /> - <class name="xAOD::MissingETAuxContainer_v1" id="2F92EC94-8CD1-49F3-BCA4-3D78599D4D60" /> + <!-- xAOD::MissingET interface type(s). --> + <class name="xAOD::MissingET_v1" > + <field name="m_nameHash" transient="true" /> + </class> + <class name="DataVector<xAOD::MissingET_v1>" /> + <class name="xAOD::MissingETContainer_v1" + id="F49162FE-6BC0-49BC-A7DA-A792136BD939" /> + <typedef name="xAOD::MissingET" /> + <typedef name="xAOD::MissingETContainer" /> - <!-- MissingETComponent_v1/MissingETComponentMap_v1 dictionaries: --> - <class name="xAOD::MissingETComponent_v1" /> - <class name="xAOD::MissingETComponent_v1::Weight"> - <field name="m_wpx" transient="true" /> - <field name="m_wpy" transient="true" /> - <field name="m_wet" transient="true" /> - </class> - <class name="DataVector<xAOD::MissingETComponent_v1>" /> - <class name="xAOD::MissingETComponentMap_v1" id="994D9D32-820F-47B1-A54B-37C15CD0FD1E" > - <field name="m_clusterLinks" transient="true" /> - <field name="m_trackLinks" transient="true" /> - <field name="m_particleLinks" transient="true" /> - </class> - <class name="xAOD::MissingETAuxComponentMap_v1" id="96287268-4165-4288-8FC1-6227FD4AB95D" /> + <!-- xAOD::MissingET auxiliary type(s). --> + <class name="xAOD::MissingETAuxContainer_v1" + id="2F92EC94-8CD1-49F3-BCA4-3D78599D4D60" /> + <typedef name="xAOD::MissingETAuxContainer" /> - <!-- MissingETAssociation_v1/MissingETAssociationMap_v1 dictionaries: --> - <class name="xAOD::MissingETAssociation_v1"> - <field name="m_objConstLinks" transient="true" /> - <field name="m_override" transient="true" /> - </class> - <class name="xAOD::MissingETAssociation_v1::ConstVec"> - <field name="m_cpx" transient="true" /> - <field name="m_cpy" transient="true" /> - <field name="m_cpz" transient="true" /> - <field name="m_ce" transient="true" /> - <field name="m_sumpt" transient="true" /> - </class> - <class name="DataVector<xAOD::MissingETAssociation_v1>" /> - <class name="xAOD::MissingETAssociationMap_v1" id="E2EAA116-F03E-430E-B4EF-216AAF7DEEE8"> - <field name="m_jetConstLinks" transient="true" /> - </class> - <!-- Schema evolve aux container --> - <class name="xAOD::MissingETAuxAssociationMap_v1" id="48EEF1CD-F937-445C-A09C-B978D152868E" /> - <class name="xAOD::MissingETAuxAssociationMap_v2" id="05184C74-A3CE-4C89-959E-D7E9F0A98D13" /> + <!-- xAOD::MissingETComponent interface type(s). --> + <class name="xAOD::MissingETComponent_v1" /> + <class name="xAOD::MissingETComponent_v1::Weight" > + <field name="m_wpx" transient="true" /> + <field name="m_wpy" transient="true" /> + <field name="m_wet" transient="true" /> + </class> + <class name="DataVector<xAOD::MissingETComponent_v1>" /> + <class name="xAOD::MissingETComponentMap_v1" + id="994D9D32-820F-47B1-A54B-37C15CD0FD1E" > + <field name="m_clusterLinks" transient="true" /> + <field name="m_trackLinks" transient="true" /> + <field name="m_particleLinks" transient="true" /> + </class> + <typedef name="xAOD::MissingETComponent" /> + <typedef name="xAOD::MissingETComponentMap" /> - <!-- Smart pointer dictionaries: --> - <class name="DataLink<xAOD::MissingETContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::MissingETContainer_v1> >" /> + <!-- xAOD::MissingETComponent auxiliary type(s). --> + <class name="xAOD::MissingETAuxComponentMap_v1" + id="96287268-4165-4288-8FC1-6227FD4AB95D" /> + <typedef name="xAOD::MissingETAuxComponentMap" /> - <class name="DataLink<xAOD::MissingETComponentMap_v1>" /> - <class name="std::vector<DataLink<xAOD::MissingETComponentMap_v1> >" /> + <!-- xAOD::MissingETAssociation interface type(s). --> + <class name="xAOD::MissingETAssociation_v1" > + <field name="m_objConstLinks" transient="true" /> + <field name="m_override" transient="true" /> + </class> + <class name="xAOD::MissingETAssociation_v1::ConstVec" > + <field name="m_cpx" transient="true" /> + <field name="m_cpy" transient="true" /> + <field name="m_cpz" transient="true" /> + <field name="m_ce" transient="true" /> + <field name="m_sumpt" transient="true" /> + </class> + <class name="DataVector<xAOD::MissingETAssociation_v1>" /> + <class name="xAOD::MissingETAssociationMap_v1" + id="E2EAA116-F03E-430E-B4EF-216AAF7DEEE8" > + <field name="m_jetConstLinks" transient="true" /> + </class> + <typedef name="xAOD::MissingETAssociation" /> + <typedef name="xAOD::MissingETAssociationMap" /> - <class name="ElementLink<xAOD::MissingETContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::MissingETContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::MissingETContainer_v1> > >" /> - - <class name="ElementLink<xAOD::MissingETComponentMap_v1>" /> - <class name="std::vector<ElementLink<xAOD::MissingETComponentMap_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::MissingETComponentMap_v1> > >" /> - - <class name="ElementLink<xAOD::MissingETAssociationMap_v1>" /> - <class name="std::vector<ElementLink<xAOD::MissingETAssociationMap_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::MissingETAssociationMap_v1> > >" /> - - <class name="std::vector<std::vector<unsigned long long> >" /> - <class name="std::vector<std::vector<std::vector<size_t> > >" /> - <class name="std::vector<std::vector<std::vector<unsigned long> > >" /> - <class name="std::vector<std::vector<std::vector<unsigned char> > >" /> - <class name="std::vector<std::vector<std::vector<unsigned long long> > >" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<DataVector<xAOD::IParticle> >" /> - <class name="ElementLink<DataVector<xAOD::Jet_v1> >" /> - </exclusion> + <!-- xAOD::MissingETAssociation auxiliary type(s). --> + <class name="xAOD::MissingETAuxAssociationMap_v1" + id="48EEF1CD-F937-445C-A09C-B978D152868E" /> + <class name="xAOD::MissingETAuxAssociationMap_v2" + id="05184C74-A3CE-4C89-959E-D7E9F0A98D13" /> + <typedef name="xAOD::MissingETAuxAssociationMap" /> </lcgdict> diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/xAODMissingETDict.h b/Event/xAOD/xAODMissingET/xAODMissingET/xAODMissingETDict.h index 1e67356d93299e71f665bf00463df8220679251d..3ec3bcefa663ecb7d71c9f7ceafe19c7a93f52f5 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/xAODMissingETDict.h +++ b/Event/xAOD/xAODMissingET/xAODMissingET/xAODMissingETDict.h @@ -1,76 +1,47 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODMissingETDict.h 693950 2015-09-09 15:29:18Z khoo $ #ifndef XAODMISSINGET_XAODMISSINGETDICT_H #define XAODMISSINGET_XAODMISSINGETDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// System include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODMissingET/MissingET.h" #include "xAODMissingET/MissingETContainer.h" #include "xAODMissingET/MissingETAuxContainer.h" +#include "xAODMissingET/versions/MissingET_v1.h" +#include "xAODMissingET/versions/MissingETContainer_v1.h" +#include "xAODMissingET/versions/MissingETAuxContainer_v1.h" + +#include "xAODMissingET/MissingETComponent.h" #include "xAODMissingET/MissingETComponentMap.h" #include "xAODMissingET/MissingETAuxComponentMap.h" +#include "xAODMissingET/versions/MissingETComponent_v1.h" +#include "xAODMissingET/versions/MissingETComponentMap_v1.h" +#include "xAODMissingET/versions/MissingETAuxComponentMap_v1.h" + +#include "xAODMissingET/MissingETAssociation.h" #include "xAODMissingET/MissingETAssociationMap.h" #include "xAODMissingET/MissingETAuxAssociationMap.h" +#include "xAODMissingET/versions/MissingETAssociation_v1.h" +#include "xAODMissingET/versions/MissingETAssociationMap_v1.h" #include "xAODMissingET/versions/MissingETAuxAssociationMap_v1.h" +#include "xAODMissingET/versions/MissingETAuxAssociationMap_v2.h" + #include "xAODMissingET/versions/MissingETBase.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODMISSINGET { - // Container(s): - DataVector< xAOD::MissingET_v1 > c1; - xAOD::MissingETContainer_v1 c2; - DataVector< xAOD::MissingETComponent_v1 > c3; - xAOD::MissingETComponentMap_v1 c4; - DataVector< xAOD::MissingETAssociation_v1 > c5; - xAOD::MissingETAssociationMap_v1 c6; - // Smart pointer(s): - DataLink< xAOD::MissingETContainer_v1 > dl1; - std::vector< DataLink< xAOD::MissingETContainer_v1 > > dl2; - ElementLink< xAOD::MissingETContainer_v1 > el1; - std::vector< ElementLink< xAOD::MissingETContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::MissingETContainer_v1 > > > el3; - DataLink< xAOD::MissingETComponentMap_v1 > dl3; - std::vector< DataLink< xAOD::MissingETComponentMap_v1 > > dl4; - ElementLink< xAOD::MissingETComponentMap_v1 > el4; - std::vector< ElementLink< xAOD::MissingETComponentMap_v1 > > el5; - std::vector< std::vector< ElementLink< xAOD::MissingETComponentMap_v1 > > > el6; - DataLink< xAOD::MissingETAssociationMap_v1 > dl5; - std::vector< DataLink< xAOD::MissingETAssociationMap_v1 > > dl6; - ElementLink< xAOD::MissingETAssociationMap_v1 > el7; - std::vector< ElementLink< xAOD::MissingETAssociationMap_v1 > > el8; - std::vector< std::vector< ElementLink< xAOD::MissingETAssociationMap_v1 > > > el9; - - // Smart pointers needed for the correct generation of the auxiliary - // class dictionaries: - ElementLink< xAOD::IParticleContainer > el10; - std::vector< ElementLink< xAOD::IParticleContainer > > el11; - std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > el12; - - std::vector< MissingETBase::Types::bitmask_t > vec1; - std::vector< unsigned long long > vec2; - std::vector< std::vector< size_t > > vec3; - std::vector< std::vector< unsigned char > > vec4; - std::vector< std::vector< unsigned long long > > vec5; - std::vector< std::vector< std::vector< size_t > > > vec6; - std::vector< std::vector< std::vector< unsigned long > > > vec7; - std::vector< std::vector< std::vector< unsigned char > > > vec8; - std::vector< std::vector<std::vector<unsigned long long> > > vec9; + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MissingETContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MissingETComponentMap_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MissingETAssociationMap_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, IParticleContainer ); }; } diff --git a/Event/xAOD/xAODMuon/CMakeLists.txt b/Event/xAOD/xAODMuon/CMakeLists.txt index dc635487f80095c1983ed1e77fb0a534a382267b..daa84f6143f87e7836bb2ba05119fbb3059a998e 100644 --- a/Event/xAOD/xAODMuon/CMakeLists.txt +++ b/Event/xAOD/xAODMuon/CMakeLists.txt @@ -1,51 +1,40 @@ -# $Id: CMakeLists.txt 790886 2016-12-22 22:03:35Z ssnyder $ -################################################################################ -# Package: xAODMuon -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODMuon ) -# Extra dependencies, based on the build environment: +# External dependencies. +find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) + +# Extra dependencies, based on the build environment. +set( extra_libs ) if( NOT XAOD_ANALYSIS AND NOT GENERATIONBASE ) - set( extra_deps Tracking/TrkEvent/TrkSegment ) set( extra_libs TrkSegment ) endif() -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs ${extra_libs} GenVector ) - endif() -endif() - -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODCore - Event/xAOD/xAODPrimitives - Event/xAOD/xAODTracking - MuonSpectrometer/MuonStationIndex - ${extra_deps} ) - -find_package( ROOT COMPONENTS Core GenVector ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODMuon xAODMuon/*.h xAODMuon/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODMuon - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCaloEvent xAODCore - xAODPrimitives xAODTracking MuonStationIndexLib ${extra_libs} ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase + xAODCaloEvent xAODCore xAODPrimitives xAODTracking MuonStationIndexLib + ${extra_libs} ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODMuon/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::MuonContainer_v1" "xAOD::MuonSegmentContainer_v1" + "xAOD::SlowMuonContainer_v1" ) atlas_add_dictionary( xAODMuonDict xAODMuon/xAODMuonDict.h - xAODMuon/selection.xml - LINK_LIBRARIES xAODMuon + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODMuon EXTRA_FILES Root/dict/*.cxx ) +# Test(s) in the package. atlas_add_test( xAODMuon_Muon_test SOURCES test/xAODMuon_Muon_test.cxx LINK_LIBRARIES xAODMuon ) diff --git a/Event/xAOD/xAODMuon/xAODMuon/selection.xml b/Event/xAOD/xAODMuon/xAODMuon/selection.xml index e68fa1c1886dbce46492e203fc94bcfbda166a02..f20f4d6521c43de6cb5cd5e74a1f25f3ec9ca199 100644 --- a/Event/xAOD/xAODMuon/xAODMuon/selection.xml +++ b/Event/xAOD/xAODMuon/xAODMuon/selection.xml @@ -1,82 +1,48 @@ -<?xml version="1.0"?> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- MuonAux _v2 dictionaries: --> - <class name="xAOD::MuonAuxContainer_v2" - id="AB53C81C-B10C-11E4-AC59-6C3BE51AB9F1"/> - - <!-- MuonAux _v3 dictionaries: --> - <class name="xAOD::MuonAuxContainer_v3" - id="ECC65005-302B-4662-ACBA-D2CE5A0218B8"/> - - <!-- MuonAux _v4 dictionaries: --> - <class name="xAOD::MuonAuxContainer_v4" - id="8251F481-EA4C-4852-AE72-BED87E6FD2FB"/> - - <!-- MuonAux _v5 dictionaries: --> - <class name="xAOD::MuonAuxContainer_v5" - id="9245FA19-1552-4BBB-8CC3-57224E57A466"/> - - <!-- Muon_v1 dictionaries: --> - <class name="xAOD::Muon_v1" /> - <class name="xAOD::MuonContainer_v1" - id="F84AE51A-F309-4844-B286-8E94C655B724"/> - - <class name="xAOD::MuonAuxContainer_v1" - id="EC9B677A-B3BA-4C75-87D3-373FC478291E"/> - - <!-- All smart pointer dictionaries for xAOD::Muon v1--> - <class name="DataLink<xAOD::MuonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::MuonContainer_v1> >" /> - - <class name="ElementLink<xAOD::MuonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::MuonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::MuonContainer_v1> > >" /> - - - - <!-- MuonSegment_v1 dictionaries --> - <class name="xAOD::MuonSegment_v1"/> - <class name="xAOD::MuonSegmentAuxContainer_v1" - id="51739E92-98A5-11E3-B7F4-6C3BE51AB9F1"/> - <class name="xAOD::MuonSegmentContainer_v1" - id="9516C67E-98A5-11E3-BDFD-6C3BE51AB9F1"/> - - <!-- All smart pointer dictionaries for xAOD::MuonSegment --> - <class name="DataLink<xAOD::MuonSegmentContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::MuonSegmentContainer_v1> >" /> - - <class name="ElementLink<xAOD::MuonSegmentContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::MuonSegmentContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::MuonSegmentContainer_v1> > >" /> - - <!-- SlowMuon_v1 dictionaries --> - <class name="xAOD::SlowMuon_v1"/> - <class name="xAOD::SlowMuonAuxContainer_v1" - id="B0B4F66B-C261-4403-AB96-D71249A9CDEC"/> - <class name="xAOD::SlowMuonContainer_v1" - id="78E011F9-AD91-40A8-95E9-E288A5A583FE"/> - - <!-- All smart pointer dictionaries for xAOD::SlowMuon --> - <class name="DataLink<xAOD::SlowMuonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::SlowMuonContainer_v1> >" /> - - <class name="ElementLink<xAOD::SlowMuonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::SlowMuonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::SlowMuonContainer_v1> > >" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class pattern="xAOD::TrackParticle*" /> - <class pattern="DataVector<xAOD::TrackParticle*" /> - <class pattern="ElementLink<DataVector<xAOD::TrackParticle*" /> - <class pattern="xAOD::CaloCluster*" /> - <class pattern="DataVector<xAOD::CaloCluster*" /> - <class pattern="ElementLink<DataVector<xAOD::CaloCluster*" /> - </exclusion> + <!-- xAOD::Muon interface type(s). --> + <class name="xAOD::Muon_v1" /> + <class name="xAOD::MuonContainer_v1" + id="F84AE51A-F309-4844-B286-8E94C655B724" /> + <typedef name="xAOD::Muon" /> + <typedef name="xAOD::MuonContainer" /> + + <!-- xAOD::Muon auxiliary type(s). --> + <class name="xAOD::MuonAuxContainer_v1" + id="EC9B677A-B3BA-4C75-87D3-373FC478291E" /> + <class name="xAOD::MuonAuxContainer_v2" + id="AB53C81C-B10C-11E4-AC59-6C3BE51AB9F1" /> + <class name="xAOD::MuonAuxContainer_v3" + id="ECC65005-302B-4662-ACBA-D2CE5A0218B8" /> + <class name="xAOD::MuonAuxContainer_v4" + id="8251F481-EA4C-4852-AE72-BED87E6FD2FB" /> + <class name="xAOD::MuonAuxContainer_v5" + id="9245FA19-1552-4BBB-8CC3-57224E57A466" /> + <typedef name="xAOD::MuonAuxContainer" /> + + <!-- xAOD::MuonSegment interfac type(s). --> + <class name="xAOD::MuonSegment_v1"/> + <class name="xAOD::MuonSegmentContainer_v1" + id="9516C67E-98A5-11E3-BDFD-6C3BE51AB9F1" /> + <typedef name="xAOD::MuonSegment" /> + <typedef name="xAOD::MuonSegmentContainer" /> + + <!-- xAOD::MuonSegment auxiliary type(s). --> + <class name="xAOD::MuonSegmentAuxContainer_v1" + id="51739E92-98A5-11E3-B7F4-6C3BE51AB9F1" /> + <typedef name="xAOD::MuonSegmentAuxContainer" /> + + <!-- xAOD::SlowMuon interface type(s). --> + <class name="xAOD::SlowMuon_v1" /> + <class name="xAOD::SlowMuonContainer_v1" + id="78E011F9-AD91-40A8-95E9-E288A5A583FE" /> + <typedef name="xAOD::SlowMuon" /> + <typedef name="xAOD::SlowMuonContainer" /> + + <!-- xAOD::SlowMuon auxiliary type(s). --> + <class name="xAOD::SlowMuonAuxContainer_v1" + id="B0B4F66B-C261-4403-AB96-D71249A9CDEC" /> + <typedef name="xAOD::SlowMuonAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODMuon/xAODMuon/versions/MuonSegment_v1.h b/Event/xAOD/xAODMuon/xAODMuon/versions/MuonSegment_v1.h index 8547ba1c8c2c3745285e11758a453f194f93b0ab..b86a2baeec48939cb2ed57df49f9ca238c0ceffb 100644 --- a/Event/xAOD/xAODMuon/xAODMuon/versions/MuonSegment_v1.h +++ b/Event/xAOD/xAODMuon/xAODMuon/versions/MuonSegment_v1.h @@ -1,7 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef XAODMUON_VERSIONS_MUONSEGMENT_V1_H #define XAODMUON_VERSIONS_MUONSEGMENT_V1_H @@ -33,7 +33,7 @@ namespace xAOD { class MuonSegment_v1 : public SG::AuxElement { public: - + /// Default constructor MuonSegment_v1(); @@ -84,22 +84,22 @@ namespace xAOD { /// Set the 'Fit Quality' information. void setFitQuality(float chiSquared, float numberDoF); /// @} - - /// @name Identification + + /// @name Identification /// The general muon identification scheme is defined here: https://cds.cern.ch/record/681542/files/com-muon-2002-019.pdf /// @{ /// Returns the sector number int sector() const; /// Returns the chamber index - Muon::MuonStationIndex::ChIndex chamberIndex() const; + ::Muon::MuonStationIndex::ChIndex chamberIndex() const; /// Returns the eta index, which corresponds to stationEta in the offline identifiers (and the ). int etaIndex() const; /// Returns the main technology of the segment. - Muon::MuonStationIndex::TechnologyIndex technology() const; + ::Muon::MuonStationIndex::TechnologyIndex technology() const; /// Set the identifier - void setIdentifier(int sector, Muon::MuonStationIndex::ChIndex chamberIndex, int etaIndex, Muon::MuonStationIndex::TechnologyIndex technology); - /// @} - + void setIdentifier(int sector, ::Muon::MuonStationIndex::ChIndex chamberIndex, int etaIndex, ::Muon::MuonStationIndex::TechnologyIndex technology); + /// @} + /// @name Hit counts functions /// Returns the number of hits /// @{ @@ -113,7 +113,7 @@ namespace xAOD { void setNHits(int nPrecisionHits, int nPhiLayers, int nTrigEtaLayers); /// @} -#if !(defined(GENERATIONBASE) || defined(XAOD_ANALYSIS)) +#if !(defined(GENERATIONBASE) || defined(XAOD_ANALYSIS)) const ElementLink< ::Trk::SegmentCollection >& muonSegment() const; void setMuonSegment(const ElementLink< ::Trk::SegmentCollection >& segment); #endif diff --git a/Event/xAOD/xAODMuon/xAODMuon/xAODMuonDict.h b/Event/xAOD/xAODMuon/xAODMuon/xAODMuonDict.h index e6f21d8ea9445ccdbd58753913a988b50a3eaf28..9cacffd24dda749e4c6c5f2bd95c7cff9602b946 100644 --- a/Event/xAOD/xAODMuon/xAODMuon/xAODMuonDict.h +++ b/Event/xAOD/xAODMuon/xAODMuon/xAODMuonDict.h @@ -1,75 +1,53 @@ // Dear emacs, this is -*- c++ -*- - /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef XAODMUON_XAODMUONDICT_H #define XAODMUON_XAODMUONDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# ifndef EIGEN_DONT_VECTORIZE -# define EIGEN_DONT_VECTORIZE -# endif -#endif // __GCCXML__ - -// Local include(s): - +// Local include(s). +#include "xAODMuon/Muon.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODMuon/MuonAuxContainer.h" +#include "xAODMuon/versions/Muon_v1.h" #include "xAODMuon/versions/MuonContainer_v1.h" #include "xAODMuon/versions/MuonAuxContainer_v1.h" #include "xAODMuon/versions/MuonAuxContainer_v2.h" #include "xAODMuon/versions/MuonAuxContainer_v3.h" #include "xAODMuon/versions/MuonAuxContainer_v4.h" #include "xAODMuon/versions/MuonAuxContainer_v5.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODMuon/MuonAuxContainer.h" + +#include "xAODMuon/MuonSegment.h" #include "xAODMuon/MuonSegmentContainer.h" #include "xAODMuon/MuonSegmentAuxContainer.h" +#include "xAODMuon/versions/MuonSegment_v1.h" +#include "xAODMuon/versions/MuonSegmentContainer_v1.h" +#include "xAODMuon/versions/MuonSegmentAuxContainer_v1.h" + +#include "xAODMuon/SlowMuon.h" #include "xAODMuon/SlowMuonContainer.h" #include "xAODMuon/SlowMuonAuxContainer.h" +#include "xAODMuon/versions/SlowMuon_v1.h" +#include "xAODMuon/versions/SlowMuonContainer_v1.h" +#include "xAODMuon/versions/SlowMuonAuxContainer_v1.h" // EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -#if !(defined(GENERATIONBASE) || defined(XAOD_ANALYSIS)) -#include "TrkSegment/SegmentCollection.h" -#endif // not XAOD_ANALYSIS or GENERATIONBASE +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODMUON { - // Classes in this package - xAOD::MuonContainer c1; - xAOD::MuonSegmentContainer c2; - xAOD::SlowMuonContainer c4; - // Links for Muon - DataLink< xAOD::MuonContainer > l1; - ElementLink< xAOD::MuonContainer > l2; - std::vector< DataLink< xAOD::MuonContainer > > l3; - std::vector< ElementLink< xAOD::MuonContainer > > l4; - std::vector< std::vector< ElementLink< xAOD::MuonContainer > > > l5; - // Segments - DataLink< xAOD::MuonSegmentContainer > l6; - ElementLink< xAOD::MuonSegmentContainer > l7; - std::vector< DataLink< xAOD::MuonSegmentContainer > > l8; - std::vector< ElementLink< xAOD::MuonSegmentContainer > > l9; - std::vector< std::vector< ElementLink< xAOD::MuonSegmentContainer > > > l10; - // Slow Muons - DataLink< xAOD::SlowMuonContainer > l11; - ElementLink< xAOD::SlowMuonContainer > l12; - std::vector< DataLink< xAOD::SlowMuonContainer > > l13; - std::vector< ElementLink< xAOD::SlowMuonContainer > > l14; - std::vector< std::vector< ElementLink< xAOD::SlowMuonContainer > > > l15; - // Instantiations of links used by this package - ElementLink< xAOD::CaloClusterContainer > i1; - ElementLink< xAOD::TrackParticleContainer > i2; + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MuonContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MuonSegmentContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, SlowMuonContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CaloClusterContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); #if !(defined(GENERATIONBASE) || defined(XAOD_ANALYSIS)) // These lines are still needed in order for Reflex to see the // member variable of xAOD::MuonSegmentAuxContainer_v1 correctly. - Trk::SegmentCollection c3; - ElementLink< Trk::SegmentCollection > i3; - std::vector<ElementLink< Trk::SegmentCollection > > i4; + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( Trk, SegmentCollection ); #endif // not (defined(GENERATIONBASE) || defined(XAOD_ANALYSIS)) }; } diff --git a/Event/xAOD/xAODPFlow/CMakeLists.txt b/Event/xAOD/xAODPFlow/CMakeLists.txt index 9c385b524b23d786f05ff8c61a5b1474a9ca4624..c230887d74cc90e39d6fd476be623432c5b5b2ab 100644 --- a/Event/xAOD/xAODPFlow/CMakeLists.txt +++ b/Event/xAOD/xAODPFlow/CMakeLists.txt @@ -1,30 +1,11 @@ -# $Id: CMakeLists.txt 744541 2016-05-03 15:55:30Z krasznaa $ -################################################################################ -# Package: xAODPFlow -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODPFlow ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODCore - Event/xAOD/xAODTracking ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Physics GenVector) - -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() +# External dependencies. +find_package( ROOT COMPONENTS Core Physics GenVector ) +find_package( xAODUtilities ) # Component(s) in the package: atlas_add_library( xAODPFlow @@ -32,10 +13,15 @@ atlas_add_library( xAODPFlow PUBLIC_HEADERS xAODPFlow INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase - xAODCaloEvent xAODCore xAODTracking ${extra_libs} ) + xAODCaloEvent xAODCore xAODTracking ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODPFlow/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::PFOContainer_v1" "xAOD::TrackCaloClusterContainer_v1" ) atlas_add_dictionary( xAODPFlowDict xAODPFlow/xAODPFlowDict.h - xAODPFlow/selection.xml - LINK_LIBRARIES xAODPFlow + ${_selectionFile} + LINK_LIBRARIES AthLinks xAODCore xAODPFlow EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODPFlow/Root/FlowElementAuxContainer_v1.cxx b/Event/xAOD/xAODPFlow/Root/FlowElementAuxContainer_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e162b9c0bc1e0247b3f980582dbc5099de5900d3 --- /dev/null +++ b/Event/xAOD/xAODPFlow/Root/FlowElementAuxContainer_v1.cxx @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "xAODPFlow/versions/FlowElementAuxContainer_v1.h" + +namespace xAOD { + + FlowElementAuxContainer_v1::FlowElementAuxContainer_v1() + : AuxContainerBase() { + AUX_VARIABLE(pt); + AUX_VARIABLE(eta); + AUX_VARIABLE(phi); + AUX_VARIABLE(m); + AUX_VARIABLE(charge); + AUX_VARIABLE(signalType); + AUX_VARIABLE(vertexType); + AUX_VARIABLE( chargedObjectLinks ); + AUX_VARIABLE( chargedObjectWeights ); + AUX_VARIABLE( otherObjectLinks ); + AUX_VARIABLE( otherObjectWeights ); + } + +} // namespace xAOD diff --git a/Event/xAOD/xAODPFlow/Root/FlowElement_v1.cxx b/Event/xAOD/xAODPFlow/Root/FlowElement_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6f210f206f74a9bcb048555d6aec7dcead8d678d --- /dev/null +++ b/Event/xAOD/xAODPFlow/Root/FlowElement_v1.cxx @@ -0,0 +1,208 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// EDM include(s): +#include "xAODCore/AuxStoreAccessorMacros.h" +#include "AthLinks/ElementLink.h" + + +// Local include(s): +#include "xAODPFlow/versions/FlowElement_v1.h" + +#include "Math/Vector4D.h" + +using ROOT::Math::PtEtaPhiMVector ; + +namespace xAOD { + + + AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(FlowElement_v1, float, double, pt) + AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(FlowElement_v1, float, double, eta) + AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(FlowElement_v1, float, double, phi) + AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(FlowElement_v1, float, double, m) + + double FlowElement_v1::e() const { + return PtEtaPhiMVector(pt(), eta(), phi(), m() ).E(); + } + + double FlowElement_v1::rapidity() const { + return PtEtaPhiMVector(pt(), eta(), phi(), m() ).Rapidity(); + } + + FlowElement_v1::FourMom_t FlowElement_v1::p4() const { + FourMom_t p4; + p4.SetPtEtaPhiE( pt(), eta(), phi(), e() ); + return p4; + } + + void FlowElement_v1::setP4(float pt, float eta, float phi, float m){ + static const Accessor< float > acc1( "pt" ); + acc1( *this ) = pt; + static const Accessor< float > acc2( "eta" ); + acc2( *this ) = eta; + static const Accessor< float > acc3( "phi" ); + acc3( *this ) = phi; + static const Accessor< float > acc4( "m" ); + acc4( *this ) = m; + + } + + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(FlowElement_v1, float, charge, setCharge) + bool FlowElement_v1::isCharged() const { return !bool( signalType()& Neutral );} + + + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(FlowElement_v1, FlowElement_v1::signal_t, signalType, setSignalType) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(FlowElement_v1, FlowElement_v1::vertex_t, vertexType, setVertexType) + + bool FlowElement_v1::isMatchedToPV(MatchedPVType vxtype) const { + return (vertexType()==vxtype); + } + + + Type::ObjectType FlowElement_v1::type() const { + return Type::FlowElement; + } + + + + + AUXSTORE_OBJECT_SETTER_AND_GETTER( FlowElement_v1, + std::vector< ElementLink< xAOD::IParticleContainer > >, + chargedObjectLinks, + setChargedObjectLinks) + + + AUXSTORE_OBJECT_GETTER( FlowElement_v1, std::vector<float>, chargedObjectWeights) + + void FlowElement_v1::setChargedObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV, const std::vector<float> & wV){ + if(elV.size() != wV.size() ){ + throw std::runtime_error("FlowElement::setChargedObjectLinks : Can not set vectors of links and weights with different sizes"); + } + static const SG::AuxElement::Accessor< std::vector<ElementLink< xAOD::IParticleContainer >> > accL( "chargedObjectLinks" ); + static const SG::AuxElement::Accessor< std::vector<float> > accW( "chargedObjectWeights" ); + accL(*this) = elV; + accW(*this) = wV; + } + + + std::vector<const xAOD::IParticle*> FlowElement_v1::chargedObjects() const { + const auto & elV = chargedObjectLinks(); + std::vector<const xAOD::IParticle*> result; + result.reserve( elV.size() ); + for(const auto& el: elV ){ + result.push_back( el.isValid() ? *el : nullptr ) ; + } + return result; + } + + std::vector<std::pair<const xAOD::IParticle*,float> > FlowElement_v1::chargedObjectsAndWeights() const { + + const auto & elV = chargedObjectLinks(); + const std::vector<float> & wV = chargedObjectWeights(); + std::vector< std::pair<const xAOD::IParticle*,float> > result; + result.reserve( elV.size() ); + if(wV.empty()) { + for(const auto& el: elV ){ + result.push_back( { el.isValid() ? *el : nullptr , 1.} ) ; + } + } else { + for(size_t i=0;i<elV.size();i++){ + const xAOD::IParticle* p = elV[i].isValid() ? *(elV[i]) : nullptr; + result.push_back( {p , wV[i]} ); + } + } + return result; + } + + std::size_t FlowElement_v1::nChargedObjects() const { + return chargedObjectLinks().size(); + } + + const xAOD::IParticle* FlowElement_v1::chargedObject( std::size_t i ) const{ + const auto & elV = chargedObjectLinks(); + // should we check if i >= size() and throw ourselves ? or trust the user ? + return elV[i].isValid()? *(elV[i]) : nullptr ; + } + + std::pair<const xAOD::IParticle*, float > FlowElement_v1::chargedObjectAndWeight( std::size_t i ) const { + const auto & elV = chargedObjectLinks(); + const std::vector<float> & wV = chargedObjectWeights(); + + if( elV[i].isValid() ) return { *(elV[i]), wV[i] } ; + else return {nullptr, wV[i] } ; + } + + + + + + AUXSTORE_OBJECT_SETTER_AND_GETTER( FlowElement_v1, + std::vector< ElementLink< xAOD::IParticleContainer > >, + otherObjectLinks, + setOtherObjectLinks) + AUXSTORE_OBJECT_GETTER( FlowElement_v1, std::vector<float>, otherObjectWeights) + + void FlowElement_v1::setOtherObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV, const std::vector<float> & wV){ + if(elV.size() != wV.size() ){ + throw std::runtime_error("FlowElement::setOtherObjectLinks : Can not set vectors of links and weights with different sizes"); + return; + } + static const SG::AuxElement::Accessor< std::vector<ElementLink< xAOD::IParticleContainer > > > accL( "otherObjectLinks" ); + static const SG::AuxElement::Accessor< std::vector<float> > accW( "otherObjectWeights" ); + accL(*this) = elV; + accW(*this) = wV; + } + + + std::vector<const xAOD::IParticle*> FlowElement_v1::otherObjects() const { + const auto & elV = otherObjectLinks(); + std::vector<const xAOD::IParticle*> result; + result.reserve( elV.size() ); + for(const auto& el: elV ){ + result.push_back( el.isValid() ? *el : nullptr ) ; + } + return result; + } + + std::vector<std::pair<const xAOD::IParticle*,float> > FlowElement_v1::otherObjectsAndWeights() const { + + const auto & elV = otherObjectLinks(); + const std::vector<float> & wV = otherObjectWeights(); + std::vector< std::pair<const xAOD::IParticle*,float> > result; + result.reserve( elV.size() ); + if(wV.empty()) { + for(const auto& el: elV ){ + result.push_back( { el.isValid() ? *el : nullptr , 1.} ) ; + } + } else { + for(size_t i=0;i<elV.size();i++){ + const xAOD::IParticle* p = elV[i].isValid() ? *(elV[i]) : nullptr; + result.push_back( {p , wV[i]} ); + } + } + return result; + } + + std::size_t FlowElement_v1::nOtherObjects() const { + return otherObjectLinks().size(); + } + + const xAOD::IParticle* FlowElement_v1::otherObject( std::size_t i ) const{ + const auto & elV = otherObjectLinks(); + // should we check if i >= size() and throw ourselves ? or trust the user ? + return elV[i].isValid()? *(elV[i]) : nullptr ; + } + + std::pair< const xAOD::IParticle*, float > FlowElement_v1::otherObjectAndWeight( std::size_t i ) const { + const auto & elV = otherObjectLinks(); + const std::vector<float> & wV = otherObjectWeights(); + + if( elV[i].isValid() ) return { *(elV[i]), wV[i] }; + else return {nullptr, wV[i] } ; + } + + +} diff --git a/Event/xAOD/xAODPFlow/Root/dict/ContainerProxies.cxx b/Event/xAOD/xAODPFlow/Root/dict/ContainerProxies.cxx index 63aff550c225d1742337da19181624dae7d2c39e..88a1d7c84ffa182f845c472a7697fde84ca6b398 100644 --- a/Event/xAOD/xAODPFlow/Root/dict/ContainerProxies.cxx +++ b/Event/xAOD/xAODPFlow/Root/dict/ContainerProxies.cxx @@ -10,7 +10,9 @@ // Local include(s): #include "xAODPFlow/versions/PFOContainer_v1.h" #include "xAODPFlow/versions/TrackCaloClusterContainer_v1.h" +#include "xAODPFlow/versions/FlowElementContainer_v1.h" // Set up the collection proxies: ADD_NS_DV_PROXY( xAOD, PFOContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrackCaloClusterContainer_v1 ); +ADD_NS_DV_PROXY( xAOD, FlowElementContainer_v1 ); diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/FlowElement.h b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElement.h new file mode 100644 index 0000000000000000000000000000000000000000..293a61729940112f5808440b802c6ab7cc76a422 --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElement.h @@ -0,0 +1,23 @@ +// this file is -*- c++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: PFO.h 744541 2016-05-03 15:55:30Z krasznaa $ +#ifndef XAODPFLOW_FLOWELEMENT_H +#define XAODPFLOW_FLOWELEMENT_H + +// Local include(s): +#include "xAODPFlow/versions/FlowElement_v1.h" + +/// Namespace holding all the xAOD EDM classes +namespace xAOD { + /// Definition of the current "pfo version" + typedef FlowElement_v1 FlowElement; +} + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::FlowElement , 25811773 , 1 ) + +#endif // XAODPFLOW_FlowElement_H diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementAuxContainer.h b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementAuxContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..21c72e3bd6601cd34af1cc35d9fb1616067ee67a --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementAuxContainer.h @@ -0,0 +1,27 @@ +// this file is -*- c++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODPFLOW_FLOWELEMENTAUXCONTAINER_H +#define XAODPFLOW_FLOWELEMENTAUXCONTAINER_H + +// Local include(s): +#include "xAODPFlow/versions/FlowElementAuxContainer_v1.h" + +namespace xAOD { + /// Definition of the current FlowElementAuxContainer_v1 auxiliary container + /// + /// All reconstruction code should attach the typedefed auxiliary + /// container to the xAOD::FlowElementContainer, so it will be easy to change + /// the container type as we get new I/O technologies for these + /// objects. + /// + typedef FlowElementAuxContainer_v1 FlowElementAuxContainer; +} + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::FlowElementAuxContainer , 1078624534 , 1 ) + +#endif // XAODPFLOW_FLOWELEMENTAUXCONTAINER_H diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementContainer.h b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..d63b47a52ba4613706748ef1bafc62b08fcbfe2d --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/FlowElementContainer.h @@ -0,0 +1,23 @@ +// this file is -*- c++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODPFLOW_FlowElementCONTAINER_H +#define XAODPFLOW_FlowElementCONTAINER_H + +// Local include(s): +#include "xAODPFlow/FlowElement.h" +#include "xAODPFlow/versions/FlowElementContainer_v1.h" + +namespace xAOD { + /// Definition of the current "pfo container version" + typedef FlowElementContainer_v1 FlowElementContainer; +} + +// Set up a CLID for the container: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::FlowElementContainer , 1158384067 , 1 ) + +#endif // XAODPFLOW_FlowElementCONTAINER_H diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/selection.xml b/Event/xAOD/xAODPFlow/xAODPFlow/selection.xml index c5a81b4c6e7339a704d0457a76588bbdfab964f6..2c6e4664db7c05f53770cf27802c116ea5bc75c9 100644 --- a/Event/xAOD/xAODPFlow/xAODPFlow/selection.xml +++ b/Event/xAOD/xAODPFlow/xAODPFlow/selection.xml @@ -1,58 +1,52 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - - <!-- PFO_v1 dictionaries: --> - <class name="xAOD::PFO_v1" /> - - <class name="xAOD::PFOContainer_v1" - id="476378BF-054D-499E-9CC9-000F501B30F2" /> - - <class name="xAOD::PFOAuxContainer_v1" - id="F691F845-4A3D-466A-9187-FED7837D9372" /> - - <!-- TrackCaloCluster_v1 dictionaries: --> - <class name="xAOD::TrackCaloCluster_v1" /> + <!-- xAOD::PFO interface type(s). --> + <class name="xAOD::PFO_v1" /> + <class name="xAOD::PFOContainer_v1" + id="476378BF-054D-499E-9CC9-000F501B30F2" /> + <typedef name="xAOD::PFO" /> + <typedef name="xAOD::PFOContainer" /> + + <!-- xAOD::PFO auxiliary type(s). --> + <class name="xAOD::PFOAuxContainer_v1" + id="F691F845-4A3D-466A-9187-FED7837D9372" /> + <typedef name="xAOD::PFOAuxContainer" /> + + <!-- xAOD::TrackCaloCluster interface type(s). --> + <class name="xAOD::TrackCaloCluster_v1" /> + <class name="xAOD::TrackCaloClusterContainer_v1" + id="84C52180-1AC0-4877-BAD3-B5C7A71F9125"/> + <typedef name="xAOD::TrackCaloCluster" /> + <typedef name="xAOD::TrackCaloClusterContainer" /> + + <!-- xAOD::TrackCaloCluster auxiliary type(s). --> + <class name="xAOD::TrackCaloClusterAuxContainer_v1" + id="E3492C37-2469-4346-BCBA-7A18CACD46AC"/> + <typedef name="xAOD::TrackCaloClusterAuxContainer" /> + + + <!-- FlowElement interface type(s): --> + <class name="xAOD::FlowElement_v1" /> + <class name="xAOD::FlowElementContainer_v1" + id="68F99A1F-96F4-4339-BEB7-46A6E7A5E351"/> + + <typedef name="xAOD::FlowElement" /> + <typedef name="xAOD::FlowElementContainer" /> - <class name="xAOD::TrackCaloClusterAuxContainer_v1" - id="E3492C37-2469-4346-BCBA-7A18CACD46AC"/> - <class name="xAOD::TrackCaloClusterContainer_v1" - id="84C52180-1AC0-4877-BAD3-B5C7A71F9125"/> - - <!-- Link types pointing at clusters: --> - <class name="DataLink<xAOD::PFOContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::PFOContainer_v1> >" /> - - <class name="ElementLink<xAOD::PFOContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::PFOContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::PFOContainer_v1> > >" /> - - <class name="ElementLink<xAOD::IParticleContainer>" /> - <class name="std::vector< ElementLink<xAOD::IParticleContainer> >" /> - <class name="std::vector<std::vector< ElementLink<xAOD::IParticleContainer> > >" /> - - <enum pattern="xAOD::PFODetails::*" /> - <class name="std::vector<xAOD::PFODetails::PFOLeptonType>" /> - - <!-- All smart pointer dictionaries for xAOD::IParticle --> - <class name="DataLink<xAOD::TrackCaloClusterContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrackCaloClusterContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrackCaloClusterContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrackCaloClusterContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrackCaloClusterContainer_v1> > >" /> - - <!-- Extra types needed --> - <class name="std::pair<ElementLink<DataVector<xAOD::CaloCluster_v1> >,double>" /> - <class name="std::vector<std::vector<std::pair<ElementLink<DataVector<xAOD::CaloCluster_v1> >,double> > >" /> - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<DataVector<xAOD::IParticle> >" /> - <class pattern="xAOD::Vertex*" /> - <class pattern="DataVector<xAOD::Vertex*" /> - <class pattern="ElementLink<DataVector<xAOD::Vertex*" /> - </exclusion> + <!-- FlowElement interface type(s): --> + <class name="xAOD::FlowElementAuxContainer_v1" + id="5015F3F7-901A-44FD-9FF2-93EEA1DAE686"/> + <typedef name="xAOD::FlowElementAuxContainer" /> + + + <!-- Other type(s). --> + <enum pattern="xAOD::PFODetails::*" /> + + <!-- Weird/bad types used by the PFO reconstruction as attributes on --> + <!-- xAOD::PFO objects. :-( --> + <class name="std::pair<ElementLink<xAOD::CaloClusterContainer_v1>,double>" /> + <class name="std::vector<std::pair<ElementLink<xAOD::CaloClusterContainer_v1>,double> >" /> + <class name="std::vector<std::vector<std::pair<ElementLink<xAOD::CaloClusterContainer_v1>,double> > >" /> + <class name="std::vector<xAOD::PFODetails::PFOLeptonType>" /> </lcgdict> diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementAuxContainer_v1.h b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementAuxContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..358462b0fb8d9e9dcd492b56a1e96bce83d5c0d4 --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementAuxContainer_v1.h @@ -0,0 +1,56 @@ +// this file is -*- c++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODPFLOW_VERSIONS_FLOWELEMENTAUXCONTAINER_V1_H +#define XAODPFLOW_VERSIONS_FLOWELEMENTAUXCONTAINER_V1_H + + +// EDM include(s): +#include "xAODCore/AuxContainerBase.h" +#include "AthLinks/ElementLink.h" +#include "xAODPFlow/FlowElement.h" + +namespace xAOD { + + + class FlowElementAuxContainer_v1 : public AuxContainerBase { + + public: + /// Default constructor + FlowElementAuxContainer_v1(); + ~FlowElementAuxContainer_v1() = default; + + private: + /** Charge of FlowElement */ + std::vector<float> charge; + + std::vector<FlowElement_v1::signal_t> signalType; + + std::vector<FlowElement_v1::vertex_t> vertexType; + + /** 4-vector of FlowElement */ + std::vector<float> pt; + std::vector<float> eta; + std::vector<float> phi; + std::vector<float> m; + + /** Vectors of links to underlying objects*/ + + std::vector<std::vector<ElementLink<IParticleContainer> > > chargedObjectLinks; + std::vector<std::vector<float > > chargedObjectWeights; + + std::vector<std::vector<ElementLink<IParticleContainer> > > otherObjectLinks; + std::vector<std::vector<float > > otherObjectWeights; + + + }; // class FlowElementAuxContainer_v1 + +} // namespace xAOD + +#include "xAODCore/BaseInfo.h" +SG_BASE( xAOD::FlowElementAuxContainer_v1, xAOD::AuxContainerBase ); + +#endif // XAODPFLOW_VERSIONS_FlowElementAUXCONTAINER_V1_H diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementContainer_v1.h b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..162551e7a79172971e58ccb7d402d2e9dd885d30 --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElementContainer_v1.h @@ -0,0 +1,22 @@ +// this file is -*- c++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef XAODPFLOW_VERSIONS_FlowElementCONTAINER_V1_H +#define XAODPFLOW_VERSIONS_FlowElementCONTAINER_V1_H + +// Core include(s): +#include "AthContainers/DataVector.h" + +// Local include(s): +#include "xAODPFlow/versions/FlowElement_v1.h" + +namespace xAOD { + /// The container is a simple typedef for now + typedef DataVector< xAOD::FlowElement_v1 > FlowElementContainer_v1; +} + +#endif // XAODPFLOW_VERSIONS_FlowElementCONTAINER_V1_H diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElement_v1.h b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElement_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..a95f1d0dcae3733c2c710e485fb249a66a89dc5f --- /dev/null +++ b/Event/xAOD/xAODPFlow/xAODPFlow/versions/FlowElement_v1.h @@ -0,0 +1,153 @@ +// this files is -*- c++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODPFLOW_VERSIONS_FLOWELEMENT_V1_H +#define XAODPFLOW_VERSIONS_FLOWELEMENT_V1_H + +// Core include(s): +#include "AthLinks/ElementLink.h" + +// xAOD include(s): +#include "xAODBase/IParticle.h" +#include "xAODBase/IParticleContainer.h" + +namespace xAOD { + + ///////////////////////////////////////////////////////// + /// A detector object made of other lower level object(s) + /// + /// This class is intended to describe reconstruction objects coumpound of lower level detector objects. + /// Typically it provides links to tracks and calo clusters such as is needed for particle flow objects. + /// + /// The class is kept minimal and very generic so it can cover many use cases, including a generic type + /// to describe jet constituents. + class FlowElement_v1 : public IParticle { + public: + + using IParticle::IParticle; + + typedef unsigned long signal_t; // 32-bit minimum + typedef unsigned short vertex_t; + using IParticle::FourMom_t ; + + /// Enum to encode the nature of the object this FlowElement represents + enum SignalType { + // global characteristics + Neutral = 0x1000, + Charged = 0x2000, + Combined = 0x4000, //needed?? + + // detector level signals and flow objects + CaloCluster = Neutral | 0x0100, + Track = Charged | 0x0200, + Muon = Charged | 0x0400, + PFlow = 0x0010, + NeutralPFlow = Neutral | PFlow, + ChargedPFlow = Charged | PFlow, + + // higher level flow objects + TCC = 0x0020, + NeutralTCC = Neutral | TCC, + ChargedTCC = Charged | TCC, + UFO = 0x0001, + NeutralUFO = Neutral | UFO, + ChargedUFO = Charged | UFO, + + // unknown + Unknown = 0x0000 + }; + + /// Enum to encode high-level information on the vertex associated to this FlowElement + enum MatchedPVType { + Undefined = 0x00, HardScatter = 0x10, Pileup = 0x20, PileupSideBand = 0x21 + }; + + // ************************************************* + ///@{ + /// kinematics (IParticle interface) + virtual double pt() const override; + virtual double eta() const override; + virtual double phi() const override; + virtual double m() const override; + virtual double e() const override; + virtual double rapidity() const override; + virtual FourMom_t p4() const override; + virtual Type::ObjectType type() const override ; + + void setP4(float pt, float eta, float phi, float m) ; + ///@} + + // ************************************************* + ///@{ + ///Access signal type + signal_t signalType() const; + void setSignalType(signal_t t); + ///@} + + // ************************************************* + ///@{ + /// Acess vertex types + bool isMatchedToPV(MatchedPVType vxtype=HardScatter) const; + + vertex_t vertexType() const; + void setVertexType(vertex_t t); + ///@} + + // ************************************************* + ///@{ + ///Access charge + bool isCharged() const; + float charge() const; + + void setCharge(float c); + ///@} + + // ************************************************* + + ///@{ + /// Access directly the charged underlying IParticle (typically : TrackParticle) + /// nullptr are returned if the ElementLink to the IParticle are invalid (ex: after thinning) + std::vector<const xAOD::IParticle*> chargedObjects() const ; + std::vector<std::pair<const xAOD::IParticle*,float> > chargedObjectsAndWeights() const ; + + std::size_t nChargedObjects() const ; + const xAOD::IParticle* chargedObject( std::size_t i ) const; + std::pair< const xAOD::IParticle*, float > chargedObjectAndWeight( std::size_t i ) const; + ///@} + + + ///@{ + /** Access to the EL.*/ + const std::vector<ElementLink<IParticleContainer>> & chargedObjectLinks() const ; + const std::vector<float> & chargedObjectWeights() const ; + void setChargedObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV); + void setChargedObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV, const std::vector<float> & wV); + ///@} + + // ************************************************* + ///@{ + /// Access directly the 'other' underlying IParticle (typically neutral CaloCluster) + /// nullptr are returned if the ElementLink to the IParticle are invalid (ex: after thinning) + std::vector<const xAOD::IParticle*> otherObjects() const ; + std::vector<std::pair<const xAOD::IParticle*,float> > otherObjectsAndWeights() const ; + + std::size_t nOtherObjects() const ; + const xAOD::IParticle* otherObject( std::size_t i ) const; + std::pair< const xAOD::IParticle*, float > otherObjectAndWeight( std::size_t i ) const; + ///@} + + ///@{ + /// Access to the EL + const std::vector<ElementLink<IParticleContainer>>& otherObjectLinks() const ; + const std::vector<float>& otherObjectWeights() const ; + + void setOtherObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV); + void setOtherObjectLinks(const std::vector<ElementLink<IParticleContainer>> & elV, const std::vector<float> & wV); + ///@} + + }; + +} + +#endif diff --git a/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h b/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h index b12e786c55d1975bb7360229c9cf33c7f201f459..11b944665f6ac200060c4a6b054cda7b846fc840 100644 --- a/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h +++ b/Event/xAOD/xAODPFlow/xAODPFlow/xAODPFlowDict.h @@ -1,58 +1,55 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -/* Class to set what goes in the dictionary - authors M. Hodgkinson amd M. Janus */ - #ifndef XAODPFLOW_XAODPFODICT_H #define XAODPFLOW_XAODPFODICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - // Local include(s): +#include "xAODPFlow/PFO.h" #include "xAODPFlow/PFOContainer.h" #include "xAODPFlow/PFOAuxContainer.h" +#include "xAODPFlow/versions/PFO_v1.h" #include "xAODPFlow/versions/PFOContainer_v1.h" #include "xAODPFlow/versions/PFOAuxContainer_v1.h" + +#include "xAODPFlow/TrackCaloCluster.h" +#include "xAODPFlow/TrackCaloClusterContainer.h" +#include "xAODPFlow/TrackCaloClusterAuxContainer.h" +#include "xAODPFlow/versions/TrackCaloCluster_v1.h" #include "xAODPFlow/versions/TrackCaloClusterContainer_v1.h" #include "xAODPFlow/versions/TrackCaloClusterAuxContainer_v1.h" +#include "xAODPFlow/versions/FlowElementContainer_v1.h" +#include "xAODPFlow/versions/FlowElementAuxContainer_v1.h" + #include "xAODPFlow/PFODefs.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +#include "AthLinks/ElementLink.h" + +// System include(s). +#include <utility> +#include <vector> + +// Instantiate all necessary types for the dictionary. namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODPFLOW { - xAOD::PFOContainer_v1 c1; - DataLink< xAOD::PFOContainer_v1 > l1; - ElementLink< xAOD::PFOContainer_v1 > l2; - std::vector< DataLink< xAOD::PFOContainer_v1 > > l4; - std::vector< ElementLink< xAOD::PFOContainer_v1 > > l5; - std::vector< std::vector< ElementLink< xAOD::PFOContainer_v1 > > > l6; - - xAOD::IParticleContainer c2; - ElementLink< xAOD::IParticleContainer > l8; - std::vector< ElementLink<xAOD::IParticleContainer > > l9; - std::vector< std::vector< ElementLink<xAOD::IParticleContainer > > > l10; - std::vector< xAOD::PFODetails::PFOLeptonType > l11; - ElementLink< xAOD::VertexContainer > l12; - - xAOD::TrackCaloClusterContainer_v1 c3; - DataLink< xAOD::TrackCaloClusterContainer_v1 > l13; - std::vector< DataLink< xAOD::TrackCaloClusterContainer_v1 > > l14; - ElementLink< xAOD::TrackCaloClusterContainer_v1 > l15; - std::vector< ElementLink< xAOD::TrackCaloClusterContainer_v1 > > l16; - std::vector< std::vector< ElementLink< xAOD::TrackCaloClusterContainer_v1 > > > l17; - - std::vector<std::vector<std::pair<ElementLink<DataVector<xAOD::CaloCluster_v1> >,double> > > l18; - + struct GCCXML_DUMMY_INSTANTIATION_XAODFLOW { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, PFOContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackCaloClusterContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, FlowElementContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, IParticleContainer ); + // Weird/bad types used by the PFO reconstruction as attributes on + // xAOD::PFO objects. :-( + std::pair< ElementLink< xAOD::CaloClusterContainer >, double > dummy1; + std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > > + dummy2; + std::vector< std::vector< std::pair< ElementLink< xAOD::CaloClusterContainer >, double > > > + dummy3; + std::vector< xAOD::PFODetails::PFOLeptonType > dummy4; + }; } diff --git a/Event/xAOD/xAODPFlowAthenaPool/CMakeLists.txt b/Event/xAOD/xAODPFlowAthenaPool/CMakeLists.txt index b799b4af58190577e6b8e622397ace1cd31c3755..85541f56d980c41bed69da42e261c155991cdf7f 100644 --- a/Event/xAOD/xAODPFlowAthenaPool/CMakeLists.txt +++ b/Event/xAOD/xAODPFlowAthenaPool/CMakeLists.txt @@ -9,9 +9,13 @@ atlas_add_poolcnv_library( xAODPFlowAthenaPoolPoolCnv FILES xAODPFlow/PFOContainer.h xAODPFlow/PFOAuxContainer.h xAODPFlow/TrackCaloClusterContainer.h xAODPFlow/TrackCaloClusterAuxContainer.h + xAODPFlow/FlowElementContainer.h + xAODPFlow/FlowElementAuxContainer.h TYPES_WITH_NAMESPACE xAOD::PFOContainer xAOD::PFOAuxContainer xAOD::TrackCaloClusterContainer xAOD::TrackCaloClusterAuxContainer + xAOD::FlowElementContainer + xAOD::FlowElementAuxContainer CNV_PFX xAOD LINK_LIBRARIES AthContainers AthenaKernel AthenaPoolCnvSvcLib AthenaPoolUtilities xAODPFlow ) diff --git a/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.cxx b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..724faaa41f9b6d1a419455e566029425f023ada0 --- /dev/null +++ b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.cxx @@ -0,0 +1,3 @@ +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// Dummy source file so that cmake will know that this is a custom converter. + diff --git a/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.h b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..d903ae9c85f26f21c8f2d03a860503fbdd8ed533 --- /dev/null +++ b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementAuxContainerCnv.h @@ -0,0 +1,20 @@ +// this file is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODPFLOWATHENAPOOL_XAODFLOWELEMENTAUXCONTAINERCNV_H +#define XAODPFLOWATHENAPOOL_XAODFLOWELEMENTAUXCONTAINERCNV_H + +// Local include(s). +//#include "xAODFlowEmentAuxContainerCnv_v1.h" + +// EDM include(s). +#include "xAODPFlow/FlowElementAuxContainer.h" + +// Framework include(s). +#include "AthenaPoolCnvSvc/T_AthenaPoolAuxContainerCnv.h" + +// Declare the POOL converter. +typedef T_AthenaPoolAuxContainerCnv< xAOD::FlowElementAuxContainer> xAODFlowElementAuxContainerCnv; + +#endif // XAODPFLOWATHENAPOOL_XAODFLOWELEMENTAUXCONTAINERCNV_H diff --git a/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.cxx b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cabe40b8bc597885a4a6b2e0dbeccbe1fa6c2c50 --- /dev/null +++ b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.cxx @@ -0,0 +1,5 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// Dummy source file so that cmake will know this is a custom converter. diff --git a/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.h b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..dc4c4db8b3cbf999c0bcee3537a100df69113c59 --- /dev/null +++ b/Event/xAOD/xAODPFlowAthenaPool/src/xAODFlowElementContainerCnv.h @@ -0,0 +1,14 @@ +// this file is -*- c++ -*- +/* +Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODPFLOWATHENAPOOL_XAODFLOWELEMENTCONTAINERCNV_H +#define XAODPFLOWATHENAPOOL_XAODFLOWELEMENTCONTAINERCNV_H + +#include "xAODPFlow/FlowElementContainer.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolxAODCnv.h" + +typedef T_AthenaPoolxAODCnv<xAOD::FlowElementContainer> xAODFlowElementContainerCnv; + +#endif //XAODPFLOWATHENAPOOL_XAODFLOWELEMENTCONTAINERCNV_H diff --git a/Event/xAOD/xAODParticleEvent/CMakeLists.txt b/Event/xAOD/xAODParticleEvent/CMakeLists.txt index 01524f17a62c16da3ceaffbf1ab8c08662d08aaa..1aaa8d18c80d0f833debf7fd837a2813e9308dc9 100644 --- a/Event/xAOD/xAODParticleEvent/CMakeLists.txt +++ b/Event/xAOD/xAODParticleEvent/CMakeLists.txt @@ -1,44 +1,28 @@ -# $Id: CMakeLists.txt 751314 2016-06-01 09:14:59Z krasznaa $ -################################################################################ -# Package: xAODParticleEvent -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODParticleEvent ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODEgamma - Event/xAOD/xAODJet - Event/xAOD/xAODMissingET - Event/xAOD/xAODMuon - Event/xAOD/xAODTau - Event/xAOD/xAODTruth ) - -# External dependencies: +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODParticleEvent xAODParticleEvent/*.h xAODParticleEvent/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODParticleEvent - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCore xAODEgamma xAODJet - xAODMissingET xAODMuon xAODTau xAODTruth ${extra_libs} ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCore + xAODEgamma xAODJet xAODMissingET xAODMuon xAODTau xAODTruth ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODParticleEvent/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::ParticleContainer_v1" + "xAOD::CompositeParticleContainer_v1" ) atlas_add_dictionary( xAODParticleEventDict xAODParticleEvent/xAODParticleEventDict.h - xAODParticleEvent/selection.xml - LINK_LIBRARIES ${extra_libs} xAODParticleEvent + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODParticleEvent EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODParticleEvent/xAODParticleEvent/selection.xml b/Event/xAOD/xAODParticleEvent/xAODParticleEvent/selection.xml index daad8f1538b8f3363f5242b9452afa6a21fefe0c..f60f9b63c8f0e6aeef68f9af679fc48f7dc64846 100644 --- a/Event/xAOD/xAODParticleEvent/xAODParticleEvent/selection.xml +++ b/Event/xAOD/xAODParticleEvent/xAODParticleEvent/selection.xml @@ -1,80 +1,28 @@ -<!-- $Id$ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- xAOD::IParticleLink_v1 dictionaries: --> - <class name="xAOD::IParticleLink_v1"> - <!-- <field name="m_proxy" transient="true"/> --> - <!-- <field name="m_element" transient="true"/> --> - </class> - <!-- <read sourceClass="xAOD::IParticleLink_v1" version="[1-]" - targetClass="xAOD::IParticleLink_v1" source="" - > - <![CDATA[ - // Let the object prepare for being used: - newObj->toTransient(); - ]]> - </read> --> - - <class name="xAOD::IParticleLinkContainer_v1" - id="E3A75D69-B84E-41DD-AB67-B5FF6ACBC243" /> - <!-- <read sourceClass="xAOD::IParticleLink_v1" version="[1-]" - targetClass="xAOD::IParticleLink_v1" source="" target="" > - <![CDATA[ - m_p4Cached = false; - ]]> - </read> --> - - <!-- <class name="xAOD::IParticleLinkAuxContainer_v1" - id="3BA65D0C-E2DC-4D7A-84F6-4A1D0EA8728D" /> --> - - - <!-- Particle_v1 dictionaries: --> - <class name="xAOD::Particle_v1" /> - - <class name="xAOD::ParticleContainer_v1" - id="CE9D717A-A6DD-4BCA-A946-63A730E0EA3B" /> - - <class name="xAOD::ParticleAuxContainer_v1" - id="B53E64D2-C5EA-4B93-9B3C-F4506C823708" /> - - <!-- Smart pointers to Particle_v1: --> - <class name="DataLink<xAOD::ParticleContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::ParticleContainer_v1> >" /> - <class name="ElementLink<xAOD::ParticleContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::ParticleContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::ParticleContainer_v1> > >" /> - - - - <!-- CompositeParticle_v1 dictionaries: --> - <class name="xAOD::CompositeParticle_v1" /> - - <class name="xAOD::CompositeParticleContainer_v1" - id="C65FFC20-CC41-4C6D-BEDF-B10E935EBFCC" /> - - <class name="xAOD::CompositeParticleAuxContainer_v1" - id="E43BBAC2-214D-4AFC-927D-AA0EE2C9217C" /> - - <!-- Smart pointers to CompositeParticle_v1: --> - <class name="DataLink<xAOD::CompositeParticleContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::CompositeParticleContainer_v1> >" /> - <class name="ElementLink<xAOD::CompositeParticleContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::CompositeParticleContainer_v1> >" /> - <class name="ElementLinkVector<xAOD::CompositeParticleContainer_v1>" /> - <class name="std::vector<ElementLinkVector<xAOD::CompositeParticleContainer_v1> >" /> - - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<xAOD::IParticleContainer>" /> - <class name="DataVector<xAOD::MissingET_v1>" /> - <class name="ElementLink<xAOD::MissingETContainer_v1>" /> - <!-- <class name="std::vector<ElementLink<xAOD::IParticleContainer> >" /> --> - <!-- <class name="std::vector<std::vector<ElementLink<xAOD::IParticleContainer> > >" /> --> - </exclusion> + <!-- xAOD::Particle interface type(s). --> + <class name="xAOD::Particle_v1" /> + <class name="xAOD::ParticleContainer_v1" + id="CE9D717A-A6DD-4BCA-A946-63A730E0EA3B" /> + <typedef name="xAOD::Particle" /> + <typedef name="xAOD::ParticleContainer" /> + + <!-- xAOD::Particle auxiliary type(s). --> + <class name="xAOD::ParticleAuxContainer_v1" + id="B53E64D2-C5EA-4B93-9B3C-F4506C823708" /> + <typedef name="xAOD::ParticleAuxContainer" /> + + <!-- xAOD::CompositeParticle interface type(s). --> + <class name="xAOD::CompositeParticle_v1" /> + <class name="xAOD::CompositeParticleContainer_v1" + id="C65FFC20-CC41-4C6D-BEDF-B10E935EBFCC" /> + <typedef name="xAOD::CompositeParticle" /> + <typedef name="xAOD::CompositeParticleContainer" /> + + <!-- xAOD::CompositeParticle auxiliary type(s). --> + <class name="xAOD::CompositeParticleAuxContainer_v1" + id="E43BBAC2-214D-4AFC-927D-AA0EE2C9217C" /> + <typedef name="xAOD::CompositeParticleAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODParticleEvent/xAODParticleEvent/xAODParticleEventDict.h b/Event/xAOD/xAODParticleEvent/xAODParticleEvent/xAODParticleEventDict.h index 81b76f04301e40cbff7125a783b233f9e1146791..9371be2e1327f71e88793e09f7b3cb5b33a111b2 100644 --- a/Event/xAOD/xAODParticleEvent/xAODParticleEvent/xAODParticleEventDict.h +++ b/Event/xAOD/xAODParticleEvent/xAODParticleEvent/xAODParticleEventDict.h @@ -1,65 +1,38 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODParticleEventDict.h 649922 2015-02-26 12:20:50Z kkoeneke $ #ifndef XAODPARTICLEEVENT_XAODPARTICLEEVENTDICT_H #define XAODPARTICLEEVENT_XAODPARTICLEEVENTDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - - -// STL -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): -#include "xAODParticleEvent/IParticleLinkContainer.h" +// Local include(s). +#include "xAODParticleEvent/Particle.h" #include "xAODParticleEvent/ParticleContainer.h" #include "xAODParticleEvent/ParticleAuxContainer.h" +#include "xAODParticleEvent/versions/Particle_v1.h" +#include "xAODParticleEvent/versions/ParticleContainer_v1.h" +#include "xAODParticleEvent/versions/ParticleAuxContainer_v1.h" + +#include "xAODParticleEvent/CompositeParticle.h" #include "xAODParticleEvent/CompositeParticleContainer.h" #include "xAODParticleEvent/CompositeParticleAuxContainer.h" +#include "xAODParticleEvent/versions/CompositeParticle_v1.h" +#include "xAODParticleEvent/versions/CompositeParticleContainer_v1.h" +#include "xAODParticleEvent/versions/CompositeParticleAuxContainer_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODPARTICLEEVENT { - xAOD::IParticleLinkContainer_v1 ipl_c1; - DataLink< xAOD::IParticleLinkContainer_v1 > ipl_l1; - ElementLink< xAOD::IParticleLinkContainer_v1 > ipl_l2; - std::vector< DataLink< xAOD::IParticleLinkContainer_v1 > > ipl_l3; - std::vector< ElementLink< xAOD::IParticleLinkContainer_v1 > > ipl_l4; - std::vector< std::vector< ElementLink< xAOD::IParticleLinkContainer_v1 > > > ipl_l5; - - xAOD::ParticleContainer_v1 p_c1; - DataLink< xAOD::ParticleContainer_v1 > p_l1; - ElementLink< xAOD::ParticleContainer_v1 > p_l2; - std::vector< DataLink< xAOD::ParticleContainer_v1 > > p_l3; - std::vector< ElementLink< xAOD::ParticleContainer_v1 > > p_l4; - std::vector< std::vector< ElementLink< xAOD::ParticleContainer_v1 > > > p_l5; - - xAOD::CompositeParticleContainer_v1 cp_c1; - DataLink< xAOD::CompositeParticleContainer_v1 > cp_l1; - ElementLink< xAOD::CompositeParticleContainer_v1 > cp_l2; - std::vector< DataLink< xAOD::CompositeParticleContainer_v1 > > cp_l3; - std::vector< ElementLink< xAOD::CompositeParticleContainer_v1 > > cp_l4; - std::vector< std::vector< ElementLink< xAOD::CompositeParticleContainer_v1 > > > cp_l5; - - // // Smart pointers needed for the correct generation of the auxiliary - // // class dictionaries: - // std::vector< xAOD::IParticleLinkContainer > el1; - // ElementLink< xAOD::IParticleContainer > el7; - // std::vector< ElementLink< xAOD::IParticleContainer > > el8; - // std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > el9; - - }; + struct GCCXML_DUMMY_INSTANTIATION_XAODPARTICLEEVENT { + // Types for which dictionaries are built. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, ParticleContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + CompositeParticleContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, IParticleContainer ); + }; } #endif // XAODPARTICLEEVENT_XAODPARTICLEEVENTDICT_H diff --git a/Event/xAOD/xAODPrimitives/CMakeLists.txt b/Event/xAOD/xAODPrimitives/CMakeLists.txt index 7f3c474e61159dc8ae278dabe4cdb80bc278f78d..5563fec425bfb0df96e6ecfb081952966c0f2292 100644 --- a/Event/xAOD/xAODPrimitives/CMakeLists.txt +++ b/Event/xAOD/xAODPrimitives/CMakeLists.txt @@ -1,36 +1,23 @@ -################################################################################ -# Package: xAODPrimitives -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODPrimitives ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - PRIVATE - AtlasTest/TestTools ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODPrimitives - Root/*.cxx - PUBLIC_HEADERS xAODPrimitives - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TestTools ) + xAODPrimitives/*.h xAODPrimitives/tools/*.h Root/*.cxx + PUBLIC_HEADERS xAODPrimitives + LINK_LIBRARIES AthContainers ) atlas_add_dictionary( xAODPrimitivesDict - xAODPrimitives/xAODPrimitivesDict.h - xAODPrimitives/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers TestTools xAODPrimitives ) + xAODPrimitives/xAODPrimitivesDict.h + xAODPrimitives/selection.xml + LINK_LIBRARIES xAODPrimitives ) +# Test(s) in the package. atlas_add_test( ut_xAOD_primitives_enums_test - SOURCES - test/ut_xAOD_primitives_enums_test.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers TestTools xAODPrimitives ) + SOURCES test/ut_xAOD_primitives_enums_test.cxx + LINK_LIBRARIES xAODPrimitives ) +# Install files from the package. +atlas_install_python_modules( python/*.py ) diff --git a/Event/xAOD/xAODPrimitives/python/__init__.py b/Event/xAOD/xAODPrimitives/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f2f0fc1b7b487784e8781d2a41e43908019e0a7d --- /dev/null +++ b/Event/xAOD/xAODPrimitives/python/__init__.py @@ -0,0 +1 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration diff --git a/Event/xAOD/xAODPrimitives/python/xAODIso.py b/Event/xAOD/xAODPrimitives/python/xAODIso.py new file mode 100644 index 0000000000000000000000000000000000000000..058689be10c4d4248b2905be5e8a588bba5f6353 --- /dev/null +++ b/Event/xAOD/xAODPrimitives/python/xAODIso.py @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Make sure that the dictionary is loaded. +import ROOT +ROOT.xAOD.Iso.ROOT6_NamespaceAutoloadHook() + +# Declare the xAODIso type. +xAODIso = ROOT.xAOD.Iso diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h b/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h index b09a61ea58e24b2871e8ae21823b64e4868bf127..6b3268d68c896818f21f451aaa644fdbd6dac85f 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h @@ -1,10 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: IsolationType.h 718726 2016-01-20 12:10:22Z dzhang $ #ifndef XAODPRIMITIVES_ISOLATIONTYPE_H #define XAODPRIMITIVES_ISOLATIONTYPE_H @@ -100,8 +97,6 @@ namespace xAOD { default: return "[Unknown IsolationType]"; } } - - struct ROOT6_NamespaceAutoloadHook{}; } // namespace Iso diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml b/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml index 0e252c2b6befc9549fec4df3ca86754f321f2153..a93cb86a100dd2a6cca78cc7140b601ea7be2e18 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml @@ -1,8 +1,8 @@ -<!-- $Id: selection.xml 615648 2014-09-08 16:35:14Z schaffer $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <!-- Enums --> <enum pattern="xAOD::Iso::*" /> - <class name="xAOD::Iso::ROOT6_NamespaceAutoloadHook" /> + <struct name="xAOD::Iso::ROOT6_NamespaceAutoloadHook" /> </lcgdict> diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h b/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h index 0196a3b88c358f20f5331defa9e193df5278abf2..29cb59e333d6cd8b940712314f2b2ecf9c948feb 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h @@ -1,17 +1,21 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODPrimitivesDict.h 636772 2014-12-18 15:33:07Z mnowak $ #ifndef XAODPRIMITIVES_XAODPRIMITIVESDICT_H #define XAODPRIMITIVES_XAODPRIMITIVESDICT_H +// Local include(s). #include "xAODPrimitives/IsolationType.h" #include "xAODPrimitives/IsolationCorrection.h" #include "xAODPrimitives/IsolationFlavour.h" #include "xAODPrimitives/IsolationConeSize.h" -#endif // XAODPRIMITIVES_XAODPRIMITIVESDICT_H +namespace xAOD { + namespace Iso { + /// Struct helping with auto-loading this dictionary + struct ROOT6_NamespaceAutoloadHook {}; + } // namespace Iso +} // namespace xAOD +#endif // XAODPRIMITIVES_XAODPRIMITIVESDICT_H diff --git a/Event/xAOD/xAODTau/CMakeLists.txt b/Event/xAOD/xAODTau/CMakeLists.txt index c69a066b94aeadd1c9bd6877cc365e04d4ad9f0b..733c76aac7d7b62cfb98000e71e804cf8457cf0d 100644 --- a/Event/xAOD/xAODTau/CMakeLists.txt +++ b/Event/xAOD/xAODTau/CMakeLists.txt @@ -1,46 +1,32 @@ -# $Id: CMakeLists.txt 775886 2016-09-29 16:03:02Z griffith $ -################################################################################ -# Package: xAODTau -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTau ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODJet - Event/xAOD/xAODPFlow - Event/xAOD/xAODTracking - Event/xAOD/xAODTruth ) - -# External dependencies: +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTau xAODTau/*.h xAODTau/*.icc xAODTau/versions/*.h Root/*.h Root/*.icc Root/*.cxx PUBLIC_HEADERS xAODTau INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCore - xAODJet xAODPFlow xAODTracking xAODTruth ${extra_libs} ) + xAODJet xAODPFlow xAODTracking xAODTruth ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTau/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TauJetContainer_v1" "xAOD::TauJetContainer_v2" + "xAOD::TauJetContainer_v3" "xAOD::DiTauJetContainer_v1" + "xAOD::TauTrackContainer_v1" ) atlas_add_dictionary( xAODTauDict xAODTau/xAODTauDict.h - xAODTau/selection.xml - LINK_LIBRARIES xAODTau + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTau EXTRA_FILES Root/dict/*.cxx ) atlas_add_dictionary( xAODTau_cDict @@ -48,8 +34,7 @@ atlas_add_dictionary( xAODTau_cDict xAODTau/selection_c.xml LINK_LIBRARIES xAODTau ) - -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( xAODTau_TauJet_test SOURCES test/xAODTau_TauJet_test.cxx LINK_LIBRARIES xAODTau ) diff --git a/Event/xAOD/xAODTau/xAODTau/selection.xml b/Event/xAOD/xAODTau/xAODTau/selection.xml index 6ac6160bad59ede27235e9c8751380abaa1cfdfb..56e075cd6eeb7191cb1552fc56d1bc2e5d93157f 100644 --- a/Event/xAOD/xAODTau/xAODTau/selection.xml +++ b/Event/xAOD/xAODTau/xAODTau/selection.xml @@ -1,129 +1,74 @@ -<!-- $Id: selection.xml 767396 2016-08-11 02:39:30Z griffith $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- TauJet_v1 dictionaries: --> - <class name="xAOD::TauJet_v1" /> - - <class name="xAOD::TauJetContainer_v1" - id="93CCE680-47C0-11E3-997C-02163E00A614" /> - <class name="xAOD::TauJetAuxContainer_v1" - id="EA3CE9A0-18D8-49FD-B978-62857D8D8FD0" /> - - <class name="DataLink<xAOD::TauJetContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TauJetContainer_v1> >" /> - - <class name="ElementLink<xAOD::TauJetContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TauJetContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TauJetContainer_v1> > >" /> - - <!-- TauJet_v2 dictionaries: --> - <class name="xAOD::TauJet_v2" /> - - <class name="xAOD::TauJetContainer_v2" - id="AACF5DF5-2D1A-4678-9188-756C27314E2F" /> - <class name="xAOD::TauJetAuxContainer_v2" - id="2853B3D8-136E-444D-AB48-24B1A0E13083" /> - - <class name="DataLink<xAOD::TauJetContainer_v2>" /> - <class name="std::vector<DataLink<xAOD::TauJetContainer_v2> >" /> - - <class name="ElementLink<xAOD::TauJetContainer_v2>" /> - <class name="std::vector<ElementLink<xAOD::TauJetContainer_v2> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TauJetContainer_v2> > >" /> - - - <!-- TauJet_v3 dictionaries: --> - <class name="xAOD::TauJet_v3" /> - - <class name="xAOD::TauJetContainer_v3" - id="9A1207C5-E25F-4974-A9D6-A51DB37F09F9" /> - <class name="xAOD::TauJetAuxContainer_v3" - id="77AA6800-DDAD-44E8-AD90-003D48082A94" /> - - <class name="DataLink<xAOD::TauJetContainer_v3>" /> - <class name="std::vector<DataLink<xAOD::TauJetContainer_v3> >" /> - - <class name="ElementLink<xAOD::TauJetContainer_v3>" /> - <class name="std::vector<ElementLink<xAOD::TauJetContainer_v3> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TauJetContainer_v3> > >" /> - - - <!-- Tell ROOT that it should automatically convert the v1 smart pointer --> - <!-- types into v2 types. Making it possible to read back other objects --> - <!-- from older files that are pointing at TauJets. --> - <read sourceClass="DataLink<xAOD::TauJetContainer_v1>" version="[1-]" - targetClass="DataLink<xAOD::TauJetContainer_v2>" - source="" target="" /> - <read sourceClass="DataLink<xAOD::TauJetContainer_v1>" version="[1-]" - targetClass="DataLink<xAOD::TauJetContainer_v3>" - source="" target="" /> - <read sourceClass="DataLink<xAOD::TauJetContainer_v2>" version="[2-]" - targetClass="DataLink<xAOD::TauJetContainer_v3>" - source="" target="" /> - <read sourceClass="ElementLink<xAOD::TauJetContainer_v1>" version="[1-]" - targetClass="ElementLink<xAOD::TauJetContainer_v2>" - source="" target="" /> - <read sourceClass="ElementLink<xAOD::TauJetContainer_v1>" version="[1-]" - targetClass="ElementLink<xAOD::TauJetContainer_v3>" - source="" target="" /> - <read sourceClass="ElementLink<xAOD::TauJetContainer_v2>" version="[2-]" - targetClass="ElementLink<xAOD::TauJetContainer_v3>" - source="" target="" /> - - - <!-- DiTauJet_v1 dictionaries: --> - <class name="xAOD::DiTauJet_v1" /> - - <class name="xAOD::DiTauJetContainer_v1" - id="0AD18017-0347-4F89-976E-6DA3149DA622" /> - <class name="xAOD::DiTauJetAuxContainer_v1" - id="52A49486-FE88-4448-87E0-5878B69975D1" /> - - <class name="DataLink<xAOD::DiTauJetContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::DiTauJetContainer_v1> >" /> - - <class name="ElementLink<xAOD::DiTauJetContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::DiTauJetContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::DiTauJetContainer_v1> > >" /> - - - <!-- TauTrack_v1 dictionaries: --> - <class name="xAOD::TauTrack_v1" /> - - <class name="xAOD::TauTrackContainer_v1" - id="A45C1CC2-E6BE-4D99-BB49-3CE80AACEDDA" /> - <class name="xAOD::TauTrackAuxContainer_v1" - id="E36C4BCF-0180-461F-8767-46768A7F3573" /> - - <class name="DataLink<xAOD::TauTrackContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TauTrackContainer_v1> >" /> - - <class name="ElementLink<xAOD::TauTrackContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TauTrackContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TauTrackContainer_v1> > >" /> - - <!--Add Helper Functions --> - <function pattern="xAOD::TauHelpers::*" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<DataVector<xAOD::IParticle> >" /> - <class pattern="xAOD::TrackParticle*" /> - <class pattern="DataVector<xAOD::TrackParticle*" /> - <class pattern="ElementLink<DataVector<xAOD::TrackParticle*" /> - <class pattern="xAOD::Vertex*" /> - <class pattern="DataVector<xAOD::Vertex*" /> - <class pattern="ElementLink<DataVector<xAOD::Vertex*" /> - <class pattern="xAOD::Jet*" /> - <class pattern="DataVector<xAOD::Jet*" /> - <class pattern="ElementLink<DataVector<xAOD::Jet*" /> - <class pattern="xAOD::PFO*" /> - <class pattern="DataVector<xAOD::PFO*" /> - <class pattern="ElementLink<DataVector<xAOD::PFO*" /> - </exclusion> + <!-- xAOD::TauJet interface type(s). --> + <class name="xAOD::TauJet_v1" /> + <class name="xAOD::TauJetContainer_v1" + id="93CCE680-47C0-11E3-997C-02163E00A614" /> + <class name="xAOD::TauJet_v2" /> + <class name="xAOD::TauJetContainer_v2" + id="AACF5DF5-2D1A-4678-9188-756C27314E2F" /> + <class name="xAOD::TauJet_v3" /> + <class name="xAOD::TauJetContainer_v3" + id="9A1207C5-E25F-4974-A9D6-A51DB37F09F9" /> + <typedef name="xAOD::TauJet" /> + <typedef name="xAOD::TauJetContainer" /> + + <!-- xAOD::TauJet auxiliary type(s). --> + <class name="xAOD::TauJetAuxContainer_v1" + id="EA3CE9A0-18D8-49FD-B978-62857D8D8FD0" /> + <class name="xAOD::TauJetAuxContainer_v2" + id="2853B3D8-136E-444D-AB48-24B1A0E13083" /> + <class name="xAOD::TauJetAuxContainer_v3" + id="77AA6800-DDAD-44E8-AD90-003D48082A94" /> + <typedef name="xAOD::TauJetAuxContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::TauJetContainer_v1>" version="[1-]" + targetClass="DataLink<xAOD::TauJetContainer_v2>" + source="" target="" /> + <read sourceClass="DataLink<xAOD::TauJetContainer_v1>" version="[1-]" + targetClass="DataLink<xAOD::TauJetContainer_v3>" + source="" target="" /> + <read sourceClass="DataLink<xAOD::TauJetContainer_v2>" version="[2-]" + targetClass="DataLink<xAOD::TauJetContainer_v3>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::TauJetContainer_v1>" version="[1-]" + targetClass="ElementLink<xAOD::TauJetContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::TauJetContainer_v1>" version="[1-]" + targetClass="ElementLink<xAOD::TauJetContainer_v3>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::TauJetContainer_v2>" version="[2-]" + targetClass="ElementLink<xAOD::TauJetContainer_v3>" + source="" target="" /> + + <!-- xAOD::DiTauJet interface type(s). --> + <class name="xAOD::DiTauJet_v1" /> + <class name="xAOD::DiTauJetContainer_v1" + id="0AD18017-0347-4F89-976E-6DA3149DA622" /> + <typedef name="xAOD::DiTauJet" /> + <typedef name="xAOD::DiTauJetContainer" /> + + <!-- xAOD::DiTauJet auxiliary type(s). --> + <class name="xAOD::DiTauJetAuxContainer_v1" + id="52A49486-FE88-4448-87E0-5878B69975D1" /> + <typedef name="xAOD::DiTauJetAuxContainer" /> + + <!-- xAOD::TauTrack interface type(s). --> + <class name="xAOD::TauTrack_v1" /> + <class name="xAOD::TauTrackContainer_v1" + id="A45C1CC2-E6BE-4D99-BB49-3CE80AACEDDA" /> + <typedef name="xAOD::TauTrack" /> + <typedef name="xAOD::TauTrackContainer" /> + + <!-- xAOD::TauTrack auxiliary type(s). --> + <class name="xAOD::TauTrackAuxContainer_v1" + id="E36C4BCF-0180-461F-8767-46768A7F3573" /> + <typedef name="xAOD::TauTrackAuxContainer" /> + + <!-- Helper function(s). --> + <function pattern="xAOD::TauHelpers::*" /> </lcgdict> diff --git a/Event/xAOD/xAODTau/xAODTau/xAODTauDict.h b/Event/xAOD/xAODTau/xAODTau/xAODTauDict.h index 211a84aef0a0151af575cf07cc73c88e60b4c10a..f1ddc0aacff574fd3f8929cff1fd78f08f0aa26d 100644 --- a/Event/xAOD/xAODTau/xAODTau/xAODTauDict.h +++ b/Event/xAOD/xAODTau/xAODTau/xAODTauDict.h @@ -1,115 +1,57 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTauDict.h 796007 2017-02-07 15:38:04Z griffith $ #ifndef XAODTAU_XAODTAUDICT_H #define XAODTAU_XAODTAUDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" -#include "AthLinks/ElementLinkVector.h" - -// Local include(s): +// Local include(s). +#include "xAODTau/TauJet.h" +#include "xAODTau/TauJetContainer.h" +#include "xAODTau/TauJetAuxContainer.h" +#include "xAODTau/versions/TauJet_v1.h" #include "xAODTau/versions/TauJetContainer_v1.h" #include "xAODTau/versions/TauJetAuxContainer_v1.h" +#include "xAODTau/versions/TauJet_v2.h" #include "xAODTau/versions/TauJetContainer_v2.h" #include "xAODTau/versions/TauJetAuxContainer_v2.h" +#include "xAODTau/versions/TauJet_v3.h" #include "xAODTau/versions/TauJetContainer_v3.h" #include "xAODTau/versions/TauJetAuxContainer_v3.h" -#include "xAODTau/versions/DiTauJetContainer_v1.h" -#include "xAODTau/versions/DiTauJetAuxContainer_v1.h" -#include "xAODTau/versions/TauTrackContainer_v1.h" -#include "xAODTau/versions/TauTrackAuxContainer_v1.h" -#include "xAODTau/TauJetContainer.h" -#include "xAODTau/TauJetAuxContainer.h" + +#include "xAODTau/DiTauJet.h" #include "xAODTau/DiTauJetContainer.h" #include "xAODTau/DiTauJetAuxContainer.h" +#include "xAODTau/versions/DiTauJet_v1.h" +#include "xAODTau/versions/DiTauJetContainer_v1.h" +#include "xAODTau/versions/DiTauJetAuxContainer_v1.h" + +#include "xAODTau/TauTrack.h" #include "xAODTau/TauTrackContainer.h" #include "xAODTau/TauTrackAuxContainer.h" +#include "xAODTau/versions/TauTrack_v1.h" +#include "xAODTau/versions/TauTrackContainer_v1.h" +#include "xAODTau/versions/TauTrackAuxContainer_v1.h" +#include "xAODTau/TauxAODHelpers.h" -/// Declare a dummy CLID for xAOD::TauJetContainer_v1. This is only necessary -/// to get DataLink<xAOD::TauJetContainer_v1> and -/// ElementLink<xAOD::TauJetContainer_v1> compiling in the dictionary. The CLID -/// is not needed in the "real" code, since users are never exposed to the _v1 -/// classes in Athena anymore. -CLASS_DEF( xAOD::TauJetContainer_v1, 12345678, 10 ) -CLASS_DEF( xAOD::TauJetContainer_v2, 123456789, 10 ) +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODTAU { - xAOD::TauJetContainer_v1 c1; - DataLink< xAOD::TauJetContainer_v1 > l1; - ElementLink< xAOD::TauJetContainer_v1 > l2; - ElementLinkVector< xAOD::TauJetContainer_v1 > l3; - std::vector< DataLink< xAOD::TauJetContainer_v1 > > l4; - std::vector< ElementLink< xAOD::TauJetContainer_v1 > > l5; - std::vector< std::vector< ElementLink< xAOD::TauJetContainer_v1 > > > l6; - std::vector< ElementLinkVector< xAOD::TauJetContainer_v1 > > l7; - - xAOD::TauJetContainer_v2 c2; - DataLink< xAOD::TauJetContainer_v2 > l8; - ElementLink< xAOD::TauJetContainer_v2 > l9; - ElementLinkVector< xAOD::TauJetContainer_v2 > l10; - std::vector< DataLink< xAOD::TauJetContainer_v2 > > l11; - std::vector< ElementLink< xAOD::TauJetContainer_v2 > > l12; - std::vector< std::vector< ElementLink< xAOD::TauJetContainer_v2 > > > l13; - std::vector< ElementLinkVector< xAOD::TauJetContainer_v2 > > l14; - - xAOD::DiTauJetContainer_v1 c3; - DataLink< xAOD::DiTauJetContainer_v1 > l15; - ElementLink< xAOD::DiTauJetContainer_v1 > l16; - ElementLinkVector< xAOD::DiTauJetContainer_v1 > l17; - std::vector< DataLink< xAOD::DiTauJetContainer_v1 > > l18; - std::vector< ElementLink< xAOD::DiTauJetContainer_v1 > > l19; - std::vector< std::vector< ElementLink< xAOD::DiTauJetContainer_v1 > > > l20; - std::vector< ElementLinkVector< xAOD::DiTauJetContainer_v1 > > l21; - - xAOD::TauTrackContainer_v1 c4; - DataLink< xAOD::TauTrackContainer_v1 > l22; - ElementLink< xAOD::TauTrackContainer_v1 > l23; - ElementLinkVector< xAOD::TauTrackContainer_v1 > l24; - std::vector< DataLink< xAOD::TauTrackContainer_v1 > > l25; - std::vector< ElementLink< xAOD::TauTrackContainer_v1 > > l26; - std::vector< std::vector< ElementLink< xAOD::TauTrackContainer_v1 > > > l27; - std::vector< ElementLinkVector< xAOD::TauTrackContainer_v1 > > l28; - - xAOD::TauJetContainer_v2 c5; - DataLink< xAOD::TauJetContainer_v2 > l29; - ElementLink< xAOD::TauJetContainer_v2 > l30; - ElementLinkVector< xAOD::TauJetContainer_v2 > l31; - std::vector< DataLink< xAOD::TauJetContainer_v2 > > l32; - std::vector< ElementLink< xAOD::TauJetContainer_v2 > > l33; - std::vector< std::vector< ElementLink< xAOD::TauJetContainer_v2 > > > l34; - std::vector< ElementLinkVector< xAOD::TauJetContainer_v2 > > l35; - - - // Instantiate the classes used by xAOD::TauJetAuxContainer, so that - // Reflex would see them with their "correct type". Note that the - // dictionary for these types comes from other places. This instantiation - // is just needed for "Reflex related technical reasons"... - ElementLink< xAOD::TrackParticleContainer > auxlink1; - std::vector< ElementLink< xAOD::TrackParticleContainer > > auxlink2; - ElementLink< xAOD::JetContainer > auxlink3; - std::vector< ElementLink< xAOD::JetContainer > > auxlink4; - ElementLink< xAOD::PFOContainer > auxlink5; - std::vector< ElementLink< xAOD::PFOContainer > > auxlink6; - ElementLink< xAOD::VertexContainer > auxlink7; - std::vector< ElementLink< xAOD::VertexContainer > > auxlink8; - ElementLink< xAOD::TauTrackContainer > auxlink9; - std::vector< ElementLink< xAOD::TauTrackContainer > > auxlink10; + struct GCCXML_DUMMY_INSTANTIATION_XAODTAU { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TauJetContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TauJetContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TauJetContainer_v3 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, DiTauJetContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TauTrackContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, VertexContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, PFOContainer ); }; } diff --git a/Event/xAOD/xAODTracking/CMakeLists.txt b/Event/xAOD/xAODTracking/CMakeLists.txt index 0ebb21124b04a221d9755ec4990376279dae38d5..4a0db8be2f788a4c5615432cd0fb2818042c3589 100644 --- a/Event/xAOD/xAODTracking/CMakeLists.txt +++ b/Event/xAOD/xAODTracking/CMakeLists.txt @@ -1,57 +1,41 @@ -################################################################################ -# Package: xAODTracking -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTracking ) -# Extra dependencies, based on what environment we are in: +# Extra dependencies, based on what environment we are in. if( NOT XAOD_STANDALONE AND NOT XAOD_ANALYSIS ) - set( extra_deps Tracking/TrkEvent/TrkNeutralParameters - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkTrack - Tracking/TrkEvent/VxVertex ) - set( extra_libs TrkNeutralParameters TrkParameters TrkTrack VxVertex ) + set( extra_libs TrkNeutralParameters TrkParameters TrkTrack VxVertex ) endif() -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs ${extra_libs} GenVector ) - endif() -endif() - -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/CxxUtils - Control/AthContainers - Control/AthLinks - DetectorDescription/GeoPrimitives - Event/EventPrimitives - Event/xAOD/xAODBase - Event/xAOD/xAODCore - ${extra_deps} ) - -# External dependencies: -find_package( Eigen ) +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTracking xAODTracking/*.h xAODTracking/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODTracking - INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${ROOT_LIBRARIES} AthContainers - AthLinks GeoPrimitives + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks GeoPrimitives EventPrimitives xAODBase xAODCore ${extra_libs} ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTracking/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrackParticleContainer_v1" + "xAOD::NeutralParticleContainer_v1" "xAOD::VertexContainer_v1" + "xAOD::TrackMeasurementValidationContainer_v1" + "xAOD::TrackStateValidationContainer_v1" + "xAOD::SCTRawHitValidationContainer_v1" ) + atlas_add_dictionary( xAODTrackingDict xAODTracking/xAODTrackingDict.h - xAODTracking/selection.xml - LINK_LIBRARIES xAODTracking + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTracking EXTRA_FILES Root/dict/*.cxx ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( xAODTracking_TrackParticle_test SOURCES test/xAODTracking_TrackParticle_test.cxx LINK_LIBRARIES xAODTracking ) diff --git a/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx b/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx index ccfd3dc8f4f6fc3b176c10526cb473de5eb98860..8fd8eaccb21fdf599c706471116d47a5cb428c44 100644 --- a/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Misc includes @@ -7,6 +7,8 @@ #include <cassert> #include <vector> #include <stdexcept> +#include <atomic> +#include <iostream> // EDM include(s): #include "xAODCore/AuxStoreAccessorMacros.h" @@ -16,8 +18,27 @@ #include "xAODTracking/TrackSummaryAccessors_v1.h" #include "EventPrimitives/EventPrimitivesHelpers.h" -// Amg include -//#include "EventPrimitives/EventPrimitives.h" + +namespace xAODTrackParticlePrivate { + + /// Function that would be possible to use to debug what client is trying + /// to access covariance matrix from an @c xAOD::TrackParticle object, before they + /// it has been set. + void covarianceUnsetHook() { + static std::atomic< bool > uninitCovarianceAccessPrinted = false; + if( ! uninitCovarianceAccessPrinted ) { + std::cout << "xAOD::TrackParticle WARNING Uninitialised covariance matrix was " + "accessed.\n" + " Debug it by breaking on " + "xAODTrackParticlePrivate::covarianceUnsetHook function calls!" + << std::endl; + uninitCovarianceAccessPrinted = true; + } + return; + } + +} + namespace xAOD { @@ -207,6 +228,7 @@ namespace xAOD { cov( i, i ) = diagVec[ i ]; } } else { + xAODTrackParticlePrivate::covarianceUnsetHook(); // If the variable is not available/set, set the matrix to identity. cov.setIdentity(); } @@ -231,6 +253,8 @@ namespace xAOD { } } + else xAODTrackParticlePrivate::covarianceUnsetHook(); + } else{ //Compressed case @@ -255,6 +279,8 @@ namespace xAOD { } + else xAODTrackParticlePrivate::covarianceUnsetHook(); + } diff --git a/Event/xAOD/xAODTracking/Root/TrackParticlexAODHelpers.cxx b/Event/xAOD/xAODTracking/Root/TrackParticlexAODHelpers.cxx index 348c803cecdedd6c417e645b18bb88d2ab5117f1..33b1028f89cecddea18b53552d87fb1205a225d5 100644 --- a/Event/xAOD/xAODTracking/Root/TrackParticlexAODHelpers.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackParticlexAODHelpers.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "xAODTracking/TrackParticlexAODHelpers.h" @@ -14,7 +14,9 @@ namespace xAOD { if (!tp) { throw std::runtime_error("Invalid TrackParticle pointer."); } - if( tp->definingParametersCovMatrixFilled() != xAOD::FullCovMatrixAvailable ) { + SG::AuxElement::ConstAccessor< std::vector<float> > accDiag( "definingParametersCovMatrixDiag" ); + SG::AuxElement::ConstAccessor< std::vector<float> > accOffDiag( "definingParametersCovMatrixOffDiag" ); + if( !(accDiag.isAvailable( *tp ) && accOffDiag.isAvailable( *tp )) ) { throw std::runtime_error("TrackParticle without covariance matrix for the defining parameters."); } } diff --git a/Event/xAOD/xAODTracking/xAODTracking/selection.xml b/Event/xAOD/xAODTracking/xAODTracking/selection.xml index 1c70c76fd1a1f403032d00687692fbe31ff15122..a36b2eaca42a0e895ede619a73d988816004eafb 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/selection.xml +++ b/Event/xAOD/xAODTracking/xAODTracking/selection.xml @@ -1,180 +1,135 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- VERTEX DICTIONARIES --> - - <!-- Vertex_v1 dictionaries: --> - <class name="xAOD::Vertex_v1" > - <field name="m_position" transient="true" /> - <field name="m_covariance" transient="true" /> - </class> - <read sourceClass="xAOD::Vertex_v1" version="[1-]" - targetClass="xAOD::Vertex_v1" source="" target="" > - <![CDATA[ - newObj->resetCache(); - ]]> - </read> - <class name="xAOD::VertexContainer_v1" - id="00B6DBA1-0E0D-4FDA-BFEF-F08EEFFE4BA0" /> - <class name="xAOD::VertexAuxContainer_v1" - id="B1F73A82-9B4E-4508-8EB0-EF7D6E05BA57" /> - - <!-- Vertex_v1 links: --> - <class name="DataLink<xAOD::VertexContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::VertexContainer_v1> >" /> - <class name="ElementLink<xAOD::VertexContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::VertexContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::VertexContainer_v1> > >" /> + <!-- xAOD::TrackParticle interface type(s). --> + <class name="xAOD::TrackParticle_v1" > + <field name="m_perigeeParameters" transient="true" /> + </class> + <read sourceClass="xAOD::TrackParticle_v1" version="[1-]" + targetClass="xAOD::TrackParticle_v1" source="" target="" > + <![CDATA[ + newObj->resetCache(); + ]]> + </read> + <class name="xAOD::TrackParticleContainer_v1" + id="F7564EE8-3BD2-11E3-A42F-6C3BE51AB9F1" /> + <typedef name="xAOD::TrackParticle" /> + <typedef name="xAOD::TrackParticleContainer" /> + + <!-- xAOD::TrackParticle auxiliary type(s). --> + <class name="xAOD::TrackParticleAuxContainer_v1" + id="C3B01EA0-CA87-4C96-967F-E0F9A75BD370"/> + <class name="xAOD::TrackParticleAuxContainer_v2" + id="53031BE5-2156-41E8-B70C-41A1C0572FC5"/> + <read sourceClass="xAOD::TrackParticleAuxContainer_v2" version="[1-]" + targetClass="xAOD::TrackParticleAuxContainer_v2" + source="" target="" > + <![CDATA[ + newObj->toTransient(); + ]]> + </read> + <class name="xAOD::TrackParticleAuxContainer_v3" + id="F41DF744-242D-11E6-B472-02163E010CEC"/> + <read sourceClass="xAOD::TrackParticleAuxContainer_v3" version="[1-]" + targetClass="xAOD::TrackParticleAuxContainer_v3" + source="" target="" > + <![CDATA[ + newObj->toTransient(); + ]]> + </read> + <class name="xAOD::TrackParticleAuxContainer_v4" + id="403ceb6e-2a3d-11e8-b048-080027f5cbda"/> + <read sourceClass="xAOD::TrackParticleAuxContainer_v4" version="[1-]" + targetClass="xAOD::TrackParticleAuxContainer_v4" + source="" target="" > + <![CDATA[ + newObj->toTransient(); + ]]> + </read> + <class name="xAOD::TrackParticleAuxContainer_v5" + id="3CE194F2-99D1-42D5-A3EB-D193E0AFA9FF"/> + <typedef name="xAOD::TrackParticleAuxContainer" /> + + <!-- xAOD::NeutralParticle interface type(s). --> + <class name="xAOD::NeutralParticle_v1" > + <field name="m_perigeeParameters" transient="true" /> + </class> + <read sourceClass="xAOD::NeutralParticle_v1" version="[1-]" + targetClass="xAOD::NeutralParticle_v1" source="" target="" > + <![CDATA[ + newObj->resetCache(); + ]]> + </read> + <class name="xAOD::NeutralParticleContainer_v1" + id="12869D6A-5CEB-11E3-B64A-02163E00A92F" /> + <typedef name="xAOD::NeutralParticle" /> + <typedef name="xAOD::NeutralParticleContainer" /> + + <!-- xAOD::NeutralParticle auxiliary type(s). --> + <class name="xAOD::NeutralParticleAuxContainer_v1" + id="006862BC-5CEB-11E3-9FB4-02163E00A92F" /> + <typedef name="xAOD::NeutralParticleAuxContainer" /> - <!-- TRACK PARTICLE DICTIONARIES --> - - <!-- TrackParticle_v1 dictionaries: --> - <class name="xAOD::TrackParticle_v1"> - <field name="m_perigeeParameters" transient="true"/> - </class> - <read sourceClass="xAOD::TrackParticle_v1" version="[1-]" - targetClass="xAOD::TrackParticle_v1" source="" target="" > - <![CDATA[ - newObj->resetCache(); - ]]> - </read> - <class name="xAOD::TrackParticleAuxContainer_v1" - id="C3B01EA0-CA87-4C96-967F-E0F9A75BD370"/> - <class name="xAOD::TrackParticleContainer_v1" - id="F7564EE8-3BD2-11E3-A42F-6C3BE51AB9F1"/> - - <class name="xAOD::TrackParticleAuxContainer_v2" - id="53031BE5-2156-41E8-B70C-41A1C0572FC5"/> - - <class name="xAOD::TrackParticleAuxContainer_v3" - id="F41DF744-242D-11E6-B472-02163E010CEC"/> - - <class name="xAOD::TrackParticleAuxContainer_v4" - id="403ceb6e-2a3d-11e8-b048-080027f5cbda"/> - - <class name="xAOD::TrackParticleAuxContainer_v5" - id="3CE194F2-99D1-42D5-A3EB-D193E0AFA9FF"/> - - <read sourceClass="xAOD::TrackParticleAuxContainer_v4" version="[1-]" - targetClass="xAOD::TrackParticleAuxContainer_v4" - source="" target="" > - <![CDATA[ - newObj->toTransient(); - ]]> - </read> - - <read sourceClass="xAOD::TrackParticleAuxContainer_v3" version="[1-]" - targetClass="xAOD::TrackParticleAuxContainer_v3" - source="" target="" > - <![CDATA[ - newObj->toTransient(); - ]]> - </read> - - <read sourceClass="xAOD::TrackParticleAuxContainer_v2" version="[1-]" - targetClass="xAOD::TrackParticleAuxContainer_v2" - source="" target="" > - <![CDATA[ - newObj->toTransient(); - ]]> - </read> - - <!-- NeutralParticle_v1 dictionaries: --> - <class name="xAOD::NeutralParticle_v1"> - <field name="m_perigeeParameters" transient="true"/> - </class> - <read sourceClass="xAOD::NeutralParticle_v1" version="[1-]" - targetClass="xAOD::NeutralParticle_v1" source="" target="" > - <![CDATA[ - newObj->resetCache(); - ]]> - </read> - <class name="xAOD::NeutralParticleAuxContainer_v1" - id="006862BC-5CEB-11E3-9FB4-02163E00A92F"/> - <class name="xAOD::NeutralParticleContainer_v1" - id="12869D6A-5CEB-11E3-B64A-02163E00A92F"/> - - <!-- All smart pointer dictionaries for xAOD::IParticle --> - <class name="DataLink<xAOD::TrackParticleContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrackParticleContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrackParticleContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrackParticleContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrackParticleContainer_v1> > >" /> - - <!-- All smart pointer dictionaries for xAOD::IParticle --> - <class name="DataLink<xAOD::NeutralParticleContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::NeutralParticleContainer_v1> >" /> - - <class name="ElementLink<xAOD::NeutralParticleContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::NeutralParticleContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::NeutralParticleContainer_v1> > >" /> - - <!-- SCTRawHitValidation_v1 dictionaries: --> - <class name="xAOD::SCTRawHitValidation_v1"/> - <class name="xAOD::SCTRawHitValidationAuxContainer_v1" - id="788781DA-FE8A-414A-A72B-6E846094FCF8" /> - <class name="xAOD::SCTRawHitValidationContainer_v1" - id="4F8042A1-64B0-42AB-B0A4-C9716C15336A" /> - - <!-- Smart pointers to objects: --> - <class name="DataLink<xAOD::SCTRawHitValidationContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::SCTRawHitValidationContainer_v1> >" /> - - <class name="ElementLink<xAOD::SCTRawHitValidationContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::SCTRawHitValidationContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::SCTRawHitValidationContainer_v1> > >" /> - - <!-- TrackMeasurementValidation_v1 dictionaries: --> - <class name="xAOD::TrackMeasurementValidation_v1"/> - <class name="xAOD::TrackMeasurementValidationAuxContainer_v1" - id="61B62A1A-4C51-43A2-9623-1B9E910A81E8"/> - <class name="xAOD::TrackMeasurementValidationContainer_v1" - id="868F1FD8-AFE7-4B40-B12E-73716C37A6B0"/> - - <!-- Smart pointers to objects: --> - <class name="DataLink<xAOD::TrackMeasurementValidationContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrackMeasurementValidationContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrackMeasurementValidationContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrackMeasurementValidationContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrackMeasurementValidationContainer_v1> > >" /> - - - <!-- TrackStateValidation_v1 dictionaries: --> - <class name="xAOD::TrackStateValidation_v1"/> - <class name="xAOD::TrackStateValidationAuxContainer_v1" - id="797432BD-DBEE-4C08-BF8E-E0556434A3F3"/> - <class name="xAOD::TrackStateValidationContainer_v1" - id="149664B4-C7A7-4373-B5BA-D8D2DB3E65B5"/> - - <!-- Smart pointers to objects: --> - <class name="DataLink<xAOD::TrackStateValidationContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrackStateValidationContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrackStateValidationContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrackStateValidationContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrackStateValidationContainer_v1> > >" /> - - <class name="xAOD::CurvilinearParameters_t" /> - - <!-- Enums --> - <enum pattern="xAOD::*" /> - - <class name="std::vector<std::vector<std::vector<int> > >"/> - <class name="std::vector<std::vector<std::vector<float> > >"/> - <class name="std::vector<std::vector<unsigned long> >"/> - - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <enum name="xAOD::Type::ObjectType" /> - </exclusion> - - <!--Add Helper Functions --> - <function pattern="xAOD::TrackParticleHelpers::*" /> + <!-- xAOD::Vertex interface type(s). --> + <class name="xAOD::Vertex_v1" > + <field name="m_position" transient="true" /> + <field name="m_covariance" transient="true" /> + </class> + <read sourceClass="xAOD::Vertex_v1" version="[1-]" + targetClass="xAOD::Vertex_v1" source="" target="" > + <![CDATA[ + newObj->resetCache(); + ]]> + </read> + <class name="xAOD::VertexContainer_v1" + id="00B6DBA1-0E0D-4FDA-BFEF-F08EEFFE4BA0" /> + <typedef name="xAOD::Vertex" /> + <typedef name="xAOD::VertexContainer" /> + + <!-- xAOD::Vertex auxiliary type(s). --> + <class name="xAOD::VertexAuxContainer_v1" + id="B1F73A82-9B4E-4508-8EB0-EF7D6E05BA57" /> + <typedef name="xAOD::VertexAuxContainer" /> + + <!-- xAOD::TrackMeasurementValidation interface type(s). --> + <class name="xAOD::TrackMeasurementValidation_v1" /> + <class name="xAOD::TrackMeasurementValidationContainer_v1" + id="868F1FD8-AFE7-4B40-B12E-73716C37A6B0" /> + <typedef name="xAOD::TrackMeasurementValidation" /> + <typedef name="xAOD::TrackMeasurementValidationContainer" /> + + <!-- xAOD::TrackMeasurementValidation auxiliary type(s). --> + <class name="xAOD::TrackMeasurementValidationAuxContainer_v1" + id="61B62A1A-4C51-43A2-9623-1B9E910A81E8" /> + <typedef name="xAOD::TrackMeasurementValidationAuxContainer" /> + + <!-- xAOD::TrackStateValidation interface type(s). --> + <class name="xAOD::TrackStateValidation_v1" /> + <class name="xAOD::TrackStateValidationContainer_v1" + id="149664B4-C7A7-4373-B5BA-D8D2DB3E65B5" /> + <typedef name="xAOD::TrackStateValidation" /> + <typedef name="xAOD::TrackStateValidationContainer" /> + + <!-- xAOD::TrackStateValidation auxiliary type(s). --> + <class name="xAOD::TrackStateValidationAuxContainer_v1" + id="797432BD-DBEE-4C08-BF8E-E0556434A3F3" /> + <typedef name="xAOD::TrackStateValidationAuxContainer" /> + + <!-- xAOD::SCTRawHitValidation interface type(s). --> + <class name="xAOD::SCTRawHitValidation_v1" /> + <class name="xAOD::SCTRawHitValidationContainer_v1" + id="4F8042A1-64B0-42AB-B0A4-C9716C15336A" /> + <typedef name="xAOD::SCTRawHitValidation" /> + <typedef name="xAOD::SCTRawHitValidationContainer" /> + + <!-- xAOD::SCTRawHitValidation auxiliary type(s). --> + <class name="xAOD::SCTRawHitValidationAuxContainer_v1" + id="788781DA-FE8A-414A-A72B-6E846094FCF8" /> + <typedef name="xAOD::SCTRawHitValidationAuxContainer" /> + + <!-- Additional type(s). --> + <class name="xAOD::CurvilinearParameters_t" /> + <enum pattern="xAOD::*" /> + <function pattern="xAOD::TrackParticleHelpers::*" /> </lcgdict> diff --git a/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h b/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h index 02b9e7895503a2acf25f1eba86ba8ed246d902b6..78f6ff384d6fdbf02003d1ed6a44c7095c6c426c 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h +++ b/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h @@ -1,48 +1,49 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef XAODTRACKING_XAODTRACKINGDICT_H #define XAODTRACKING_XAODTRACKINGDICT_H - -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// System include(s): -#include <bitset> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" -// Local include(s): +// Local include(s). +#include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/versions/TrackParticle_v1.h" #include "xAODTracking/versions/TrackParticleContainer_v1.h" #include "xAODTracking/versions/TrackParticleAuxContainer_v1.h" #include "xAODTracking/versions/TrackParticleAuxContainer_v2.h" #include "xAODTracking/versions/TrackParticleAuxContainer_v3.h" #include "xAODTracking/versions/TrackParticleAuxContainer_v4.h" #include "xAODTracking/versions/TrackParticleAuxContainer_v5.h" + +#include "xAODTracking/NeutralParticle.h" #include "xAODTracking/NeutralParticleContainer.h" +#include "xAODTracking/NeutralParticleAuxContainer.h" +#include "xAODTracking/versions/NeutralParticle_v1.h" #include "xAODTracking/versions/NeutralParticleContainer_v1.h" #include "xAODTracking/versions/NeutralParticleAuxContainer_v1.h" -#include "xAODTracking/versions/Vertex_v1.h" + +#include "xAODTracking/Vertex.h" #include "xAODTracking/VertexContainer.h" -#include "xAODTracking/versions/VertexContainer_v1.h" +#include "xAODTracking/VertexAuxContainer.h" +#include "xAODTracking/versions/Vertex_v1.h" #include "xAODTracking/versions/VertexContainer_v1.h" #include "xAODTracking/versions/VertexAuxContainer_v1.h" + +#include "xAODTracking/TrackMeasurementValidation.h" #include "xAODTracking/TrackMeasurementValidationContainer.h" +#include "xAODTracking/TrackMeasurementValidationAuxContainer.h" +#include "xAODTracking/versions/TrackMeasurementValidation_v1.h" #include "xAODTracking/versions/TrackMeasurementValidationContainer_v1.h" #include "xAODTracking/versions/TrackMeasurementValidationAuxContainer_v1.h" + +#include "xAODTracking/TrackStateValidation.h" #include "xAODTracking/TrackStateValidationContainer.h" +#include "xAODTracking/TrackStateValidationAuxContainer.h" +#include "xAODTracking/versions/TrackStateValidation_v1.h" #include "xAODTracking/versions/TrackStateValidationContainer_v1.h" #include "xAODTracking/versions/TrackStateValidationAuxContainer_v1.h" -#include "xAODTracking/TrackingPrimitives.h" -#include "xAODTracking/TrackParticlexAODHelpers.h" #include "xAODTracking/SCTRawHitValidation.h" #include "xAODTracking/SCTRawHitValidationContainer.h" @@ -51,73 +52,33 @@ #include "xAODTracking/versions/SCTRawHitValidationContainer_v1.h" #include "xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h" -namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODTRACKING { - xAOD::TrackParticleContainer_v1 c1; - DataLink< xAOD::TrackParticleContainer_v1 > l1; - std::vector< DataLink< xAOD::TrackParticleContainer_v1 > > l2; - ElementLink< xAOD::TrackParticleContainer > l3; - std::vector< ElementLink< xAOD::TrackParticleContainer_v1 > > l4; - std::vector< std::vector< ElementLink< xAOD::TrackParticleContainer_v1 > > > l5; - - xAOD::NeutralParticleContainer_v1 nc1; - DataLink< xAOD::NeutralParticleContainer_v1 > nl1; - std::vector< DataLink< xAOD::NeutralParticleContainer_v1 > > nl2; - ElementLink< xAOD::NeutralParticleContainer > nl3; - std::vector< ElementLink< xAOD::NeutralParticleContainer_v1 > > nl4; - std::vector< std::vector< ElementLink< xAOD::NeutralParticleContainer_v1 > > > nl5; - -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) - std::bitset< 11 > dummy1; - TrackCollection c2; - ElementLink<TrackCollection> l8; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE - - // Container(s): - xAOD::VertexContainer_v1 c3; - // Data link(s): - DataLink< xAOD::VertexContainer_v1 > dl1; - std::vector< DataLink< xAOD::VertexContainer_v1 > > dl2; - // Element link(s): - ElementLink< xAOD::VertexContainer > el1; - std::vector< ElementLink< xAOD::VertexContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::VertexContainer_v1 > > > el3; - - // Container(s): - xAOD::TrackMeasurementValidationContainer_v1 c4; - // Data link(s): - DataLink< xAOD::TrackMeasurementValidationContainer_v1 > pdl1; - std::vector< DataLink< xAOD::TrackMeasurementValidationContainer_v1 > > pdl2; - // Element link(s): - ElementLink< xAOD::TrackMeasurementValidationContainer > pel1; - std::vector< ElementLink< xAOD::TrackMeasurementValidationContainer_v1 > > pel2; - std::vector< std::vector< ElementLink< xAOD::TrackMeasurementValidationContainer_v1 > > > pel3; +#include "xAODTracking/TrackingPrimitives.h" +#include "xAODTracking/TrackParticlexAODHelpers.h" - // Container(s): - xAOD::TrackStateValidationContainer_v1 c5; - // Data link(s): - DataLink< xAOD::TrackStateValidationContainer_v1 > mdl1; - std::vector< DataLink< xAOD::TrackStateValidationContainer_v1 > > mdl2; - // Element link(s): - ElementLink< xAOD::TrackStateValidationContainer > mel1; - std::vector< ElementLink< xAOD::TrackStateValidationContainer_v1 > > mel2; - std::vector< std::vector< ElementLink< xAOD::TrackStateValidationContainer_v1 > > > mel3; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - std::vector<std::vector<std::vector<int> > > vecDummyIntX; - std::vector<std::vector<std::vector<float> > > vecDummyFltX; - std::vector<std::vector<unsigned long> > vecDummyULX; +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODTRACKING { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, NeutralParticleContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, VertexContainer_v1 ); - // Container(s): - xAOD::SCTRawHitValidationContainer_v1 c6; - // Data link(s): - DataLink< xAOD::SCTRawHitValidationContainer_v1 > rdodl1; - std::vector< DataLink< xAOD::SCTRawHitValidationContainer_v1 > > rdodl2; - // Element link(s): - ElementLink< xAOD::SCTRawHitValidationContainer > rdoel1; - std::vector< ElementLink< xAOD::SCTRawHitValidationContainer_v1 > > rdoel2; - std::vector< std::vector< ElementLink< xAOD::SCTRawHitValidationContainer_v1 > > > rdoel3; + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + TrackMeasurementValidationContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + TrackStateValidationContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + SCTRawHitValidationContainer_v1 ); - }; + // Type(s) needed for the dictionary generation to succeed. +#ifndef XAOD_STANDALONE + XAOD_INSTANTIATE_CONTAINER_TYPES( TrackCollection ); +#endif // not XAOD_STANDALONE + xAOD::CurvilinearParameters_t dummy; + }; } #endif // XAODTRACKPARTICLE_XAODTRACKPARTICLEDICT_H diff --git a/Event/xAOD/xAODTrigBphys/CMakeLists.txt b/Event/xAOD/xAODTrigBphys/CMakeLists.txt index 9fc1887f553f709f4d2c3644467ff82f92a3c863..a27d641423a21500af332f8392de215ca8bba5bd 100644 --- a/Event/xAOD/xAODTrigBphys/CMakeLists.txt +++ b/Event/xAOD/xAODTrigBphys/CMakeLists.txt @@ -1,34 +1,24 @@ -################################################################################ -# Package: xAODTrigBphys -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigBphys ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Event/xAOD/xAODCore - Event/xAOD/xAODTracking - PRIVATE - Control/AthLinks ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigBphys - Root/*.cxx - PUBLIC_HEADERS xAODTrigBphys - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers xAODCore xAODTracking - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks ) - -atlas_add_dictionary( xAODTrigBphysDict - xAODTrigBphys/xAODTrigBphysDict.h - xAODTrigBphys/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers xAODCore xAODTracking AthLinks xAODTrigBphys - EXTRA_FILES Root/dict/*.cxx ) + xAODTrigBphys/*.h xAODTrigBphys/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigBphys + LINK_LIBRARIES AthContainers AthLinks xAODCore xAODTracking ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigBphys/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigBphysContainer_v1" ) +atlas_add_dictionary( xAODTrigBphysDict + xAODTrigBphys/xAODTrigBphysDict.h + ${_selectionFile} + LINK_LIBRARIES xAODTrigBphys + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigBphys/xAODTrigBphys/selection.xml b/Event/xAOD/xAODTrigBphys/xAODTrigBphys/selection.xml index 6dfe8352c559b92989694c9afdfdb57dcf5cc013..fd11c8a13f9692d87014873fe577e049e05c3f95 100644 --- a/Event/xAOD/xAODTrigBphys/xAODTrigBphys/selection.xml +++ b/Event/xAOD/xAODTrigBphys/xAODTrigBphys/selection.xml @@ -1,28 +1,16 @@ -<!-- $Id: selection.xml 646005 2015-02-11 13:20:20Z krasznaa $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- TrigBphys dictionaries --> - <class name="xAOD::TrigBphys_v1" /> - <class name="xAOD::TrigBphysContainer_v1" - id="FD05137E-421B-40B5-AB7C-D119C5490784" /> - <class name="xAOD::TrigBphysAuxContainer_v1" - id="C7246162-DB5D-4ACA-BF20-838A1B2BC4A3" /> + <!-- xAOD::TrigBphys interface type(s). --> + <class name="xAOD::TrigBphys_v1" /> + <class name="xAOD::TrigBphysContainer_v1" + id="FD05137E-421B-40B5-AB7C-D119C5490784" /> + <typedef name="xAOD::TrigBphys" /> + <typedef name="xAOD::TrigBphysContainer" /> - <class name="DataLink<xAOD::TrigBphysContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrigBphysContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrigBphysContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigBphysContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigBphysContainer_v1> > >" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<DataVector<xAOD::IParticle> >" /> - <class name="ElementLink<DataVector<xAOD::TrackParticle_v1> >" /> - </exclusion> + <!-- xAOD::TrigBphys auxiliary type(s). --> + <class name="xAOD::TrigBphysAuxContainer_v1" + id="C7246162-DB5D-4ACA-BF20-838A1B2BC4A3" /> + <typedef name="xAOD::TrigBphysAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigBphys/xAODTrigBphys/xAODTrigBphysDict.h b/Event/xAOD/xAODTrigBphys/xAODTrigBphys/xAODTrigBphysDict.h index f0ce4dc4e1ea36b591422a5839ba28bc9704c7d4..c2b6c7f0290bfcdcaac41aa9e9c47d41f6f96805 100644 --- a/Event/xAOD/xAODTrigBphys/xAODTrigBphys/xAODTrigBphysDict.h +++ b/Event/xAOD/xAODTrigBphys/xAODTrigBphys/xAODTrigBphysDict.h @@ -1,54 +1,29 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#ifndef XAODTRIGBPHYS_XAODTRIGBPHYSDICT_H +#define XAODTRIGBPHYS_XAODTRIGBPHYSDICT_H -// $Id: xAODTrigBphysDict.h 632753 2014-12-01 17:04:27Z jwalder $ -#ifndef XAODTRIGBPHYS_AODTRIGBPHYSDICT_H -#define XAODTRIGBPHYS_AODTRIGBPHYSDICT_H - -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODTrigBphys/TrigBphys.h" #include "xAODTrigBphys/TrigBphysContainer.h" +#include "xAODTrigBphys/TrigBphysAuxContainer.h" #include "xAODTrigBphys/versions/TrigBphys_v1.h" #include "xAODTrigBphys/versions/TrigBphysContainer_v1.h" #include "xAODTrigBphys/versions/TrigBphysAuxContainer_v1.h" -namespace{ - struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGBPHYS { - - xAOD::TrigBphysContainer_v1 bphys_l1; - ElementLink< xAOD::TrigBphysContainer_v1 > bphys_l2; - DataLink< xAOD::TrigBphysContainer_v1 > bphys_l3; - std::vector< ElementLink< xAOD::TrigBphysContainer_v1 > > bphys_l4; - std::vector< DataLink< xAOD::TrigBphysContainer_v1 > > bphys_l5; - std::vector< std::vector< ElementLink< xAOD::TrigBphysContainer_v1 > > > bphys_l6; - std::vector< std::vector< ElementLink< xAOD::TrackParticleContainer > > > bphys_17; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - // Instantiate the classes used by xAOD::xAODTrigBphys so that - // Reflex would see them with their "correct type". Note that the - // dictionary for these types comes from other places. This instantiation - // is just needed for "Reflex related technical reasons"... - ElementLink< xAOD::TrackParticleContainer > auxlink1; - std::vector< ElementLink< xAOD::TrackParticleContainer > > auxlink2; - std::vector< std::vector< ElementLink< xAOD::TrackParticleContainer > > > auxlink3; - - ElementLink< xAOD::IParticleContainer > auxlink4; - std::vector< ElementLink< xAOD::IParticleContainer > > auxlink5; - std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > auxlink6; - }; +// Instantiate all necessary types for the dictionary. +namespace{ + struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGBPHYS { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigBphysContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); + }; } -#endif // XAODTRIGBPHYS_AODTRIGBPHYSDICT_H +#endif // XAODTRIGBPHYS_XAODTRIGBPHYSDICT_H diff --git a/Event/xAOD/xAODTrigBphysCnv/CMakeLists.txt b/Event/xAOD/xAODTrigBphysCnv/CMakeLists.txt index 27cd12b5b419b3c402c1ed794d762b0daa3d7c18..88a0f8764ce77c8b5b1568a9e14d57615405e336 100644 --- a/Event/xAOD/xAODTrigBphysCnv/CMakeLists.txt +++ b/Event/xAOD/xAODTrigBphysCnv/CMakeLists.txt @@ -14,11 +14,18 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel Trigger/TrigEvent/TrigParticle ) +atlas_add_library( xAODTrigBphysCnvLib + xAODTrigBphysCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODTrigBphysCnv + LINK_LIBRARIES GaudiKernel xAODTrigBphys ) + + # Component(s) in the package: atlas_add_component( xAODTrigBphysCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODTrigBphys GaudiKernel AthenaBaseComps AthenaKernel TrigParticle ) + LINK_LIBRARIES xAODTrigBphysCnvLib xAODTrigBphys GaudiKernel AthenaBaseComps AthenaKernel TrigParticle ) # Install files from the package: atlas_install_headers( xAODTrigBphysCnv ) diff --git a/Event/xAOD/xAODTrigCalo/CMakeLists.txt b/Event/xAOD/xAODTrigCalo/CMakeLists.txt index b0bbbb5aab2fbac0a16fd3b9cbc501f6754ce416..70bdf84fa1fbc59d3c8411e596ded0ffb06a952e 100644 --- a/Event/xAOD/xAODTrigCalo/CMakeLists.txt +++ b/Event/xAOD/xAODTrigCalo/CMakeLists.txt @@ -1,34 +1,28 @@ -################################################################################ -# Package: xAODTrigCalo -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigCalo ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloGeoHelpers - Control/AthContainers - Event/xAOD/xAODCore - PRIVATE - Control/AthLinks ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigCalo - Root/*.cxx - PUBLIC_HEADERS xAODTrigCalo - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES CaloGeoHelpers AthContainers xAODCore - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks ) + xAODTrigCalo/*.h xAODTrigCalo/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigCalo + LINK_LIBRARIES CaloGeoHelpers AthContainers xAODCore ) -atlas_add_dictionary( xAODTrigCaloDict - xAODTrigCalo/xAODTrigCaloDict.h - xAODTrigCalo/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloGeoHelpers AthContainers xAODCore AthLinks xAODTrigCalo - EXTRA_FILES Root/dict/*.cxx ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigCalo/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigCaloClusterContainer_v1" + "xAOD::TrigEMClusterContainer_v1" ) +atlas_add_dictionary( xAODTrigCaloDict + xAODTrigCalo/xAODTrigCaloDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigCalo + EXTRA_FILES Root/dict/*.cxx ) +# Generate CLIDs for the library explicitly. +atlas_generate_cliddb( xAODTrigCalo ) diff --git a/Event/xAOD/xAODTrigCalo/xAODTrigCalo/selection.xml b/Event/xAOD/xAODTrigCalo/xAODTrigCalo/selection.xml index 8f246e62c7a9510232927be8768dcce9f6525c64..712ae13c8ca2589ad5ce2742c9e89a778a0cbd9b 100644 --- a/Event/xAOD/xAODTrigCalo/xAODTrigCalo/selection.xml +++ b/Event/xAOD/xAODTrigCalo/xAODTrigCalo/selection.xml @@ -1,42 +1,35 @@ -<!-- $Id: selection.xml 692011 2015-08-28 17:19:22Z wigleswt $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- TrigCaloCluster_v1 dictionaries: --> - <class name="xAOD::TrigCaloCluster_v1" /> - <class name="xAOD::TrigCaloClusterContainer_v1" - id="0C7F7869-C67A-4E4A-8793-358F8B32DFEA" /> - <class name="xAOD::TrigCaloClusterAuxContainer_v1" - id="4A2F55AF-D465-42A8-A4CF-2DB84D9628E5" /> + <!-- xAOD::TrigCaloCluster interface type(s). --> + <class name="xAOD::TrigCaloCluster_v1" /> + <class name="xAOD::TrigCaloClusterContainer_v1" + id="0C7F7869-C67A-4E4A-8793-358F8B32DFEA" /> + <typedef name="xAOD::TrigCaloCluster" /> + <typedef name="xAOD::TrigCaloClusterContainer" /> - <class name="ElementLink<xAOD::TrigCaloClusterContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigCaloClusterContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigCaloClusterContainer_v1> > >" /> + <!-- xAOD::TrigCaloCluster auxiliary type(s). --> + <class name="xAOD::TrigCaloClusterAuxContainer_v1" + id="4A2F55AF-D465-42A8-A4CF-2DB84D9628E5" /> + <typedef name="xAOD::TrigCaloClusterAuxContainer" /> - <!-- TrigEMCluster_v1 dictionaries: --> - <class name="xAOD::TrigEMCluster_v1" /> - <class name="xAOD::TrigEMClusterContainer_v1" - id="B37C59EC-1A1E-467C-BFCE-52EA08694C60" /> - <class name="xAOD::TrigEMClusterAuxContainer_v1" - id="CE08F151-A2BA-44ED-B854-7D8B9C8679DE" /> + <!-- xAOD::TrigEMCluster interface type(s). --> + <class name="xAOD::TrigEMCluster_v1" /> + <class name="xAOD::TrigEMClusterContainer_v1" + id="B37C59EC-1A1E-467C-BFCE-52EA08694C60" /> + <typedef name="xAOD::TrigEMCluster" /> + <typedef name="xAOD::TrigEMClusterContainer" /> - <!-- TrigEMCluster_v2 dictionaries: --> - <class name="xAOD::TrigEMClusterAuxContainer_v2" - id="2AC227DF-EE58-4469-AE60-F066F75DC0DD" /> + <!-- xAOD::TrigEMCluster auxiliary type(s). --> + <class name="xAOD::TrigEMClusterAuxContainer_v1" + id="CE08F151-A2BA-44ED-B854-7D8B9C8679DE" /> + <class name="xAOD::TrigEMClusterAuxContainer_v2" + id="2AC227DF-EE58-4469-AE60-F066F75DC0DD" /> + <typedef name="xAOD::TrigEMClusterAuxContainer" /> - <class name="ElementLink<xAOD::TrigEMClusterContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigEMClusterContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigEMClusterContainer_v1> > >" /> - - - <class name="xAOD::CaloClusterTrigAuxContainer_v1" - id="F25EBF21-75CD-4CB7-B33E-76B46213A49B" /> - - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - </exclusion> + <!-- xAOD::CaloCluster auxiliary type(s). --> + <class name="xAOD::CaloClusterTrigAuxContainer_v1" + id="F25EBF21-75CD-4CB7-B33E-76B46213A49B" /> + <typedef name="xAOD::CaloClusterTrigAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigCalo/xAODTrigCalo/xAODTrigCaloDict.h b/Event/xAOD/xAODTrigCalo/xAODTrigCalo/xAODTrigCaloDict.h index b698d215db835f86e107c888856a8caf573ab438..35d8e7c8a02b7a2bfcdf46bb354ce50cf57926d3 100644 --- a/Event/xAOD/xAODTrigCalo/xAODTrigCalo/xAODTrigCaloDict.h +++ b/Event/xAOD/xAODTrigCalo/xAODTrigCalo/xAODTrigCaloDict.h @@ -1,47 +1,39 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTrigCaloDict.h 692011 2015-08-28 17:19:22Z wigleswt $ #ifndef XAODTRIGCALO_XAODTRIGCALODICT_H #define XAODTRIGCALO_XAODTRIGCALODICT_H -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - // Local include(s): +#include "xAODTrigCalo/TrigCaloCluster.h" #include "xAODTrigCalo/TrigCaloClusterContainer.h" +#include "xAODTrigCalo/TrigCaloClusterAuxContainer.h" #include "xAODTrigCalo/versions/TrigCaloCluster_v1.h" #include "xAODTrigCalo/versions/TrigCaloClusterContainer_v1.h" #include "xAODTrigCalo/versions/TrigCaloClusterAuxContainer_v1.h" +#include "xAODTrigCalo/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODTrigCalo/TrigEMClusterAuxContainer.h" #include "xAODTrigCalo/versions/TrigEMCluster_v1.h" #include "xAODTrigCalo/versions/TrigEMClusterContainer_v1.h" #include "xAODTrigCalo/versions/TrigEMClusterAuxContainer_v1.h" #include "xAODTrigCalo/versions/TrigEMClusterAuxContainer_v2.h" +#include "xAODTrigCalo/CaloClusterTrigAuxContainer.h" #include "xAODTrigCalo/versions/CaloClusterTrigAuxContainer_v1.h" -namespace{ - struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGCALO { - - xAOD::TrigCaloClusterContainer_v1 c3; - ElementLink< xAOD::TrigCaloClusterContainer_v1 > a1; - std::vector< ElementLink< xAOD::TrigCaloClusterContainer_v1 > > a3; - std::vector< std::vector< ElementLink< xAOD::TrigCaloClusterContainer_v1 > > > a4; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" - xAOD::TrigEMClusterContainer_v1 c4; - ElementLink< xAOD::TrigEMClusterContainer_v1 > b1; - std::vector< ElementLink< xAOD::TrigEMClusterContainer_v1 > > b3; - std::vector< std::vector< ElementLink< xAOD::TrigEMClusterContainer_v1 > > > b4; - }; +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGCALO { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigCaloClusterContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigEMClusterContainer_v1 ); + }; } #endif // XAODTRIGCALO_XAODTRIGCALODICT_H diff --git a/Event/xAOD/xAODTrigCaloCnv/CMakeLists.txt b/Event/xAOD/xAODTrigCaloCnv/CMakeLists.txt index f6f7e7ccf0302abf29810d0f6663c603295f387e..1d0af5f488d40a17d955444145ab2968c27076fa 100644 --- a/Event/xAOD/xAODTrigCaloCnv/CMakeLists.txt +++ b/Event/xAOD/xAODTrigCaloCnv/CMakeLists.txt @@ -14,14 +14,20 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel Trigger/TrigEvent/TrigCaloEvent ) +atlas_add_library( xAODTrigCaloCnvLib + xAODTrigCaloCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODTrigCaloCnv + LINK_LIBRARIES GaudiKernel xAODTrigCalo ) + + # Component(s) in the package: atlas_add_component( xAODTrigCaloCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODTrigCalo GaudiKernel AthenaBaseComps AthenaKernel TrigCaloEvent ) + LINK_LIBRARIES xAODTrigCaloCnvLib xAODTrigCalo GaudiKernel AthenaBaseComps AthenaKernel TrigCaloEvent ) # Install files from the package: -atlas_install_headers( xAODTrigCaloCnv ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODTrigEgamma/CMakeLists.txt b/Event/xAOD/xAODTrigEgamma/CMakeLists.txt index 65e4c29ef34323c25230c63d0c35c4470a9cea18..8bb8251d77203cd4f378680e4a6cd134dc3d77b8 100644 --- a/Event/xAOD/xAODTrigEgamma/CMakeLists.txt +++ b/Event/xAOD/xAODTrigEgamma/CMakeLists.txt @@ -1,45 +1,27 @@ -################################################################################ -# Package: xAODTrigEgamma -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigEgamma ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODCore - Event/xAOD/xAODEgamma - Event/xAOD/xAODTracking - Event/xAOD/xAODTrigCalo ) +# External dependencies. +find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread GenVector ) - -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigEgamma - Root/*.cxx - PUBLIC_HEADERS xAODTrigEgamma - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers AthLinks xAODBase xAODCaloEvent xAODCore xAODEgamma xAODTracking xAODTrigCalo - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${extra_libs} ) + xAODTrigEgamma/*.h xAODTrigEgamma/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigEgamma + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase + xAODCaloEvent xAODCore xAODEgamma xAODTracking xAODTrigCalo ) -atlas_add_dictionary( xAODTrigEgammaDict - xAODTrigEgamma/xAODTrigEgammaDict.h - xAODTrigEgamma/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks - xAODBase xAODCaloEvent xAODCore xAODEgamma xAODTracking - xAODTrigCalo xAODTrigEgamma ${extra_libs} - EXTRA_FILES Root/dict/*.cxx ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigEgamma/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigPhotonContainer_v1" "xAOD::TrigElectronContainer_v1" ) +atlas_add_dictionary( xAODTrigEgammaDict + xAODTrigEgamma/xAODTrigEgammaDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigEgamma + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/selection.xml b/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/selection.xml index 1bc649d8ace6673a5df64339a239e8a767d97e2a..97a1e870b45af7493c2b839e236d19a6c9dcf720 100644 --- a/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/selection.xml +++ b/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/selection.xml @@ -1,49 +1,37 @@ -<!-- $Id: selection.xml 705788 2015-11-04 13:06:35Z krasznaa $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- TrigPhoton_v1 dictionaries: --> - <class name="xAOD::TrigPhoton_v1"/> - - <class name="xAOD::TrigPhotonContainer_v1" - id="DA2CDAF5-B0E8-4502-89A3-E342DFA9C250" /> - <class name="xAOD::TrigPhotonAuxContainer_v1" - id="36B8B9E3-8F5E-4356-9315-EF4FA6959624" /> - - <class name="DataLink<xAOD::TrigPhotonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrigPhotonContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrigPhotonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigPhotonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigPhotonContainer_v1> > >" /> - - <!-- TrigElectron_v1 dictionaries: --> - <class name="xAOD::TrigElectron_v1" /> - - <class name="xAOD::TrigElectronContainer_v1" - id="3492BB27-3ED8-45E3-9A5B-7266949CEDA9" /> - <class name="xAOD::TrigElectronAuxContainer_v1" - id="173425E6-51BB-4015-B960-3F7F83F26B9E" /> - - <class name="DataLink<xAOD::TrigElectronContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrigElectronContainer_v1> >" /> - - <class name="ElementLink<xAOD::TrigElectronContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigElectronContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigElectronContainer_v1> > >" /> - - <class name="xAOD::ElectronTrigAuxContainer_v1" - id="359610D5-3AEA-4DB4-837E-4C93F81014C2" /> - <class name="xAOD::PhotonTrigAuxContainer_v1" - id="863989DB-F18B-4D93-A019-F3CBFF726176" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class name="ElementLink<DataVector<xAOD::TrackParticle_v1> >" /> - <class name="ElementLink<DataVector<xAOD::TrigEMCluster_v1> >" /> - </exclusion> + <!-- xAOD::TrigPhoton interface type(s). --> + <class name="xAOD::TrigPhoton_v1"/> + <class name="xAOD::TrigPhotonContainer_v1" + id="DA2CDAF5-B0E8-4502-89A3-E342DFA9C250" /> + <typedef name="xAOD::TrigPhoton" /> + <typedef name="xAOD::TrigPhotonContainer" /> + + <!-- xAOD::TrigPhoton auxiliary type(s). --> + <class name="xAOD::TrigPhotonAuxContainer_v1" + id="36B8B9E3-8F5E-4356-9315-EF4FA6959624" /> + <typedef name="xAOD::TrigPhotonAuxContainer" /> + + <!-- xAOD::TrigElectron interface type(s). --> + <class name="xAOD::TrigElectron_v1" /> + <class name="xAOD::TrigElectronContainer_v1" + id="3492BB27-3ED8-45E3-9A5B-7266949CEDA9" /> + <typedef name="xAOD::TrigElectron" /> + <typedef name="xAOD::TrigElectronContainer" /> + + <!-- xAOD::TrigElectron auxiliary type(s). --> + <class name="xAOD::TrigElectronAuxContainer_v1" + id="173425E6-51BB-4015-B960-3F7F83F26B9E" /> + <typedef name="xAOD::TrigElectronAuxContainer" /> + + <!-- xAODEgamma auxiliary type(s). --> + <class name="xAOD::ElectronTrigAuxContainer_v1" + id="359610D5-3AEA-4DB4-837E-4C93F81014C2" /> + <typedef name="xAOD::ElectronTrigAuxContainer" /> + + <class name="xAOD::PhotonTrigAuxContainer_v1" + id="863989DB-F18B-4D93-A019-F3CBFF726176" /> + <typedef name="xAOD::PhotonTrigAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/xAODTrigEgammaDict.h b/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/xAODTrigEgammaDict.h index 15f8da8169d31550c95fb803f369e8dde431edb2..2782b8549cd7f116d5a6382887f8a479b91272eb 100644 --- a/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/xAODTrigEgammaDict.h +++ b/Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/xAODTrigEgammaDict.h @@ -1,32 +1,21 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTrigEgammaDict.h 690869 2015-08-24 09:22:25Z rwhite $ #ifndef XAODTRIGEGAMMA_XAODTRIGEGAMMADICT_H #define XAODTRIGEGAMMA_XAODTRIGEGAMMADICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -//Local include(s) +// Local include(s). +#include "xAODTrigEgamma/TrigPhoton.h" #include "xAODTrigEgamma/TrigPhotonContainer.h" +#include "xAODTrigEgamma/TrigPhotonAuxContainer.h" #include "xAODTrigEgamma/versions/TrigPhoton_v1.h" #include "xAODTrigEgamma/versions/TrigPhotonContainer_v1.h" #include "xAODTrigEgamma/versions/TrigPhotonAuxContainer_v1.h" +#include "xAODTrigEgamma/TrigElectron.h" #include "xAODTrigEgamma/TrigElectronContainer.h" +#include "xAODTrigEgamma/TrigElectronAuxContainer.h" #include "xAODTrigEgamma/versions/TrigElectron_v1.h" #include "xAODTrigEgamma/versions/TrigElectronContainer_v1.h" #include "xAODTrigEgamma/versions/TrigElectronAuxContainer_v1.h" @@ -36,31 +25,20 @@ #include "xAODTrigEgamma/versions/ElectronTrigAuxContainer_v1.h" #include "xAODTrigEgamma/versions/PhotonTrigAuxContainer_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace{ struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGEGAMMA { - - xAOD::TrigElectronContainer_v1 electron_c1; - DataLink< xAOD::TrigElectronContainer_v1 > electron_dl1; - std::vector< DataLink< xAOD::TrigElectronContainer_v1 > > electron_dl2; - ElementLink< xAOD::TrigElectronContainer_v1 > electron_el1; - std::vector< ElementLink< xAOD::TrigElectronContainer_v1 > > electron_el2; - std::vector< std::vector< ElementLink< xAOD::TrigElectronContainer_v1 > > > electron_el3; - - xAOD::TrigPhotonContainer_v1 photon_c1; - DataLink< xAOD::TrigPhotonContainer_v1 > photon_dl1; - std::vector< DataLink< xAOD::TrigPhotonContainer_v1 > > photon_dl2; - ElementLink< xAOD::TrigPhotonContainer_v1 > photon_el1; - std::vector< ElementLink< xAOD::TrigPhotonContainer_v1 > > photon_el2; - std::vector< std::vector< ElementLink< xAOD::TrigPhotonContainer_v1 > > > photon_el3; - - // Declarations needed in order to generate the dictionaries of the - // auxiliary containers correctly: - ElementLink< xAOD::TrigEMClusterContainer > dummy1; - std::vector< ElementLink< xAOD::TrigEMClusterContainer > > dummy2; - ElementLink< xAOD::TrackParticleContainer > dummy3; - std::vector< ElementLink< xAOD::TrackParticleContainer > > dummy4; - + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigElectronContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigPhotonContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigEMClusterContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, VertexContainer ); }; -} // private namespace +} #endif // XAODTRIGEGAMMA_XAODTRIGEGAMMADICT_H diff --git a/Event/xAOD/xAODTrigL1Calo/CMakeLists.txt b/Event/xAOD/xAODTrigL1Calo/CMakeLists.txt index e3bb7e36ad80f61b07ba08d8a6f4a719fc5f6033..6a2a6963d715c008cbd8331970d3470946c7c228 100644 --- a/Event/xAOD/xAODTrigL1Calo/CMakeLists.txt +++ b/Event/xAOD/xAODTrigL1Calo/CMakeLists.txt @@ -1,41 +1,39 @@ -################################################################################ -# Package: xAODTrigL1Calo -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigL1Calo ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Event/xAOD/xAODBase - Event/xAOD/xAODCore - PRIVATE - Control/AthLinks ) - -# External dependencies: -find_package( ROOT COMPONENTS Physics Core Tree MathCore Hist RIO pthread GenVector ) - -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() +# External dependencies. +find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigL1Calo - Root/*.cxx - PUBLIC_HEADERS xAODTrigL1Calo - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers xAODBase xAODCore - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks ${extra_libs} ) + xAODTrigL1Calo/*.h xAODTrigL1Calo/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigL1Calo + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers xAODBase xAODCore ) -atlas_add_dictionary( xAODTrigL1CaloDict - xAODTrigL1Calo/xAODTrigL1CaloDict.h - xAODTrigL1Calo/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${extra_libs} AthContainers xAODBase xAODCore AthLinks xAODTrigL1Calo - EXTRA_FILES Root/dict/*.cxx ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigL1Calo/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::JEMHitsContainer_v1" "xAOD::JEMEtSumsContainer_v1" + "xAOD::JEMRoIContainer_v1" "xAOD::CPMHitsContainer_v1" + "xAOD::CPMTowerContainer_v1" "xAOD::CPMRoIContainer_v1" + "xAOD::CMMCPHitsContainer_v1" "xAOD::CMMEtSumsContainer_v1" + "xAOD::CMMJetHitsContainer_v1" "xAOD::JetElementContainer_v1" + "xAOD::RODHeaderContainer_v1" "xAOD::RODHeaderContainer_v2" + "xAOD::TriggerTowerContainer_v1" "xAOD::TriggerTowerContainer_v2" + "xAOD::CMXCPHitsContainer_v1" "xAOD::CMXCPTobContainer_v1" + "xAOD::CMXJetHitsContainer_v1" "xAOD::CMXJetTobContainer_v1" + "xAOD::CMXEtSumsContainer_v1" "xAOD::CMXRoIContainer_v1" + "xAOD::CPMTowerContainer_v2" "xAOD::CPMTobRoIContainer_v1" + "xAOD::JEMEtSumsContainer_v2" "xAOD::JEMTobRoIContainer_v1" + "xAOD::JetElementContainer_v2" "xAOD::L1TopoRawDataContainer_v1" + OBJECTS "xAOD::CMMRoI_v1" ) +atlas_add_dictionary( xAODTrigL1CaloDict + xAODTrigL1Calo/xAODTrigL1CaloDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigL1Calo + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/selection.xml b/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/selection.xml index 8b978f9fbc4c3bf80b117ca78279c8cc3053a0e0..3922b4a6e1ce935a25c679b2bb8ec4adaf7f656a 100644 --- a/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/selection.xml +++ b/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/selection.xml @@ -1,23 +1,28 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- dictionaries: --> - <!-- Run1 EDM --> - - <!-- JEMHits --> + + <!-- JEMHits --> <class name="xAOD::JEMHits_v1" /> <class name="xAOD::JEMHitsContainer_v1" id="070F54C6-320D-4F22-BD42-C87C6AF99C38" /> <class name="xAOD::JEMHitsAuxContainer_v1" - id="CE2C5182-53DD-46E0-9DFA-61C214A8FCE5" /> - + id="CE2C5182-53DD-46E0-9DFA-61C214A8FCE5" /> + <typedef name="xAOD::JEMHits" /> + <typedef name="xAOD::JEMHitsContainer" /> + <typedef name="xAOD::JEMHitsAuxContainer" /> + <!-- JEMEtSums --> <class name="xAOD::JEMEtSums_v1" /> <class name="xAOD::JEMEtSumsContainer_v1" id="DDB6D476-D1E2-490E-A81B-8D4FC65F1D81" /> <class name="xAOD::JEMEtSumsAuxContainer_v1" - id="4D3C658D-597A-414E-AAA3-BE61A1D664C3" /> - + id="4D3C658D-597A-414E-AAA3-BE61A1D664C3" /> + <typedef name="xAOD::JEMEtSums" /> + <typedef name="xAOD::JEMEtSumsContainer" /> + <typedef name="xAOD::JEMEtSumsAuxContainer" /> + <!-- JEMRoI --> <class name="xAOD::JEMRoI_v1"> <field name="s_wordIdVal" transient="true"/> @@ -45,24 +50,32 @@ <class name="xAOD::JEMRoIContainer_v1" id="52384828-A57D-477D-A8C8-597C78D02686" /> <class name="xAOD::JEMRoIAuxContainer_v1" - id="959C24E5-9746-4C70-83FA-A0140C710039" /> - + id="959C24E5-9746-4C70-83FA-A0140C710039" /> + <typedef name="xAOD::JEMRoI" /> + <typedef name="xAOD::JEMRoIContainer" /> + <typedef name="xAOD::JEMRoIAuxContainer" /> - <!-- CPMHits --> + <!-- CPMHits --> <class name="xAOD::CPMHits_v1" /> <class name="xAOD::CPMHitsContainer_v1" id="3D15DF3F-E014-42E3-9614-37E4CD535F9C" /> <class name="xAOD::CPMHitsAuxContainer_v1" - id="28FCEB20-A9DC-4FED-9FDD-00F46948E92E" /> - - <!-- CPMTower --> + id="28FCEB20-A9DC-4FED-9FDD-00F46948E92E" /> + <typedef name="xAOD::CPMHits" /> + <typedef name="xAOD::CPMHitsContainer" /> + <typedef name="xAOD::CPMHitsAuxContainer" /> + + <!-- CPMTower --> <class name="xAOD::CPMTower_v1" /> <class name="xAOD::CPMTowerContainer_v1" id="D220C61E-ECD1-427C-86D0-2C88E00ABBD2" /> <class name="xAOD::CPMTowerAuxContainer_v1" - id="529B6BD7-7B7D-438C-94D7-BAA49A022C47" /> - - <!-- CPMRoI --> + id="529B6BD7-7B7D-438C-94D7-BAA49A022C47" /> + <typedef name="xAOD::CPMTower" /> + <typedef name="xAOD::CPMTowerContainer" /> + <typedef name="xAOD::CPMTowerAuxContainer" /> + + <!-- CPMRoI --> <class name="xAOD::CPMRoI_v1"> <field name="s_wordIdVal" transient="true"/> <field name="s_wordIdBit" transient="true"/> @@ -71,98 +84,121 @@ <field name="s_chipBit" transient="true"/> <field name="s_locationBit" transient="true"/> <field name="s_parityBit" transient="true"/> - <field name="s_saturationBit" transient="true"/> + <field name="s_saturationBit" transient="true"/> <field name="s_hitsBit" transient="true"/> - <field name="s_wordIdMask" transient="true"/> + <field name="s_wordIdMask" transient="true"/> <field name="s_crateMask" transient="true"/> - <field name="s_cpmMask" transient="true"/> + <field name="s_cpmMask" transient="true"/> <field name="s_chipMask" transient="true"/> - <field name="s_locationMask" transient="true"/> + <field name="s_locationMask" transient="true"/> <field name="s_parityMask" transient="true"/> - <field name="s_saturationMask" transient="true"/> + <field name="s_saturationMask" transient="true"/> <field name="s_hitsMask" transient="true"/> - </class> + </class> <class name="xAOD::CPMRoIContainer_v1" id="4B48CC07-6B22-46EC-9BD5-51379664B9BC" /> <class name="xAOD::CPMRoIAuxContainer_v1" - id="8FA92C8D-214F-4B8F-84CA-CB7267CAD0F2" /> + id="8FA92C8D-214F-4B8F-84CA-CB7267CAD0F2" /> + <typedef name="xAOD::CPMRoI" /> + <typedef name="xAOD::CPMRoIContainer" /> + <typedef name="xAOD::CPMRoIAuxContainer" /> - <!-- CMMCPHits --> + <!-- CMMCPHits --> <class name="xAOD::CMMCPHits_v1" /> <class name="xAOD::CMMCPHitsContainer_v1" id="8826CC48-CD08-4FD7-9AC4-358A4888271F" /> <class name="xAOD::CMMCPHitsAuxContainer_v1" id="1951D4B4-D471-4256-8F0D-D666043E2889" /> + <typedef name="xAOD::CMMCPHits" /> + <typedef name="xAOD::CMMCPHitsContainer" /> + <typedef name="xAOD::CMMCPHitsAuxContainer" /> - <!-- CMMEtSums --> + <!-- CMMEtSums --> <class name="xAOD::CMMEtSums_v1" /> <class name="xAOD::CMMEtSumsContainer_v1" id="186A613D-0C91-4880-9B09-B41C28B17B53" /> <class name="xAOD::CMMEtSumsAuxContainer_v1" - id="A072EDD3-880D-46D0-A120-48C116FDB14E" /> - - <!-- CMMJetHits --> + id="A072EDD3-880D-46D0-A120-48C116FDB14E" /> + <typedef name="xAOD::CMMEtSums" /> + <typedef name="xAOD::CMMEtSumsContainer" /> + <typedef name="xAOD::CMMEtSumsAuxContainer" /> + + <!-- CMMJetHits --> <class name="xAOD::CMMJetHits_v1" /> <class name="xAOD::CMMJetHitsContainer_v1" id="43B6130D-4C3F-4E22-9FE2-680E6DFA149F" /> <class name="xAOD::CMMJetHitsAuxContainer_v1" - id="B3C8D000-0E7F-4A0D-8F05-6DA36FFC9DD7" /> - - <!-- CMMRoI --> - <class name="xAOD::CMMRoI_v1" + id="B3C8D000-0E7F-4A0D-8F05-6DA36FFC9DD7" /> + <typedef name="xAOD::CMMJetHits" /> + <typedef name="xAOD::CMMJetHitsContainer" /> + <typedef name="xAOD::CMMJetHitsAuxContainer" /> + + <!-- CMMRoI --> + <class name="xAOD::CMMRoI_v1" id="2BA7B6B2-69C6-40E8-8D2A-0398371EDC81" /> <class name="xAOD::CMMRoIAuxInfo_v1" - id="B0CAB5B5-6B6B-437D-B353-1397C1F01B7E" /> - + id="B0CAB5B5-6B6B-437D-B353-1397C1F01B7E" /> + <typedef name="xAOD::CMMRoI" /> + <typedef name="xAOD::CMMRoIAuxInfo" /> - <!-- JetElement --> + <!-- JetElement --> <class name="xAOD::JetElement_v1"> - <field name="m_saturationThreshold" transient="true"/> + <field name="m_saturationThreshold" transient="true"/> <field name="m_layerSaturationThreshold" transient="true"/> - </class> + </class> <class name="xAOD::JetElementContainer_v1" id="B1103844-7187-4305-B20A-748591A54145" /> <class name="xAOD::JetElementAuxContainer_v1" - id="7A0A2307-5729-4306-B520-4F75BBCC8E76" /> - - <!-- RODHeader --> + id="7A0A2307-5729-4306-B520-4F75BBCC8E76" /> + <typedef name="xAOD::JetElement" /> + <typedef name="xAOD::JetElementContainer" /> + <typedef name="xAOD::JetElementAuxContainer" /> + + <!-- RODHeader --> <class name="xAOD::RODHeader_v1" /> <class name="xAOD::RODHeaderContainer_v1" id="AA0924D2-23E2-47B3-8C7D-9D3B104B8990" /> <class name="xAOD::RODHeaderAuxContainer_v1" - id="6524E46D-CC9C-43D2-BAE0-55310A6B316C" /> + id="6524E46D-CC9C-43D2-BAE0-55310A6B316C" /> + <typedef name="xAOD::RODHeader" /> + <typedef name="xAOD::RODHeaderContainer" /> + <typedef name="xAOD::RODHeaderAuxContainer" /> - <!-- RODHeader Run2 EDM--> + <!-- RODHeader Run2 EDM--> <class name="xAOD::RODHeader_v2" /> <class name="xAOD::RODHeaderContainer_v2" id="98368E90-F392-41D8-850C-317B65034544" /> <class name="xAOD::RODHeaderAuxContainer_v2" - id="A94BA0CD-E57C-4C69-ADA1-CCB91BC0C36F" /> - - <!-- TriggerTower --> + id="A94BA0CD-E57C-4C69-ADA1-CCB91BC0C36F" /> + + <!-- TriggerTower --> <class name="xAOD::TriggerTower_v1" /> <class name="xAOD::TriggerTowerContainer_v1" id="DE2A7891-B5FE-4811-8178-EF106743312C" /> <class name="xAOD::TriggerTowerAuxContainer_v1" id="3C5D20CF-6F77-4E67-B182-674EDFD2FE38" /> - - + <typedef name="xAOD::TriggerTower" /> + <typedef name="xAOD::TriggerTowerContainer" /> + <typedef name="xAOD::TriggerTowerAuxContainer" /> + <!-- Moving onto Run2 EDM --> - - <!-- TriggerTower --> + + <!-- TriggerTower --> <class name="xAOD::TriggerTower_v2" /> <class name="xAOD::TriggerTowerContainer_v2" id="730DE7B8-C24A-4567-A66D-0386DC50E9AC" /> <class name="xAOD::TriggerTowerAuxContainer_v2" - id="07FF691A-A920-43B2-A4E7-637D335E6929" /> - + id="07FF691A-A920-43B2-A4E7-637D335E6929" /> + <!-- CMXCPHits_v1 --> <class name="xAOD::CMXCPHits_v1" /> <class name="xAOD::CMXCPHitsContainer_v1" id="96ED5A94-473C-4E96-A348-78077310635F" /> <class name="xAOD::CMXCPHitsAuxContainer_v1" id="F3F8A07D-536B-42EB-9792-E08DB1F76C1F" /> - + <typedef name="xAOD::CMXCPHits" /> + <typedef name="xAOD::CMXCPHitsContainer" /> + <typedef name="xAOD::CMXCPHitsAuxContainer" /> <!-- CMXCPTob_v1 --> <class name="xAOD::CMXCPTob_v1" /> @@ -170,7 +206,9 @@ id="5E70EF98-47ED-441F-8CC3-F1906AA2E8CD" /> <class name="xAOD::CMXCPTobAuxContainer_v1" id="B4A55AC8-3D30-42AF-B954-82DA7D8A07CB" /> - + <typedef name="xAOD::CMXCPTob" /> + <typedef name="xAOD::CMXCPTobContainer" /> + <typedef name="xAOD::CMXCPTobAuxContainer" /> <!-- CMXJetHits_v1 --> <class name="xAOD::CMXJetHits_v1" /> @@ -178,7 +216,9 @@ id="492E21EF-A9B0-4262-80EE-4ADECDEA44E7" /> <class name="xAOD::CMXJetHitsAuxContainer_v1" id="509DB371-6A95-4DE1-B950-751B99EBF5EC" /> - + <typedef name="xAOD::CMXJetHits" /> + <typedef name="xAOD::CMXJetHitsContainer" /> + <typedef name="xAOD::CMXJetHitsAuxContainer" /> <!-- CMXJetTob_v1 --> <class name="xAOD::CMXJetTob_v1" /> @@ -186,7 +226,9 @@ id="4116184D-A8AF-43B1-9990-9DF5C1010AB6" /> <class name="xAOD::CMXJetTobAuxContainer_v1" id="094F5655-229B-49BE-870D-1E4D13866CED" /> - + <typedef name="xAOD::CMXJetTob" /> + <typedef name="xAOD::CMXJetTobContainer" /> + <typedef name="xAOD::CMXJetTobAuxContainer" /> <!-- CMXEtSums_v1 --> <class name="xAOD::CMXEtSums_v1" /> @@ -194,8 +236,11 @@ id="751F0DD4-FF7F-4950-9928-3198DA4B1AB4" /> <class name="xAOD::CMXEtSumsAuxContainer_v1" id="B96297C3-769B-4084-9524-9D4D233B4896" /> - - <!-- CMXRoI_v1 --> + <typedef name="xAOD::CMXEtSums" /> + <typedef name="xAOD::CMXEtSumsContainer" /> + <typedef name="xAOD::CMXEtSumsAuxContainer" /> + + <!-- CMXRoI_v1 --> <class name="xAOD::CMXRoI_v1" > <field name="s_wordIdVal0" transient="true"/> <field name="s_wordIdVal1" transient="true"/> @@ -204,116 +249,114 @@ <field name="s_sumEtHitsBit" transient="true"/> <field name="s_missingEtHitsBit" transient="true"/> <field name="s_missingEtSigHitsBit" transient="true"/> - <field name="s_energyBit" transient="true"/> + <field name="s_energyBit" transient="true"/> <field name="s_overflowBit" transient="true"/> - <field name="s_sumTypeBit" transient="true"/> + <field name="s_sumTypeBit" transient="true"/> <field name="s_wordIdMask" transient="true"/> - <field name="s_sumEtHitsMask" transient="true"/> + <field name="s_sumEtHitsMask" transient="true"/> <field name="s_missingEtHitsMask" transient="true"/> - <field name="s_missingEtSigHitsMask" transient="true"/> + <field name="s_missingEtSigHitsMask" transient="true"/> <field name="s_energyMask" transient="true"/> - <field name="s_overflowMask" transient="true"/> - <field name="s_sumTypeMask" transient="true"/> - <field name="s_exOffset" transient="true"/> + <field name="s_overflowMask" transient="true"/> + <field name="s_sumTypeMask" transient="true"/> + <field name="s_exOffset" transient="true"/> <field name="s_eyOffset" transient="true"/> - <field name="s_etOffset" transient="true"/> + <field name="s_etOffset" transient="true"/> <field name="s_maxRoiWords" transient="true"/> - </class> + </class> <class name="xAOD::CMXRoIContainer_v1" - id="37420C80-6007-43B0-ADD3-63FAF6088EC8"/> + id="37420C80-6007-43B0-ADD3-63FAF6088EC8" /> <class name="xAOD::CMXRoIAuxContainer_v1" - id="501FFFE3-9788-4A3C-9151-8466F32EF2B4" /> + id="501FFFE3-9788-4A3C-9151-8466F32EF2B4" /> + <typedef name="xAOD::CMXRoI" /> + <typedef name="xAOD::CMXRoIContainer" /> + <typedef name="xAOD::CMXRoIAuxContainer" /> - - <!-- CPMTower_v2 --> + <!-- CPMTower_v2 --> <class name="xAOD::CPMTower_v2" /> <class name="xAOD::CPMTowerContainer_v2" id="87CC5511-E7E5-4068-8F40-F44B0A1E9A3F" /> <class name="xAOD::CPMTowerAuxContainer_v2" - id="E41859F4-0B8B-412B-A697-2B5A22C5B720" /> - + id="E41859F4-0B8B-412B-A697-2B5A22C5B720" /> + <!-- CPMTobRoI_v1 --> <class name="xAOD::CPMTobRoI_v1"> <field name="s_wordIdVal" transient="true"/> <field name="s_wordIdBit" transient="true"/> <field name="s_crateBit" transient="true"/> - <field name="s_cpmBit" transient="true"/> + <field name="s_cpmBit" transient="true"/> <field name="s_chipBit" transient="true"/> <field name="s_locationBit" transient="true"/> <field name="s_isolBit" transient="true"/> - <field name="s_energyBit" transient="true"/> + <field name="s_energyBit" transient="true"/> <field name="s_wordIdMask" transient="true"/> <field name="s_crateMask" transient="true"/> <field name="s_cpmMask" transient="true"/> - <field name="s_chipMask" transient="true"/> + <field name="s_chipMask" transient="true"/> <field name="s_locationMask" transient="true"/> <field name="s_isolMask" transient="true"/> <field name="s_energyMask" transient="true"/> - <field name="s_typeMask" transient="true"/> + <field name="s_typeMask" transient="true"/> </class> <class name="xAOD::CPMTobRoIContainer_v1" id="B84B5967-8B6C-4743-AC18-FF68E13D9EA6" /> <class name="xAOD::CPMTobRoIAuxContainer_v1" id="38CB660E-139B-4280-9517-B571CA680A37" /> - + <typedef name="xAOD::CPMTobRoI" /> + <typedef name="xAOD::CPMTobRoIContainer" /> + <typedef name="xAOD::CPMTobRoIAuxContainer" /> + <!-- JEMEtSums --> <class name="xAOD::JEMEtSums_v2" /> <class name="xAOD::JEMEtSumsContainer_v2" id="9EE079C0-5737-4710-A81D-278D97F01E50" /> <class name="xAOD::JEMEtSumsAuxContainer_v2" - id="015D34AC-2FD5-4357-850E-04FD5EF6F945" /> - + id="015D34AC-2FD5-4357-850E-04FD5EF6F945" /> <!-- JEMTobRoI_v1 --> <class name="xAOD::JEMTobRoI_v1"> <field name="s_wordIdVal" transient="true"/> <field name="s_wordIdBit" transient="true"/> <field name="s_crateBit" transient="true"/> - <field name="s_jemBit" transient="true"/> + <field name="s_jemBit" transient="true"/> <field name="s_frameBit" transient="true"/> <field name="s_locationBit" transient="true"/> <field name="s_energySmallBit" transient="true"/> - <field name="s_energyLargeBit" transient="true"/> + <field name="s_energyLargeBit" transient="true"/> <field name="s_wordIdMask" transient="true"/> <field name="s_crateMask" transient="true"/> <field name="s_jemMask" transient="true"/> - <field name="s_frameMask" transient="true"/> + <field name="s_frameMask" transient="true"/> <field name="s_locationMask" transient="true"/> <field name="s_energySmallMask" transient="true"/> - <field name="s_energyLargeMask" transient="true"/> - </class> + <field name="s_energyLargeMask" transient="true"/> + </class> <class name="xAOD::JEMTobRoIContainer_v1" id="2C7D0000-4D7B-45D4-8EE5-B18F172A70C3" /> <class name="xAOD::JEMTobRoIAuxContainer_v1" id="2EAA65B1-B1F3-4530-9413-E572D6282996" /> - - - <!-- JetElement_v2 --> + <typedef name="xAOD::JEMTobRoI" /> + <typedef name="xAOD::JEMTobRoIContainer" /> + <typedef name="xAOD::JEMTobRoIAuxContainer" /> + + <!-- JetElement_v2 --> <class name="xAOD::JetElement_v2"> - <field name="m_saturationThreshold" transient="true"/> + <field name="m_saturationThreshold" transient="true"/> <field name="m_layerSaturationThreshold" transient="true"/> - </class> + </class> <class name="xAOD::JetElementContainer_v2" id="C4E1BE3D-6499-41A6-9643-4EA716049F60" /> <class name="xAOD::JetElementAuxContainer_v2" - id="A52FADFE-E250-43EC-9766-2898288521BF" /> - + id="A52FADFE-E250-43EC-9766-2898288521BF" /> + <!-- L1TopoRawData_v1 --> <class name="xAOD::L1TopoRawData_v1" /> <class name="xAOD::L1TopoRawDataContainer_v1" id="59FD769F-86CA-4636-8AB0-61EB3E0482EA" /> <class name="xAOD::L1TopoRawDataAuxContainer_v1" - id="E3D3AF1E-843A-4F21-A639-EE97040D3B6B" /> - - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - <class pattern="ElementLink<DataVector<xAOD::IParticle*" /> - </exclusion> + id="E3D3AF1E-843A-4F21-A639-EE97040D3B6B" /> + <typedef name="xAOD::L1TopoRawData" /> + <typedef name="xAOD::L1TopoRawDataContainer" /> + <typedef name="xAOD::L1TopoRawDataAuxContainer" /> </lcgdict> - diff --git a/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/xAODTrigL1CaloDict.h b/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/xAODTrigL1CaloDict.h index ddf7ba6a0c42b690e8e891d679ece05056fd55f5..025fa36bba731693d2712be9364c91d3a043b9fb 100644 --- a/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/xAODTrigL1CaloDict.h +++ b/Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/xAODTrigL1CaloDict.h @@ -1,68 +1,90 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTrigL1CaloDict.h 694350 2015-09-11 12:02:19Z krasznaa $ #ifndef XAODTRIGL1CALO_XAODTRIGL1CALOCALOEVENTDICT_H #define XAODTRIGL1CALO_XAODTRIGL1CALOCALOEVENTDICT_H -// System include(s): -#include <vector> - -// EDM include(s): -/* -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" -#include "AthLinks/ElementLinkVector.h" -*/ - // Local include(s): // Run 1 +#include "xAODTrigL1Calo/JEMHits.h" +#include "xAODTrigL1Calo/JEMHitsContainer.h" +#include "xAODTrigL1Calo/JEMHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/JEMHits_v1.h" #include "xAODTrigL1Calo/versions/JEMHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/JEMHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/JEMEtSums.h" +#include "xAODTrigL1Calo/JEMEtSumsContainer.h" +#include "xAODTrigL1Calo/JEMEtSumsAuxContainer.h" #include "xAODTrigL1Calo/versions/JEMEtSums_v1.h" #include "xAODTrigL1Calo/versions/JEMEtSumsContainer_v1.h" #include "xAODTrigL1Calo/versions/JEMEtSumsAuxContainer_v1.h" +#include "xAODTrigL1Calo/JEMRoI.h" +#include "xAODTrigL1Calo/JEMRoIContainer.h" +#include "xAODTrigL1Calo/JEMRoIAuxContainer.h" #include "xAODTrigL1Calo/versions/JEMRoI_v1.h" #include "xAODTrigL1Calo/versions/JEMRoIContainer_v1.h" #include "xAODTrigL1Calo/versions/JEMRoIAuxContainer_v1.h" +#include "xAODTrigL1Calo/CPMHits.h" +#include "xAODTrigL1Calo/CPMHitsContainer.h" +#include "xAODTrigL1Calo/CPMHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/CPMHits_v1.h" #include "xAODTrigL1Calo/versions/CPMHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/CPMHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CPMTower.h" +#include "xAODTrigL1Calo/CPMTowerContainer.h" +#include "xAODTrigL1Calo/CPMTowerAuxContainer.h" #include "xAODTrigL1Calo/versions/CPMTower_v1.h" #include "xAODTrigL1Calo/versions/CPMTowerContainer_v1.h" #include "xAODTrigL1Calo/versions/CPMTowerAuxContainer_v1.h" +#include "xAODTrigL1Calo/CPMRoI.h" +#include "xAODTrigL1Calo/CPMRoIContainer.h" +#include "xAODTrigL1Calo/CPMRoIAuxContainer.h" #include "xAODTrigL1Calo/versions/CPMRoI_v1.h" #include "xAODTrigL1Calo/versions/CPMRoIContainer_v1.h" #include "xAODTrigL1Calo/versions/CPMRoIAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMMCPHits.h" +#include "xAODTrigL1Calo/CMMCPHitsContainer.h" +#include "xAODTrigL1Calo/CMMCPHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMMCPHits_v1.h" #include "xAODTrigL1Calo/versions/CMMCPHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMMCPHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMMEtSums.h" +#include "xAODTrigL1Calo/CMMEtSumsContainer.h" +#include "xAODTrigL1Calo/CMMEtSumsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMMEtSums_v1.h" #include "xAODTrigL1Calo/versions/CMMEtSumsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMMEtSumsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMMJetHits.h" +#include "xAODTrigL1Calo/CMMJetHitsContainer.h" +#include "xAODTrigL1Calo/CMMJetHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMMJetHits_v1.h" #include "xAODTrigL1Calo/versions/CMMJetHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMMJetHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMMRoI.h" +#include "xAODTrigL1Calo/CMMRoIAuxInfo.h" #include "xAODTrigL1Calo/versions/CMMRoI_v1.h" #include "xAODTrigL1Calo/versions/CMMRoIAuxInfo_v1.h" +#include "xAODTrigL1Calo/JetElement.h" +#include "xAODTrigL1Calo/JetElementContainer.h" +#include "xAODTrigL1Calo/JetElementAuxContainer.h" #include "xAODTrigL1Calo/versions/JetElement_v1.h" #include "xAODTrigL1Calo/versions/JetElementContainer_v1.h" #include "xAODTrigL1Calo/versions/JetElementAuxContainer_v1.h" +#include "xAODTrigL1Calo/RODHeader.h" +#include "xAODTrigL1Calo/RODHeaderContainer.h" +#include "xAODTrigL1Calo/RODHeaderAuxContainer.h" #include "xAODTrigL1Calo/versions/RODHeader_v1.h" #include "xAODTrigL1Calo/versions/RODHeaderContainer_v1.h" #include "xAODTrigL1Calo/versions/RODHeaderAuxContainer_v1.h" @@ -71,6 +93,9 @@ #include "xAODTrigL1Calo/versions/RODHeaderContainer_v2.h" #include "xAODTrigL1Calo/versions/RODHeaderAuxContainer_v2.h" +#include "xAODTrigL1Calo/TriggerTower.h" +#include "xAODTrigL1Calo/TriggerTowerContainer.h" +#include "xAODTrigL1Calo/TriggerTowerAuxContainer.h" #include "xAODTrigL1Calo/versions/TriggerTower_v1.h" #include "xAODTrigL1Calo/versions/TriggerTowerContainer_v1.h" #include "xAODTrigL1Calo/versions/TriggerTowerAuxContainer_v1.h" @@ -80,26 +105,44 @@ #include "xAODTrigL1Calo/versions/TriggerTowerContainer_v2.h" #include "xAODTrigL1Calo/versions/TriggerTowerAuxContainer_v2.h" +#include "xAODTrigL1Calo/CMXCPHits.h" +#include "xAODTrigL1Calo/CMXCPHitsContainer.h" +#include "xAODTrigL1Calo/CMXCPHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXCPHits_v1.h" #include "xAODTrigL1Calo/versions/CMXCPHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXCPHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMXCPTob.h" +#include "xAODTrigL1Calo/CMXCPTobContainer.h" +#include "xAODTrigL1Calo/CMXCPTobAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXCPTob_v1.h" #include "xAODTrigL1Calo/versions/CMXCPTobContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXCPTobAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMXJetHits.h" +#include "xAODTrigL1Calo/CMXJetHitsContainer.h" +#include "xAODTrigL1Calo/CMXJetHitsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXJetHits_v1.h" #include "xAODTrigL1Calo/versions/CMXJetHitsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXJetHitsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMXJetTob.h" +#include "xAODTrigL1Calo/CMXJetTobContainer.h" +#include "xAODTrigL1Calo/CMXJetTobAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXJetTob_v1.h" #include "xAODTrigL1Calo/versions/CMXJetTobContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXJetTobAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMXEtSums.h" +#include "xAODTrigL1Calo/CMXEtSumsContainer.h" +#include "xAODTrigL1Calo/CMXEtSumsAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXEtSums_v1.h" #include "xAODTrigL1Calo/versions/CMXEtSumsContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXEtSumsAuxContainer_v1.h" +#include "xAODTrigL1Calo/CMXRoI.h" +#include "xAODTrigL1Calo/CMXRoIContainer.h" +#include "xAODTrigL1Calo/CMXRoIAuxContainer.h" #include "xAODTrigL1Calo/versions/CMXRoI_v1.h" #include "xAODTrigL1Calo/versions/CMXRoIContainer_v1.h" #include "xAODTrigL1Calo/versions/CMXRoIAuxContainer_v1.h" @@ -108,15 +151,20 @@ #include "xAODTrigL1Calo/versions/CPMTowerContainer_v2.h" #include "xAODTrigL1Calo/versions/CPMTowerAuxContainer_v2.h" +#include "xAODTrigL1Calo/CPMTobRoI.h" +#include "xAODTrigL1Calo/CPMTobRoIContainer.h" +#include "xAODTrigL1Calo/CPMTobRoIAuxContainer.h" #include "xAODTrigL1Calo/versions/CPMTobRoI_v1.h" #include "xAODTrigL1Calo/versions/CPMTobRoIContainer_v1.h" #include "xAODTrigL1Calo/versions/CPMTobRoIAuxContainer_v1.h" - #include "xAODTrigL1Calo/versions/JEMEtSums_v2.h" #include "xAODTrigL1Calo/versions/JEMEtSumsContainer_v2.h" #include "xAODTrigL1Calo/versions/JEMEtSumsAuxContainer_v2.h" +#include "xAODTrigL1Calo/JEMTobRoI.h" +#include "xAODTrigL1Calo/JEMTobRoIContainer.h" +#include "xAODTrigL1Calo/JEMTobRoIAuxContainer.h" #include "xAODTrigL1Calo/versions/JEMTobRoI_v1.h" #include "xAODTrigL1Calo/versions/JEMTobRoIContainer_v1.h" #include "xAODTrigL1Calo/versions/JEMTobRoIAuxContainer_v1.h" @@ -125,332 +173,80 @@ #include "xAODTrigL1Calo/versions/JetElementContainer_v2.h" #include "xAODTrigL1Calo/versions/JetElementAuxContainer_v2.h" +#include "xAODTrigL1Calo/L1TopoRawData.h" +#include "xAODTrigL1Calo/L1TopoRawDataContainer.h" +#include "xAODTrigL1Calo/L1TopoRawDataAuxContainer.h" #include "xAODTrigL1Calo/versions/L1TopoRawData_v1.h" #include "xAODTrigL1Calo/versions/L1TopoRawDataContainer_v1.h" #include "xAODTrigL1Calo/versions/L1TopoRawDataAuxContainer_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" -// Versionless AuxContainers -#include "xAODTrigL1Calo/CMMCPHitsAuxContainer.h" -#include "xAODTrigL1Calo/CMMEtSumsAuxContainer.h" -#include "xAODTrigL1Calo/CMMJetHitsAuxContainer.h" -#include "xAODTrigL1Calo/CMMRoIAuxInfo.h" -#include "xAODTrigL1Calo/CMXCPHitsAuxContainer.h" -#include "xAODTrigL1Calo/CMXCPTobAuxContainer.h" -#include "xAODTrigL1Calo/CMXEtSumsAuxContainer.h" -#include "xAODTrigL1Calo/CMXJetHitsAuxContainer.h" -#include "xAODTrigL1Calo/CMXJetTobAuxContainer.h" -#include "xAODTrigL1Calo/CMXRoIAuxContainer.h" -#include "xAODTrigL1Calo/CPMHitsAuxContainer.h" -#include "xAODTrigL1Calo/CPMRoIAuxContainer.h" -#include "xAODTrigL1Calo/CPMTobRoIAuxContainer.h" -#include "xAODTrigL1Calo/CPMTowerAuxContainer.h" -#include "xAODTrigL1Calo/JEMEtSumsAuxContainer.h" -#include "xAODTrigL1Calo/JEMHitsAuxContainer.h" -#include "xAODTrigL1Calo/JEMRoIAuxContainer.h" -#include "xAODTrigL1Calo/JEMTobRoIAuxContainer.h" -#include "xAODTrigL1Calo/JetElementAuxContainer.h" -#include "xAODTrigL1Calo/RODHeaderAuxContainer.h" -#include "xAODTrigL1Calo/TriggerTowerAuxContainer.h" -#include "xAODTrigL1Calo/L1TopoRawDataAuxContainer.h" - - +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGL1CALO { - + // Run 1 - - // JEMHits - xAOD::JEMHitsContainer_v1 JEMHits_v1_c1; - /* - DataLink< xAOD::JEMHitsContainer_v1 > JEMHits_v1_l1; - ElementLink< xAOD::JEMHitsContainer_v1 > JEMHits_v1_l2; - ElementLinkVector< xAOD::JEMHitsContainer_v1 > JEMHits_v1_l3; - std::vector< DataLink< xAOD::JEMHitsContainer_v1 > > JEMHits_v1_l4; - std::vector< ElementLink< xAOD::JEMHitsContainer_v1 > > JEMHits_v1_l5; - std::vector< ElementLinkVector< xAOD::JEMHitsContainer_v1 > > JEMHits_v1_l6; - */ + // JEMHits + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JEMHitsContainer_v1 ); // JEMEtSums - xAOD::JEMEtSumsContainer_v1 JEMEtSums_v1_c1; - /* - DataLink< xAOD::JEMEtSumsContainer_v1 > JEMEtSums_v1_l1; - ElementLink< xAOD::JEMEtSumsContainer_v1 > JEMEtSums_v1_l2; - ElementLinkVector< xAOD::JEMEtSumsContainer_v1 > JEMEtSums_v1_l3; - std::vector< DataLink< xAOD::JEMEtSumsContainer_v1 > > JEMEtSums_v1_l4; - std::vector< ElementLink< xAOD::JEMEtSumsContainer_v1 > > JEMEtSums_v1_l5; - std::vector< ElementLinkVector< xAOD::JEMEtSumsContainer_v1 > > JEMEtSums_v1_l6; - */ - - // JEMRoI - xAOD::JEMRoIContainer_v1 JEMRoI_v1_c1; - /* - DataLink< xAOD::JEMRoIContainer_v1 > JEMRoI_v1_l1; - ElementLink< xAOD::JEMRoIContainer_v1 > JEMRoI_v1_l2; - ElementLinkVector< xAOD::JEMRoIContainer_v1 > JEMRoI_v1_l3; - std::vector< DataLink< xAOD::JEMRoIContainer_v1 > > JEMRoI_v1_l4; - std::vector< ElementLink< xAOD::JEMRoIContainer_v1 > > JEMRoI_v1_l5; - std::vector< ElementLinkVector< xAOD::JEMRoIContainer_v1 > > JEMRoI_v1_l6; \ - */ - - // CPMHits - xAOD::CPMHitsContainer_v1 CPMHits_v1_c1; - /* - DataLink< xAOD::CPMHitsContainer_v1 > CPMHits_v1_l1; - ElementLink< xAOD::CPMHitsContainer_v1 > CPMHits_v1_l2; - ElementLinkVector< xAOD::CPMHitsContainer_v1 > CPMHits_v1_l3; - std::vector< DataLink< xAOD::CPMHitsContainer_v1 > > CPMHits_v1_l4; - std::vector< ElementLink< xAOD::CPMHitsContainer_v1 > > CPMHits_v1_l5; - std::vector< ElementLinkVector< xAOD::CPMHitsContainer_v1 > > CPMHits_v1_l6; - */ - - // CPMTower - xAOD::CPMTowerContainer_v1 CPMTower_v1_c1; - /* - DataLink< xAOD::CPMTowerContainer_v1 > CPMTower_v1_l1; - ElementLink< xAOD::CPMTowerContainer_v1 > CPMTower_v1_l2; - ElementLinkVector< xAOD::CPMTowerContainer_v1 > CPMTower_v1_l3; - std::vector< DataLink< xAOD::CPMTowerContainer_v1 > > CPMTower_v1_l4; - std::vector< ElementLink< xAOD::CPMTowerContainer_v1 > > CPMTower_v1_l5; - std::vector< ElementLinkVector< xAOD::CPMTowerContainer_v1 > > CPMTower_v1_l6; - */ - - // CPMRoI - xAOD::CPMRoIContainer_v1 CPMRoI_v1_c1; - /* - DataLink< xAOD::CPMRoIContainer_v1 > CPMRoI_v1_l1; - ElementLink< xAOD::CPMRoIContainer_v1 > CPMRoI_v1_l2; - ElementLinkVector< xAOD::CPMRoIContainer_v1 > CPMRoI_v1_l3; - std::vector< DataLink< xAOD::CPMRoIContainer_v1 > > CPMRoI_v1_l4; - std::vector< ElementLink< xAOD::CPMRoIContainer_v1 > > CPMRoI_v1_l5; - std::vector< ElementLinkVector< xAOD::CPMRoIContainer_v1 > > CPMRoI_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JEMEtSumsContainer_v1 ); + // JEMRoI + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JEMRoIContainer_v1 ); + // CPMHits + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CPMHitsContainer_v1 ); + // CPMTower + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CPMTowerContainer_v1 ); + // CPMRoI + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CPMRoIContainer_v1 ); // CMMCPHits - xAOD::CMMCPHitsContainer_v1 CMMCPHits_v1_c1; - /* - DataLink< xAOD::CMMCPHitsContainer_v1 > CMMCPHits_v1_l1; - ElementLink< xAOD::CMMCPHitsContainer_v1 > CMMCPHits_v1_l2; - ElementLinkVector< xAOD::CMMCPHitsContainer_v1 > CMMCPHits_v1_l3; - std::vector< DataLink< xAOD::CMMCPHitsContainer_v1 > > CMMCPHits_v1_l4; - std::vector< ElementLink< xAOD::CMMCPHitsContainer_v1 > > CMMCPHits_v1_l5; - std::vector< ElementLinkVector< xAOD::CMMCPHitsContainer_v1 > > CMMCPHits_v1_l6; - */ - - // CMMEtSums - xAOD::CMMEtSumsContainer_v1 CMMEtSums_v1_c1; - /* - DataLink< xAOD::CMMEtSumsContainer_v1 > CMMEtSums_v1_l1; - ElementLink< xAOD::CMMEtSumsContainer_v1 > CMMEtSums_v1_l2; - ElementLinkVector< xAOD::CMMEtSumsContainer_v1 > CMMEtSums_v1_l3; - std::vector< DataLink< xAOD::CMMEtSumsContainer_v1 > > CMMEtSums_v1_l4; - std::vector< ElementLink< xAOD::CMMEtSumsContainer_v1 > > CMMEtSums_v1_l5; - std::vector< ElementLinkVector< xAOD::CMMEtSumsContainer_v1 > > CMMEtSums_v1_l6; - */ - - // CMMJetHits - xAOD::CMMJetHitsContainer_v1 CMMJetHits_v1_c1; - /* - DataLink< xAOD::CMMJetHitsContainer_v1 > CMMJetHits_v1_l1; - ElementLink< xAOD::CMMJetHitsContainer_v1 > CMMJetHits_v1_l2; - ElementLinkVector< xAOD::CMMJetHitsContainer_v1 > CMMJetHits_v1_l3; - std::vector< DataLink< xAOD::CMMJetHitsContainer_v1 > > CMMJetHits_v1_l4; - std::vector< ElementLink< xAOD::CMMJetHitsContainer_v1 > > CMMJetHits_v1_l5; - std::vector< ElementLinkVector< xAOD::CMMJetHitsContainer_v1 > > CMMJetHits_v1_l6; - */ - - // JetElement - xAOD::JetElementContainer_v1 JetElement_v1_c1; - /* - DataLink< xAOD::JetElementContainer_v1 > JetElement_v1_l1; - ElementLink< xAOD::JetElementContainer_v1 > JetElement_v1_l2; - ElementLinkVector< xAOD::JetElementContainer_v1 > JetElement_v1_l3; - std::vector< DataLink< xAOD::JetElementContainer_v1 > > JetElement_v1_l4; - std::vector< ElementLink< xAOD::JetElementContainer_v1 > > JetElement_v1_l5; - std::vector< ElementLinkVector< xAOD::JetElementContainer_v1 > > JetElement_v1_l6; - */ - - // RODHeader - xAOD::RODHeaderContainer_v1 RODHeader_v1_c1; - /* - DataLink< xAOD::RODHeaderContainer_v1 > RODHeader_v1_l1; - ElementLink< xAOD::RODHeaderContainer_v1 > RODHeader_v1_l2; - ElementLinkVector< xAOD::RODHeaderContainer_v1 > RODHeader_v1_l3; - std::vector< DataLink< xAOD::RODHeaderContainer_v1 > > RODHeader_v1_l4; - std::vector< ElementLink< xAOD::RODHeaderContainer_v1 > > RODHeader_v1_l5; - std::vector< ElementLinkVector< xAOD::RODHeaderContainer_v1 > > RODHeader_v1_l6; - */ - - // TriggerTower - xAOD::TriggerTowerContainer_v1 TriggerTower_v1_c1; - /* - DataLink< xAOD::TriggerTowerContainer_v1 > TriggerTower_v1_l1; - ElementLink< xAOD::TriggerTowerContainer_v1 > TriggerTower_v1_l2; - ElementLinkVector< xAOD::TriggerTowerContainer_v1 > TriggerTower_v1_l3; - std::vector< DataLink< xAOD::TriggerTowerContainer_v1 > > TriggerTower_v1_l4; - std::vector< ElementLink< xAOD::TriggerTowerContainer_v1 > > TriggerTower_v1_l5; - std::vector< ElementLinkVector< xAOD::TriggerTowerContainer_v1 > > TriggerTower_v1_l6; - */ - - // Run 2 - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMMCPHitsContainer_v1 ); + // CMMEtSums + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMMEtSumsContainer_v1 ); + // CMMJetHits + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMMJetHitsContainer_v1 ); + // JetElement + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetElementContainer_v1 ); + // RODHeader + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, RODHeaderContainer_v1 ); // TriggerTower - xAOD::TriggerTowerContainer_v2 TriggerTower_v2_c1; - /* - DataLink< xAOD::TriggerTowerContainer_v2 > TriggerTower_v2_l1; - ElementLink< xAOD::TriggerTowerContainer_v2 > TriggerTower_v2_l2; - ElementLinkVector< xAOD::TriggerTowerContainer_v2 > TriggerTower_v2_l3; - std::vector< DataLink< xAOD::TriggerTowerContainer_v2 > > TriggerTower_v2_l4; - std::vector< ElementLink< xAOD::TriggerTowerContainer_v2 > > TriggerTower_v2_l5; - std::vector< ElementLinkVector< xAOD::TriggerTowerContainer_v2 > > TriggerTower_v2_l6; - */ - - // RODHeader - xAOD::RODHeaderContainer_v2 RODHeader_v2_c1; - /* - DataLink< xAOD::RODHeaderContainer_v2 > RODHeader_v2_l1; - ElementLink< xAOD::RODHeaderContainer_v2 > RODHeader_v2_l2; - ElementLinkVector< xAOD::RODHeaderContainer_v2 > RODHeader_v2_l3; - std::vector< DataLink< xAOD::RODHeaderContainer_v2 > > RODHeader_v2_l4; - std::vector< ElementLink< xAOD::RODHeaderContainer_v2 > > RODHeader_v2_l5; - std::vector< ElementLinkVector< xAOD::RODHeaderContainer_v2 > > RODHeader_v2_l6; - */ + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TriggerTowerContainer_v1 ); + // CMMRoI + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, CMMRoI_v1 ); + // Run 2 + + // TriggerTower + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TriggerTowerContainer_v2 ); + // RODHeader + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, RODHeaderContainer_v2 ); // CMXCPHits - xAOD::CMXCPHitsContainer_v1 CMXCPHits_v1_c1; - /* - DataLink< xAOD::CMXCPHitsContainer_v1 > CMXCPHits_v1_l1; - ElementLink< xAOD::CMXCPHitsContainer_v1 > CMXCPHits_v1_l2; - ElementLinkVector< xAOD::CMXCPHitsContainer_v1 > CMXCPHits_v1_l3; - std::vector< DataLink< xAOD::CMXCPHitsContainer_v1 > > CMXCPHits_v1_l4; - std::vector< ElementLink< xAOD::CMXCPHitsContainer_v1 > > CMXCPHits_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXCPHitsContainer_v1 > > CMXCPHits_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXCPHitsContainer_v1 ); // CMXCPTob - xAOD::CMXCPTobContainer_v1 CMXCPTob_v1_c1; - /* - DataLink< xAOD::CMXCPTobContainer_v1 > CMXCPTob_v1_l1; - ElementLink< xAOD::CMXCPTobContainer_v1 > CMXCPTob_v1_l2; - ElementLinkVector< xAOD::CMXCPTobContainer_v1 > CMXCPTob_v1_l3; - std::vector< DataLink< xAOD::CMXCPTobContainer_v1 > > CMXCPTob_v1_l4; - std::vector< ElementLink< xAOD::CMXCPTobContainer_v1 > > CMXCPTob_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXCPTobContainer_v1 > > CMXCPTob_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXCPTobContainer_v1 ); // CMXJetHits - xAOD::CMXJetHitsContainer_v1 CMXJetHits_v1_c1; - /* - DataLink< xAOD::CMXJetHitsContainer_v1 > CMXJetHits_v1_l1; - ElementLink< xAOD::CMXJetHitsContainer_v1 > CMXJetHits_v1_l2; - ElementLinkVector< xAOD::CMXJetHitsContainer_v1 > CMXJetHits_v1_l3; - std::vector< DataLink< xAOD::CMXJetHitsContainer_v1 > > CMXJetHits_v1_l4; - std::vector< ElementLink< xAOD::CMXJetHitsContainer_v1 > > CMXJetHits_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXJetHitsContainer_v1 > > CMXJetHits_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXJetHitsContainer_v1 ); // CMXJetTob - xAOD::CMXJetTobContainer_v1 CMXJetTob_v1_c1; - /* - DataLink< xAOD::CMXJetTobContainer_v1 > CMXJetTob_v1_l1; - ElementLink< xAOD::CMXJetTobContainer_v1 > CMXJetTob_v1_l2; - ElementLinkVector< xAOD::CMXJetTobContainer_v1 > CMXJetTob_v1_l3; - std::vector< DataLink< xAOD::CMXJetTobContainer_v1 > > CMXJetTob_v1_l4; - std::vector< ElementLink< xAOD::CMXJetTobContainer_v1 > > CMXJetTob_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXJetTobContainer_v1 > > CMXJetTob_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXJetTobContainer_v1 ); // CMXEtSums - xAOD::CMXEtSumsContainer_v1 CMXEtSums_v1_c1; - /* - DataLink< xAOD::CMXEtSumsContainer_v1 > CMXEtSums_v1_l1; - ElementLink< xAOD::CMXEtSumsContainer_v1 > CMXEtSums_v1_l2; - ElementLinkVector< xAOD::CMXEtSumsContainer_v1 > CMXEtSums_v1_l3; - std::vector< DataLink< xAOD::CMXEtSumsContainer_v1 > > CMXEtSums_v1_l4; - std::vector< ElementLink< xAOD::CMXEtSumsContainer_v1 > > CMXEtSums_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXEtSumsContainer_v1 > > CMXEtSums_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXEtSumsContainer_v1 ); // CMXRoI - xAOD::CMXRoIContainer_v1 CMXRoI_v1_c1; - /* - DataLink< xAOD::CMXRoIContainer_v1 > CMXRoI_v1_l1; - ElementLink< xAOD::CMXRoIContainer_v1 > CMXRoI_v1_l2; - ElementLinkVector< xAOD::CMXRoIContainer_v1 > CMXRoI_v1_l3; - std::vector< DataLink< xAOD::CMXRoIContainer_v1 > > CMXRoI_v1_l4; - std::vector< ElementLink< xAOD::CMXRoIContainer_v1 > > CMXRoI_v1_l5; - std::vector< ElementLinkVector< xAOD::CMXRoIContainer_v1 > > CMXRoI_v1_l6; - */ - - // CPMTower - xAOD::CPMTowerContainer_v2 CPMTower_v2_c1; - /* - DataLink< xAOD::CPMTowerContainer_v2 > CPMTower_v2_l1; - ElementLink< xAOD::CPMTowerContainer_v2 > CPMTower_v2_l2; - ElementLinkVector< xAOD::CPMTowerContainer_v2 > CPMTower_v2_l3; - std::vector< DataLink< xAOD::CPMTowerContainer_v2 > > CPMTower_v2_l4; - std::vector< ElementLink< xAOD::CPMTowerContainer_v2 > > CPMTower_v2_l5; - std::vector< ElementLinkVector< xAOD::CPMTowerContainer_v2 > > CPMTower_v2_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CMXRoIContainer_v1 ); + // CPMTower + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CPMTowerContainer_v2 ); // CPMTobRoI - xAOD::CPMTobRoIContainer_v1 CPMTobRoI_v1_c1; - /* - DataLink< xAOD::CPMTobRoIContainer_v1 > CPMTobRoI_v1_l1; - ElementLink< xAOD::CPMTobRoIContainer_v1 > CPMTobRoI_v1_l2; - ElementLinkVector< xAOD::CPMTobRoIContainer_v1 > CPMTobRoI_v1_l3; - std::vector< DataLink< xAOD::CPMTobRoIContainer_v1 > > CPMTobRoI_v1_l4; - std::vector< ElementLink< xAOD::CPMTobRoIContainer_v1 > > CPMTobRoI_v1_l5; - std::vector< ElementLinkVector< xAOD::CPMTobRoIContainer_v1 > > CPMTobRoI_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, CPMTobRoIContainer_v1 ); // JEMEtSums - xAOD::JEMEtSumsContainer_v2 JEMEtSums_v2_c1; - /* - DataLink< xAOD::JEMEtSumsContainer_v2 > JEMEtSums_v2_l1; - ElementLink< xAOD::JEMEtSumsContainer_v2 > JEMEtSums_v2_l2; - ElementLinkVector< xAOD::JEMEtSumsContainer_v2 > JEMEtSums_v2_l3; - std::vector< DataLink< xAOD::JEMEtSumsContainer_v2 > > JEMEtSums_v2_l4; - std::vector< ElementLink< xAOD::JEMEtSumsContainer_v2 > > JEMEtSums_v2_l5; - std::vector< ElementLinkVector< xAOD::JEMEtSumsContainer_v2 > > JEMEtSums_v2_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JEMEtSumsContainer_v2 ); // JEMTobRoI - xAOD::JEMTobRoIContainer_v1 JEMTobRoI_v1_c1; - /* - DataLink< xAOD::JEMTobRoIContainer_v1 > JEMTobRoI_v1_l1; - ElementLink< xAOD::JEMTobRoIContainer_v1 > JEMTobRoI_v1_l2; - ElementLinkVector< xAOD::JEMTobRoIContainer_v1 > JEMTobRoI_v1_l3; - std::vector< DataLink< xAOD::JEMTobRoIContainer_v1 > > JEMTobRoI_v1_l4; - std::vector< ElementLink< xAOD::JEMTobRoIContainer_v1 > > JEMTobRoI_v1_l5; - std::vector< ElementLinkVector< xAOD::JEMTobRoIContainer_v1 > > JEMTobRoI_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JEMTobRoIContainer_v1 ); // JetElement - xAOD::JetElementContainer_v2 JetElement_v2_c1; - /* - DataLink< xAOD::JetElementContainer_v2 > JetElement_v2_l1; - ElementLink< xAOD::JetElementContainer_v2 > JetElement_v2_l2; - ElementLinkVector< xAOD::JetElementContainer_v2 > JetElement_v2_l3; - std::vector< DataLink< xAOD::JetElementContainer_v2 > > JetElement_v2_l4; - std::vector< ElementLink< xAOD::JetElementContainer_v2 > > JetElement_v2_l5; - std::vector< ElementLinkVector< xAOD::JetElementContainer_v2 > > JetElement_v2_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetElementContainer_v2 ); // L1TopoRawData - xAOD::L1TopoRawDataContainer_v1 L1TopoRawData_v1_c1; - /* - DataLink< xAOD::L1TopoRawDataContainer_v1 > L1TopoRawData_v1_l1; - ElementLink< xAOD::L1TopoRawDataContainer_v1 > L1TopoRawData_v1_l2; - ElementLinkVector< xAOD::L1TopoRawDataContainer_v1 > L1TopoRawData_v1_l3; - std::vector< DataLink< xAOD::L1TopoRawDataContainer_v1 > > L1TopoRawData_v1_l4; - std::vector< ElementLink< xAOD::L1TopoRawDataContainer_v1 > > L1TopoRawData_v1_l5; - std::vector< ElementLinkVector< xAOD::L1TopoRawDataContainer_v1 > > L1TopoRawData_v1_l6; - */ - + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L1TopoRawDataContainer_v1 ); }; } -template class DataVector<xAOD::TriggerTower_v2>; - #endif // XAODTRIGL1CALO_XAODTRIGL1CALOCALOEVENTDICT_H diff --git a/Event/xAOD/xAODTrigMinBias/CMakeLists.txt b/Event/xAOD/xAODTrigMinBias/CMakeLists.txt index b914b5fd7b206a37abf1d847dbdb9b79d865d620..5f96dd03ae3abe9dcb337170cb4bc3f926f8736c 100644 --- a/Event/xAOD/xAODTrigMinBias/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMinBias/CMakeLists.txt @@ -1,30 +1,31 @@ -# $Id: CMakeLists.txt 751124 2016-05-31 12:55:34Z krasznaa $ -################################################################################ -# Package: xAODTrigMinBias -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigMinBias ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Event/xAOD/xAODCore - PRIVATE - Control/AthLinks ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigMinBias xAODTrigMinBias/*.h xAODTrigMinBias/versions/*.h Root/*.cxx PUBLIC_HEADERS xAODTrigMinBias LINK_LIBRARIES AthContainers xAODCore ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigMinBias/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigSpacePointCountsContainer_v1" + "xAOD::TrigT2MbtsBitsContainer_v1" "xAOD::TrigHisto2DContainer_v1" + "xAOD::TrigTrackCountsContainer_v1" + "xAOD::TrigVertexCountsContainer_v1" + "xAOD::TrigT2ZdcSignalsContainer_v1" ) + atlas_add_dictionary( xAODTrigMinBiasDict xAODTrigMinBias/xAODTrigMinBiasDict.h - xAODTrigMinBias/selection.xml - LINK_LIBRARIES AthLinks xAODTrigMinBias + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigMinBias EXTRA_FILES Root/dict/*.cxx ) -# Generate CLIDs from the library: +# Generate CLIDs from the library. atlas_generate_cliddb( xAODTrigMinBias ) diff --git a/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/selection.xml b/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/selection.xml index 48ded7f23f3d83dffa52e59d9f67f431430aa506..ca6aab76eeac5e1b0aaf9057f2ffd4bb37a728e2 100644 --- a/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/selection.xml +++ b/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/selection.xml @@ -1,27 +1,76 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <class name="xAOD::TrigSpacePointCounts_v1" /> - <class name="xAOD::TrigSpacePointCountsContainer_v1" id="519EBE61-C135-46C7-AD7D-C661DC6FC4B5" /> - <class name="xAOD::TrigSpacePointCountsAuxContainer_v1" id="C682FD32-73CC-4773-ACBF-30B2657C5991" /> - <class name="xAOD::TrigT2MbtsBits_v1" /> - <class name="xAOD::TrigT2MbtsBitsContainer_v1" id="FF96BF06-1206-11E4-9605-02163E00A892" /> - <class name="xAOD::TrigT2MbtsBitsAuxContainer_v1" id="0055818E-1207-11E4-9C7B-02163E00A892" /> - <class name="xAOD::TrigHisto2D_v1" /> - <class name="xAOD::TrigHisto2DContainer_v1" id="0116E8A6-1207-11E4-8724-02163E00A892" /> - <class name="xAOD::TrigHisto2DAuxContainer_v1" id="05B28A1E-1207-11E4-84E2-02163E00A892" /> - <class name="xAOD::TrigTrackCounts_v1" /> - <class name="xAOD::TrigTrackCountsContainer_v1" id="0650DED0-1207-11E4-9CD1-02163E00A892" /> - <class name="xAOD::TrigTrackCountsAuxContainer_v1" id="0701BEB0-1207-11E4-9D08-02163E00A892" /> - <class name="xAOD::TrigVertexCounts_v1" /> - <class name="xAOD::TrigVertexCountsContainer_v1" id="07EE6B72-1207-11E4-8B69-02163E00A892" /> - <class name="xAOD::TrigVertexCountsAuxContainer_v1" id="70E7BDFE-1207-11E4-ACEF-02163E00A892" /> - <class name="xAOD::TrigT2ZdcSignals_v1" /> - <class name="xAOD::TrigT2ZdcSignalsContainer_v1" id="8313279A-5E27-11E4-A635-02163E00A82C" /> - <class name="xAOD::TrigT2ZdcSignalsAuxContainer_v1" id="83B9F174-5E27-11E4-98C2-02163E00A82" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - </exclusion> + + <!-- xAOD::TrigSpacePointCounts interface type(s). --> + <class name="xAOD::TrigSpacePointCounts_v1" /> + <class name="xAOD::TrigSpacePointCountsContainer_v1" + id="519EBE61-C135-46C7-AD7D-C661DC6FC4B5" /> + <typedef name="xAOD::TrigSpacePointCounts" /> + <typedef name="xAOD::TrigSpacePointCountsContainer" /> + + <!-- xAOD::TrigSpacePointCounts auxiliary type(s). --> + <class name="xAOD::TrigSpacePointCountsAuxContainer_v1" + id="C682FD32-73CC-4773-ACBF-30B2657C5991" /> + <typedef name="xAOD::TrigSpacePointCountsAuxContainer" /> + + <!-- xAOD::TrigT2MbtsBits interface type(s). --> + <class name="xAOD::TrigT2MbtsBits_v1" /> + <class name="xAOD::TrigT2MbtsBitsContainer_v1" + id="FF96BF06-1206-11E4-9605-02163E00A892" /> + <typedef name="xAOD::TrigT2MbtsBits" /> + <typedef name="xAOD::TrigT2MbtsBitsContainer" /> + + <!-- xAOD::TrigT1MbtsBits auxiliary type(s). --> + <class name="xAOD::TrigT2MbtsBitsAuxContainer_v1" + id="0055818E-1207-11E4-9C7B-02163E00A892" /> + <typedef name="xAOD::TrigT2MbtsBitsAuxContainer" /> + + <!-- xAOD::TrigHisto2D interface type(s). --> + <class name="xAOD::TrigHisto2D_v1" /> + <class name="xAOD::TrigHisto2DContainer_v1" + id="0116E8A6-1207-11E4-8724-02163E00A892" /> + <typedef name="xAOD::TrigHisto2D" /> + <typedef name="xAOD::TrigHisto2DContainer" /> + + <!-- xAOD::TrigHisto2D auxiliary type(s). --> + <class name="xAOD::TrigHisto2DAuxContainer_v1" + id="05B28A1E-1207-11E4-84E2-02163E00A892" /> + <typedef name="xAOD::TrigHisto2DAuxContainer" /> + + <!-- xAOD::TrigTrackCounts interface type(s). --> + <class name="xAOD::TrigTrackCounts_v1" /> + <class name="xAOD::TrigTrackCountsContainer_v1" + id="0650DED0-1207-11E4-9CD1-02163E00A892" /> + <typedef name="xAOD::TrigTrackCounts" /> + <typedef name="xAOD::TrigTrackCountsContainer" /> + + <!-- xAOD::TrigTrackCounts auxiliary type(s). --> + <class name="xAOD::TrigTrackCountsAuxContainer_v1" + id="0701BEB0-1207-11E4-9D08-02163E00A892" /> + <typedef name="xAOD::TrigTrackCountsAuxContainer" /> + + <!-- xAOD::TrigVertexCounts interface type(s). --> + <class name="xAOD::TrigVertexCounts_v1" /> + <class name="xAOD::TrigVertexCountsContainer_v1" + id="07EE6B72-1207-11E4-8B69-02163E00A892" /> + <typedef name="xAOD::TrigVertexCounts" /> + <typedef name="xAOD::TrigVertexCountsContainer" /> + + <!-- xAOD::TrigVertexCounts auxiliary type(s). --> + <class name="xAOD::TrigVertexCountsAuxContainer_v1" + id="70E7BDFE-1207-11E4-ACEF-02163E00A892" /> + <typedef name="xAOD::TrigVertexCountsAuxContainer" /> + + <!-- xAOD::TrigT2ZdcSignals interface type(s). --> + <class name="xAOD::TrigT2ZdcSignals_v1" /> + <class name="xAOD::TrigT2ZdcSignalsContainer_v1" + id="8313279A-5E27-11E4-A635-02163E00A82C" /> + <typedef name="xAOD::TrigT2ZdcSignals" /> + <typedef name="xAOD::TrigT2ZdcSignalsContainer" /> + + <!-- xAOD::TrigT2ZdcSignals auxiliary type(s). --> + <class name="xAOD::TrigT2ZdcSignalsAuxContainer_v1" + id="83B9F174-5E27-11E4-98C2-02163E00A82" /> + <typedef name="xAOD::TrigT2ZdcSignalsAuxContainer" /> + </lcgdict> diff --git a/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/xAODTrigMinBiasDict.h b/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/xAODTrigMinBiasDict.h index 9dfc23333d39aa30560d78a5e223b35859640c11..bab6e929e52f6f7c1230665181753f381803cd33 100644 --- a/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/xAODTrigMinBiasDict.h +++ b/Event/xAOD/xAODTrigMinBias/xAODTrigMinBias/xAODTrigMinBiasDict.h @@ -1,80 +1,68 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef xAODTrigMinBias_xAODTrigMinBias_DICT_H #define xAODTrigMinBias_xAODTrigMinBias_DICT_H -// Include all headers here that need to have dictionaries -// generated for them. - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - +// Local include(s). +#include "xAODTrigMinBias/TrigSpacePointCounts.h" +#include "xAODTrigMinBias/TrigSpacePointCountsContainer.h" +#include "xAODTrigMinBias/TrigSpacePointCountsAuxContainer.h" #include "xAODTrigMinBias/versions/TrigSpacePointCounts_v1.h" #include "xAODTrigMinBias/versions/TrigSpacePointCountsContainer_v1.h" #include "xAODTrigMinBias/versions/TrigSpacePointCountsAuxContainer_v1.h" +#include "xAODTrigMinBias/TrigT2MbtsBits.h" +#include "xAODTrigMinBias/TrigT2MbtsBitsContainer.h" +#include "xAODTrigMinBias/TrigT2MbtsBitsAuxContainer.h" #include "xAODTrigMinBias/versions/TrigT2MbtsBits_v1.h" #include "xAODTrigMinBias/versions/TrigT2MbtsBitsContainer_v1.h" #include "xAODTrigMinBias/versions/TrigT2MbtsBitsAuxContainer_v1.h" +#include "xAODTrigMinBias/TrigHisto2D.h" +#include "xAODTrigMinBias/TrigHisto2DContainer.h" +#include "xAODTrigMinBias/TrigHisto2DAuxContainer.h" #include "xAODTrigMinBias/versions/TrigHisto2D_v1.h" #include "xAODTrigMinBias/versions/TrigHisto2DContainer_v1.h" #include "xAODTrigMinBias/versions/TrigHisto2DAuxContainer_v1.h" +#include "xAODTrigMinBias/TrigVertexCounts.h" +#include "xAODTrigMinBias/TrigVertexCountsContainer.h" +#include "xAODTrigMinBias/TrigVertexCountsAuxContainer.h" #include "xAODTrigMinBias/versions/TrigVertexCounts_v1.h" #include "xAODTrigMinBias/versions/TrigVertexCountsContainer_v1.h" #include "xAODTrigMinBias/versions/TrigVertexCountsAuxContainer_v1.h" +#include "xAODTrigMinBias/TrigTrackCounts.h" +#include "xAODTrigMinBias/TrigTrackCountsContainer.h" +#include "xAODTrigMinBias/TrigTrackCountsAuxContainer.h" #include "xAODTrigMinBias/versions/TrigTrackCounts_v1.h" #include "xAODTrigMinBias/versions/TrigTrackCountsContainer_v1.h" #include "xAODTrigMinBias/versions/TrigTrackCountsAuxContainer_v1.h" +#include "xAODTrigMinBias/TrigT2ZdcSignals.h" +#include "xAODTrigMinBias/TrigT2ZdcSignalsContainer.h" +#include "xAODTrigMinBias/TrigT2ZdcSignalsAuxContainer.h" #include "xAODTrigMinBias/versions/TrigT2ZdcSignals_v1.h" #include "xAODTrigMinBias/versions/TrigT2ZdcSignalsContainer_v1.h" #include "xAODTrigMinBias/versions/TrigT2ZdcSignalsAuxContainer_v1.h" -//i don't know what for +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGMINBIAS { - xAOD::TrigSpacePointCountsContainer_v1 c1; - DataLink< xAOD::TrigSpacePointCountsContainer_v1 > dl1; - std::vector< DataLink< xAOD::TrigSpacePointCountsContainer_v1 > > dl2; - ElementLink< xAOD::TrigSpacePointCountsContainer_v1 > el1; - std::vector< ElementLink< xAOD::TrigSpacePointCountsContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::TrigSpacePointCountsContainer_v1 > > > el3; - - xAOD::TrigT2MbtsBitsContainer_v1 ct1; - DataLink< xAOD::TrigT2MbtsBitsContainer_v1 > dlt1; - std::vector< DataLink< xAOD::TrigT2MbtsBitsContainer_v1 > > dlt2; - ElementLink< xAOD::TrigT2MbtsBitsContainer_v1 > elt1; - std::vector< ElementLink< xAOD::TrigT2MbtsBitsContainer_v1 > > elt2; - std::vector< std::vector< ElementLink< xAOD::TrigT2MbtsBitsContainer_v1 > > > elt3; - - xAOD::TrigVertexCountsContainer_v1 cv1; - DataLink< xAOD::TrigVertexCountsContainer_v1 > dlv1; - std::vector< DataLink< xAOD::TrigVertexCountsContainer_v1 > > dlv2; - ElementLink< xAOD::TrigVertexCountsContainer_v1 > elv1; - std::vector< ElementLink< xAOD::TrigVertexCountsContainer_v1 > > elv2; - std::vector< std::vector< ElementLink< xAOD::TrigVertexCountsContainer_v1 > > > elv3; - - xAOD::TrigTrackCountsContainer_v1 ctt1; - DataLink< xAOD::TrigTrackCountsContainer_v1 > dltt1; - std::vector< DataLink< xAOD::TrigTrackCountsContainer_v1 > > dltt2; - ElementLink< xAOD::TrigTrackCountsContainer_v1 > eltt1; - std::vector< ElementLink< xAOD::TrigTrackCountsContainer_v1 > > eltt2; - std::vector< std::vector< ElementLink< xAOD::TrigTrackCountsContainer_v1 > > > eltt3; - - xAOD::TrigT2ZdcSignalsContainer_v1 czdct1; - DataLink< xAOD::TrigT2ZdcSignalsContainer_v1 > dlzdct1; - std::vector< DataLink< xAOD::TrigT2ZdcSignalsContainer_v1 > > dlzdct2; - ElementLink< xAOD::TrigT2ZdcSignalsContainer_v1 > elzdct1; - std::vector< ElementLink< xAOD::TrigT2ZdcSignalsContainer_v1 > > elzdct2; - std::vector< std::vector< ElementLink< xAOD::TrigT2ZdcSignalsContainer_v1 > > > elzdct3; - + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, + TrigSpacePointCountsContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigT2MbtsBitsContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigHisto2DContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigVertexCountsContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigTrackCountsContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigT2ZdcSignalsContainer_v1 ); }; -} // private namespace +} -#endif +#endif // xAODTrigMinBias_xAODTrigMinBias_DICT_H diff --git a/Event/xAOD/xAODTrigMinBiasCnv/CMakeLists.txt b/Event/xAOD/xAODTrigMinBiasCnv/CMakeLists.txt index fe5ff93b48d403012af3aa3dd11d3c54e8bbf80f..1e3d86d02bf7b15987c860ff691b9e6f0d8cac5e 100644 --- a/Event/xAOD/xAODTrigMinBiasCnv/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMinBiasCnv/CMakeLists.txt @@ -15,14 +15,20 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigEvent/TrigCaloEvent Trigger/TrigEvent/TrigInDetEvent ) +atlas_add_library( xAODTrigMinBiasCnvLib + xAODTrigMinBiasCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODTrigMinBiasCnv + LINK_LIBRARIES GaudiKernel xAODTrigMinBias ) + + # Component(s) in the package: atlas_add_component( xAODTrigMinBiasCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODTrigMinBias GaudiKernel AthenaBaseComps AthenaKernel TrigCaloEvent TrigInDetEvent ) + LINK_LIBRARIES xAODTrigMinBiasCnvLib xAODTrigMinBias GaudiKernel AthenaBaseComps AthenaKernel TrigCaloEvent TrigInDetEvent ) # Install files from the package: -atlas_install_headers( xAODTrigMinBiasCnv ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODTrigMissingET/CMakeLists.txt b/Event/xAOD/xAODTrigMissingET/CMakeLists.txt index 7bc799388cbce8bf071d2bb13c6e5b88f9ddec7a..09d60f2e2f2046cb678d89a6106023dcbf0923f3 100644 --- a/Event/xAOD/xAODTrigMissingET/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMissingET/CMakeLists.txt @@ -1,33 +1,24 @@ -################################################################################ -# Package: xAODTrigMissingET -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigMissingET ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Event/xAOD/xAODCore - PRIVATE - Control/AthLinks ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigMissingET - Root/*.cxx - PUBLIC_HEADERS xAODTrigMissingET - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers xAODCore - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks ) - -atlas_add_dictionary( xAODTrigMissingETDict - xAODTrigMissingET/xAODTrigMissingETDict.h - xAODTrigMissingET/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers xAODCore AthLinks xAODTrigMissingET - EXTRA_FILES Root/dict/*.cxx ) + xAODTrigMissingET/versions/*.h xAODTrigMissingET/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigMissingET + LINK_LIBRARIES AthContainers xAODCore ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigMissingET/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigMissingETContainer_v1" ) +atlas_add_dictionary( xAODTrigMissingETDict + xAODTrigMissingET/xAODTrigMissingETDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigMissingET + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/selection.xml b/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/selection.xml index 4a323ae44fd7539c0752bc6b3b4d0a4b3188fa72..9d497d7beb5086737d00acf100d20c0a7200823b 100644 --- a/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/selection.xml +++ b/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/selection.xml @@ -1,20 +1,16 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <class name="xAOD::TrigMissingET_v1" /> - <class name="xAOD::TrigMissingETContainer_v1" id="3EA0678D-5DCA-4BA8-BB29-775CB9A246AC" /> - <class name="xAOD::TrigMissingETAuxContainer_v1" id="E8C1613E-5E47-4B7F-8ED7-B30A8FE21DB4" /> - <class name="DataLink<xAOD::TrigMissingETContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TrigMissingETContainer_v1> >" /> + <!-- xAOD::TrigMissingET interface type(s). --> + <class name="xAOD::TrigMissingET_v1" /> + <class name="xAOD::TrigMissingETContainer_v1" + id="3EA0678D-5DCA-4BA8-BB29-775CB9A246AC" /> + <typedef name="xAOD::TrigMissingET" /> + <typedef name="xAOD::TrigMissingETContainer" /> - <class name="ElementLink<xAOD::TrigMissingETContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigMissingETContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigMissingETContainer_v1> > >" /> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - </exclusion> + <!-- xAOD::TrigMissingET auxiliary type(s). --> + <class name="xAOD::TrigMissingETAuxContainer_v1" + id="E8C1613E-5E47-4B7F-8ED7-B30A8FE21DB4" /> + <typedef name="xAOD::TrigMissingETAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/xAODTrigMissingETDict.h b/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/xAODTrigMissingETDict.h index 05c79b8142592b5f3ab33b631fdb17493014efe9..e8c34047f358e473e7f4aacbfb00c666e9e67127 100644 --- a/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/xAODTrigMissingETDict.h +++ b/Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/xAODTrigMissingETDict.h @@ -1,36 +1,27 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTrigMissingETDict.h 630930 2014-11-25 14:57:49Z gwatts $ #ifndef xAODTrigMissingET_xAODTrigMissingET_DICT_H #define xAODTrigMissingET_xAODTrigMissingET_DICT_H -// Include all headers here that need to have dictionaries -// generated for them. - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - // Local include(s): #include "xAODTrigMissingET/TrigMissingET.h" #include "xAODTrigMissingET/TrigMissingETContainer.h" +#include "xAODTrigMissingET/TrigMissingETAuxContainer.h" #include "xAODTrigMissingET/versions/TrigMissingET_v1.h" #include "xAODTrigMissingET/versions/TrigMissingETContainer_v1.h" #include "xAODTrigMissingET/versions/TrigMissingETAuxContainer_v1.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGMISSINGET { - xAOD::TrigMissingETContainer_v1 c1; - DataLink< xAOD::TrigMissingETContainer_v1 > dl1; - std::vector< DataLink< xAOD::TrigMissingETContainer_v1 > > dl2; - ElementLink< xAOD::TrigMissingETContainer_v1 > el1; - std::vector< ElementLink< xAOD::TrigMissingETContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::TrigMissingETContainer_v1 > > > el3; + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigMissingETContainer_v1 ); }; -} // private namespace +} -#endif +#endif // xAODTrigMissingET_xAODTrigMissingET_DICT_H diff --git a/Event/xAOD/xAODTrigMissingETCnv/CMakeLists.txt b/Event/xAOD/xAODTrigMissingETCnv/CMakeLists.txt index eeefed6360aa0a82bf377af773dbb4b041a32c27..996cd386454a797688efb1ce0e0b65b06a049175 100644 --- a/Event/xAOD/xAODTrigMissingETCnv/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMissingETCnv/CMakeLists.txt @@ -14,14 +14,20 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel Trigger/TrigEvent/TrigMissingEtEvent ) +atlas_add_library( xAODTrigMissingETCnvLib + xAODTrigMissingETCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODTrigMissingETCnv + LINK_LIBRARIES GaudiKernel xAODTrigMissingET xAODCore ) + + # Component(s) in the package: atlas_add_component( xAODTrigMissingETCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODTrigMissingET GaudiKernel AthenaBaseComps AthenaKernel TrigMissingEtEvent ) + LINK_LIBRARIES xAODTrigMissingETCnvLib xAODTrigMissingET GaudiKernel AthenaBaseComps AthenaKernel TrigMissingEtEvent ) # Install files from the package: -atlas_install_headers( xAODTrigMissingETCnv ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODTrigMuon/CMakeLists.txt b/Event/xAOD/xAODTrigMuon/CMakeLists.txt index 1e60def6b2e5398082faccf92ebf20bb2c4ce6af..7cd013f180e94bd6ae2448519d7a24d0201253a3 100644 --- a/Event/xAOD/xAODTrigMuon/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMuon/CMakeLists.txt @@ -1,41 +1,29 @@ -################################################################################ -# Package: xAODTrigMuon -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigMuon ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODTracking - PRIVATE - Control/AthLinks ) +# External dependencies. +find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Physics Core Tree MathCore Hist RIO pthread GenVector ) - -# Extra dependencies, based on what environment we are in: -if (BUILDVP1LIGHT) - if( BUILDVP1LIGHT_DIST STREQUAL "ubuntu") - set( extra_libs GenVector ) - endif() -endif() - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigMuon - Root/*.cxx - PUBLIC_HEADERS xAODTrigMuon - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers xAODBase xAODCore xAODTracking ${extra_libs} - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks ) + xAODTrigMuon/*.h xAODTrigMuon/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigMuon + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCore + xAODTracking ) -atlas_add_dictionary( xAODTrigMuonDict - xAODTrigMuon/xAODTrigMuonDict.h - xAODTrigMuon/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers xAODBase xAODCore xAODTracking AthLinks xAODTrigMuon - EXTRA_FILES Root/dict/*.cxx ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigMuon/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::L2StandAloneMuonContainer_v1" + "xAOD::L2StandAloneMuonContainer_v2" "xAOD::L2IsoMuonContainer_v1" + "xAOD::L2CombinedMuonContainer_v1" ) +atlas_add_dictionary( xAODTrigMuonDict + xAODTrigMuon/xAODTrigMuonDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigMuon + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigMuon/xAODTrigMuon/selection.xml b/Event/xAOD/xAODTrigMuon/xAODTrigMuon/selection.xml index 0b8c9e2317debb53bf1ac6864bce3df4630caa2e..f1d072badb62a8e5f5d54c2e377bc7f61443299c 100644 --- a/Event/xAOD/xAODTrigMuon/xAODTrigMuon/selection.xml +++ b/Event/xAOD/xAODTrigMuon/xAODTrigMuon/selection.xml @@ -1,90 +1,72 @@ -<!-- $Id: selection.xml 706292 2015-11-06 05:33:24Z ssnyder $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- dictionaries: --> - - <!-- L2StandAloneMuon_v1 --> - <class name="xAOD::L2StandAloneMuon_v1" /> - - <class name="xAOD::L2StandAloneMuonContainer_v1" - id="645BDBC3-44EE-486B-8783-96F93FA2550B" /> - <class name="xAOD::L2StandAloneMuonAuxContainer_v1" - id="69F56941-D2B5-4C70-BFBD-605CB64A3DB8" /> - - <class name="DataLink<xAOD::L2StandAloneMuonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::L2StandAloneMuonContainer_v1> >" /> - - <class name="ElementLink<xAOD::L2StandAloneMuonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v1> > >" /> - - <!-- L2StandAloneMuon_v2 --> - <class name="xAOD::L2StandAloneMuon_v2" /> - - <class name="xAOD::L2StandAloneMuonContainer_v2" - id="6B02C486-CB3B-4762-89CA-60B210FC5AAF" /> - <class name="xAOD::L2StandAloneMuonAuxContainer_v2" - id="39CA616A-16BF-4CCE-8885-3D68CE7BC3B0" /> - - <class name="DataLink<xAOD::L2StandAloneMuonContainer_v2>" /> - <class name="std::vector<DataLink<xAOD::L2StandAloneMuonContainer_v2> >" /> - - <class name="ElementLink<xAOD::L2StandAloneMuonContainer_v2>" /> - <class name="std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v2> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v2> > >" /> - - <!-- L2IsoMuon --> - <class name="xAOD::L2IsoMuon_v1" /> - - <class name="xAOD::L2IsoMuonContainer_v1" - id="D3AD2358-29B9-48D1-B181-89D4DA39B5CC" /> - <class name="xAOD::L2IsoMuonAuxContainer_v1" - id="09310901-41D9-49FB-A131-5AC73A9EA455" /> - - <class name="DataLink<xAOD::L2IsoMuonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::L2IsoMuonContainer_v1> >" /> - - <class name="ElementLink<xAOD::L2IsoMuonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::L2IsoMuonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::L2IsoMuonContainer_v1> > >" /> - - <!-- L2CombinedMuon --> - <class name="xAOD::L2CombinedMuon_v1" /> - - <class name="xAOD::L2CombinedMuonContainer_v1" - id="91ECD1FA-3B9F-4F80-BBD1-698DCC7C9477" /> - <class name="xAOD::L2CombinedMuonAuxContainer_v1" - id="0A7A1CB4-A5D3-4447-BE1A-F4DA14D5891B" /> - - <class name="DataLink<xAOD::L2CombinedMuonContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::L2CombinedMuonContainer_v1> >" /> - - <class name="ElementLink<xAOD::L2CombinedMuonContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::L2CombinedMuonContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::L2CombinedMuonContainer_v1> > >" /> - - <read sourceClass="xAOD::L2CombinedMuonAuxContainer_v1" - targetClass="xAOD::L2CombinedMuonAuxContainer_v1" - checksum="[1033889070]" - source="std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v1> > muSATrackLink" - target="muSATrackLink" > - <![CDATA[ - muSATrackLink.clear(); - muSATrackLink.reserve (onfile.muSATrackLink.size()); - for (const ElementLink<xAOD::L2StandAloneMuonContainer_v1>& el : - onfile.muSATrackLink) - { - muSATrackLink.emplace_back (el.key(), el.index(), el.source()); - } - ]]> - </read> - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="DataVector<xAOD::IParticle>" /> - </exclusion> + <!-- xAOD::L2StandAloneMuon interface type(s). --> + <class name="xAOD::L2StandAloneMuon_v1" /> + <class name="xAOD::L2StandAloneMuonContainer_v1" + id="645BDBC3-44EE-486B-8783-96F93FA2550B" /> + <class name="xAOD::L2StandAloneMuon_v2" /> + <class name="xAOD::L2StandAloneMuonContainer_v2" + id="6B02C486-CB3B-4762-89CA-60B210FC5AAF" /> + <typedef name="xAOD::L2StandAloneMuon" /> + <typedef name="xAOD::L2StandAloneMuonContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::L2StandAloneMuonContainer_v1>" + version="[1-]" + targetClass="DataLink<xAOD::L2StandAloneMuonContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::L2StandAloneMuonContainer_v1>" + version="[1-]" + targetClass="ElementLink<xAOD::L2StandAloneMuonContainer_v2>" + source="" target="" /> + + <!-- xAOD::L2StandAloneMuon auxiliary type(s). --> + <class name="xAOD::L2StandAloneMuonAuxContainer_v1" + id="69F56941-D2B5-4C70-BFBD-605CB64A3DB8" /> + <class name="xAOD::L2StandAloneMuonAuxContainer_v2" + id="39CA616A-16BF-4CCE-8885-3D68CE7BC3B0" /> + <typedef name="xAOD::L2StandAloneMuonAuxContainer" /> + + <!-- xAOD::L2IsoMuon interface type(s). --> + <class name="xAOD::L2IsoMuon_v1" /> + <class name="xAOD::L2IsoMuonContainer_v1" + id="D3AD2358-29B9-48D1-B181-89D4DA39B5CC" /> + <typedef name="xAOD::L2IsoMuon" /> + <typedef name="xAOD::L2IsoMuonContainer" /> + + <!-- xAOD::L2IsoMuon auxiliary type(s). --> + <class name="xAOD::L2IsoMuonAuxContainer_v1" + id="09310901-41D9-49FB-A131-5AC73A9EA455" /> + <typedef name="xAOD::L2IsoMuonAuxContainer" /> + + <!-- xAOD::L2CombinedMuon interface type(s). --> + <class name="xAOD::L2CombinedMuon_v1" /> + <class name="xAOD::L2CombinedMuonContainer_v1" + id="91ECD1FA-3B9F-4F80-BBD1-698DCC7C9477" /> + <typedef name="xAOD::L2CombinedMuon" /> + <typedef name="xAOD::L2CombinedMuonContainer" /> + + <!-- xAOD::L2CombinedMuon auxiliary type(s). --> + <class name="xAOD::L2CombinedMuonAuxContainer_v1" + id="0A7A1CB4-A5D3-4447-BE1A-F4DA14D5891B" /> + <typedef name="xAOD::L2CombinedMuonAuxContainer" /> + + <read sourceClass="xAOD::L2CombinedMuonAuxContainer_v1" + targetClass="xAOD::L2CombinedMuonAuxContainer_v1" + checksum="[1033889070]" + source="std::vector<ElementLink<xAOD::L2StandAloneMuonContainer_v1> > muSATrackLink" + target="muSATrackLink" > + <![CDATA[ + muSATrackLink.clear(); + muSATrackLink.reserve (onfile.muSATrackLink.size()); + for (const ElementLink<xAOD::L2StandAloneMuonContainer_v1>& el : + onfile.muSATrackLink) + { + muSATrackLink.emplace_back (el.key(), el.index(), el.source()); + } + ]]> + </read> </lcgdict> diff --git a/Event/xAOD/xAODTrigMuon/xAODTrigMuon/xAODTrigMuonDict.h b/Event/xAOD/xAODTrigMuon/xAODTrigMuon/xAODTrigMuonDict.h index 49625d7b74ad92525356a51c31b2ed5a6f4afadd..6b7ae4fea1a8b60f83799ab35fc327b3e3a81542 100644 --- a/Event/xAOD/xAODTrigMuon/xAODTrigMuon/xAODTrigMuonDict.h +++ b/Event/xAOD/xAODTrigMuon/xAODTrigMuon/xAODTrigMuonDict.h @@ -1,73 +1,48 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTrigMuonDict.h 698126 2015-10-02 12:59:53Z mishitsu $ #ifndef XAODTRIGMUON_XAODTRIGMUONDICT_H #define XAODTRIGMUON_XAODTRIGMUONDICT_H -// Needed to successfully generate the dictionary in standalone mode: -#if defined(__GCCXML__) and not defined(EIGEN_DONT_VECTORIZE) -# define EIGEN_DONT_VECTORIZE -#endif // __GCCXML__ - -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODTrigMuon/L2StandAloneMuon.h" #include "xAODTrigMuon/L2StandAloneMuonContainer.h" -#include "xAODTrigMuon/L2IsoMuonContainer.h" -#include "xAODTrigMuon/L2CombinedMuonContainer.h" +#include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h" #include "xAODTrigMuon/versions/L2StandAloneMuon_v1.h" #include "xAODTrigMuon/versions/L2StandAloneMuonContainer_v1.h" #include "xAODTrigMuon/versions/L2StandAloneMuonAuxContainer_v1.h" #include "xAODTrigMuon/versions/L2StandAloneMuon_v2.h" #include "xAODTrigMuon/versions/L2StandAloneMuonContainer_v2.h" #include "xAODTrigMuon/versions/L2StandAloneMuonAuxContainer_v2.h" + +#include "xAODTrigMuon/L2IsoMuon.h" +#include "xAODTrigMuon/L2IsoMuonContainer.h" +#include "xAODTrigMuon/L2IsoMuonAuxContainer.h" #include "xAODTrigMuon/versions/L2IsoMuon_v1.h" #include "xAODTrigMuon/versions/L2IsoMuonContainer_v1.h" #include "xAODTrigMuon/versions/L2IsoMuonAuxContainer_v1.h" + +#include "xAODTrigMuon/L2CombinedMuon.h" +#include "xAODTrigMuon/L2CombinedMuonContainer.h" +#include "xAODTrigMuon/L2CombinedMuonAuxContainer.h" #include "xAODTrigMuon/versions/L2CombinedMuon_v1.h" #include "xAODTrigMuon/versions/L2CombinedMuonContainer_v1.h" #include "xAODTrigMuon/versions/L2CombinedMuonAuxContainer_v1.h" -namespace{ - struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGMUON { - - xAOD::L2StandAloneMuonContainer_v1 muonsa_c1; - DataLink< xAOD::L2StandAloneMuonContainer_v1 > muonsa_dl1; - std::vector< DataLink< xAOD::L2StandAloneMuonContainer_v1 > > muonsa_dl2; - ElementLink< xAOD::L2StandAloneMuonContainer_v1 > muonsa_el1; - std::vector< ElementLink< xAOD::L2StandAloneMuonContainer_v1 > > muonsa_el2; - std::vector< std::vector< ElementLink< xAOD::L2StandAloneMuonContainer_v1 > > > muonsa_el3; - - xAOD::L2StandAloneMuonContainer_v2 muonsa_c2; - DataLink< xAOD::L2StandAloneMuonContainer_v2 > muonsa_dl4; - std::vector< DataLink< xAOD::L2StandAloneMuonContainer_v2 > > muonsa_dl5; - ElementLink< xAOD::L2StandAloneMuonContainer_v2 > muonsa_el4; - std::vector< ElementLink< xAOD::L2StandAloneMuonContainer_v2 > > muonsa_el5; - std::vector< std::vector< ElementLink< xAOD::L2StandAloneMuonContainer_v2 > > > muonsa_el6; - - xAOD::L2IsoMuonContainer_v1 muoniso_c1; - DataLink< xAOD::L2IsoMuonContainer_v1 > muoniso_dl1; - std::vector< DataLink< xAOD::L2IsoMuonContainer_v1 > > muoniso_dl2; - ElementLink< xAOD::L2IsoMuonContainer_v1 > muoniso_el1; - std::vector< ElementLink< xAOD::L2IsoMuonContainer_v1 > > muoniso_el2; - std::vector< std::vector< ElementLink< xAOD::L2IsoMuonContainer_v1 > > > muoniso_el3; - - xAOD::L2CombinedMuonContainer_v1 muoncb_c1; - DataLink< xAOD::L2CombinedMuonContainer_v1 > muoncb_dl1; - std::vector< DataLink< xAOD::L2CombinedMuonContainer_v1 > > muoncb_dl2; - ElementLink< xAOD::L2CombinedMuonContainer_v1 > muoncb_el1; - std::vector< ElementLink< xAOD::L2CombinedMuonContainer_v1 > > muoncb_el2; - std::vector< std::vector< ElementLink< xAOD::L2CombinedMuonContainer_v1 > > > muoncb_el3; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGMUON { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L2StandAloneMuonContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L2StandAloneMuonContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L2IsoMuonContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L2CombinedMuonContainer_v1 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrackParticleContainer ); }; } diff --git a/Event/xAOD/xAODTrigMuonCnv/CMakeLists.txt b/Event/xAOD/xAODTrigMuonCnv/CMakeLists.txt index 308b52bd4fdfe76b29536daa9941a67046da7929..f5a08b0976a4f1fbd1898fcced17e1cba6adec77 100644 --- a/Event/xAOD/xAODTrigMuonCnv/CMakeLists.txt +++ b/Event/xAOD/xAODTrigMuonCnv/CMakeLists.txt @@ -18,14 +18,20 @@ atlas_depends_on_subdirs( PUBLIC Event/FourMomUtils Trigger/TrigEvent/TrigMuonEvent ) +atlas_add_library( xAODTrigMuonCnvLib + xAODTringMuonCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODTrigMuonCnv + LINK_LIBRARIES GaudiKernel xAODTrigMuon xAODMuon xAODTracking ) + + # Component(s) in the package: atlas_add_component( xAODTrigMuonCnv src/*.cxx src/components/*.cxx - LINK_LIBRARIES xAODMuon xAODTracking xAODTrigMuon GaudiKernel AthenaBaseComps AthenaKernel AthLinks FourMomUtils TrigMuonEvent ) + LINK_LIBRARIES xAODTrigMuonCnvLib xAODMuon xAODTracking xAODTrigMuon GaudiKernel AthenaBaseComps AthenaKernel AthLinks FourMomUtils TrigMuonEvent ) # Install files from the package: -atlas_install_headers( xAODTrigMuonCnv ) atlas_install_python_modules( python/xAODTrigMuonCnvConfig.py python/xAODTrigMuonCnvConfigDb.py ) atlas_install_joboptions( share/addEFMuonxAODCnv_jobOptions.py share/runEFMuonAODCnvAlg_topOptions.py ) diff --git a/Event/xAOD/xAODTrigRinger/CMakeLists.txt b/Event/xAOD/xAODTrigRinger/CMakeLists.txt index 7fa143bf63409fcd18f5c582defe9f252bbdf639..37a1fb37cdde2217163c64410736d1245c0efc33 100644 --- a/Event/xAOD/xAODTrigRinger/CMakeLists.txt +++ b/Event/xAOD/xAODTrigRinger/CMakeLists.txt @@ -1,33 +1,27 @@ -################################################################################ -# Package: xAODTrigRinger -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigRinger ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODCore - Event/xAOD/xAODTrigCalo ) +# Pull in the helper CMake code. +find_package( xAODUtilities ) -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTrigRinger - Root/*.cxx - PUBLIC_HEADERS xAODTrigRinger - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers AthLinks xAODCore xAODTrigCalo - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) - -atlas_add_dictionary( xAODTrigRingerDict - xAODTrigRinger/xAODTrigRingerDict.h - xAODTrigRinger/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODCore xAODTrigCalo xAODTrigRinger - EXTRA_FILES Root/dict/*.cxx ) + xAODTrigRinger/*.h xAODTrigRinger/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODTrigRinger + LINK_LIBRARIES AthContainers AthLinks xAODCore xAODTrigCalo ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigRinger/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TrigRingerRingsContainer_v1" + "xAOD::TrigRingerRingsContainer_v2" + "xAOD::TrigRNNOutputContainer_v1" + "xAOD::TrigRNNOutputContainer_v2" ) +atlas_add_dictionary( xAODTrigRingerDict + xAODTrigRinger/xAODTrigRingerDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigRinger + EXTRA_FILES Root/dict/*.cxx ) diff --git a/Event/xAOD/xAODTrigRinger/xAODTrigRinger/selection.xml b/Event/xAOD/xAODTrigRinger/xAODTrigRinger/selection.xml index 7bfd0b3c5c528a9fd32f92344e4bee016385b085..5721f57dab0b7d96cb42f9e1f8a5206577dc7d1d 100644 --- a/Event/xAOD/xAODTrigRinger/xAODTrigRinger/selection.xml +++ b/Event/xAOD/xAODTrigRinger/xAODTrigRinger/selection.xml @@ -1,64 +1,59 @@ -<!-- $Id: selection.xml $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- TrigRingerRings_v1 dictionaries: --> - <class name="xAOD::TrigRingerRings_v1" /> - <class name="xAOD::TrigRingerRingsContainer_v1" - id="AEF63C18-1B19-4861-A909-FCAF11CFBFCE" /> - <class name="xAOD::TrigRingerRingsAuxContainer_v1" - id="4016ADBB-830C-4523-97E2-D5FED349D98D" /> - - <!-- - <class name="ElementLink<xAOD::TrigRingerRingsContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigRingerRingsContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigRingerRingsContainer_v1> > >" /> - --> - - <!-- TrigRingerRings_v2 dictionaries: --> - <class name="xAOD::TrigRingerRings_v2" /> - <class name="xAOD::TrigRingerRingsContainer_v2" - id="96FADA09-FADA-4437-AC96-B02CAA5DE776" /> - <class name="xAOD::TrigRingerRingsAuxContainer_v2" - id="5C14CCCA-B46E-4E2A-97F4-A15EAACB124C"/> - - - <class name="ElementLink<xAOD::TrigRingerRingsContainer_v2>" /> - <class name="std::vector<ElementLink<xAOD::TrigRingerRingsContainer_v2> >"/> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigRingerRingsContainer_v2> > >"/> - - - <!-- TrigRNNOutput_v1 dictionaries: --> - <class name="xAOD::TrigRNNOutput_v1" /> - <class name="xAOD::TrigRNNOutputContainer_v1" - id="E96CE49C-6A88-47A0-8DA0-F1D42E0813C8" /> - <class name="xAOD::TrigRNNOutputAuxContainer_v1" - id="5090A739-C400-4322-9F91-C49441C9141F" /> - - <!-- - <class name="ElementLink<xAOD::TrigRNNOutputContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TrigRNNOutputContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigRNNOutputContainer_v1> > >" /> - --> - - <!-- TrigRNNOutput_v2 dictionaries: --> - <class name="xAOD::TrigRNNOutput_v2" /> - <class name="xAOD::TrigRNNOutputContainer_v2" - id="6410C90B-57BE-48A9-9A96-A203E4EF90F1" /> - <class name="xAOD::TrigRNNOutputAuxContainer_v2" - id="725ADE43-9D9D-4856-90C6-8DE105BE62A4" /> - - - <class name="ElementLink<xAOD::TrigRNNOutputContainer_v2>" /> - <class name="std::vector<ElementLink<xAOD::TrigRNNOutputContainer_v2> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TrigRNNOutputContainer_v2> > >" /> - - - <!-- Suppress the unwanted classes found by ROOT 6. --> - <!-- Hopefully we can remove these extra lines at one point... --> - <exclusion> - <class name="SG::IConstAuxStore" /> - <class name="DataLink<SG::IConstAuxStore>" /> - <class name="ElementLink<DataVector<xAOD::TrigEMCluster > >" /> - </exclusion> + <!-- xAOD::TrigRingerRings interface type(s). --> + <class name="xAOD::TrigRingerRings_v1" /> + <class name="xAOD::TrigRingerRingsContainer_v1" + id="AEF63C18-1B19-4861-A909-FCAF11CFBFCE" /> + <class name="xAOD::TrigRingerRings_v2" /> + <class name="xAOD::TrigRingerRingsContainer_v2" + id="96FADA09-FADA-4437-AC96-B02CAA5DE776" /> + <typedef name="xAOD::TrigRingerRings" /> + <typedef name="xAOD::TrigRingerRingsContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::TrigRingerRingsContainer_v1>" + version="[1-]" + targetClass="DataLink<xAOD::TrigRingerRingsContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::TrigRingerRingsContainer_v1>" + version="[1-]" + targetClass="ElementLink<xAOD::TrigRingerRingsContainer_v2>" + source="" target="" /> + + <!-- xAOD::TrigRingerRings auxiliary type(s). --> + <class name="xAOD::TrigRingerRingsAuxContainer_v1" + id="4016ADBB-830C-4523-97E2-D5FED349D98D" /> + <class name="xAOD::TrigRingerRingsAuxContainer_v2" + id="5C14CCCA-B46E-4E2A-97F4-A15EAACB124C"/> + <typedef name="xAOD::TrigRingerRingsAuxContainer" /> + + <!-- xAOD::TrigRNNOutput interface type(s). --> + <class name="xAOD::TrigRNNOutput_v1" /> + <class name="xAOD::TrigRNNOutputContainer_v1" + id="E96CE49C-6A88-47A0-8DA0-F1D42E0813C8" /> + <class name="xAOD::TrigRNNOutput_v2" /> + <class name="xAOD::TrigRNNOutputContainer_v2" + id="6410C90B-57BE-48A9-9A96-A203E4EF90F1" /> + <typedef name="xAOD::TrigRNNOutput" /> + <typedef name="xAOD::TrigRNNOutputContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::TrigRNNOutputContainer_v1>" version="[1-]" + targetClass="DataLink<xAOD::TrigRNNOutputContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::TrigRNNOutputContainer_v1>" + version="[1-]" + targetClass="ElementLink<xAOD::TrigRNNOutputContainer_v2>" + source="" target="" /> + + <!-- xAOD::TrigRNNOutput auxiliary type(s). --> + <class name="xAOD::TrigRNNOutputAuxContainer_v1" + id="5090A739-C400-4322-9F91-C49441C9141F" /> + <class name="xAOD::TrigRNNOutputAuxContainer_v2" + id="725ADE43-9D9D-4856-90C6-8DE105BE62A4" /> + <typedef name="xAOD::TrigRNNOutputAuxContainer" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigRinger/xAODTrigRinger/xAODTrigRingerDict.h b/Event/xAOD/xAODTrigRinger/xAODTrigRinger/xAODTrigRingerDict.h index 1ff2a2d9f7cf51d74297620588f5609c36e8400f..c570b23993656b1ef810102a56818551f3269170 100644 --- a/Event/xAOD/xAODTrigRinger/xAODTrigRinger/xAODTrigRingerDict.h +++ b/Event/xAOD/xAODTrigRinger/xAODTrigRinger/xAODTrigRingerDict.h @@ -1,81 +1,45 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef XAODTRIGRINGER_XAODTRIGRINGERDICT_H #define XAODTRIGRINGER_XAODTRIGRINGERDICT_H -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODTrigRinger/TrigRingerRings.h" #include "xAODTrigRinger/TrigRingerRingsContainer.h" -#include "xAODTrigRinger/TrigRNNOutputContainer.h" - -// version 1 +#include "xAODTrigRinger/TrigRingerRingsAuxContainer.h" #include "xAODTrigRinger/versions/TrigRingerRings_v1.h" #include "xAODTrigRinger/versions/TrigRingerRingsContainer_v1.h" #include "xAODTrigRinger/versions/TrigRingerRingsAuxContainer_v1.h" -#include "xAODTrigRinger/versions/TrigRNNOutput_v1.h" -#include "xAODTrigRinger/versions/TrigRNNOutputContainer_v1.h" -#include "xAODTrigRinger/versions/TrigRNNOutputAuxContainer_v1.h" - -// version 2 #include "xAODTrigRinger/versions/TrigRingerRings_v2.h" #include "xAODTrigRinger/versions/TrigRingerRingsContainer_v2.h" #include "xAODTrigRinger/versions/TrigRingerRingsAuxContainer_v2.h" + +#include "xAODTrigRinger/TrigRNNOutput.h" +#include "xAODTrigRinger/TrigRNNOutputContainer.h" +#include "xAODTrigRinger/TrigRNNOutputAuxContainer.h" +#include "xAODTrigRinger/versions/TrigRNNOutput_v1.h" +#include "xAODTrigRinger/versions/TrigRNNOutputContainer_v1.h" +#include "xAODTrigRinger/versions/TrigRNNOutputAuxContainer_v1.h" #include "xAODTrigRinger/versions/TrigRNNOutput_v2.h" #include "xAODTrigRinger/versions/TrigRNNOutputContainer_v2.h" #include "xAODTrigRinger/versions/TrigRNNOutputAuxContainer_v2.h" -#include "xAODTrigCalo/TrigEMClusterContainer.h" - -// ElementLink<xAOD::*Container_v1> compiling in the dictionary. The CLID -/// is not needed in the "real" code, since users are never exposed to the _v1 -/// classes in Athena anymore. -//#include "xAODCore/CLASS_DEF.h" -//CLASS_DEF( xAOD::TrigRingerRingsContainer_v1 , 1337532868 , 10 ) -//CLASS_DEF( xAOD::TrigRNNOutputContainer_v1 , 1103699247 , 10 ) - - -namespace{ - - struct GCCXML_DUMMY_INSTANTIATION_XAODRINGERRINGS { - - // version 1 - xAOD::TrigRingerRingsContainer_v1 c3; - ElementLink< xAOD::TrigRingerRingsContainer_v1 > a1; - std::vector< ElementLink< xAOD::TrigRingerRingsContainer_v1 > > a3; - std::vector< std::vector< ElementLink< xAOD::TrigRingerRingsContainer_v1 > > > a4; - - xAOD::TrigRNNOutputContainer_v1 c4; - ElementLink< xAOD::TrigRNNOutputContainer_v1 > b1; - std::vector< ElementLink< xAOD::TrigRNNOutputContainer_v1 > > b3; - std::vector< std::vector< ElementLink< xAOD::TrigRNNOutputContainer_v1 > > > b4; - - // version 2 - xAOD::TrigRingerRingsContainer_v2 v2_c3; - ElementLink< xAOD::TrigRingerRingsContainer_v2 > v2_a1; - std::vector< ElementLink< xAOD::TrigRingerRingsContainer_v2 > > v2_a3; - std::vector< std::vector< ElementLink< xAOD::TrigRingerRingsContainer_v2 > > > v2_a4; - - xAOD::TrigRNNOutputContainer_v2 v2_c4; - ElementLink< xAOD::TrigRNNOutputContainer_v2 > v2_b1; - std::vector< ElementLink< xAOD::TrigRNNOutputContainer_v2 > > v2_b3; - std::vector< std::vector< ElementLink< xAOD::TrigRNNOutputContainer_v2 > > > v2_b4; - - // Declarations needed in order to generate the dictionaries of the - // auxiliary containers correctly: - ElementLink< xAOD::TrigEMClusterContainer > dummy1; - std::vector< ElementLink< xAOD::TrigEMClusterContainer > > dummy2; - - }; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODRINGERRINGS { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigRingerRingsContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigRingerRingsContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigRNNOutputContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigRNNOutputContainer_v2 ); + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigEMClusterContainer ); + }; } -#endif // +#endif // XAODTRIGRINGER_XAODTRIGRINGERDICT_H diff --git a/Event/xAOD/xAODTrigger/CMakeLists.txt b/Event/xAOD/xAODTrigger/CMakeLists.txt index 5f0b72e796662982aa060d2399159828708bc237..73487f2ce92cb27943d88d0875a150e05d88f81a 100644 --- a/Event/xAOD/xAODTrigger/CMakeLists.txt +++ b/Event/xAOD/xAODTrigger/CMakeLists.txt @@ -1,38 +1,41 @@ -################################################################################ -# Package: xAODTrigger -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTrigger ) -# Extra dependencies, based on what environment we're in: +# Extra dependencies, based on what environment we're in. +set( extra_libs ) if( NOT XAOD_STANDALONE ) - set( extra_deps Control/AthenaKernel ) set( extra_libs AthenaKernel ) endif() -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthContainersInterfaces - Control/AthLinks - Event/xAOD/xAODCore - Event/xAOD/xAODBase - Trigger/TrigEvent/TrigNavStructure - ${extra_deps} ) - -# Component(s) in the package: +# Pull in the helper CMake code. +find_package( xAODUtilities ) + +# Component(s) in the package. atlas_add_library( xAODTrigger xAODTrigger/*.h xAODTrigger/versions/*.h xAODTrigger/versions/*.icc Root/*.cxx PUBLIC_HEADERS xAODTrigger - LINK_LIBRARIES AthContainers AthLinks xAODCore xAODBase TrigNavStructure ${extra_libs} ) + LINK_LIBRARIES AthContainers AthLinks xAODCore xAODBase TrigNavStructure + ${extra_libs} ) + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTrigger/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::MuonRoIContainer_v1" "xAOD::JetRoIContainer_v1" + "xAOD::JetRoIContainer_v2" "xAOD::EmTauRoIContainer_v1" + "xAOD::EmTauRoIContainer_v2" "xAOD::TriggerMenuContainer_v1" + "xAOD::TrigCompositeContainer_v1" "xAOD::BunchConfContainer_v1" + "xAOD::TrigPassBitsContainer_v1" + OBJECTS "xAOD::EnergySumRoI_v1" "xAOD::EnergySumRoI_v2" + "xAOD::TrigDecision_v1" "xAOD::TrigNavigation_v1" + "xAOD::RoiDescriptorStore_v1" ) atlas_add_dictionary( xAODTriggerDict xAODTrigger/xAODTriggerDict.h - xAODTrigger/selection.xml - LINK_LIBRARIES xAODTrigger + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTrigger EXTRA_FILES Root/dict/*.cxx ) atlas_add_test( ut_xaodtrigger_bytestreamauxcontainer_v1_test diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml b/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml index a336d26549c40ab88c901f80d273464d24d46d90..d316db7bfc34bcecf06ead33a906285e5e1ae57e 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml +++ b/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml @@ -1,7 +1,7 @@ -<!-- $Id: selection.xml 743093 2016-04-26 21:46:56Z watsona $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <!-- The byte stream auxiliary container, v1: --> + <!-- xAOD::ByteStreamAuxContainer type(s). --> <class name="xAOD::ByteStreamAuxContainer_v1" > <field name="m_auxids" transient="true" /> <field name="m_staticVecs" transient="true" /> @@ -20,119 +20,169 @@ ]]> </read> - <!-- Types used by ByteStreamAuxContainer_v1 internally: --> - <class name="std::map<std::string,std::vector<int> >" /> - <class name="std::map<std::string,std::vector<float> >" /> - <class name="std::map<std::string,std::vector<std::vector<int> > >" /> - <class name="std::map<std::string,std::vector<std::vector<float> > >" /> - - <!-- Types used by Signature and Sequence info in TriggerMenuAuxContainer_v1 --> - <class name="std::vector<std::vector<std::vector<std::string> > >" /> - <class name="std::vector<std::vector<std::vector<uint32_t> > >" /> - <class name="std::vector<std::vector<std::vector<std::vector<std::string> > > >" /> - - <!-- RoI dictionaries: --> + <!-- xAOD::MuonRoI interface type(s). --> <class name="xAOD::MuonRoI_v1" /> <class name="xAOD::MuonRoIContainer_v1" id="807F1B34-CFD5-4410-AB98-83231B551D6F" /> + <typedef name="xAOD::MuonRoI" /> + <typedef name="xAOD::MuonRoIContainer" /> + + <!-- xAOD::MuonRoI auxiliary type(s). --> <class name="xAOD::MuonRoIAuxContainer_v1" id="242CC7E8-D74C-4208-A3F6-2982628F1F8E" /> + <typedef name="xAOD::MuonRoIAuxContainer" /> + <!-- xAOD::JetRoI interface type(s). --> <class name="xAOD::JetRoI_v1" /> <class name="xAOD::JetRoIContainer_v1" id="ED39F230-5E9A-11E3-9563-02163E00A725" /> - <class name="xAOD::JetRoIAuxContainer_v1" - id="64C2E2A4-5E9A-11E3-BEF2-02163E00A725" /> - <class name="xAOD::JetRoI_v2" /> <class name="xAOD::JetRoIContainer_v2" id="8F9A76C9-2083-4774-A0EE-FB585930B664" /> + <typedef name="xAOD::JetRoI" /> + <typedef name="xAOD::JetRoIContainer" /> + + <!-- xAOD::JetRoI auxiliary type(s). --> + <class name="xAOD::JetRoIAuxContainer_v1" + id="64C2E2A4-5E9A-11E3-BEF2-02163E00A725" /> <class name="xAOD::JetRoIAuxContainer_v2" id="8448ECAF-10E0-4E8B-9E67-3A00FEA36317" /> - + <typedef name="xAOD::JetRoIAuxContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::JetRoIContainer_v1>" version="[1-]" + targetClass="DataLink<xAOD::JetRoIContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::JetRoIContainer_v1>" version="[1-]" + targetClass="ElementLink<xAOD::JetRoIContainer_v2>" + source="" target="" /> + + <!-- xAOD::EmTauRoI interface type(s). --> <class name="xAOD::EmTauRoI_v1" /> <class name="xAOD::EmTauRoIContainer_v1" id="101CD1EE-5EA2-11E3-895D-02163E00A743" /> - <class name="xAOD::EmTauRoIAuxContainer_v1" - id="1825AE7E-5EA2-11E3-A41F-02163E00A743" /> - <class name="xAOD::EmTauRoI_v2" /> <class name="xAOD::EmTauRoIContainer_v2" id="6AB862C4-31E6-4F66-AAE8-56BA01E350F2" /> + <typedef name="xAOD::EmTauRoI" /> + <typedef name="xAOD::EmTauRoIContainer" /> + + <!-- xAOD::EmTauRoI auxiliary type(s). --> + <class name="xAOD::EmTauRoIAuxContainer_v1" + id="1825AE7E-5EA2-11E3-A41F-02163E00A743" /> <class name="xAOD::EmTauRoIAuxContainer_v2" id="74EA3AFB-B7BE-4E4B-AD5D-4297CA6EDBCD" /> - + <typedef name="xAOD::EmTauRoIAuxContainer" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::EmTauRoIContainer_v1>" version="[1-]" + targetClass="DataLink<xAOD::EmTauRoIContainer_v2>" + source="" target="" /> + <read sourceClass="ElementLink<xAOD::EmTauRoIContainer_v1>" version="[1-]" + targetClass="ElementLink<xAOD::EmTauRoIContainer_v2>" + source="" target="" /> + + <!-- xAOD::JetEtRoI interface type(s). --> <class name="xAOD::JetEtRoI_v1" id="6018AD28-5EAF-11E3-9B5D-02163E00A743" /> + <typedef name="xAOD::JetEtRoI" /> + + <!-- xAOD::JetEtRoI auxiliary type(s). --> <class name="xAOD::JetEtRoIAuxInfo_v1" id="6A7C6F7A-5EAF-11E3-BFBC-02163E00A743" /> + <typedef name="xAOD::JetEtRoIAuxInfo" /> + <!-- xAOD::EnergySumRoI interface type(s). --> <class name="xAOD::EnergySumRoI_v1" id="727CB19A-5EB8-11E3-81B0-02163E00A743" /> - <class name="xAOD::EnergySumRoIAuxInfo_v1" - id="7BD71A00-5EB8-11E3-95AF-02163E00A743" /> - <class name="xAOD::EnergySumRoI_v2" id="3F26401F-25D9-4CCA-B883-57EBCEE8D299" /> + <typedef name="xAOD::EnergySumRoI" /> + + <!-- xAOD::EnergySumRoI auxiliary type(s). --> + <class name="xAOD::EnergySumRoIAuxInfo_v1" + id="7BD71A00-5EB8-11E3-95AF-02163E00A743" /> <class name="xAOD::EnergySumRoIAuxInfo_v2" id="7A0DB6D7-05F6-4D3A-9E8B-0230350E3E25" /> + <typedef name="xAOD::EnergySumRoIAuxInfo" /> + + <!-- Tell ROOT that it should automatically convert between smart pointer --> + <!-- types. --> + <read sourceClass="DataLink<xAOD::EnergySumRoI_v1>" version="[1-]" + targetClass="DataLink<xAOD::EnergySumRoI_v2>" + source="" target="" /> - <!-- TriggerMenu dictionaries: --> + <!-- xAOD::TriggerMenu interface type(s). --> <class name="xAOD::TriggerMenu_v1" /> <class name="xAOD::TriggerMenuContainer_v1" id="AA55120B-11CF-44A3-B1E4-A5AB062207B7" /> + <typedef name="xAOD::TriggerMenu" /> + <typedef name="xAOD::TriggerMenuContainer" /> + + <!-- xAOD::TriggerMenu auxiliary type(s). --> <class name="xAOD::TriggerMenuAuxContainer_v1" id="B8614CC5-8696-4170-8CCC-496DA7671246" /> + <typedef name="xAOD::TriggerMenuAuxContainer" /> - <class name="xAOD::TrigConfKeys_v1" - id="A88FD5D2-8BCB-4ADC-978C-0914D86B96B7" /> - - <!-- Extra types used by TriggerMenu: --> - <class name="std::vector<std::vector<uint16_t> >" /> - <class name="std::vector<std::vector<std::vector<uint16_t> > >" /> - - <!-- TrigDecision_v1 dictionaries: --> + <!-- xAOD::TrigDecision interface type(s). --> <class name="xAOD::TrigDecision_v1" id="092BCB2D-9630-4689-BE86-7B93466420DA" /> + <typedef name="xAOD::TrigDecision" /> + + <!-- xAOD::TrigDecision auxiliary type(s). --> <class name="xAOD::TrigDecisionAuxInfo_v1" id="F9618829-3B9C-41CB-8A87-D26B5D31CA79" /> + <typedef name="xAOD::TrigDecisionAuxInfo" /> - <!-- TrigNavigation_v1 dictionaries: --> + <!-- xAOD::TrigNavigation interface type(s). --> <class name="xAOD::TrigNavigation_v1" id="C9131CE0-C4D5-47A2-B088-D49ECE2C3C69" /> + <typedef name="xAOD::TrigNavigation" /> + + <!-- xAOD::TrigNavigation auxiliary type(s). --> <class name="xAOD::TrigNavigationAuxInfo_v1" id="924049A6-25B4-4406-A70A-CCAC2E4233E1" /> + <typedef name="xAOD::TrigNavigationAuxInfo" /> - <!-- TrigComposite_v1 dictionaries: --> + <!-- xAOD::TrigComposite interface type(s). --> <class name="xAOD::TrigComposite_v1" /> <class name="xAOD::TrigCompositeContainer_v1" id="3CB1DCCD-2B78-4E15-AC09-D75B228A29AA" /> + <typedef name="xAOD::TrigComposite" /> + <typedef name="xAOD::TrigCompositeContainer" /> + + <!-- xAOD::TrigComposite auxiliary type(s). --> <class name="xAOD::TrigCompositeAuxContainer_v1" id="171EB8B8-A777-47D9-94A9-33B2482E2AAF" /> - - <!-- TrigComposite_v2 dictionaries: --> <class name="xAOD::TrigCompositeAuxContainer_v2" id="3174A8A0-7EA2-436D-93FC-0D058BE99B09" /> + <typedef name="xAOD::TrigCompositeAuxContainer" /> - <!-- RoiDescriptorStore_v1 dictionaries: --> + <!-- xAOD::RoiDescriptorStore interface type(s). --> <class name="xAOD::RoiDescriptorStore_v1" id="882822c8-906a-11e5-87f4-02163e010d8c" /> + <typedef name="xAOD::RoiDescriptorStore" /> + + <!-- xAOD::RoiDescriptorStore auxiliary type(s). --> <class name="xAOD::RoiDescriptorStoreAuxInfo_v1" id="8aa7eae2-906a-11e5-a100-02163e010d8c" /> + <typedef name="xAOD::RoiDescriptorStoreAuxInfo" /> - <!-- Extra types used by TrigComposite: --> - <class name="std::vector<std::vector<std::string> >" /> - - <!-- Bunch configuration dictionaries: --> + <!-- xAOD::BunchConf interface type(s). --> <class name="xAOD::BunchConf_v1" /> <class name="xAOD::BunchConfContainer_v1" id="07B1BB98-24EE-4EA3-B0D5-ECB2B0A3CB65" /> + <typedef name="xAOD::BunchConf" /> + <typedef name="xAOD::BunchConfContainer" /> + + <!-- xAOD::BunchConf auxiliary type(s). --> <class name="xAOD::BunchConfAuxContainer_v1" id="29CFA84E-5C7C-4AAD-8FB5-F5EB9AF93423" /> - <class name="xAOD::BunchConfKey_v1" - id="B7FA1A14-95A4-4852-813E-CB2271906060" /> + <typedef name="xAOD::BunchConfAuxContainer" /> - <!-- TrigPassBits dictionaries: --> + <!-- xAOD::TrigPassBits interface type(s). --> <class name="xAOD::TrigPassBits_v1" > <field name="m_container" transient="true" /> </class> @@ -145,7 +195,18 @@ </read> <class name="xAOD::TrigPassBitsContainer_v1" id="7B5DF7FF-2043-414E-BEDC-2BB0AB518AF7" /> + <typedef name="xAOD::TrigPassBits" /> + <typedef name="xAOD::TrigPassBitsContainer" /> + + <!-- xAOD::TrigPassBits auxiliary type(s). --> <class name="xAOD::TrigPassBitsAuxContainer_v1" id="AD293D04-8D40-4704-B945-04283172D035" /> + <typedef name="xAOD::TrigPassBitsAuxContainer" /> + + <!-- Key type(s). --> + <class name="xAOD::TrigConfKeys_v1" + id="A88FD5D2-8BCB-4ADC-978C-0914D86B96B7" /> + <class name="xAOD::BunchConfKey_v1" + id="B7FA1A14-95A4-4852-813E-CB2271906060" /> </lcgdict> diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h b/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h index 6ce42c1839a9c1a88cfda109e3c8e1260f130a4d..5b5127c252347499f3700279dd848a66e4cd9c38 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h @@ -1,149 +1,128 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTriggerDict.h 743093 2016-04-26 21:46:56Z watsona $ #ifndef XAODTRIGGER_XAODTRIGGERDICT_H #define XAODTRIGGER_XAODTRIGGERDICT_H -// STL include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" -#include "AthLinks/ElementLinkVector.h" - -// Local include(s): +// Local include(s). #include "xAODTrigger/versions/ByteStreamAuxContainer_v1.h" +#include "xAODTrigger/TriggerMenu.h" +#include "xAODTrigger/TriggerMenuContainer.h" +#include "xAODTrigger/TriggerMenuAuxContainer.h" #include "xAODTrigger/versions/TriggerMenu_v1.h" #include "xAODTrigger/versions/TriggerMenuContainer_v1.h" #include "xAODTrigger/versions/TriggerMenuAuxContainer_v1.h" +#include "xAODTrigger/MuonRoI.h" +#include "xAODTrigger/MuonRoIContainer.h" +#include "xAODTrigger/MuonRoIAuxContainer.h" +#include "xAODTrigger/versions/MuonRoI_v1.h" #include "xAODTrigger/versions/MuonRoIContainer_v1.h" #include "xAODTrigger/versions/MuonRoIAuxContainer_v1.h" -#include "xAODTrigger/versions/MuonRoI_v1.h" +#include "xAODTrigger/JetRoI.h" +#include "xAODTrigger/JetRoIContainer.h" +#include "xAODTrigger/JetRoIAuxContainer.h" +#include "xAODTrigger/versions/JetRoI_v1.h" #include "xAODTrigger/versions/JetRoIContainer_v1.h" #include "xAODTrigger/versions/JetRoIAuxContainer_v1.h" -#include "xAODTrigger/versions/JetRoI_v1.h" - +#include "xAODTrigger/versions/JetRoI_v2.h" #include "xAODTrigger/versions/JetRoIContainer_v2.h" #include "xAODTrigger/versions/JetRoIAuxContainer_v2.h" -#include "xAODTrigger/versions/JetRoI_v2.h" +#include "xAODTrigger/EmTauRoI.h" +#include "xAODTrigger/EmTauRoIContainer.h" +#include "xAODTrigger/EmTauRoIAuxContainer.h" +#include "xAODTrigger/versions/EmTauRoI_v1.h" #include "xAODTrigger/versions/EmTauRoIContainer_v1.h" #include "xAODTrigger/versions/EmTauRoIAuxContainer_v1.h" -#include "xAODTrigger/versions/EmTauRoI_v1.h" - +#include "xAODTrigger/versions/EmTauRoI_v2.h" #include "xAODTrigger/versions/EmTauRoIContainer_v2.h" #include "xAODTrigger/versions/EmTauRoIAuxContainer_v2.h" -#include "xAODTrigger/versions/EmTauRoI_v2.h" -#include "xAODTrigger/versions/JetEtRoIAuxInfo_v1.h" +#include "xAODTrigger/JetEtRoI.h" +#include "xAODTrigger/JetEtRoIAuxInfo.h" #include "xAODTrigger/versions/JetEtRoI_v1.h" +#include "xAODTrigger/versions/JetEtRoIAuxInfo_v1.h" -#include "xAODTrigger/versions/EnergySumRoIAuxInfo_v2.h" -#include "xAODTrigger/versions/EnergySumRoI_v2.h" - -#include "xAODTrigger/versions/EnergySumRoIAuxInfo_v1.h" +#include "xAODTrigger/EnergySumRoI.h" +#include "xAODTrigger/EnergySumRoIAuxInfo.h" #include "xAODTrigger/versions/EnergySumRoI_v1.h" - -#include "xAODTrigger/versions/EnergySumRoIAuxInfo_v2.h" +#include "xAODTrigger/versions/EnergySumRoIAuxInfo_v1.h" #include "xAODTrigger/versions/EnergySumRoI_v2.h" +#include "xAODTrigger/versions/EnergySumRoIAuxInfo_v2.h" +#include "xAODTrigger/TrigDecision.h" +#include "xAODTrigger/TrigDecisionAuxInfo.h" #include "xAODTrigger/versions/TrigDecision_v1.h" #include "xAODTrigger/versions/TrigDecisionAuxInfo_v1.h" +#include "xAODTrigger/TrigNavigation.h" +#include "xAODTrigger/TrigNavigationAuxInfo.h" #include "xAODTrigger/versions/TrigNavigation_v1.h" #include "xAODTrigger/versions/TrigNavigationAuxInfo_v1.h" +#include "xAODTrigger/TrigConfKeys.h" #include "xAODTrigger/versions/TrigConfKeys_v1.h" +#include "xAODTrigger/TrigComposite.h" +#include "xAODTrigger/TrigCompositeContainer.h" +#include "xAODTrigger/TrigCompositeAuxContainer.h" #include "xAODTrigger/versions/TrigComposite_v1.h" #include "xAODTrigger/versions/TrigCompositeContainer_v1.h" #include "xAODTrigger/versions/TrigCompositeAuxContainer_v1.h" #include "xAODTrigger/versions/TrigCompositeAuxContainer_v2.h" +#include "xAODTrigger/BunchConfKey.h" #include "xAODTrigger/versions/BunchConfKey_v1.h" + +#include "xAODTrigger/BunchConf.h" +#include "xAODTrigger/BunchConfContainer.h" +#include "xAODTrigger/BunchConfAuxContainer.h" +#include "xAODTrigger/versions/BunchConf_v1.h" #include "xAODTrigger/versions/BunchConfContainer_v1.h" #include "xAODTrigger/versions/BunchConfAuxContainer_v1.h" +#include "xAODTrigger/TrigPassBits.h" +#include "xAODTrigger/TrigPassBitsContainer.h" +#include "xAODTrigger/TrigPassBitsAuxContainer.h" #include "xAODTrigger/versions/TrigPassBits_v1.h" #include "xAODTrigger/versions/TrigPassBitsContainer_v1.h" #include "xAODTrigger/versions/TrigPassBitsAuxContainer_v1.h" +#include "xAODTrigger/RoiDescriptorStore.h" +#include "xAODTrigger/RoiDescriptorStoreAuxInfo.h" #include "xAODTrigger/versions/RoiDescriptorStore_v1.h" #include "xAODTrigger/versions/RoiDescriptorStoreAuxInfo_v1.h" -namespace{ - struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGGER { - - xAOD::MuonRoIContainer_v1 muon_c1; - DataLink< xAOD::MuonRoIContainer_v1 > muon_l1; - ElementLink< xAOD::MuonRoIContainer_v1 > muon_l2; - ElementLinkVector< xAOD::MuonRoIContainer_v1 > muon_l3; - std::vector< DataLink<xAOD::MuonRoIContainer_v1 > > muon_l4; - std::vector< ElementLink<xAOD::MuonRoIContainer_v1 > > muon_l5; - std::vector< ElementLinkVector< xAOD::MuonRoIContainer_v1 > > muon_l6; - - xAOD::JetRoIContainer_v1 jet_c1; - DataLink< xAOD::JetRoIContainer_v1 > jet_l1; - ElementLink< xAOD::JetRoIContainer_v1 > jet_l2; - ElementLinkVector< xAOD::JetRoIContainer_v1 > jet_l3; - std::vector< DataLink<xAOD::JetRoIContainer_v1 > > jet_l4; - std::vector< ElementLink<xAOD::JetRoIContainer_v1 > > jet_l5; - std::vector< ElementLinkVector< xAOD::JetRoIContainer_v1 > > jet_l6; - - xAOD::JetRoIContainer_v2 jet_v2_c1; - DataLink< xAOD::JetRoIContainer_v2 > jet_v2_l1; - ElementLink< xAOD::JetRoIContainer_v2 > jet_v2_l2; - ElementLinkVector< xAOD::JetRoIContainer_v2 > jet_v2_l3; - std::vector< DataLink<xAOD::JetRoIContainer_v2 > > jet_v2_l4; - std::vector< ElementLink<xAOD::JetRoIContainer_v2 > > jet_v2_l5; - std::vector< ElementLinkVector< xAOD::JetRoIContainer_v2 > > jet_v2_l6; - - xAOD::EmTauRoIContainer_v1 emtau_c1; - DataLink< xAOD::EmTauRoIContainer_v1 > emtau_l1; - ElementLink< xAOD::EmTauRoIContainer_v1 > emtau_l2; - ElementLinkVector< xAOD::EmTauRoIContainer_v1 > emtau_l3; - std::vector< DataLink<xAOD::EmTauRoIContainer_v1 > > emtau_l4; - std::vector< ElementLink<xAOD::EmTauRoIContainer_v1 > > emtau_l5; - std::vector< ElementLinkVector< xAOD::EmTauRoIContainer_v1 > > emtau_l6; - - xAOD::EmTauRoIContainer_v2 emtau_v2_c1; - DataLink< xAOD::EmTauRoIContainer_v2 > emtau_v2_l1; - ElementLink< xAOD::EmTauRoIContainer_v2 > emtau_v2_l2; - ElementLinkVector< xAOD::EmTauRoIContainer_v2 > emtau_v2_l3; - std::vector< DataLink<xAOD::EmTauRoIContainer_v2 > > emtau_v2_l4; - std::vector< ElementLink<xAOD::EmTauRoIContainer_v2 > > emtau_v2_l5; - std::vector< ElementLinkVector< xAOD::EmTauRoIContainer_v2 > > emtau_v2_l6; - - DataLink< xAOD::JetEtRoI_v1 > jetEt_l1; - std::vector< DataLink< xAOD::JetEtRoI_v1 > > jetEt_l2; - - DataLink< xAOD::EnergySumRoI_v1 > esum_l1; - std::vector< DataLink< xAOD::EnergySumRoI_v1 > > esum_l2; - - DataLink< xAOD::EnergySumRoI_v2 > esum_v2_l1; - std::vector< DataLink< xAOD::EnergySumRoI_v2 > > esum_v2_l2; - - xAOD::TriggerMenuContainer_v1 c2; - - xAOD::TrigCompositeContainer_v1 comp_c1; - - xAOD::BunchConfContainer_v1 c5; - - xAOD::TrigPassBitsContainer_v1 pb_c1; - DataLink< xAOD::TrigPassBitsContainer_v1 > pb_l1; - ElementLink< xAOD::TrigPassBitsContainer_v1 > pb_l2; - std::vector< DataLink< xAOD::TrigPassBitsContainer_v1 > > pb_l3; - std::vector< ElementLink< xAOD::TrigPassBitsContainer_v1 > > pb_l4; - - }; +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. +namespace { + struct GCCXML_DUMMY_INSTANTIATION_XAODTRIGGER { + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TriggerMenuContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, BunchConfContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, MuonRoIContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetRoIContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, JetRoIContainer_v2 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, EmTauRoIContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, EmTauRoIContainer_v2 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigCompositeContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigPassBitsContainer_v1 ); + + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, JetEtRoI_v1 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, EnergySumRoI_v1 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, EnergySumRoI_v2 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, TrigDecision_v1 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, TrigNavigation_v1 ); + XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, RoiDescriptorStore_v1 ); + }; } #endif // XAODTRIGGER_XAODTRIGGERDICT_H diff --git a/Event/xAOD/xAODTriggerAthenaPool/src/xAODTrigNavigationAuxInfoCnv.cxx b/Event/xAOD/xAODTriggerAthenaPool/src/xAODTrigNavigationAuxInfoCnv.cxx index f06503813e72388afd62a3d4aac3ba65ab4a8337..d18aefe32fc135247bcdebf639066ae39f48434c 100644 --- a/Event/xAOD/xAODTriggerAthenaPool/src/xAODTrigNavigationAuxInfoCnv.cxx +++ b/Event/xAOD/xAODTriggerAthenaPool/src/xAODTrigNavigationAuxInfoCnv.cxx @@ -7,9 +7,6 @@ // System include(s): #include <stdexcept> -// Core include(s): -#include "AthenaKernel/IThinningSvc.h" - #ifndef XAOD_ANALYSIS #include "AthenaKernel/ITrigNavigationThinningSvc.h" //thinning only possible in full athena #include "AthenaKernel/getThinningCache.h" @@ -37,17 +34,13 @@ xAODTrigNavigationAuxInfoCnv:: createPersistentWithKey( xAOD::TrigNavigationAuxInfo* trans, const std::string& /*key*/) { - // see if the ThinningSvc implements an interface capable of slimming the navation xAOD::TrigNavigationAuxInfo* result = new xAOD::TrigNavigationAuxInfo(); #ifndef XAOD_ANALYSIS const ITrigNavigationThinningSvc* thinningSvc = nullptr; + // Try to find the thinning service. if (const SG::ThinningCache* cache = SG::getThinningCache()) { thinningSvc = cache->trigNavigationThinningSvc(); } - if (!thinningSvc) { - thinningSvc = - dynamic_cast<const ITrigNavigationThinningSvc*>(IThinningSvc::instance()); - } if ( thinningSvc ) { ATH_MSG_DEBUG("Doing TrigNavigation slimming"); xAOD::TrigNavigation wrapper; diff --git a/Event/xAOD/xAODTruth/CMakeLists.txt b/Event/xAOD/xAODTruth/CMakeLists.txt index f7804228e3abbcaa96e09f76c36b70b78bd2dc1d..04c964d808232dc71569687cd1a62fcc07e74538 100644 --- a/Event/xAOD/xAODTruth/CMakeLists.txt +++ b/Event/xAOD/xAODTruth/CMakeLists.txt @@ -1,42 +1,37 @@ -# $Id: CMakeLists.txt 761796 2016-07-14 08:06:02Z krasznaa $ -################################################################################ -# Package: xAODTruth -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( xAODTruth ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthLinks - Event/xAOD/xAODBase - Event/xAOD/xAODCore - PRIVATE - Generators/TruthUtils ) - -# External dependencies: +# External dependencies. find_package( ROOT COMPONENTS Core GenVector ) +find_package( xAODUtilities ) -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( xAODTruth xAODTruth/*.h xAODTruth/versions/*.h Root/*.h Root/*.cxx PUBLIC_HEADERS xAODTruth - LINK_LIBRARIES AthContainers AthLinks xAODBase xAODCore + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks xAODBase xAODCore PRIVATE_LINK_LIBRARIES TruthUtils ) +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODTruth/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::TruthParticleContainer_v1" "xAOD::TruthVertexContainer_v1" + "xAOD::TruthEventBaseContainer_v1" "xAOD::TruthEventContainer_v1" + "xAOD::TruthPileupEventContainer_v1" + "xAOD::TruthMetaDataContainer_v1" ) + atlas_add_dictionary( xAODTruthDict xAODTruth/xAODTruthDict.h - xAODTruth/selection.xml - LINK_LIBRARIES xAODTruth + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODTruth EXTRA_FILES Root/dict/*.cxx ) - - atlas_generate_cliddb( xAODTruth ) -# Test(s) in the package: +# Test(s) in the package. atlas_add_test( ut_xaodtruth_particle_test SOURCES test/ut_xaodtruth_particle_test.cxx LINK_LIBRARIES xAODTruth ) diff --git a/Event/xAOD/xAODTruth/xAODTruth/selection.xml b/Event/xAOD/xAODTruth/xAODTruth/selection.xml index e051ef8fb0f866f65462af97a4e1f519411a35bf..1daa1f2c4d8cf341bb9d7d5ca0f527d14fcbae10 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/selection.xml +++ b/Event/xAOD/xAODTruth/xAODTruth/selection.xml @@ -1,75 +1,72 @@ -<!-- $Id: selection.xml 670153 2015-05-27 11:42:29Z tbisanz $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> - <typedef name="xAOD::TruthParticle" /> - <typedef name="xAOD::TruthVertex" /> - <typedef name="xAOD::TruthEvent" /> + <!-- xAOD::TruthParticle interface type(s). --> + <class name="xAOD::TruthParticle_v1" /> + <class name="xAOD::TruthParticle_v1::Polarization" /> + <class name="xAOD::TruthParticleContainer_v1" + id="58F98A16-E465-4CA5-A099-73033206D8E3" /> + <typedef name="xAOD::TruthParticle" /> + <typedef name="xAOD::TruthParticleContainer" /> - <typedef name="xAOD::TruthParticleContainer" /> - <typedef name="xAOD::TruthVertexContainer" /> - <typedef name="xAOD::TruthEventContainer" /> + <!-- xAOD::TruthParticle auxiliary type(s). --> + <class name="xAOD::TruthParticleAuxContainer_v1" + id="BA8FA08F-8DD6-420D-97D5-8B54EABECD65" /> + <typedef name="xAOD::TruthParticleAuxContainer" /> - <typedef name="xAOD::TruthParticleAuxContainer" /> - <typedef name="xAOD::TruthVertexAuxContainer" /> - <typedef name="xAOD::TruthEventAuxContainer" /> + <!-- xAOD::TruthVertex interface type(s). --> + <class name="xAOD::TruthVertex_v1" /> + <class name="xAOD::TruthVertexContainer_v1" + id="5FBAE0AB-09F7-4B6C-B066-0A003FC38ECF" /> + <typedef name="xAOD::TruthVertex" /> + <typedef name="xAOD::TruthVertexContainer" /> - <typedef name="xAOD::TruthMetaData" /> - <typedef name="xAOD::TruthMetaDataContainer" /> + <!-- xAOD::TruthVertex auxiliary type(s). --> + <class name="xAOD::TruthVertexAuxContainer_v1" + id="B6BD3B02-C411-4EB9-903F-5B099D3B1A3E" /> + <typedef name="xAOD::TruthVertexAuxContainer" /> + <!-- xAOD::TruthEvent interface type(s). --> + <class name="xAOD::TruthEventBase_v1" /> + <class name="xAOD::TruthEventBaseContainer_v1" /> + <typedef name="xAOD::TruthEventBase" /> + <typedef name="xAOD::TruthEventBaseContainer" /> - <!-- The TruthParticle_v1 class(es): --> - <class name="xAOD::TruthParticle_v1" /> - <class name="xAOD::TruthParticle_v1::Polarization" /> + <class name="xAOD::TruthEvent_v1" /> + <class name="xAOD::TruthEvent_v1::PdfInfo" /> + <class name="xAOD::TruthEventContainer_v1" + id="6290F297-F529-40EE-9FE5-1C577678306D" /> + <typedef name="xAOD::TruthEvent" /> + <typedef name="xAOD::TruthEventContainer" /> - <!-- The TruthVertex_v1 class: --> - <class name="xAOD::TruthVertex_v1" /> + <class name="xAOD::TruthPileupEvent_v1" /> + <class name="xAOD::TruthPileupEventContainer_v1" + id="05ECB16C-A36F-4853-8BB7-C9E7A84B4677" /> + <typedef name="xAOD::TruthPileupEvent" /> + <typedef name="xAOD::TruthPileupEventContainer" /> - <!-- The TruthEvent_v1 class(es): --> - <class name="xAOD::TruthEventBase_v1" /> - <class name="xAOD::TruthEventBaseContainer_v1" /> - <class name="xAOD::TruthEvent_v1" /> - <class name="xAOD::TruthPileupEvent_v1" /> - <class name="xAOD::TruthEvent_v1::PdfInfo" /> - <class name="xAOD::TruthMetaData_v1" /> + <!-- xAOD::TruthEvent auxiliary type(s). --> + <class name="xAOD::TruthEventAuxContainer_v1" + id="1B945EFD-4F7D-4BDD-9FB1-6FB975315961" /> + <typedef name="xAOD::TruthEventAuxContainer" /> - <!-- The persistent classes: --> - <class name="xAOD::TruthParticleContainer_v1" - id="58F98A16-E465-4CA5-A099-73033206D8E3" /> - <class name="xAOD::TruthVertexContainer_v1" - id="5FBAE0AB-09F7-4B6C-B066-0A003FC38ECF" /> - <class name="xAOD::TruthEventContainer_v1" - id="6290F297-F529-40EE-9FE5-1C577678306D" /> - <class name="xAOD::TruthPileupEventContainer_v1" - id="05ECB16C-A36F-4853-8BB7-C9E7A84B4677" /> - <class name="xAOD::TruthMetaDataContainer_v1" - id="754BDA89-C0D9-43BF-B468-32E10C1690FE" /> + <class name="xAOD::TruthPileupEventAuxContainer_v1" + id="9E9DD653-247C-4D5E-B14C-538EADEA6CD2" /> + <typedef name="xAOD::TruthPileupEventAuxContainer" /> - <class name="xAOD::TruthParticleAuxContainer_v1" - id="BA8FA08F-8DD6-420D-97D5-8B54EABECD65" /> - <class name="xAOD::TruthVertexAuxContainer_v1" - id="B6BD3B02-C411-4EB9-903F-5B099D3B1A3E" /> - <class name="xAOD::TruthEventAuxContainer_v1" - id="1B945EFD-4F7D-4BDD-9FB1-6FB975315961" /> - <class name="xAOD::TruthPileupEventAuxContainer_v1" - id="9E9DD653-247C-4D5E-B14C-538EADEA6CD2" /> - <class name="xAOD::TruthMetaDataAuxContainer_v1" - id="E2EF5F89-DFFA-4225-823E-29E40130A7B2" /> + <!-- xAOD::TruthMetaData interface type(s). --> + <class name="xAOD::TruthMetaData_v1" /> + <class name="xAOD::TruthMetaDataContainer_v1" + id="754BDA89-C0D9-43BF-B468-32E10C1690FE" /> + <typedef name="xAOD::TruthMetaData" /> + <typedef name="xAOD::TruthMetaDataContainer" /> - <!-- Smart pointers for TruthParticle_v1: --> - <class name="DataLink<xAOD::TruthParticleContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TruthParticleContainer_v1> >" /> - <class name="ElementLink<xAOD::TruthParticleContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TruthParticleContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TruthParticleContainer_v1> > >" /> + <!-- xAOD::TruthMetaData auxiliary type(s). --> + <class name="xAOD::TruthMetaDataAuxContainer_v1" + id="E2EF5F89-DFFA-4225-823E-29E40130A7B2" /> + <typedef name="xAOD::TruthMetaDataAuxContainer" /> - <!-- Smart pointers for TruthVertex_v1: --> - <class name="DataLink<xAOD::TruthVertexContainer_v1>" /> - <class name="std::vector<DataLink<xAOD::TruthVertexContainer_v1> >" /> - <class name="ElementLink<xAOD::TruthVertexContainer_v1>" /> - <class name="std::vector<ElementLink<xAOD::TruthVertexContainer_v1> >" /> - <class name="std::vector<std::vector<ElementLink<xAOD::TruthVertexContainer_v1> > >" /> - - <!-- The helper functions: --> - <function pattern="xAOD::TruthHelpers::*" /> + <!-- Helper function(s). --> + <function pattern="xAOD::TruthHelpers::*" /> </lcgdict> diff --git a/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h b/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h index 43d481519f4aec026ed1e6f57df97231ae104f07..4043d664ca4d2bb8b5a47da3df4f8cc894a83cf4 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h +++ b/Event/xAOD/xAODTruth/xAODTruth/xAODTruthDict.h @@ -1,67 +1,64 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: xAODTruthDict.h 670153 2015-05-27 11:42:29Z tbisanz $ #ifndef XAODTRUTH_XAODTRUTHDICT_H #define XAODTRUTH_XAODTRUTHDICT_H -// System include(s): -#include <vector> - -// EDM include(s): -#include "AthLinks/DataLink.h" -#include "AthLinks/ElementLink.h" - -// Local include(s): +// Local include(s). +#include "xAODTruth/TruthParticle.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/versions/TruthParticle_v1.h" #include "xAODTruth/versions/TruthParticleContainer_v1.h" #include "xAODTruth/versions/TruthParticleAuxContainer_v1.h" -#include "xAODTruth/versions/TruthVertexContainer_v1.h" -#include "xAODTruth/versions/TruthVertexAuxContainer_v1.h" -#include "xAODTruth/versions/TruthEventBaseContainer_v1.h" -#include "xAODTruth/versions/TruthEventContainer_v1.h" -#include "xAODTruth/versions/TruthEventAuxContainer_v1.h" -#include "xAODTruth/versions/TruthPileupEventContainer_v1.h" -#include "xAODTruth/versions/TruthPileupEventAuxContainer_v1.h" -#include "xAODTruth/versions/TruthMetaDataContainer_v1.h" -#include "xAODTruth/versions/TruthMetaDataAuxContainer_v1.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthVertex.h" #include "xAODTruth/TruthVertexContainer.h" #include "xAODTruth/TruthVertexAuxContainer.h" +#include "xAODTruth/versions/TruthVertex_v1.h" +#include "xAODTruth/versions/TruthVertexContainer_v1.h" +#include "xAODTruth/versions/TruthVertexAuxContainer_v1.h" + +#include "xAODTruth/TruthEventBase.h" #include "xAODTruth/TruthEventBaseContainer.h" +#include "xAODTruth/TruthEvent.h" #include "xAODTruth/TruthEventContainer.h" #include "xAODTruth/TruthEventAuxContainer.h" +#include "xAODTruth/TruthPileupEvent.h" #include "xAODTruth/TruthPileupEventContainer.h" #include "xAODTruth/TruthPileupEventAuxContainer.h" +#include "xAODTruth/versions/TruthEventBase_v1.h" +#include "xAODTruth/versions/TruthEventBaseContainer_v1.h" +#include "xAODTruth/versions/TruthEvent_v1.h" +#include "xAODTruth/versions/TruthEventContainer_v1.h" +#include "xAODTruth/versions/TruthEventAuxContainer_v1.h" +#include "xAODTruth/versions/TruthPileupEvent_v1.h" +#include "xAODTruth/versions/TruthPileupEventContainer_v1.h" +#include "xAODTruth/versions/TruthPileupEventAuxContainer_v1.h" + +#include "xAODTruth/TruthMetaData.h" #include "xAODTruth/TruthMetaDataContainer.h" #include "xAODTruth/TruthMetaDataAuxContainer.h" +#include "xAODTruth/versions/TruthMetaData_v1.h" +#include "xAODTruth/versions/TruthMetaDataContainer_v1.h" +#include "xAODTruth/versions/TruthMetaDataAuxContainer_v1.h" + #include "xAODTruth/xAODTruthHelpers.h" +// EDM include(s). +#include "xAODCore/tools/DictHelpers.h" + +// Instantiate all necessary types for the dictionary. namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODTRUTH { - // The DataVector types: - xAOD::TruthParticleContainer_v1 c1; - xAOD::TruthVertexContainer_v1 c2; - xAOD::TruthEventBaseContainer_v1 c3; - xAOD::TruthEventContainer_v1 c4; - xAOD::TruthPileupEventContainer_v1 c5; - xAOD::TruthMetaDataContainer_v1 c6; - - // The smart pointer types: - DataLink< xAOD::TruthParticleContainer_v1 > dl1; - std::vector< DataLink< xAOD::TruthParticleContainer_v1 > > dl2; - DataLink< xAOD::TruthVertexContainer_v1 > dl3; - std::vector< DataLink< xAOD::TruthVertexContainer_v1 > > dl4; - ElementLink< xAOD::TruthParticleContainer_v1 > el1; - std::vector< ElementLink< xAOD::TruthParticleContainer_v1 > > el2; - std::vector< std::vector< ElementLink< xAOD::TruthParticleContainer_v1 > > > el3; - ElementLink< xAOD::TruthVertexContainer_v1 > el4; - std::vector< ElementLink< xAOD::TruthVertexContainer_v1 > > el5; - std::vector< std::vector< ElementLink< xAOD::TruthVertexContainer_v1 > > > el6; + // Local type(s). + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthParticleContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthVertexContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthEventBaseContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthEventContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthPileupEventContainer_v1 ); + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TruthMetaDataContainer_v1 ); }; } diff --git a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.cxx b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.cxx index a306fbd2a63150cc7702030ce6c7dc10cfbbe0c3..63e6a7e50bfac8b466acdcdf6e0102420597167c 100644 --- a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.cxx +++ b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.cxx @@ -54,7 +54,7 @@ StatusCode HepMCTruthReader::execute() { if (cntr>0) ATH_MSG_INFO("Printing pileup events..."); if (cntr==0) { - auto signalProcessVtx = genEvt->signal_process_vertex(); + auto signalProcessVtx = HepMC::signal_process_vertex((HepMC::GenEvent*)genEvt); ATH_MSG_INFO("Signal process vertex position: (" << (signalProcessVtx?signalProcessVtx->position().x():0) << ", " << (signalProcessVtx?signalProcessVtx->position().y():0) << ", " << (signalProcessVtx?signalProcessVtx->position().z():0) @@ -87,13 +87,13 @@ void HepMCTruthReader::printEvent(const HepMC::GenEvent* event) { // Print method for vertex - mimics the HepMC dump. // Particle print method called within here -void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) { +void HepMCTruthReader::printVertex(const HepMC::GenVertexPtr vertex) { std::ios::fmtflags f( cout.flags() ); cout << "GenVertex (" << vertex << "):"; - if (vertex->barcode() != 0) { + if (HepMC::barcode(vertex) != 0) { if (vertex->position().x() != 0.0 && vertex->position().y() != 0.0 && vertex->position().z() != 0.0) { cout.width(9); - cout << vertex->barcode(); + cout <<HepMC::barcode(vertex); cout << " ID:"; cout.width(5); cout << vertex->id(); @@ -117,7 +117,7 @@ void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) { cout << endl; } else { cout.width(9); - cout << vertex->barcode(); + cout << HepMC::barcode(vertex); cout << " ID:"; cout.width(5); cout << vertex->id(); @@ -194,11 +194,11 @@ void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) { // Print method for particle - mimics the HepMC dump. -void HepMCTruthReader::printParticle(const HepMC::GenParticle* particle) { +void HepMCTruthReader::printParticle(const HepMC::GenParticlePtr particle) { std::ios::fmtflags f( cout.flags() ); cout << " "; cout.width(9); - cout << particle->barcode(); + cout << HepMC::barcode(particle); cout.width(9); cout << particle->pdg_id() << " "; cout.width(9); @@ -218,11 +218,11 @@ void HepMCTruthReader::printParticle(const HepMC::GenParticle* particle) { cout.setf(ios::fmtflags(0), ios::floatfield); cout.unsetf(ios_base::showpos); if ( particle->has_decayed() ) { - if ( particle->end_vertex()->barcode()!=0 ) { + if ( HepMC::barcode(particle->end_vertex())!=0 ) { cout.width(3); cout << particle->status() << " "; cout.width(9); - cout << particle->end_vertex()->barcode(); + cout << HepMC::barcode(particle->end_vertex()); } } else { cout.width(3); diff --git a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h index 71e19e440fe4f5baf913847ffb51dbd2a28fd661..9d835d2015d3b748cdf237ab5fb221fe8494a8cf 100644 --- a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h +++ b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h @@ -33,8 +33,8 @@ private: std::string m_hepMCContainerName; void printEvent(const HepMC::GenEvent*); - void printVertex(const HepMC::GenVertex*); - void printParticle(const HepMC::GenParticle*); + void printVertex(const HepMC::GenVertexPtr); + void printParticle(const HepMC::GenParticlePtr); }; // class HepMCTruthReader diff --git a/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx b/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx index a6bdb3ba190839a1047ae4549d294d420ea68d04..a128cc5c62b24d9e947c929fd7a6aa0e3405c0ac 100644 --- a/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx +++ b/Event/xAOD/xAODTruthCnv/src/RedoTruthLinksAlg.cxx @@ -62,7 +62,6 @@ namespace xAODMaker { continue; } // Create link between HepMC and xAOD truth - //truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*par)->barcode(), evt->eventNumber()), par)); /// @todo AB: Truth particle links should only be made to the signal event... hence the 0. Right? truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink((*par)->barcode(), 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION), par)); } diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx index 36d2fdf9b5518270aa9fac8501565c4215342256..be134d9c472abea3952950efb5e1e2d3aca1d96d 100644 --- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx +++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx @@ -173,7 +173,7 @@ namespace xAODMaker { // https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/PileupDigitization#Arrangement_of_Truth_Information if (!m_doInTimePileUp && !m_doAllPileUp) break; isSignalProcess=false; - int pid = genEvt->signal_process_id(); + int pid = HepMC::signal_process_id(genEvt); int eventNumber = genEvt->event_number(); if (m_doInTimePileUp && pid==0 && eventNumber==-1) break; // stop at the separator } @@ -181,14 +181,11 @@ namespace xAODMaker { xAOD::TruthEvent* xTruthEvent = new xAOD::TruthEvent(); xAOD::TruthPileupEvent* xTruthPileupEvent = new xAOD::TruthPileupEvent(); - /// @todo Drop or re-enable these? Signal process can be set to DSID... preferably not to the gen-name code - //xTruthEvent->setSignalProcessId(genEvt->signal_process_id()); - //xTruthEvent->setEventNumber(genEvt->event_number()); if (isSignalProcess) { xTruthEventContainer->push_back( xTruthEvent ); // Cross-section - const HepMC::GenCrossSection* const crossSection = genEvt->cross_section(); + auto crossSection = genEvt->cross_section(); xTruthEvent->setCrossSection(crossSection ? (float)crossSection->cross_section() : -1); xTruthEvent->setCrossSectionError(crossSection ? (float)crossSection->cross_section_error() : -1); @@ -212,7 +209,7 @@ namespace xAODMaker { xTruthEvent->setWeights(weights); // Heavy ion info - const HepMC::HeavyIon* const hiInfo = genEvt->heavy_ion(); + auto const hiInfo = genEvt->heavy_ion(); if (hiInfo) { xTruthEvent->setHeavyIonParameter(hiInfo->Ncoll_hard(), xAOD::TruthEvent::NCOLLHARD); xTruthEvent->setHeavyIonParameter(hiInfo->Npart_proj(), xAOD::TruthEvent::NPARTPROJ); @@ -233,7 +230,7 @@ namespace xAODMaker { // Parton density info // This will exist 99% of the time, except for e.g. cosmic or particle gun simulation - const HepMC::PdfInfo* const pdfInfo = genEvt->pdf_info(); + auto const pdfInfo = genEvt->pdf_info(); if (pdfInfo) { xTruthEvent->setPdfInfoParameter(pdfInfo->id1(), xAOD::TruthEvent::PDGID1); xTruthEvent->setPdfInfoParameter(pdfInfo->id2(), xAOD::TruthEvent::PDGID2); @@ -255,11 +252,11 @@ namespace xAODMaker { // If signal process vertex is a disconnected vertex (no incoming/outgoing particles), add it manually VertexMap vertexMap; VertexMap::iterator mapItr; - vector<const HepMC::GenVertex*> vertices; + vector<HepMC::GenVertexPtr> vertices; // Check signal process vertex // If this is a disconnected vertex, add it manually or won't be added from the loop over particles below. - auto disconnectedSignalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex + auto disconnectedSignalProcessVtx = HepMC::signal_process_vertex((HepMC::GenEvent*)genEvt); // Get the signal process vertex if (disconnectedSignalProcessVtx) { if (disconnectedSignalProcessVtx->particles_in_size() == 0 && disconnectedSignalProcessVtx->particles_out_size() == 0 ) { @@ -271,7 +268,7 @@ namespace xAODMaker { } // Get the beam particles - pair<HepMC::GenParticle*,HepMC::GenParticle*> beamParticles; + pair<HepMC::GenParticlePtr,HepMC::GenParticlePtr> beamParticles; if ( genEvt->valid_beam_particles() ) beamParticles = genEvt->beam_particles(); for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) { // (a) create TruthParticle @@ -319,7 +316,7 @@ namespace xAODMaker { } // end of loop over particles // (3) Loop over the map - auto signalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex + auto signalProcessVtx = HepMC::signal_process_vertex(genEvt); // Get the signal process vertex for (auto vertex : vertices) { const auto& parts = vertexMap[vertex]; // (a) create TruthVertex @@ -357,9 +354,9 @@ namespace xAODMaker { // A helper to set up a TruthVertex (without filling the ELs) - void xAODTruthCnvAlg::fillVertex(xAOD::TruthVertex* tv, const HepMC::GenVertex* gv) { + void xAODTruthCnvAlg::fillVertex(xAOD::TruthVertex* tv, const HepMC::GenVertexPtr gv) { tv->setId(gv->id()); - tv->setBarcode(gv->barcode()); + tv->setBarcode(HepMC::barcode(gv)); // No vertex weights // vector<float> weights; @@ -374,9 +371,9 @@ namespace xAODMaker { // A helper to set up a TruthParticle (without filling the ELs) - void xAODTruthCnvAlg::fillParticle(xAOD::TruthParticle* tp, const HepMC::GenParticle* gp) { + void xAODTruthCnvAlg::fillParticle(xAOD::TruthParticle* tp, const HepMC::GenParticlePtr gp) { tp->setPdgId(gp->pdg_id()); - tp->setBarcode(gp->barcode()); + tp->setBarcode(HepMC::barcode(gp)); tp->setStatus(gp->status()); const HepMC::Polarization& pol = gp->polarization(); @@ -428,8 +425,7 @@ namespace xAODMaker { // FIXME: class member protection violation here. // This appears to be because WeightContainer has no public methods // to get information about the weight names. - const std::map<std::string,HepMC::WeightContainer::size_type>& weightNameMap = - genEvt.weights().m_names; + const auto& weightNameMap = genEvt.weights().m_names; std::vector<std::string> orderedWeightNameVec; orderedWeightNameVec.reserve( weightNameMap.size() ); for (const auto& entry: weightNameMap) { diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h index aad1b77c482e42a9749517d9a08015d4667d4dce..79513e702cc8e194d2bc92c808b83ce6b2163abb 100644 --- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h +++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h @@ -97,11 +97,11 @@ namespace xAODMaker { std::vector<ElementLink<xAOD::TruthParticleContainer> > outgoingEL; }; /// Convenience handle for a map of vtx ptrs -> connected particles - typedef std::map<const HepMC::GenVertex*, VertexParticles> VertexMap; + typedef std::map<const HepMC::GenVertexPtr, VertexParticles> VertexMap; /// These functions do not set up ELs, just the other variables - static void fillVertex(xAOD::TruthVertex *tv, const HepMC::GenVertex *gv); - static void fillParticle(xAOD::TruthParticle *tp, const HepMC::GenParticle *gp); + static void fillVertex(xAOD::TruthVertex *tv, const HepMC::GenVertexPtr gv); + static void fillParticle(xAOD::TruthParticle *tp, const HepMC::GenParticlePtr gp); /// The key of the input AOD truth container SG::ReadHandleKey<McEventCollection> m_aodContainerKey{ diff --git a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/AFP_ByteStream2RawCnv/AFP_RawDataProvider.h b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/AFP_ByteStream2RawCnv/AFP_RawDataProvider.h index 1c817be5b9d83c6f5cc3b3b36b1a06c527641024..2eefd289515c7d7141f9fd8951a01a178f33c87d 100644 --- a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/AFP_ByteStream2RawCnv/AFP_RawDataProvider.h +++ b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/AFP_ByteStream2RawCnv/AFP_RawDataProvider.h @@ -42,10 +42,11 @@ public: private: ServiceHandle<IROBDataProviderSvc> m_robDataProvider; - ToolHandle<AFP_RawDataProviderTool> m_rawDataTool; + ToolHandle<AFP_RawDataProviderTool> m_rawDataTool{this, "ProviderTool", "AFP_RawDataProviderTool"}; /// name used to store AFP_RawContainer in StoreGate - std::string m_AFP_RawContainerKey; + SG::WriteHandleKey<AFP_RawContainer> m_AFP_RawContainerKey{this, "AFP_RawContainerKey", "AFP_RawData", + "Name under which AFP_RawContainer object will be saved in StoreGate"}; /// vector of robIDs from which data should be processed static const std::vector<unsigned int> s_robIDs; diff --git a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/src/AFP_RawDataProvider.cxx b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/src/AFP_RawDataProvider.cxx index 4d3531b29929d9ca14e47d7ce1e04ee4000b956f..c8eef0c884bc54c03950091db2771221c320f3d9 100644 --- a/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/src/AFP_RawDataProvider.cxx +++ b/ForwardDetectors/AFP/AFP_ByteStream2RawCnv/src/AFP_RawDataProvider.cxx @@ -14,15 +14,8 @@ const std::vector<unsigned int> AFP_RawDataProvider::s_robIDs = {AFP_ROBID::side AFP_RawDataProvider::AFP_RawDataProvider(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_robDataProvider("ROBDataProviderSvc", name), - m_rawDataTool("AFP_RawDataProviderTool") + m_robDataProvider("ROBDataProviderSvc", name) { - - declareProperty("AFP_RawContainerKey", - m_AFP_RawContainerKey = "AFP_RawData", - "Name under which AFP_RawContainer object will be saved in StoreGate"); - - declareProperty("ProviderTool", m_rawDataTool); } AFP_RawDataProvider::~AFP_RawDataProvider() {} @@ -43,30 +36,23 @@ StatusCode AFP_RawDataProvider::initialize() { ATH_MSG_DEBUG("Retrieved service " << m_rawDataTool); } + ATH_CHECK(m_AFP_RawContainerKey.initialize()); + return StatusCode::SUCCESS; } StatusCode AFP_RawDataProvider::execute() { ATH_MSG_DEBUG("AFP_RawDataProvider::EXECUTE"); - AFP_RawContainer *container = new AFP_RawContainer; + auto container = std::make_unique<AFP_RawContainer>(); ATH_MSG_DEBUG("Created AFP RDO Container"); - StatusCode recordSC = - evtStore()->record(container, m_AFP_RawContainerKey); - if (recordSC.isFailure()) { - ATH_MSG_WARNING("Unable to record AFP RDO Container"); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG("AFP RDO Container recorded"); - } - std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *> listOfRobf; m_robDataProvider->getROBData(s_robIDs, listOfRobf); ATH_MSG_DEBUG(" ROB ID " << std::hex << s_robIDs<<std::dec); ATH_MSG_DEBUG(" Number of ROB fragments is " << listOfRobf.size()); - if (m_rawDataTool->convert(listOfRobf, container).isFailure()) { + if (m_rawDataTool->convert(listOfRobf, container.get()).isFailure()) { ATH_MSG_WARNING("Bytestream conversion into raw failed"); return StatusCode::SUCCESS; } else { @@ -76,5 +62,14 @@ StatusCode AFP_RawDataProvider::execute() { << container->collectionsSi().size()); } + SG::WriteHandle<AFP_RawContainer> writeHandle{m_AFP_RawContainerKey}; + StatusCode recordSC = writeHandle.record(std::move(container)); + if (recordSC.isFailure()) { + ATH_MSG_WARNING("Unable to record AFP RDO Container"); + return StatusCode::SUCCESS; + } else { + ATH_MSG_DEBUG("AFP RDO Container recorded"); + } + return StatusCode::SUCCESS; } diff --git a/ForwardDetectors/AFP/AFP_DBTools/CMakeLists.txt b/ForwardDetectors/AFP/AFP_DBTools/CMakeLists.txt index a5d6112904385a5d4e1baea75785d302ac8af17b..947414ae3158d348a0177a2c61250f2d3063fa12 100644 --- a/ForwardDetectors/AFP/AFP_DBTools/CMakeLists.txt +++ b/ForwardDetectors/AFP/AFP_DBTools/CMakeLists.txt @@ -27,6 +27,6 @@ atlas_install_headers( AFP_DBTools ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_add_test( flake8_scripts - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/scripts + SCRIPT ${ATLAS_FLAKE8} ${CMAKE_CURRENT_SOURCE_DIR}/scripts PROPERTIES TIMEOUT 300 POST_EXEC_SCRIPT nopost.sh ) diff --git a/ForwardDetectors/AFP/AFP_DBTools/scripts/AFPLocalAlignDBCreate.py b/ForwardDetectors/AFP/AFP_DBTools/scripts/AFPLocalAlignDBCreate.py index acb520683246fb0bf06209b534d77846704aa4a8..8a0373c6296d36e4deb3d96683e6917710277b68 100644 --- a/ForwardDetectors/AFP/AFP_DBTools/scripts/AFPLocalAlignDBCreate.py +++ b/ForwardDetectors/AFP/AFP_DBTools/scripts/AFPLocalAlignDBCreate.py @@ -1,4 +1,5 @@ #!/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function diff --git a/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt b/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt index 4713da1c4af735df752a1c62d63a133ee31ffa6c..4547f9c73a4e495c805e71e28a6d25fecc5114d6 100644 --- a/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt +++ b/ForwardDetectors/AFP/AFP_Monitoring/CMakeLists.txt @@ -12,7 +12,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODForward ForwardDetectors/AFP/AFP_RawEv PRIVATE - External/AtlasROOT Tools/LWHists Event/xAOD/xAODEventInfo ) @@ -28,7 +27,7 @@ atlas_add_component( AFP_Monitoring src/components/*.cxx PUBLIC_HEADERS AFP_Monitoring INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib LWHists xAODForward xAODEventInfo AFP_RawEv) + LINK_LIBRARIES AthenaMonitoringLib LWHists xAODForward xAODEventInfo AFP_RawEv) atlas_install_headers( AFP_Monitoring ) atlas_install_joboptions( share/*.py ) diff --git a/ForwardDetectors/AFP/AFP_Monitoring/share/AFPMonitoring_jobOptions.py b/ForwardDetectors/AFP/AFP_Monitoring/share/AFPMonitoring_jobOptions.py index 39af47807491ebd006404c08a6dd60ba5a191029..a1a37f8a1079ad9a0770a8043d8e4f34782e1a54 100644 --- a/ForwardDetectors/AFP/AFP_Monitoring/share/AFPMonitoring_jobOptions.py +++ b/ForwardDetectors/AFP/AFP_Monitoring/share/AFPMonitoring_jobOptions.py @@ -97,17 +97,5 @@ ToolSvc += station_3 AFPSiHitsMonTool.stationsMonitors = [station_0, station_1, station_2, station_3] -ToolSvc += AFPSiHitsMonTool AFPMonManager.AthenaMonTools += [ AFPSiHitsMonTool ] - -# # ===== Technical monitor ===== -# from AFP_Monitoring.AFP_MonitoringConf import AFPTechnicalMonitorTool -# AFPTechnicalMonTool = AFPTechnicalMonitorTool ( -# name = "AFPTechnicalMonitoring", -# PreScale = 0, -# EnableLumi = True -# ) - -# ToolSvc += AFPTechnicalMonTool -# AFPMonManager.AthenaMonTools += [ AFPTechnicalMonTool ] diff --git a/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.cxx b/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.cxx index 6a89502d627e10288f5967ab53c22d2fd8314e64..bc024196581ca80a3c6ee1864eb3e2cf96c0fb73 100644 --- a/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.cxx +++ b/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.cxx @@ -22,17 +22,17 @@ AFP_Raw2DigiTool::AFP_Raw2DigiTool(const std::string &type, const IInterface *parent) : base_class(type, name, parent), m_totToChargeTransformation ("totToChargeTransformation", "1909 + x*363 + x*x*141") -{ - declareProperty( "rawDataContainerName", m_rawDataContainerName = "AFP_RawData"); - declareProperty( "AFPSiHitsContainerName", m_AFPSiHitsContainerName = "AFPSiHitContainer" ); - declareProperty( "AFPHitsContainerNameToF", m_AFPHitsContainerNameToF = "AFPToFHitContainer" ); -} +{} AFP_Raw2DigiTool::~AFP_Raw2DigiTool() {} StatusCode AFP_Raw2DigiTool::initialize() { - ATH_MSG_INFO("Initializing " << name() << "..."); + ATH_MSG_DEBUG("Initializing " << name() << "..."); + + ATH_CHECK( m_rawDataContainerName.initialize() ); + ATH_CHECK( m_AFPSiHitsContainerName.initialize() ); + ATH_CHECK( m_AFPHitsContainerNameToF.initialize() ); return StatusCode::SUCCESS; } @@ -50,15 +50,13 @@ StatusCode AFP_Raw2DigiTool::recoSiHits() ATH_MSG_DEBUG("AFP_Raw2DigiTool recoSiHits "); // create output containers - xAOD::AFPSiHitContainer* siHitContainer = new xAOD::AFPSiHitContainer(); - ATH_CHECK( evtStore()->record(siHitContainer, m_AFPSiHitsContainerName) ); - xAOD::AFPSiHitAuxContainer* siHitAuxContainer = new xAOD::AFPSiHitAuxContainer(); - ATH_CHECK( evtStore()->record(siHitAuxContainer, m_AFPSiHitsContainerName + "Aux.") ); - siHitContainer->setStore(siHitAuxContainer); + auto siHitContainer = std::make_unique<xAOD::AFPSiHitContainer>(); + auto siHitAuxContainer = std::make_unique<xAOD::AFPSiHitAuxContainer>(); + siHitContainer->setStore(siHitAuxContainer.get()); // retrieve raw data - const AFP_RawContainer *container = nullptr; - if (evtStore()->retrieve(container, m_rawDataContainerName).isFailure()) { + SG::ReadHandle<AFP_RawContainer> container{m_rawDataContainerName}; + if (!container.isValid()) { ATH_MSG_WARNING("AFP_Raw2DigiTool: Could not find raw data container"); return StatusCode::SUCCESS; } @@ -67,7 +65,10 @@ StatusCode AFP_Raw2DigiTool::recoSiHits() for (const AFP_SiRawCollection& collection: container->collectionsSi()) for (const AFP_SiRawData& data : collection.dataRecords()) - newXAODHitSi (siHitContainer, collection, data); + newXAODHitSi (siHitContainer.get(), collection, data); + + SG::WriteHandle<xAOD::AFPSiHitContainer> writeHandle{m_AFPSiHitsContainerName}; + ATH_CHECK( writeHandle.record(std::move(siHitContainer), std::move(siHitAuxContainer)) ); return StatusCode::SUCCESS; } @@ -77,15 +78,13 @@ StatusCode AFP_Raw2DigiTool::recoToFHits() ATH_MSG_DEBUG("AFP_Raw2DigiTool recoToFHits "); // create output containers - xAOD::AFPToFHitContainer* tofHitContainer = new xAOD::AFPToFHitContainer(); - ATH_CHECK( evtStore()->record(tofHitContainer, m_AFPHitsContainerNameToF) ); - xAOD::AFPToFHitAuxContainer* tofHitAuxContainer = new xAOD::AFPToFHitAuxContainer(); - ATH_CHECK( evtStore()->record(tofHitAuxContainer, m_AFPHitsContainerNameToF + "Aux.") ); - tofHitContainer->setStore(tofHitAuxContainer); + auto tofHitContainer = std::make_unique<xAOD::AFPToFHitContainer>(); + auto tofHitAuxContainer = std::make_unique<xAOD::AFPToFHitAuxContainer>(); + tofHitContainer->setStore(tofHitAuxContainer.get()); // retrieve raw data - const AFP_RawContainer *container = nullptr; - if (evtStore()->retrieve(container, m_rawDataContainerName).isFailure()) { + SG::ReadHandle<AFP_RawContainer> container{m_rawDataContainerName}; + if (!container.isValid()) { ATH_MSG_WARNING("AFP_Raw2DigiTool: Could not find raw data container"); return StatusCode::SUCCESS; } @@ -95,7 +94,10 @@ StatusCode AFP_Raw2DigiTool::recoToFHits() for (const AFP_ToFRawCollection& collection: container->collectionsToF()) for (const AFP_ToFRawData& data : collection.dataRecords()) if (data.hitDiscConfig() == 3 && data.header() == 2) - newXAODHitToF (tofHitContainer, collection, data); + newXAODHitToF (tofHitContainer.get(), collection, data); + + SG::WriteHandle<xAOD::AFPToFHitContainer> writeHandle{m_AFPHitsContainerNameToF}; + ATH_CHECK( writeHandle.record(std::move(tofHitContainer), std::move(tofHitAuxContainer)) ); return StatusCode::SUCCESS; } diff --git a/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.h b/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.h index ea894f5aff90e57c8a1846c65d35fd3e142b7f85..11df139f27d875e3c778f290b29defa18eccc897 100644 --- a/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.h +++ b/ForwardDetectors/AFP/AFP_Raw2Digi/src/AFP_Raw2DigiTool.h @@ -42,9 +42,9 @@ public: unsigned int decodeTimeOverThresholdSi (const unsigned int input, const unsigned int discConfig) const; protected: - std::string m_rawDataContainerName; - std::string m_AFPSiHitsContainerName; - std::string m_AFPHitsContainerNameToF; + SG::ReadHandleKey<AFP_RawContainer> m_rawDataContainerName{this, "rawDataContainerName", "AFP_RawData"}; + SG::WriteHandleKey<xAOD::AFPSiHitContainer> m_AFPSiHitsContainerName{this, "AFPSiHitsContainerName", "AFPSiHitContainer"}; + SG::WriteHandleKey<xAOD::AFPToFHitContainer> m_AFPHitsContainerNameToF{this, "AFPHitsContainerNameToF", "AFPToFHitContainer"}; /// @brief Factor converting signal to time /// diff --git a/ForwardDetectors/ALFA/ALFA_RawEv/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_RawEv/CMakeLists.txt index 7ebd3e21b64dcf95154743d09d8113d5be357688..ef670882a4cb540952035cf0fad2048e4f27d091 100644 --- a/ForwardDetectors/ALFA/ALFA_RawEv/CMakeLists.txt +++ b/ForwardDetectors/ALFA/ALFA_RawEv/CMakeLists.txt @@ -24,7 +24,7 @@ atlas_add_library( ALFA_RawEv PUBLIC_HEADERS ALFA_RawEv INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers HitManagement StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES GaudiKernel ) + PRIVATE_LINK_LIBRARIES GaudiKernel EventContainers ) atlas_add_dictionary( ALFA_RawEvDict ALFA_RawEv/ALFA_RawEvDict.h diff --git a/ForwardDetectors/ALFA/ALFA_SimEv/src/ALFA_ODHit.cxx b/ForwardDetectors/ALFA/ALFA_SimEv/src/ALFA_ODHit.cxx index 9da62947af78df530538b4f9b10016b1b795a05e..e8fecbeac5cc5d04a1c9fb6ff6598993dc0c1dd8 100644 --- a/ForwardDetectors/ALFA/ALFA_SimEv/src/ALFA_ODHit.cxx +++ b/ForwardDetectors/ALFA/ALFA_SimEv/src/ALFA_ODHit.cxx @@ -51,5 +51,4 @@ ALFA_ODHit::~ALFA_ODHit() {} int ALFA_ODHit::GetTrackID() const { return 22; -// return m_partLink.barcode(); } diff --git a/ForwardDetectors/ForwardSimulation/ForwardRegion_EventCnv/ForwardRegion_EventTPCnv/CMakeLists.txt b/ForwardDetectors/ForwardSimulation/ForwardRegion_EventCnv/ForwardRegion_EventTPCnv/CMakeLists.txt index 958d89332fcc61ce060c1d5632d95fed9c3fba51..b77a25ed535863fdad25429086935ce4377f116a 100644 --- a/ForwardDetectors/ForwardSimulation/ForwardRegion_EventCnv/ForwardRegion_EventTPCnv/CMakeLists.txt +++ b/ForwardDetectors/ForwardSimulation/ForwardRegion_EventCnv/ForwardRegion_EventTPCnv/CMakeLists.txt @@ -37,6 +37,6 @@ atlas_add_test( SimulationHitCnv_p1_test SOURCES test/SimulationHitCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ForwardRegion_EventTPCnv ) + LINK_LIBRARIES ForwardRegion_EventTPCnv TestTools ) diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt index 3cec6e9f4fe7f02751129764313ca9a8fde881c7..985ca52ac1c770f2d392dc860cdaf8fbd4317ebe 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt @@ -23,6 +23,5 @@ atlas_add_component( LUCID_Monitoring LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib LUCID_RawEvent GaudiKernel ) # Install files from the package: -atlas_install_headers( LUCID_Monitoring ) atlas_install_joboptions( share/*.py ) diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx index b0edd2ff0319d2d561e301e6bbc804334293192c..e37c24136b575d365a58c2c9e75c12b49512d4a3 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx @@ -1,27 +1,27 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <sstream> -#include "GaudiKernel/IJobOptionsSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/StatusCode.h" - -#include "AthenaMonitoring/AthenaMonManager.h" -#include "LUCID_Monitoring/LUCID_HitsMoniTool.h" +#include "LUCID_HitsMoniTool.h" LUCID_HitsMoniTool::LUCID_HitsMoniTool(const std::string& type, const std::string& name, const IInterface* parent): ManagedMonitorToolBase(type, name, parent) { - m_LUCID_RawDataContainer = 0; } LUCID_HitsMoniTool::~LUCID_HitsMoniTool() {} +StatusCode LUCID_HitsMoniTool::initialize() { + ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_LUCID_RawDataContainerKey.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode LUCID_HitsMoniTool::bookHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::bookHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::bookHistograms "); m_LUCID_Histos.clear(); @@ -103,30 +103,27 @@ StatusCode LUCID_HitsMoniTool::bookHistograms() { StatusCode LUCID_HitsMoniTool::fillHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::fillHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::fillHistograms "); - StatusCode sc = evtStore()->retrieve(m_LUCID_RawDataContainer, "Lucid_RawData"); + SG::ReadHandle<LUCID_RawDataContainer> rawdata{m_LUCID_RawDataContainerKey}; - if (sc.isFailure()) { if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Could not retireved LUCID_RawDataContainer from StoreGate " << endmsg; return sc; } - else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_RawDataContainer is retireved from StoreGate " << endmsg; - - LUCID_RawDataContainer::const_iterator LUCID_RawData_itr = m_LUCID_RawDataContainer->begin(); - LUCID_RawDataContainer::const_iterator LUCID_RawData_end = m_LUCID_RawDataContainer->end(); + if (!rawdata.isValid()) { ATH_MSG_WARNING(" Could not retireved LUCID_RawDataContainer from StoreGate "); return StatusCode::FAILURE; } + else ATH_MSG_DEBUG(" LUCID_RawDataContainer is retireved from StoreGate "); - for (; LUCID_RawData_itr != LUCID_RawData_end; LUCID_RawData_itr++) { + for (const auto& LUCID_RawData_itr : *rawdata) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << (*LUCID_RawData_itr); + ATH_MSG_DEBUG(LUCID_RawData_itr); for (int bxID=0; bxID<3; bxID++) { for (int tub=0; tub<m_nLucidTubes; tub++) { - bool isTubeFired = (*LUCID_RawData_itr)->isTubeFired(tub, bxID); + bool isTubeFired = LUCID_RawData_itr->isTubeFired(tub, bxID); - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) - << " bxID: " << std::setw(10) << bxID + ATH_MSG_DEBUG( + " bxID: " << std::setw(10) << bxID << " tub: " << std::setw(10) << tub << " fire: " << std::setw(10) << isTubeFired - << endmsg; + ); if (isTubeFired) m_LUCID_Histos[bxID]->Fill(tub); } @@ -135,8 +132,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { int hitsA, hitsC, hitsT; bool coinFlag; - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideA(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideC(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideA(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideC(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -148,8 +145,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[7]->Fill(hitsC*coinFlag); m_LUCID_Histos[8]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideA(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideC(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideA(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideC(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -161,8 +158,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[13]->Fill(hitsC*coinFlag); m_LUCID_Histos[14]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideAprevBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideCprevBX(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideAprevBX(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideCprevBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -174,8 +171,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[19]->Fill(hitsC*coinFlag); m_LUCID_Histos[20]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideAprevBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideCprevBX(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideAprevBX(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideCprevBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -187,8 +184,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[25]->Fill(hitsC*coinFlag); m_LUCID_Histos[26]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideAnextBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideCnextBX(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideAnextBX(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideCnextBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -200,8 +197,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[31]->Fill(hitsC*coinFlag); m_LUCID_Histos[32]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideAnextBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideCnextBX(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideAnextBX(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideCnextBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -219,11 +216,11 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { StatusCode LUCID_HitsMoniTool::procHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::procHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::procHistograms "); if (endOfRunFlag()) { - msg(MSG::DEBUG) << " m_nEvents: " << m_nEvents << endmsg; + ATH_MSG_DEBUG(" m_nEvents: " << m_nEvents); for (int bxID=0; bxID<3; bxID++) m_LUCID_Histos[18+bxID]->Scale(1./m_nEvents); } diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h similarity index 67% rename from ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h rename to ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h index cb78a7c5d52a5f760575bbd06fa708e3a9479e1e..129a02bed026b8e7a14363b6ffcc2fe7fe9d5e9c 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h @@ -23,13 +23,14 @@ class LUCID_HitsMoniTool: public ManagedMonitorToolBase { virtual ~LUCID_HitsMoniTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; protected: - const LUCID_RawDataContainer* m_LUCID_RawDataContainer; + SG::ReadHandleKey<LUCID_RawDataContainer> m_LUCID_RawDataContainerKey{this, "RawDataKey", "Lucid_RawData"}; std::vector<TH1F*> m_LUCID_Histos; diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx b/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx index 05a53b223f91b34592ef66e9ecf442311b99ba53..d7328a31be7af1ba497dab15632b101b6dbd32ea 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx @@ -1,3 +1,3 @@ -#include "LUCID_Monitoring/LUCID_HitsMoniTool.h" +#include "../LUCID_HitsMoniTool.h" DECLARE_COMPONENT( LUCID_HitsMoniTool ) diff --git a/ForwardDetectors/ZDC/ZdcRec/CMakeLists.txt b/ForwardDetectors/ZDC/ZdcRec/CMakeLists.txt index 14824a76ef55c43e03bb2441a5b46cd17091d5d6..0f4c4834444949a3cc6fc4cf4a77dd4d3947bf54 100644 --- a/ForwardDetectors/ZDC/ZdcRec/CMakeLists.txt +++ b/ForwardDetectors/ZDC/ZdcRec/CMakeLists.txt @@ -42,8 +42,4 @@ atlas_add_component( ZdcRec # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h index 82e8a52dee3ae6ce6a2ae502dde495094b19b47f..df51a269bd71a3717e3f323a886a43a9cd3cb5bc 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h @@ -4,7 +4,13 @@ #ifndef ATLASHEPMC_GENEVENT_H #define ATLASHEPMC_GENEVENT_H #include "HepMC/GenEvent.h" +#include "HepMC/GenVertex.h" +#include "AtlasHepMC/GenVertex.h" namespace HepMC { +inline GenEvent* newGenEvent(const int a, const int b ){ return new GenEvent(a,b); } +inline GenVertex* signal_process_vertex(const GenEvent* e) { return e->signal_process_vertex(); } +inline GenVertex* barcode_to_vertex(const GenEvent* e, int id ){return e->barcode_to_vertex(id);} +inline GenParticle* barcode_to_particle(const GenEvent* e, int id ){return e->barcode_to_particle(id);} inline int signal_process_id(const GenEvent e) { return e.signal_process_id(); } diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h index c245613597dac5c26c4bd4ca6e2f1eb5e92369a7..2d0aaae21d5ae2a719ce800d73e8ddb6c0803174 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h @@ -12,6 +12,7 @@ inline GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom = HepMC::Fo } inline int barcode(GenParticle p) { return p.barcode(); } template <class T> inline int barcode(T p) { return p->barcode(); } - +inline void suggest_barcode(GenParticle p, int i){p.suggest_barcode(i);} +template <class T> void suggest_barcode(T* p, int i){p->suggest_barcode(i);} } #endif diff --git a/Generators/BeamHaloGenerator/src/BeamHaloGenerator.cxx b/Generators/BeamHaloGenerator/src/BeamHaloGenerator.cxx index 2bef9d36dacbaaa7f3fcdc23b6a674b1fcafb528..0631e4f21513464556bf9c028d746862e5060149 100644 --- a/Generators/BeamHaloGenerator/src/BeamHaloGenerator.cxx +++ b/Generators/BeamHaloGenerator/src/BeamHaloGenerator.cxx @@ -97,8 +97,8 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent HepMC::GenEvent* evt) { double pz; bool flipFlag = flipEvent(); - HepMC::GenParticle* genParticle; - HepMC::GenVertex* genVertex; + HepMC::GenParticlePtr genParticle; + HepMC::GenVertexPtr genVertex; const double c = 2.99792458E+11; // speed of light in mm/s std::vector<BeamHaloParticle>::iterator itr = beamHaloEvent->begin(); @@ -121,11 +121,11 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent HepMC::FourVector fourVector = (*itr).fourVector(); if(!flipFlag) { - genParticle = new HepMC::GenParticle(fourVector, + genParticle = HepMC::newGenParticlePtr(fourVector, (*itr).pdgId(), 1); - genVertex = new HepMC::GenVertex(HepMC::FourVector(position.x(), + genVertex = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(), position.y(), (position.z() + m_interfacePlane), c*position.t() -1.0*std::fabs(m_interfacePlane)), @@ -135,11 +135,11 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent pz = fourVector.pz(); fourVector.setPz(-pz); - genParticle = new HepMC::GenParticle(fourVector, + genParticle = HepMC::newGenParticlePtr(fourVector, (*itr).pdgId(), 1); - genVertex = new HepMC::GenVertex(HepMC::FourVector(position.x(), + genVertex = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(), position.y(), -1.0*(position.z() + m_interfacePlane), c*position.t() -1.0*std::fabs(m_interfacePlane)), diff --git a/Generators/BeamHaloGenerator/src/BeamHaloGeneratorAlg.cxx b/Generators/BeamHaloGenerator/src/BeamHaloGeneratorAlg.cxx index cf834975b697613478320eab0705dec54233d61a..fe9068ecd7f3645ba3d72eb6d201cb55e81ebbea 100644 --- a/Generators/BeamHaloGenerator/src/BeamHaloGeneratorAlg.cxx +++ b/Generators/BeamHaloGenerator/src/BeamHaloGeneratorAlg.cxx @@ -193,9 +193,9 @@ StatusCode BeamHaloGeneratorAlg::callGenerator() { // Fill monitoring plots if requested if(m_doMonitoringPlots) { - HepMC::WeightContainer weightContainer = m_evt.weights(); + auto weightContainer = m_evt.weights(); if(weightContainer.size() != 5) { - ATH_MSG_WARNING("HepMC::WeightContainer does not contain five elements."); + ATH_MSG_WARNING("The number of weights for this event is not equal to 5."); return StatusCode::SUCCESS; } double weight = weightContainer[0]; diff --git a/Generators/BeamHaloGenerator/src/FlukaHaloGenerator.cxx b/Generators/BeamHaloGenerator/src/FlukaHaloGenerator.cxx index 6b77219f6caf50858923c99188352be3716482c0..c03c14459ab2a9b55e98495441bc1ad425abed3b 100644 --- a/Generators/BeamHaloGenerator/src/FlukaHaloGenerator.cxx +++ b/Generators/BeamHaloGenerator/src/FlukaHaloGenerator.cxx @@ -67,7 +67,7 @@ int FlukaHaloGenerator::fillEvt(HepMC::GenEvent* evt) { evt->set_event_number(m_eventNumber); // Set the signal process - evt->set_signal_process_id(BeamHaloGenerator::FLUKA_SHOWER); + HepMC::set_signal_process_id(evt,BeamHaloGenerator::FLUKA_SHOWER); // Increment the event number m_eventNumber++; diff --git a/Generators/BeamHaloGenerator/src/MarsHaloGenerator.cxx b/Generators/BeamHaloGenerator/src/MarsHaloGenerator.cxx index 44fc5052a0a2d2da2872a6921ae4c2f2851d3ad5..da1c70298df7e3583afcb6923aa0fea54fb051db 100644 --- a/Generators/BeamHaloGenerator/src/MarsHaloGenerator.cxx +++ b/Generators/BeamHaloGenerator/src/MarsHaloGenerator.cxx @@ -93,11 +93,11 @@ int MarsHaloGenerator::fillEvt(HepMC::GenEvent* evt) { // Check if sampling has been enabled or not. if(!m_enableSampling) { - evt->set_signal_process_id(BeamHaloGenerator::MARS_READ); + HepMC::set_signal_process_id(evt,BeamHaloGenerator::MARS_READ); evt->weights().push_back(beamHaloEvent[0].weight()); } else { - evt->set_signal_process_id(BeamHaloGenerator::MARS_SINGLE); + HepMC::set_signal_process_id(evt,BeamHaloGenerator::MARS_SINGLE); evt->weights().push_back(1.0); } diff --git a/Generators/CavernBkgGenerator/src/GenerateCavernBkg.cxx b/Generators/CavernBkgGenerator/src/GenerateCavernBkg.cxx index 6c5e79ae1bb84d839df9b35616a07411841b2fa6..8941dded6b764e8521d3c2a3708359ef83f91c48 100644 --- a/Generators/CavernBkgGenerator/src/GenerateCavernBkg.cxx +++ b/Generators/CavernBkgGenerator/src/GenerateCavernBkg.cxx @@ -61,16 +61,16 @@ GenerateCavernBkg::fillEvt(HepMC::GenEvent* evt) { ATH_MSG_INFO("GenerateCavernBkg FILLING."); // Set event properties - evt->set_signal_process_id(-1); + HepMC::set_signal_process_id(evt,-1); evt->set_event_number(m_bkgout.ievent()); - evt->set_random_states(m_seeds); + HepMC::set_random_states(evt,m_seeds); for (int i = 1; i <= m_bkgout.npv(); ++i) { const CLHEP::HepLorentzVector position(m_bkgout.vx(i)*10., // CLHEP::cm to CLHEP::mm m_bkgout.vy(i)*10., // CLHEP::cm to CLHEP::mm m_bkgout.vz(i)*10., // CLHEP::cm to CLHEP::mm m_bkgout.ptof(i)*299.792458); // CLHEP::ns to CLHEP::mm - HepMC::GenVertex* v = new HepMC::GenVertex(position, m_bkgout.irp(i)); + HepMC::GenVertexPtr v = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(),position.y(),position.z(),position.t()), m_bkgout.irp(i)); // Get the mass from the particle property service const HepPDT::ParticleData* particle = particleData(abs(m_bkgout.ityp(i))); @@ -81,7 +81,7 @@ GenerateCavernBkg::fillEvt(HepMC::GenEvent* evt) { const double pz = m_bkgout.pz(i)*1000.; // CLHEP::GeV to CLHEP::MeV const double ener = sqrt(px*px + py*py + pz*pz + mass*mass); const CLHEP::HepLorentzVector momentum(px, py, pz, ener); - HepMC::GenParticle* p = new HepMC::GenParticle(momentum, m_bkgout.ityp(i), 1); + HepMC::GenParticlePtr p = HepMC::newGenParticlePtr(HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()), m_bkgout.ityp(i), 1); v->add_particle_out(p); evt->add_vertex(v); diff --git a/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx b/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx index d08bd2fb92a77c5ae61eea4caafd1ea9632ac050..e88b5e57ee0c5a3d383842f9189f42efdfcf868b 100644 --- a/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx +++ b/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx @@ -309,11 +309,11 @@ StatusCode MuonBackgroundConverter::fillEvt( HepMC::GenEvent* event ) int nPart = m_pdgCode.size(); for ( int i = 0; i < nPart; i++ ) { - HepMC::GenParticle* particle = new HepMC::GenParticle( m_fourMom[i], m_pdgCode[i], 1 ); - particle->set_polarization( m_polarization[i] ); + HepMC::GenParticlePtr particle = HepMC::newGenParticlePtr( HepMC::FourVector(m_fourMom[i].x(),m_fourMom[i].y(),m_fourMom[i].z(),m_fourMom[i].e()), m_pdgCode[i], 1 ); + HepMC::set_polarization(particle, m_polarization[i] ); // Create the vertex, and add the particle to the vertex - HepMC::GenVertex* vertex = new HepMC::GenVertex( m_fourPos[i] ); + HepMC::GenVertexPtr vertex = HepMC::newGenVertexPtr( HepMC::FourVector(m_fourPos[i].x(),m_fourPos[i].y(),m_fourPos[i].z(),m_fourPos[i].t()) ); vertex->add_particle_out( particle ); // Add the vertex to the event diff --git a/Generators/CosmicGenerator/src/CosmicGenerator.cxx b/Generators/CosmicGenerator/src/CosmicGenerator.cxx index b5ba5f50da409e454737c3f3571781544c30badc..72a334457c2e5ff1bbecc9ea5e9b22a1e5154d82 100644 --- a/Generators/CosmicGenerator/src/CosmicGenerator.cxx +++ b/Generators/CosmicGenerator/src/CosmicGenerator.cxx @@ -720,11 +720,11 @@ StatusCode CosmicGenerator::fillEvt(HepMC::GenEvent* event) { // Create the particle, and specify its polarization. - HepMC::GenParticle* particle = new HepMC::GenParticle( m_fourMom[v], m_pdgCode[v], 1); - particle->set_polarization( m_polarization[v] ); + HepMC::GenParticlePtr particle = HepMC::newGenParticlePtr( HepMC::FourVector(m_fourMom[v].px(),m_fourMom[v].py(),m_fourMom[v].pz(),m_fourMom[v].e()), m_pdgCode[v], 1); + HepMC::set_polarization(particle, m_polarization[v] ); // Create the vertex, and add the particle to the vertex. - HepMC::GenVertex* vertex = new HepMC::GenVertex(m_fourPos[v]); + HepMC::GenVertexPtr vertex = HepMC::newGenVertexPtr(HepMC::FourVector(m_fourPos[v].x(),m_fourPos[v].y(),m_fourPos[v].z(),m_fourPos[v].t())); vertex->add_particle_out( particle ); // Add the vertex to the event. diff --git a/Generators/Epos_i/src/Epos.cxx b/Generators/Epos_i/src/Epos.cxx index c1a635e247b58e0e2c694105d7d124a7d52573dc..f8308215ac31dd459527de159964906a0fcb6da8 100644 --- a/Generators/Epos_i/src/Epos.cxx +++ b/Generators/Epos_i/src/Epos.cxx @@ -21,6 +21,8 @@ #include "AtlasHepMC/HEPEVT_Wrapper.h" #include "AtlasHepMC/IO_HEPEVT.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/HeavyIon.h" #include "Epos_i/Epos.h" @@ -328,12 +330,12 @@ StatusCode Epos::fillEvt( HepMC::GenEvent* evt ) // evt->print(); - evt->set_random_states( m_seeds ); + HepMC::set_random_states(evt, m_seeds ); evt->weights().push_back(1.0); GeVToMeV(evt); - std::vector<HepMC::GenParticle*> beams; + std::vector<HepMC::GenParticlePtr> beams; for (HepMC::GenEvent::particle_const_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) { if ((*p)->status() == 4) { @@ -377,7 +379,7 @@ StatusCode Epos::fillEvt( HepMC::GenEvent* evt ) default: ATH_MSG_INFO( "Signal ID not recognised for setting HEPEVT \n"); } - evt->set_signal_process_id(sig_id); + HepMC::set_signal_process_id(evt,sig_id); return StatusCode::SUCCESS; diff --git a/Generators/EvgenProdTools/CMakeLists.txt b/Generators/EvgenProdTools/CMakeLists.txt index be11c006ff0ba49086ec90109b7b83d5469edbb8..4b5d58785d534a73ab4308640a45fc4480bcc347 100644 --- a/Generators/EvgenProdTools/CMakeLists.txt +++ b/Generators/EvgenProdTools/CMakeLists.txt @@ -36,14 +36,6 @@ atlas_add_component( EvgenProdTools # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/common/*.py ) +atlas_install_joboptions( share/common/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) atlas_install_runtime( share/file/*.txt ) -atlas_install_scripts( scripts/simple_lhe_plotter.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( flake8_scripts - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/scripts - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_scripts( scripts/simple_lhe_plotter.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h b/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h index e3c15f770119c0645ac51e814d632bcb6a14e98a..d4da612374592ed0754b31ea45fc713415a7d58a 100644 --- a/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h +++ b/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h @@ -36,9 +36,9 @@ private: /// @name Classifiers for identifying particles to be removed //@{ - bool isPID0(const HepMC::GenParticle* p); - bool isNonTransportableInDecayChain(const HepMC::GenParticle* p); - bool isLoop(const HepMC::GenParticle* p); + bool isPID0(const HepMC::GenParticlePtr p); + bool isNonTransportableInDecayChain(const HepMC::GenParticlePtr p); + bool isLoop(const HepMC::GenParticlePtr p); //@} /// @name Config properties diff --git a/Generators/EvgenProdTools/src/FixHepMC.cxx b/Generators/EvgenProdTools/src/FixHepMC.cxx index ec0a87331e22ab7afe6b05cfafe578a6afce7ede..891d9889a5a62abaa576830c9aab211a42943c24 100644 --- a/Generators/EvgenProdTools/src/FixHepMC.cxx +++ b/Generators/EvgenProdTools/src/FixHepMC.cxx @@ -47,7 +47,7 @@ StatusCode FixHepMC::execute() { } // Event particle content cleaning -- remove "bad" structures - vector<HepMC::GenParticle*> toremove; toremove.reserve(10); + std::vector<HepMC::GenParticlePtr> toremove; toremove.reserve(10); long seenThisEvent = 0; /// @todo Use nicer particles accessor from TruthUtils / HepMC3 when it exists for (HepMC::GenEvent::particle_const_iterator ip = evt->particles_begin(); ip != evt->particles_end(); ++ip) { @@ -137,17 +137,17 @@ StatusCode FixHepMC::finalize() { //@{ // Identify PDG ID = 0 particles, usually from HEPEVT padding -bool FixHepMC::isPID0(const HepMC::GenParticle* p) { +bool FixHepMC::isPID0(const HepMC::GenParticlePtr p) { return p->pdg_id() == 0; } // Identify non-transportable stuff _after_ hadronisation -bool FixHepMC::isNonTransportableInDecayChain(const HepMC::GenParticle* p) { +bool FixHepMC::isNonTransportableInDecayChain(const HepMC::GenParticlePtr p) { return !MC::isTransportable(p) && MC::fromDecay(p); } // Identify internal "loop" particles -bool FixHepMC::isLoop(const HepMC::GenParticle* p) { +bool FixHepMC::isLoop(const HepMC::GenParticlePtr p) { if (p->production_vertex() == p->end_vertex() && p->end_vertex() != NULL) return true; if (m_loopByBC && p->production_vertex()) { /// @todo Use new particle MC::parents(...) tool diff --git a/Generators/EvgenProdTools/src/TestHepMC.cxx b/Generators/EvgenProdTools/src/TestHepMC.cxx index 84cccb331e1cc8e522233ecec8ffb81d0c801d5b..60a430e052cf1a9fda891fa955b91c2a72f98927 100644 --- a/Generators/EvgenProdTools/src/TestHepMC.cxx +++ b/Generators/EvgenProdTools/src/TestHepMC.cxx @@ -278,7 +278,7 @@ StatusCode TestHepMC::execute() { vector<int> undisplaceds; // Check beams and work out per-event beam energy - const pair<HepMC::GenParticle*, HepMC::GenParticle*> beams = evt->beam_particles(); + const pair<HepMC::GenParticlePtr, HepMC::GenParticlePtr> beams = evt->beam_particles(); double cmenergy = m_cm_energy; if (!evt->valid_beam_particles()) { ATH_MSG_WARNING("Invalid beam particle pointers -- this generator interface should be fixed"); @@ -520,7 +520,7 @@ StatusCode TestHepMC::execute() { int tau_child = 0; if (abs(ppdgid) == m_pdg && (pstatus == 1 || pstatus == 2)) { ++m_TotalTaus; - HepMC::GenVertex* vtx = (*pitr)->end_vertex(); + auto vtx = (*pitr)->end_vertex(); if (vtx) { double p_energy = 0; HepMC::GenVertex::particle_iterator desc = vtx->particles_begin(HepMC::descendants); @@ -550,7 +550,7 @@ StatusCode TestHepMC::execute() { // Check for undisplaced decay daughters from long-lived hadrons if ((*pitr)->end_vertex()) { - HepMC::GenVertex* decayvtx = (*pitr)->end_vertex(); + auto decayvtx = (*pitr)->end_vertex(); const HepMC::FourVector decaypos = decayvtx->position(); const double displacement = decaypos.x()*decaypos.x() + decaypos.y()*decaypos.y() + decaypos.z()*decaypos.z(); if (displacement > 1e-6) { diff --git a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h index 42eb33b3f15abbc9c5b12f9f1eb30023df3e62dd..befc860819b32ff3620271883f3f836e077beaa9 100644 --- a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h +++ b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h @@ -71,28 +71,28 @@ class EvtInclusiveDecay:public GenBase { std::string xmlpath(void); private: - StatusCode traverseDecayTree(HepMC::GenParticle* p, + StatusCode traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, - std::set<HepMC::GenVertex*>& visited, + std::set<HepMC::GenVertexPtr>& visited, std::set<int>& toBeDecayed); - void removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticle* p); - void decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticle* p); - void addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticle* part, + void removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p); + void decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p); + void addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr part, EvtParticle* evtPart, EvtVector4R treeStart, double momentumScaleFactor = 1.0); - bool isToBeDecayed(const HepMC::GenParticle* p, bool doCrossChecks); + bool isToBeDecayed(const HepMC::GenParticlePtr p, bool doCrossChecks); bool isDefaultB(const int pId) const; bool passesUserSelection(HepMC::GenEvent* hepMC); - double invMass(const HepMC::GenParticle* p1, const HepMC::GenParticle* p2); + double invMass(const HepMC::GenParticlePtr p1, const HepMC::GenParticlePtr p2); // Utility functions to print HepMC record for debugging with optional // coloring by status code and highlighting of particles in a specific list of barcodes void printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList = 0); - unsigned int printTree(HepMC::GenParticle* p, std::set<HepMC::GenVertex*>& visited, + unsigned int printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited, int level, std::set<int>* barcodeList = 0); - std::string pdgName(const HepMC::GenParticle* p, bool statusHighlighting = false, std::set<int>* barcodeList = 0); + std::string pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting = false, std::set<int>* barcodeList = 0); // StoreGate access // StoreGateSvc* m_sgSvc; diff --git a/Generators/EvtGen_i/src/EvtDecay.cxx b/Generators/EvtGen_i/src/EvtDecay.cxx index 73938f34402a96d7ab479aeb4f38f12d1363b23d..5d40740f8b5c534763c7d9acbe66b8f97b4c03f4 100644 --- a/Generators/EvtGen_i/src/EvtDecay.cxx +++ b/Generators/EvtGen_i/src/EvtDecay.cxx @@ -418,7 +418,6 @@ double EvtCLHepRandom::random() { void EvtDecay::MeVToGeV (HepMC::GenEvent* evt) { for ( HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) { -// std::cout << " PDG, BAR " << (*p)->pdg_id() << " " << (*p)->barcode() << std::endl; HepMC::FourVector newMomentum(0.,0.,0.,0.); newMomentum.setPx( (*p)->momentum().px() / 1000. ); newMomentum.setPy( (*p)->momentum().py() / 1000. ); diff --git a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx index 77b544dfa0f53fe51b505b8b3d859d0c1346b08a..3e5cab71b66804328e1b754cb85dc1ccf77c3e70 100644 --- a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx +++ b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx @@ -211,7 +211,7 @@ StatusCode EvtInclusiveDecay::execute() { // Search HepMC record for particles to be decayed by EvtGen // NOTE: In order to ensure repeatability, we use a std::set of barcodes to obtain // an ordered list of particles to be decayed by EvtGen. - std::set<HepMC::GenVertex*> visited; + std::set<HepMC::GenVertexPtr> visited; std::set<int> toBeDecayed; for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) { HepMC::GenParticle* p = *itp; @@ -316,16 +316,16 @@ StatusCode EvtInclusiveDecay::finalize() { // by EvtGen (with its decay tree being deleted beforehand), we cannot use HepMC's // "descendant" iterator. // -StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticle* p, +StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, - std::set<HepMC::GenVertex*>& visited, + std::set<HepMC::GenVertexPtr>& visited, std::set<int>& toBeDecayed) { - ATH_MSG_VERBOSE("Inspecting: " << pdgName(p) << " barcode:"<< p->barcode()); + ATH_MSG_VERBOSE("Inspecting: " << pdgName(p) << " barcode:"<< HepMC::barcode(p)); if (!isToBeRemoved) { if (isToBeDecayed(p,true)) { - toBeDecayed.insert(p->barcode()); + toBeDecayed.insert(HepMC::barcode(p)); isToBeRemoved = true; - ATH_MSG_VERBOSE("Selected particle for decay: " << pdgName(p) << " (barcode " << p->barcode() << ")"); + ATH_MSG_VERBOSE("Selected particle for decay: " << pdgName(p) << " (barcode " << HepMC::barcode(p) << ")"); // In principle we could stop the recursion here. However, to prevent // pathological cases in certain decay trees (in particular from Herwig), @@ -365,7 +365,7 @@ StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticle* p, // // Remove an existing decay tree // -void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticle* p) { +void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p) { auto v = p->end_vertex(); if (v) { std::set<int> vtxBarCodesToDelete; @@ -402,8 +402,8 @@ void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPartic // downstream in the simulation chain. The default job parameters are for routine // isToBeDecayed() to never enable decays of such particles by EvtGen. // -void EvtInclusiveDecay::decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticle* part) { - ATH_MSG_DEBUG("Decaying particle " << pdgName(part) << " (barcode " << part->barcode() << ")"); +void EvtInclusiveDecay::decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr part) { + ATH_MSG_DEBUG("Decaying particle " << pdgName(part) << " (barcode " << HepMC::barcode(part) << ")"); if (msgLvl(MSG::VERBOSE)) part->print(); // Remove existing decay tree, if any, and flag particle as being decayed by EvtGen @@ -436,7 +436,7 @@ void EvtInclusiveDecay::decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticle -void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticle* part, +void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr part, EvtParticle* evtPart, EvtVector4R treeStart, double momentumScaleFactor) { if(evtPart->getNDaug()!=0) { @@ -446,7 +446,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar double y=(evtPart->getDaug(0)->get4Pos()).get(2)+treeStart.get(2); double z=(evtPart->getDaug(0)->get4Pos()).get(3)+treeStart.get(3); - HepMC::GenVertex* end_vtx = new HepMC::GenVertex(HepMC::FourVector(x,y,z,ct)); + HepMC::GenVertexPtr end_vtx = HepMC::newGenVertexPtr(HepMC::FourVector(x,y,z,ct)); hepMC->add_vertex(end_vtx); end_vtx->add_particle_in(part); @@ -459,7 +459,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar int id=EvtPDL::getStdHep(evtPart->getDaug(it)->getId()); int status=1; if(evtPart->getDaug(it)->getNDaug() != 0) status=m_decayedStatus; - HepMC::GenParticle* daughter = new HepMC::GenParticle(HepMC::FourVector(px,py,pz,e),id,status); + HepMC::GenParticlePtr daughter = HepMC::newGenParticlePtr(HepMC::FourVector(px,py,pz,e),id,status); end_vtx->add_particle_out(daughter); addEvtGenDecayTree(hepMC, daughter, evtPart->getDaug(it), treeStart, momentumScaleFactor); } @@ -474,7 +474,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar // The parameter doCrossChecks is used to prevent double-counting for cross-checks // if isToBeDecayed is called more than once for the same particle. // -bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticle* p, bool doCrossChecks) { +bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticlePtr p, bool doCrossChecks) { int id = p->pdg_id(); int stat = p->status(); int nDaughters = 0; @@ -570,7 +570,7 @@ bool EvtInclusiveDecay::isDefaultB(const int pId) const { // bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) { bool passed(false); - std::vector<HepMC::GenParticle*> *muons = new std::vector<HepMC::GenParticle*>; + std::vector<HepMC::GenParticlePtr> *muons = new std::vector<HepMC::GenParticlePtr>; for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) { HepMC::GenParticle* p = *itp; @@ -599,7 +599,7 @@ bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) { return passed; } -double EvtInclusiveDecay::invMass(const HepMC::GenParticle* p1, const HepMC::GenParticle* p2) { +double EvtInclusiveDecay::invMass(const HepMC::GenParticlePtr p1, const HepMC::GenParticlePtr p2) { double p1Px = p1->momentum().px(); double p1Py = p1->momentum().py(); double p1Pz = p1->momentum().pz(); @@ -623,7 +623,7 @@ double EvtInclusiveDecay::invMass(const HepMC::GenParticle* p1, const HepMC::Gen // are selected by the job options to be decayed by EvtGen. // void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList) { - std::set<HepMC::GenVertex*> visited; + std::set<HepMC::GenVertexPtr> visited; unsigned int nParticlesFound = 0; unsigned int nTreesFound = 0; for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) { @@ -641,8 +641,8 @@ void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcod << nTreesFound << " decay subtrees in HepMC event record\n" << std::endl; } -unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticle* p, - std::set<HepMC::GenVertex*>& visited, int level, std::set<int>* barcodeList) { +unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticlePtr p, + std::set<HepMC::GenVertexPtr>& visited, int level, std::set<int>* barcodeList) { unsigned int nParticlesVisited = 1; for (int i=0; i<level; i++) std::cout << " "; std::cout << pdgName(p,m_printHepMCHighlighted,barcodeList); @@ -674,12 +674,12 @@ unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticle* p, return nParticlesVisited; } -std::string EvtInclusiveDecay::pdgName(const HepMC::GenParticle* p, bool statusHighlighting, std::set<int>* barcodeList) { +std::string EvtInclusiveDecay::pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting, std::set<int>* barcodeList) { // Note: HepPDT doesn't seem to know anti-particle names // const HepPDT::ParticleData* pData = m_pdt->particle(HepPDT::ParticleID(abs(p->pdg_id()))); std::ostringstream buf; if (statusHighlighting) { - if ( ((barcodeList!=0) && (barcodeList->find(p->barcode()) != barcodeList->end())) || + if ( ((barcodeList!=0) && (barcodeList->find(HepMC::barcode(p)) != barcodeList->end())) || ((barcodeList==0) && isToBeDecayed(p,false)) ) buf << "\033[7m"; // reverse if (p->status() != 1) { diff --git a/Generators/FlowAfterburner/FlowAfterburner/AddFlowByShifting.h b/Generators/FlowAfterburner/FlowAfterburner/AddFlowByShifting.h index d3d888fc00cc2de512f9dd738c3ccd0ae3a8ffa1..e788faa5202805a42d1d4029193160d9f37eabea 100644 --- a/Generators/FlowAfterburner/FlowAfterburner/AddFlowByShifting.h +++ b/Generators/FlowAfterburner/FlowAfterburner/AddFlowByShifting.h @@ -52,10 +52,10 @@ public: private: - double SetParentToRanPhi(HepMC::GenParticle* parent); - double AddFlowToParent(HepMC::GenParticle* parent, + double SetParentToRanPhi(HepMC::GenParticlePtr parent); + double AddFlowToParent(HepMC::GenParticlePtr parent, const HijingEventParams *hijing_pars); - void MoveDescendantsToParent(HepMC::GenParticle* parent, double phishift); + void MoveDescendantsToParent(HepMC::GenParticlePtr parent, double phishift); // flow functions to set the vn values @@ -70,7 +70,7 @@ private: void p_Pb_cent_eta_indep (double b, double eta, double pt); //for p_Pb TGraph *m_graph_fluc;//TGraph storing the v2_RP/delta Vs b_imp - void Set_EbE_Fluctuation_Multipliers(HepMC::GenVertex* mainvtx, float b); + void Set_EbE_Fluctuation_Multipliers(HepMC::GenVertexPtr mainvtx, float b); diff --git a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx index f55c91da8fa4f3aeb466b61fd5e2471eb62b77f1..9a9f1fc67b7e94a63a34268ad15661acde7d0f73 100644 --- a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx +++ b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx @@ -244,7 +244,7 @@ StatusCode AddFlowByShifting::execute() { //std::cout << std::endl; - auto mainvtx =(*itr)->barcode_to_vertex(-1); + auto mainvtx=HepMC::barcode_to_vertex(*itr,-1); if(m_flow_fluctuations) Set_EbE_Fluctuation_Multipliers(mainvtx,hijing_pars->get_b()); int particles_in_event = (*itr)->particles_size(); @@ -254,12 +254,12 @@ StatusCode AddFlowByShifting::execute() { partit != (*mainvtx).particles_end(HepMC::children); partit++ ) { // Process particles from main vertex - HepMC::GenParticle* parent = (*partit); + auto parent = (*partit); CLHEP::HepLorentzVector momentum(parent->momentum().px(), parent->momentum().py(), parent->momentum().pz(), parent->momentum().e()); - ATH_MSG_DEBUG("Parent particle: " << parent->barcode() << + ATH_MSG_DEBUG("Parent particle: " << HepMC::barcode(parent) << " PID = " << parent->pdg_id() << " Status = " << parent->status() << " Eta = " << momentum.pseudoRapidity()<< @@ -314,7 +314,7 @@ StatusCode AddFlowByShifting::finalize() { -double AddFlowByShifting::SetParentToRanPhi(HepMC::GenParticle* parent) +double AddFlowByShifting::SetParentToRanPhi(HepMC::GenParticlePtr parent) { // Set particle to random phi // Return phi shift @@ -344,13 +344,13 @@ double AddFlowByShifting::SetParentToRanPhi(HepMC::GenParticle* parent) void AddFlowByShifting::MoveDescendantsToParent - (HepMC::GenParticle* parent, double phishift) + (HepMC::GenParticlePtr parent, double phishift) { // Move the branch of descendant vertices and particles // by phishift to parent particle position auto endvtx = parent->end_vertex(); if ( endvtx ) { - ATH_MSG_DEBUG("Processing branch of parent particle "<< parent->barcode()); + ATH_MSG_DEBUG("Processing branch of parent particle "<< HepMC::barcode(parent)); // now rotate descendant vertices for ( HepMC::GenVertex::vertex_iterator @@ -358,7 +358,7 @@ void AddFlowByShifting::MoveDescendantsToParent descvtxit != endvtx->vertices_end(HepMC::descendants); ++descvtxit) { auto descvtx = (*descvtxit); - ATH_MSG_DEBUG("Processing vertex " << descvtx->barcode()); + ATH_MSG_DEBUG("Processing vertex " << HepMC::barcode(descvtx)); // rotate vertex if(fabs(phishift) > 1e-7) { @@ -367,7 +367,7 @@ void AddFlowByShifting::MoveDescendantsToParent descvtx->position().z(), descvtx->position().t()); position.rotateZ(phishift*Gaudi::Units::rad); - descvtx->set_position( position ); + descvtx->set_position(HepMC::FourVector( position.x(),position.y(),position.z(),position.t()) ); } // now rotate their associated particles @@ -380,7 +380,7 @@ void AddFlowByShifting::MoveDescendantsToParent descpart->momentum().py(), descpart->momentum().pz(), descpart->momentum().e()); - ATH_MSG_DEBUG("Descendant particle: " << descpart->barcode()<< + ATH_MSG_DEBUG("Descendant particle: " << HepMC::barcode(descpart)<< " PID = " << descpart->pdg_id() << " Status = " << descpart->status() << " Eta = " << momentum.pseudoRapidity() << @@ -390,7 +390,7 @@ void AddFlowByShifting::MoveDescendantsToParent // rotate particle if(fabs(phishift) > 1e-7) { momentum.rotateZ(phishift*Gaudi::Units::rad); - descpart->set_momentum( momentum ); + descpart->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) ); ATH_MSG_DEBUG(" Phi shift = " << phishift<< " Phi shifted = " << momentum.phi()); } @@ -412,7 +412,7 @@ void AddFlowByShifting::MoveDescendantsToParent -double AddFlowByShifting::AddFlowToParent (HepMC::GenParticle* parent, const HijingEventParams *hijing_pars) +double AddFlowByShifting::AddFlowToParent (HepMC::GenParticlePtr parent, const HijingEventParams *hijing_pars) { m_particles_processed++; @@ -653,7 +653,7 @@ void AddFlowByShifting::p_Pb_cent_eta_indep(double /*b*/, double /*eta*/, double -void AddFlowByShifting::Set_EbE_Fluctuation_Multipliers(HepMC::GenVertex* mainvtx,float b){ +void AddFlowByShifting::Set_EbE_Fluctuation_Multipliers(HepMC::GenVertexPtr mainvtx,float b){ int Total_Multiplicity=0; double EbE_Vn[6]; for(int ihar=0;ihar<6;ihar++){m_EbE_Multiplier_vn[ihar]=1.0;EbE_Vn[ihar]=0.0;} diff --git a/Generators/FlowAfterburner/src/CheckFlow.cxx b/Generators/FlowAfterburner/src/CheckFlow.cxx index 16aa3b937fd8b8f9d7431bd98c0fd91170d3df0c..fa82725443b629f9272e32b65f6521e8b0f93a6d 100644 --- a/Generators/FlowAfterburner/src/CheckFlow.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow.cxx @@ -28,7 +28,7 @@ using namespace TruthHelper; -typedef std::vector<const HepMC::GenParticle*> MCparticleCollection ; +typedef std::vector<const HepMC::GenParticlePtr> MCparticleCollection ; CheckFlow::CheckFlow(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), @@ -212,7 +212,7 @@ StatusCode CheckFlow::execute() { // Iterate over MC particles We are using the IsGenStable predicate from // IsGenStable ifs; GenAll ifs; - std::vector<const HepMC::GenParticle*> particles; + MCParticleCollection particles; StatusCode stat = m_tesIO->getMC(particles, &ifs, m_key); if (stat.isFailure()) { msg(MSG::ERROR) << "Could not find " << m_key << endmsg; diff --git a/Generators/FlowAfterburner/src/CheckFlow_New.cxx b/Generators/FlowAfterburner/src/CheckFlow_New.cxx index b87f93899129e8f5f055b84f019c3871663a305f..d2e3456df4848df546b0a923441194b5bd3335a0 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New.cxx @@ -280,7 +280,7 @@ StatusCode CheckFlow_New::execute() { // Iterate over all MC particles GenAll ifs; - std::vector<const HepMC::GenParticle*> particles; + MCParticleCollection particles; StatusCode stat = m_tesIO->getMC(particles, &ifs, m_key); if (stat.isFailure()) { msg(MSG::ERROR) << "Could not find " << m_key << endmsg; diff --git a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx index 5c5b5b33b759fa02bf6dc464805f65e288cd292e..ffe7b94b8ecfa95fab0b626744313f91e6a05bf6 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx @@ -39,7 +39,7 @@ using namespace TruthHelper; -typedef std::vector<const HepMC::GenParticle*> MCparticleCollection ; +//typedef std::vector<const HepMC::GenParticlePtr> MCParticleCollection ; CheckFlow_New_Minbias::CheckFlow_New_Minbias(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) @@ -259,7 +259,7 @@ StatusCode CheckFlow_New_Minbias::execute() { // Iterate over MC particles We are using the IsGenStable predicate from IsGenStable ifs; GenAll ifs; - std::vector<const HepMC::GenParticle*> particles; + MCParticleCollection particles; CHECK(m_tesIO->getMC(particles, &ifs, m_key)); for (auto pitr: particles) { diff --git a/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h b/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h index 95623a3d13663e86f12c9fe83853801eb1c2683b..185ee8d16655445fb6c8bd43012cdbd0bf6d49dc 100755 --- a/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h +++ b/Generators/GenAnalysisTools/EventBoost/EventBoost/EventBoost.h @@ -46,8 +46,8 @@ public: StatusCode AnalyseGenEvent(const HepMC::GenEvent*); StatusCode EventCopy(const HepMC::GenEvent* evt) const; - bool doModification(HepMC::GenParticle * part, double& pxsum); - bool doVertexModification(HepMC::GenVertex * ver, double rand_x, double rand_y, double rand_z); + bool doModification(HepMC::GenParticlePtr part, double& pxsum); + bool doVertexModification(HepMC::GenVertexPtr ver, double rand_x, double rand_y, double rand_z); private: diff --git a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx index a891dd975433afd1b309b53ab883f6e5665f9ebd..897182b6423b20ac2ad6a2e003819a0ef7901918 100755 --- a/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx +++ b/Generators/GenAnalysisTools/EventBoost/src/EventBoost.cxx @@ -172,10 +172,10 @@ StatusCode EventBoost::AnalyseGenEvent(const HepMC::GenEvent* genEvt) { msg(MSG::VERBOSE) << "EventBoost begin AnalyseGenEvent()" << endmsg; + std::vector<HepMC::GenParticlePtr> particles_needing_modification; HepMC::GenEvent::particle_const_iterator p = genEvt->particles_begin(); HepMC::GenEvent::particle_const_iterator pEnd = genEvt->particles_end(); - std::vector<HepMC::GenParticle*> particles_needing_modification; for(; p != pEnd; ++p ) { particles_needing_modification.push_back(*p); @@ -194,7 +194,7 @@ StatusCode EventBoost::AnalyseGenEvent(const HepMC::GenEvent* genEvt) { if ((m_gaussian_vertex_smearing)||(m_flat_vertex_smearing)) { - std::vector<HepMC::GenVertex*> vertices_needing_modification; + std::vector<HepMC::GenVertexPtr> vertices_needing_modification; HepMC::GenEvent::vertex_const_iterator v = genEvt->vertices_begin(); HepMC::GenEvent::vertex_const_iterator vEnd = genEvt->vertices_end(); @@ -256,7 +256,7 @@ StatusCode EventBoost::AnalyseGenEvent(const HepMC::GenEvent* genEvt) { //__________________________________________________________________________ -bool EventBoost::doModification(HepMC::GenParticle * part, double& pxsum ) { +bool EventBoost::doModification(HepMC::GenParticlePtr part, double& pxsum ) { /* From px' = gamma_x*px+beta_x*gamma_x*E @@ -290,7 +290,7 @@ bool EventBoost::doModification(HepMC::GenParticle * part, double& pxsum ) { //__________________________________________________________________________ -bool EventBoost::doVertexModification(HepMC::GenVertex * ver, double rand_x, double rand_y, double rand_z ) { +bool EventBoost::doVertexModification(HepMC::GenVertexPtr ver, double rand_x, double rand_y, double rand_z ) { CLHEP::HepLorentzVector vertex(ver->position().x(), ver->position().y(), diff --git a/Generators/GenAnalysisTools/TruthHelper/TruthHelper/GenAccessIO.h b/Generators/GenAnalysisTools/TruthHelper/TruthHelper/GenAccessIO.h index f184b88cd0b926804ff90ad34f808cf7439d7602..c4415887c5d4efd9a17284c3d45f135e270693ef 100644 --- a/Generators/GenAnalysisTools/TruthHelper/TruthHelper/GenAccessIO.h +++ b/Generators/GenAnalysisTools/TruthHelper/TruthHelper/GenAccessIO.h @@ -37,8 +37,8 @@ namespace TruthHelper { } } - StatusCode getMC(std::vector<const HepMC::GenParticle*>& mc, const std::string& key="GEN_EVENT") const; - StatusCode getMC(std::vector<const HepMC::GenParticle*>& mc, + StatusCode getMC(MCParticleCollection& mc, const std::string& key="GEN_EVENT") const; + StatusCode getMC(MCParticleCollection& mc, const GenIMCselector* selector, const std::string& key="GEN_EVENT") const; StatusCode getDH(const McEventCollection*& dh) const { diff --git a/Generators/GenAnalysisTools/TruthHelper/TruthHelper/PileUpType.icc b/Generators/GenAnalysisTools/TruthHelper/TruthHelper/PileUpType.icc index 6a8a944969b2ef308ac24374eedfb7a6afc3c936..08fe012085ef05c46425db784c3db832c4736b80 100644 --- a/Generators/GenAnalysisTools/TruthHelper/TruthHelper/PileUpType.icc +++ b/Generators/GenAnalysisTools/TruthHelper/TruthHelper/PileUpType.icc @@ -62,11 +62,11 @@ void PileUpType::particles_in_two_bunch_crossings( std::vector<const HepMC::GenP for (unsigned int i=1; i<colSize; ++i) { // start of the out-of-time in [-2BC,+2BC] - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) istart=i+1; + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1; if ( i >= istart ) { // end of the out-of-time in [-2BC,+2BC] - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) { iend=i-1; break; @@ -97,15 +97,15 @@ void PileUpType::particles_outside_two_bunch_crossings( std::vector<const HepMC: for (unsigned int i=1; i<colSize; ++i) { // start of the out-of-time in [-2BC, +2BC] - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) istart=i+1; + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1; if ( i >= istart ) { // start of the out-of-time in [-Inf,-2BC] and [+2BC,+Inf] - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) istart=i+1; + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i+1; if ( i >= istart ) { // end of the out-of-time in [-Inf,-2BC] and [+2Bc,+Inf] - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) { iend=i-1; break; @@ -136,7 +136,7 @@ void PileUpType::cavern_background_particles( std::vector<const HepMC::GenPartic for (unsigned int i=1; i<colSize; ++i) { // the cavern is at the end so, the last of this condition is the start of the cavern - if ( (m_particleList->at(i))->event_number() == -1 && (m_particleList->at(i))->signal_process_id() == 0 ) istart=i; + if ( (m_particleList->at(i))->event_number() == -1 && HepMC::signal_process_id(m_particleList->at(i)) == 0 ) istart=i; } /** collect the cavern background particles */ diff --git a/Generators/GenAnalysisTools/TruthHelper/src/IsGenerator.cxx b/Generators/GenAnalysisTools/TruthHelper/src/IsGenerator.cxx index 2509412a51567139e66fe77d09aa1e82f928330c..f7138840d01f18f304d2023414325019db6bdc81 100644 --- a/Generators/GenAnalysisTools/TruthHelper/src/IsGenerator.cxx +++ b/Generators/GenAnalysisTools/TruthHelper/src/IsGenerator.cxx @@ -9,7 +9,7 @@ namespace TruthHelper { bool IsGenerator::operator()(const HepMC::GenParticle* const p ) const { - return p->barcode() < 200000 && + return HepMC::barcode(p) < 200000 && (p->status() < 200 || p->status() % 1000 == 1 || p->status() % 1000 == 2 || p->status() == 10902); diff --git a/Generators/GenAnalysisTools/TruthHelper/src/PileUpType.cxx b/Generators/GenAnalysisTools/TruthHelper/src/PileUpType.cxx index 6dc641e4fbb142ffdc082feac1ab140af7cdbb9b..2ff8c2f01f8f98ef4f62b5022e63f256c264262c 100644 --- a/Generators/GenAnalysisTools/TruthHelper/src/PileUpType.cxx +++ b/Generators/GenAnalysisTools/TruthHelper/src/PileUpType.cxx @@ -31,7 +31,7 @@ McEventCollection::const_iterator PileUpType::in_time_minimum_bias_event_end() c McEventCollection::const_iterator ibegin = m_particleList->begin(); McEventCollection::const_iterator iend = m_particleList->end(); for ( ; ibegin != iend; ++ibegin ) { - if ( (*ibegin)->event_number() == -1 && (*ibegin)->signal_process_id() == 0 ) break; + if ( (*ibegin)->event_number() == -1 && HepMC::signal_process_id(*ibegin) == 0 ) break; } return ibegin; } diff --git a/Generators/GenAnalysisTools/TruthTools/CMakeLists.txt b/Generators/GenAnalysisTools/TruthTools/CMakeLists.txt index f5e189cab598851055bd95be485b503e402b46d0..155e8c5703ffa920d8f3e8b9355a4755e5c1be84 100644 --- a/Generators/GenAnalysisTools/TruthTools/CMakeLists.txt +++ b/Generators/GenAnalysisTools/TruthTools/CMakeLists.txt @@ -23,7 +23,7 @@ atlas_add_component( TruthTools src/TruthSelector.cxx src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel GeneratorObjects TruthUtils ) + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel GeneratorObjects TruthUtils GenInterfacesLib ) # Install files from the package: atlas_install_headers( TruthTools ) diff --git a/Generators/GenAnalysisTools/TruthTools/TruthTools/TruthSelector.h b/Generators/GenAnalysisTools/TruthTools/TruthTools/TruthSelector.h index 87dfda9aefba2cc3e110cd30a028350ef00ff90c..be7c494f663ef1feeaa16f782a8e1096e1547445 100644 --- a/Generators/GenAnalysisTools/TruthTools/TruthTools/TruthSelector.h +++ b/Generators/GenAnalysisTools/TruthTools/TruthTools/TruthSelector.h @@ -49,8 +49,8 @@ public: const std::vector<int>& reconstructableSecondaries(double minPt); private: - bool selectParticle (const HepMC::GenParticle& particle, double minPt); - + bool selectParticle (const HepMC::GenParticle* particle, double minPt); + bool selectParticle (const HepMC::GenParticle& particle, double minPt){ return selectParticle(&particle,minPt); }; std::vector<int> m_barcodes; std::map<int,int> m_indetKineMap; double m_maxEta; diff --git a/Generators/GenAnalysisTools/TruthTools/src/TruthSelector.cxx b/Generators/GenAnalysisTools/TruthTools/src/TruthSelector.cxx index 7faa7c9ddc2010b5cf60f4453c9e4e376af27f37..5a3cc35744fb27641da5c5684015682ae05fe5a9 100644 --- a/Generators/GenAnalysisTools/TruthTools/src/TruthSelector.cxx +++ b/Generators/GenAnalysisTools/TruthTools/src/TruthSelector.cxx @@ -56,19 +56,19 @@ TruthSelector::TruthSelector (const std::string& type, const std::string& name, TruthSelector::~TruthSelector() { } -bool TruthSelector::selectParticle (const HepMC::GenParticle& particle, double minPt) { +bool TruthSelector::selectParticle (const HepMC::GenParticle* particle, double minPt) { // skip null barcode - int barCode = particle.barcode(); + int barCode = HepMC::barcode(particle); if (barCode == 0) return false; // G4 uses helper to select particle in final state. /// @note Temporary cut at 0.1mm for non-final state particles while truth helpers get sorted /// @todo Why this cut? Won't this exclude B decay products? - if (particle.production_vertex() && particle.production_vertex()->position().perp() < 0.1*Gaudi::Units::mm && ! MC::isGenStable(&particle)) return false; + if (particle->production_vertex() && particle->production_vertex()->position().perp() < 0.1*Gaudi::Units::mm && ! MC::isGenStable(particle)) return false; if (barCode >= 10100) return false; //< @todo Why? // known particle - int pdgCode = particle.pdg_id(); + int pdgCode = particle->pdg_id(); if (pdgCode == 0) return false; // charged particle @@ -76,7 +76,7 @@ bool TruthSelector::selectParticle (const HepMC::GenParticle& particle, double m if (! particleData || particleData->charge() == 0.) return false; // momentum and eta cut-offs - if (particle.momentum().perp() < minPt || std::abs(particle.momentum().pseudoRapidity()) > m_maxEta) return false; + if (particle->momentum().perp() < minPt || std::abs(particle->momentum().pseudoRapidity()) > m_maxEta) return false; return true; } @@ -132,9 +132,9 @@ const std::map<int,int>& TruthSelector::indetKineMap() { int kine = 0; // temporary for G4: kine == barcode - kine = (**particle).barcode(); + kine = HepMC::barcode(**particle); - m_indetKineMap[kine] = (**particle).barcode(); + m_indetKineMap[kine] = HepMC::barcode(**particle); } return m_indetKineMap; } @@ -166,7 +166,7 @@ TruthSelector::indetMuons (double minPt) if (startVertex.perp() > m_maxRIndet || std::abs(startVertex.z()) > m_maxZIndet) continue; - m_barcodes.push_back((**particle).barcode()); + m_barcodes.push_back(HepMC::barcode(**particle)); ATH_MSG_DEBUG(" select barcode #" << m_barcodes.size() << " at production vertex R,Z " << startVertex.perp() << ", " << startVertex.z() ); @@ -242,7 +242,7 @@ TruthSelector::reconstructablePrimaries (double minPt) } ATH_MSG_DEBUG( std::setiosflags(std::ios::fixed) << std::setw(6) << m_barcodes.size() - << " barcode" << std::setw(7) << (**particle).barcode() + << " barcode" << std::setw(7) << HepMC::barcode(**particle) << " start/end vertex R,Z" << std::setw(5) << std::setprecision(1) << startVertex.perp() << ", " << std::setw(6) << std::setprecision(1) << startVertex.z() << " / " @@ -259,7 +259,7 @@ TruthSelector::reconstructablePrimaries (double minPt) << mass/Gaudi::Units::GeV ); } - m_barcodes.push_back((**particle).barcode()); + m_barcodes.push_back(HepMC::barcode(**particle)); } return m_barcodes; } @@ -316,7 +316,7 @@ TruthSelector::reconstructableSecondaries (double minPt) } ATH_MSG_DEBUG( std::setiosflags(std::ios::fixed) << std::setw(6) << m_barcodes.size() - << " barcode" << std::setw(7) << (**particle).barcode() + << " barcode" << std::setw(7) << HepMC::barcode(**particle) << " start/end vertex R,Z" << std::setw(5) << std::setprecision(1) << startVertex.perp() << ", " << std::setw(6) << std::setprecision(1) << startVertex.z() << " / " @@ -333,7 +333,7 @@ TruthSelector::reconstructableSecondaries (double minPt) << mass/Gaudi::Units::GeV ); } - m_barcodes.push_back((**particle).barcode()); + m_barcodes.push_back(HepMC::barcode(**particle)); } return m_barcodes; } diff --git a/Generators/GenInterfaces/CMakeLists.txt b/Generators/GenInterfaces/CMakeLists.txt index d37350aaf381e8e25bbc9c2ce285592dee5d6b4b..01a1961f64cd36466aed0aadb52180326fff2a89 100644 --- a/Generators/GenInterfaces/CMakeLists.txt +++ b/Generators/GenInterfaces/CMakeLists.txt @@ -8,7 +8,6 @@ atlas_depends_on_subdirs( GaudiKernel ) # External dependencies: -find_package( HepMC ) # Component(s) in the package: atlas_add_library( GenInterfacesLib diff --git a/Generators/GeneratorFilters/GeneratorFilters/BSignalFilter.h b/Generators/GeneratorFilters/GeneratorFilters/BSignalFilter.h index 8f17540c16d16ac496da91d5723461317e082174..c0731cdfc0c067629d5012a1d8d5612e74041ad6 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/BSignalFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/BSignalFilter.h @@ -65,23 +65,23 @@ class BSignalFilter : public GenFilter // ** Private member functions ** // Find child - void FindAllChildren(const HepMC::GenParticle* mother,std::string treeIDStr, + void FindAllChildren(const HepMC::GenParticlePtr mother,std::string treeIDStr, bool fromFinalB, bool &foundSignal, bool &passedAllCuts, TLorentzVector &p1, TLorentzVector &p2, bool fromSelectedB) const; // Check whether child has pass cuts - bool FinalStatePassedCuts(const HepMC::GenParticle* child) const; + bool FinalStatePassedCuts(const HepMC::GenParticlePtr child) const; // Test whether final states pass cuts bool test_cuts(const double myPT, const double testPT, const double myEta, const double testEta) const; // LVL1 and LVL2 cuts - bool LVL1_Mu_Trigger(const HepMC::GenParticle* child) const; - bool LVL2_eMu_Trigger(const HepMC::GenParticle* child) const; + bool LVL1_Mu_Trigger(const HepMC::GenParticlePtr child) const; + bool LVL2_eMu_Trigger(const HepMC::GenParticlePtr child) const; // Print child (for debug) - void PrintChild(const HepMC::GenParticle* child, const std::string treeIDStr, const bool fromFinalB) const; + void PrintChild(const HepMC::GenParticlePtr child, const std::string treeIDStr, const bool fromFinalB) const; }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/BSubstruct.h b/Generators/GeneratorFilters/GeneratorFilters/BSubstruct.h index 9d92f8e6cc791ffb38ab47685747c25c2dc46099..ab0c3a86200e0dfaf24016bb8017b22ba169c405 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/BSubstruct.h +++ b/Generators/GeneratorFilters/GeneratorFilters/BSubstruct.h @@ -9,7 +9,7 @@ #include "xAODJet/Jet.h" class TH1; -typedef std::vector<const HepMC::GenParticle*> Particles; +typedef std::vector<HepMC::GenParticlePtr> Particles; class BSubstruct : public GenFilter{ public: @@ -31,14 +31,14 @@ private: * Recursively calls itself to return a list of all particles earlier in the * decay chain that are c or b-flavoured. */ - Particles ancestorCBs(const HepMC::GenParticle* p)const; + Particles ancestorCBs(const HepMC::GenParticlePtr p)const; /// the delta-r between two vectors at y, phi double deltaR(double y1, double phi1, double y2, double phi2)const; /// the delta-r between a jet an a hadron - double deltaR(const HepMC::GenParticle *particle, const xAOD::Jet *jet)const; + double deltaR(const HepMC::GenParticlePtr particle, const xAOD::Jet *jet)const; /// the delta-r between two hadrons - double deltaR(const HepMC::GenParticle *particle1, const HepMC::GenParticle *particle2)const; + double deltaR(const HepMC::GenParticlePtr particle1, const HepMC::GenParticlePtr particle2)const; /// the delta-r between two jets double deltaR(const xAOD::Jet*, const xAOD::Jet*)const; // the delta-phi of two angles, returned in the range 0-Pi diff --git a/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h b/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h index 94ab2767a654033eeee16a77f04f14976749b716..59b64dbc7556796fa2cc99511a0ee93c9e914934 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h +++ b/Generators/GeneratorFilters/GeneratorFilters/BoostedHadTopAndTopPair.h @@ -55,11 +55,11 @@ private: double m_tPairPtMax; int m_cutPtOf; - const HepMC::GenParticle* findInitial(const HepMC::GenParticle* part) const; - bool isFromTop(const HepMC::GenParticle* part) const; - bool isHadronic(const HepMC::GenParticle* part) const; - bool isFinalParticle(const HepMC::GenParticle* part) const; - HepMC::FourVector momentumBofW(const HepMC::GenParticle* part); + HepMC::ConstGenParticlePtr findInitial(HepMC::ConstGenParticlePtr part) const; + bool isFromTop(HepMC::ConstGenParticlePtr part) const; + bool isHadronic(HepMC::ConstGenParticlePtr part) const; + bool isFinalParticle(HepMC::ConstGenParticlePtr part) const; + HepMC::FourVector momentumBofW(HepMC::ConstGenParticlePtr part); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h b/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h index 3afcca29edbb36ae3e35a95cb6a5918e0f8a3932..8ac4f904d67a815a3e58a700e5cff90939a655a8 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h @@ -59,9 +59,9 @@ private: private: - std::string printChain(HepMC::GenParticle* parent) const; - void analyzeChain(HepMC::GenParticle* parent, bool&, bool&, bool&, bool& ); - void countChain(HepMC::GenParticle* parent, int& length, int& Nchi2, int& NW,int& NZ,int& NH, int& Nse, int& Nsmu, int& Nstau, int& nChargedLeptons, int& nSMParticles) const; + std::string printChain(HepMC::GenParticlePtr parent) const; + void analyzeChain(HepMC::GenParticlePtr parent, bool&, bool&, bool&, bool& ); + void countChain(HepMC::GenParticlePtr parent, int& length, int& Nchi2, int& NW,int& NZ,int& NH, int& Nse, int& Nsmu, int& Nstau, int& nChargedLeptons, int& nSMParticles) const; void countPIDs(int sparticle_PDG, int SM_PDG, int& Nchi2, int& NW, int& NZ, int& NH, int& Nse, int& Nsmu, int& Nstau, int& nChargedLeptons) const; }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/DstD0K3piFilter.h b/Generators/GeneratorFilters/GeneratorFilters/DstD0K3piFilter.h index aafc78ef1d41f47d7ce414afc53dffca448c269d..84adc3da8d67f70a563f24e2c4101f044c2eb33c 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/DstD0K3piFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/DstD0K3piFilter.h @@ -37,8 +37,8 @@ public: private: - bool CheckChildLundId(HepMC::GenParticle* mcpart, int nth, int chLundId); // Check lundId of Nth(0 or 1) children from mcpart... - bool IsCandidate(std::vector<float>& lundIds, std::vector<HepMC::GenParticle*>& genParticles); // Is Candidate among 6 intermediate state?? + bool CheckChildLundId(HepMC::GenParticlePtr mcpart, unsigned int nth, int chLundId); // Check lundId of Nth(0 or 1) children from mcpart... + bool IsCandidate(std::vector<float>& lundIds, std::vector<HepMC::GenParticlePtr>& genParticles); // Is Candidate among 6 intermediate state?? double m_Ptmin; double m_EtaRange; diff --git a/Generators/GeneratorFilters/GeneratorFilters/HTFilter.h b/Generators/GeneratorFilters/GeneratorFilters/HTFilter.h index 44a7c1f6af1dbb761832cf0fbe1a47112566adb6..e89acf18ad75c2151e8264e5b89a1f7e86bd6180 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/HTFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/HTFilter.h @@ -22,8 +22,8 @@ public: virtual StatusCode filterFinalize(); virtual StatusCode filterEvent(); - bool fromTau( const HepMC::GenParticle* tp ) const; - bool fromWZ( const HepMC::GenParticle* tp ) const; + bool fromTau( const HepMC::GenParticlePtr tp ) const; + bool fromWZ( const HepMC::GenParticlePtr tp ) const; private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/MissingEtFilter.h b/Generators/GeneratorFilters/GeneratorFilters/MissingEtFilter.h index e4f31141b6572981071d490aa147cef820e740c1..bfe99b0ba369009c60e262c4eff1b795d09d644d 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/MissingEtFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/MissingEtFilter.h @@ -15,8 +15,8 @@ public: MissingEtFilter(const std::string& name, ISvcLocator* pSvcLocator); virtual StatusCode filterEvent(); - bool fromTau( const HepMC::GenParticle* tp ) const; - bool fromWZ( const HepMC::GenParticle* tp ) const; + bool fromTau( const HepMC::GenParticlePtr tp ) const; + bool fromWZ( const HepMC::GenParticlePtr tp ) const; private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h b/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h index 9f6b63d5bc4174453d9b74a44b8b0a8c2a847596..69c683e2c09ea5a5c95ca2e55ee24147136b1463 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h @@ -17,8 +17,8 @@ public: protected: - bool isElectron(const HepMC::GenParticle* p) const; - bool isParton(const HepMC::GenParticle* p) const; + bool isElectron(HepMC::GenParticlePtr p) const; + bool isParton(HepMC::GenParticlePtr p) const; private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h index 4802aabba2a7521f9e797b3edb9265bc0c75ed88..e6b088910771c73f8ee1f054762ffcf45122c665 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/TTbarPlusHeavyFlavorFilter.h @@ -47,28 +47,28 @@ private: bool m_excludeCFromTop; - bool passBSelection(const HepMC::GenParticle* part) const; - bool passCSelection(const HepMC::GenParticle* part) const; + bool passBSelection(const HepMC::GenParticlePtr part) const; + bool passCSelection(const HepMC::GenParticlePtr part) const; int hadronType(int pdgid) const; - bool isBHadron(const HepMC::GenParticle* part) const; - bool isCHadron(const HepMC::GenParticle* part) const; + bool isBHadron(const HepMC::GenParticlePtr part) const; + bool isCHadron(const HepMC::GenParticlePtr part) const; - bool isInitialHadron(const HepMC::GenParticle* part) const; - bool isFinalHadron(const HepMC::GenParticle* part) const; + bool isInitialHadron(const HepMC::GenParticlePtr part) const; + bool isFinalHadron(const HepMC::GenParticlePtr part) const; - bool isQuarkFromHadron(const HepMC::GenParticle* part) const; - bool isCHadronFromB(const HepMC::GenParticle* part) const; + bool isQuarkFromHadron(const HepMC::GenParticlePtr part) const; + bool isCHadronFromB(const HepMC::GenParticlePtr part) const; /// init_part needed to detect looping graphs (sherpa) and to switch on using barcode to resolve it without affecting pythia8 /// up to know only seen at parton level - bool isLooping(const HepMC::GenParticle* part, std::set<const HepMC::GenParticle*> init_part = std::set<const HepMC::GenParticle*>()) const; + bool isLooping(const HepMC::GenParticlePtr part, std::set<HepMC::GenParticlePtr> init_part = std::set<HepMC::GenParticlePtr>()) const; - const HepMC::GenParticle* findInitial(const HepMC::GenParticle* part, bool looping) const; + HepMC::ConstGenParticlePtr findInitial(HepMC::ConstGenParticlePtr part, bool looping) const; - bool isFromTop(const HepMC::GenParticle* part, bool looping) const; - bool isDirectlyFromTop(const HepMC::GenParticle* part, bool looping) const; - bool isDirectlyFromWTop(const HepMC::GenParticle* part, bool looping) const; + bool isFromTop(const HepMC::GenParticlePtr part, bool looping) const; + bool isDirectlyFromTop(const HepMC::GenParticlePtr part, bool looping) const; + bool isDirectlyFromWTop(const HepMC::GenParticlePtr part, bool looping) const; diff --git a/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h index 0617a65ec50dba6f2f5a8eef55cae804744f1dd1..245ab02d476314a9e09ce9c877e216fb344942b3 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h @@ -18,7 +18,7 @@ public: StatusCode filterFinalize(); StatusCode filterEvent(); - CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::GenParticle *tau ); + CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::GenParticlePtr tau ); private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h index 07b488c2c2f5746b0dbf065af8fb196bdd2c47fd..55012480b5bb302b93e0691ddb9ce97e01bdaf5f 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h @@ -40,7 +40,7 @@ private: int m_nGoodHtoVV; int m_nGoodHtoVVSameCharge; - bool findAncestor(const HepMC::GenVertex* searchvertex, + bool findAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h index 4b1323b5f4d4e0b0773c5fd2cea1b639979f9066..9d779a37014ebcbf49400ca00f7ba9a0b367fe0b 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h @@ -40,12 +40,12 @@ private: std::string m_TruthJetContainerName; - CLHEP::HepLorentzVector sumDaughterNeutrinos(HepMC::GenParticle* tau); + CLHEP::HepLorentzVector sumDaughterNeutrinos(HepMC::GenParticlePtr tau); void removePseudoJets(std::vector<const xAOD::Jet*>& jetList, - std::vector<HepMC::GenParticle*>& MCTruthPhotonList, - std::vector<HepMC::GenParticle*>& MCTruthElectronList, + std::vector<HepMC::GenParticlePtr>& MCTruthPhotonList, + std::vector<HepMC::GenParticlePtr>& MCTruthElectronList, std::vector<CLHEP::HepLorentzVector*> & MCTruthTauList); - double getMinDeltaR(const xAOD::Jet* jet, std::vector<HepMC::GenParticle*>& list); + double getMinDeltaR(const xAOD::Jet* jet, std::vector<HepMC::GenParticlePtr>& list); double getMinDeltaR(const xAOD::Jet* jet, std::vector<CLHEP::HepLorentzVector*>& list); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h index 54dc51fe82f97522e97435c8b79e55530da78646..04b4519f27d5e1ba942e445cfd512397f27b377b 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h @@ -48,9 +48,9 @@ private: bool m_taujetoverlap; double m_alpha; - bool checkOverlap(double, double, std::vector<HepMC::GenParticle*>); + bool checkOverlap(double, double, std::vector<HepMC::GenParticlePtr>); bool checkOverlap(double, double, std::vector<CLHEP::HepLorentzVector*>); - CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::GenParticle* ); + CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::GenParticlePtr ); public: diff --git a/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h index b95194a1e321a3c6f0bff482d12805efe17e46a1..2886150e441acc47fc2462a4682ce8b0021acc05 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h @@ -36,7 +36,7 @@ private: int m_nVHtoVV; int m_nGoodVHtoVV; - void findAncestor(const HepMC::GenVertex* searchvertex, + void findAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, int& n_okPDGChild); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/WeightedBDtoElectronFilter.h b/Generators/GeneratorFilters/GeneratorFilters/WeightedBDtoElectronFilter.h index 8624dd88820a0bd051afedfba1ffe9d2e71f9ba5..4065972434005740da02b89edf85725e02dd2ef3 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/WeightedBDtoElectronFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/WeightedBDtoElectronFilter.h @@ -25,7 +25,7 @@ public: private: /// Check if the particle has a B hadron as parent or ancestor - const HepMC::GenParticle* FindBParent(const HepMC::GenParticle* part); + HepMC::ConstGenParticlePtr FindBParent(HepMC::ConstGenParticlePtr part); /// Generate random number an check if electron passes the prescale weight bool PassPrescaleCheck( double etaAbs, double pt ); diff --git a/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilter.h b/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilter.h index 6dc0cf20d7f3c2e04e265668f7676294d6c7fc59..6a52d6c9ade5a0898557b15a999465936343af9d 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilter.h @@ -32,7 +32,7 @@ private: int m_nHtoVV; int m_nGoodHtoVV; - void FindAncestor(const HepMC::GenVertex* searchvertex, + void FindAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, bool& okPDGChild1, bool& okPDGChild2); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilterExtended.h b/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilterExtended.h index 149e741d9140918798aa67a4a1320edbc96d2397..a76fe1ad07d59a123a831ea00f0c5ebdb0ccc1cc 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilterExtended.h +++ b/Generators/GeneratorFilters/GeneratorFilters/XtoVVDecayFilterExtended.h @@ -35,10 +35,10 @@ private: int m_nHtoVV; int m_nGoodHtoVV; - void FindAncestor(const HepMC::GenVertex* searchvertex, + void FindAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, bool& okPDGChild1, bool& okPDGChild2); - HepMC::GenParticle * CheckGrandparent(HepMC::GenParticle *pitr, int &); - bool RunHistory(HepMC::GenParticle *pitr); + HepMC::GenParticlePtr CheckGrandparent(HepMC::GenParticlePtr pitr, int &); + bool RunHistory(HepMC::GenParticlePtr pitr); }; #endif diff --git a/Generators/GeneratorFilters/src/ATauFilter.cxx b/Generators/GeneratorFilters/src/ATauFilter.cxx index 5cf43e89c9ccc34042abcfe0d6faa1d99d0dca06..443f1f8cebf8ce10477e0b29e5f439fa0765fe97 100644 --- a/Generators/GeneratorFilters/src/ATauFilter.cxx +++ b/Generators/GeneratorFilters/src/ATauFilter.cxx @@ -50,12 +50,12 @@ StatusCode ATauFilter::filterFinalize() { StatusCode ATauFilter::filterEvent() { - HepMC::GenParticle *tau; - HepMC::GenParticle *atau; - HepMC::GenParticle *nutau; - HepMC::GenParticle *anutau; - HepMC::GenParticle *taulep; - HepMC::GenParticle *ataulep; + HepMC::GenParticlePtr tau; + HepMC::GenParticlePtr atau; + HepMC::GenParticlePtr nutau; + HepMC::GenParticlePtr anutau; + HepMC::GenParticlePtr taulep; + HepMC::GenParticlePtr ataulep; CLHEP::HepLorentzVector mom_tauprod; // will contain the momentum of the products of the tau decay CLHEP::HepLorentzVector mom_atauprod; // calculated with mom_tauprod = mom_tau - mom_nutau @@ -98,7 +98,7 @@ StatusCode ATauFilter::filterEvent() { // If tau was already found look for his nu if ( ( tau != 0 ) && ( (*pitr)->pdg_id() == 16 ) ) { if ( tau->end_vertex() == (*pitr)->production_vertex() ) { - ATH_MSG_DEBUG("Found nutau with barcode " << (*pitr)->barcode() << " and pdg_id " << + ATH_MSG_DEBUG("Found nutau with barcode " << HepMC::barcode(*pitr) << " and pdg_id " << (*pitr)->pdg_id() << " pt=" << (*pitr)->momentum().perp()); nutau = (*pitr); } @@ -107,7 +107,7 @@ StatusCode ATauFilter::filterEvent() { // If atau was already found look for his anu if ( ( atau != 0 ) && ( (*pitr)->pdg_id() == -16 ) ) { if ( atau->end_vertex() == (*pitr)->production_vertex() ) { - ATH_MSG_DEBUG("Found anutau with barcode " << (*pitr)->barcode() << " and pdg_id " << + ATH_MSG_DEBUG("Found anutau with barcode " << HepMC::barcode(*pitr) << " and pdg_id " << (*pitr)->pdg_id() << " pt=" << (*pitr)->momentum().perp()); anutau = (*pitr); } @@ -116,7 +116,7 @@ StatusCode ATauFilter::filterEvent() { // if tau was already found look for his lepton if ( ( tau != 0 ) && ( ( (*pitr)->pdg_id() == 13 ) || ( (*pitr)->pdg_id() == 11 ) ) ) { if ( tau->end_vertex() == (*pitr)->production_vertex() ) { - ATH_MSG_DEBUG("Found tau-lepton with barcode " << (*pitr)->barcode() << " and pdg_id " << + ATH_MSG_DEBUG("Found tau-lepton with barcode " << HepMC::barcode(*pitr) << " and pdg_id " << (*pitr)->pdg_id() << " pt=" << (*pitr)->momentum().perp()); taulep = (*pitr); } @@ -125,7 +125,7 @@ StatusCode ATauFilter::filterEvent() { // If atau was already found look for his alepton if ( ( atau != 0 ) && ( ( (*pitr)->pdg_id() == -13 ) || ( (*pitr)->pdg_id() == -11 ) ) ) { if ( atau->end_vertex() == (*pitr)->production_vertex() ) { - ATH_MSG_DEBUG("Found atau-lepton with barcode " << (*pitr)->barcode() << " and pdg_id " << + ATH_MSG_DEBUG("Found atau-lepton with barcode " << HepMC::barcode(*pitr) << " and pdg_id " << (*pitr)->pdg_id() << " pt=" << (*pitr)->momentum().perp()); ataulep = (*pitr); } diff --git a/Generators/GeneratorFilters/src/BSignalFilter.cxx b/Generators/GeneratorFilters/src/BSignalFilter.cxx index 7632a1d0a4d1eed63b571e50c27356a92e9d0993..62b96f3828a360e72e386cf5cdcd31401903636a 100644 --- a/Generators/GeneratorFilters/src/BSignalFilter.cxx +++ b/Generators/GeneratorFilters/src/BSignalFilter.cxx @@ -107,7 +107,6 @@ StatusCode BSignalFilter::filterEvent() bool acceptEvent = true; const HepMC::GenEvent* genEvt = (*itr); - HepMC::GenEvent::particle_const_iterator pitr; // ** Check HepMC for particles activating LVL1 trigger, if that is what user wishes ** // @@ -117,13 +116,12 @@ StatusCode BSignalFilter::filterEvent() if ( m_localLVL1MuonCutOn ) { // - for( pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) - { + for(auto pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ){ bool LVL1Result = LVL1_Mu_Trigger( (*pitr) ); if ( LVL1Result ) { LVL1Passed = true; - LVL1MuonBarcode = (*pitr)->barcode(); // Remember the muon for LVL2 testing + LVL1MuonBarcode = HepMC::barcode(*pitr); // Remember the muon for LVL2 testing break; } } @@ -135,12 +133,12 @@ StatusCode BSignalFilter::filterEvent() // if ( LVL1Passed && (m_localLVL2MuonCutOn || m_localLVL2ElectronCutOn) ) { - for( pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) + for(auto pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) { bool LVL2Result = LVL2_eMu_Trigger( (*pitr) ); if ( LVL2Result ) { - if ( (*pitr)->barcode() != LVL1MuonBarcode ) // Check the particle triggering LVL2 isn't + if ( HepMC::barcode(*pitr) != LVL1MuonBarcode ) // Check the particle triggering LVL2 isn't LVL2Passed = true; // the muon that triggered LVL1 --> Artificial, // since, effectively, LVL2 trigger is not applied. // This is needed to "trigger" the 2nd muon! @@ -174,7 +172,7 @@ StatusCode BSignalFilter::filterEvent() // ** Reject event if an undecayed quark is found ** // - for( pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) + for(auto pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) { if ( abs((*pitr)->pdg_id()) <= 6 && (*pitr)->status() == 1 ) { @@ -191,7 +189,7 @@ StatusCode BSignalFilter::filterEvent() if ( LVL1Passed && LVL2Passed ) { // ** Loop on all particles ** - for( pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) + for(auto pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) { const int particleID = (*pitr)->pdg_id(); // @@ -363,7 +361,7 @@ bool BSignalFilter::test_cuts(const double myPT, const double testPT, } -bool BSignalFilter::LVL1_Mu_Trigger(const HepMC::GenParticle* child) const +bool BSignalFilter::LVL1_Mu_Trigger(const HepMC::GenParticlePtr child) const { bool accept = false; int pID = child->pdg_id(); @@ -378,7 +376,7 @@ bool BSignalFilter::LVL1_Mu_Trigger(const HepMC::GenParticle* child) const } -bool BSignalFilter::LVL2_eMu_Trigger(const HepMC::GenParticle* child) const +bool BSignalFilter::LVL2_eMu_Trigger(const HepMC::GenParticlePtr child) const { bool accept = false; int pID = child->pdg_id(); @@ -394,7 +392,7 @@ bool BSignalFilter::LVL2_eMu_Trigger(const HepMC::GenParticle* child) const } -void BSignalFilter::FindAllChildren(const HepMC::GenParticle* mother,std::string treeIDStr, +void BSignalFilter::FindAllChildren(const HepMC::GenParticlePtr mother,std::string treeIDStr, bool fromFinalB, bool &foundSignal, bool &passedAllCuts, TLorentzVector &p1, TLorentzVector &p2, bool fromSelectedB) const { @@ -428,10 +426,8 @@ void BSignalFilter::FindAllChildren(const HepMC::GenParticle* mother,std::string return; } } - - HepMC::GenVertex::particle_iterator firstChild, thisChild, lastChild; - firstChild = mother->end_vertex()->particles_begin(HepMC::children); - lastChild = mother->end_vertex()->particles_end(HepMC::children); + auto firstChild = mother->end_vertex()->particles_begin(HepMC::children); + auto lastChild = mother->end_vertex()->particles_end(HepMC::children); int childCnt = 0; std::string childIDStr; @@ -442,7 +438,7 @@ void BSignalFilter::FindAllChildren(const HepMC::GenParticle* mother,std::string { fromFinalB = true; int pID; - for( thisChild = firstChild; thisChild != lastChild++; ++thisChild) + for(auto thisChild = firstChild; thisChild != lastChild++; ++thisChild) { pID = (*thisChild)->pdg_id(); if( MC::PID::isBottomMeson(pID) || MC::PID::isBottomBaryon(pID) ) fromFinalB = false; @@ -450,7 +446,7 @@ void BSignalFilter::FindAllChildren(const HepMC::GenParticle* mother,std::string } // ** Main loop: iterate over all children, call method recursively. - for( thisChild = firstChild; thisChild != lastChild++; ++thisChild) + for( auto thisChild = firstChild; thisChild != lastChild++; ++thisChild) { childCnt++; stringstream childCntSS; childCntSS << childCnt; @@ -464,7 +460,7 @@ void BSignalFilter::FindAllChildren(const HepMC::GenParticle* mother,std::string } -bool BSignalFilter::FinalStatePassedCuts(const HepMC::GenParticle* child) const +bool BSignalFilter::FinalStatePassedCuts(const HepMC::GenParticlePtr child) const { bool accept = true; @@ -597,7 +593,7 @@ bool BSignalFilter::FinalStatePassedCuts(const HepMC::GenParticle* child) const } -void BSignalFilter::PrintChild(const HepMC::GenParticle* child, +void BSignalFilter::PrintChild(const HepMC::GenParticlePtr child, const std::string treeIDStr, const bool fromFinalB) const { int pID = child->pdg_id(); diff --git a/Generators/GeneratorFilters/src/BSubstruct.cxx b/Generators/GeneratorFilters/src/BSubstruct.cxx index ba9e92e4fd3417251964500afff9f7e6f4ed31ca..5d210e163bf42ff4bdb67af933d850e605ed5f46 100644 --- a/Generators/GeneratorFilters/src/BSubstruct.cxx +++ b/Generators/GeneratorFilters/src/BSubstruct.cxx @@ -64,7 +64,7 @@ inline double BSubstruct::deltaR(double y1, double phi1, double y2, double phi2) } -inline double BSubstruct::deltaR(const HepMC::GenParticle* particle1, const HepMC::GenParticle* particle2) const { +inline double BSubstruct::deltaR(const HepMC::GenParticlePtr particle1, const HepMC::GenParticlePtr particle2) const { double rap1 = 0.5 * log((particle1->momentum().e() + particle1->momentum().pz()) / (particle1->momentum().e() - particle1->momentum().pz())); double rap2 = 0.5 * log((particle2->momentum().e() + particle2->momentum().pz()) / @@ -73,7 +73,7 @@ inline double BSubstruct::deltaR(const HepMC::GenParticle* particle1, const Hep } -inline double BSubstruct::deltaR(const HepMC::GenParticle* particle, const xAOD::Jet* jet) const { +inline double BSubstruct::deltaR(const HepMC::GenParticlePtr particle, const xAOD::Jet* jet) const { // GenParticle does not provide rapidity (only pseudo-rapidity) // Since we are likely dealing with massive b-hadrons and massive jets // and the jet-clustering alg uses rapidity, I think we should use that @@ -88,9 +88,9 @@ inline double BSubstruct::deltaR(const xAOD::Jet* jet1, const xAOD::Jet* jet2) c } -inline Particles BSubstruct::ancestorCBs(const HepMC::GenParticle* p) const { +inline Particles BSubstruct::ancestorCBs(const HepMC::GenParticlePtr p) const { Particles parentBs; - const HepMC::GenVertex* vtx = p->production_vertex(); + const HepMC::GenVertexPtr vtx = p->production_vertex(); // If the particle has no production vertex then can only assume it is beam or similar // therefore return empty set of parents. @@ -164,7 +164,7 @@ StatusCode BSubstruct::filterInitialize() { StatusCode BSubstruct::filterEvent() { ++m_nEvents; - std::vector<const HepMC::GenParticle*> bHadrons; + std::vector<HepMC::GenParticlePtr> bHadrons; for (McEventCollection::const_iterator evt = events()->begin(); evt != events()->end(); ++evt) { if ((*evt) == 0) { // WTF? ++m_nRejected; diff --git a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx index 1928f85020e6f0a2831dd86b9a75ce9c545ea471..eea4606a4c5bde285a5aac135b3dd5f52da70753 100644 --- a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx +++ b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx @@ -51,7 +51,7 @@ StatusCode BoostedHadTopAndTopPair::filterEvent() { HepMC::GenEvent::particle_const_iterator pitr; for (pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) { - const HepMC::GenParticle* part = (*pitr); + HepMC::GenParticle* part = (*pitr); int pdgId = part->pdg_id(); // pdgId t quark = 6 @@ -100,10 +100,10 @@ StatusCode BoostedHadTopAndTopPair::filterEvent() { } -bool BoostedHadTopAndTopPair::isFromTop(const HepMC::GenParticle* part) const{ +bool BoostedHadTopAndTopPair::isFromTop(HepMC::ConstGenParticlePtr part) const{ - const HepMC::GenParticle* initpart = findInitial(part); - HepMC::GenVertex* prod = initpart->production_vertex(); + auto initpart = findInitial(part); + auto prod = initpart->production_vertex(); if(!prod) return false; @@ -117,9 +117,9 @@ bool BoostedHadTopAndTopPair::isFromTop(const HepMC::GenParticle* part) const{ } -const HepMC::GenParticle* BoostedHadTopAndTopPair::findInitial(const HepMC::GenParticle* part) const{ +HepMC::ConstGenParticlePtr BoostedHadTopAndTopPair::findInitial(HepMC::ConstGenParticlePtr part) const{ - HepMC::GenVertex* prod = part->production_vertex(); + auto prod = part->production_vertex(); if(!prod) return part; @@ -133,9 +133,9 @@ const HepMC::GenParticle* BoostedHadTopAndTopPair::findInitial(const HepMC::Gen } -bool BoostedHadTopAndTopPair::isHadronic(const HepMC::GenParticle* part) const{ +bool BoostedHadTopAndTopPair::isHadronic(HepMC::ConstGenParticlePtr part) const{ - HepMC::GenVertex* end = part->end_vertex(); + auto end = part->end_vertex(); HepMC::GenVertex::particle_iterator firstChild = end->particles_begin(HepMC::children); HepMC::GenVertex::particle_iterator endChild = end->particles_end (HepMC::children); @@ -147,9 +147,9 @@ bool BoostedHadTopAndTopPair::isHadronic(const HepMC::GenParticle* part) const{ } -bool BoostedHadTopAndTopPair::isFinalParticle(const HepMC::GenParticle* part) const{ +bool BoostedHadTopAndTopPair::isFinalParticle(HepMC::ConstGenParticlePtr part) const{ - HepMC::GenVertex* end = part->end_vertex(); + auto end = part->end_vertex(); if(end){ int type = part->pdg_id(); HepMC::GenVertex::particle_iterator firstChild = end->particles_begin(HepMC::children); @@ -164,10 +164,10 @@ bool BoostedHadTopAndTopPair::isFinalParticle(const HepMC::GenParticle* part) co } -HepMC::FourVector BoostedHadTopAndTopPair::momentumBofW(const HepMC::GenParticle* part){ +HepMC::FourVector BoostedHadTopAndTopPair::momentumBofW(HepMC::ConstGenParticlePtr part){ - const HepMC::GenParticle* initpart = findInitial(part); - HepMC::GenVertex* prod = initpart->production_vertex(); + auto initpart = findInitial(part); + auto prod = initpart->production_vertex(); HepMC::FourVector b(0,0,0,0); diff --git a/Generators/GeneratorFilters/src/DecayLengthFilter.cxx b/Generators/GeneratorFilters/src/DecayLengthFilter.cxx index 97b2b84cc3f0f435a5dc4a17a184c13f03626d4f..24044ba21a621d160a993d8a4fb7641ddf0f56f0 100644 --- a/Generators/GeneratorFilters/src/DecayLengthFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayLengthFilter.cxx @@ -55,8 +55,8 @@ StatusCode DecayLengthFilter::filterEvent() { break; } - HepMC::GenVertex* decayVertex = *vtx_iter; - HepMC::GenVertex* creationVertex = (*inParticle)->production_vertex(); + HepMC::GenVertexPtr decayVertex = *vtx_iter; + HepMC::GenVertexPtr creationVertex = (*inParticle)->production_vertex(); float distR = sqrt( pow(creationVertex->position().x() - decayVertex->position().x(),2) + pow(creationVertex->position().y() - decayVertex->position().y(),2) ); float distZ = creationVertex->position().z() - decayVertex->position().z(); diff --git a/Generators/GeneratorFilters/src/DecayModeFilter.cxx b/Generators/GeneratorFilters/src/DecayModeFilter.cxx index 131ad4b321b7d807e4321e32aa936b0ec3e5fff0..d8624c3c88f6ba809cd23907dc9220e8e2cdce13 100644 --- a/Generators/GeneratorFilters/src/DecayModeFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayModeFilter.cxx @@ -116,15 +116,15 @@ StatusCode DecayModeFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* theGenEvent = *(events()->begin()); - HepMC::GenEvent::vertex_const_iterator vtx_iter = theGenEvent->vertices_begin(); + HepMC::GenEvent::vertex_const_iterator vtx_begin = theGenEvent->vertices_begin(); HepMC::GenEvent::vertex_const_iterator vtx_end = theGenEvent->vertices_end(); - for (; vtx_iter!=vtx_end; ++vtx_iter) { + for (auto vtx_iter=vtx_begin; vtx_iter!=vtx_end; ++vtx_iter) { // Look for initial vertex if ((*vtx_iter)->particles_in_size() != 2) continue; if ((*vtx_iter)->particles_out_size() < 2) continue; - HepMC::GenVertex::particles_out_const_iterator outParticle = (*vtx_iter)->particles_out_const_begin(); - HepMC::GenParticle* parent1 = *outParticle; - HepMC::GenParticle* parent2 = *(++outParticle); + auto outParticle = (*vtx_iter)->particles_out_const_begin(); + auto parent1 = *outParticle; + auto parent2 = *(++outParticle); ATH_MSG_DEBUG("Two in, two out: " << parent1->pdg_id() << " " << parent2->pdg_id()); bool parent1ok(false), parent2ok(false); @@ -184,10 +184,10 @@ StatusCode DecayModeFilter::filterEvent() { } -string DecayModeFilter::printChain(HepMC::GenParticle* parent) const { +string DecayModeFilter::printChain(HepMC::GenParticlePtr parent) const { std::stringstream ss; ss << " " << abs(parent->pdg_id()) << " -> "; - HepMC::GenParticle* foundChild(NULL); + HepMC::GenParticlePtr foundChild(NULL); int SMchild_PDG(0); HepMC::GenVertex::particle_iterator child = parent->end_vertex()->particles_begin(HepMC::children); HepMC::GenVertex::particle_iterator end_child = parent->end_vertex()->particles_end(HepMC::children); @@ -201,7 +201,7 @@ string DecayModeFilter::printChain(HepMC::GenParticle* parent) const { } -void DecayModeFilter::analyzeChain(HepMC::GenParticle* parent, bool& isDirect, bool& isBosonic, bool& isLeptonic, bool& isDirect3body) { +void DecayModeFilter::analyzeChain(HepMC::GenParticlePtr parent, bool& isDirect, bool& isBosonic, bool& isLeptonic, bool& isDirect3body) { int length(0), Nchi2(0), NW(0), NZ(0), NH(0), Nse(0), Nsmu(0), Nstau(0), nChargedLeptons(0), nSMParticles(0); countChain(parent, length, Nchi2, NW, NZ, NH, Nse, Nsmu, Nstau, nChargedLeptons, nSMParticles); @@ -238,9 +238,9 @@ void DecayModeFilter::analyzeChain(HepMC::GenParticle* parent, bool& isDirect, b } -void DecayModeFilter::countChain(HepMC::GenParticle* parent, int& length, +void DecayModeFilter::countChain(HepMC::GenParticlePtr parent, int& length, int& Nchi2, int& NW,int& NZ,int& NH, int& Nse, int& Nsmu, int& Nstau, int& nChargedLeptons, int& nSMParticles) const { - HepMC::GenParticle* foundChild(NULL); + HepMC::GenParticlePtr foundChild=nullptr; int SMchild_PDG(0); HepMC::GenVertex::particle_iterator child = parent->end_vertex()->particles_begin(HepMC::children); HepMC::GenVertex::particle_iterator end_child = parent->end_vertex()->particles_end(HepMC::children); diff --git a/Generators/GeneratorFilters/src/DecayPositionFilter.cxx b/Generators/GeneratorFilters/src/DecayPositionFilter.cxx index 60c7bda503695dc5ef274db3df90c912363e77e1..dec2072405d6743a54dee291d10005201776afd8 100644 --- a/Generators/GeneratorFilters/src/DecayPositionFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayPositionFilter.cxx @@ -52,7 +52,7 @@ StatusCode DecayPositionFilter::filterEvent() { } if(notSelfDecay){ - HepMC::GenVertex* vtx = (*pitr)->end_vertex(); + HepMC::GenVertexPtr vtx = (*pitr)->end_vertex(); float x = vtx->position().x(); float y = vtx->position().y(); float Rdecay = sqrt(x*x + y*y); diff --git a/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx b/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx index 14048a06beb13815307d152c019ade989e46f0e3..f68e50cee483de745e6a9fd1b17d8df1498996e6 100644 --- a/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx +++ b/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx @@ -67,7 +67,7 @@ StatusCode DecaysFinalStateFilter::filterEvent() { } if (!allowedParent) continue; - HepMC::GenVertex* vtx = (*pitr)->end_vertex(); + auto vtx = (*pitr)->end_vertex(); if (!vtx) continue; for (HepMC::GenVertex::particles_out_const_iterator opitr = vtx->particles_out_const_begin(); diff --git a/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx b/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx index 2671f9c689cedccefd3ea438a4055c37ed625961..6369f7be6817ff73e98939f7e9f8d6cb2aad2589 100644 --- a/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx +++ b/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx @@ -35,7 +35,9 @@ StatusCode DiLeptonMassFilter::filterEvent() { for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); // Loop over all particles in the event - for (HepMC::GenEvent::particle_const_iterator pitr1 = genEvt->particles_begin(); pitr1 != genEvt->particles_end(); ++pitr1 ){ + HepMC::GenEvent::particle_const_iterator genEvt_particles_begin=genEvt->particles_begin(); + HepMC::GenEvent::particle_const_iterator genEvt_particles_end=genEvt->particles_end(); + for (auto pitr1 = genEvt_particles_begin; pitr1 != genEvt_particles_end; ++pitr1 ){ int pdgId1((*pitr1)->pdg_id()); if((*pitr1)->status()!=1) continue; @@ -44,10 +46,10 @@ StatusCode DiLeptonMassFilter::filterEvent() { if ((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta){ // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr2 = pitr1; + auto pitr2 = pitr1; pitr2++; - for(; pitr2 != genEvt->particles_end(); ++pitr2){ + for(; pitr2 != genEvt_particles_end; ++pitr2){ int pdgId2((*pitr2)->pdg_id()); //if((*pitr2)->status()!=1 && pitr1 != pitr2) continue; if((*pitr2)->status()!=1 || pitr1 == pitr2) continue; @@ -69,9 +71,9 @@ StatusCode DiLeptonMassFilter::filterEvent() { double dilepPt = vec.perp(); ATH_MSG_DEBUG(" Lepton1 : Pt = " << (*pitr1)->momentum().perp() << ", Eta = " << (*pitr1)->momentum().pseudoRapidity() << - ", pdgid = " << pdgId1 << ", status = " << (*pitr1)->status() << ", barcode = " << (*pitr1)->barcode() << + ", pdgid = " << pdgId1 << ", status = " << (*pitr1)->status() << ", barcode = " << HepMC::barcode(*pitr1) << " Lepton2 : Pt = " << (*pitr2)->momentum().perp() << ", Eta = " << (*pitr2)->momentum().pseudoRapidity() << - ", pdgid = " << pdgId2 << ", status = " << (*pitr2)->status() << ", barcode = " << (*pitr2)->barcode() << + ", pdgid = " << pdgId2 << ", status = " << (*pitr2)->status() << ", barcode = " << HepMC::barcode(*pitr2) << " Mass = " << invMass << " DilepPt = " << dilepPt); diff --git a/Generators/GeneratorFilters/src/DiPhotonFilter.cxx b/Generators/GeneratorFilters/src/DiPhotonFilter.cxx index e25a2d2e7f5ed99b311e18d66a7294754ed7e7c5..a9a9cf51900323f9f898e75550ce1d1e9d9c4664 100644 --- a/Generators/GeneratorFilters/src/DiPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/DiPhotonFilter.cxx @@ -10,7 +10,7 @@ /// @todo Move to a sorting utils module class High2LowByGenParticleClassPt { public: - bool operator() (const HepMC::GenParticle *t1, const HepMC::GenParticle *t2) const { + bool operator() (const HepMC::GenParticlePtr t1, const HepMC::GenParticlePtr t2) const { return t1->momentum().perp2() > t2->momentum().perp2(); } }; @@ -56,7 +56,7 @@ StatusCode DiPhotonFilter::filterEvent() { ATH_MSG_DEBUG("min pt(photon) = " << ptcut << " (CLHEP::MeV)"); // find truth photons - std::vector<HepMC::GenParticle*> MCTruthPhotonList; + std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { // Loop over all particles in the event @@ -79,7 +79,7 @@ StatusCode DiPhotonFilter::filterEvent() { if (MCTruthPhotonList.size() < 2) { isOK = false; } else { - std::vector<HepMC::GenParticle*> MCTruthPhotonList2; + std::vector<HepMC::GenParticlePtr> MCTruthPhotonList2; // check pT and eta to select truth photons for (size_t i = 0; i < MCTruthPhotonList.size(); ++i) { ATH_MSG_DEBUG(i << ": pT=" << MCTruthPhotonList[i]->momentum().perp() << ", eta=" << MCTruthPhotonList[i]->momentum().pseudoRapidity()); diff --git a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx index b94dbef187674ecaa714d2a19010ad610c0edf40..5b527cbf4f113c2d5c2dc5800de06c8242afeb94 100644 --- a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx @@ -24,7 +24,7 @@ StatusCode DirectPhotonFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - ATH_MSG_DEBUG("----->>> Process : " << genEvt->signal_process_id()); + ATH_MSG_DEBUG("----->>> Process : " << HepMC::signal_process_id(genEvt)); for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) { if (((*pitr)->pdg_id() == 22)) { diff --git a/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx b/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx index 8e4d94e736bfc6fcd247394b19d0c8c5d981c72b..9e97570368993de111f71bbb30ea3d7f9eaf0995 100644 --- a/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx +++ b/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx @@ -15,7 +15,7 @@ DstD0K3piFilter::DstD0K3piFilter(const std::string& name, ISvcLocator* pSvcLocat // If mcpart first child lundId equals chLundId, return true /// @todo No need for this to be a member function... useful in a HepMC utils library? -bool DstD0K3piFilter::CheckChildLundId(HepMC::GenParticle* mcpart, int nth, int chLundId) { +bool DstD0K3piFilter::CheckChildLundId(HepMC::GenParticlePtr mcpart, unsigned int nth, int chLundId) { int nChild = 0; const HepMC::GenVertex* DecayVtx = mcpart->end_vertex(); if (DecayVtx != 0) nChild = DecayVtx->particles_out_size(); @@ -37,7 +37,7 @@ bool DstD0K3piFilter::CheckChildLundId(HepMC::GenParticle* mcpart, int nth, int /// @todo No need for this to be a member function -bool DstD0K3piFilter::IsCandidate(std::vector<float>& lundIds, std::vector<HepMC::GenParticle*>& genParticles) { +bool DstD0K3piFilter::IsCandidate(std::vector<float>& lundIds, std::vector<HepMC::GenParticlePtr>& genParticles) { unsigned int nDecay = lundIds.size(); if (nDecay == 2) { unsigned int id0 = std::abs( static_cast<int>(lundIds[0]) ); diff --git a/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx b/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx index c251d0e2a8ac4138718838f9db8f680df7af65e4..ff14bdd5036c264632bbc149da7edc8b656f3abe 100644 --- a/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx +++ b/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx @@ -36,9 +36,11 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); + HepMC::GenEvent::particle_const_iterator genEvt_particles_begin = genEvt->particles_begin(); + HepMC::GenEvent::particle_const_iterator genEvt_particles_end = genEvt->particles_end(); // Loop over all particles in the event - for (HepMC::GenEvent::particle_const_iterator pitr1 = genEvt->particles_begin(); pitr1 != genEvt->particles_end(); ++pitr1 ){ + for (auto pitr1 = genEvt_particles_begin; pitr1 != genEvt_particles_end; ++pitr1 ){ if((*pitr1)->status()!=1) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -47,10 +49,10 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { if (!((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr2 = pitr1; + auto pitr2 = pitr1; pitr2++; - for(; pitr2 != genEvt->particles_end(); ++pitr2){ + for(; pitr2 != genEvt_particles_end; ++pitr2){ if((*pitr2)->status()!=1 || pitr1 == pitr2) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -59,10 +61,10 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { if (!((*pitr2)->momentum().perp() >= m_minPt && fabs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr3 = pitr2; + auto pitr3 = pitr2; pitr3++; - for(; pitr3 != genEvt->particles_end(); ++pitr3){ + for(; pitr3 != genEvt_particles_end; ++pitr3){ if((*pitr3)->status()!=1 || pitr1 == pitr3 || pitr2 == pitr3 ) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -71,10 +73,10 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { if (!((*pitr3)->momentum().perp() >= m_minPt && fabs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr4 = pitr3; + auto pitr4 = pitr3; pitr4++; - for(; pitr4 != genEvt->particles_end(); ++pitr4){ + for(; pitr4 != genEvt_particles_end; ++pitr4){ if((*pitr4)->status()!=1 || pitr1 == pitr4 || pitr2 == pitr4 || pitr3 == pitr4) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta diff --git a/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx b/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx index 9e7f7891da7ab84860ee15c7878ce633c1dbeff0..aa906eb2abebe64ed922edc6b5f2c89c83c69f14 100644 --- a/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx +++ b/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx @@ -36,7 +36,9 @@ StatusCode FourLeptonMassFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = *itr; - for (HepMC::GenEvent::particle_const_iterator pitr1 = genEvt->particles_begin(); pitr1 != genEvt->particles_end(); ++pitr1) { + HepMC::GenEvent::particle_const_iterator genEvt_particles_begin = genEvt->particles_begin(); + HepMC::GenEvent::particle_const_iterator genEvt_particles_end = genEvt->particles_end(); + for (auto pitr1 = genEvt_particles_begin; pitr1 != genEvt_particles_end; ++pitr1) { if ((*pitr1)->status() != 1) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -45,10 +47,10 @@ StatusCode FourLeptonMassFilter::filterEvent() { if (!((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr2 = pitr1; + auto pitr2 = pitr1; pitr2++; - for (; pitr2 != genEvt->particles_end(); ++pitr2) { + for (; pitr2 != genEvt_particles_end; ++pitr2) { if ((*pitr2)->status()!=1 || pitr1 == pitr2) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId2((*pitr2)->pdg_id()); @@ -56,10 +58,10 @@ StatusCode FourLeptonMassFilter::filterEvent() { if (!((*pitr2)->momentum().perp() >= m_minPt && fabs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr3 = pitr2; + auto pitr3 = pitr2; pitr3++; - for (; pitr3 != genEvt->particles_end(); ++pitr3) { + for (; pitr3 != genEvt_particles_end; ++pitr3) { if ((*pitr3)->status()!=1 || pitr1 == pitr3 || pitr2 == pitr3 ) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -68,10 +70,10 @@ StatusCode FourLeptonMassFilter::filterEvent() { if (!((*pitr3)->momentum().perp() >= m_minPt && fabs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event - HepMC::GenEvent::particle_const_iterator pitr4 = pitr3; + auto pitr4 = pitr3; pitr4++; - for (; pitr4 != genEvt->particles_end(); ++pitr4) { + for (; pitr4 != genEvt_particles_end; ++pitr4) { if ((*pitr4)->status()!=1 || pitr1 == pitr4 || pitr2 == pitr4 || pitr3 == pitr4) continue; // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta @@ -79,7 +81,7 @@ StatusCode FourLeptonMassFilter::filterEvent() { if (!(abs(pdgId4) == 11 || abs(pdgId4) == 13)) continue; if (!((*pitr4)->momentum().perp() >= m_minPt && fabs((*pitr4)->momentum().pseudoRapidity()) <= m_maxEta)) continue; - HepMC::GenEvent::particle_const_iterator apitr[4] = {pitr1,pitr2,pitr3,pitr4}; + decltype(pitr1) apitr[4] = {pitr1,pitr2,pitr3,pitr4}; int pdgIds[4]={pdgId1,pdgId2,pdgId3,pdgId4}; for (int ii = 0; ii < 4; ii++) { for (int jj = 0; jj < 4; jj++) { diff --git a/Generators/GeneratorFilters/src/HTFilter.cxx b/Generators/GeneratorFilters/src/HTFilter.cxx index c584eed707016b2c84e19f1b31e71de1a75b30c2..2ba7c8e4ebeadcefb677a905d8a5e49b8758e558 100644 --- a/Generators/GeneratorFilters/src/HTFilter.cxx +++ b/Generators/GeneratorFilters/src/HTFilter.cxx @@ -107,7 +107,7 @@ StatusCode HTFilter::filterEvent() { return StatusCode::SUCCESS; } - std::vector<const HepMC::GenParticle*> WZleptons; + std::vector<HepMC::GenParticlePtr> WZleptons; WZleptons.reserve(10); for (HepMC::GenEvent::particle_const_iterator iter=(*mecc)[0]->particles_begin(); iter!=(*mecc)[0]->particles_end();++iter){ @@ -149,7 +149,7 @@ StatusCode HTFilter::filterEvent() { return StatusCode::SUCCESS; } -bool HTFilter::fromWZ( const HepMC::GenParticle* part ) const +bool HTFilter::fromWZ( const HepMC::GenParticlePtr part ) const { // !!! IMPORTANT !!! This is a TEMPORARY function // it's used in place of code in MCTruthClassifier as long as this package is not dual-use @@ -174,7 +174,7 @@ bool HTFilter::fromWZ( const HepMC::GenParticle* part ) const return false; } -bool HTFilter::fromTau( const HepMC::GenParticle* part ) const +bool HTFilter::fromTau( const HepMC::GenParticlePtr part ) const { // !!! IMPORTANT !!! This is a TEMPORARY function // it's used in place of code in MCTruthClassifier as long as this package is not dual-use diff --git a/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx b/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx index 0315e6f8c3f208ddfede795a2b6c67ec12717218..d69dd29b79d3eb1c5a6bc612ae9d6ef380a30523 100644 --- a/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx +++ b/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx @@ -130,7 +130,7 @@ StatusCode JetFilterWithTruthPhoton::filterEvent() { } } - std::vector<HepMC::GenParticle*> MCTruthPhotonList; + std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; MCTruthPhotonList.clear(); McEventCollection::const_iterator itr; diff --git a/Generators/GeneratorFilters/src/MassRangeFilter.cxx b/Generators/GeneratorFilters/src/MassRangeFilter.cxx index 960c8499ee7b077f4272a1fb912b9997046378f2..a3e0feab85e061eaa32428ce5173ee1840000b72 100644 --- a/Generators/GeneratorFilters/src/MassRangeFilter.cxx +++ b/Generators/GeneratorFilters/src/MassRangeFilter.cxx @@ -39,18 +39,20 @@ StatusCode MassRangeFilter::filterEvent() { for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = *itr; int n = 0; - for (HepMC::GenEvent::particle_const_iterator pitr1 = genEvt->particles_begin(); pitr1 != genEvt->particles_end(); ++pitr1) { + HepMC::GenEvent::particle_const_iterator genEvt_particles_begin=genEvt->particles_begin(); + HepMC::GenEvent::particle_const_iterator genEvt_particles_end= genEvt->particles_end(); + for ( auto pitr1 = genEvt_particles_begin; pitr1 != genEvt_particles_end; ++pitr1) { n++; if ((*pitr1)->status() != m_PartStatus ) continue; //status of the particle if (std::abs((*pitr1)->pdg_id()) != std::abs(m_PartId) ) continue; //PDG ID selection if ((*pitr1)->momentum().perp() < m_Ptmin ) continue; // pT cut if (fabs((*pitr1)->momentum().pseudoRapidity()) > m_EtaRange) continue; //eta cut - HepMC::GenEvent::particle_const_iterator pitr2 = genEvt->particles_begin(); + auto pitr2 = genEvt_particles_begin; if (samePDGID) { pitr2 = pitr1; pitr2++; } - for (; pitr2 != genEvt->particles_end(); ++pitr2) { + for (; pitr2 != genEvt_particles_end; ++pitr2) { if (pitr1 == pitr2) continue; //if the pointers are the same if ((*pitr2)->status() != m_PartStatus) continue; //status of the particle if (std::abs((*pitr2)->pdg_id()) != std::abs(m_PartId2)) continue; //PDG ID selection diff --git a/Generators/GeneratorFilters/src/MissingEtFilter.cxx b/Generators/GeneratorFilters/src/MissingEtFilter.cxx index 484dabda9bde58faae886c139009d086c8973311..67acf7d99d49d6aec1b95877c5af6838e492d83c 100644 --- a/Generators/GeneratorFilters/src/MissingEtFilter.cxx +++ b/Generators/GeneratorFilters/src/MissingEtFilter.cxx @@ -47,7 +47,7 @@ StatusCode MissingEtFilter::filterEvent() { return StatusCode::SUCCESS; } -bool MissingEtFilter::fromWZ( const HepMC::GenParticle* part ) const +bool MissingEtFilter::fromWZ( const HepMC::GenParticlePtr part ) const { // !!! IMPORTANT !!! This is a TEMPORARY function // it's used in place of code in MCTruthClassifier as long as this package is not dual-use @@ -72,7 +72,7 @@ bool MissingEtFilter::fromWZ( const HepMC::GenParticle* part ) const return false; } -bool MissingEtFilter::fromTau( const HepMC::GenParticle* part ) const +bool MissingEtFilter::fromTau( const HepMC::GenParticlePtr part ) const { // !!! IMPORTANT !!! This is a TEMPORARY function // it's used in place of code in MCTruthClassifier as long as this package is not dual-use diff --git a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx index c9e11f09bda1c2a034dd8291d0fa55f8d933fbe0..0415fba4eb2f9e478acc0e115f2ece35ed4b58cf 100644 --- a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx +++ b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx @@ -96,13 +96,13 @@ StatusCode SoftLeptonInJetFilter::filterEvent() { return StatusCode::SUCCESS; } -bool SoftLeptonInJetFilter::isElectron(const HepMC::GenParticle* p) const { +bool SoftLeptonInJetFilter::isElectron(HepMC::GenParticlePtr p) const { return (abs(p->pdg_id())==11 && p->status()==1 && p->momentum().perp() >= m_Ptmin && fabs(p->momentum().pseudoRapidity()) <= m_EtaRange ); } -bool SoftLeptonInJetFilter::isParton(const HepMC::GenParticle* p) const { +bool SoftLeptonInJetFilter::isParton(HepMC::GenParticlePtr p) const { return (abs(p->pdg_id()) == m_part_ID && p->status()==3 && p->momentum().perp() >= m_part_Ptmin && fabs(p->momentum().pseudoRapidity()) <= m_part_EtaRange); diff --git a/Generators/GeneratorFilters/src/TTbarBoostCatFilter.cxx b/Generators/GeneratorFilters/src/TTbarBoostCatFilter.cxx index 18aa4c9dd6b43c4004bb4a9c04238044eee17d14..7f3b3c9322f4e0783ed0606b01239c1f436dc30f 100644 --- a/Generators/GeneratorFilters/src/TTbarBoostCatFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarBoostCatFilter.cxx @@ -61,10 +61,10 @@ StatusCode TTbarBoostCatFilter::filterEvent() { if(m_LepPtmin*m_LepPtmax <0 && m_LepPtmin < 0 ) m_LepPtmin = 0.; if(m_LepPtmin*m_LepPtmax <0 && m_LepPtmax < 0 ) m_LepPtmax = 14000000.; // 14 TeV - std::vector<HepMC::GenParticle*> tops; - std::vector<HepMC::GenParticle*> ws; // W from top decay (from tops) - std::vector<HepMC::GenParticle*> leps; // e, mu, tau from W decay (from ws) - std::vector<HepMC::GenParticle*> nus; // nutrino from W decay (from ws) + std::vector<HepMC::GenParticlePtr> tops; + std::vector<HepMC::GenParticlePtr> ws; // W from top decay (from tops) + std::vector<HepMC::GenParticlePtr> leps; // e, mu, tau from W decay (from ws) + std::vector<HepMC::GenParticlePtr> nus; // nutrino from W decay (from ws) for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); diff --git a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx index ce7622a1f6e9fc3803180248090f8e800703d877..64f2a727c82c89245ba2ca761ac2bfd69ec9e1e1 100644 --- a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx @@ -20,8 +20,8 @@ StatusCode TTbarMassFilter::filterEvent() { bool isLastTop = false; bool isFirstTop = false; double topPairInvariantMass = 0.; - std::vector<HepMC::GenParticle*> tops; - std::vector<const HepMC::GenVertex*> top_vtxs; + std::vector<HepMC::GenParticlePtr> tops; + std::vector<HepMC::GenVertexPtr> top_vtxs; for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); @@ -37,7 +37,7 @@ StatusCode TTbarMassFilter::filterEvent() { if (abs(mcpart->pdg_id()) == 6) { // Assume that this is the 'last' top isLastTop=true; - const HepMC::GenVertex* decayVtx = mcpart->end_vertex(); + HepMC::GenVertex* decayVtx = mcpart->end_vertex(); // Unusual case... if (!decayVtx) { ATH_MSG_WARNING("top particle with a status "<<mcpart->status()<<" has no valid decay vertex. "); @@ -71,7 +71,7 @@ StatusCode TTbarMassFilter::filterEvent() { // Investigate whether this top particle is the 'first' one. isFirstTop = false; // Retrieve the production vertex of the current 'last' top particle - const HepMC::GenVertex* prodVtx = mcpart->production_vertex(); + HepMC::GenVertex* prodVtx = mcpart->production_vertex(); if (!prodVtx) { ATH_MSG_WARNING("Top particle with a status " << mcpart->status() << " has no valid production vertex"); //save null pointer for consistency @@ -158,7 +158,7 @@ StatusCode TTbarMassFilter::filterEvent() { double topPairInvMass_2=0.; // There must be only two different vertecies out of the four - const HepMC::GenVertex* prodVtx = top_vtxs[0]; + const HepMC::GenVertexPtr prodVtx = top_vtxs[0]; int top_11 = 0; int top_12 = -1; int top_21 = -1; diff --git a/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx b/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx index 2eb0244f4266807b57b807d70422023ae2a52f37..fdf491a31086ef24fe2fd038e273f5eb4a3c3ce4 100644 --- a/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx @@ -65,9 +65,9 @@ StatusCode TTbarPlusHeavyFlavorFilter::filterEvent() { // =========================================== for(HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin();pitr!=genEvt->particles_end(); ++pitr ) { - const HepMC::GenParticle* part = (*pitr); + HepMC::GenParticle* part = (*pitr); - if(part->barcode() > 200000) break; + if(HepMC::barcode(part) > 200000) break; bool isbquark=false; bool iscquark=false; @@ -158,7 +158,7 @@ StatusCode TTbarPlusHeavyFlavorFilter::filterEvent() { } -bool TTbarPlusHeavyFlavorFilter::passBSelection(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::passBSelection(const HepMC::GenParticlePtr part) const{ const HepMC::FourVector& p4 = part->momentum(); double pt = p4.perp(); @@ -171,7 +171,7 @@ bool TTbarPlusHeavyFlavorFilter::passBSelection(const HepMC::GenParticle* part) } -bool TTbarPlusHeavyFlavorFilter::passCSelection(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::passCSelection(const HepMC::GenParticlePtr part) const{ const HepMC::FourVector& p4 = part->momentum(); double pt = p4.perp(); @@ -200,9 +200,9 @@ int TTbarPlusHeavyFlavorFilter::hadronType(int pdgid) const{ } -bool TTbarPlusHeavyFlavorFilter::isBHadron(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isBHadron(const HepMC::GenParticlePtr part) const{ - if(part->barcode() >= 200000) return false; + if(HepMC::barcode(part) >= 200000) return false; int type = hadronType(part->pdg_id()); if(type == 5) return true; @@ -211,9 +211,9 @@ bool TTbarPlusHeavyFlavorFilter::isBHadron(const HepMC::GenParticle* part) const } -bool TTbarPlusHeavyFlavorFilter::isCHadron(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isCHadron(const HepMC::GenParticlePtr part) const{ - if(part->barcode() >= 200000) return false; + if(HepMC::barcode(part) >= 200000) return false; int type = hadronType(part->pdg_id()); if(type == 4) return true; @@ -223,9 +223,9 @@ bool TTbarPlusHeavyFlavorFilter::isCHadron(const HepMC::GenParticle* part) const -bool TTbarPlusHeavyFlavorFilter::isInitialHadron(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isInitialHadron(const HepMC::GenParticlePtr part) const{ - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(prod){ int type = hadronType(part->pdg_id()); HepMC::GenVertex::particle_iterator firstParent = prod->particles_begin(HepMC::parents); @@ -244,9 +244,9 @@ bool TTbarPlusHeavyFlavorFilter::isInitialHadron(const HepMC::GenParticle* part) } -bool TTbarPlusHeavyFlavorFilter::isFinalHadron(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isFinalHadron(const HepMC::GenParticlePtr part) const{ - HepMC::GenVertex* end = part->end_vertex(); + HepMC::GenVertexPtr end = part->end_vertex(); if(end){ int type = hadronType(part->pdg_id()); HepMC::GenVertex::particle_iterator firstChild = end->particles_begin(HepMC::children); @@ -267,9 +267,9 @@ bool TTbarPlusHeavyFlavorFilter::isFinalHadron(const HepMC::GenParticle* part) c -bool TTbarPlusHeavyFlavorFilter::isQuarkFromHadron(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isQuarkFromHadron(const HepMC::GenParticlePtr part) const{ - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(prod){ HepMC::GenVertex::particle_iterator firstParent = prod->particles_begin(HepMC::ancestors); HepMC::GenVertex::particle_iterator endParent = prod->particles_end(HepMC::ancestors); @@ -287,11 +287,11 @@ bool TTbarPlusHeavyFlavorFilter::isQuarkFromHadron(const HepMC::GenParticle* par } -bool TTbarPlusHeavyFlavorFilter::isCHadronFromB(const HepMC::GenParticle* part) const{ +bool TTbarPlusHeavyFlavorFilter::isCHadronFromB(const HepMC::GenParticlePtr part) const{ if(!isCHadron(part)) return false; - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(prod){ HepMC::GenVertex::particle_iterator firstParent = prod->particles_begin(HepMC::ancestors); HepMC::GenVertex::particle_iterator endParent = prod->particles_end(HepMC::ancestors); @@ -308,9 +308,9 @@ bool TTbarPlusHeavyFlavorFilter::isCHadronFromB(const HepMC::GenParticle* part) } -bool TTbarPlusHeavyFlavorFilter::isLooping(const HepMC::GenParticle* part, std::set<const HepMC::GenParticle*> init_part) const{ +bool TTbarPlusHeavyFlavorFilter::isLooping(const HepMC::GenParticlePtr part, std::set<HepMC::GenParticlePtr> init_part) const{ - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(!prod) return false; @@ -329,9 +329,9 @@ bool TTbarPlusHeavyFlavorFilter::isLooping(const HepMC::GenParticle* part, std:: -const HepMC::GenParticle* TTbarPlusHeavyFlavorFilter::findInitial(const HepMC::GenParticle* part, bool looping) const{ +HepMC::ConstGenParticlePtr TTbarPlusHeavyFlavorFilter::findInitial(HepMC::ConstGenParticlePtr part, bool looping) const{ - HepMC::GenVertex* prod = part->production_vertex(); + auto prod = part->production_vertex(); if(!prod) return part; @@ -348,16 +348,16 @@ const HepMC::GenParticle* TTbarPlusHeavyFlavorFilter::findInitial(const HepMC:: } -bool TTbarPlusHeavyFlavorFilter::isFromTop(const HepMC::GenParticle* part, bool looping) const{ +bool TTbarPlusHeavyFlavorFilter::isFromTop(const HepMC::GenParticlePtr part, bool looping) const{ - const HepMC::GenParticle* initpart = findInitial(part, looping); + const HepMC::GenParticlePtr initpart = findInitial(part, looping); return isDirectlyFromTop(initpart, looping); } -bool TTbarPlusHeavyFlavorFilter::isDirectlyFromTop(const HepMC::GenParticle* part, bool looping) const{ +bool TTbarPlusHeavyFlavorFilter::isDirectlyFromTop(const HepMC::GenParticlePtr part, bool looping) const{ - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(!prod) return false; @@ -373,9 +373,9 @@ bool TTbarPlusHeavyFlavorFilter::isDirectlyFromTop(const HepMC::GenParticle* par -bool TTbarPlusHeavyFlavorFilter::isDirectlyFromWTop(const HepMC::GenParticle* part, bool looping) const{ +bool TTbarPlusHeavyFlavorFilter::isDirectlyFromWTop(const HepMC::GenParticlePtr part, bool looping) const{ - HepMC::GenVertex* prod = part->production_vertex(); + HepMC::GenVertexPtr prod = part->production_vertex(); if(!prod) return false; diff --git a/Generators/GeneratorFilters/src/TauFilter.cxx b/Generators/GeneratorFilters/src/TauFilter.cxx index 6d162297689745c472f5bad9c6dabe897605dda2..36b93bb7ae05fe0e7248e2d085fb574b702a1d81 100644 --- a/Generators/GeneratorFilters/src/TauFilter.cxx +++ b/Generators/GeneratorFilters/src/TauFilter.cxx @@ -40,7 +40,7 @@ StatusCode TauFilter::filterFinalize() { } -CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::GenParticle *part ) { +CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { nu.setPx(part->momentum().px()); @@ -60,7 +60,7 @@ CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::GenParticle *par StatusCode TauFilter::filterEvent() { - HepMC::GenParticle *tau; + HepMC::GenParticlePtr tau; CLHEP::HepLorentzVector mom_tauprod; // will contain the momentum of the products of the tau decay CLHEP::HepLorentzVector tauvis; CLHEP::HepLorentzVector nutau; diff --git a/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx b/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx index b16fce94d462be606137fb7347411a3f314f123b..2da4c6276ccad671fb83179a8c01da9bb226caa5 100644 --- a/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx +++ b/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx @@ -99,8 +99,10 @@ StatusCode TrimuMassRangeFilter::filterEvent() { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); int n=0; - for(HepMC::GenEvent::particle_const_iterator pitr1 = genEvt->particles_begin(); - pitr1!=genEvt->particles_end(); ++pitr1 ){ + auto genEvt_particles_begin = genEvt->particles_begin(); + auto genEvt_particles_end = genEvt->particles_end(); + for(auto pitr1 = genEvt_particles_begin; + pitr1!=genEvt_particles_end; ++pitr1 ){ n++; if( ( std::abs((*pitr1)->pdg_id()) != std::abs(m_PartId1) && 99999 != std::abs(m_PartId1) ) || //PDG ID selection (*pitr1)->status() != m_PartStatus || //status of the particle @@ -112,13 +114,13 @@ StatusCode TrimuMassRangeFilter::filterEvent() { << " eta1 " << (*pitr1)->momentum().pseudoRapidity() << " phi1 " << (*pitr1)->momentum().phi() << " stat1 " << (*pitr1)->status() ); - HepMC::GenEvent::particle_const_iterator pitr2 = genEvt->particles_begin(); + auto pitr2 = genEvt_particles_begin; if( samePDGID12 ){ pitr2 = pitr1; pitr2++;//pirt2 = pitr1 + 1 is not allowed. operator+ is not defined.... } - for(; pitr2!=genEvt->particles_end(); ++pitr2 ){ + for(; pitr2!=genEvt_particles_end; ++pitr2 ){ if( pitr1 == pitr2 ) continue;//if the pointers are the same. @@ -133,13 +135,13 @@ StatusCode TrimuMassRangeFilter::filterEvent() { << " eta2 " << (*pitr2)->momentum().pseudoRapidity() << " phi2 " << (*pitr2)->momentum().phi() << " stat2 " << (*pitr2)->status() ); - HepMC::GenEvent::particle_const_iterator pitr3 = genEvt->particles_begin(); + auto pitr3 = genEvt_particles_begin; if( samePDGID123 ){ pitr3 = pitr2; pitr3++;//pirt2 = pitr1 + 1 is not allowed. operator+ is not defined.... } - for(; pitr3!=genEvt->particles_end(); ++pitr3 ){ + for(; pitr3!=genEvt_particles_end; ++pitr3 ){ if( pitr1 == pitr3 || pitr2 == pitr3 ) continue;//if the pointers are the same. diff --git a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx index 7ff363a32d2cf04100a3f0c5df9fc6f1ccb37765..822c2ac92eebd80bf557db6685a82cf2dfc30ae0 100644 --- a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx +++ b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx @@ -126,12 +126,12 @@ StatusCode TtHtoVVDecayFilter::filterEvent() { } -bool TtHtoVVDecayFilter::findAncestor(const HepMC::GenVertex* searchvertex, +bool TtHtoVVDecayFilter::findAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID) { if (!searchvertex) return false; const HepMC::GenVertex::particles_out_const_iterator firstAncestor = searchvertex->particles_out_const_begin(); const HepMC::GenVertex::particles_out_const_iterator endAncestor = searchvertex->particles_out_const_end(); - for (HepMC::GenVertex::particles_out_const_iterator anc = firstAncestor; anc != endAncestor; ++anc) { + for (auto anc = firstAncestor; anc != endAncestor; ++anc) { if (abs((*anc)->pdg_id()) == targetPDGID) { // same particle as parent return findAncestor((*anc)->end_vertex(), targetPDGID); diff --git a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx index ea94ff8b114515c8fdb06ceeb949fb15e7367034..5d3aa26935a43acddb61ee691f053b007c329788 100644 --- a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx +++ b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx @@ -92,8 +92,8 @@ StatusCode VBFForwardJetsFilter::filterEvent() { ATH_MSG_DEBUG("xAOD::JetContainer size = " << truthjetTES->size()); // Get MCTruth Photon/Electon/Tau(HadronicDecay) - std::vector<HepMC::GenParticle*> MCTruthPhotonList; - std::vector<HepMC::GenParticle*> MCTruthElectronList; + std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; + std::vector<HepMC::GenParticlePtr> MCTruthElectronList; std::vector<CLHEP::HepLorentzVector*> MCTruthTauList; McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { @@ -237,7 +237,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { } -CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::GenParticle *part ) { +CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { @@ -257,7 +257,7 @@ CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::GenPa } -double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<HepMC::GenParticle*> &list) { +double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<HepMC::GenParticlePtr> &list) { double minDR = 999.; for (unsigned i=0;i<list.size();++i) { if (list[i]->momentum().perp() != 0.) { @@ -292,8 +292,8 @@ double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<CLHE void VBFForwardJetsFilter::removePseudoJets( std::vector<const xAOD::Jet*> &jetList, - std::vector<HepMC::GenParticle*> &MCTruthPhotonList, - std::vector<HepMC::GenParticle*> &MCTruthElectronList, + std::vector<HepMC::GenParticlePtr> &MCTruthPhotonList, + std::vector<HepMC::GenParticlePtr> &MCTruthElectronList, std::vector<CLHEP::HepLorentzVector*> &MCTruthTauList) { std::vector<const xAOD::Jet*> orgJetList = jetList; jetList.clear(); diff --git a/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx b/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx index 830c25e8a37b2a15141cb3316eca2c78d9705481..77c431e8ac42c88015a3e14944944bc9da5ffa0f 100644 --- a/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx +++ b/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx @@ -80,8 +80,8 @@ StatusCode VBFMjjIntervalFilter::filterEvent() { } // Find overlap objects - std::vector<HepMC::GenParticle*> MCTruthPhotonList; - std::vector<HepMC::GenParticle*> MCTruthElectronList; + std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; + std::vector<HepMC::GenParticlePtr> MCTruthElectronList; std::vector<CLHEP::HepLorentzVector*> MCTruthTauList; for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); @@ -193,7 +193,7 @@ StatusCode VBFMjjIntervalFilter::filterEvent() { } -bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepMC::GenParticle*> list) { +bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepMC::GenParticlePtr> list) { for (size_t i = 0; i < list.size(); ++i) { double pt = list[i]->momentum().perp(); if (pt > m_olapPt) { @@ -263,7 +263,7 @@ double VBFMjjIntervalFilter::getEventWeight(xAOD::JetContainer *jets) { } -CLHEP::HepLorentzVector VBFMjjIntervalFilter::sumDaughterNeutrinos( HepMC::GenParticle *part ) { +CLHEP::HepLorentzVector VBFMjjIntervalFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { diff --git a/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx b/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx index add2a990cda2ca2319f2b0459b5125d45fdaa9db..0d5372a9979dc085f6a3d7fddae441c6c303689c 100644 --- a/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx +++ b/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx @@ -99,8 +99,7 @@ StatusCode VHtoVVDiLepFilter::filterEvent() { return StatusCode::SUCCESS; } - -void VHtoVVDiLepFilter::findAncestor(const HepMC::GenVertex* searchvertex, +void VHtoVVDiLepFilter::findAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, int& n_okPDGChild) { std::vector<int> foundCodes; if (!searchvertex) return; diff --git a/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx b/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx index d1434fc0f8ca5bbadef4ca746e234a9f91856bd6..0b705e77c3723c6b112f3201eff12b66eab385ae 100644 --- a/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx @@ -203,8 +203,8 @@ StatusCode WZtoLeptonFilter::filterFinalize() { StatusCode WZtoLeptonFilter::filterEvent() { - HepMC::GenVertex *LePrdVrt; - HepMC::GenVertex *TauPrdVrt; + HepMC::GenVertexPtr LePrdVrt; + HepMC::GenVertexPtr TauPrdVrt; // Momentum of the products of the tau decay CLHEP::HepLorentzVector mom_hadrons; @@ -239,7 +239,7 @@ StatusCode WZtoLeptonFilter::filterEvent() { nullvertex = 0; const HepMC::GenEvent* genEvt = (*itr); - HepMC::WeightContainer wgtsC = genEvt->weights(); + auto wgtsC = genEvt->weights(); double wght = 1; if (wgtsC.size() > 0) wght = wgtsC[0]; m_tot_wghts += wght; diff --git a/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx b/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx index d158f3aafb7bd88eb4594ecd2ce9a2d0c6ccff68..4895bf0804302529f2667f89fa91cc9a9bceedcf 100644 --- a/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx +++ b/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx @@ -80,7 +80,7 @@ StatusCode WeightedBDtoElectronFilter::filterEvent() { if ( etaAbs <=m_EtaRange ) { // check parent and ancestors for B hadron - const HepMC::GenParticle* bParent = FindBParent( (*pitr) ); + auto bParent = FindBParent( (*pitr) ); if ( bParent != 0 ) { // apply prescale factors @@ -106,7 +106,7 @@ StatusCode WeightedBDtoElectronFilter::filterEvent() { } -const HepMC::GenParticle* WeightedBDtoElectronFilter::FindBParent( const HepMC::GenParticle* part ) { +HepMC::ConstGenParticlePtr WeightedBDtoElectronFilter::FindBParent( HepMC::ConstGenParticlePtr part ) { if ( part->production_vertex() == 0 ) { ATH_MSG_DEBUG("Can't find parent (no production vertex)"); return 0; @@ -143,7 +143,7 @@ const HepMC::GenParticle* WeightedBDtoElectronFilter::FindBParent( const HepMC:: parentItr = (*parentItr)->production_vertex()->particles_in_const_begin(); } - const HepMC::GenParticle* bParent = 0; + HepMC::GenParticle* bParent = 0; if ( isBHadron((*parentItr)->pdg_id()) || isDHadron((*parentItr)->pdg_id()) ) { bParent = (*parentItr); ATH_MSG_INFO("Found B hadron: " << (*parentItr)->pdg_id()); diff --git a/Generators/GeneratorFilters/src/XtoVVDecayFilter.cxx b/Generators/GeneratorFilters/src/XtoVVDecayFilter.cxx index 80d9581a8ce80e69c514993c4eff16a72ddd2c31..0360724d7e35da417dc83336f6034048c430d294 100644 --- a/Generators/GeneratorFilters/src/XtoVVDecayFilter.cxx +++ b/Generators/GeneratorFilters/src/XtoVVDecayFilter.cxx @@ -88,7 +88,7 @@ StatusCode XtoVVDecayFilter::filterEvent() { } -void XtoVVDecayFilter::FindAncestor(const HepMC::GenVertex* searchvertex, +void XtoVVDecayFilter::FindAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, bool& okPDGChild1, bool& okPDGChild2) { if (!searchvertex) return; const HepMC::GenVertex::particles_out_const_iterator firstAncestor = searchvertex->particles_out_const_begin(); diff --git a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx index 0d07757e59d1706e4e543fb5ebf3e1f8da1ad486..8730ee71d0006b750e93285b2603208bec59ead9 100644 --- a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx +++ b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx @@ -83,7 +83,7 @@ StatusCode XtoVVDecayFilterExtended::filterEvent() { // Runs the history of ancestors and returns TRUE if it finds the // m_PDGGrandParent in the list of ansestors -bool XtoVVDecayFilterExtended::RunHistory(HepMC::GenParticle *pitr) { +bool XtoVVDecayFilterExtended::RunHistory(HepMC::GenParticlePtr pitr) { if (! pitr->production_vertex()) { ATH_MSG_DEBUG("No History for this case"); return false; @@ -108,7 +108,7 @@ bool XtoVVDecayFilterExtended::RunHistory(HepMC::GenParticle *pitr) { // checks whether the grandparent of a given particle is m_PDGGrandParent // it returns the first mother -HepMC::GenParticle* XtoVVDecayFilterExtended::CheckGrandparent(HepMC::GenParticle *pitr, int &result) { +HepMC::GenParticlePtr XtoVVDecayFilterExtended::CheckGrandparent(HepMC::GenParticlePtr pitr, int &result) { if (! pitr->production_vertex()) { ATH_MSG_DEBUG("No ancestor for this case"); @@ -135,7 +135,7 @@ HepMC::GenParticle* XtoVVDecayFilterExtended::CheckGrandparent(HepMC::GenPartic } -void XtoVVDecayFilterExtended::FindAncestor(const HepMC::GenVertex * searchvertex, +void XtoVVDecayFilterExtended::FindAncestor(const HepMC::GenVertexPtr searchvertex, int targetPDGID, bool& okPDGChild1, bool& okPDGChild2) { if (!searchvertex) return; const HepMC::GenVertex::particles_out_const_iterator firstAncestor = searchvertex->particles_out_const_begin(); diff --git a/Generators/GeneratorModules/src/GenModule.cxx b/Generators/GeneratorModules/src/GenModule.cxx index 866c2a6d61ee99d68c62a08377f7b55bfafd2026..a6323fb3563e6c3fb971edf7f20d630dbb37a497 100644 --- a/Generators/GeneratorModules/src/GenModule.cxx +++ b/Generators/GeneratorModules/src/GenModule.cxx @@ -56,7 +56,7 @@ StatusCode GenModule::execute() { CHECK(this->callGenerator()); // Create the MC event and send the GeneratorEvent stored in it to fillEvt - HepMC::GenEvent* evt = new HepMC::GenEvent(1,1); + HepMC::GenEvent* evt = HepMC::newGenEvent(1,1); CHECK(this->fillEvt(evt)); // Add the event to the MC event collection diff --git a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h index b6fb73787bbcfc34b7c6285060fa51937bb23a33..938ec08cebc2fb7e882445448c917854cecbd8a0 100644 --- a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h +++ b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h @@ -22,6 +22,7 @@ #include <iostream> #include <limits> /* numeric_limits */ #include <string> +#include <vector> #include "AtlasHepMC/GenEvent_fwd.h" #include "AtlasHepMC/GenParticle_fwd.h" @@ -523,6 +524,34 @@ public: index_type eventIndex() const; + /** + * @brief Return the event number of the GenEvent at the specified + * position in the McEventCollection. + * @param position in the McEventCollection + * @param evColl McEventCollection type + * @param sg Target event store. + * Returns -999 when position is larger than the McEventCollection size + */ + static int getEventNumberAtPosition (index_type position, EBC_EVCOLL evColl, const IProxyDict* sg); + + + /** + * @brief Return a vector of the positions in the McEventCollection of the + * GenEvent(s) with a given event number. + * @param index the event number of the required GenEvent + * @param evColl McEventCollection type + * @param sg Target event store. + * Returns a vector containing only ExtendedBarCode::UNDEFINED FIXME when no event with the appropriate event_number was found. + * (Multiple entries in the vector is technically a bug, but can't be fixed until the HepMC3 migration.) + */ + static std::vector<index_type> getEventPositionInCollection (index_type index, EBC_EVCOLL evColl, const IProxyDict* sg); + + /** + * @brief Return the position in the McEventCollection of the + * GenEvent pointed to by this HepMcParticleLink + * @param sg Target event store. + * FIXME - need to be able to flag when no event with the appropriate event_number was found. + */ index_type getEventPositionInCollection (const IProxyDict* sg) const; @@ -564,6 +593,16 @@ public: friend MsgStream& operator << (MsgStream&, const HepMcParticleLink&); + /** + * @brief Look up the event collection we're targeting. + * @param sg Target event store. + * @param evColl McEventCollection type + * May return nullptr if the collection is not found. + */ + static const McEventCollection* + retrieveMcEventCollection (EBC_EVCOLL evColl, const IProxyDict* sg); + + /** * @brief Look up the event collection we're targeting. * @param sg Target event store. @@ -575,10 +614,11 @@ public: /** * @brief Find the proxy for the target event collection. + * @param evColl McEventCollection type * @param sg Target event store. * May return nullptr if the collection is not found. */ - SG::DataProxy* find_proxy (const IProxyDict* sg) const; + static SG::DataProxy* find_proxy (EBC_EVCOLL evColl, const IProxyDict* sg); /** diff --git a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref index b7430df5df9969fb9ce9e54b348f54acc0787a7e..a0a4df283c29f9d5a647fcba5b5771845b825f7d 100644 --- a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref +++ b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref @@ -1,4 +1,4 @@ -[==========] Running 4 tests from 1 test case. +[==========] Running 9 tests from 1 test case. [----------] Global test environment set-up. ApplicationMgr SUCCESS ==================================================================================================================================== @@ -10,7 +10,7 @@ EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -[----------] 4 tests from HepMcParticleLink_test +[----------] 9 tests from HepMcParticleLink_test [ RUN ] HepMcParticleLink_test.old_test *** HepMcParticleLink_test starts *** ClassIDSvc INFO getRegistryEntries: read 817 CLIDRegistry entries for module ALL @@ -21,12 +21,25 @@ HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key [ RUN ] HepMcParticleLink_test.broken_event_link ClassIDSvc INFO getRegistryEntries: read 1070 CLIDRegistry entries for module ALL [ OK ] HepMcParticleLink_test.broken_event_link (1 ms) -[ RUN ] HepMcParticleLink_test.truth_event_link -[ OK ] HepMcParticleLink_test.truth_event_link (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_first_event +[ OK ] HepMcParticleLink_test.truth_event_link_first_event (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_second_event +[ OK ] HepMcParticleLink_test.truth_event_link_second_event (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_third_event +[ OK ] HepMcParticleLink_test.truth_event_link_third_event (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_fourth_event +[ OK ] HepMcParticleLink_test.truth_event_link_fourth_event (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_delta_rays +[ OK ] HepMcParticleLink_test.truth_event_link_delta_rays (0 ms) +[ RUN ] HepMcParticleLink_test.truth_event_link_cut_events +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +[ OK ] HepMcParticleLink_test.truth_event_link_cut_events (0 ms) [ RUN ] HepMcParticleLink_test.max_event_number [ OK ] HepMcParticleLink_test.max_event_number (0 ms) -[----------] 4 tests from HepMcParticleLink_test (54 ms total) +[----------] 9 tests from HepMcParticleLink_test (54 ms total) [----------] Global test environment tear-down -[==========] 4 tests from 1 test case ran. (176 ms total) -[ PASSED ] 4 tests. +[==========] 9 tests from 1 test case ran. (176 ms total) +[ PASSED ] 9 tests. diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx index 5a6aa6abfb9a73a464aee9d64a38362bb4355b54..ddaf6e6243a543e870711cb2a7dd585b09df869b 100644 --- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx +++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -26,14 +26,14 @@ namespace { /** * @brief StoreGate keys to try for each EBC_EVCOLL enum. */ -constexpr static int NKEYS = 4; +constexpr static int NKEYS = 5; const std::string s_keys[EBC_NCOLLKINDS][NKEYS] = { - {"TruthEvent","G4Truth","GEN_AOD","GEN_EVENT"}, - {"TruthEvent_PU","G4Truth_PU","GEN_AOD_PU","GEN_EVENT_PU"}, - {"TruthEvent_HighPtPU","G4Truth_HighPtPU","GEN_AOD_HighPtPU","GEN_EVENT_HighPtPU"}, - {"TruthEvent_Cavern","G4Truth_Cavern","GEN_AOD_Cavern","GEN_EVENT_Cavern"}, + {"TruthEvent","G4Truth","GEN_AOD","GEN_EVENT","Bkg_TruthEvent"}, + {"TruthEvent_PU","G4Truth_PU","GEN_AOD_PU","GEN_EVENT_PU","Bkg_TruthEvent_PU"}, + {"TruthEvent_HighPtPU","G4Truth_HighPtPU","GEN_AOD_HighPtPU","GEN_EVENT_HighPtPU","Bkg_TruthEvent_HighPtPU"}, + {"TruthEvent_Cavern","G4Truth_Cavern","GEN_AOD_Cavern","GEN_EVENT_Cavern","Bkg_TruthEvent_Cavern"}, }; @@ -145,7 +145,7 @@ HepMcParticleLink::HepMcParticleLink (const HepMC::GenParticle* part, PositionFlag positionFlag /*= IS_INDEX*/, IProxyDict* sg /*= SG::CurrentEventStore::store()*/) : m_ptrs (part), - m_extBarcode((0 != part) ? part->barcode() : 0, eventIndex, evColl, positionFlag) + m_extBarcode((0 != part) ? HepMC::barcode(part) : 0, eventIndex, evColl, positionFlag) { assert(part); @@ -168,9 +168,9 @@ HepMcParticleLink::HepMcParticleLink (const HepMC::GenParticle* part, const HepMC::GenParticle* HepMcParticleLink::cptr() const { const IProxyDict* sg = nullptr; - const HepMC::GenParticle* p = m_ptrs.get (sg); + auto p = m_ptrs.get (sg); if (!p) { - if (0 == barcode() || 0x7fffffff == barcode()) { + if (0 == barcode()) { #if 0 MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink"); log << MSG::DEBUG @@ -179,6 +179,9 @@ const HepMC::GenParticle* HepMcParticleLink::cptr() const #endif return nullptr; } + if (!sg) { + sg = SG::CurrentEventStore::store(); + } if (const McEventCollection* pEvtColl = retrieveMcEventCollection(sg)) { const HepMC::GenEvent *pEvt = nullptr; index_type index, position; @@ -203,16 +206,24 @@ const HepMC::GenParticle* HepMcParticleLink::cptr() const } if (0 != pEvt) { - p = pEvt->barcode_to_particle(barcode()); - m_ptrs.set (sg, p); + p = HepMC::barcode_to_particle(pEvt,barcode()); + if (p) { + m_ptrs.set (sg, p); + } if (position != ExtendedBarCode::UNDEFINED) { m_extBarcode.makeIndex (pEvt->event_number(), position); } } else { MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink"); - log << MSG::WARNING - << "cptr: Mc Truth not stored for event " << eventIndex() + if (position != ExtendedBarCode::UNDEFINED) { + log << MSG::WARNING + << "cptr: Mc Truth not stored for event at " << position + << endmsg; + } else { + log << MSG::WARNING + << "cptr: Mc Truth not stored for event with event number " << index << endmsg; + } } } else { MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink"); @@ -232,16 +243,45 @@ HepMcParticleLink::index_type HepMcParticleLink::eventIndex() const index_type index, position; m_extBarcode.eventIndex (index, position); if (index == ExtendedBarCode::UNDEFINED) { - // Don't trip the assertion for a null link. - if (barcode() == 0 || barcode() == 0x7fffffff) return 0; - cptr(); - m_extBarcode.eventIndex (index, position); - assert (index != ExtendedBarCode::UNDEFINED); + const HepMC::GenEvent* pEvt{}; + const IProxyDict* sg{}; + auto p = m_ptrs.get (sg); + if (const McEventCollection* coll = retrieveMcEventCollection (getEventCollection(),sg)) { + if (position < coll->size()) { + pEvt = coll->at (position); + } + if (pEvt) { + const int event_number = pEvt->event_number(); + p = HepMC::barcode_to_particle(pEvt,barcode()); + if (p) { + m_ptrs.set (sg, p); + } + if(event_number>-1) { + index = static_cast<index_type>(event_number); + m_extBarcode.makeIndex (index, HepMcParticleLink::IS_INDEX); + return index; + } + } + } + } + // Don't trip the assertion for a null link. + if (barcode() == 0 ) { // || barcode() == 0x7fffffff) + if (index != ExtendedBarCode::UNDEFINED) { + return index; + } + return 0; } + cptr(); + m_extBarcode.eventIndex (index, position); + assert (index != ExtendedBarCode::UNDEFINED); return index; } +/** + * @brief Return the position in the McEventCollection of the + * (first) GenEvent with a given event number + */ HepMcParticleLink::index_type HepMcParticleLink::getEventPositionInCollection (const IProxyDict* sg) const { @@ -254,20 +294,56 @@ HepMcParticleLink::getEventPositionInCollection (const IProxyDict* sg) const return 0; } + EBC_EVCOLL evColl = getEventCollection(); + std::vector<index_type> positions = getEventPositionInCollection(index, evColl, sg); + return positions[0]; +} + + +/** + * @brief Return the position in the McEventCollection of the + * (first) GenEvent with a given event number + */ +std::vector<HepMcParticleLink::index_type> +HepMcParticleLink::getEventPositionInCollection (index_type index, EBC_EVCOLL evColl, const IProxyDict* sg) +{ + std::vector<index_type> positions; positions.reserve(1); const int intIndex = static_cast<int>(index); - const McEventCollection* coll = retrieveMcEventCollection (sg); - size_t sz = coll->size(); - for (size_t i = 0; i < sz; i++) { - if ((*coll)[i]->event_number() == intIndex) { - return i; + if (const McEventCollection* coll = retrieveMcEventCollection (evColl,sg)) { + size_t sz = coll->size(); + for (size_t i = 0; i < sz; i++) { + if ((*coll)[i]->event_number() == intIndex) { + positions.push_back(i); + } } } + if (positions.empty() ) { + positions.push_back(ExtendedBarCode::UNDEFINED); + } + return positions; +} + - return ExtendedBarCode::UNDEFINED; +/** + * @brief Return the event number of the GenEvent at the specified + * position in the McEventCollection. + */ +int HepMcParticleLink::getEventNumberAtPosition (index_type position, EBC_EVCOLL evColl, const IProxyDict* sg) +{ + if (const McEventCollection* coll = retrieveMcEventCollection (evColl,sg)) { + if (position < coll->size()) { + return coll->at (position)->event_number(); + } + } +#if 0 + MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink"); + log << MSG::WARNING << "getEventNumberAtPosition: position = " << position << ", McEventCollection size = "<< coll->size() << endmsg; +#endif + return -999; } -/** +/** * @brief Return the corresponding enum from a McEventCollection name. */ EBC_EVCOLL HepMcParticleLink::find_enumFromKey (const std::string& evCollName) @@ -297,14 +373,15 @@ void HepMcParticleLink::setExtendedBarCode (const ExtendedBarCode& extBarcode) /** * @brief Look up the event collection we're targeting. + * @param evColl McEventCollection type * @param sg Target event store. * May return nullptr if the collection is not found. */ const McEventCollection* -HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const +HepMcParticleLink::retrieveMcEventCollection (EBC_EVCOLL evColl, const IProxyDict* sg) { const McEventCollection* pEvtColl = nullptr; - SG::DataProxy* proxy = find_proxy (sg); + SG::DataProxy* proxy = find_proxy (evColl, sg); if (proxy) { pEvtColl = SG::DataProxy_cast<McEventCollection> (proxy); if (!pEvtColl) { @@ -315,16 +392,27 @@ HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const return pEvtColl; } +/** + * @brief Look up the event collection we're targeting. + * @param sg Target event store. + * May return nullptr if the collection is not found. + */ +const McEventCollection* +HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const +{ + EBC_EVCOLL evColl = getEventCollection(); + return retrieveMcEventCollection(evColl, sg); +} + /** * @brief Find the proxy for the target event collection. * @param sg Target event store. * May return nullptr if the collection is not found. */ -SG::DataProxy* HepMcParticleLink::find_proxy (const IProxyDict* sg) const +SG::DataProxy* HepMcParticleLink::find_proxy (EBC_EVCOLL evColl, const IProxyDict* sg) { const CLID clid = ClassID_traits<McEventCollection>::ID(); - EBC_EVCOLL evColl = getEventCollection(); assert (evColl < EBC_NCOLLKINDS); unsigned int hint_orig = s_hints[evColl]; if (hint_orig >= NKEYS) hint_orig = 0; diff --git a/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx b/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx index 7a930f29d4ac3d599a6e7b34951fb5322d41bbc7..61262add751bf70d1375e9d5685b51744cf5a71e 100644 --- a/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx +++ b/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx @@ -109,7 +109,7 @@ void ThreadingTest::readerThread::operator()() do { if (!checked[i]) { const IProxyDict* sg = nullptr; - const HepMC::GenParticle* p = m_test.m_vals[i].get (sg); + auto p = m_test.m_vals[i].get (sg); if (p != nullptr) { assert (p == &m_test.m_parts[i]); assert (sg == nullptr); diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx index 3f33ea31b82122dac032e20f15374fa916bf3ca7..bca5b7087184206654cb5adfa377ab482268d8c0 100644 --- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx +++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx @@ -10,6 +10,7 @@ #undef NDEBUG #include <iostream> +#include <limits> #include <list> // Framework #include "TestTools/initGaudi.h" @@ -21,7 +22,6 @@ #include "AtlasHepMC/GenEvent.h" // CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/SystemOfUnits.h" // Athena headers @@ -50,6 +50,9 @@ namespace MCTesting { } virtual void TearDown() override { + StoreGateSvc* pStore(nullptr); + ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); + pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies } }; @@ -71,51 +74,51 @@ namespace MCTesting { // First create the event container, with Signal Process 20, event number 1 - HepMC::GenEvent* evt = new HepMC::GenEvent( 20, 1 ); + HepMC::GenEvent* evt = HepMC::newGenEvent( 20, 1 ); // // create vertex 1 and vertex 2, together with their inparticles - HepMC::GenVertex* v1 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v1 = HepMC::newGenVertexPtr(); evt->add_vertex( v1 ); - v1->add_particle_in( new HepMC::GenParticle( CLHEP::HepLorentzVector(0,0,7000,7000), + v1->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0,0,7000,7000), 2212, 3 ) ); - HepMC::GenVertex* v2 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v2 = HepMC::newGenVertexPtr(); evt->add_vertex( v2 ); - v2->add_particle_in( new HepMC::GenParticle( CLHEP::HepLorentzVector(0,0,-7000,7000), + v2->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0,0,-7000,7000), 2212, 3 ) ); // // create the outgoing particles of v1 and v2 - HepMC::GenParticle* p3 = - new HepMC::GenParticle( CLHEP::HepLorentzVector(.750,-1.569,32.191,32.238), 1, 3 ); + HepMC::GenParticlePtr p3 = + HepMC::newGenParticlePtr( HepMC::FourVector(.750,-1.569,32.191,32.238), 1, 3 ); v1->add_particle_out( p3 ); - HepMC::GenParticle* p4 = - new HepMC::GenParticle( CLHEP::HepLorentzVector(-3.047,-19.,-54.629,57.920), -2, 3 ); + HepMC::GenParticlePtr p4 = + HepMC::newGenParticlePtr( HepMC::FourVector(-3.047,-19.,-54.629,57.920), -2, 3 ); v2->add_particle_out( p4 ); // // create v3 - HepMC::GenVertex* v3 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v3 = HepMC::newGenVertexPtr(); evt->add_vertex( v3 ); v3->add_particle_in( p3 ); v3->add_particle_in( p4 ); v3->add_particle_out( - new HepMC::GenParticle( CLHEP::HepLorentzVector(-3.813,0.113,-1.833,4.233 ), 22, 1 ) + HepMC::newGenParticlePtr( HepMC::FourVector(-3.813,0.113,-1.833,4.233 ), 22, 1 ) ); - HepMC::GenParticle* p5 = - new HepMC::GenParticle( CLHEP::HepLorentzVector(1.517,-20.68,-20.605,85.925), -24,3); + HepMC::GenParticlePtr p5 = + HepMC::newGenParticlePtr( HepMC::FourVector(1.517,-20.68,-20.605,85.925), -24,3); v3->add_particle_out( p5 ); // // create v4 - HepMC::GenVertex* v4 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v4 = HepMC::newGenVertexPtr(); evt->add_vertex( v4 ); v4->add_particle_in( p5 ); v4->add_particle_out( - new HepMC::GenParticle( CLHEP::HepLorentzVector(-2.445,28.816,6.082,29.552), 1,1 ) + HepMC::newGenParticlePtr( HepMC::FourVector(-2.445,28.816,6.082,29.552), 1,1 ) ); v4->add_particle_out( - new HepMC::GenParticle( CLHEP::HepLorentzVector(3.962,-49.498,-26.687,56.373), -2,1 ) + HepMC::newGenParticlePtr( HepMC::FourVector(3.962,-49.498,-26.687,56.373), -2,1 ) ); // // tell the event which vertex is the signal process vertex - evt->set_signal_process_vertex( v3 ); + HepMC::set_signal_process_vertex(evt, v3 ); // the event is complete, we now print it out to the screen #ifdef GENP_DEBUG evt->print(); @@ -128,56 +131,105 @@ namespace MCTesting { class is_photon { public: - bool operator() ( const HepMC::GenParticle* p ) { + bool operator() ( const HepMC::GenParticlePtr p ) { return ( p && p->pdg_id() == 22 ); } }; - HepMC::GenParticle* populateGenEvent(HepMC::GenEvent & ge) + HepMC::GenParticlePtr populateGenEvent(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); return inParticle3; } - HepMC::GenParticle* populateGenEvent2(HepMC::GenEvent & ge) + HepMC::GenParticlePtr populateGenEvent2(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); return inParticle4; } + HepMC::GenParticlePtr populateFilteredGenEvent(HepMC::GenEvent & ge) + { + //.......Create new particle (geantino) to link hits from pileup + HepMC::GenParticlePtr genPart=HepMC::newGenParticlePtr(); + genPart->set_pdg_id(999); //Geantino + genPart->set_status(1); //!< set decay status + HepMC::suggest_barcode(genPart, std::numeric_limits<int32_t>::max() ); + + HepMC::GenVertexPtr genVertex=HepMC::newGenVertexPtr (); + genVertex->add_particle_out(genPart); + + //to set geantino vertex as a truth primary vertex + HepMC::GenVertexPtr hScatVx = HepMC::barcode_to_vertex(&ge,-3); + if(hScatVx!=nullptr) { + HepMC::FourVector pmvxpos=hScatVx->position(); + genVertex->set_position(pmvxpos); + //to set geantino kinematic phi=eta=0, E=p=E_hard_scat + HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin(); + if (hScatVx->particles_in_size()==2){ + HepMC::FourVector mom1=(*itrp)->momentum(); + HepMC::FourVector mom2=(*(++itrp))->momentum(); + HepMC::FourVector vxmom; + vxmom.setPx(mom1.e()+mom2.e()); + vxmom.setPy(0.); + vxmom.setPz(0.); + vxmom.setE(mom1.e()+mom2.e()); + + genPart->set_momentum(vxmom); + } + } + + if(!ge.vertices_empty()){ + std::vector<HepMC::GenVertexPtr> vtxvec; + HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin(); + for (;itvtx != ge.vertices_end(); ++itvtx ) { + ge.remove_vertex(*itvtx); + vtxvec.push_back((*itvtx)); + //fix me: delete vertex pointer causes crash + //delete (*itvtx); + } + for(unsigned int i=0;i<vtxvec.size();i++) delete vtxvec[i]; + } + + //.....add new vertex with geantino + ge.add_vertex(genVertex); + + return genPart; + } + TEST_F(HepMcParticleLink_test, old_test) { std::cout << "*** HepMcParticleLink_test starts ***" <<std::endl; @@ -187,23 +239,23 @@ namespace MCTesting { HepMC::GenEvent* pEvent(buildEvent()); inputTestDataHandle->push_back(pEvent); inputTestDataHandle->push_back(buildEvent()); //a copy - std::list<HepMC::GenParticle*> theGammas; - HepMC::copy_if( pEvent->particles_begin(), pEvent->particles_end(), + std::list<HepMC::GenParticlePtr> theGammas; + std::copy_if( pEvent->particles_begin(), pEvent->particles_end(), back_inserter(theGammas), is_photon() ); ASSERT_EQ(1u, theGammas.size()); - const HepMC::GenParticle* pGamma(theGammas.front()); + const HepMC::GenParticlePtr pGamma(theGammas.front()); #ifdef GENP_DEBUG pGamma->print(); - std::cout << "gamma barcode " << hex << pGamma->barcode() << std::endl; + std::cout << "gamma barcode " << hex << HepMC::barcode(pGamma) << std::endl; #endif HepMcParticleLink gammaLink1(pGamma); - HepMcParticleLink gammaLink2(pGamma->barcode()); + HepMcParticleLink gammaLink2(HepMC::barcode(pGamma)); HepMcParticleLink gammaLink11(pGamma, 1); - HepMcParticleLink gammaLink12(pGamma->barcode(), 1); + HepMcParticleLink gammaLink12(HepMC::barcode(pGamma), 1); std::cout << "Testing HepMcParticleLink streamer " - << gammaLink1 << " --- " << gammaLink11 <<std::endl; + << gammaLink1 << " --- " << gammaLink11 <<std::endl; #ifdef GENP_DEBUG @@ -214,7 +266,7 @@ namespace MCTesting { #endif ASSERT_EQ(*gammaLink1, *gammaLink2); ASSERT_EQ(gammaLink1, gammaLink2); - ASSERT_EQ(gammaLink1.barcode(), pGamma->barcode()); + ASSERT_EQ(gammaLink1.barcode(), HepMC::barcode(pGamma)); ASSERT_EQ(*gammaLink11, *gammaLink12); ASSERT_EQ(gammaLink11, gammaLink12); @@ -222,9 +274,6 @@ namespace MCTesting { ASSERT_EQ(*gammaLink1, *gammaLink11); ASSERT_NE( gammaLink1, gammaLink11 ); //FIXME weird! Can't check ptr... ASSERT_LT( gammaLink1, gammaLink11 ); //FIXME weird! Can't check ptr... - StoreGateSvc* pStore(nullptr); - ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); - pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies std::cout << "*** HepMcParticleLink_test OK ***" <<std::endl; } @@ -234,23 +283,20 @@ namespace MCTesting { SG::WriteHandle<McEventCollection> inputTestDataHandle{"GEN_EVENT"}; inputTestDataHandle = std::make_unique<McEventCollection>(); // Fill it with a dummy GenEvent - inputTestDataHandle->push_back(new HepMC::GenEvent(20,1)); + inputTestDataHandle->push_back(HepMC::newGenEvent(20,1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); - const HepMC::GenParticle* particle1 = populateGenEvent(ge1); + const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1); // A HepMcParticleLink built using a GenParticle pointer should // still work. HepMcParticleLink testLink1a(particle1,0); ASSERT_TRUE( testLink1a.isValid() ); // A HepMcParticleLink built using the barcode and the position of // the GenEvent in the McEventCollection should still work. - HepMcParticleLink testLink1b(particle1->barcode(),0); + HepMcParticleLink testLink1b(HepMC::barcode(particle1),0); ASSERT_TRUE( testLink1b.isValid() ); - StoreGateSvc* pStore(nullptr); - ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); - pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies } - TEST_F(HepMcParticleLink_test, truth_event_link) { + TEST_F(HepMcParticleLink_test, truth_event_link_first_event) { // create dummy input McEventCollection with a name that // HepMcParticleLink knows about SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; @@ -259,46 +305,49 @@ namespace MCTesting { // Add a dummy GenEvent const int process_id1(20); const int event_number1(17); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); const HepMcParticleLink::index_type dummyIndex1(0); const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); - const HepMC::GenParticle* particle1 = populateGenEvent(ge1); + const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1); // Add a second dummy GenEvent const int process_id2(20); const int event_number2(25); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2)); - const HepMcParticleLink::index_type dummyIndex2(1); - const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); - const HepMC::GenParticle* particle2 = populateGenEvent2(ge2); + (void)populateGenEvent2(ge2); // Add a third dummy GenEvent (identical to the first) const int process_id3(20); const int event_number3(17); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3)); - const HepMcParticleLink::index_type dummyIndex3(2); - const HepMcParticleLink::index_type refEvtNum3 = static_cast<HepMcParticleLink::index_type>(event_number3); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); - const HepMC::GenParticle* particle3 = populateGenEvent(ge3); + (void)populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + (void)populateFilteredGenEvent(ge4); - //Testing links to the first dummy GenEvent const IProxyDict* sg = SG::CurrentEventStore::store(); + //Testing links to the first dummy GenEvent + // HepMcParticleLink built using a GenParticle pointer and the // position of the GenEvent. - HepMcParticleLink testLink1a(particle1,0, EBC_MAINEVCOLL, + HepMcParticleLink testLink1a(particle1,dummyIndex1, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1a.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1a.barcode()); + ASSERT_EQ(HepMC::barcode(particle1), testLink1a.barcode()); ASSERT_EQ( refEvtNum1, testLink1a.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1a.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. - HepMcParticleLink testLink1b(particle1->barcode(),0, EBC_MAINEVCOLL, + HepMcParticleLink testLink1b(HepMC::barcode(particle1),dummyIndex1, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1b.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1b.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1b.barcode()); ASSERT_EQ( refEvtNum1, testLink1b.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1b.getEventPositionInCollection(sg)); ASSERT_EQ(*(testLink1a.cptr()),*(testLink1b.cptr())); @@ -306,38 +355,74 @@ namespace MCTesting { // event_number of the GenEvent. HepMcParticleLink testLink1c(particle1,event_number1); ASSERT_TRUE( testLink1c.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1c.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1c.barcode()); ASSERT_NE( dummyIndex1, testLink1c.eventIndex()); ASSERT_EQ( refEvtNum1, testLink1c.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1c.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. - HepMcParticleLink testLink1d(particle1->barcode(),event_number1); + HepMcParticleLink testLink1d(HepMC::barcode(particle1),event_number1); ASSERT_TRUE( testLink1d.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1d.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1d.barcode()); ASSERT_NE( dummyIndex1, testLink1d.eventIndex()); ASSERT_EQ( refEvtNum1, testLink1d.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1d.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1d.cptr()); + } + + TEST_F(HepMcParticleLink_test, truth_event_link_second_event) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + (void)populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); + const HepMcParticleLink::index_type dummyIndex2(1); + const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + const HepMC::GenParticlePtr particle2 = populateGenEvent2(ge2); + // Add a third dummy GenEvent (identical to the first) + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); + HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); + (void)populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + (void)populateFilteredGenEvent(ge4); + + const IProxyDict* sg = SG::CurrentEventStore::store(); //Testing links to the second dummy GenEvent // HepMcParticleLink built using a GenParticle pointer and the // position of the GenEvent. - HepMcParticleLink testLink2a(particle2,1, EBC_MAINEVCOLL, + HepMcParticleLink testLink2a(particle2, dummyIndex2, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2a.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2a.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2a.barcode()); ASSERT_EQ( refEvtNum2, testLink2a.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2a.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. - HepMcParticleLink testLink2b(particle2->barcode(),1, EBC_MAINEVCOLL, + HepMcParticleLink testLink2b(HepMC::barcode(particle2), dummyIndex2, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2b.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2b.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2b.barcode()); ASSERT_EQ( refEvtNum2, testLink2b.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2b.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2b.cptr()); @@ -345,60 +430,312 @@ namespace MCTesting { // event_number of the GenEvent. HepMcParticleLink testLink2c(particle2,event_number2); ASSERT_TRUE( testLink2c.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2c.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2c.barcode()); ASSERT_NE( dummyIndex2, testLink2c.eventIndex()); ASSERT_EQ( refEvtNum2, testLink2c.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2c.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. - HepMcParticleLink testLink2d(particle2->barcode(),event_number2); + HepMcParticleLink testLink2d(HepMC::barcode(particle2),event_number2); ASSERT_TRUE( testLink2d.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2d.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2d.barcode()); ASSERT_NE( dummyIndex2, testLink2d.eventIndex()); ASSERT_EQ( refEvtNum2, testLink2d.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2d.cptr()); + } + + TEST_F(HepMcParticleLink_test, truth_event_link_third_event) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + (void)populateGenEvent2(ge2); + // Add a third dummy GenEvent (identical to the first) + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); + const HepMcParticleLink::index_type dummyIndex3(2); + const HepMcParticleLink::index_type refEvtNum3 = static_cast<HepMcParticleLink::index_type>(event_number3); + HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); + const HepMC::GenParticlePtr particle3 = populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + (void)populateFilteredGenEvent(ge4); + //Testing links to the third dummy GenEvent // HepMcParticleLink built using a GenParticle pointer and the // position of the GenEvent. - HepMcParticleLink testLink3a(particle3,2, EBC_MAINEVCOLL, + HepMcParticleLink testLink3a(particle3, dummyIndex3, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink3a.isValid() ); - ASSERT_EQ( particle3->barcode(), testLink3a.barcode()); + ASSERT_EQ( HepMC::barcode(particle3), testLink3a.barcode()); ASSERT_EQ( refEvtNum3, testLink3a.eventIndex()); ASSERT_EQ(particle3,testLink3a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. - HepMcParticleLink testLink3b(particle3->barcode(),2, EBC_MAINEVCOLL, + HepMcParticleLink testLink3b(HepMC::barcode(particle3), dummyIndex3, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink3b.isValid() ); - ASSERT_EQ( particle3->barcode(), testLink3b.barcode()); + ASSERT_EQ( HepMC::barcode(particle3), testLink3b.barcode()); ASSERT_EQ( refEvtNum3, testLink3b.eventIndex()); ASSERT_EQ(particle3,testLink3b.cptr()); // HepMcParticleLink built using a GenParticle pointer and the // event_number of the GenEvent. HepMcParticleLink testLink3c(particle3,event_number3); ASSERT_TRUE( testLink3c.isValid() ); - ASSERT_EQ( particle3->barcode(), testLink3c.barcode()); + ASSERT_EQ( HepMC::barcode(particle3), testLink3c.barcode()); ASSERT_NE( dummyIndex3, testLink3c.eventIndex()); ASSERT_EQ( refEvtNum3, testLink3c.eventIndex()); ASSERT_EQ(particle3,testLink3c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. BROKEN - HepMcParticleLink testLink3d(particle3->barcode(),event_number3); + HepMcParticleLink testLink3d(HepMC::barcode(particle3),event_number3); ASSERT_TRUE( testLink3d.isValid() ); - ASSERT_EQ( particle3->barcode(), testLink3d.barcode()); + ASSERT_EQ( HepMC::barcode(particle3), testLink3d.barcode()); ASSERT_NE( dummyIndex3, testLink3d.eventIndex()); ASSERT_EQ( refEvtNum3, testLink3d.eventIndex()); ASSERT_NE(particle3,testLink3d.cptr()); ASSERT_EQ(particle1,testLink3d.cptr()); //POINTS AT THE IDENTICAL PARTICLE IN FIRST GenEvent!! + } + + TEST_F(HepMcParticleLink_test, truth_event_link_fourth_event) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + (void)populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + (void)populateGenEvent2(ge2); + // Add a third dummy GenEvent (identical to the first) + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); + HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); + (void)populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + const HepMcParticleLink::index_type dummyIndex4(3); + const HepMcParticleLink::index_type refEvtNum4 = static_cast<HepMcParticleLink::index_type>(event_number4); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + const HepMC::GenParticlePtr particle4 = populateFilteredGenEvent(ge4); + + const IProxyDict* sg = SG::CurrentEventStore::store(); + + // Testing links to the fourth GenEvent - filtered pile-up truth + + // HepMcParticleLink built using a GenParticle pointer and the + // event_number of the GenEvent. + HepMcParticleLink testLink4a(particle4,event_number4); + ASSERT_TRUE( testLink4a.isValid() ); + ASSERT_EQ( HepMC::barcode(particle4), testLink4a.barcode()); + ASSERT_EQ( refEvtNum4, testLink4a.eventIndex()); + ASSERT_EQ( dummyIndex4, testLink4a.getEventPositionInCollection(sg)); + ASSERT_EQ( particle4, testLink4a.cptr()); + // A HepMcParticleLink built using the barcode and the event_number of + // the GenEvent. + HepMcParticleLink testLink4b(HepMC::barcode(particle4),event_number4); + ASSERT_TRUE( testLink4b.isValid() ); + ASSERT_EQ( HepMC::barcode(particle4), testLink4b.barcode()); + ASSERT_EQ( refEvtNum4, testLink4b.eventIndex()); + ASSERT_EQ( dummyIndex4, testLink4a.getEventPositionInCollection(sg)); + ASSERT_EQ( particle4, testLink4b.cptr()); + // HepMcParticleLink built using a GenParticle pointer and the + // position of the GenEvent. + HepMcParticleLink testLink4c(particle4, dummyIndex4, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink4c.isValid() ); + ASSERT_EQ( HepMC::barcode(particle4), testLink4c.barcode()); + ASSERT_EQ( refEvtNum4, testLink4c.eventIndex()); + ASSERT_EQ( dummyIndex4, testLink4c.getEventPositionInCollection(sg)); + ASSERT_EQ( particle4, testLink4c.cptr()); - StoreGateSvc* pStore(nullptr); - ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); - pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies + // A HepMcParticleLink built using the barcode and the position of + // the GenEvent. + HepMcParticleLink testLink4d(HepMC::barcode(particle4), dummyIndex4, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_TRUE( testLink4d.isValid() ); + ASSERT_EQ( HepMC::barcode(particle4), testLink4d.barcode()); + ASSERT_EQ( refEvtNum4, testLink4d.eventIndex()); + ASSERT_EQ( dummyIndex4, testLink4d.getEventPositionInCollection(sg)); + ASSERT_EQ( particle4, testLink4d.cptr()); + } + + TEST_F(HepMcParticleLink_test, truth_event_link_delta_rays) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); + const HepMcParticleLink::index_type dummyIndex1(0); + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + (void)populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); + const HepMcParticleLink::index_type dummyIndex2(1); + const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + (void)populateGenEvent2(ge2); + // Add a third dummy GenEvent (identical to the first) + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); + HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); + (void)populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + (void)populateFilteredGenEvent(ge4); + + const IProxyDict* sg = SG::CurrentEventStore::store(); + + // Testing Links to delta-rays (barcode=0) - not recorded in McEventCollection + const int deltaRayBarcode(0); + HepMC::GenParticlePtr deltaRayPtr{}; + + // HepMcParticleLink built using a delta-ray barcode and the event_number of + // the GenEvent. + HepMcParticleLink testLink5a(deltaRayBarcode, refEvtNum1); + ASSERT_EQ( refEvtNum1, testLink5a.eventIndex()); + ASSERT_FALSE( testLink5a.isValid() ); + ASSERT_EQ( deltaRayBarcode, testLink5a.barcode()); + ASSERT_EQ( dummyIndex1, testLink5a.getEventPositionInCollection(sg)); + ASSERT_EQ( deltaRayPtr, testLink5a.cptr()); + + // HepMcParticleLink built using a delta-ray barcode and the event_number of + // the GenEvent. GenEvent not recorded + const int event_number5(460); + const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5); + HepMcParticleLink testLink5b(deltaRayBarcode, refEvtNum5); + ASSERT_FALSE( testLink5b.isValid() ); + ASSERT_EQ( deltaRayBarcode, testLink5b.barcode()); + ASSERT_EQ( refEvtNum5, testLink5b.eventIndex()); + ASSERT_EQ( HepMcParticleLink:: ExtendedBarCode::UNDEFINED, testLink5b.getEventPositionInCollection(sg)); + ASSERT_EQ( deltaRayPtr, testLink5b.cptr()); + + // HepMcParticleLink built using a delta-ray barcode and the + // position of the GenEvent. + HepMcParticleLink testLink5c(deltaRayBarcode, dummyIndex1, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_FALSE( testLink5c.isValid() ); + ASSERT_EQ( deltaRayBarcode, testLink5c.barcode()); + ASSERT_EQ( refEvtNum1, testLink5c.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink5c.getEventPositionInCollection(sg)); + ASSERT_EQ( deltaRayPtr, testLink5c.cptr()); + + // HepMcParticleLink built using a delta-ray barcode and the + // position of the GenEvent. + HepMcParticleLink testLink5d(deltaRayBarcode, dummyIndex2, EBC_MAINEVCOLL, + HepMcParticleLink::IS_POSITION); + ASSERT_FALSE( testLink5d.isValid() ); + ASSERT_EQ( deltaRayBarcode, testLink5d.barcode()); + ASSERT_EQ( refEvtNum2, testLink5d.eventIndex()); + ASSERT_EQ( dummyIndex2, testLink5d.getEventPositionInCollection(sg)); + ASSERT_EQ( deltaRayPtr, testLink5d.cptr()); + } + + TEST_F(HepMcParticleLink_test, truth_event_link_cut_events) { + // create dummy input McEventCollection with a name that + // HepMcParticleLink knows about + SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + + // Add a dummy GenEvent + const int process_id1(20); + const int event_number1(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); + const HepMcParticleLink::index_type dummyIndex1(0); + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); + HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); + (void)populateGenEvent(ge1); + // Add a second dummy GenEvent + const int process_id2(20); + const int event_number2(25); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); + HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); + (void)populateGenEvent2(ge2); + // Add a third dummy GenEvent (identical to the first) + const int process_id3(20); + const int event_number3(17); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); + HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); + (void)populateGenEvent(ge3); + + const int event_number4(89); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + (void)populateFilteredGenEvent(ge4); + + //Testing links to the first dummy GenEvent + const IProxyDict* sg = SG::CurrentEventStore::store(); + + // Links to GenParticles which were not copied to the current McEventCollection + + // Info about a GenParticle/GenEvent which is not part of the + // McEventCollection. For example if pile-up truth was not + // recorded. + const int event_number5(460); + const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5); + const int cutBarcode(210001); + const HepMC::GenParticlePtr cutParticlePtr{}; + + // Link to a GenParticle which was not recorded to the + // McEventCollection, even though other parts of the same GenEvent + // were recorded. + HepMcParticleLink testLink6a(cutBarcode, refEvtNum1); + ASSERT_FALSE( testLink6a.isValid() ); + ASSERT_EQ( cutBarcode, testLink6a.barcode()); + ASSERT_EQ( refEvtNum1, testLink6a.eventIndex()); + ASSERT_EQ( dummyIndex1, testLink6a.getEventPositionInCollection(sg)); + ASSERT_EQ( cutParticlePtr, testLink6a.cptr()); + + // Link to a GenEvent which was not recorded to the McEventCollection + HepMcParticleLink testLink6b(cutBarcode, refEvtNum5); + ASSERT_FALSE( testLink6b.isValid() ); + ASSERT_EQ( cutBarcode, testLink6b.barcode()); + ASSERT_EQ( refEvtNum5, testLink6b.eventIndex()); + ASSERT_EQ( HepMcParticleLink:: ExtendedBarCode::UNDEFINED, testLink6b.getEventPositionInCollection(sg)); + ASSERT_EQ( cutParticlePtr, testLink6b.cptr()); } TEST_F(HepMcParticleLink_test, max_event_number) { @@ -415,42 +752,42 @@ namespace MCTesting { // hold the eventIndex is used to flag whether the it represents the // position of the GenEvent in the McEventCollection or the // GenEvent::event_number. - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); const HepMcParticleLink::index_type dummyIndex1(0); const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); - const HepMC::GenParticle* particle1 = populateGenEvent(ge1); + const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1); // Add a second dummy GenEvent const int process_id2(20); const int event_number2(25); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id2, event_number2)); const HepMcParticleLink::index_type dummyIndex2(1); const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2); HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); - const HepMC::GenParticle* particle2 = populateGenEvent2(ge2); + const HepMC::GenParticlePtr particle2 = populateGenEvent2(ge2); // Add a third dummy GenEvent const int process_id3(20); const int event_number3(17); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id3, event_number3)); //Testing links to the first dummy GenEvent const IProxyDict* sg = SG::CurrentEventStore::store(); // HepMcParticleLink built using a GenParticle pointer and the // position of the GenEvent. - HepMcParticleLink testLink1a(particle1,0, EBC_MAINEVCOLL, + HepMcParticleLink testLink1a(particle1, dummyIndex1, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1a.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1a.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1a.barcode()); ASSERT_EQ( refEvtNum1, testLink1a.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1a.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. - HepMcParticleLink testLink1b(particle1->barcode(),0, EBC_MAINEVCOLL, + HepMcParticleLink testLink1b(HepMC::barcode(particle1), dummyIndex1, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink1b.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1b.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1b.barcode()); ASSERT_EQ( refEvtNum1, testLink1b.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1b.getEventPositionInCollection(sg)); ASSERT_EQ(*(testLink1a.cptr()),*(testLink1b.cptr())); @@ -458,16 +795,16 @@ namespace MCTesting { // event_number of the GenEvent. HepMcParticleLink testLink1c(particle1,event_number1); ASSERT_TRUE( testLink1c.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1c.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1c.barcode()); ASSERT_NE( dummyIndex1, testLink1c.eventIndex()); ASSERT_EQ( refEvtNum1, testLink1c.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1c.getEventPositionInCollection(sg)); ASSERT_EQ(particle1,testLink1c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. - HepMcParticleLink testLink1d(particle1->barcode(),event_number1); + HepMcParticleLink testLink1d(HepMC::barcode(particle1),event_number1); ASSERT_TRUE( testLink1d.isValid() ); - ASSERT_EQ( particle1->barcode(), testLink1d.barcode()); + ASSERT_EQ( HepMC::barcode(particle1), testLink1d.barcode()); ASSERT_NE( dummyIndex1, testLink1d.eventIndex()); ASSERT_EQ( refEvtNum1, testLink1d.eventIndex()); ASSERT_EQ( dummyIndex1, testLink1d.getEventPositionInCollection(sg)); @@ -477,19 +814,19 @@ namespace MCTesting { // HepMcParticleLink built using a GenParticle pointer and the // position of the GenEvent. - HepMcParticleLink testLink2a(particle2,1, EBC_MAINEVCOLL, + HepMcParticleLink testLink2a(particle2, dummyIndex2, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2a.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2a.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2a.barcode()); ASSERT_EQ( refEvtNum2, testLink2a.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2a.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2a.cptr()); // A HepMcParticleLink built using the barcode and the position of // the GenEvent. - HepMcParticleLink testLink2b(particle2->barcode(),1, EBC_MAINEVCOLL, + HepMcParticleLink testLink2b(HepMC::barcode(particle2), dummyIndex2, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); ASSERT_TRUE( testLink2b.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2b.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2b.barcode()); ASSERT_EQ( refEvtNum2, testLink2b.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2b.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2b.cptr()); @@ -497,24 +834,20 @@ namespace MCTesting { // event_number of the GenEvent. HepMcParticleLink testLink2c(particle2,event_number2); ASSERT_TRUE( testLink2c.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2c.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2c.barcode()); ASSERT_NE( dummyIndex2, testLink2c.eventIndex()); ASSERT_EQ( refEvtNum2, testLink2c.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2c.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2c.cptr()); // A HepMcParticleLink built using the barcode and the event_number of // the GenEvent. - HepMcParticleLink testLink2d(particle2->barcode(),event_number2); + HepMcParticleLink testLink2d(HepMC::barcode(particle2),event_number2); ASSERT_TRUE( testLink2d.isValid() ); - ASSERT_EQ( particle2->barcode(), testLink2d.barcode()); + ASSERT_EQ( HepMC::barcode(particle2), testLink2d.barcode()); ASSERT_NE( dummyIndex2, testLink2d.eventIndex()); ASSERT_EQ( refEvtNum2, testLink2d.eventIndex()); ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg)); ASSERT_EQ(particle2,testLink2d.cptr()); - - StoreGateSvc* pStore(nullptr); - ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess()); - pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies } } // <-- namespace MCTesting diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h index 533727ce1cd94a8ee5bbd8aa96f5714841f2b2af..2d987cad543942b70ea14463590b4c0e55d2fcac 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h @@ -86,7 +86,7 @@ class GenEventCnv_p1 : public T_AthenaPoolTPCnvBase<HepMC::GenEvent, /////////////////////////////////////////////////////////////////// protected: - typedef std::unordered_map<HepMC::GenParticle*,int> ParticlesMap_t; + typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t; /** @brief Create a transient @c GenVertex from a persistent one (version 1) * It returns the new @c GenVertex. @@ -97,7 +97,7 @@ class GenEventCnv_p1 : public T_AthenaPoolTPCnvBase<HepMC::GenEvent, * of barcodes to particle so that we can reconnect all the (non-orphan) * particles to their decay vertex (if any). */ - HepMC::GenVertex* + HepMC::GenVertexPtr createGenVertex( const GenEvent_p1& persEvt, const GenVertex_p1& vtx, ParticlesMap_t& bcToPart ) const; @@ -107,7 +107,7 @@ class GenEventCnv_p1 : public T_AthenaPoolTPCnvBase<HepMC::GenEvent, * argument is to hold the association of barcodes to particle so that * we can reconnect all the particles to their decay vertex (if any). */ - HepMC::GenParticle* + HepMC::GenParticlePtr createGenParticle( const GenParticle_p1& p, ParticlesMap_t& partToEndVtx ) const; diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h index 5ef4935216c7cd344509557f3432f5aa4b140065..56f3bfad7071bc5a0ea072a27bac4615a3b31a05 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h @@ -94,7 +94,7 @@ class McEventCollectionCnv_p2 : public T_AthenaPoolTPCnvBase< /////////////////////////////////////////////////////////////////// protected: - typedef std::unordered_map<HepMC::GenParticle*,int> ParticlesMap_t; + typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t; /** @brief Create a transient @c GenVertex from a persistent one (version 1) * It returns the new @c GenVertex. @@ -105,7 +105,7 @@ class McEventCollectionCnv_p2 : public T_AthenaPoolTPCnvBase< * of barcodes to particle so that we can reconnect all the (non-orphan) * particles to their decay vertex (if any). */ - HepMC::GenVertex* + HepMC::GenVertexPtr createGenVertex( const McEventCollection_p2& persEvts, const GenVertex_p2& vtx, ParticlesMap_t& bcToPart, @@ -116,7 +116,7 @@ class McEventCollectionCnv_p2 : public T_AthenaPoolTPCnvBase< * argument is to hold the association of barcodes to particle so that * we can reconnect all the particles to their decay vertex (if any). */ - HepMC::GenParticle* + HepMC::GenParticlePtr createGenParticle( const GenParticle_p2& p, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const; diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h index 884eef9f735934e882545765e7f528f157a0c14d..7515a37c075d2d10fe65bede130055486c25f64e 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h @@ -93,7 +93,7 @@ class McEventCollectionCnv_p3 : public T_AthenaPoolTPCnvBase< /////////////////////////////////////////////////////////////////// protected: - typedef std::unordered_map<HepMC::GenParticle*,int> ParticlesMap_t; + typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t; /** @brief Create a transient @c GenVertex from a persistent one (version 1) * It returns the new @c GenVertex. @@ -104,7 +104,7 @@ class McEventCollectionCnv_p3 : public T_AthenaPoolTPCnvBase< * of barcodes to particle so that we can reconnect all the (non-orphan) * particles to their decay vertex (if any). */ - HepMC::GenVertex* + HepMC::GenVertexPtr createGenVertex( const McEventCollection_p3& persEvts, const GenVertex_p3& vtx, ParticlesMap_t& bcToPart, @@ -115,7 +115,7 @@ class McEventCollectionCnv_p3 : public T_AthenaPoolTPCnvBase< * argument is to hold the association of barcodes to particle so that * we can reconnect all the particles to their decay vertex (if any). */ - HepMC::GenParticle* + HepMC::GenParticlePtr createGenParticle( const GenParticle_p3& p, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const; diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h index 18d1b96ae80fd7c6614285db4c88fadb1c388e1d..19ba716047d09374eb5bc509e929ad6890b1447c 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h @@ -98,7 +98,7 @@ class McEventCollectionCnv_p4 : public T_AthenaPoolTPCnvBase< /////////////////////////////////////////////////////////////////// protected: - typedef std::unordered_map<HepMC::GenParticle*,int> ParticlesMap_t; + typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t; /** @brief Create a transient @c GenVertex from a persistent one (version 1) * It returns the new @c GenVertex. @@ -109,7 +109,7 @@ class McEventCollectionCnv_p4 : public T_AthenaPoolTPCnvBase< * of barcodes to particle so that we can reconnect all the (non-orphan) * particles to their decay vertex (if any). */ - HepMC::GenVertex* + HepMC::GenVertexPtr createGenVertex( const McEventCollection_p4& persEvts, const GenVertex_p4& vtx, ParticlesMap_t& bcToPart, @@ -120,7 +120,7 @@ class McEventCollectionCnv_p4 : public T_AthenaPoolTPCnvBase< * argument is to hold the association of barcodes to particle so that * we can reconnect all the particles to their decay vertex (if any). */ - HepMC::GenParticle* + HepMC::GenParticlePtr createGenParticle( const GenParticle_p4& p, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const; diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h index c7c9372fa22558e5b064a1a5ab37cb87239c15c3..c5649ca6fd448c6d4db866e18a9266767751546d 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h @@ -99,7 +99,7 @@ class McEventCollectionCnv_p5 : public T_AthenaPoolTPCnvBase< /////////////////////////////////////////////////////////////////// protected: - typedef std::unordered_map<HepMC::GenParticle*,int> ParticlesMap_t; + typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t; /** @brief Create a transient @c GenVertex from a persistent one (version 1) * It returns the new @c GenVertex. @@ -110,7 +110,7 @@ class McEventCollectionCnv_p5 : public T_AthenaPoolTPCnvBase< * of barcodes to particle so that we can reconnect all the (non-orphan) * particles to their decay vertex (if any). */ - HepMC::GenVertex* + HepMC::GenVertexPtr createGenVertex( const McEventCollection_p5& persEvts, const GenVertex_p5& vtx, ParticlesMap_t& bcToPart, @@ -121,7 +121,7 @@ class McEventCollectionCnv_p5 : public T_AthenaPoolTPCnvBase< * argument is to hold the association of barcodes to particle so that * we can reconnect all the particles to their decay vertex (if any). */ - HepMC::GenParticle* + HepMC::GenParticlePtr createGenParticle( const GenParticle_p5& p, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const; diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h index f74c78bbe9a6f33bd700d298377f3acb734130d5..90bdca0ce1d89514b6eb6bebe86a7a8b13e737dd 100644 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef GENERATOROBJECTSTPCNV_INITMCEVENTCOLLECTION_H @@ -23,13 +23,14 @@ namespace Athena_test { * @brief minimal gaudi initialization and record an McEventCollection in StoreGate * @param pSvcLoc returns a pointer to the Gaudi ServiceLocator * @param genPartVector returns a vector of pointers to GenParticle objects for use in HepMcParticleLink creation + * @param initGaudi default is true. If you already did Athena_test::initGaudi and want to skip it, set this false. */ - bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticle*>& genPartVector); + bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticlePtr>& genPartVector, const bool initGaudi=true); /** @fn HepMC::GenParticle* populateGenEvent(HepMC::GenEvent & ge) * @brief fills a HepMC::GenEvent with some dummy GenParticle and GenVertex objects * @param pSvcLoc returns a pointer to the Gaudi ServiceLocator * @param genPartVector returns a vector of pointers to GenParticle objects for use in HepMcParticleLink creation */ - void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartVector); + void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartVector); } #endif // GENERATOROBJECTSTPCNV_INITMCEVENTCOLLECTION_H diff --git a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref index 075f1607b3a428f1d10a95404d8e0b80d6d77043..740fe2f0e3e80570c973f485f93e7c7106ce5181 100644 --- a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref +++ b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref @@ -12,3 +12,12 @@ ApplicationMgr Ready test1 ClassIDSvc INFO getRegistryEntries: read 1853 CLIDRegistry entries for module ALL HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 diff --git a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref index ad71efce4f8586494b63dcf78e897b1ef39ae84f..624d028db9a5bc83a408dac84101d2381197c7e4 100644 --- a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref +++ b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref @@ -12,3 +12,12 @@ ApplicationMgr Ready test1 ClassIDSvc INFO getRegistryEntries: read 1853 CLIDRegistry entries for module ALL HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 +HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460 diff --git a/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx index b464017da136aa6fa880180e945d236f92b23c13..a6532e9c29caefdee1c8cc48f7fd363fb8a20d18 100755 --- a/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx @@ -98,7 +98,7 @@ void GenEventCnv_p1::persToTrans( const GenEvent_p1* persObj, // set the signal process vertex const int sigProcVtx = persObj->m_signalProcessVtx; if ( sigProcVtx != 0 ) { - transObj->set_signal_process_vertex( transObj->barcode_to_vertex( sigProcVtx ) ); + HepMC::set_signal_process_vertex(transObj, HepMC::barcode_to_vertex(transObj,sigProcVtx ) ); } // connect particles to their end vertices @@ -106,7 +106,7 @@ void GenEventCnv_p1::persToTrans( const GenEvent_p1* persObj, for ( ParticlesMap_t::iterator p = partToEndVtx.begin(); p != endItr; ++p ) { - auto decayVtx = transObj->barcode_to_vertex( p->second ); + auto decayVtx = HepMC::barcode_to_vertex(transObj, p->second ); if ( decayVtx ) { decayVtx->add_particle_in( p->first ); } else { @@ -142,12 +142,12 @@ void GenEventCnv_p1::transToPers( const HepMC::GenEvent*, // Protected methods: /////////////////////////////////////////////////////////////////// -HepMC::GenVertex* +HepMC::GenVertexPtr GenEventCnv_p1::createGenVertex( const GenEvent_p1& persEvt, const GenVertex_p1& persVtx, ParticlesMap_t& partToEndVtx ) const { - HepMC::GenVertex * vtx = m_pool->vtx.nextElementPtr(); + HepMC::GenVertexPtr vtx = m_pool->vtx.nextElementPtr(); vtx->m_position.setX( persVtx.m_x ); vtx->m_position.setY( persVtx.m_y ); vtx->m_position.setZ( persVtx.m_z ); @@ -176,13 +176,13 @@ GenEventCnv_p1::createGenVertex( const GenEvent_p1& persEvt, return vtx; } -HepMC::GenParticle* +HepMC::GenParticlePtr GenEventCnv_p1::createGenParticle( const GenParticle_p1& persPart, ParticlesMap_t& partToEndVtx ) const { - HepMC::GenParticle* p = m_pool->part.nextElementPtr(); + HepMC::GenParticlePtr p = m_pool->part.nextElementPtr(); p->m_momentum.setPx( persPart.m_px ); p->m_momentum.setPy( persPart.m_py ); p->m_momentum.setPz( persPart.m_pz ); diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx index a1b0d96df2aef5a70769780df608d0d84733490e..06809d4a80289174a0cf6b1a94e53e48783a2688 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx @@ -6,6 +6,8 @@ // Framework includes #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" +#include "AthenaKernel/ExtendedEventContext.h" // GeneratorObjectsAthenaPool includes #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h" @@ -54,8 +56,14 @@ void HepMcParticleLinkCnv_p1::transToPers( const HepMcParticleLink* transObj, // NB This method assumes that there all GenEvents are stored in a // single McEventCollection, as running with split // McEventCollections is not supported in 21.0. + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); unsigned short index{0}; - if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(transObj->eventIndex(), + transObj->getEventCollection(), + proxy).at(0); + if (position!=0) { index = transObj->eventIndex(); if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx index ea0693b4d5eaf5202228ae1e290f234da2d20fe9..d448d8cca25e65c1ab378bd32c247b658633cd76 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx @@ -6,6 +6,8 @@ // Framework includes #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" +#include "AthenaKernel/ExtendedEventContext.h" // GeneratorObjectsAthenaPool includes #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p2.h" @@ -48,8 +50,14 @@ void HepMcParticleLinkCnv_p2::transToPers( const HepMcParticleLink* transObj, // m_mcEvtIndex of zero as a special case, in which m_mcEvtIndex // should be interpreted as the position in the McEventCollection // rather than the value of GenEvent::event_number(). + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); unsigned short index{0}; - if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(transObj->eventIndex(), + transObj->getEventCollection(), + proxy).at(0); + if (position!=0) { index = transObj->eventIndex(); if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx index c9b49570c943a3a0549df81e4f281cd8141d6b30..db91483e3fd011b891f63000db0e019af406573b 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx @@ -186,13 +186,13 @@ void McEventCollectionCnv_p2::transToPers( const McEventCollection*, // Protected methods: /////////////////////////////////////////////////////////////////// -HepMC::GenVertex* +HepMC::GenVertexPtr McEventCollectionCnv_p2::createGenVertex( const McEventCollection_p2& persEvt, const GenVertex_p2& persVtx, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx; - HepMC::GenVertex * vtx = poolOfVertices.nextElementPtr(); + HepMC::GenVertexPtr vtx = poolOfVertices.nextElementPtr(); vtx->m_position.setX( persVtx.m_x ); vtx->m_position.setY( persVtx.m_y ); vtx->m_position.setZ( persVtx.m_z ); @@ -225,12 +225,12 @@ McEventCollectionCnv_p2::createGenVertex( const McEventCollection_p2& persEvt, return vtx; } -HepMC::GenParticle* +HepMC::GenParticlePtr McEventCollectionCnv_p2::createGenParticle( const GenParticle_p2& persPart, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part; - HepMC::GenParticle* p = poolOfParticles.nextElementPtr(); + HepMC::GenParticlePtr p = poolOfParticles.nextElementPtr(); p->m_momentum.setPx( persPart.m_px ); p->m_momentum.setPy( persPart.m_py ); p->m_momentum.setPz( persPart.m_pz ); diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx index b9f4cf8167f75f6282f325494bad0f7c379a392d..deee70416c6e61b5ab86830a32d225b5ab58abd8 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx @@ -140,7 +140,7 @@ void McEventCollectionCnv_p3::persToTrans( const McEventCollection_p3* persObj, // set the signal process vertex const int sigProcVtx = persEvt.m_signalProcessVtx; if ( sigProcVtx != 0 ) { - genEvt->set_signal_process_vertex( genEvt->barcode_to_vertex( sigProcVtx ) ); + HepMC::set_signal_process_vertex(genEvt, HepMC::barcode_to_vertex(genEvt, sigProcVtx ) ); } // connect particles to their end vertices @@ -149,7 +149,7 @@ void McEventCollectionCnv_p3::persToTrans( const McEventCollection_p3* persObj, endItr = partToEndVtx.end(); p != endItr; ++p ) { - auto decayVtx = genEvt->barcode_to_vertex( p->second ); + auto decayVtx=HepMC::barcode_to_vertex(genEvt, p->second ); if ( decayVtx ) { decayVtx->add_particle_in( p->first ); } else { @@ -188,14 +188,14 @@ void McEventCollectionCnv_p3::transToPers( const McEventCollection* /*transObj*/ // Protected methods: /////////////////////////////////////////////////////////////////// -HepMC::GenVertex* +HepMC::GenVertexPtr McEventCollectionCnv_p3::createGenVertex( const McEventCollection_p3& persEvt, const GenVertex_p3& persVtx, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx; - HepMC::GenVertex * vtx = poolOfVertices.nextElementPtr(); + HepMC::GenVertexPtr vtx = poolOfVertices.nextElementPtr(); vtx->m_position.setX( persVtx.m_x ); vtx->m_position.setY( persVtx.m_y ); vtx->m_position.setZ( persVtx.m_z ); @@ -228,7 +228,7 @@ McEventCollectionCnv_p3::createGenVertex( const McEventCollection_p3& persEvt, return vtx; } -HepMC::GenParticle* +HepMC::GenParticlePtr McEventCollectionCnv_p3::createGenParticle( const GenParticle_p3& persPart, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const @@ -238,7 +238,7 @@ McEventCollectionCnv_p3::createGenParticle( const GenParticle_p3& persPart, using std::pow; DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part; - HepMC::GenParticle* p = poolOfParticles.nextElementPtr(); + HepMC::GenParticlePtr p = poolOfParticles.nextElementPtr(); p->m_pdg_id = persPart.m_pdgId; p->m_status = persPart.m_status; p->m_polarization.m_theta= static_cast<double>(persPart.m_thetaPolarization); diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx index 294c5abba7f4113ce44deec27e8b24ed81290d87..c9fd90e17b928eb6eb32b230e3bc2658908238a1 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx @@ -180,7 +180,7 @@ void McEventCollectionCnv_p4::persToTrans( const McEventCollection_p4* persObj, const int sigProcVtx = persEvt.m_signalProcessVtx; if ( sigProcVtx != 0 ) { - genEvt->set_signal_process_vertex( genEvt->barcode_to_vertex( sigProcVtx ) ); + HepMC::set_signal_process_vertex(genEvt,HepMC::barcode_to_vertex(genEvt, sigProcVtx ) ); } // connect particles to their end vertices @@ -190,7 +190,7 @@ void McEventCollectionCnv_p4::persToTrans( const McEventCollection_p4* persObj, p != endItr; ++p ) { - auto decayVtx = genEvt->barcode_to_vertex( p->second ); + auto decayVtx= HepMC::barcode_to_vertex(genEvt, p->second ); if ( decayVtx ) { decayVtx->add_particle_in( p->first ); @@ -288,17 +288,17 @@ void McEventCollectionCnv_p4::transToPers( const McEventCollection* transObj, // Protected methods: /////////////////////////////////////////////////////////////////// -HepMC::GenVertex* +HepMC::GenVertexPtr McEventCollectionCnv_p4::createGenVertex( const McEventCollection_p4& persEvt, const GenVertex_p4& persVtx, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx; - HepMC::GenVertex * vtx(0); + HepMC::GenVertexPtr vtx(0); if(m_isPileup) { - vtx=new HepMC::GenVertex(); + vtx=HepMC::newGenVertexPtr(); } else { @@ -338,7 +338,7 @@ McEventCollectionCnv_p4::createGenVertex( const McEventCollection_p4& persEvt, return vtx; } -HepMC::GenParticle* +HepMC::GenParticlePtr McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const @@ -348,10 +348,10 @@ McEventCollectionCnv_p4::createGenParticle( const GenParticle_p4& persPart, using std::pow; DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part; - HepMC::GenParticle* p(0); + HepMC::GenParticlePtr p(0); if (m_isPileup) { - p = new HepMC::GenParticle(); + p = HepMC::newGenParticlePtr(); } else { @@ -433,9 +433,9 @@ void McEventCollectionCnv_p4::writeGenVertex( const HepMC::GenVertex& vtx, GenVertex_p4& persVtx = persEvt.m_genVertices.back(); // we write only the orphans in-coming particles - const std::vector<HepMC::GenParticle*>::const_iterator endInVtx = vtx.m_particles_in.end(); + const std::vector<HepMC::GenParticlePtr>::const_iterator endInVtx = vtx.m_particles_in.end(); persVtx.m_particlesIn.reserve(vtx.m_particles_in.size()); - for ( std::vector<HepMC::GenParticle*>::const_iterator p = vtx.m_particles_in.begin(); + for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_in.begin(); p != endInVtx; ++p ) { @@ -445,9 +445,9 @@ void McEventCollectionCnv_p4::writeGenVertex( const HepMC::GenVertex& vtx, } } - const std::vector<HepMC::GenParticle*>::const_iterator endOutVtx = vtx.m_particles_out.end(); + const std::vector<HepMC::GenParticlePtr>::const_iterator endOutVtx = vtx.m_particles_out.end(); persVtx.m_particlesOut.reserve(vtx.m_particles_out.size()); - for ( std::vector<HepMC::GenParticle*>::const_iterator p = vtx.m_particles_out.begin(); + for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_out.begin(); p != endOutVtx; ++p ) { diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx index e34c0f2679a57d8550126183f0630af4abbe3a2b..a47035f08ec42cf7fab3ac397061d4e44fd01840 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx @@ -222,7 +222,7 @@ void McEventCollectionCnv_p5::persToTrans( const McEventCollection_p5* persObj, endItr = partToEndVtx.end(); p != endItr; ++p ) { - auto decayVtx = genEvt->barcode_to_vertex( p->second ); + auto decayVtx = HepMC::barcode_to_vertex(genEvt, p->second ); if ( decayVtx ) { decayVtx->add_particle_in( p->first ); } else { @@ -373,16 +373,16 @@ void McEventCollectionCnv_p5::transToPers( const McEventCollection* transObj, // Protected methods: /////////////////////////////////////////////////////////////////// -HepMC::GenVertex* +HepMC::GenVertexPtr McEventCollectionCnv_p5::createGenVertex( const McEventCollection_p5& persEvt, const GenVertex_p5& persVtx, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { DataPool<HepMC::GenVertex>& poolOfVertices = datapools->vtx; - HepMC::GenVertex * vtx(0); + HepMC::GenVertexPtr vtx(0); if(m_isPileup) { - vtx=new HepMC::GenVertex(); + vtx=HepMC::newGenVertexPtr(); } else { vtx = poolOfVertices.nextElementPtr(); } @@ -418,7 +418,7 @@ McEventCollectionCnv_p5::createGenVertex( const McEventCollection_p5& persEvt, return vtx; } -HepMC::GenParticle* +HepMC::GenParticlePtr McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart, ParticlesMap_t& partToEndVtx, HepMC::DataPool* datapools ) const { @@ -427,9 +427,9 @@ McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart, using std::pow; DataPool<HepMC::GenParticle>& poolOfParticles = datapools->part; - HepMC::GenParticle* p(0); + HepMC::GenParticlePtr p(0); if (m_isPileup) { - p = new HepMC::GenParticle(); + p = HepMC::newGenParticlePtr(); } else { p = poolOfParticles.nextElementPtr(); } @@ -506,9 +506,9 @@ void McEventCollectionCnv_p5::writeGenVertex( const HepMC::GenVertex& vtx, GenVertex_p5& persVtx = persEvt.m_genVertices.back(); // we write only the orphans in-coming particles - const std::vector<HepMC::GenParticle*>::const_iterator endInVtx = vtx.m_particles_in.end(); + const std::vector<HepMC::GenParticlePtr>::const_iterator endInVtx = vtx.m_particles_in.end(); persVtx.m_particlesIn.reserve(vtx.m_particles_in.size()); - for ( std::vector<HepMC::GenParticle*>::const_iterator p = vtx.m_particles_in.begin(); + for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_in.begin(); p != endInVtx; ++p ) { if ( 0 == (*p)->production_vertex() ) { @@ -516,9 +516,9 @@ void McEventCollectionCnv_p5::writeGenVertex( const HepMC::GenVertex& vtx, } } - const std::vector<HepMC::GenParticle*>::const_iterator endOutVtx = vtx.m_particles_out.end(); + const std::vector<HepMC::GenParticlePtr>::const_iterator endOutVtx = vtx.m_particles_out.end(); persVtx.m_particlesOut.reserve(vtx.m_particles_out.size()); - for ( std::vector<HepMC::GenParticle*>::const_iterator p = vtx.m_particles_out.begin(); + for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_out.begin(); p != endOutVtx; ++p ) { persVtx.m_particlesOut.push_back( writeGenParticle( **p, persEvt ) ); diff --git a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx index 4714e3d384374dc98b338b4cf4ada1e3ecf3c648..2e87bf052a1acc9e7f317007d6c907c286e23f13 100644 --- a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorObjectsTPCnv/initMcEventCollection.h" @@ -19,9 +19,9 @@ #include "TestTools/initGaudi.h" namespace Athena_test { - bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticle*>& genPartList) + bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticlePtr>& genPartList, const bool initGaudi) { - if (!Athena_test::initGaudi(pSvcLoc)) { + if (initGaudi && !Athena_test::initGaudi(pSvcLoc)) { std::cerr << "This test can not be run" << std::endl; return false; } @@ -29,10 +29,16 @@ namespace Athena_test { // HepMcParticleLink knows about SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; inputTestDataHandle = std::make_unique<McEventCollection>(); + + // create a dummy EventContext + EventContext ctx; + ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) ); + Gaudi::Hive::setCurrentContext( ctx ); + // Add a dummy GenEvent const int process_id1(20); const int event_number1(17); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); populateGenEvent(ge1,-11,11,genPartList); populateGenEvent(ge1,-13,13,genPartList); @@ -43,26 +49,26 @@ namespace Athena_test { return true; } - void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList) + void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, pdgid1, 2); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, pdgid2, 2); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, pdgid1, 1); myVertex->add_particle_out(inParticle3); genPartList.push_back(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, pdgid2, 1); myVertex->add_particle_out(inParticle4); genPartList.push_back(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } } diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx index 937f83451d94de4223aad4ec2d2fb5421cba0122..52dcb9a9fb0b0cc65917de7536da3901b646a2a6 100644 --- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx @@ -16,7 +16,6 @@ #include "AtlasHepMC/GenEvent.h" // CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/SystemOfUnits.h" #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h" @@ -36,35 +35,88 @@ void compare (const HepMcParticleLink& p1, assert ( p1 == p2 ); } -void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList) +void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, pdgid1, 2); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, pdgid2, 2); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, pdgid1, 1); myVertex->add_particle_out(inParticle3); genPartList.push_back(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, pdgid2, 1); myVertex->add_particle_out(inParticle4); genPartList.push_back(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } -void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPartList) +void populateFilteredGenEvent(HepMC::GenEvent & ge, std::vector<HepMC::GenParticlePtr>& genPartList) +{ + //.......Create new particle (geantino) to link hits from pileup + HepMC::GenParticlePtr genPart=HepMC::newGenParticlePtr(); + genPart->set_pdg_id(999); //Geantino + genPart->set_status(1); //!< set decay status + HepMC::suggest_barcode(genPart, std::numeric_limits<int32_t>::max() ); + + HepMC::GenVertexPtr genVertex=HepMC::newGenVertexPtr(); + genVertex->add_particle_out(genPart); + genPartList.push_back(genPart); + + //to set geantino vertex as a truth primary vertex + HepMC::GenVertexPtr hScatVx = HepMC::barcode_to_vertex(&ge,-3); + if(hScatVx!=nullptr) { + HepMC::FourVector pmvxpos=hScatVx->position(); + genVertex->set_position(pmvxpos); + //to set geantino kinematic phi=eta=0, E=p=E_hard_scat + HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin(); + if (hScatVx->particles_in_size()==2){ + HepMC::FourVector mom1=(*itrp)->momentum(); + HepMC::FourVector mom2=(*(++itrp))->momentum(); + HepMC::FourVector vxmom; + vxmom.setPx(mom1.e()+mom2.e()); + vxmom.setPy(0.); + vxmom.setPz(0.); + vxmom.setE(mom1.e()+mom2.e()); + + genPart->set_momentum(vxmom); + } + } + + if(!ge.vertices_empty()){ + std::vector<HepMC::GenVertexPtr> vtxvec; + HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin(); + for (;itvtx != ge.vertices_end(); ++itvtx ) { + ge.remove_vertex(*itvtx); + vtxvec.push_back((*itvtx)); + //fix me: delete vertex pointer causes crash + //delete (*itvtx); + } + for(unsigned int i=0;i<vtxvec.size();i++) delete vtxvec[i]; + } + + //.....add new vertex with geantino + ge.add_vertex(genVertex); +} + +void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticlePtr>& genPartList) { // create dummy input McEventCollection with a name that // HepMcParticleLink knows about SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; inputTestDataHandle = std::make_unique<McEventCollection>(); + + EventContext ctx; + ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) ); + Gaudi::Hive::setCurrentContext( ctx ); + // Add a dummy GenEvent const int process_id1(20); const int event_number1(2147483647); @@ -78,18 +130,23 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar // HepMcParticleLink_p2. A workaround is used to suppport larger // values for the first event in the McEventCollection. const int event_number3(64); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + const int event_number4(89); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); populateGenEvent(ge1,-11,11,genPartList); populateGenEvent(ge1,-13,13,genPartList); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number2)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number2)); HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); populateGenEvent(ge2,-11,11,genPartList); populateGenEvent(ge2,-13,13,genPartList); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number3)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number3)); HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); populateGenEvent(ge3,-11,11,genPartList); populateGenEvent(ge3,22,22,genPartList); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + populateFilteredGenEvent(ge4,genPartList); return; } @@ -108,20 +165,47 @@ void testit (const HepMcParticleLink& trans1) void test1() { std::cout << "test1\n"; - std::vector<HepMC::GenParticle*> genPartList; + std::vector<HepMC::GenParticlePtr> genPartList; createMcEventCollectionInStoreGate(genPartList); - assert ( genPartList.size() == 12 ); - const HepMC::GenParticle * particle1 = genPartList.at(0); - HepMcParticleLink trans1(particle1->barcode(),particle1->parent_event()->event_number()); - testit (trans1); - HepMcParticleLink trans2(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + assert ( genPartList.size() == 13 ); + // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection + // By event_number + const HepMC::GenParticlePtr particle1 = genPartList.at(0); + HepMcParticleLink trans1a(HepMC::barcode(particle1),particle1->parent_event()->event_number()); + testit (trans1a); + // By position + HepMcParticleLink trans1b(HepMC::barcode(particle1),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + testit (trans1b); + // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection + const HepMC::GenParticlePtr particle2 = genPartList.at(7); + HepMcParticleLink trans2(HepMC::barcode(particle2),particle2->parent_event()->event_number()); testit (trans2); - const HepMC::GenParticle * particle2 = genPartList.at(7); - HepMcParticleLink trans3(particle2->barcode(),particle2->parent_event()->event_number()); + const HepMC::GenParticlePtr particle3 = genPartList.at(8); + HepMcParticleLink trans3(HepMC::barcode(particle3),particle3->parent_event()->event_number()); testit (trans3); - const HepMC::GenParticle * particle3 = genPartList.at(8); - HepMcParticleLink trans4(particle3->barcode(),particle3->parent_event()->event_number()); + // HepMcParticleLinks pointing at filtered pileup truth + const HepMC::GenParticlePtr particle4 = genPartList.at(12); + HepMcParticleLink trans4(HepMC::barcode(particle4),particle4->parent_event()->event_number()); testit (trans4); + // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event_number + int deltaRayBarcode(0); + HepMcParticleLink trans5a(deltaRayBarcode,particle1->parent_event()->event_number()); + testit (trans5a); + // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using position + HepMcParticleLink trans5b(deltaRayBarcode,0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + testit (trans5b); + // Link to a GenParticle which was not recorded to the + // McEventCollection, even though other parts of the same GenEvent + // were recorded. + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(particle1->parent_event()->event_number()); + const int cutBarcode(210001); + HepMcParticleLink trans6a(cutBarcode, refEvtNum1); + testit (trans6a); + // Link to a GenEvent which was not recorded to the McEventCollection + const int event_number5(460); + const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5); + HepMcParticleLink trans6b(cutBarcode, refEvtNum5); + testit (trans6b); } diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx index b18f98f5770d1728e4a2551c55df274d94fdb627..bc858ae3ec36d57f50a53eca2a4095fd3f517878 100644 --- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx @@ -36,35 +36,88 @@ void compare (const HepMcParticleLink& p1, assert ( p1 == p2 ); } -void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList) +void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, pdgid1, 2); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, pdgid2, 2); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, pdgid1, 1); myVertex->add_particle_out(inParticle3); genPartList.push_back(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, pdgid2, 1); myVertex->add_particle_out(inParticle4); genPartList.push_back(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } -void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPartList) +void populateFilteredGenEvent(HepMC::GenEvent & ge, std::vector<HepMC::GenParticlePtr>& genPartList) +{ + //.......Create new particle (geantino) to link hits from pileup + HepMC::GenParticlePtr genPart=HepMC::newGenParticlePtr(); + genPart->set_pdg_id(999); //Geantino + genPart->set_status(1); //!< set decay status + HepMC::suggest_barcode(genPart, std::numeric_limits<int32_t>::max() ); + + HepMC::GenVertexPtr genVertex=HepMC::newGenVertexPtr(); + genVertex->add_particle_out(genPart); + genPartList.push_back(genPart); + + //to set geantino vertex as a truth primary vertex + HepMC::GenVertexPtr hScatVx = HepMC::barcode_to_vertex(&ge,-3); + if(hScatVx!=nullptr) { + HepMC::FourVector pmvxpos=hScatVx->position(); + genVertex->set_position(pmvxpos); + //to set geantino kinematic phi=eta=0, E=p=E_hard_scat + HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin(); + if (hScatVx->particles_in_size()==2){ + HepMC::FourVector mom1=(*itrp)->momentum(); + HepMC::FourVector mom2=(*(++itrp))->momentum(); + HepMC::FourVector vxmom; + vxmom.setPx(mom1.e()+mom2.e()); + vxmom.setPy(0.); + vxmom.setPz(0.); + vxmom.setE(mom1.e()+mom2.e()); + + genPart->set_momentum(vxmom); + } + } + + if(!ge.vertices_empty()){ + std::vector<HepMC::GenVertexPtr> vtxvec; + HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin(); + for (;itvtx != ge.vertices_end(); ++itvtx ) { + ge.remove_vertex(*itvtx); + vtxvec.push_back((*itvtx)); + //fix me: delete vertex pointer causes crash + //delete (*itvtx); + } + for(unsigned int i=0;i<vtxvec.size();i++) delete vtxvec[i]; + } + + //.....add new vertex with geantino + ge.add_vertex(genVertex); +} + +void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticlePtr>& genPartList) { // create dummy input McEventCollection with a name that // HepMcParticleLink knows about SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"}; inputTestDataHandle = std::make_unique<McEventCollection>(); + // create a dummy EventContext + EventContext ctx; + ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) ); + Gaudi::Hive::setCurrentContext( ctx ); + // Add a dummy GenEvent const int process_id1(20); const int event_number1(2147483647); @@ -78,18 +131,23 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar // HepMcParticleLink_p2. A workaround is used to suppport larger // values for the first event in the McEventCollection. const int event_number3(64); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + const int event_number4(89); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); populateGenEvent(ge1,-11,11,genPartList); populateGenEvent(ge1,-13,13,genPartList); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number2)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number2)); HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1)); populateGenEvent(ge2,-11,11,genPartList); populateGenEvent(ge2,-13,13,genPartList); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number3)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number3)); HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2)); populateGenEvent(ge3,-11,11,genPartList); populateGenEvent(ge3,22,22,genPartList); + inputTestDataHandle->push_back(new HepMC::GenEvent(ge1)); + HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3)); + ge4.set_event_number(event_number4); + populateFilteredGenEvent(ge4,genPartList); return; } @@ -108,20 +166,47 @@ void testit (const HepMcParticleLink& trans1) void test1() { std::cout << "test1\n"; - std::vector<HepMC::GenParticle*> genPartList; + std::vector<HepMC::GenParticlePtr> genPartList; createMcEventCollectionInStoreGate(genPartList); - assert ( genPartList.size() == 12 ); - const HepMC::GenParticle * particle1 = genPartList.at(0); - HepMcParticleLink trans1(particle1->barcode(),particle1->parent_event()->event_number()); - testit (trans1); - HepMcParticleLink trans2(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + assert ( genPartList.size() == 13 ); + // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection + // By event_number + const HepMC::GenParticlePtr particle1 = genPartList.at(0); + HepMcParticleLink trans1a(HepMC::barcode(particle1),particle1->parent_event()->event_number()); + testit (trans1a); + // By position + HepMcParticleLink trans1b(HepMC::barcode(particle1),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + testit (trans1b); + // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection + const HepMC::GenParticlePtr particle2 = genPartList.at(7); + HepMcParticleLink trans2(HepMC::barcode(particle2),particle2->parent_event()->event_number()); testit (trans2); - const HepMC::GenParticle * particle2 = genPartList.at(7); - HepMcParticleLink trans3(particle2->barcode(),particle2->parent_event()->event_number()); + const HepMC::GenParticlePtr particle3 = genPartList.at(8); + HepMcParticleLink trans3(HepMC::barcode(particle3),particle3->parent_event()->event_number()); testit (trans3); - const HepMC::GenParticle * particle3 = genPartList.at(8); - HepMcParticleLink trans4(particle3->barcode(),particle3->parent_event()->event_number()); + // HepMcParticleLinks pointing at filtered pileup truth + const HepMC::GenParticlePtr particle4 = genPartList.at(12); + HepMcParticleLink trans4(HepMC::barcode(particle4),particle4->parent_event()->event_number()); testit (trans4); + // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event number + int deltaRayBarcode(0); + HepMcParticleLink trans5a(deltaRayBarcode,particle1->parent_event()->event_number()); + testit (trans5a); + // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using hard-scatter event position + HepMcParticleLink trans5b(deltaRayBarcode,0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION); + testit (trans5b); + // Link to a GenParticle which was not recorded to the + // McEventCollection, even though other parts of the same GenEvent + // were recorded. + const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(particle1->parent_event()->event_number()); + const int cutBarcode(210001); + HepMcParticleLink trans6a(cutBarcode, refEvtNum1); + testit (trans6a); + // Link to a GenEvent which was not recorded to the McEventCollection + const int event_number5(460); + const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5); + HepMcParticleLink trans6b(cutBarcode, refEvtNum5); + testit (trans6b); } diff --git a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx index 52d941263c79519fbb419cf8adc39c9c1784ea64..2b95a8224693f207ea1ffb39442b294930fdf0ce 100644 --- a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx @@ -16,7 +16,6 @@ #include "AtlasHepMC/GenEvent.h" // CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/SystemOfUnits.h" #include "GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h" @@ -24,7 +23,7 @@ void compare (const HepMC::GenEvent& p1, const HepMC::GenEvent& p2) { - assert (p1.signal_process_id() == p2.signal_process_id() ); + assert (HepMC::signal_process_id(p1) == HepMC::signal_process_id(p2) ); assert (p1.event_number() == p2.event_number() ); //FIXME Need to loop over GenVertex and GenParticle objects too. } @@ -40,43 +39,43 @@ void compare (const McEventCollection& p1, void populateGenEvent(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } void populateGenEvent2(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } @@ -100,13 +99,13 @@ void test1() // Add a dummy GenEvent const int process_id1(20); const int event_number1(17); - trans1.push_back(new HepMC::GenEvent(process_id1, event_number1)); + trans1.push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(trans1.at(0)); populateGenEvent(ge1); // Add a second dummy GenEvent const int process_id2(20); const int event_number2(25); - trans1.push_back(new HepMC::GenEvent(process_id2, event_number2)); + trans1.push_back(HepMC::newGenEvent(process_id2, event_number2)); HepMC::GenEvent& ge2 = *(trans1.at(1)); populateGenEvent2(ge2); diff --git a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx index b9e78aa81a55b75a18e34a09e158c8b2b455a9d0..02b015120911068fcf34248b1e0cb4110f88fa5f 100644 --- a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx +++ b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx @@ -16,7 +16,6 @@ #include "AtlasHepMC/GenEvent.h" // CLHEP includes -#include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/SystemOfUnits.h" #include "GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h" @@ -24,7 +23,7 @@ void compare (const HepMC::GenEvent& p1, const HepMC::GenEvent& p2) { - assert (p1.signal_process_id() == p2.signal_process_id() ); + assert (HepMC::signal_process_id(p1) == HepMC::signal_process_id(p2) ); assert (p1.event_number() == p2.event_number() ); //FIXME Need to loop over GenVertex and GenParticle objects too. } @@ -40,43 +39,43 @@ void compare (const McEventCollection& p1, void populateGenEvent(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } void populateGenEvent2(HepMC::GenEvent & ge) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, 2, 10); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, 2, 10); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, -2, 10); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, -2, 10); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, 2, 10); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, 2, 10); myVertex->add_particle_out(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, -2, 10); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, -2, 10); myVertex->add_particle_out(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex(&ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } @@ -100,13 +99,13 @@ void test1() // Add a dummy GenEvent const int process_id1(20); const int event_number1(17); - trans1.push_back(new HepMC::GenEvent(process_id1, event_number1)); + trans1.push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(trans1.at(0)); populateGenEvent(ge1); // Add a second dummy GenEvent const int process_id2(20); const int event_number2(25); - trans1.push_back(new HepMC::GenEvent(process_id2, event_number2)); + trans1.push_back(HepMC::newGenEvent(process_id2, event_number2)); HepMC::GenEvent& ge2 = *(trans1.at(1)); populateGenEvent2(ge2); diff --git a/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h b/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h index 8b76dbb6cfb3e17ca87a0394a382bc367c73c8d0..c8d4b5e8104f1d89a661da26ebcfadbb34a69a60 100644 --- a/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h +++ b/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h @@ -13,8 +13,8 @@ class KineHepMcmap public: KineHepMcmap(const HepMC::GenEvent* evt); - int giveParticle_getkine ( const HepMC::GenParticle* p ) const; - HepMC::GenParticle* givekine_getParticle ( const int ikine ) const; + int giveParticle_getkine (HepMC::GenParticlePtr p ) const; + HepMC::GenParticlePtr givekine_getParticle ( const int ikine ) const; private: const HepMC::GenEvent* m_evt; //const int m_vertex_offset; diff --git a/Generators/GenzModuleEvent/src/KineHepMcmap.cxx b/Generators/GenzModuleEvent/src/KineHepMcmap.cxx index d2ade821a13e59d7ade579b26c77dbf40a3843db..e3b07a5ed606134d6eaae5853c99a6fbe8b56318 100644 --- a/Generators/GenzModuleEvent/src/KineHepMcmap.cxx +++ b/Generators/GenzModuleEvent/src/KineHepMcmap.cxx @@ -10,9 +10,9 @@ KineHepMcmap::KineHepMcmap ( const HepMC::GenEvent* evt ) {} int -KineHepMcmap::giveParticle_getkine ( const HepMC::GenParticle* p ) const +KineHepMcmap::giveParticle_getkine (HepMC::GenParticlePtr p ) const { - int barcode = p->barcode(); + int barcode = HepMC::barcode(p); if (barcode < m_kine_offset) { if (p->status() > 1000) return p->status() / 1000; @@ -24,11 +24,11 @@ KineHepMcmap::giveParticle_getkine ( const HepMC::GenParticle* p ) const } } -HepMC::GenParticle* +HepMC::GenParticlePtr KineHepMcmap::givekine_getParticle ( const int kine ) const { if (kine <= 0) return 0; - HepMC::GenParticle* part = 0; + HepMC::GenParticlePtr part = nullptr; bool not_found = true; HepMC::GenEvent::particle_const_iterator p = m_evt->particles_begin(); do diff --git a/Generators/HepMCAnalysis_i/CMakeLists.txt b/Generators/HepMCAnalysis_i/CMakeLists.txt index 65867868c356622011ff25a2950ec5f3e0684630..abbed775bb511f15534b554be57e941e7bcb3cd5 100644 --- a/Generators/HepMCAnalysis_i/CMakeLists.txt +++ b/Generators/HepMCAnalysis_i/CMakeLists.txt @@ -23,6 +23,7 @@ find_package( HEPUtils ) find_package( HepMCAnalysis ) find_package( ROOT COMPONENTS Core MathCore Hist RIO ) find_package( FastJet ) +find_package( HepMC ) # Component(s) in the package: atlas_add_component( HepMCAnalysis_i @@ -30,6 +31,7 @@ atlas_add_component( HepMCAnalysis_i INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMCANALYSIS_INCLUDE_DIRS} ${HEPUTILS_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} + ${HEPMC_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMCANALYSIS_LIBRARIES} ${HEPUTILS_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${FASTJET_LIBRARIES} AthenaBaseComps GaudiKernel StoreGateLib EventInfo diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/HepMCAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/HepMCAnalysis.h index 114515b787949cb8713f62e18312383ce1f8349f..7b23626d5b23d03c14a9433f967f6e47e6330e3f 100644 --- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/HepMCAnalysis.h +++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/HepMCAnalysis.h @@ -19,7 +19,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "TH1.h" -#include "AtlasHepMC/GenEvent.h" // forward declarations class ITHistSvc; @@ -66,8 +65,6 @@ class HepMCAnalysis std::string m_key; std::string m_infokey; - //convert unit MeV to GeV for energy and momenta - void MeVToGeV (HepMC::GenEvent* evt); bool m_JetFinder; bool m_JetAnalysis; diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h index 6c1f44dffacc25e1beeb46f8afbe9b1373bbc6d0..50bd4735a5a06edc345d87c8950d4650b437b08b 100644 --- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h +++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h @@ -7,8 +7,6 @@ #include "baseAnalysis.h" -// forward declarations -#include "AtlasHepMC/GenEvent_fwd.h" class TH1D; class LeptonJetAnalysis: public baseAnalysis diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h index 45cfd6ce142dd8fa01990f53c9eb7e09c44090d9..8cb78563a7972969de7f150aabb54020041b75e5 100644 --- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h +++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h @@ -7,11 +7,6 @@ #include "baseAnalysis.h" -// forward declarations -// forward declarations -#include "AtlasHepMC/GenEvent_fwd.h" -#include "AtlasHepMC/GenParticle_fwd.h" - class TH1D; /* diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h index 2cecf588b5a6f99210325a08397830465bc1186a..95a20911cfb4d59de98aaf26c8fc699cfb815e82 100644 --- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h +++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h @@ -7,10 +7,6 @@ #include "baseAnalysis.h" -// forward declarations -#include "AtlasHepMC/GenEvent_fwd.h" -#include "AtlasHepMC/PdfInfo.h" - class TH1D; class PdfAnalysis: public baseAnalysis diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h index a81836c552559fac4febb8826c0019a890ddbcc2..112850fccf5d528c12602e3a26f8ce53046a9c39 100644 --- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h +++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h @@ -7,8 +7,6 @@ #include "baseAnalysis.h" -// forward declarations -#include "AtlasHepMC/GenEvent_fwd.h" class TH1D; class UserAnalysis: public baseAnalysis diff --git a/Generators/HepMCAnalysis_i/src/GetEvents.cxx b/Generators/HepMCAnalysis_i/src/GetEvents.cxx new file mode 100644 index 0000000000000000000000000000000000000000..693bc84995c1ea53b51b49f48b88a6580fbffd03 --- /dev/null +++ b/Generators/HepMCAnalysis_i/src/GetEvents.cxx @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + * Author: Andrii Verbytsky andrii.verbytskyi@mpp.mpg.de + * + * This file implements helper functions that prepare the ATLAS MC events + * to be used with the HepMCAnalysis package. + */ +#include <vector> +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/StoreGateSvc.h" +#include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/Property.h" + +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventID.h" +#include "GeneratorObjects/McEventCollection.h" + +//class HepMCAnalysisGenEvent; +using HepMCAnalysisGenEvent=HepMC::GenEvent; +HepMCAnalysisGenEvent* PrepareHepMCAnalysisGenEvent(const HepMC::GenEvent* cevent); + +StatusCode GetRunEventNumber(AthAlgorithm* a,int& runNumber,int& evtNumber, const std::string im) +{ + // load event info + const EventInfo* mcInfoptr; + if ( a->evtStore()->retrieve( mcInfoptr, im ).isFailure() ) { + //ATH_MSG_ERROR( "Could not retrieve EventInfo" ); + return StatusCode::FAILURE; + + } else{ + runNumber = mcInfoptr->event_ID()->run_number(); + evtNumber = mcInfoptr->event_ID()->event_number(); + //ATH_MSG_DEBUG( "run: " << runNumber << " event: " << evtNumber ); + //ATH_MSG_DEBUG("Event info loaded"); + } + return StatusCode::SUCCESS; +} + + +StatusCode GetEvents(AthAlgorithm* a,std::vector<HepMCAnalysisGenEvent*>& evts, const std::string km) +{ + // load HepMC info + const McEventCollection* mcCollptr; + if ( a->evtStore()->retrieve( mcCollptr, km ).isFailure() ) { + //ATH_MSG_WARNING( "Could not retrieve McEventCollection" ); + } else { + //ATH_MSG_DEBUG("HepMC info loaded"); + + // loop over all events in McEventCollection + for ( McEventCollection::const_iterator itr = mcCollptr->begin(); itr != mcCollptr->end(); ++itr ) { + evts.push_back(PrepareHepMCAnalysisGenEvent(*itr)); +} +} + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/Generators/HepMCAnalysis_i/src/HepMCAnalysis.cxx b/Generators/HepMCAnalysis_i/src/HepMCAnalysis.cxx index 30d84aad66f36f7ff56ef5e871f77714b0791c38..1b4b25141e91424ae390b05d021f69b53a0184b1 100644 --- a/Generators/HepMCAnalysis_i/src/HepMCAnalysis.cxx +++ b/Generators/HepMCAnalysis_i/src/HepMCAnalysis.cxx @@ -13,12 +13,7 @@ #include "GaudiKernel/ITHistSvc.h" #include "GaudiKernel/Property.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "GeneratorObjects/McEventCollection.h" - -#include "AtlasHepMC/GenEvent.h" - +// ROOT #include "TFile.h" #include "TH1.h" #include "TString.h" @@ -45,13 +40,10 @@ #include "HepMCAnalysis_i/ParticleContentAnalysis.h" #include "HepMCAnalysis_i/PdfAnalysis.h" -using std::cout; -using std::endl; -using std::string; -using std::vector; + // ---------------------------------------------------------------------- -HepMCAnalysis::HepMCAnalysis(const string &name, ISvcLocator *pSvcLocator): +HepMCAnalysis::HepMCAnalysis(const std::string &name, ISvcLocator *pSvcLocator): AthAlgorithm(name, pSvcLocator), m_histSvc("ITHistSvc", name) { declareProperty("McEventKey", m_key = "GEN_EVENT"); @@ -95,119 +87,106 @@ HepMCAnalysis::~HepMCAnalysis() } -// ---------------------------------------------------------------------- -void HepMCAnalysis::MeVToGeV(HepMC::GenEvent *event) -{ - for (HepMC::GenEvent::particle_iterator p = event->particles_begin(); p != event->particles_end(); ++p) { - const HepMC::FourVector fv((*p)->momentum().px() / 1000.0, - (*p)->momentum().py() / 1000.0, - (*p)->momentum().pz() / 1000.0, - (*p)->momentum().e() / 1000.0); - - (*p)->set_momentum(fv); - } -} - // ---------------------------------------------------------------------- StatusCode HepMCAnalysis::initialize() { ATH_MSG_DEBUG("Initializing " << name() << "..."); if (m_JetFinder) { - cout << "Adding module JetFinder" << endl; + std::cout << "Adding module JetFinder" << std::endl; m_jetfinder.push_back(new JetFinder); } // create analyses and initialize them if (m_JetAnalysis) { - cout << "Adding module JetAnalysis" << endl; + std::cout << "Adding module JetAnalysis" << std::endl; m_analysis.push_back(new JetAnalysis); } if (m_WplusJetAnalysis) { - cout << "Adding module WplusJetAnalysis" << endl; + std::cout << "Adding module WplusJetAnalysis" << std::endl; m_analysis.push_back(new WplusJetAnalysis); } if (m_ZAnalysis) { - cout << "Adding module ZAnalysis" << endl; + std::cout << "Adding module ZAnalysis" << std::endl; m_analysis.push_back(new ZAnalysis); } if (m_ZtautauAnalysis) { - cout << "Adding module ZtautauAnalysis" << endl; + std::cout << "Adding module ZtautauAnalysis" << std::endl; m_analysis.push_back(new ZtautauAnalysis); } if (m_WtaunuAnalysis) { - cout << "Adding module WtaunuAnalysis" << endl; + std::cout << "Adding module WtaunuAnalysis" << std::endl; m_analysis.push_back(new WtaunuAnalysis); } if (m_ttbarAnalysis) { - cout << "Adding module ttbarAnalysis" << endl; + std::cout << "Adding module ttbarAnalysis" << std::endl; m_analysis.push_back(new ttbarAnalysis); } if (m_bbbarAnalysis) { - cout << "Adding module bbbarAnalysis" << endl; + std::cout << "Adding module bbbarAnalysis" << std::endl; m_analysis.push_back(new bbbarAnalysis); } if (m_UEAnalysis) { - cout << "Adding module UEAnalysis" << endl; + std::cout << "Adding module UEAnalysis" << std::endl; m_analysis.push_back(new UEAnalysis); } if (m_EtmissAnalysis) { - cout << "Adding module EtMissAnalysis" << endl; + std::cout << "Adding module EtMissAnalysis" << std::endl; m_analysis.push_back(new EtMissAnalysis); } if (m_ElasScatAnalysis) { - cout << "Adding module ElasScatAnalysis" << endl; + std::cout << "Adding module ElasScatAnalysis" << std::endl; m_analysis.push_back(new ElasScatAnalysis); } if (m_UserAnalysis) { - cout << "Adding module UserAnalysis" << endl; + std::cout << "Adding module UserAnalysis" << std::endl; m_analysis.push_back(new UserAnalysis); } ATH_MSG_DEBUG("Analyses added"); if (m_LeptonJetAnalysis) { - cout << "Adding module LeptonJetAnalysis" << endl; + std::cout << "Adding module LeptonJetAnalysis" << std::endl; m_analysis.push_back(new LeptonJetAnalysis); } ATH_MSG_DEBUG("Analyses added"); if (m_ParticleContentAnalysis) { - cout << "Adding module ParticleContentAnalysis" << endl; + std::cout << "Adding module ParticleContentAnalysis" << std::endl; m_analysis.push_back(new ParticleContentAnalysis); } ATH_MSG_DEBUG("Analyses added"); if (m_PdfAnalysis) { - cout << "Adding module PdfAnalysis" << endl; + std::cout << "Adding module PdfAnalysis" << std::endl; m_analysis.push_back(new PdfAnalysis); } ATH_MSG_DEBUG("Analyses added"); - for (vector<baseAnalysis*>::const_iterator i(m_jetfinder.begin()); i != m_jetfinder.end(); ++i) { + for (std::vector<baseAnalysis*>::const_iterator i(m_jetfinder.begin()); i != m_jetfinder.end(); ++i) { (*i)->Init(m_max_eta,m_min_pt); (*i)->InitJetFinder(m_jet_coneRadius,m_jet_overlapThreshold,m_jet_ptmin, m_lepton_ptmin, m_DeltaR_lepton_track); } - for (vector<baseAnalysis*>::const_iterator i(m_analysis.begin()); i != m_analysis.end(); ++i) { + for (std::vector<baseAnalysis*>::const_iterator i(m_analysis.begin()); i != m_analysis.end(); ++i) { (*i)->Init(m_max_eta,m_min_pt); (*i)->InitJetFinder(m_jet_coneRadius,m_jet_overlapThreshold,m_jet_ptmin, m_lepton_ptmin, m_DeltaR_lepton_track); } //TH1::SetDirectory(0) prevent histograms to be added to the list of histiograms of currently opened file (solve conflict with TestHepMC) - for ( vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) + for ( std::vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) { - vector<TH1D*> hists = (*ana)->Histograms(); - for (vector<TH1D* >::iterator h = hists.begin(); h != hists.end(); h++) + std::vector<TH1D*> hists = (*ana)->Histograms(); + for (std::vector<TH1D* >::iterator h = hists.begin(); h != hists.end(); h++) (*h)->SetDirectory(0); } @@ -225,6 +204,8 @@ StatusCode HepMCAnalysis::initialize() return StatusCode::SUCCESS; } +StatusCode GetRunEventNumber(AthAlgorithm* a,int& runNumber,int& evtNumber, const std::string im); +StatusCode GetEvents( AthAlgorithm* a, std::vector<HepMC::GenEvent*>& evts, const std::string km); // ---------------------------------------------------------------------- StatusCode HepMCAnalysis::execute() { @@ -232,71 +213,32 @@ StatusCode HepMCAnalysis::execute() int runNumber = 0, evtNumber = 0; - // load event info - const EventInfo* mcInfoptr; - if ( evtStore()->retrieve( mcInfoptr, m_infokey ).isFailure() ) { - ATH_MSG_ERROR( "Could not retrieve EventInfo" ); - return StatusCode::FAILURE; - - } else{ - runNumber = mcInfoptr->event_ID()->run_number(); - evtNumber = mcInfoptr->event_ID()->event_number(); - ATH_MSG_DEBUG( "run: " << runNumber << " event: " << evtNumber ); - } - ATH_MSG_DEBUG("Event info loaded"); - - // load HepMC info - const McEventCollection* mcCollptr; - if ( evtStore()->retrieve( mcCollptr, m_key ).isFailure() ) { - ATH_MSG_WARNING( "Could not retrieve McEventCollection" ); - return StatusCode::SUCCESS; - - } else { - ATH_MSG_DEBUG("HepMC info loaded"); - - // loop over all events in McEventCollection - for ( McEventCollection::const_iterator itr = mcCollptr->begin(); itr != mcCollptr->end(); ++itr ) { - // FIXME: This gets an object from SG, which we are not allowed to modify. - // But we do modify it in MeVToGeV. - // This needs to change. - // Further, we need a non-const pointer to call the Process() and - // ClearEvent() methods of baseAnalysis, although from a spot check, - // it appears that these do not actually change the object. - // If that is the case, then these interfaces should really be changed - // to take a const pointer. - HepMC::GenEvent *evt = const_cast<HepMC::GenEvent*>(*itr); - - // convert units - MeVToGeV( evt ); - + StatusCode runeventnumber_statuscode =GetRunEventNumber(this,runNumber,evtNumber,m_infokey); + if (runeventnumber_statuscode==StatusCode::FAILURE) return StatusCode::FAILURE; + std::vector<HepMC::GenEvent*> evts; + StatusCode events_statuscode=GetEvents(this,evts,m_key); + if (events_statuscode==StatusCode::FAILURE) return StatusCode::FAILURE; + for (auto evt: evts) { // call JetFinder - vector< fastjet::PseudoJet > inclusive_jets; - for ( vector< baseAnalysis* >::const_iterator i( m_jetfinder.begin() ); i != m_jetfinder.end(); ++i ) { + std::vector< fastjet::PseudoJet > inclusive_jets; + for ( std::vector< baseAnalysis* >::const_iterator i( m_jetfinder.begin() ); i != m_jetfinder.end(); ++i ) { inclusive_jets = (*i)->GetJet(evt); } ATH_MSG_DEBUG( "after jet finder" ); - -// int ret_all = true; - for ( vector< baseAnalysis* >::const_iterator analysis = m_analysis.begin(); analysis != m_analysis.end(); ++analysis ) { + for ( std::vector< baseAnalysis* >::const_iterator analysis = m_analysis.begin(); analysis != m_analysis.end(); ++analysis ) { (*analysis)->SetJet( &inclusive_jets ); -// int ret = (*analysis)->Process( evt ); // call analysis - -// if ( !ret ) { -// ret_all = false; -// } } ATH_MSG_DEBUG("After process function"); // delete jet object, missing Et etc. - for ( vector<baseAnalysis*>::const_iterator i( m_jetfinder.begin() ); i != m_jetfinder.end(); ++i ) { + for ( std::vector<baseAnalysis*>::const_iterator i( m_jetfinder.begin() ); i != m_jetfinder.end(); ++i ) { (*i)->ClearEvent(evt); } ATH_MSG_DEBUG("After jetfinder mem cleanup"); } - } - + for (size_t i=0;i<evts.size();i++) delete evts[i]; ATH_MSG_DEBUG("Successful execution"); return StatusCode::SUCCESS; } @@ -314,18 +256,18 @@ StatusCode HepMCAnalysis::finalize() } // average histograms - for ( vector< baseAnalysis* >::const_iterator analysis = m_analysis.begin(); analysis != m_analysis.end(); ++analysis ) { + for ( std::vector< baseAnalysis* >::const_iterator analysis = m_analysis.begin(); analysis != m_analysis.end(); ++analysis ) { (*analysis)->averagedHistograms(); } // register histos with histogram service TH1D *hist = 0; - for ( vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) { + for ( std::vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) { while ( ( hist =(*ana)->popHisto() ) ) { TString histname("/hepmcanalysis/"); - string name = hist->GetName(); - string dir = name.substr(0, name.find("_")); + std::string name = hist->GetName(); + std::string dir = name.substr(0, name.find("_")); histname += dir; histname += "/"; histname += hist->GetName(); @@ -342,12 +284,12 @@ StatusCode HepMCAnalysis::finalize() ATH_MSG_INFO( "Histograms registered successfully" ); // clean up analysis modules - for ( vector< baseAnalysis* >::const_iterator j = m_jetfinder.begin(); j != m_jetfinder.end(); ++j ) { + for ( std::vector< baseAnalysis* >::const_iterator j = m_jetfinder.begin(); j != m_jetfinder.end(); ++j ) { delete (*j); } m_jetfinder.clear(); - for ( vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) { + for ( std::vector< baseAnalysis* >::const_iterator ana = m_analysis.begin(); ana != m_analysis.end(); ++ana ) { delete (*ana); } m_analysis.clear(); diff --git a/Generators/HepMCAnalysis_i/src/LeptonJetAnalysis.cxx b/Generators/HepMCAnalysis_i/src/LeptonJetAnalysis.cxx index afe57c9276bfacecbc241f773ed1b35052c54c56..dca2138cce8ab55d433a017dad53b005bffebb5e 100644 --- a/Generators/HepMCAnalysis_i/src/LeptonJetAnalysis.cxx +++ b/Generators/HepMCAnalysis_i/src/LeptonJetAnalysis.cxx @@ -6,16 +6,6 @@ #include <iostream> -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/IO_GenEvent.h" -#include "AtlasHepMC/GenParticle.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/IO_AsciiParticles.h" -#include "AtlasHepMC/SimpleVector.h" -#include "AtlasHepMC/WeightContainer.h" -#include "CLHEP/Vector/LorentzVector.h" - - #include "TH1.h" #include "TMath.h" #include "TLorentzVector.h" @@ -25,12 +15,22 @@ #include "fastjet/JetDefinition.hh" #include "fastjet/SISConePlugin.hh" -#include "TruthUtils/HepMCHelpers.h" //MCUtils.h +/** Here we state explicitely what is used */ +#include "MCUtils/PIDUtils.h" +#include "MCUtils/HepMCEventUtils.h" +#include "MCUtils/HepMCParticleUtils.h" +#include "MCUtils/HepMCVectors.h" +#include "MCUtils/HepMCParticleClassifiers.h" #include "HEPUtils/FastJet.h" #include "../HepMCAnalysis_i/LeptonJetAnalysis.h" -using namespace std; +namespace MC { +using namespace MCUtils::PID; +using MCUtils::ptGtr; +using MCUtils::get_weight; +using MCUtils::isLastReplica; +} // ---------------------------------------------------------------------- LeptonJetAnalysis::LeptonJetAnalysis() @@ -298,26 +298,26 @@ int LeptonJetAnalysis::Init(double maxEta, double minPt) for(UInt_t i = 0; i < nleptons; ++i){ m_histName.Form("lepton%d_pT", i+1); - m_leptonPt[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 100, 0., 300.); + m_leptonPt[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 100, 0., 300.); m_leptonPt[i] -> Sumw2(); m_histName.Form("lepton%d_eta", i+1); - m_leptonEta[i] = initHist(string( m_histName ), string( m_histName ), string( "#eta") , 50, -4, 4); + m_leptonEta[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#eta") , 50, -4, 4); m_leptonEta[i] -> Sumw2(); } for(UInt_t i = 0; i < nleptons-1; ++i){ for (UInt_t j=i+1; j < nleptons;++j){ m_histName.Form("lepton%d%d_deltaR", i+1,j+1); - m_leptondR[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta R" ), 64, 0, 3.2); + m_leptondR[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta R" ), 64, 0, 3.2); m_leptondR[i][j] -> Sumw2(); m_histName.Form("lepton%d%d_deltaPhi", i+1,j+1); - m_leptondPhi[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta #phi" ), 40, -3.14, 3.14); + m_leptondPhi[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta #phi" ), 40, -3.14, 3.14); m_leptondPhi[i][j] -> Sumw2(); m_histName.Form("lepton%d%d_Mass", i+1,j+1); - m_leptonMass[i][j] = initHist(string( m_histName ), string( m_histName ), string( "mass [GeV]" ), 40, 40.0, 120.0); + m_leptonMass[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass [GeV]" ), 40, 40.0, 120.0); m_leptonMass[i][j] -> Sumw2(); m_histName.Form("lepton%d%d_lowMass", i+1,j+1); - m_leptonLowMass[i][j] = initHist(string( m_histName ), string( m_histName ), string( "mass [GeV]" ), 20, 0.0, 40.0); + m_leptonLowMass[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass [GeV]" ), 20, 0.0, 40.0); m_leptonLowMass[i][j] -> Sumw2(); } } @@ -351,16 +351,16 @@ int LeptonJetAnalysis::Init(double maxEta, double minPt) for(UInt_t i = 0; i < njets; ++i){ m_histName.Form("jet%d_pT", i+1); - m_jetPt[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 100, 0., 300.); + m_jetPt[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 100, 0., 300.); m_jetPt[i] -> Sumw2(); m_histName.Form("jet%d_pT_highrange", i+1); - m_jetPtHighRange[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 300, 0., 1000.); + m_jetPtHighRange[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 300, 0., 1000.); m_jetPtHighRange[i] -> Sumw2(); m_histName.Form("jet%d_eta", i+1); - m_jetEta[i] = initHist(string( m_histName ), string( m_histName ), string( "#eta") , 50, -4, 4); + m_jetEta[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#eta") , 50, -4, 4); m_jetEta[i] -> Sumw2(); m_histName.Form("jet%d_MassPt", i+1); - m_jetMassPt[i] = initHist(string( m_histName ), string( m_histName ), string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); + m_jetMassPt[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); m_jetMassPt[i] -> Sumw2(); } @@ -368,13 +368,13 @@ int LeptonJetAnalysis::Init(double maxEta, double minPt) for(UInt_t i = 0; i < njets-1; ++i){ for (UInt_t j=i+1; j < njets;++j){ m_histName.Form("jet%d%d_deltaR", i+1,j+1); - m_jetdR[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta R" ), 64, 0, 3.2); + m_jetdR[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta R" ), 64, 0, 3.2); m_jetdR[i][j] -> Sumw2(); m_histName.Form("jet%d%d_deltaPhi", i+1,j+1); - m_jetdPhi[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta #phi" ), 40, -3.14, 3.14); + m_jetdPhi[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta #phi" ), 40, -3.14, 3.14); m_jetdPhi[i][j] -> Sumw2(); m_histName.Form("jet%d%d_Mass", i+1,j+1); - m_jetMass[i][j] = initHist(string( m_histName ), string( m_histName ), string( "mass [GeV]" ), 50, 0.0, 50.0); + m_jetMass[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass [GeV]" ), 50, 0.0, 50.0); m_jetMass[i][j] -> Sumw2(); } } @@ -388,29 +388,29 @@ int LeptonJetAnalysis::Init(double maxEta, double minPt) for(UInt_t i = 0; i < njets; ++i){ m_histName.Form("jet%d_pT_nocuts", i+1); - m_jetPt_nocuts[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 100, 0., 300.); + m_jetPt_nocuts[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 100, 0., 300.); m_jetPt_nocuts[i] -> Sumw2(); m_histName.Form("jet%d_pT_highrange_nocuts", i+1); - m_jetPtHighRange_nocuts[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 300, 0., 1000.); + m_jetPtHighRange_nocuts[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 300, 0., 1000.); m_jetPtHighRange_nocuts[i] -> Sumw2(); m_histName.Form("jet%d_eta_nocuts", i+1); - m_jetEta_nocuts[i] = initHist(string( m_histName ), string( m_histName ), string( "#eta") , 50, -4, 4); + m_jetEta_nocuts[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#eta") , 50, -4, 4); m_jetEta_nocuts[i] -> Sumw2(); m_histName.Form("jet%d_MassPt_nocuts", i+1); - m_jetMassPt_nocuts[i] = initHist(string( m_histName ), string( m_histName ), string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); + m_jetMassPt_nocuts[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); m_jetMassPt_nocuts[i] -> Sumw2(); } for(UInt_t i = 0; i < njets-1; ++i){ for (UInt_t j=i+1; j < njets;++j){ m_histName.Form("jet%d%d_deltaR_nocuts", i+1,j+1); - m_jetdR_nocuts[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta R" ), 64, 0, 3.2); + m_jetdR_nocuts[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta R" ), 64, 0, 3.2); m_jetdR_nocuts[i][j] -> Sumw2(); m_histName.Form("jet%d%d_deltaPhi_nocuts", i+1,j+1); - m_jetdPhi_nocuts[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta #phi" ), 40, -3.14, 3.14); + m_jetdPhi_nocuts[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta #phi" ), 40, -3.14, 3.14); m_jetdPhi_nocuts[i][j] -> Sumw2(); m_histName.Form("jet%d%d_Mass_nocuts", i+1,j+1); - m_jetMass_nocuts[i][j] = initHist(string( m_histName ), string( m_histName ), string( "mass [GeV]" ), 50, 0.0, 50.0); + m_jetMass_nocuts[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass [GeV]" ), 50, 0.0, 50.0); m_jetMass_nocuts[i][j] -> Sumw2(); } } @@ -424,29 +424,29 @@ int LeptonJetAnalysis::Init(double maxEta, double minPt) for(UInt_t i = 0; i < njets; ++i){ m_histName.Form("jet%d_pT_forward", i+1); - m_jetPt_forward[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 100, 0., 300.); + m_jetPt_forward[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 100, 0., 300.); m_jetPt_forward[i] -> Sumw2(); m_histName.Form("jet%d_pT_highrange_forward", i+1); - m_jetPtHighRange_forward[i] = initHist(string( m_histName ), string( m_histName ), string( "p_{T} [GeV]") , 300, 0., 1000.); + m_jetPtHighRange_forward[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "p_{T} [GeV]") , 300, 0., 1000.); m_jetPtHighRange_forward[i] -> Sumw2(); m_histName.Form("jet%d_eta_forward", i+1); - m_jetEta_forward[i] = initHist(string( m_histName ), string( m_histName ), string( "#eta") , 50, -4, 4); + m_jetEta_forward[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#eta") , 50, -4, 4); m_jetEta_forward[i] -> Sumw2(); m_histName.Form("jet%d_MassPt_forward", i+1); - m_jetMassPt_forward[i] = initHist(string( m_histName ), string( m_histName ), string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); + m_jetMassPt_forward[i] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass^{2}/p_{T}^{2}") , 100, 0.0, 0.1); m_jetMassPt_forward[i] -> Sumw2(); } for(UInt_t i = 0; i < njets-1; ++i){ for (UInt_t j=i+1; j < njets;++j){ m_histName.Form("jet%d%d_deltaR_forward", i+1,j+1); - m_jetdR_forward[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta R" ), 64, 0, 3.2); + m_jetdR_forward[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta R" ), 64, 0, 3.2); m_jetdR_forward[i][j] -> Sumw2(); m_histName.Form("jet%d%d_deltaPhi_forward", i+1,j+1); - m_jetdPhi_forward[i][j] = initHist(string( m_histName ), string( m_histName ), string( "#Delta #phi" ), 40, -3.14, 3.14); + m_jetdPhi_forward[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "#Delta #phi" ), 40, -3.14, 3.14); m_jetdPhi_forward[i][j] -> Sumw2(); m_histName.Form("jet%d%d_Mass_forward", i+1,j+1); - m_jetMass_forward[i][j] = initHist(string( m_histName ), string( m_histName ), string( "mass [GeV]" ), 50, 0.0, 50.0); + m_jetMass_forward[i][j] = initHist(std::string( m_histName ), std::string( m_histName ), std::string( "mass [GeV]" ), 50, 0.0, 50.0); m_jetMass_forward[i][j] -> Sumw2(); } } @@ -520,7 +520,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) { double weight; - HepMC::GenParticle *lepton = 0; + HepMC::GenParticle* lepton = nullptr; std::vector<fastjet::PseudoJet> selected_jets; std::vector<fastjet::PseudoJet> forward_jets; @@ -538,7 +538,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) Int_t NumLeptons = 0, NumElectrons = 0, NumMuons = 0, NumTaus = 0, NumZ = 0, NumW = 0, NumGamma = 0; if (event -> event_number() % 1000 == 0) { - cout << "Processing event " << event -> event_number() << endl; + std::cout << "Processing event " << event -> event_number() << std::endl; } weight = MC::get_weight(event, 0 ); m_event_weight -> Fill(weight); @@ -547,7 +547,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) for (HepMC::GenEvent::particle_const_iterator p = event -> particles_begin(); p != event -> particles_end(); ++p){ - if ( abs((*p) -> pdg_id()) == 23 && (MC::isLastReplica(*p))){ + if ( std::abs((*p) -> pdg_id()) == 23 && (MC::isLastReplica(*p))){ NumZ++; m_ZNum->Fill(weight); m_Z1pt->Fill((*p) -> momentum().perp(), weight); @@ -555,7 +555,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) } - if ( abs((*p) -> pdg_id()) == 24 && (MC::isLastReplica(*p))){ + if ( std::abs((*p) -> pdg_id()) == 24 && (MC::isLastReplica(*p))){ NumW++; m_WNum->Fill(weight); m_W1pt->Fill((*p) -> momentum().perp(), weight); @@ -563,7 +563,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) } - if ( abs((*p) -> pdg_id()) == 22 && (MC::isLastReplica(*p))){ + if ( std::abs((*p) -> pdg_id()) == 22 && (MC::isLastReplica(*p))){ NumGamma++; m_gammaNum->Fill(weight); m_gamma1pt->Fill((*p) -> momentum().perp(), weight); @@ -573,32 +573,32 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) - if ((MC::PID::isLepton((*p) -> pdg_id())) && (MC::isLastReplica(*p))) // last replica of charged lepton selected + if ((MC::isLepton((*p) -> pdg_id())) && (MC::isLastReplica(*p))) // last replica of charged lepton selected { lepton = (*p); if (!MC::ptGtr(lepton, ptmin_l)) continue; - if (!MC::isStable(lepton)) continue; - if (!MC::isCharged(lepton)) continue; + if (!(lepton->status()==1)) continue; + if (!MC::isCharged(lepton->pdg_id())) continue; int charge = ((*p) -> pdg_id() > 0) ? 1 : (((*p) -> pdg_id() < 0) ? -1 : 0); m_leptonInclPt -> Fill(lepton -> momentum().perp(), weight); //fill plots for electrons - if (abs(lepton -> pdg_id()) == 11) { + if (std::abs(lepton -> pdg_id()) == 11) { m_electronPt -> Fill(lepton -> momentum().perp(), weight); m_electronCharge -> Fill(charge, weight); NumElectrons++; } //fill plots for muons - if (abs(lepton -> pdg_id()) == 13) { + if (std::abs(lepton -> pdg_id()) == 13) { m_muonPt -> Fill(lepton -> momentum().perp(), weight); m_muonCharge -> Fill(charge, weight); NumMuons++; } //fill plots for taus - //pdgid 17??? seems wrong if ((abs(lepton -> pdg_id()) == 15) || (abs(lepton -> pdg_id()) == 17)) { - if (abs(lepton -> pdg_id()) == 15) { + //pdgid 17??? seems wrong if ((std::abs(lepton -> pdg_id()) == 15) || (std::abs(lepton -> pdg_id()) == 17)) { + if (std::abs(lepton -> pdg_id()) == 15) { m_tauPt -> Fill(lepton -> momentum().perp(), weight); m_tauCharge -> Fill(charge, weight); NumTaus++; @@ -610,7 +610,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) const HEPUtils::P4 leptonMomentum(p4.px(), p4.py(), p4.pz(), p4.e()); unsorted_leptons.push_back(HEPUtils::mk_pseudojet(leptonMomentum)); - if( abs(lepton -> momentum().eta()) < etamax_l){ + if( std::abs(lepton -> momentum().eta()) < etamax_l){ // unsorted_tight_leptons.push_back(MC::mk_pseudojet(lepton)); unsorted_tight_leptons.push_back(HEPUtils::mk_pseudojet(leptonMomentum)); } @@ -649,13 +649,13 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) //loop over jets and fill vectors for (size_t i = 0; i < m_inclusive_jets.size(); ++i) { - if ((abs(m_inclusive_jets[i].eta()) < etamax_jet) && (m_inclusive_jets[i].perp() > ptmin_jet)){ + if ((std::abs(m_inclusive_jets[i].eta()) < etamax_jet) && (m_inclusive_jets[i].perp() > ptmin_jet)){ selected_jets.push_back(m_inclusive_jets[i]); } - if (abs(m_inclusive_jets[i].eta()) < etamax_jet){ + if (std::abs(m_inclusive_jets[i].eta()) < etamax_jet){ no_cuts_jets.push_back(m_inclusive_jets[i]); } - if ( (abs(m_inclusive_jets[i].eta()) >= etamin_jetf) && (m_inclusive_jets[i].perp() > ptmin_jet)){ + if ( (std::abs(m_inclusive_jets[i].eta()) >= etamin_jetf) && (m_inclusive_jets[i].perp() > ptmin_jet)){ forward_jets.push_back(m_inclusive_jets[i]); } } @@ -671,7 +671,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) } for (UInt_t j = i + 1; j < selected_jets.size() ;++j){ if ((i < njets-1)&&(j < njets)){ - m_jetdR[i][j]->Fill(sqrt(selected_jets[i].squared_distance(selected_jets[j])), weight); + m_jetdR[i][j]->Fill(std::sqrt(selected_jets[i].squared_distance(selected_jets[j])), weight); m_jetMass[i][j] -> Fill(selected_jets[i].m() + selected_jets[j].m(), weight); m_jetdPhi[i][j]->Fill(selected_jets[i].delta_phi_to(selected_jets[j]), weight); } @@ -689,7 +689,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) } for (UInt_t j = i + 1; j < no_cuts_jets.size() ;++j){ if ((i < njets-1)&&(j < njets)){ - m_jetdR_nocuts[i][j]->Fill(sqrt(no_cuts_jets[i].squared_distance(no_cuts_jets[j])), weight); + m_jetdR_nocuts[i][j]->Fill(std::sqrt(no_cuts_jets[i].squared_distance(no_cuts_jets[j])), weight); m_jetMass_nocuts[i][j] -> Fill(no_cuts_jets[i].m() + no_cuts_jets[j].m(), weight); m_jetdPhi_nocuts[i][j]->Fill(no_cuts_jets[i].delta_phi_to(no_cuts_jets[j]), weight); } @@ -707,7 +707,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) } for (UInt_t j = i + 1; j < forward_jets.size() ;++j){ if ((i < njets-1)&&(j < njets)){ - m_jetdR_forward[i][j]->Fill(sqrt(forward_jets[i].squared_distance(forward_jets[j])), weight); + m_jetdR_forward[i][j]->Fill(std::sqrt(forward_jets[i].squared_distance(forward_jets[j])), weight); m_jetMass_forward[i][j] -> Fill(forward_jets[i].m() + forward_jets[j].m(), weight); m_jetdPhi_forward[i][j]->Fill(forward_jets[i].delta_phi_to(forward_jets[j]), weight); } @@ -729,7 +729,7 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) m_jet1Pt_tight -> Fill(selected_jets[0].perp(), weight); m_jet1PtHighRange_tight -> Fill(selected_jets[0].perp(), weight); m_jet1Eta_tight -> Fill(selected_jets[0].eta(), weight); - m_dR_jet1_to_lepton_tight -> Fill(sqrt(selected_jets[0].squared_distance(tight_leptons[0])), weight); + m_dR_jet1_to_lepton_tight -> Fill(std::sqrt(selected_jets[0].squared_distance(tight_leptons[0])), weight); m_dPhi_jet1_to_lepton_tight -> Fill(selected_jets[0].delta_phi_to(tight_leptons[0]), weight); dR1 = selected_jets[0].squared_distance (tight_leptons[0]); @@ -740,15 +740,15 @@ int LeptonJetAnalysis::Process(HepMC::GenEvent *event) m_jet2Pt_tight -> Fill(selected_jets[1].perp(), weight); m_jet2PtHighRange_tight -> Fill(selected_jets[1].perp(), weight); m_jet2Eta_tight -> Fill(selected_jets[1].eta(), weight); - m_dR_jet2_to_lepton_tight -> Fill(sqrt(selected_jets[1].squared_distance(tight_leptons[0])), weight); + m_dR_jet2_to_lepton_tight -> Fill(std::sqrt(selected_jets[1].squared_distance(tight_leptons[0])), weight); m_dPhi_jet2_to_lepton_tight -> Fill(selected_jets[1].delta_phi_to(tight_leptons[0]), weight); dR2 = selected_jets[1].squared_distance(tight_leptons[0]); dPhi2 = selected_jets[1].delta_phi_to(tight_leptons[0]); } - dRmin = ( abs(dR2) > abs(dR1)) ? dR1 :dR2; - dPhimin = (abs(dPhi2) > abs(dPhi1)) ? dPhi1 :dPhi2; + dRmin = ( std::abs(dR2) > std::abs(dR1)) ? dR1 :dR2; + dPhimin = (std::abs(dPhi2) > std::abs(dPhi1)) ? dPhi1 :dPhi2; m_dR_lepton_to_closest_jet_tight -> Fill(dRmin, weight); m_dPhi_lepton_to_closest_jet_tight -> Fill(dPhimin, weight); } diff --git a/Generators/HepMCAnalysis_i/src/ParticleContentAnalysis.cxx b/Generators/HepMCAnalysis_i/src/ParticleContentAnalysis.cxx index fe44ac3d0c57029b69a3cff7b3b94d99c381a832..0d48092e7c521efe2bbfe317c5b3168da578285d 100644 --- a/Generators/HepMCAnalysis_i/src/ParticleContentAnalysis.cxx +++ b/Generators/HepMCAnalysis_i/src/ParticleContentAnalysis.cxx @@ -5,12 +5,6 @@ #include <iostream> #include <sstream> #include <stdio.h> -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/IO_GenEvent.h" -#include "AtlasHepMC/GenParticle.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/IO_AsciiParticles.h" -#include "AtlasHepMC/SimpleVector.h" #include "CLHEP/Vector/LorentzVector.h" // ROOT headers @@ -18,13 +12,23 @@ #include "TH2.h" #include "TFile.h" #include "TMath.h" -#include "TLorentzVector.h" -#include "TruthUtils/HepMCHelpers.h" +/** Here we state explicitely what is used */ +#include "MCUtils/PIDUtils.h" +#include "MCUtils/HepMCEventUtils.h" +#include "MCUtils/HepMCParticleUtils.h" +#include "MCUtils/HepMCVectors.h" +#include "MCUtils/HepMCParticleClassifiers.h" #include "../HepMCAnalysis_i/ParticleContentAnalysis.h" -using namespace std; +namespace MC { +using namespace MCUtils::PID; +using MCUtils::get_weight; +using MCUtils::flightLength; +using MCUtils::isLastReplica; +} + // empty default constructor ParticleContentAnalysis::ParticleContentAnalysis() @@ -208,83 +212,83 @@ int ParticleContentAnalysis::Init(double tr_max_eta, double tr_min_pt) m_outputRootDir = "PartCont"; //declaration of histograms - m_evtnr = initHist( string( "EventNumber" ), string( "Event number" ), string("Eventnumber"), 100, 0., 1000. ); - m_evtweight = initHist( string( "EventWeight"), string( "event weight"), string("weight"), 1000, -5000000.0, 5000000.0); - m_evtweight_zoom = initHist(string("EventWeight_Zoom"), string("event weight"), string("weight"), 41, -20.5, 20.5); + m_evtnr = initHist( std::string( "EventNumber" ), std::string( "Event number" ), std::string("Eventnumber"), 100, 0., 1000. ); + m_evtweight = initHist( std::string( "EventWeight"), std::string( "event weight"), std::string("weight"), 1000, -5000000.0, 5000000.0); + m_evtweight_zoom = initHist(std::string("EventWeight_Zoom"), std::string("event weight"), std::string("weight"), 41, -20.5, 20.5); //all particles in the event - m_initial_particle_pid = initHist( string( "Initial_Particle_PID" ) , string( "PID of initial particles") , string(" pid" ), 30001., -15000.5, 15000.5 ); - m_intermediate_particle_pid = initHist( string( "Intermediate_Particle_PID" ) , string( "PID of intermediate particles" ), string(" pid" ), 30001., -15000.5, 15000.5 ); - m_final_particle_pid = initHist( string( "Final_Particle_PID") , string( "PID of final particles" ), string(" pid" ), 30001., -15000.5, 15000.5 ); + m_initial_particle_pid = initHist( std::string( "Initial_Particle_PID" ) , std::string( "PID of initial particles") , std::string(" pid" ), 30001., -15000.5, 15000.5 ); + m_intermediate_particle_pid = initHist( std::string( "Intermediate_Particle_PID" ) , std::string( "PID of intermediate particles" ), std::string(" pid" ), 30001., -15000.5, 15000.5 ); + m_final_particle_pid = initHist( std::string( "Final_Particle_PID") , std::string( "PID of final particles" ), std::string(" pid" ), 30001., -15000.5, 15000.5 ); - m_initial_particle_pid_zoom = initHist( string( "Initial_Particle_PID_zoom" ) , string( "PID of initial particles") , string(" pid" ), 61., -30.5, 30.5 ); - m_intermediate_particle_pid_zoom = initHist( string( "Intermediate_Particle_PID_zoom" ) , string( "PID of intermediate particles" ), string(" pid" ), 61., -30.5, 30.5 ); - m_final_particle_pid_zoom = initHist( string( "Final_Particle_PID_zoom") , string( "PID of final particles" ), string(" pid" ), 61., -30.5, 30.5 ); + m_initial_particle_pid_zoom = initHist( std::string( "Initial_Particle_PID_zoom" ) , std::string( "PID of initial particles") , std::string(" pid" ), 61., -30.5, 30.5 ); + m_intermediate_particle_pid_zoom = initHist( std::string( "Intermediate_Particle_PID_zoom" ) , std::string( "PID of intermediate particles" ), std::string(" pid" ), 61., -30.5, 30.5 ); + m_final_particle_pid_zoom = initHist( std::string( "Final_Particle_PID_zoom") , std::string( "PID of final particles" ), std::string(" pid" ), 61., -30.5, 30.5 ); - m_particle_status = initHist( string( "Particle_Status" ), string( "status of particles" ), string("status" ), 151., -0.5, 150.5 ); + m_particle_status = initHist( std::string( "Particle_Status" ), std::string( "status of particles" ), std::string("status" ), 151., -0.5, 150.5 ); //bottom hadron plots - m_BottomHadron_pt = initHist( string( "BottomHadron_Pt" ), string( "p_{T} of bottom hadron" ), string( "p_{T} [GeV]" ), 200., 0., 400. ); - m_BottomHadron_eta = initHist( string( "BottomHadron_Eta" ), string( "#eta of bottom hadron" ), string(" #eta" ), 60, -6., 6. ); - m_BottomHadron_phi = initHist( string( "BottomHadron_Phi" ), string( "#Phi of bottom hadron" ), string( "#Phi" ), 48, -3.15, 3.15 ); - m_BottomHadron_flightlength = initHist( string( "BottomHadron_FlightLength" ), string( "flight length of bottom hadron" ), string( "length" ), 100., -0.05, 150.05 ); - m_BottomHadron_status = initHist( string( "BottomHadron_Status" ), string( "status of bottom hadron" ), string("status" ), 151., -0.5, 150.5 ); - m_BottomHadron_decay_multiplicity = initHist( string( "BottomHadron_decay_multiplicity" ), string( "multiplicity of bottom hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - m_BottomHadron_decay_charged_multiplicity = initHist( string( "BottomHadron_decay_charged_multiplicity" ), string( "charged multiplicity of bottom hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - - m_BottomHadron_tight_pt = initHist( string( "BottomHadron_tight_Pt" ), string( "p_{T} of bottom hadron" ), string( "p_{T} [GeV]" ), 200., 0., 400. ); - m_BottomHadron_tight_eta = initHist( string( "BottomHadron_tight_Eta" ), string( "#eta of bottom hadron" ), string(" #eta" ), 60, -6., 6. ); - m_BottomHadron_tight_phi = initHist( string( "BottomHadron_tight_Phi" ), string( "#Phi of bottom hadron" ), string( "#Phi" ), 48, -3.15, 3.15 ); - m_BottomHadron_tight_flightlength = initHist( string( "BottomHadron_tight_FlightLength" ), string( "flight length of bottom hadron" ), string( "length" ), 100., -0.05, 150.05 ); - m_BottomHadron_tight_status = initHist( string( "BottomHadron_tight_Status" ), string( "status of bottom hadron" ), string("status" ), 151., -0.5, 150.5 ); - m_BottomHadron_tight_decay_multiplicity = initHist( string( "BottomHadron_tight_decay_multiplicity" ), string( "multiplicity of bottom hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - m_BottomHadron_tight_decay_charged_multiplicity = initHist( string( "BottomHadron_tight_decay_charged_multiplicity" ), string( "charged multiplicity of bottom hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - - m_BottomMeson_number = initHist( string( "NumBottomMeson"), string( "number of bottom meson"), string( "number"), 81, -0.5, 80.5); - m_BottomBaryon_number = initHist( string( "NumBottomBaryon"), string( "number of bottom baryon"), string( "number"), 81, -0.5, 80.5); + m_BottomHadron_pt = initHist( std::string( "BottomHadron_Pt" ), std::string( "p_{T} of bottom hadron" ), std::string( "p_{T} [GeV]" ), 200., 0., 400. ); + m_BottomHadron_eta = initHist( std::string( "BottomHadron_Eta" ), std::string( "#eta of bottom hadron" ), std::string(" #eta" ), 60, -6., 6. ); + m_BottomHadron_phi = initHist( std::string( "BottomHadron_Phi" ), std::string( "#Phi of bottom hadron" ), std::string( "#Phi" ), 48, -3.15, 3.15 ); + m_BottomHadron_flightlength = initHist( std::string( "BottomHadron_FlightLength" ), std::string( "flight length of bottom hadron" ), std::string( "length" ), 100., -0.05, 150.05 ); + m_BottomHadron_status = initHist( std::string( "BottomHadron_Status" ), std::string( "status of bottom hadron" ), std::string("status" ), 151., -0.5, 150.5 ); + m_BottomHadron_decay_multiplicity = initHist( std::string( "BottomHadron_decay_multiplicity" ), std::string( "multiplicity of bottom hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + m_BottomHadron_decay_charged_multiplicity = initHist( std::string( "BottomHadron_decay_charged_multiplicity" ), std::string( "charged multiplicity of bottom hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + + m_BottomHadron_tight_pt = initHist( std::string( "BottomHadron_tight_Pt" ), std::string( "p_{T} of bottom hadron" ), std::string( "p_{T} [GeV]" ), 200., 0., 400. ); + m_BottomHadron_tight_eta = initHist( std::string( "BottomHadron_tight_Eta" ), std::string( "#eta of bottom hadron" ), std::string(" #eta" ), 60, -6., 6. ); + m_BottomHadron_tight_phi = initHist( std::string( "BottomHadron_tight_Phi" ), std::string( "#Phi of bottom hadron" ), std::string( "#Phi" ), 48, -3.15, 3.15 ); + m_BottomHadron_tight_flightlength = initHist( std::string( "BottomHadron_tight_FlightLength" ), std::string( "flight length of bottom hadron" ), std::string( "length" ), 100., -0.05, 150.05 ); + m_BottomHadron_tight_status = initHist( std::string( "BottomHadron_tight_Status" ), std::string( "status of bottom hadron" ), std::string("status" ), 151., -0.5, 150.5 ); + m_BottomHadron_tight_decay_multiplicity = initHist( std::string( "BottomHadron_tight_decay_multiplicity" ), std::string( "multiplicity of bottom hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + m_BottomHadron_tight_decay_charged_multiplicity = initHist( std::string( "BottomHadron_tight_decay_charged_multiplicity" ), std::string( "charged multiplicity of bottom hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + + m_BottomMeson_number = initHist( std::string( "NumBottomMeson"), std::string( "number of bottom meson"), std::string( "number"), 81, -0.5, 80.5); + m_BottomBaryon_number = initHist( std::string( "NumBottomBaryon"), std::string( "number of bottom baryon"), std::string( "number"), 81, -0.5, 80.5); //charmed hadron plots - m_CharmHadron_pt = initHist( string( "CharmHadron_Pt" ), string( "p_{T} of charmed hadron" ), string( "p_{T} [GeV]" ), 200., 0., 400.); - m_CharmHadron_eta = initHist( string( "CharmHadron_Eta" ), string( "#eta of charmed hadron" ), string( "#eta" ), 60, -6., 6.); - m_CharmHadron_phi = initHist( string( "CharmHadron_Phi" ), string( "#Phi of charmed hadron" ), string( "#Phi" ), 48, -3.15, 3.15); - m_CharmHadron_flightlength = initHist( string( "CharmHadron_FlightLength" ), string( "flight length of charmed hadron" ), string( "length" ), 100., -0.05, 150.05 ); - m_CharmHadron_status = initHist( string( "CharmHadron_Status" ), string( "status of charmed hadron" ), string("status" ), 151., -0.5, 150.5 ); - m_CharmHadron_decay_multiplicity = initHist( string( "CharmHadron_decay_multiplicity" ), string( "multiplicity of charmed hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - m_CharmHadron_decay_charged_multiplicity = initHist( string( "CharmHadron_decay_charged_multiplicity" ), string( "charged multiplicity of charmed hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - m_CharmMeson_number = initHist( string( "NumCharmMeson"), string( "number of charm meson"), string( "number"), 81, -0.5, 80.5); - m_CharmBaryon_number = initHist( string( "NumCharmBaryon"), string( "number of charm baryon"), string( "number"), 81, -0.5, 80.5); + m_CharmHadron_pt = initHist( std::string( "CharmHadron_Pt" ), std::string( "p_{T} of charmed hadron" ), std::string( "p_{T} [GeV]" ), 200., 0., 400.); + m_CharmHadron_eta = initHist( std::string( "CharmHadron_Eta" ), std::string( "#eta of charmed hadron" ), std::string( "#eta" ), 60, -6., 6.); + m_CharmHadron_phi = initHist( std::string( "CharmHadron_Phi" ), std::string( "#Phi of charmed hadron" ), std::string( "#Phi" ), 48, -3.15, 3.15); + m_CharmHadron_flightlength = initHist( std::string( "CharmHadron_FlightLength" ), std::string( "flight length of charmed hadron" ), std::string( "length" ), 100., -0.05, 150.05 ); + m_CharmHadron_status = initHist( std::string( "CharmHadron_Status" ), std::string( "status of charmed hadron" ), std::string("status" ), 151., -0.5, 150.5 ); + m_CharmHadron_decay_multiplicity = initHist( std::string( "CharmHadron_decay_multiplicity" ), std::string( "multiplicity of charmed hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + m_CharmHadron_decay_charged_multiplicity = initHist( std::string( "CharmHadron_decay_charged_multiplicity" ), std::string( "charged multiplicity of charmed hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + m_CharmMeson_number = initHist( std::string( "NumCharmMeson"), std::string( "number of charm meson"), std::string( "number"), 81, -0.5, 80.5); + m_CharmBaryon_number = initHist( std::string( "NumCharmBaryon"), std::string( "number of charm baryon"), std::string( "number"), 81, -0.5, 80.5); //strange hadron plots - m_StrangeHadron_pt = initHist( string( "StrangeHadron_Pt" ), string( "p_{T} of strange hadron" ), string( "p_{T} [GeV]" ), 200., 0., 400. ); - m_StrangeHadron_unstable_pt = initHist( string( "StrangeHadron_Unstable_Pt" ), string("p_{T} of the last strange hadron (unstable)" ), string( "p_{T} [GeV]" ), 200.,0.,400. ); - m_StrangeHadron_eta = initHist( string( "StrangeHadron_Eta" ), string( "#eta of strange hadron" ), string( "#eta" ), 60, -6., 6.); - m_StrangeHadron_phi = initHist( string( "StrangeHadron_Phi" ), string( "#Phi of strange hadron" ), string( "#Phi" ), 48, -3.15, 3.15); - m_StrangeHadron_flightlength = initHist( string( "StrangeHadron_FlightLength" ), string( "flight length of strange hadron" ), string( "length" ), 100., -0.05, 150.05 ); - m_StrangeHadron_status = initHist( string( "StrangeHadron_Status" ), string( "status of strange hadron" ), string("status" ), 151., -0.5, 150.5 ); - m_StrangeHadron_decay_multiplicity = initHist( string( "StrangeHadron_decay_multiplicity" ), string( "multiplicity of strange hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - m_StrangeHadron_decay_charged_multiplicity = initHist( string( "StrangeHadron_decay_charged_multiplicity" ), string( "charged multiplicity of strange hadron decay" ), string("N" ), 11., -0.5, 10.5 ); - - m_StrangeMeson_number = initHist( string( "NumStrangeMeson"), string( "number of strange meson"), string( "number"), 81, -0.5, 80.5); - m_StrangeBaryon_number = initHist( string( "NumStrangeBaryon"), string( "number of strange baryon"), string( "number"), 81, -0.5, 80.5); + m_StrangeHadron_pt = initHist( std::string( "StrangeHadron_Pt" ), std::string( "p_{T} of strange hadron" ), std::string( "p_{T} [GeV]" ), 200., 0., 400. ); + m_StrangeHadron_unstable_pt = initHist( std::string( "StrangeHadron_Unstable_Pt" ), std::string("p_{T} of the last strange hadron (unstable)" ), std::string( "p_{T} [GeV]" ), 200.,0.,400. ); + m_StrangeHadron_eta = initHist( std::string( "StrangeHadron_Eta" ), std::string( "#eta of strange hadron" ), std::string( "#eta" ), 60, -6., 6.); + m_StrangeHadron_phi = initHist( std::string( "StrangeHadron_Phi" ), std::string( "#Phi of strange hadron" ), std::string( "#Phi" ), 48, -3.15, 3.15); + m_StrangeHadron_flightlength = initHist( std::string( "StrangeHadron_FlightLength" ), std::string( "flight length of strange hadron" ), std::string( "length" ), 100., -0.05, 150.05 ); + m_StrangeHadron_status = initHist( std::string( "StrangeHadron_Status" ), std::string( "status of strange hadron" ), std::string("status" ), 151., -0.5, 150.5 ); + m_StrangeHadron_decay_multiplicity = initHist( std::string( "StrangeHadron_decay_multiplicity" ), std::string( "multiplicity of strange hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + m_StrangeHadron_decay_charged_multiplicity = initHist( std::string( "StrangeHadron_decay_charged_multiplicity" ), std::string( "charged multiplicity of strange hadron decay" ), std::string("N" ), 11., -0.5, 10.5 ); + + m_StrangeMeson_number = initHist( std::string( "NumStrangeMeson"), std::string( "number of strange meson"), std::string( "number"), 81, -0.5, 80.5); + m_StrangeBaryon_number = initHist( std::string( "NumStrangeBaryon"), std::string( "number of strange baryon"), std::string( "number"), 81, -0.5, 80.5); //tau plots - m_Tau_decay_multiplicity = initHist( string( "Tau_decay_multiplicity") , string("multiplicity of tau decay") , string("N" ), 11., -0.5, 10.5 ); - m_Tau_decay_charged_multiplicity = initHist( string( "Tau_charged_decay_multiplicity") , string("charged multiplicity of tau decay") , string("N" ), 11., -0.5, 10.5 ); - m_Tau_cos_theta = initHist( string( "Tau_cos_theta") , string("cos(#theta)") , string("cos(#theta)") , 80., -1.0, 1.0 ); - m_Tau_charged_energy_fraction = initHist( string( "Tau_charged_energy_fraction") , string("charged energy fraction") , string("E_{charged}/E") , 40., -1.0, 1.0 ); - m_Tau_flightlength = initHist( string( "Tau_FlightLength") , string( "flight length of tau") , string( "length" ), 100., -0.05, 150.05 ); - - m_uquark_mass = initHist( string( "uquark_mass" ), string( "mass of u-quark" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_dquark_mass = initHist( string( "dquark_mass" ), string( "mass of d-quark" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_cquark_mass = initHist( string( "cquark_mass" ), string( "mass of c-quark" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_squark_mass = initHist( string( "squark_mass" ), string( "mass of s-quark" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_tquark_mass = initHist( string( "tquark_mass" ), string( "mass of t-quark" ), string( "mass [GeV]" ), 201., 99.5, 200.5 ); - m_bquark_mass = initHist( string( "bquark_mass" ), string( "mass of b-quark" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_gluon_mass = initHist( string( "gluon_mass" ), string( "mass of gluon" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_photon_mass = initHist( string( "photon_mass" ), string( "mass of photon" ), string( "mass [GeV]" ), 101., -0.25, 50.25 ); - m_Zboson_mass = initHist( string( "Zboson_mass" ), string( "mass of Z boson" ), string( "mass [GeV]" ), 100., 50., 150 ); - m_Wboson_mass = initHist( string( "Wboson_mass" ), string( "mass of W boson" ), string( "mass [GeV]" ), 100., 50., 150 ); + m_Tau_decay_multiplicity = initHist( std::string( "Tau_decay_multiplicity") , std::string("multiplicity of tau decay") , std::string("N" ), 11., -0.5, 10.5 ); + m_Tau_decay_charged_multiplicity = initHist( std::string( "Tau_charged_decay_multiplicity") , std::string("charged multiplicity of tau decay") , std::string("N" ), 11., -0.5, 10.5 ); + m_Tau_cos_theta = initHist( std::string( "Tau_cos_theta") , std::string("cos(#theta)") , std::string("cos(#theta)") , 80., -1.0, 1.0 ); + m_Tau_charged_energy_fraction = initHist( std::string( "Tau_charged_energy_fraction") , std::string("charged energy fraction") , std::string("E_{charged}/E") , 40., -1.0, 1.0 ); + m_Tau_flightlength = initHist( std::string( "Tau_FlightLength") , std::string( "flight length of tau") , std::string( "length" ), 100., -0.05, 150.05 ); + + m_uquark_mass = initHist( std::string( "uquark_mass" ), std::string( "mass of u-quark" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_dquark_mass = initHist( std::string( "dquark_mass" ), std::string( "mass of d-quark" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_cquark_mass = initHist( std::string( "cquark_mass" ), std::string( "mass of c-quark" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_squark_mass = initHist( std::string( "squark_mass" ), std::string( "mass of s-quark" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_tquark_mass = initHist( std::string( "tquark_mass" ), std::string( "mass of t-quark" ), std::string( "mass [GeV]" ), 201., 99.5, 200.5 ); + m_bquark_mass = initHist( std::string( "bquark_mass" ), std::string( "mass of b-quark" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_gluon_mass = initHist( std::string( "gluon_mass" ), std::string( "mass of gluon" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_photon_mass = initHist( std::string( "photon_mass" ), std::string( "mass of photon" ), std::string( "mass [GeV]" ), 101., -0.25, 50.25 ); + m_Zboson_mass = initHist( std::string( "Zboson_mass" ), std::string( "mass of Z boson" ), std::string( "mass [GeV]" ), 100., 50., 150 ); + m_Wboson_mass = initHist( std::string( "Wboson_mass" ), std::string( "mass of W boson" ), std::string( "mass [GeV]" ), 100., 50., 150 ); m_evtnr -> Sumw2(); @@ -371,10 +375,10 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) HepMC::GenVertex* decay_vertex; - HepMC::GenParticle *tau = 0; - HepMC::GenParticle *charged_pion = 0; - HepMC::GenParticle *uncharged_pion = 0; - HepMC::GenParticle *tau_neutrino = 0; + HepMC::GenParticle* tau = nullptr; + HepMC::GenParticle* charged_pion = nullptr; + HepMC::GenParticle* uncharged_pion = nullptr; + HepMC::GenParticle* tau_neutrino = nullptr; //tight b-hadron cuts double tight_bottom_pt = 5; @@ -409,7 +413,7 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) m_particle_status -> Fill((*p) -> status(), weight); - if ((MC::isBottomHadron(*p)) && MC::isLastReplica(*p)) + if ((MC::isBottomHadron((*p)->pdg_id())) && MC::isLastReplica(*p)) { m_BottomHadron_pt -> Fill((*p) -> momentum().perp(), weight); m_BottomHadron_eta -> Fill((*p) -> momentum().eta(), weight); @@ -418,7 +422,7 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) m_BottomHadron_flightlength -> Fill(bflightlength, weight); m_BottomHadron_status -> Fill((*p) -> status(), weight); - if((*p) -> momentum().perp() > tight_bottom_pt && fabs((*p) -> momentum().eta())< tight_bottom_eta) isTightBottomHadron = true; + if((*p) -> momentum().perp() > tight_bottom_pt && std::abs((*p) -> momentum().eta())< tight_bottom_eta) isTightBottomHadron = true; if(isTightBottomHadron){ m_BottomHadron_tight_pt -> Fill((*p) -> momentum().perp(), weight); m_BottomHadron_tight_eta -> Fill((*p) -> momentum().eta(), weight); @@ -437,7 +441,7 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) current_daughter != decay_vertex -> particles_end(HepMC::children); ++current_daughter) { NBD++; - if (MC::isCharged(*current_daughter))NBCD++; + if (MC::isCharged((*current_daughter)->pdg_id()))NBCD++; } m_BottomHadron_decay_multiplicity -> Fill(NBD, weight); m_BottomHadron_decay_charged_multiplicity -> Fill(NBCD, weight); @@ -446,11 +450,11 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) } } - if ((MC::isBottomMeson(*p)) && MC::isLastReplica(*p)) NumBottomMeson++; - if ((MC::isBottomBaryon(*p)) && MC::isLastReplica(*p)) NumBottomBaryon++; + if ((MC::isBottomMeson((*p)->pdg_id())) && MC::isLastReplica(*p)) NumBottomMeson++; + if ((MC::isBottomBaryon((*p)->pdg_id())) && MC::isLastReplica(*p)) NumBottomBaryon++; - if ((MC::isCharmHadron(*p)) && MC::isLastReplica(*p)) + if ((MC::isCharmHadron((*p)->pdg_id())) && MC::isLastReplica(*p)) { m_CharmHadron_pt -> Fill((*p) -> momentum().perp(), weight); m_CharmHadron_eta -> Fill((*p) -> momentum().eta(), weight); @@ -467,20 +471,20 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) for (HepMC::GenVertex::particle_iterator current_daughter = decay_vertex -> particles_begin(HepMC::children); current_daughter != decay_vertex -> particles_end(HepMC::children); ++current_daughter) { NDD++; - if (MC::isCharged(*current_daughter))NDCD++; + if (MC::isCharged((*current_daughter)->pdg_id()))NDCD++; } m_CharmHadron_decay_multiplicity -> Fill(NDD, weight); m_CharmHadron_decay_charged_multiplicity -> Fill(NDCD, weight); } } - if ((MC::isCharmMeson(*p)) && MC::isLastReplica(*p)) NumCharmMeson++; - if ((MC::isCharmBaryon(*p)) && MC::isLastReplica(*p)) NumCharmBaryon++; + if ((MC::isCharmMeson((*p)->pdg_id())) && MC::isLastReplica(*p)) NumCharmMeson++; + if ((MC::isCharmBaryon((*p)->pdg_id())) && MC::isLastReplica(*p)) NumCharmBaryon++; - if ((MC::isStrangeHadron(*p)) && MC::isLastReplica(*p)) + if ((MC::isStrangeHadron((*p)->pdg_id())) && MC::isLastReplica(*p)) { - if (!(MC::isStable(*p))){ + if (!((*p)->status()==1)){ m_StrangeHadron_unstable_pt -> Fill((*p) -> momentum().perp(), weight); } m_StrangeHadron_pt -> Fill((*p) -> momentum().perp(), weight); @@ -499,7 +503,7 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) for (HepMC::GenVertex::particle_iterator current_daughter = decay_vertex -> particles_begin(HepMC::children); current_daughter != decay_vertex -> particles_end(HepMC::children); ++current_daughter) { NSD++; - if (MC::isCharged(*current_daughter))NSCD++; + if (MC::isCharged((*current_daughter)->pdg_id()))NSCD++; } m_StrangeHadron_decay_multiplicity -> Fill(NSD, weight); m_StrangeHadron_decay_charged_multiplicity -> Fill(NSCD, weight); @@ -507,11 +511,11 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) } - if ((MC::isStrangeMeson(*p)) && MC::isLastReplica(*p)) NumStrangeMeson++; - if ((MC::isStrangeBaryon(*p)) && MC::isLastReplica(*p)) NumStrangeBaryon++; + if ((MC::isStrangeMeson((*p)->pdg_id())) && MC::isLastReplica(*p)) NumStrangeMeson++; + if ((MC::isStrangeBaryon((*p)->pdg_id())) && MC::isLastReplica(*p)) NumStrangeBaryon++; - if ( abs((*p) -> pdg_id()) == 15 && MC::isLastReplica(*p) ) + if ( std::abs((*p) -> pdg_id()) == 15 && MC::isLastReplica(*p) ) { Int_t NTauDecay = 0; Int_t NTauChargedDecay = 0; @@ -525,12 +529,12 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) if (decay_vertex){ for (HepMC::GenVertex::particle_iterator current_daughter = decay_vertex -> particles_begin(HepMC::children); current_daughter != decay_vertex -> particles_end(HepMC::children); ++current_daughter) { - if (abs((*current_daughter) -> pdg_id()) == 16) tau_neutrino = (*current_daughter); - if (abs((*current_daughter) -> pdg_id()) == 211) charged_pion = (*current_daughter); - if (abs((*current_daughter) -> pdg_id()) == 111) uncharged_pion = (*current_daughter); + if (std::abs((*current_daughter) -> pdg_id()) == 16) tau_neutrino = (*current_daughter); + if (std::abs((*current_daughter) -> pdg_id()) == 211) charged_pion = (*current_daughter); + if (std::abs((*current_daughter) -> pdg_id()) == 111) uncharged_pion = (*current_daughter); NTauDecay++; - if (MC::isCharged(*current_daughter)) NTauChargedDecay++; + if (MC::isCharged((*current_daughter)->pdg_id())) NTauChargedDecay++; } m_Tau_decay_multiplicity -> Fill(NTauDecay, weight); @@ -548,16 +552,16 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) } } - if ( abs((*p) -> pdg_id()) == 2) m_uquark_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 1) m_dquark_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 4) m_cquark_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 3) m_squark_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 6) m_tquark_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 5) m_bquark_mass -> Fill((*p) -> momentum().m(), weight); - if ( (abs((*p) -> pdg_id()) == 21) || (abs((*p) -> pdg_id()) == 9) ) m_gluon_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 22) m_photon_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 23) m_Zboson_mass -> Fill((*p) -> momentum().m(), weight); - if ( abs((*p) -> pdg_id()) == 24) m_Wboson_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 2) m_uquark_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 1) m_dquark_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 4) m_cquark_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 3) m_squark_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 6) m_tquark_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 5) m_bquark_mass -> Fill((*p) -> momentum().m(), weight); + if ( (std::abs((*p) -> pdg_id()) == 21) || (std::abs((*p) -> pdg_id()) == 9) ) m_gluon_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 22) m_photon_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 23) m_Zboson_mass -> Fill((*p) -> momentum().m(), weight); + if ( std::abs((*p) -> pdg_id()) == 24) m_Wboson_mass -> Fill((*p) -> momentum().m(), weight); cmult++; @@ -577,12 +581,11 @@ int ParticleContentAnalysis::Process(HepMC::GenEvent* hepmcevt) } //end Process -inline double ParticleContentAnalysis::getCosTheta(const HepMC::GenParticle* charged_pion, const HepMC::GenParticle* tau){ +inline double ParticleContentAnalysis::getCosTheta(const HepMC::GenParticle* charged_pion, const HepMC::GenParticle* tau){ //make a copy of charged_pion //(maybe you need charge_pion later in your code again, therefore you do not want to boost it) - const HepMC::GenParticle* copy_of_charged_pion; - copy_of_charged_pion = charged_pion; + const HepMC::GenParticle* copy_of_charged_pion = charged_pion; CLHEP::HepLorentzVector charged_pion_vector(0,0,0,0); CLHEP::HepLorentzVector tau_vector(0,0,0,0); @@ -602,12 +605,12 @@ inline double ParticleContentAnalysis::getCosTheta(const HepMC::GenParticle* cha //calculate theta defined as above double cos_theta; - cos_theta = cos (charged_pion_vector.angle(tau_vector)); + cos_theta = std::cos (charged_pion_vector.angle(tau_vector)); return cos_theta; } -inline double ParticleContentAnalysis::getChargedEnergyFraction(const HepMC::GenParticle* charged_pion, const HepMC::GenParticle* uncharged_pion){ +inline double ParticleContentAnalysis::getChargedEnergyFraction(const HepMC::GenParticle* charged_pion, const HepMC::GenParticle* uncharged_pion){ //calculate charged energy fraction double charged_energy_fraction; diff --git a/Generators/HepMCAnalysis_i/src/PdfAnalysis.cxx b/Generators/HepMCAnalysis_i/src/PdfAnalysis.cxx index 1c9814872e9d8788d44db53b63d64dbe7f766a23..46e89237ef6a1fbd111e095bdbe943bda3d2c152 100644 --- a/Generators/HepMCAnalysis_i/src/PdfAnalysis.cxx +++ b/Generators/HepMCAnalysis_i/src/PdfAnalysis.cxx @@ -5,32 +5,13 @@ // ---------------------------------------------------------------------- #include <iostream> - -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/IO_GenEvent.h" -#include "AtlasHepMC/GenParticle.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/IO_AsciiParticles.h" -#include "AtlasHepMC/SimpleVector.h" -#include "AtlasHepMC/WeightContainer.h" -#include "CLHEP/Vector/LorentzVector.h" - - #include "TH1.h" #include "TMath.h" -#include "TLorentzVector.h" - -#include "fastjet/PseudoJet.hh" -#include "fastjet/ClusterSequence.hh" -#include "fastjet/JetDefinition.hh" -#include "fastjet/SISConePlugin.hh" - - -#include "TruthUtils/HepMCHelpers.h" - +#include "MCUtils/HepMCEventUtils.h" #include "../HepMCAnalysis_i/PdfAnalysis.h" - -using namespace std; +namespace MC { +using MCUtils::get_weight; +} // ---------------------------------------------------------------------- PdfAnalysis::PdfAnalysis() @@ -130,8 +111,7 @@ int PdfAnalysis::Process(HepMC::GenEvent *event) double weight; weight = MC::get_weight(event, 0 ); - HepMC::PdfInfo* pdf = 0; - pdf = event->pdf_info(); + auto pdf = event->pdf_info(); if(pdf != 0){ m_Qscale -> Fill(pdf -> scalePDF(), weight); diff --git a/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx b/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..63f688bb1284d8e25be5f122e3bd32bc831e04ff --- /dev/null +++ b/Generators/HepMCAnalysis_i/src/PrepareHepMCAnalysisGenEvent.cxx @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + * Author: Andrii Verbytsky andrii.verbytskyi@mpp.mpg.de + * + * This file implements helper functions that prepare the ATLAS MC events + * to be used with the HepMCAnalysis package. + */ +#include <vector> +#include "HepMC/GenEvent.h" +//This tricky convention is needed for usage with HepMC3. +using HepMCAnalysisGenEvent=HepMC::GenEvent; +HepMC::GenEvent* PrepareHepMCAnalysisGenEvent(const HepMC::GenEvent* cevent) +{ +//Note: the deep copy solves the issue described in the previous version. +HepMC::GenEvent* event = new HepMC::GenEvent(*cevent); + for (auto p = event->particles_begin(); p != event->particles_end(); ++p) { + auto fv=(*p)->momentum(); + fv.set(fv.x()*0.001,fv.y()*0.001,fv.z()*0.001,fv.e()*0.001); + (*p)->set_momentum(fv); + } + return event; +} diff --git a/Generators/HepMCAnalysis_i/src/UserAnalysis.cxx b/Generators/HepMCAnalysis_i/src/UserAnalysis.cxx index 64c4867b2c31a756b665d44d5dd661889455d7c7..51f2714a2d9d66945751e1f4899a991c8025ddcf 100644 --- a/Generators/HepMCAnalysis_i/src/UserAnalysis.cxx +++ b/Generators/HepMCAnalysis_i/src/UserAnalysis.cxx @@ -6,17 +6,8 @@ #include <iostream> -#include "AtlasHepMC/GenEvent.h" -#include "AtlasHepMC/IO_GenEvent.h" -#include "AtlasHepMC/GenParticle.h" -#include "AtlasHepMC/GenVertex.h" -#include "AtlasHepMC/IO_AsciiParticles.h" -#include "AtlasHepMC/SimpleVector.h" -#include "CLHEP/Vector/LorentzVector.h" - #include "TH1.h" #include "TMath.h" -#include "TLorentzVector.h" #include "fastjet/PseudoJet.hh" #include "fastjet/ClusterSequence.hh" @@ -25,7 +16,6 @@ #include "../HepMCAnalysis_i/UserAnalysis.h" -using namespace std; // ---------------------------------------------------------------------- UserAnalysis::UserAnalysis(): @@ -55,7 +45,7 @@ int UserAnalysis::Init(double maxEta, double minPt) int UserAnalysis::Process(HepMC::GenEvent *event) { if (event->event_number() % 1000 == 0) { - cout << "Processing event " << event->event_number() << endl; + std::cout << "Processing event " << event->event_number() << std::endl; } m_h_njets->Fill(m_inclusive_jets.size()); diff --git a/Generators/Herwig7_i/CMakeLists.txt b/Generators/Herwig7_i/CMakeLists.txt index cbd368f2a24d763e115a62cca72336b0f58698e3..cdbf914787dc6883a8b43b8049f6f9dabaeb3130 100644 --- a/Generators/Herwig7_i/CMakeLists.txt +++ b/Generators/Herwig7_i/CMakeLists.txt @@ -35,7 +35,7 @@ atlas_add_component( Herwig7_i -DHWVER_IS_72=\"${HW3_VER_IS_72}\" LINK_LIBRARIES ${HERWIG3_LIBRARIES} ${Boost_LIBRARIES} ${THEPEG_LIBRARIES} ${GSL_LIBRARIES} ${VBFNLO_LIBRARIES} - GeneratorModulesLib EventInfo GaudiKernel PathResolver ) + GeneratorModulesLib EventInfo GaudiKernel PathResolver AtlasHepMCLib ) # ${OPENLOOPS_INCLUDE_DIRS} ${OPENLOOPS_LIBRARIES} # Install files from the package: diff --git a/Generators/Herwig7_i/src/Herwig7.cxx b/Generators/Herwig7_i/src/Herwig7.cxx index cb789cef390a6a69e816a2ca90a68b8f293f2b5a..f1a9e256653080163b0b35d69226b10cf709dcdd 100644 --- a/Generators/Herwig7_i/src/Herwig7.cxx +++ b/Generators/Herwig7_i/src/Herwig7.cxx @@ -186,7 +186,7 @@ StatusCode Herwig7::fillEvt(HepMC::GenEvent* evt) { const long* s = atRndmGenSvc().GetEngine("Herwig7")->getSeeds(); std::vector<long> seeds(s, s+2); ATH_MSG_DEBUG("Random seeds: " << seeds[0] << ", " << seeds[1]); - evt->set_random_states(seeds); + HepMC::set_random_states(evt,seeds); // Add a unit entry to the event weight vector if it's currently empty if (evt->weights().empty()) { diff --git a/Generators/HforTool/src/HforTool.cxx b/Generators/HforTool/src/HforTool.cxx index 37f241de57a810a738cc7b93b2c92c7406df80d3..b5fab1f73d85f5c7750b2551f60bfd07b619259e 100644 --- a/Generators/HforTool/src/HforTool.cxx +++ b/Generators/HforTool/src/HforTool.cxx @@ -263,7 +263,7 @@ void HforTool::findHFQuarks() { return ; } // find out which generator was used for this event, - int g_id(evt->signal_process_id()) ; + int g_id(HepMC::signal_process_id(evt)) ; const std::string gen1 = generator_string(first_generator(g_id)); const std::string gen2 = generator_string(second_generator(g_id)); const std::string gen3 = generator_string(third_generator(g_id)); @@ -294,11 +294,11 @@ void HforTool::findHFQuarks() { int pdg = (*pitr)->pdg_id(); int apdg = std::abs(pdg) ; if (apdg == 5 || apdg == 4) { // b or c quark - const HepMC::GenParticle * bcpart = (*pitr) ; + const HepMC::GenParticlePtr bcpart = (*pitr) ; ATH_MSG_DEBUG("pdg = " << pdg << ": " << *bcpart); // find the production vertex and parents - HepMC::GenVertex * prodvtx = bcpart->production_vertex() ; + HepMC::GenVertexPtr prodvtx = bcpart->production_vertex() ; bool hasbchadronparent(false) ; bool hasmpiparent(false) ; bool hastopparent(false) ; @@ -694,7 +694,7 @@ void HforTool::findHFQuarksPythia // prod vtx of stat=3 PDF parton, and opposite pdgid // first check that showered ME/PDF parton has prod. vtx -3 or -4 - HepMC::GenVertex * pvtx34(prodvtx) ; + HepMC::GenVertexPtr pvtx34(prodvtx) ; bool bc34(pvtx34->barcode()==-3 || pvtx34->barcode()==-4) ; if ( !bc34 ) { // ATH_MSG_DEBUG("Production vtx with barcode not -3 or -4") ; @@ -828,7 +828,7 @@ void HforTool::findHFQuarksUnknown ATH_MSG_DEBUG("final state b/c " << *bcpart); // still filter out the b/c partons directly from a b/c/bhadron // or from top or W decay - HepMC::GenVertex * prodvtx(bcpart->production_vertex()) ; + HepMC::GenVertexPtr prodvtx(bcpart->production_vertex()) ; bool isTopDecay(false) ; bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays bool iscquarkfromb(false) ; diff --git a/Generators/Hijing_i/src/Hijing.cxx b/Generators/Hijing_i/src/Hijing.cxx index da0a12944aa32da4a607fc8af17d11891bdd65de..cfa22100cc07f30429ad29c69fb91923530109ea 100644 --- a/Generators/Hijing_i/src/Hijing.cxx +++ b/Generators/Hijing_i/src/Hijing.cxx @@ -29,6 +29,7 @@ #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenVertex.h" #include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/HeavyIon.h" #include <stdlib.h> @@ -260,10 +261,10 @@ Hijing::fillEvt(HepMC::GenEvent* evt) evt->set_event_number( m_events ); // Set the random generator seeds - evt->set_random_states(m_seeds); + HepMC::set_random_states(evt,m_seeds); // Set the generator id - evt->set_signal_process_id(HIJING + m_iap); + HepMC::set_signal_process_id(evt,HIJING + m_iap); // Store collision parameters int np = m_himain1.np(); @@ -310,7 +311,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) // std::vector<int> partOriginVertex_vec; std::vector<int> partDecayVertex_vec; - std::vector<HepMC::GenParticle*> particleHepPartPtr_vec; + std::vector<HepMC::GenParticlePtr> particleHepPartPtr_vec; partOriginVertex_vec.assign(numHijingPart, 0); partDecayVertex_vec.assign(numHijingPart, -1); @@ -318,7 +319,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) // Vector that will keep pointers to generated vertices // - std::vector<HepMC::GenVertex*> vertexPtrVec; + std::vector<HepMC::GenVertexPtr> vertexPtrVec; // Create the event vertex // @@ -328,9 +329,9 @@ Hijing::fillEvt(HepMC::GenEvent* evt) if( m_rand )newVertex = randomizeVertex(); // Create a random vertex along the pipe else if(m_sel) newVertex = CLHEP::HepLorentzVector(m_x, m_y, m_z, 0.); // Create vertex at selected point - preempted by m_rand - HepMC::GenVertex* v1 = new HepMC::GenVertex(HepMC::FourVector(newVertex.x(),newVertex.y(),newVertex.z(),newVertex.t())); + HepMC::GenVertexPtr v1 = HepMC::newGenVertexPtr(HepMC::FourVector(newVertex.x(),newVertex.y(),newVertex.z(),newVertex.t())); - evt->set_signal_process_vertex(v1); + HepMC::set_signal_process_vertex(evt,v1); vertexPtrVec.push_back(v1); double eproj = (double) m_efrm; @@ -350,7 +351,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) } else if ( m_proj == "A " ) { proj_id = 3000000 + m_iap; } - HepMC::GenParticle* part_p = new HepMC::GenParticle( HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 ); + HepMC::GenParticlePtr part_p = HepMC::newGenParticlePtr(HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 ); v1->add_particle_in( part_p ); double etarg = 0.; @@ -370,7 +371,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) } else if ( m_targ == "A " ) { targ_id = 3000000 + m_iat; } - HepMC::GenParticle* part_t = new HepMC::GenParticle( HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 ); + HepMC::GenParticlePtr part_t = HepMC::newGenParticlePtr(HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 ); v1->add_particle_in( part_t ); evt->set_beam_particles(part_p,part_t); @@ -475,12 +476,13 @@ Hijing::fillEvt(HepMC::GenEvent* evt) << ", " << vertexPtrVec[parentDecayIndex]->position().z() << ", associated daughter IDs = "; - HepMC::GenVertex::particles_out_const_iterator iter; - for (iter = vertexPtrVec[parentDecayIndex]->particles_out_const_begin(); - iter != vertexPtrVec[parentDecayIndex]->particles_out_const_end(); + auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out_const_begin(); + auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out_const_end(); + for (auto iter = vertexPtrVec_particles_out_const_begin; + iter != vertexPtrVec_particles_out_const_end; iter++) { - log << (*iter)->barcode() << ", "; + log << HepMC::barcode((*iter)) << ", "; } log << endmsg; @@ -531,7 +533,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) { // We need to create a new vertex // - HepMC::GenVertexPtr newVertex_p = new HepMC::GenVertex(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t())); + HepMC::GenVertexPtr newVertex_p = HepMC::newGenVertexPtr(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t())); evt->add_vertex(newVertex_p); vertexPtrVec.push_back(newVertex_p); particleVertexIndex = vertexPtrVec.size() - 1; @@ -574,7 +576,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) { // We need to create a new vertex // - HepMC::GenVertex* newVertex_p = new HepMC::GenVertex(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t())); + HepMC::GenVertexPtr newVertex_p = HepMC::newGenVertexPtr(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t())); evt->add_vertex(newVertex_p); vertexPtrVec.push_back(newVertex_p); @@ -600,7 +602,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) m_himain2.patt(i, 3), m_himain2.patt(i, 4)); - HepMC::GenParticle* newParticle_p = new HepMC::GenParticle(particleP4, particleId, + HepMC::GenParticlePtr newParticle_p = HepMC::newGenParticlePtr(particleP4, particleId, particleStatus); // Record the particle in the vector of pointers @@ -678,7 +680,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary) // - v1->add_particle_out( new HepMC::GenParticle( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); + v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); } } } @@ -715,7 +717,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary) // - v1->add_particle_out( new HepMC::GenParticle( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); + v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); } } } @@ -749,7 +751,7 @@ Hijing::fillEvt(HepMC::GenEvent* evt) // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary) // - v1->add_particle_out( new HepMC::GenParticle( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); + v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) ); } } } diff --git a/Generators/Hydjet_i/src/Hydjet_i.cxx b/Generators/Hydjet_i/src/Hydjet_i.cxx index bcdd5121793c3a50586cc58bc984b6ee7edb7e36..7ed5ccca799517bf9ea72837a13bca1f7314fa59 100644 --- a/Generators/Hydjet_i/src/Hydjet_i.cxx +++ b/Generators/Hydjet_i/src/Hydjet_i.cxx @@ -245,31 +245,31 @@ Hydjet::fillEvt(HepMC::GenEvent* evt) // evt->set_random_states(m_seeds); // Set the generator id - evt->set_signal_process_id(HYDJET + int(m_a)); + HepMC::set_signal_process_id(evt,HYDJET + int(m_a)); // Create the event vertex - HepMC::GenVertex* v1 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v1 = HepMC::newGenVertexPtr(); evt->add_vertex( v1 ); double eproj = m_e/2.0; int proj_id = (int) m_a; - v1->add_particle_in( new HepMC::GenParticle( HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 ) ); + v1->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 ) ); double etarg = m_e/2.0; int targ_id = (int) m_a; - v1->add_particle_in( new HepMC::GenParticle( HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 ) ); + v1->add_particle_in( HepMC::newGenParticlePtr( HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 ) ); // Loop on all final particles and // put them all as outgoing from the event vertex for (int i = 1; i <= m_lujets.n(); ++i) { - v1->add_particle_out( new HepMC::GenParticle( + v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(m_lujets.p(i, 1), m_lujets.p(i, 2), m_lujets.p(i, 3), m_lujets.p(i, 4)), m_lujets.k(i, 2), 1 ) ); } // Set the generator id - evt->set_signal_process_id(HYDJET + int(m_a)); + HepMC::set_signal_process_id(evt,HYDJET + int(m_a)); // Convert cm->mm and GeV->MeV // diff --git a/Generators/ParticleDecayer/ParticleDecayer/ParticleDecayer.h b/Generators/ParticleDecayer/ParticleDecayer/ParticleDecayer.h index 631cfb5c7a8c07b9dbcf60647d989176b5684344..9704ba65c9ea1c173fc94f8c4dd971e70424825f 100644 --- a/Generators/ParticleDecayer/ParticleDecayer/ParticleDecayer.h +++ b/Generators/ParticleDecayer/ParticleDecayer/ParticleDecayer.h @@ -8,6 +8,8 @@ #include "GeneratorModules/GenModule.h" #include "CLHEP/Vector/LorentzVector.h" #include "AtlasHepMC/IO_BaseClass.h" +#include "AtlasHepMC/Polarization.h" +#include "AtlasHepMC/Flow.h" #include "HepPDT/ParticleDataTable.hh" @@ -75,15 +77,15 @@ class ParticleDecayer: public GenModule { HepPDT::ParticleDataTable* m_particleTable; double getParticleMass(int pdgID); //retrieve tha particle mass given the PDG ID - void addParticle (HepMC::GenVertex*, int pdg, HepMC::FourVector, int statusCode); //add particles to the evgen file + void addParticle (HepMC::GenVertexPtr, int pdg, HepMC::FourVector, int statusCode); //add particles to the evgen file double rnd_ExpLifetime(double ct); double rnd_DoubleRange(double a, double b); double cosgen(int itype); - StatusCode DFTwoBodyDecay( HepMC::GenParticle*, int ); - StatusCode setDecayPosition ( HepMC::GenParticle*, HepMC::GenEvent*, bool doScalarDecay=false ); - StatusCode changeMass( HepMC::GenParticle*, double ); + StatusCode DFTwoBodyDecay( HepMC::GenParticlePtr, int ); + StatusCode setDecayPosition ( HepMC::GenParticlePtr, HepMC::GenEvent*, bool doScalarDecay=false ); + StatusCode changeMass( HepMC::GenParticlePtr, double ); StatusCode getDecayProducts( CLHEP::HepLorentzVector, double, std::vector<CLHEP::HepLorentzVector>&, int decayType = 0); //four momentum of the dark photon diff --git a/Generators/ParticleDecayer/src/ParticleDecayer.cxx b/Generators/ParticleDecayer/src/ParticleDecayer.cxx index 004ae481a75b145bf1e1f1e6a589b57ad120588d..a563ae9b18ab5fb50a36b07315996d7420dbd8fb 100644 --- a/Generators/ParticleDecayer/src/ParticleDecayer.cxx +++ b/Generators/ParticleDecayer/src/ParticleDecayer.cxx @@ -95,7 +95,7 @@ double ParticleDecayer::cosgen(int itype){ } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -StatusCode ParticleDecayer::changeMass( HepMC::GenParticle* genpart, double newMass ) +StatusCode ParticleDecayer::changeMass( HepMC::GenParticlePtr genpart, double newMass ) { double e = genpart->momentum().e(); double theta = genpart->momentum().theta(); @@ -119,16 +119,16 @@ StatusCode ParticleDecayer::changeMass( HepMC::GenParticle* genpart, double newM } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -StatusCode ParticleDecayer::setDecayPosition( HepMC::GenParticle* genpart, HepMC::GenEvent* event, bool doScalarDecay ) +StatusCode ParticleDecayer::setDecayPosition( HepMC::GenParticlePtr genpart, HepMC::GenEvent* event, bool doScalarDecay ) { - HepMC::GenVertex* vtxp = genpart->production_vertex(); + HepMC::GenVertexPtr vtxp = genpart->production_vertex(); if(!vtxp) { ATH_MSG_FATAL("ParticleDecayer::fillEvt: -- no production vertex position found!"); return StatusCode::FAILURE; } if ( doScalarDecay ) // scalar decay is prompt. decay vtx == scalar production vertex { - HepMC::GenVertex* end_vtx = new HepMC::GenVertex(); + HepMC::GenVertexPtr end_vtx = HepMC::newGenVertexPtr(); end_vtx->set_position(vtxp->position()); end_vtx->add_particle_in(genpart); event->add_vertex(end_vtx); @@ -216,7 +216,7 @@ StatusCode ParticleDecayer::setDecayPosition( HepMC::GenParticle* genpart, HepMC //set the decay vertex position of the particle //Create a HepMC vertex at the decay position of the particle ATH_MSG_DEBUG("ParticleDecayer::fillEvt: -- set the decay vertex"); - HepMC::GenVertex* end_vtx = new HepMC::GenVertex(); + HepMC::GenVertexPtr end_vtx = HepMC::newGenVertexPtr(); end_vtx->set_position(HepMC::FourVector(posLV.x(),posLV.y(),posLV.z(),posLV.t())); end_vtx->add_particle_in(genpart); event->add_vertex(end_vtx); @@ -331,7 +331,7 @@ StatusCode ParticleDecayer::fillEvt(HepMC::GenEvent* event) { ATH_MSG_DEBUG("ParticleDecayer::fillEvt: -- assign the new mass of the dark photon, m = " << m_particleMass); //Update the geantino/parent-particle - HepMC::GenParticle* genpart = (*ip); + HepMC::GenParticlePtr genpart = (*ip); //Change the mass of the parent particle ( set by user input + command ) //Changes the magnitude of the spatial part of the 4-momentum such that the new 4-momentum has the desired inv mass CHECK( changeMass( genpart, m_particleMass ) ); @@ -365,7 +365,7 @@ StatusCode ParticleDecayer::fillEvt(HepMC::GenEvent* event) { ATH_MSG_DEBUG("ParticleDecayer::fillEvt: -- assign the new mass of the dark scalar, m = " << m_scalarMass); ////Update the geantino/parent-particle - HepMC::GenParticle* genpart = (*ip); + HepMC::GenParticlePtr genpart = (*ip); //Get the mass of the parent particle ( set by user input + command ) //Change the mass of the parent particle ( set by user input + command ) @@ -401,7 +401,7 @@ StatusCode ParticleDecayer::fillEvt(HepMC::GenEvent* event) { addParticle( genpart->end_vertex(), m_particlePDGID, HepMC::FourVector(v1.x(),v1.y(),v1.z(),0.0), 2); //lifetime handling of the dark photons - std::vector<HepMC::GenVertex*> dp_end_vertices; + std::vector<HepMC::GenVertexPtr> dp_end_vertices; int polarizationSwitch = 1; HepMC::GenVertex::particles_out_const_iterator pIt = genpart->end_vertex()->particles_out_const_begin(); HepMC::GenVertex::particles_out_const_iterator pItEnd = genpart->end_vertex()->particles_out_const_end(); @@ -443,7 +443,7 @@ StatusCode ParticleDecayer::fillEvt(HepMC::GenEvent* event) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void ParticleDecayer::addParticle(HepMC::GenVertex* prod_vtx, int pdg, HepMC::FourVector momentum, int statusCode) { +void ParticleDecayer::addParticle(HepMC::GenVertexPtr prod_vtx, int pdg, HepMC::FourVector momentum, int statusCode) { double mass = 0.; if( pdg == m_particlePDGID) @@ -454,7 +454,7 @@ void ParticleDecayer::addParticle(HepMC::GenVertex* prod_vtx, int pdg, HepMC::Fo mass = getParticleMass(pdg); } double energy=std::sqrt(std::pow(momentum.x(),2)+std::pow(momentum.y(),2)+std::pow(momentum.z(),2)+mass*mass); - HepMC::GenParticle* aParticle = new HepMC::GenParticle(HepMC::FourVector(momentum.x(), momentum.y(), momentum.z(), energy), + HepMC::GenParticlePtr aParticle = new HepMC::GenParticle(HepMC::FourVector(momentum.x(), momentum.y(), momentum.z(), energy), pdg, statusCode, HepMC::Flow(), HepMC::Polarization(0, 0)); prod_vtx->add_particle_out(aParticle); @@ -474,7 +474,7 @@ double ParticleDecayer::getParticleMass(int pid) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -StatusCode ParticleDecayer::DFTwoBodyDecay( HepMC::GenParticle* genpart, int Polarization ) { +StatusCode ParticleDecayer::DFTwoBodyDecay( HepMC::GenParticlePtr genpart, int Polarization ) { ATH_MSG_DEBUG("ParticleDecayer::fillEvt: -- allow the two-body decay of the dark photon..."); diff --git a/Generators/Pythia8B_i/src/CheckCloningFactor.cxx b/Generators/Pythia8B_i/src/CheckCloningFactor.cxx index a6bbe4fb50ee00ea781111644241d41f7349b60b..0ab2949743818ae217770716b6c2957adea54ce6 100644 --- a/Generators/Pythia8B_i/src/CheckCloningFactor.cxx +++ b/Generators/Pythia8B_i/src/CheckCloningFactor.cxx @@ -41,7 +41,7 @@ StatusCode CheckCloningFactor::execute() { // Loop over all events in McEventCollection McEventCollection::const_iterator itr; - std::vector<const HepMC::GenParticle*> bQuarks; + std::vector<HepMC::GenParticlePtr> bQuarks; for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) { // Loop over all particles in the event and find the b-quarks const HepMC::GenEvent* genEvt = (*itr); @@ -55,7 +55,7 @@ StatusCode CheckCloningFactor::execute() { } // Loop over the b-quarks and find the one with higest pt - std::vector<const HepMC::GenParticle*>::iterator bItr; + std::vector<HepMC::GenParticlePtr>::iterator bItr; double lastPt(-1.0); int index(0), highestIndex(-1); for (bItr = bQuarks.begin(); bItr!=bQuarks.end(); ++bItr, ++index) { @@ -65,7 +65,7 @@ StatusCode CheckCloningFactor::execute() { lastPt = et; } } - const HepMC::GenParticle* recordedBQuark = bQuarks[highestIndex]; + const HepMC::GenParticlePtr recordedBQuark = bQuarks[highestIndex]; double b_pt = recordedBQuark->momentum().perp(); double b_rapid = recordedBQuark->momentum().pseudoRapidity(); double b_phi = recordedBQuark->momentum().phi(); diff --git a/Generators/QGSJet_i/src/QGSJet.cxx b/Generators/QGSJet_i/src/QGSJet.cxx index 34786c4bde28a6c342f7181e1864d0c84d668aff..4b2940d1cd874516999cebb846fc403022b0e4fa 100644 --- a/Generators/QGSJet_i/src/QGSJet.cxx +++ b/Generators/QGSJet_i/src/QGSJet.cxx @@ -305,12 +305,12 @@ StatusCode QGSJet::fillEvt( HepMC::GenEvent* evt ) hepio.set_trust_mothers_before_daughters(0); hepio.set_print_inconsistency_errors(0); hepio.fill_next_event(evt); - evt->set_random_states( m_seeds ); + HepMC::set_random_states(evt, m_seeds ); evt->weights().push_back(1.0); GeVToMeV(evt); - std::vector<HepMC::GenParticle*> beams; + std::vector<HepMC::GenParticlePtr> beams; for (HepMC::GenEvent::particle_const_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) { if ((*p)->status() == 4) { @@ -320,8 +320,6 @@ StatusCode QGSJet::fillEvt( HepMC::GenEvent* evt ) evt->set_beam_particles(beams[0], beams[1]); - //an integer ID uniquely specifying the signal process (i.e. MSUB in Pythia) - // std::cout<<"obecny sig_proc_id " << evt->signal_process_id() << std::endl; int sig_id = -1; switch (int(c2evt_.typevt)) { @@ -336,7 +334,7 @@ StatusCode QGSJet::fillEvt( HepMC::GenEvent* evt ) default: ATH_MSG_INFO( "Signal ID not recognised for setting HEPEVT \n"); } - evt->set_signal_process_id(sig_id); + HepMC::set_signal_process_id(evt,sig_id); return StatusCode::SUCCESS; diff --git a/Generators/Rivet_i/src/Rivet_i.cxx b/Generators/Rivet_i/src/Rivet_i.cxx index 6ed1c192a44be24a55d73875ae203a98547be361..515e1fd366bba95ce9ded7327cff950e44c16980 100644 --- a/Generators/Rivet_i/src/Rivet_i.cxx +++ b/Generators/Rivet_i/src/Rivet_i.cxx @@ -24,10 +24,7 @@ #include "Rivet/Analysis.hh" #include "Rivet/Tools/RivetYODA.hh" -//#include "TH1D.h" -//#include "TGraphAsymmErrors.h" -//#include "YODA/ROOTCnv.h" #include <cstdlib> #include <memory> @@ -40,7 +37,6 @@ using namespace std; Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - //m_histSvc("THistSvc", name), m_analysisHandler(0), m_init(false) { @@ -58,8 +54,6 @@ Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) : declareProperty("DoRootHistos", m_doRootHistos=false); declareProperty("SkipWeights", m_skipweights=false); declareProperty("WeightCap", m_weightcap=-1.0); - // Service handles - //declareProperty("THistSvc", m_histSvc); } string getenv_str(const string& key) { @@ -72,11 +66,6 @@ StatusCode Rivet_i::initialize() { ATH_MSG_DEBUG("Rivet_i initializing"); ATH_MSG_INFO("Using Rivet version " << Rivet::version()); - // Get histo service - //if (m_doRootHistos && m_histSvc.retrieve().isFailure()) { - // ATH_MSG_FATAL("Failed to retrieve service " << m_histSvc); - // return StatusCode::FAILURE; - //} // Set RIVET_ANALYSIS_PATH based on alg setup @@ -224,49 +213,7 @@ StatusCode Rivet_i::finalize() { // Call Rivet finalize m_analysisHandler->finalize(); - // Convert YODA-->ROOT - /*if (m_doRootHistos) { - for (const Rivet::AnalysisObjectPtr ao : m_analysisHandler->getData()) { - // Normalize path name to be usable by ROOT - string path = string(ao->path()); - std::replace(path.begin(), path.end(), '-', '_'); - const string basename = ao->path().substr(ao->path().rfind("/")+1); // There should always be >= 1 slash - - // Convert YODA histos to heap-allocated ROOT objects and register - /// @todo Convert Counter... as what? - if (ao->type() == "Histo1D") { - TH1* h = (TH1*) YODA::toTH1D(*dynamic_pointer_cast<YODA::Histo1D>(ao)).Clone(basename.c_str()); - CHECK(m_histSvc->regHist(m_stream + path, h)); - ATH_MSG_INFO("TH1D " + path + " created from YODA::Histo1D"); - } else if (ao->type() == "Histo2D") { - TH2* h = (TH2*) YODA::toTH2D(*dynamic_pointer_cast<YODA::Histo2D>(ao)).Clone(basename.c_str()); - CHECK(m_histSvc->regHist(m_stream + path, h)); - ATH_MSG_INFO("TH2 " + path + " created from YODA::Histo2D"); - // } else if (ao->type() == "Profile2D") { - // TProfile2D* h = (TProfile2D*) YODA::toTProfile2D(*boost::dynamic_pointer_cast<YODA::Profile2D>(ao)).Clone(basename.c_str()); - // CHECK(m_histSvc->regHist(m_stream + path, h)); - // ATH_MSG_INFO("TProfile2D " + path + " created from YODA::Profile2D"); - } else if (ao->type() == "Profile1D") { - TH1* h = (TH1*) YODA::toTProfile(*dynamic_pointer_cast<YODA::Profile1D>(ao)).Clone(basename.c_str()); - CHECK(m_histSvc->regHist(m_stream + path, h)); - ATH_MSG_INFO("TProfile " + path + " created from YODA::Profile1D"); - // } else if (ao->type() == "Scatter1D") { - // TGraph* g = (TGraph*) YODA::toTGraph(*boost::dynamic_pointer_cast<YODA::Scatter1D>(ao)).Clone(basename.c_str()); - // CHECK(m_histSvc->regGraph(m_stream + path, g)); - // ATH_MSG_INFO("TGraph " + path + " created from YODA::Scatter2D"); - } else if (ao->type() == "Scatter2D") { - TGraph* g = (TGraph*) YODA::toTGraph(*dynamic_pointer_cast<YODA::Scatter2D>(ao)).Clone(basename.c_str()); - CHECK(m_histSvc->regGraph(m_stream + path, g)); - ATH_MSG_INFO("TGraph " + path + " created from YODA::Scatter2D"); - // } else if (ao->type() == "Scatter3D") { - // TGraph* g = (TGraph*) YODA::toTGraph(*boost::dynamic_pointer_cast<YODA::Scatter3D>(ao)).Clone(basename.c_str()); - // CHECK(m_histSvc->regGraph(m_stream + path, g)); - // ATH_MSG_INFO("TGraph " + path + " created from YODA::Scatter2D"); - } else { - ATH_MSG_WARNING("Couldn't convert YODA histo " + path + " to ROOT: unsupported data type " + ao->type()); - } - } - }*/ + // Write out YODA file (add .yoda suffix if missing) if (m_file.find(".yoda") == string::npos) m_file += ".yoda"; diff --git a/Generators/Starlight_i/src/Starlight_i.cxx b/Generators/Starlight_i/src/Starlight_i.cxx index 1db607d04d1b72154c4286a6d435f19ca0052aa2..4c6d9b924851015a55fee00ef1d08b3303299a6f 100644 --- a/Generators/Starlight_i/src/Starlight_i.cxx +++ b/Generators/Starlight_i/src/Starlight_i.cxx @@ -181,10 +181,10 @@ Starlight_i::fillEvt(HepMC::GenEvent* evt) evt->set_event_number( m_events ); // Set the generator id - evt->set_signal_process_id(0); + HepMC::set_signal_process_id(evt,0); // Create the event vertex - HepMC::GenVertex* v1 = new HepMC::GenVertex(); + HepMC::GenVertexPtr v1 = HepMC::newGenVertexPtr(); evt->add_vertex( v1 ); // Loop on all final particles and @@ -214,7 +214,7 @@ Starlight_i::fillEvt(HepMC::GenEvent* evt) ATH_MSG_DEBUG( "saving particle " << ipart ); v1->add_particle_out( - new HepMC::GenParticle(HepMC::FourVector(px, py, pz, e), pid, 1) ); + HepMC::newGenParticlePtr(HepMC::FourVector(px, py, pz, e), pid, 1) ); } ATH_MSG_DEBUG( "Saved " << ipart << " tracks " ); diff --git a/Generators/TruthIO/CMakeLists.txt b/Generators/TruthIO/CMakeLists.txt index 401a857bb29a813e356bdc46cf30fe9eabe9bffd..bd91ec10b475e6d27a587cd53c87d17ba905e0cc 100644 --- a/Generators/TruthIO/CMakeLists.txt +++ b/Generators/TruthIO/CMakeLists.txt @@ -22,7 +22,6 @@ find_package( HepPDT ) # Component(s) in the package: atlas_add_component( TruthIO src/*.cxx - src/*.F src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib AthenaBaseComps GaudiKernel GeneratorModulesLib StoreGateLib SGtests EventInfo GeneratorObjects ) diff --git a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h index 87992b5d260b8173d2b6c29c80314c8d11d01e08..689a2a56df3912f43d1187be390dc2c7d9238fb5 100644 --- a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h +++ b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h @@ -21,5 +21,8 @@ private: // Setable Properties:- std::string m_key; std::string m_input_file; + std::ifstream m_file; + bool read_hepevt_particle( int i); + bool read_hepevt_event_header(); }; diff --git a/Generators/TruthIO/src/HepEvt.cxx b/Generators/TruthIO/src/HepEvt.cxx new file mode 100644 index 0000000000000000000000000000000000000000..726b2fd747cbcad1546c812569c83d3dc7fec003 --- /dev/null +++ b/Generators/TruthIO/src/HepEvt.cxx @@ -0,0 +1,13 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +extern "C" { +const unsigned int hepevt_bytes_allocation_ATLAS = + sizeof(long int) * ( 2 + 6 * 10000 ) + + sizeof(double) * ( 9 * 10000 ); +struct { + char data[hepevt_bytes_allocation_ATLAS]; + } hepevt_; +} \ No newline at end of file diff --git a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx index 06831e5d4a22c5c1d296edea493defe0feb9fa65..795d640bce94d4e01aa5449d6758e8e56ef9fa3e 100644 --- a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx +++ b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx @@ -14,13 +14,63 @@ #include "StoreGate/StoreGateSvc.h" -extern "C" { - void openfile_(int & ifile, const char* filename, int); - void readevt_(int& ifile); - void closefile_(int& ifile); -} +bool ReadHepEvtFromAscii::read_hepevt_event_header() +{ + const size_t max_e_buffer_size=512; + char buf_e[max_e_buffer_size]; + bool eventline=false; + int im=0, pm=0; + while(!eventline) + { + m_file.getline(buf_e,max_e_buffer_size); + if( strlen(buf_e) == 0 ) return false; + std::stringstream st_e(buf_e); + char attr=' '; + eventline=false; + while (!eventline) + { + if (!(st_e>>attr)) break; + if (attr==' ') continue; + else eventline=false; + if (attr=='E') + { + eventline=static_cast<bool>(st_e>>im>>pm); + } + } + } + HepMC::HEPEVT_Wrapper::set_event_number(im); + HepMC::HEPEVT_Wrapper::set_number_entries(pm); + return eventline; +} +bool ReadHepEvtFromAscii::read_hepevt_particle( int i) +{ + const size_t max_p_buffer_size=512; + const size_t max_v_buffer_size=512; + char buf_p[max_p_buffer_size]; + char buf_v[max_v_buffer_size]; + int intcodes[6]; + double fltcodes1[5]; + double fltcodes2[4]; + m_file.getline(buf_p,max_p_buffer_size); + if( strlen(buf_p) == 0 ) return false; + m_file.getline(buf_v,max_v_buffer_size); + if( strlen(buf_v) == 0 ) return false; + std::stringstream st_p(buf_p); + std::stringstream st_v(buf_v); + if (!static_cast<bool>(st_p>>intcodes[0]>>intcodes[1]>>intcodes[2]>>intcodes[3]>>intcodes[4]>>intcodes[5]>>fltcodes1[0]>>fltcodes1[1]>>fltcodes1[2]>>fltcodes1[3]>>fltcodes1[4])) { return false;} + if (!static_cast<bool>(st_v>>fltcodes2[0]>>fltcodes2[1]>>fltcodes2[2]>>fltcodes2[3])) { return false;} + HepMC::HEPEVT_Wrapper::set_status(i,intcodes[0]); + HepMC::HEPEVT_Wrapper::set_id(i,intcodes[1]); + HepMC::HEPEVT_Wrapper::set_parents(i,intcodes[2],std::max(intcodes[2],intcodes[3]));/* Pythia writes second mother 0*/ + HepMC::HEPEVT_Wrapper::set_children(i,intcodes[4],intcodes[5]); + HepMC::HEPEVT_Wrapper::set_momentum(i,fltcodes1[0],fltcodes1[1],fltcodes1[2],fltcodes1[3]); + HepMC::HEPEVT_Wrapper::set_mass(i,fltcodes1[4]); + HepMC::HEPEVT_Wrapper::set_position(i,fltcodes2[0],fltcodes2[1],fltcodes2[2],fltcodes2[3]); + return true; +} + ReadHepEvtFromAscii::ReadHepEvtFromAscii(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_sgSvc(0) @@ -46,10 +96,8 @@ StatusCode ReadHepEvtFromAscii::initialize(){ HepMC::HEPEVT_Wrapper::set_max_number_entries(10000); // Initialize input file - int ifile=5; - closefile_(ifile); - openfile_(ifile,m_input_file.c_str(),m_input_file.size()); - + m_file=std::ifstream(m_input_file.c_str()); + if( !m_file.is_open() ) return StatusCode::FAILURE; // Initialization terminated return StatusCode::SUCCESS; } @@ -73,8 +121,10 @@ StatusCode ReadHepEvtFromAscii::execute() { } HepMC::GenEvent* evt = new HepMC::GenEvent(); - int ifile=5; - readevt_(ifile); + HepMC::HEPEVT_Wrapper::zero_everything(); + bool fileok=read_hepevt_event_header(); + for (int i=1; (i<=HepMC::HEPEVT_Wrapper::number_entries())&&fileok; i++) fileok=read_hepevt_particle(i); + if (!fileok) return StatusCode::FAILURE; HepMC::IO_HEPEVT hepio; hepio.set_print_inconsistency_errors(0); @@ -100,8 +150,7 @@ StatusCode ReadHepEvtFromAscii::finalize() { msg(MSG::INFO) << ">>> ReadHepEvtFromAscii from finalize" << endmsg; - int ifile=5; - closefile_(ifile); + if(m_file.is_open()) m_file.close(); // End of finalization step return StatusCode::SUCCESS; diff --git a/Generators/TruthIO/src/readEvt.F b/Generators/TruthIO/src/readEvt.F deleted file mode 100644 index 1e337806f881d90a252e03f2741633c4112ceffc..0000000000000000000000000000000000000000 --- a/Generators/TruthIO/src/readEvt.F +++ /dev/null @@ -1,37 +0,0 @@ - subroutine openFile(ifile,filename) - integer ifile - character*(*) filename - logical ex - - inquire(FILE=filename,EXIST=ex) - if(.not. ex) write(*,*) 'File does not exist:',filename - open(ifile,FILE=filename,status='old') - end - - subroutine readEvt(ifile) - integer ifile -c...Hepevt common block - integer nmxhep,nevhep,nhep,isthep,idhep,jmohep,jdahep - double precision phep,vhep - PARAMETER (NMXHEP=10000) - COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP), - & JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP) - - integer i - - read(ifile,*) nevhep,nhep - do i=1,nhep - read(ifile,*) dummy,isthep(i),idhep(i),jmohep(1,i), - & jmohep(2,i),jdahep(1,i),jdahep(2,i) - read(ifile,*) phep(1,i),phep(2,i),phep(3,i),phep(4,i),phep(5,i) - read(ifile,*) vhep(1,i),vhep(2,i),vhep(3,i),vhep(4,i) - enddo - - end - - subroutine closeFile(ifile) - integer ifile - - close(ifile) - - end diff --git a/HLT/Event/TrigByteStreamCnvSvc/python/TrigByteStreamCnvSvcConfig.py b/HLT/Event/TrigByteStreamCnvSvc/python/TrigByteStreamCnvSvcConfig.py index bcf66572d5ea9a215c8c9089de07f2f4bdc9d545..2490bd67f8e946477d77b6d457826130697f1562 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/python/TrigByteStreamCnvSvcConfig.py +++ b/HLT/Event/TrigByteStreamCnvSvc/python/TrigByteStreamCnvSvcConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # from TrigByteStreamCnvSvc.TrigByteStreamCnvSvcConf import TrigByteStreamInputSvc as _TrigByteStreamInputSvc @@ -9,9 +9,6 @@ class TrigByteStreamInputSvc(_TrigByteStreamInputSvc): def __init__(self, name='TrigByteStreamInputSvc'): super(TrigByteStreamInputSvc, self).__init__(name) self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) - self.MonTool.defineHistogram('TIME_getNext', path='EXPERT', type='TH1F', - title='Time of DataCollector::getNext() calls;Time [us];N calls', - xbins=100, xmin=0, xmax=50000) self.MonTool.defineHistogram('L1Result_NumROBs', path='EXPERT', type='TH1F', title='Number of ROBs received in L1 result;Number of ROBs;N events', xbins=100, xmin=0, xmax=100) @@ -21,3 +18,9 @@ class TrigByteStreamInputSvc(_TrigByteStreamInputSvc): self.MonTool.defineHistogram('L1Result_SubDets', path='EXPERT', type='TH1F', title='Source of ROBs in L1 result passed to HLT;;Total number of ROBs', xbins=1, xmin=0, xmax=1) + self.MonTool.defineHistogram('TIME_getNext', path='EXPERT', type='TH1F', + title='Time of DataCollector::getNext() calls;Time [ms];N calls', + xbins=100, xmin=0, xmax=100) + self.MonTool.defineHistogram('getNext_LBN,getNext_noEvent;NoEventFraction', path='EXPERT', type='TProfile', + title='Fraction of getNext calls returning NO_EVENT;Lumi Block;Event fraction', + xbins=100, xmin=0, xmax=100, opt='kCanRebin') diff --git a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.cxx b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.cxx index 553ec1a3d9d1862a7715658c7bad8e39734250e7..53621b238b35562c3c4145281ab5e88b27225e45 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.cxx +++ b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Trigger includes @@ -95,8 +95,10 @@ const RawEvent* TrigByteStreamInputSvc::nextEvent() { using DCStatus = hltinterface::DataCollector::Status; DCStatus status = DCStatus::NO_EVENT; + auto monLBN = Monitored::Scalar<uint16_t>("getNext_LBN", m_maxLB); + auto monNoEvent = Monitored::Scalar<bool>("getNext_noEvent", false); try { - auto t_getNext = Monitored::Timer("TIME_getNext"); + auto t_getNext = Monitored::Timer<std::chrono::milliseconds>("TIME_getNext"); status = hltinterface::DataCollector::instance()->getNext(cache->rawData); auto mon = Monitored::Group(m_monTool, t_getNext); } @@ -117,6 +119,8 @@ const RawEvent* TrigByteStreamInputSvc::nextEvent() { } else if (status == DCStatus::NO_EVENT) { ATH_MSG_DEBUG("DataCollector::getNext returned NO_EVENT - no events available temporarily"); + monNoEvent = true; + auto mon = Monitored::Group(m_monTool, monLBN, monNoEvent); throw hltonl::Exception::NoEventsTemporarily(); } else if (status != DCStatus::OK) { @@ -128,6 +132,12 @@ const RawEvent* TrigByteStreamInputSvc::nextEvent() { // Create a cached FullEventFragment object from the cached raw data cache->fullEventFragment.reset(new RawEvent(cache->rawData.get())); + // Update LB number for monitoring + if (m_maxLB < cache->fullEventFragment->lumi_block()) { + m_maxLB = cache->fullEventFragment->lumi_block(); + monLBN = m_maxLB; + } + // Monitor the input auto numROBs = Monitored::Scalar<int>("L1Result_NumROBs", cache->fullEventFragment->nchildren()); @@ -141,7 +151,7 @@ const RawEvent* TrigByteStreamInputSvc::nextEvent() { subdetNameVec.push_back(sid.human_detector()); } auto subdets = Monitored::Collection<std::vector<std::string>>("L1Result_SubDets", subdetNameVec); - auto mon = Monitored::Group(m_monTool, numROBs, fragSize, subdets); + auto mon = Monitored::Group(m_monTool, numROBs, fragSize, subdets, monLBN, monNoEvent); // Give the FullEventFragment pointer to ROBDataProviderSvc and also return it m_robDataProviderSvc->setNextEvent(*eventContext, cache->fullEventFragment.get()); diff --git a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.h b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.h index 2dfe049c9e4f071c433ab6009e920906dded4e26..dc5110722f12fd4bee4d88232237bb7c6606ea1a 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.h +++ b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamInputSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGBYTESTREAMINPUTSVC_H @@ -55,6 +55,7 @@ private: }; SG::SlotSpecificObj<EventCache> m_eventsCache; //!< Cache of RawEvent pointer per event slot + uint16_t m_maxLB{0}; //!< Maximum lumi block number seen so far, used for monitoring }; #endif // TRIGBYTESTREAMINPUTSVC_H diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py index a25db9aeb3ba6b4c29da8ce577d230bb8b400b6e..fe45172ac3be9c2ece6fb3f6602db9169a14ea17 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable @@ -274,7 +274,8 @@ def configure_hlt_result(hypo_algs): # Configure the HLT result maker to use the above tools from AthenaCommon.AppMgr import ServiceMgr as svcMgr hltResultMaker = svcMgr.HltEventLoopMgr.ResultMaker - hltResultMaker.MakerTools = [conf2toConfigurable(tool) for tool in [stmaker, bitsmaker, serialiser]] + hltResultMaker.StreamTagMaker = conf2toConfigurable(stmaker) + hltResultMaker.MakerTools = [conf2toConfigurable(tool) for tool in [bitsmaker, serialiser]] def make_summary_algs(hypo_algs): diff --git a/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py b/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py index 3de6e1177203544c7d60fbf0e4894de129d2f919..df658475c82c328cabf001bae5fdaa410fca9fbb 100644 --- a/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py +++ b/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file: TrigServicesConfig.py # @purpose: customized configurables @@ -139,4 +139,7 @@ class HltEventLoopMgr(_HltEventLoopMgr): self.MonTool.defineHistogram('TotalTimeRejected', path='EXPERT', type='TH1F', title='Total event processing time (rejected events);Time [ms];Events', xbins=200, xmin=0, xmax=10000) + self.MonTool.defineHistogram('SlotIdleTime', path='EXPERT', type='TH1F', + title='Time between freeing and assigning a scheduler slot;Time [ms];Events', + xbins=200, xmin=0, xmax=200) return diff --git a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx index bfda0598dd3de41ddcb955557252543700c1c148..893a81eed6c5f4b30f0a56afdbaa5640b5ae282d 100644 --- a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx +++ b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.cxx @@ -115,7 +115,7 @@ StatusCode HltEventLoopMgr::initialize() //---------------------------------------------------------------------------- // Set the timeout value (cast float to int) - m_softTimeoutValue = static_cast<int>(m_hardTimeout.value() * m_softTimeoutFraction.value()); + m_softTimeoutValue = std::chrono::milliseconds(static_cast<int>(m_hardTimeout.value() * m_softTimeoutFraction.value())); // Read DataFlow configuration properties updateDFProps(); @@ -124,7 +124,7 @@ StatusCode HltEventLoopMgr::initialize() ATH_MSG_INFO(" ---> ApplicationName = " << m_applicationName); ATH_MSG_INFO(" ---> HardTimeout = " << m_hardTimeout.value()); ATH_MSG_INFO(" ---> SoftTimeoutFraction = " << m_softTimeoutFraction.value()); - ATH_MSG_INFO(" ---> SoftTimeoutValue = " << m_softTimeoutValue); + ATH_MSG_INFO(" ---> SoftTimeoutValue = " << m_softTimeoutValue.count()); ATH_MSG_INFO(" ---> MaxFrameworkErrors = " << m_maxFrameworkErrors.value()); ATH_MSG_INFO(" ---> FwkErrorDebugStreamName = " << m_fwkErrorDebugStreamName.value()); ATH_MSG_INFO(" ---> AlgErrorDebugStreamName = " << m_algErrorDebugStreamName.value()); @@ -389,11 +389,15 @@ StatusCode HltEventLoopMgr::hltUpdateAfterFork(const ptree& /*pt*/) { std::unique_lock<std::mutex> lock(m_timeoutMutex); m_eventTimerStartPoint.clear(); - m_eventTimerStartPoint.resize(m_whiteboard->getNumberOfStores(), std::chrono::steady_clock::time_point()); + m_eventTimerStartPoint.resize(m_whiteboard->getNumberOfStores(), std::chrono::steady_clock::now()); m_isSlotProcessing.resize(m_whiteboard->getNumberOfStores(), false); } m_timeoutCond.notify_all(); + // Initialise vector of time points for free slots monitoring + m_freeSlotStartPoint.clear(); + m_freeSlotStartPoint.resize(m_whiteboard->getNumberOfStores(), std::chrono::steady_clock::now()); + // Fire incident to update listeners after forking m_incidentSvc->fireIncident(AthenaInterprocess::UpdateAfterFork(m_workerID, m_workerPID, name(), m_currentRunCtx)); @@ -680,6 +684,12 @@ StatusCode HltEventLoopMgr::executeEvent(EventContext &&ctx) resetTimeout(Athena::Timeout::instance(ctx)); + // Monitor slot idle time (between scheduler popFinishedEvent and pushNewEvent) + // Note this is time of a scheduler slot being free, not equal to the time of a whiteboard slot being free + const auto slotIdleTime = std::chrono::steady_clock::now() - m_freeSlotStartPoint[ctx.slot()]; + Monitored::Scalar<int64_t> monSlotIdleTime("SlotIdleTime", std::chrono::duration_cast<std::chrono::milliseconds>(slotIdleTime).count()); + auto mon = Monitored::Group(m_monTool, monSlotIdleTime); + // Now add event to the scheduler ATH_MSG_DEBUG("Adding event " << ctx.evt() << ", slot " << ctx.slot() << " to the scheduler"); StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( new EventContext{std::move(ctx)} ); @@ -1148,7 +1158,6 @@ StatusCode HltEventLoopMgr::failedEvent(HLT::OnlineErrorCode errorCode, const Ev void HltEventLoopMgr::runEventTimer() { ATH_MSG_VERBOSE("start of " << __FUNCTION__); - auto softDuration = std::chrono::milliseconds(m_softTimeoutValue); std::unique_lock<std::mutex> lock(m_timeoutMutex); while (m_runEventTimer) { m_timeoutCond.wait_for(lock,std::chrono::seconds(1)); @@ -1156,7 +1165,7 @@ void HltEventLoopMgr::runEventTimer() for (size_t i=0; i<m_eventTimerStartPoint.size(); ++i) { // iterate over all slots and check for timeout if (!m_isSlotProcessing.at(i)) continue; - if (now > m_eventTimerStartPoint.at(i) + softDuration) { + if (now > m_eventTimerStartPoint.at(i) + m_softTimeoutValue) { EventContext ctx(0,i); // we only need the slot number for Athena::Timeout instance // don't duplicate the actions if the timeout was already reached if (!Athena::Timeout::instance(ctx).reached()) { @@ -1237,6 +1246,9 @@ HltEventLoopMgr::DrainSchedulerStatusCode HltEventLoopMgr::drainScheduler() HLT_DRAINSCHED_CHECK(sc, "Detected nullptr EventContext while finalising a processed event", HLT::OnlineErrorCode::CANNOT_ACCESS_SLOT, thisFinishedEvtContext); + // Reset free slot timer for monitoring + m_freeSlotStartPoint[thisFinishedEvtContext->slot()] = std::chrono::steady_clock::now(); + // Set ThreadLocalContext to the currently processed finished context Gaudi::Hive::setCurrentContext(thisFinishedEvtContext); diff --git a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h index 71fc905bfe4099873321d65cc5d7290a5ab57f2f..56217be1b4765ae26102b3a49b44cd658d31f7ca 100644 --- a/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h +++ b/HLT/Trigger/TrigControl/TrigServices/src/HltEventLoopMgr.h @@ -271,6 +271,8 @@ private: IEvtSelector::Context* m_evtSelContext{nullptr}; /// Vector of event start-processing time stamps in each slot std::vector<std::chrono::steady_clock::time_point> m_eventTimerStartPoint; + /// Vector of time stamps telling when each scheduler slot was freed + std::vector<std::chrono::steady_clock::time_point> m_freeSlotStartPoint; /// Vector of flags to tell if a slot is idle or processing std::vector<bool> m_isSlotProcessing; // be aware of vector<bool> specialisation /// Timeout mutex @@ -280,7 +282,7 @@ private: /// Timeout thread std::unique_ptr<std::thread> m_timeoutThread; /// Soft timeout value set to HardTimeout*SoftTimeoutFraction at initialisation - int m_softTimeoutValue{0}; + std::chrono::milliseconds m_softTimeoutValue{0}; /// Flag set to false if timer thread should be stopped std::atomic<bool> m_runEventTimer{true}; /// Counter of framework errors diff --git a/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx b/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx index 12e6d11f4b0672f8511d3117eda9aa53bfceec39..d5ba0de4ccf0b95f1f738a860545d4e90ac273b0 100644 --- a/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx +++ b/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx @@ -65,7 +65,7 @@ int main() { auto t1 = std::chrono::high_resolution_clock::now(); auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0); msgsvc.reportMessage("Benchmark", 3, std::string("Time: ").append(std::to_string(td.count()).append(" ms"))); - assert(td.count() < 3000); + assert(td.count() < 6000); //-------------------------------------------------- // Stop and finalise the services diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h index 59e8e97eddf7c9371dae199875b7396cced67cd5..26f73feb0c469e5c5147d6b2205f53644ae0092b 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCT_LorentzAngleFunc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //For SCT Lorentz Angle @@ -19,7 +19,7 @@ LA_func(Double_t* x, Double_t* par) { Double_t x_{xmin}; Double_t LA_sum{0.}; for (Int_t i{1}; i<n; i++) { - LA_sum = par[0]*std::fabs(std::tan(x_*piOver180)-std::tan(par[1]*piOver180))+par[2]; + LA_sum = par[0]*std::abs(std::tan(x_*piOver180)-std::tan(par[1]*piOver180))+par[2]; sum += LA_sum * 0.017455 * piNorm/(par[3]*piOver180) * std::exp(-(x[0]*piOver180 - x_*piOver180 )*(x[0]*piOver180 - x_*piOver180 )/(2*par[3]*piOver180*par[3]*piOver180)) * h; x_ += h; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx index 1da9dd6b2b0b7c64a7389b8dbb7c6d5e49ac893d..91fa265a58a6ccf85343ea21d8fa5916aa4e04f0 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx @@ -49,9 +49,9 @@ #include "Math/ProbFuncMathCore.h" #include <array> +#include <cmath> using namespace SCT_CalibAlgs; -using namespace std; namespace { enum Bec {ENDCAP_C = -2, BARREL = 0, ENDCAP_A = 2}; @@ -75,39 +75,39 @@ associateStylesheet(const std::string& stylesheetName) { template <class T> std::string xmlPartData(const Bec bec, const int layer, const int eta, const std::string& dataName, const T data) { - ostringstream os; + std::ostringstream os; const std::string thisPart{shortNames[bec2Index(bec)]}; - os << " <parts>" << endl - << " " << xmlValue("part", thisPart) << endl - << " " << xmlValue("layer", layer) << endl + os << " <parts>" << std::endl + << " " << xmlValue("part", thisPart) << std::endl + << " " << xmlValue("layer", layer) << std::endl << " "; std::string barrelEtaXml{xmlValue("eta", "all")}; std::string endcapEtaXml{xmlValue("eta", eta)}; if (bec==BARREL) os << barrelEtaXml; else os << endcapEtaXml; - os << endl - << " " << xmlValue(dataName, data) << endl - << " </parts>" << endl; + os << std::endl + << " " << xmlValue(dataName, data) << std::endl + << " </parts>" << std::endl; return os.str(); } template <class T> std::string xmlModuleData(const Bec bec, const int layer, const int side, const int phi, const int eta, const std::string& dataName, const T data, const std::string& serial, const std::string& listOfErrors) { - ostringstream os; - os << " <module>" << endl - << " " << xmlValue("SN", serial) << endl; - - if (bec==ENDCAP_C) os << " " << xmlValue("barrel_endcap", "-2") << endl; - else if (bec==BARREL) os << " " << xmlValue("barrel_endcap", "0") << endl; - else if (bec==ENDCAP_A) os << " " << xmlValue("barrel_endcap", "2") << endl; - os << " " << xmlValue("layer", layer) << endl - << " " << xmlValue("side", side) << endl - << " " << xmlValue("eta", eta) << endl - << " " << xmlValue("phi", phi) << endl - << " " << xmlValue(dataName, data) << endl; + std::ostringstream os; + os << " <module>" << std::endl + << " " << xmlValue("SN", serial) << std::endl; + + if (bec==ENDCAP_C) os << " " << xmlValue("barrel_endcap", "-2") << std::endl; + else if (bec==BARREL) os << " " << xmlValue("barrel_endcap", "0") << std::endl; + else if (bec==ENDCAP_A) os << " " << xmlValue("barrel_endcap", "2") << std::endl; + os << " " << xmlValue("layer", layer) << std::endl + << " " << xmlValue("side", side) << std::endl + << " " << xmlValue("eta", eta) << std::endl + << " " << xmlValue("phi", phi) << std::endl + << " " << xmlValue(dataName, data) << std::endl; os << listOfErrors; - os << " </module>" << endl; + os << " </module>" << std::endl; return os.str(); } @@ -394,15 +394,15 @@ StatusCode SCTCalib::stop ATLAS_NOT_THREAD_SAFE () { SCT_ID::const_id_iterator waferItr{m_pSCTHelper->wafer_begin()}; SCT_ID::const_id_iterator waferItrE{m_pSCTHelper->wafer_end()}; const unsigned int onlyDummy{1}; - pair<int, int> timeInterval{0, 0}; - pair<int, int> lbRange{0, 0}; + std::pair<int, int> timeInterval{0, 0}; + std::pair<int, int> lbRange{0, 0}; const int withinLimits{m_maxtbins}; // for (; waferItr not_eq waferItrE; ++waferItr) { const Identifier waferId{*waferItr}; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; - const vector<pair<int, int>>& tvec{m_summarytrips.at(waferHash.value())}; - const vector<pair<int, int>>& tlbn{m_summarytripslb.at(waferHash.value())}; + const std::vector<std::pair<int, int>>& tvec{m_summarytrips.at(waferHash.value())}; + const std::vector<std::pair<int, int>>& tlbn{m_summarytripslb.at(waferHash.value())}; //tvec is a pair of times in general, although the very first one is a dummy const unsigned int numberOfElements{static_cast<unsigned int>(tvec.size())}; if (numberOfElements > onlyDummy) { @@ -596,8 +596,8 @@ StatusCode SCTCalib::getNoisyStrip ATLAS_NOT_THREAD_SAFE () { }//endif numnoisystrips!=0 //--- Create objects for a module if (m_pSCTHelper->side(waferId) == 1) { - if (!stripIdLists[ALL].empty()) moduleLists[ALL].insert(map< Identifier, std::set<Identifier> >::value_type(moduleId, stripIdLists[ALL])); - if (!stripIdLists[NEW].empty()) moduleLists[NEW].insert(map< Identifier, std::set<Identifier> >::value_type(moduleId, stripIdLists[NEW])); + if (!stripIdLists[ALL].empty()) moduleLists[ALL].insert(std::map< Identifier, std::set<Identifier> >::value_type(moduleId, stripIdLists[ALL])); + if (!stripIdLists[NEW].empty()) moduleLists[NEW].insert(std::map< Identifier, std::set<Identifier> >::value_type(moduleId, stripIdLists[NEW])); } }//end loop over wafers @@ -1182,7 +1182,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () m_pnoiseoccupancymapHistoVectorECm.clear(); for (int iDisk{0}; iDisk < n_disks ; ++iDisk) { for (int iSide{0}; iSide < 2; ++iSide) { - ostringstream streamHist; + std::ostringstream streamHist; streamHist << "noiseoccupancymap"; if (m_noiseOccupancyTriggerAware) streamHist << "trigger"; streamHist << "ECm_" << iDisk << "_" << iSide; @@ -1196,7 +1196,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () m_pnoiseoccupancymapHistoVector.clear(); for (int iLayer{0}; iLayer < n_barrels ; ++iLayer) { for (int iSide{0}; iSide < 2; ++iSide) { - ostringstream streamHist; + std::ostringstream streamHist; streamHist << "noiseoccupancymap"; if (m_noiseOccupancyTriggerAware) streamHist << "trigger"; streamHist << "_" << iLayer << "_" << iSide; @@ -1210,7 +1210,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () m_pnoiseoccupancymapHistoVectorECp.clear(); for (int iDisk{0}; iDisk < n_disks ; ++iDisk) { for (int iSide{0}; iSide < 2; ++iSide) { - ostringstream streamHist; + std::ostringstream streamHist; streamHist << "noiseoccupancymap"; if (m_noiseOccupancyTriggerAware) streamHist << "trigger"; streamHist << "ECp_" << iDisk << "_" << iSide; @@ -1222,19 +1222,19 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () //--- XML file const char* outputNoiseOccupancyFileName{m_noiseOccupancyFile.value().c_str()}; - ofstream outFile{outputNoiseOccupancyFileName, std::ios::out}; + std::ofstream outFile{outputNoiseOccupancyFileName, std::ios::out}; if (!outFile.good()) { ATH_MSG_ERROR("Unable to open NoiseOccupancyFile : " << outputNoiseOccupancyFileName); return StatusCode::FAILURE; } //--- Header for XML outputs - ostringstream osHeader; + std::ostringstream osHeader; osHeader << "<channels server=\"ATLAS_COOLPROD\" schema=\"ATLAS_COOLOFL_SCT\" dbname=\"MONP200\" folder=\"SCT/Derived/NoiseOccupancy\" " << "since=\"" << m_iovStart.re_time() << "\" " << "until=\"" << m_iovStop.re_time() << "\" " << "tag=\"" << m_tagID4NoiseOccupancy << "\" " - << "version=\"" << "multi\">" << endl; + << "version=\"" << "multi\">" << std::endl; outFile << osHeader.str(); //--- EndcapC @@ -1250,7 +1250,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () meanNO_ECC[iDisk][iEta]+=occupancy; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; - outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << endl; + outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << std::endl; //--- DB output if (m_writeToCool) { if (m_pCalibWriteTool->createListNO(waferId, m_pSCTHelper, 10000, occupancy).isFailure()) { @@ -1276,7 +1276,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () meanNO_Barrel[iLayer]+=occupancy; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; - outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << endl; + outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << std::endl; //--- DB output if (m_writeToCool) { if (m_pCalibWriteTool->createListNO(waferId, m_pSCTHelper, 10000, occupancy).isFailure()) { @@ -1301,7 +1301,7 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () meanNO_ECA[iDisk][iEta]+=occupancy; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; - outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << endl; + outFile << xmlChannelNoiseOccDataString(waferId, occupancy, sn) << std::endl; //--- DB output if (m_writeToCool) { if (m_pCalibWriteTool->createListNO(waferId, m_pSCTHelper, 10000, occupancy).isFailure()) { @@ -1315,10 +1315,10 @@ StatusCode SCTCalib::getNoiseOccupancy ATLAS_NOT_THREAD_SAFE () } //--- Tail of XML outputs - outFile << "</channels>" << endl; + outFile << "</channels>" << std::endl; //--- Summary XML output - ostringstream summaryList; + std::ostringstream summaryList; for (int i{0}; i < n_disks; ++i) { for (int j{0}; j < n_etaBinsEC; ++j) { if (n_phiBinsEndcap[i][j] != 0) { @@ -1415,7 +1415,7 @@ StatusCode SCTCalib::getRawOccupancy ATLAS_NOT_THREAD_SAFE () if ((*stemItr).second==ENDCAP_C) detector_part = "hitsmapECm"; else detector_part = "hitsmapECp"; } - ostringstream streamHist; + std::ostringstream streamHist; streamHist << detector_part << "_" << iDisk << "_" << iSide; std::string hitsmapname{stemItr->first + streamHist.str()}; TH2D* hist_tmp{dynamic_cast<TH2D*>(m_inputHist->Get(hitsmapname.c_str()))}; @@ -1446,7 +1446,7 @@ StatusCode SCTCalib::getRawOccupancy ATLAS_NOT_THREAD_SAFE () if (iEta-6==0) continue; for (int iPhi{0}; iPhi<n_phiBinsBarrel[iLayer]; ++iPhi) { Identifier waferId{m_pSCTHelper->wafer_id(BARREL, iLayer, iPhi, iEta-6, iSide)}; - ostringstream streamHist; + std::ostringstream streamHist; streamHist << iLayer << "_" << iSide; std::string hitsmapname{"/run_" + std::to_string(m_runNumber.value()) + "/SCT/SCTB/hits/hitsmap_" + streamHist.str()}; TH2D* hist_tmp{dynamic_cast<TH2D*>(m_inputHist->Get(hitsmapname.c_str()))}; @@ -1469,7 +1469,7 @@ StatusCode SCTCalib::getRawOccupancy ATLAS_NOT_THREAD_SAFE () } } //--- Summary XML output - ostringstream summaryList; + std::ostringstream summaryList; for (int i{0}; i < n_disks; ++i) { for (int j{0}; j < n_etaBinsEC; ++j) { if (n_phiBinsEndcap[i][j] != 0) { @@ -1554,21 +1554,21 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { std::vector<std::pair<std::string, int>>::iterator stemItr{EC_stems.begin()}; const char* outputEfficiencyFileName{m_efficiencyModuleFile.value().c_str()}; - ofstream outFile{outputEfficiencyFileName, std::ios::out}; + std::ofstream outFile{outputEfficiencyFileName, std::ios::out}; if (!outFile.good()) { ATH_MSG_ERROR("Unable to open EfficiencyFile : " << outputEfficiencyFileName); return StatusCode::FAILURE; } std::string xslName{"EfficiencyInfo.xsl"}; - outFile << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << endl; + outFile << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << std::endl; outFile << xmlValue("RunNumber", m_runNumber.value()) << linefeed << xmlValue("StartTime", m_utcBegin) << linefeed << xmlValue("EndTime", m_utcEnd) << linefeed << xmlValue("Duration", m_calibEvtInfoTool->duration()) << linefeed << xmlValue("LB", m_LBRange) << linefeed << xmlValue("Events", m_numberOfEvents) << linefeed - << " <modules>" << endl; + << " <modules>" << std::endl; //--- Endcaps @@ -1580,7 +1580,7 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { Identifier waferId = m_pSCTHelper->wafer_id((*stemItr).second, iDisk, iPhi, iEta, iSide); std::string detector_part; detector_part.erase(); - ostringstream streamProf; + std::ostringstream streamProf; if ((*stemItr).second==ENDCAP_C) { detector_part = "m_eff"; streamProf << detector_part << "_" << iDisk << "_" << iSide; @@ -1607,7 +1607,7 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { //--- For Efficiency _not_ averaged over modules IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; - outFile << xmlChannelEfficiencyDataString(waferId, eff, sn, iSide) << endl; + outFile << xmlChannelEfficiencyDataString(waferId, eff, sn, iSide) << std::endl; //--- DB writing if (m_writeToCool) { if (m_pCalibWriteTool->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure()) { @@ -1627,7 +1627,7 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { if (iEta-6==0) continue; for (int iPhi{0}; iPhi<n_phiBinsBarrel[iLayer]; ++iPhi) { Identifier waferId{m_pSCTHelper->wafer_id(BARREL, iLayer, iPhi, iEta-6, iSide)}; - ostringstream streamProf; + std::ostringstream streamProf; streamProf << iLayer << "_" << iSide; std::string effmapname{"/run_" + std::to_string(m_runNumber.value()) + "/SCT/SCTB/eff/eff_" + streamProf.str()}; @@ -1647,7 +1647,7 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { //--- For Efficiency _not_ averaged over modules IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; - outFile << xmlChannelEfficiencyDataString(waferId, eff, sn, iSide) << endl; + outFile << xmlChannelEfficiencyDataString(waferId, eff, sn, iSide) << std::endl; //--- DB writing if (m_writeToCool) { if (m_pCalibWriteTool->createListEff(waferId, m_pSCTHelper, eff_entry, eff).isFailure()) { @@ -1661,14 +1661,14 @@ StatusCode SCTCalib::getEfficiency ATLAS_NOT_THREAD_SAFE () { } //--- Tail of XML outputs - // outFile << "</channels>" << endl; + // outFile << "</channels>" << std::endl; - outFile << " </modules>" << endl; - outFile << "</run>" << endl; + outFile << " </modules>" << std::endl; + outFile << "</run>" << std::endl; //--- Summary XML output - ostringstream summaryList; + std::ostringstream summaryList; for (int i{0}; i < n_disks; ++i) { for (int j{0}; j < n_etaBinsEC; ++j) { if (n_phiBinsEndcap[i][j] != 0) { @@ -1778,11 +1778,11 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { //should do compile time check to ensure the sizes are equal. ErrMap_C.clear(); for (int indx{0}; indx!=numberOfErrorTypes; ++indx) { - ErrMap_C.insert(make_pair(errorValues[indx], errorNames_C[indx])); + ErrMap_C.insert(std::make_pair(errorValues[indx], errorNames_C[indx])); } ErrMap.clear(); for (int indx{0}; indx!=numberOfErrorTypes; ++indx) { - ErrMap.insert(make_pair(errorValues[indx], errorNames[indx])); + ErrMap.insert(std::make_pair(errorValues[indx], errorNames[indx])); } //--- Directory in HIST @@ -1804,8 +1804,8 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { for (int iPhi{0}; iPhi<n_phiBinsEndcap[iDisk][iEta]; ++iPhi) { defecttype.erase(); n_defect.erase(); - ostringstream osErrorList; - ostringstream osProbList; + std::ostringstream osErrorList; + std::ostringstream osProbList; Identifier waferId{m_pSCTHelper->wafer_id(thisBec, iDisk, iPhi, iEta, iSide)}; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; @@ -1822,8 +1822,8 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { float errorProb{0.}; unsigned long long n_errors{0}; if (errItr!=errItrE and iType == errItr->first) { - ostringstream streamHist; - ostringstream streamHistAlt; + std::ostringstream streamHist; + std::ostringstream streamHistAlt; //temporal fix: folder and histogram names should be Preamble //streamHist << errItr->second << "Errs" << "_" << iDisk << "_" << iSide; streamHist << "SCT_T" << errItr->second << detector_part << "_" << iDisk << "_" << iSide; @@ -1837,16 +1837,16 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { std::string profnameAltShort = detectorStems[stemIndex] + streamHistAlt.str(); TProfile2D* prof_tmp = (TProfile2D*) m_inputHist->Get( profname.c_str() ); - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { prof_tmp = (TProfile2D*) m_inputHist->Get( profnameShort.c_str() ); } - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { prof_tmp = (TProfile2D*) m_inputHist->Get( profnameAlt.c_str() ); } - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { prof_tmp = (TProfile2D*) m_inputHist->Get( profnameAltShort.c_str() ); } - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { msg( MSG::ERROR ) << "Unable to get profile for BSErrorsDB : " << profname << endmsg; return StatusCode::FAILURE; } @@ -1901,8 +1901,8 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { for (int iPhi{0}; iPhi<n_phiBinsBarrel[iLayer]; ++iPhi) { defecttype.erase(); n_defect.erase(); - ostringstream osErrorList; - ostringstream osProbList; + std::ostringstream osErrorList; + std::ostringstream osProbList; Identifier waferId{m_pSCTHelper->wafer_id(BARREL, iLayer, iPhi, iEta-6, iSide)}; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; SCT_SerialNumber sn{m_CablingTool->getSerialNumberFromHash(waferHash)}; @@ -1913,7 +1913,7 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { float errorProb{0.}; unsigned long long n_errors{0}; if (errItr!=errItrE and iType == errItr->first) { - ostringstream streamHist; + std::ostringstream streamHist; //streamHist << "SCT_T" << errItr->second << "Errors" << "_" << iLayer << "_" << iSide; streamHist << "SCT_T" << errItr->second << "B" << "_" << iLayer << "_" << iSide; //histogram or might not be inside a folder with the same name @@ -1922,10 +1922,10 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { std::string profnameShort = "/run_" + std::to_string(m_runNumber.value()) + "/SCT/SCTB/errors/" + streamHist.str(); TProfile2D* prof_tmp = (TProfile2D*) m_inputHist->Get( profname.c_str() ); - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { prof_tmp = (TProfile2D*) m_inputHist->Get( profnameShort.c_str() ); } - if(prof_tmp ==NULL) { + if(prof_tmp ==nullptr) { msg( MSG::ERROR ) << "Unable to get profile for BSErrorsDB : " << profname << endmsg; return StatusCode::FAILURE; } @@ -1966,7 +1966,7 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { ATH_MSG_INFO("#Links which send BSError : " << n_errorLink); //--- Summary XML output - ostringstream summaryList; + std::ostringstream summaryList; for (int i{0}; i < n_disks; ++i) { for (int j{0}; j < n_etaBinsEC; ++j) { if (n_phiBinsEndcap[i][j] != 0) { @@ -1996,7 +1996,7 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { } //module XML output - ostringstream moduleList; + std::ostringstream moduleList; std::string serial; for (int i{0}; i < n_disks; ++i) { for (int j{0}; j < n_etaBinsEC; ++j) { @@ -2006,10 +2006,10 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { serial = nErrLink_ECC_module_serial[i][k][j][l]; //fill ostringstream with number of error of each type for one particular module - ostringstream errList; + std::ostringstream errList; for (int errCount{0}; errCount < numberOfErrorTypes; errCount++) { int type{errorValues[errCount]}; // - errList << " " << xmlValue(ErrMap[type], nErrs_ECC_module[i][k][j][l][type]) << endl; + errList << " " << xmlValue(ErrMap[type], nErrs_ECC_module[i][k][j][l][type]) << std::endl; } moduleList << xmlModuleData(ENDCAP_C, i, k, j, l, "nErrors", nErrLink_ECC_module[i][k][j][l], serial, errList.str()); @@ -2027,10 +2027,10 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { for (int l{0}; l < n_phiBinsBarrel[i] ; l++) { serial = nErrLink_Barrel_module_serial[i][j][k][l]; - ostringstream errList; + std::ostringstream errList; for (int errCount{0}; errCount < numberOfErrorTypes; errCount++) { int type{errorValues[errCount]}; // - errList << " " << xmlValue(ErrMap[type], nErrs_Barrel_module[i][j][k][l][type]) << endl; + errList << " " << xmlValue(ErrMap[type], nErrs_Barrel_module[i][j][k][l][type]) << std::endl; } moduleList << xmlModuleData(BARREL, i, j, k, l, "nErrors", nErrLink_Barrel_module[i][j][k][l], serial, errList.str()); @@ -2046,10 +2046,10 @@ StatusCode SCTCalib::getBSErrors ATLAS_NOT_THREAD_SAFE () { for (int l{0}; l < n_phiBinsEndcap[i][j]; l++) { serial = nErrLink_ECA_module_serial[i][k][j][l]; - ostringstream errList; + std::ostringstream errList; for (int errCount{0}; errCount < numberOfErrorTypes; errCount++) { int type{errorValues[errCount]}; // - errList << " " << xmlValue(ErrMap[type], nErrs_ECA_module[i][k][j][l][type]) << endl; + errList << " " << xmlValue(ErrMap[type], nErrs_ECA_module[i][k][j][l][type]) << std::endl; } moduleList << xmlModuleData(ENDCAP_A, i, k, j, l, "nErrors", nErrLink_ECA_module[i][k][j][l], serial, errList.str()); @@ -2103,8 +2103,8 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { float Err_MCW_BarrelSide[n_barrels][2][2] = {{{0}, {0}}, {{0}, {0}}}; float Chisq_BarrelSide[n_barrels][2][2] = {{{0}, {0}}, {{0}, {0}}}; - string DBUploadFlag{"G"}; // fit status flag - string module[2] = {"100", "111"}; + std::string DBUploadFlag{"G"}; // fit status flag + std::string module[2] = {"100", "111"}; int moduleint[2] = {100, 111}; int FitFlag[n_barrels][2][2] = {{{0}, {0}}, {{0}, {0}}}; // fit status flag @@ -2124,7 +2124,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { for (int iLayer{0}; iLayer < n_barrels ; ++iLayer) { for (int iSide{0}; iSide < 2; ++iSide) { for (int iModule{0}; iModule < 2; ++iModule) { - ostringstream streamHist; + std::ostringstream streamHist; streamHist << "h_phiVsNstrips_" << module[iModule] << "_" << iLayer << "Side" << iSide; std::string histName{stem + streamHist.str()}; TProfile* hist_tmp{dynamic_cast<TProfile*>(m_inputHist->Get(histName.c_str()))}; @@ -2139,15 +2139,15 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { //--- XML file const char* outputLorentzAngleFileName{m_LorentzAngleFile.value().c_str()}; - ofstream outFile{outputLorentzAngleFileName, std::ios::out}; + std::ofstream outFile{outputLorentzAngleFileName, std::ios::out}; if (!outFile.good()) { ATH_MSG_ERROR("Unable to open LorentzAngleFile : " << outputLorentzAngleFileName); return StatusCode::FAILURE; } //--- Header for XML outputs - ostringstream osHeader; - osHeader << "<folder>" << endl; + std::ostringstream osHeader; + osHeader << "<folder>" << std::endl; outFile << osHeader.str(); fitFile = new TFile("FittingDebugFile.root", "RECREATE"); @@ -2161,7 +2161,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { Int_t fitResult; Double_t par[4], err_par[4]; TF1* LAfit{new TF1{"LAfit", LA_func, -9., 2., 4}}; - ostringstream streamFile; + std::ostringstream streamFile; streamFile << "h_phiVsNstrips_" << module[iModule] << "_" << iLayer << "Side" << iSide; LAfit->SetParLimits(3, 0.1, 50.); @@ -2176,7 +2176,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { //DEBUG MODE if (m_LorentzAngleDebugMode) { - ostringstream streamFileTmp; + std::ostringstream streamFileTmp; streamFileTmp << "h_phiVsNstrips_" << module[iModule] << "_" << iLayer << "Side" << iSide << "_First_Fit"; std::string dn{streamFile.str()}; std::string tmp_hn{streamFileTmp.str()}; @@ -2208,7 +2208,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { fitResult = m_h_phiVsNstripsSideHistoVector[4*iLayer + 2*iSide +iModule]->Fit("LAfit", "E", "", -9., 2.); LAfit->GetParameters(par); if (m_LorentzAngleDebugMode) { - ostringstream streamFileTmp; + std::ostringstream streamFileTmp; streamFileTmp << "h_phiVsNstrips_" << module[iModule] << "_" << iLayer << "Side" << iSide << "Second_Fit"; std::string tmp_hn{streamFileTmp.str()}; const char* histo_name{tmp_hn.c_str()}; @@ -2230,7 +2230,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { fitResult = m_h_phiVsNstripsSideHistoVector[4*iLayer + 2*iSide +iModule]->Fit("LAfit", "E", "", -9., 2.); LAfit->GetParameters(par); if (m_LorentzAngleDebugMode) { - ostringstream streamFileTmp; + std::ostringstream streamFileTmp; streamFileTmp << "h_phiVsNstrips_" << module[iModule] << "_" << iLayer << "Side" << iSide << "Third_Fit"; std::string tmp_hn{streamFileTmp.str()}; const char* histo_name{tmp_hn.c_str()}; @@ -2255,7 +2255,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { double err_B{err_par[2]}; double err_sigma{err_par[3]}; float MCW{static_cast<float>(LAfit->Eval(LA, 0, 0, 0))}; //Min-cluster-width - float err_MCW{static_cast<float>(LAfit->Eval(fabs(err_par[1]), 0, 0, 0))}; //Min-cluster-width + float err_MCW{static_cast<float>(LAfit->Eval(std::abs(err_par[1]), 0, 0, 0))}; //Min-cluster-width A_BarrelSide[iLayer][iSide][iModule] = A; LA_BarrelSide[iLayer][iSide][iModule] = LA; @@ -2304,7 +2304,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { << " <payloadType name=\"err_minClusterWidth\">" << Err_MCW_BarrelSide[iLayer][iSide][iModule] << "</payloadType>" << linefeed << " </payloadDescription>" << linefeed << " <channel id=\"" << ch << "\" name=\"" << iLayer << "_" << iSide << " \" />" << linefeed - << "</folderDefinition>" << endl; + << "</folderDefinition>" << std::endl; ch++; @@ -2321,10 +2321,10 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { } //--- Tail of XML outputs - outFile << "</folder>" << endl; + outFile << "</folder>" << std::endl; //--- Summary XML output - ostringstream summaryList; + std::ostringstream summaryList; for (int i{0}; i < n_barrels; ++i) { for (int iSide{0}; iSide < 2; ++iSide) { for (int iModule{0}; iModule < 2; ++iModule) { @@ -2343,7 +2343,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { } std::ofstream& file{m_outLASummary}; - typedef std::pair<string, string> TwoStrings; + typedef std::pair<std::string, std::string> TwoStrings; typedef std::map<std::string, TwoStrings > Names; Names nameAssociation; nameAssociation["LorentzAngle"]=TwoStrings(m_LorentzAngleSummaryFile, "LorentzAngleInfo.xsl"); @@ -2353,7 +2353,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { std::string xslName{found->second.second}; file.open(filename.c_str(), std::ios::out); if (!file.good()) return StatusCode::FAILURE; - file << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << endl; + file << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << std::endl; } else { ATH_MSG_ERROR(" argument \"type\" needs to be LorentzAngle."); return StatusCode::FAILURE; @@ -2366,7 +2366,7 @@ StatusCode SCTCalib::getLorentzAngle ATLAS_NOT_THREAD_SAFE () { << xmlValue("LB", m_LBRange) << linefeed << xmlValue("Events", m_numberOfEvents) << linefeed << xmlValue("Flag", DBUploadFlag) << linefeed - << " <data>" << endl; + << " <data>" << std::endl; if (wrapUpXML4Summary(m_outLASummary, "LorentzAngle", summaryList).isFailure()) { ATH_MSG_ERROR("Problem in closing LorentzAngle file"); @@ -2409,7 +2409,7 @@ StatusCode SCTCalib::openXML4DB(std::ofstream& file, const char* type, const cha StatusCode SCTCalib::closeXML4DB(std::ofstream& file) const { - file << "</channels>" << endl; + file << "</channels>" << std::endl; if (file.is_open()) { file.close(); return StatusCode::SUCCESS; @@ -2433,7 +2433,7 @@ StatusCode SCTCalib::addToXML4DB(std::ofstream& file, const Identifier& waferId, << xmlValue("DefectType", DefectType) << linefeed << xmlValue("Threshold", Threshold) << linefeed << xmlValue("DefectList", Defect4DB) << linefeed - << xmlCloseChannel() << endl; + << xmlCloseChannel() << std::endl; return StatusCode::SUCCESS; } @@ -2454,7 +2454,7 @@ StatusCode SCTCalib::openXML4DeadSummary(std::ofstream& file, const char* type, } //--- Upload flag - string strUploadFlag{"U"}; + std::string strUploadFlag{"U"}; bool isNonZero{false}; if ((m_doDeadChip and m_deadChipUploadTest) or (m_doDeadStrip and m_deadStripUploadTest)) { @@ -2467,12 +2467,12 @@ StatusCode SCTCalib::openXML4DeadSummary(std::ofstream& file, const char* type, } //--- Upload test result - ostringstream osNonZero; + std::ostringstream osNonZero; osNonZero << "#chips or #strips is non-zero"; - ostringstream osFlagReason; + std::ostringstream osFlagReason; if (!isNonZero) osFlagReason << "FAILED in " << osNonZero.str(); - string strFlagEnable{(m_deadChipUploadTest or m_deadStripUploadTest) ? "ENABLED" : "DISABLED"}; - ostringstream osCheckList; + std::string strFlagEnable{(m_deadChipUploadTest or m_deadStripUploadTest) ? "ENABLED" : "DISABLED"}; + std::ostringstream osCheckList; osCheckList << osNonZero.str(); file << xmlValue("RunNumber", m_runNumber.value()) << linefeed @@ -2489,14 +2489,14 @@ StatusCode SCTCalib::openXML4DeadSummary(std::ofstream& file, const char* type, << xmlValue("FlagReason", osFlagReason.str()) << linefeed << xmlValue("FlagEnable", strFlagEnable) << linefeed << xmlValue("CheckList", osCheckList.str()) << linefeed - << " <modules>" << endl; + << " <modules>" << std::endl; return StatusCode::SUCCESS; } StatusCode SCTCalib::openXML4MonSummary(std::ofstream& file, const char* type) const { - typedef std::pair<string, string> TwoStrings; + typedef std::pair<std::string, std::string> TwoStrings; typedef std::map<std::string, TwoStrings> Names; Names nameAssociation; nameAssociation["NoiseOccupancy"] = TwoStrings(m_noiseOccupancySummaryFile, "NoiseOccupancyInfo.xsl"); @@ -2512,7 +2512,7 @@ StatusCode SCTCalib::openXML4MonSummary(std::ofstream& file, const char* type) c // file.open(filename.c_str(), std::ios::out); if (!file.good()) return StatusCode::FAILURE; - file << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << endl; + file << xmlHeader << linefeed << associateStylesheet(xslName) << linefeed << "<run>" << std::endl; } else { ATH_MSG_ERROR("in openXML4MonSummary : argument \"type\" needs to be (NoiseOccupancy, RawOccupancy, Efficiency, BSErrors)."); return StatusCode::FAILURE; @@ -2523,7 +2523,7 @@ StatusCode SCTCalib::openXML4MonSummary(std::ofstream& file, const char* type) c << xmlValue("Duration", m_calibEvtInfoTool->duration()) << linefeed << xmlValue("LB", m_LBRange) << linefeed << xmlValue("Events", m_numberOfEvents) << linefeed - << " <data>" << endl; + << " <data>" << std::endl; return StatusCode::SUCCESS; } @@ -2531,11 +2531,11 @@ StatusCode SCTCalib::openXML4MonSummary(std::ofstream& file, const char* type) c StatusCode SCTCalib::wrapUpXML4Summary(std::ofstream& file, const char* type, std::ostringstream& list) const { file << list.str(); if (!strcmp(type, "DEAD")) { - file << " </modules>" << endl; + file << " </modules>" << std::endl; } else if (!strcmp(type, "NoiseOccupancy") or !strcmp(type, "RawOccupancy") or !strcmp(type, "Efficiency") or !strcmp(type, "BSErrors") or !strcmp(type, "LorentzAngle")) { - file << " </data>" << endl; + file << " </data>" << std::endl; } - file << "</run>" << endl; + file << "</run>" << std::endl; if (file.is_open()) { file.close(); @@ -2594,15 +2594,15 @@ StatusCode SCTCalib::addToSummaryStr(std::ostringstream& list, const Identifier& std::string SCTCalib::xmlChannelNoiseOccDataString(const Identifier& waferId, const float occupancy, const SCT_SerialNumber& serial) const { - ostringstream os; - os << xmlOpenChannel(waferId.get_identifier32().get_compact(), m_iovStart.re_time(), m_iovStop.re_time()) << endl - << " " << xmlValue("SN", serial.str()) << endl - << " " << xmlValue("SampleSize", "10000") << endl - << " " << xmlValue("barrel_endcap", m_pSCTHelper->barrel_ec(waferId)) << endl + std::ostringstream os; + os << xmlOpenChannel(waferId.get_identifier32().get_compact(), m_iovStart.re_time(), m_iovStop.re_time()) << std::endl + << " " << xmlValue("SN", serial.str()) << std::endl + << " " << xmlValue("SampleSize", "10000") << std::endl + << " " << xmlValue("barrel_endcap", m_pSCTHelper->barrel_ec(waferId)) << std::endl << " " << xmlValue("Layer", m_pSCTHelper->layer_disk(waferId)) << linefeed - << " " << xmlValue("Eta", m_pSCTHelper->eta_module(waferId)) << endl - << " " << xmlValue("Phi", m_pSCTHelper->phi_module(waferId)) << endl - << " " << xmlValue("NoiseOccupancy", occupancy) << endl + << " " << xmlValue("Eta", m_pSCTHelper->eta_module(waferId)) << std::endl + << " " << xmlValue("Phi", m_pSCTHelper->phi_module(waferId)) << std::endl + << " " << xmlValue("NoiseOccupancy", occupancy) << std::endl << " " << xmlCloseChannel(); return os.str(); } @@ -2610,16 +2610,16 @@ SCTCalib::xmlChannelNoiseOccDataString(const Identifier& waferId, const float oc std::string SCTCalib::xmlChannelEfficiencyDataString(const Identifier& waferId, const float efficiency, const SCT_SerialNumber& serial, const int side) const { - ostringstream os; - os << " <module>" << endl - << " " << xmlValue("SN", serial.str()) << endl - << " " << xmlValue("SampleSize", "10000") << endl - << " " << xmlValue("barrel_endcap", m_pSCTHelper->barrel_ec(waferId)) << endl + std::ostringstream os; + os << " <module>" << std::endl + << " " << xmlValue("SN", serial.str()) << std::endl + << " " << xmlValue("SampleSize", "10000") << std::endl + << " " << xmlValue("barrel_endcap", m_pSCTHelper->barrel_ec(waferId)) << std::endl << " " << xmlValue("Layer", m_pSCTHelper->layer_disk(waferId)) << linefeed - << " " << xmlValue("Eta", m_pSCTHelper->eta_module(waferId)) << endl - << " " << xmlValue("Phi", m_pSCTHelper->phi_module(waferId)) << endl - << " " << xmlValue("Efficiency", efficiency) << endl - << " " << xmlValue("Side", side )<<endl + << " " << xmlValue("Eta", m_pSCTHelper->eta_module(waferId)) << std::endl + << " " << xmlValue("Phi", m_pSCTHelper->phi_module(waferId)) << std::endl + << " " << xmlValue("Efficiency", efficiency) << std::endl + << " " << xmlValue("Side", side )<<std::endl << " </module>"; return os.str(); } @@ -2694,9 +2694,9 @@ SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE for (; idItr != idItrE; ++idItr) { if (m_pSCTHelper->side(*idItr) == 0) { Identifier moduleId{m_pSCTHelper->module_id(*idItr)}; - map<Identifier, std::set<Identifier>>::const_iterator moduleAllItr{moduleListAll.find(moduleId)}; - map<Identifier, std::set<Identifier>>::const_iterator moduleNewItr{moduleListNew.find(moduleId)}; - map<Identifier, std::set<Identifier>>::const_iterator moduleRefItr{moduleListRef.find(moduleId)}; + std::map<Identifier, std::set<Identifier>>::const_iterator moduleAllItr{moduleListAll.find(moduleId)}; + std::map<Identifier, std::set<Identifier>>::const_iterator moduleNewItr{moduleListNew.find(moduleId)}; + std::map<Identifier, std::set<Identifier>>::const_iterator moduleRefItr{moduleListRef.find(moduleId)}; std::string defectStripsAll{moduleAllItr != moduleListAll.end() ? getStripList((*moduleAllItr).second) : ""}; std::string defectStripsNew{moduleNewItr != moduleListNew.end() ? getStripList((*moduleNewItr).second) : ""}; std::string defectStripsRef{moduleRefItr != moduleListRef.end() ? getStripList((*moduleRefItr).second) : ""}; @@ -2805,14 +2805,14 @@ StatusCode SCTCalib::noisyStripsToXml(const std::map<Identifier, std::set<Identifier>>& moduleList, const std::string& badStripsFile) const { //--- Open const char* outputFileName{badStripsFile.c_str()}; - ofstream outFile{outputFileName, std::ios::out}; + std::ofstream outFile{outputFileName, std::ios::out}; if (!outFile.good()) { ATH_MSG_ERROR("Unable to open " << outputFileName); return(StatusCode::FAILURE); } float noisyStripThr{m_noisyStripThrDef ? (m_noisyStripThrOffline) : (m_noisyStripThrOnline)}; //--- Create module list - ostringstream osModuleList; + std::ostringstream osModuleList; //--- Loop over wafers SCT_ID::const_id_iterator waferItr{m_pSCTHelper->wafer_begin()}; SCT_ID::const_id_iterator waferItrE{m_pSCTHelper->wafer_end()}; @@ -2820,7 +2820,7 @@ SCTCalib::noisyStripsToXml(const std::map<Identifier, std::set<Identifier>>& mod Identifier waferId{*waferItr}; Identifier moduleId{m_pSCTHelper->module_id(waferId)}; if (m_pSCTHelper->side(waferId) != 0) continue; - map< Identifier, std::set<Identifier> >::const_iterator moduleItr{moduleList.find(moduleId)}; + std::map< Identifier, std::set<Identifier> >::const_iterator moduleItr{moduleList.find(moduleId)}; if (moduleItr != moduleList.end()) { std::string defectStrips{getStripList((*moduleItr).second)}; osModuleList << " <channel id=\"" << m_pSCTHelper->module_id(waferId).get_compact() << "\" " @@ -2834,7 +2834,7 @@ SCTCalib::noisyStripsToXml(const std::map<Identifier, std::set<Identifier>>& mod << " <value name=\"DefectType\">" << "NOISY" << "</value>" << linefeed << " <value name=\"Threshold\">" << noisyStripThr << "</value>" << linefeed << " <value name=\"DefectList\">" << normalizeList(defectStrips) << "</value>" << linefeed - << " </channel>" << endl; + << " </channel>" << std::endl; } } //--- Write out the contents @@ -2842,9 +2842,9 @@ SCTCalib::noisyStripsToXml(const std::map<Identifier, std::set<Identifier>>& mod << "since=\"" << m_iovStart.re_time() << "\" " << "until=\"" << m_iovStop.re_time() << "\" " << "tag=\"" << m_tagID4NoisyStrips << "\" " - << "version=\"" << "multi\">" << endl + << "version=\"" << "multi\">" << std::endl << osModuleList.str() - << "</channels>" << endl; + << "</channels>" << std::endl; return StatusCode::SUCCESS; } @@ -2856,7 +2856,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set const std::string& badStripsFile) const { //--- Open const char* outputFileName{badStripsFile.c_str()}; - ofstream outFile{outputFileName, std::ios::out}; + std::ofstream outFile{outputFileName, std::ios::out}; if (!outFile.good()) { ATH_MSG_ERROR("Unable to open " << outputFileName); return(StatusCode::FAILURE); @@ -2870,7 +2870,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set std::string defectLinks, defectChips; std::string defectStripsAll, defectStripsNew, defectStripsRef; - ostringstream osModuleList, osChipList; + std::ostringstream osModuleList, osChipList; //--- Create module list SCT_ID::const_id_iterator waferItr{m_pSCTHelper->wafer_begin()}; @@ -2902,7 +2902,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set //--- Execute once in this module if (m_pSCTHelper->side(waferId) == 1) { //--- Noisy strips : All - map< Identifier, std::set<Identifier> >::const_iterator moduleAllItr{moduleListAll.find(moduleId)}; + std::map< Identifier, std::set<Identifier> >::const_iterator moduleAllItr{moduleListAll.find(moduleId)}; if (moduleAllItr != moduleListAll.end()) { defectStripsAll = getStripList((*moduleAllItr).second); ++numModulesAll; @@ -2910,7 +2910,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set } //--- Noisy strips : Ref - map< Identifier, std::set<Identifier> >::const_iterator moduleRefItr{moduleListRef.find(moduleId)}; + std::map< Identifier, std::set<Identifier> >::const_iterator moduleRefItr{moduleListRef.find(moduleId)}; if (moduleRefItr != moduleListRef.end()) { defectStripsRef = getStripList(moduleRefItr->second); ++numModulesRef; @@ -2941,7 +2941,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set //--- To be written into module list defectChips = m_pCalibWriteTool->addDefect(defectChips, chipId, chipId); //--- LBs where this chip was noisy - std::pair< string, float > defectLB{getNoisyLB(moduleId, chipId)}; + std::pair< std::string, float > defectLB{getNoisyLB(moduleId, chipId)}; //--- Chip list written to XML osChipList << " <chip>" << linefeed << " <value name=\"SN\">" << sn.str() << "</value>" << linefeed @@ -2952,7 +2952,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set << " <value name=\"ChipID\">" << chipId << "</value>" << linefeed << " <value name=\"LB\">" << normalizeList(defectLB.first) << "</value>" << linefeed << " <value name=\"LBFraction\">" << defectLB.second << "</value>" << linefeed - << " </chip>" << endl; + << " </chip>" << std::endl; } } } @@ -2971,13 +2971,13 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set << " <value name=\"StripOfflineAll\">" << normalizeList(defectStripsAll) << "</value>" << linefeed << " <value name=\"StripOfflineNew\">" << normalizeList(defectStripsNew) << "</value>" << linefeed << " <value name=\"StripOfflineRef\">" << normalizeList(defectStripsRef) << "</value>" << linefeed - << " </module>" << endl; + << " </module>" << std::endl; } } }//--- end loop : waferItr //--- Upload flag - string strUploadFlag{"U"}; + std::string strUploadFlag{"U"}; bool isRunsInCool{false}; bool isNoisyMinStat{false}, isNoisyModuleList{false}, isNoisyModuleDiff{false}, isNoisyStripDiff{false}; @@ -3001,22 +3001,22 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set } //--- Upload test result to XML - ostringstream osNoisyMinStat, osNoisyModuleList, osNoisyModuleDiff, osNoisyStripDiff; + std::ostringstream osNoisyMinStat, osNoisyModuleList, osNoisyModuleDiff, osNoisyStripDiff; osNoisyMinStat << "#events more than " << m_noisyMinStat.value(); osNoisyModuleList << "#(modules w/ at least 1 noisy strip) less than " << m_noisyModuleList.value(); osNoisyModuleDiff << "Increase of #(modules w/ at least 1 noisy strip) from average of recent runs less than " << m_noisyModuleDiff*100 << "%"; osNoisyStripDiff << "Increase of #(noisy strips) from average of recent runs less than " << m_noisyStripDiff.value(); - ostringstream osFlagReason; + std::ostringstream osFlagReason; if (!isNoisyMinStat) osFlagReason << "FAILED in " << osNoisyMinStat.str() << "; "; if (!isNoisyModuleList) osFlagReason << "FAILED in " << osNoisyModuleList.str() << "; "; if (!isNoisyModuleDiff) osFlagReason << "FAILED in " << osNoisyModuleDiff.str() << "; "; if (!isNoisyStripDiff) osFlagReason << "FAILED in " << osNoisyStripDiff.str(); - string strFlagEnable = m_noisyUploadTest ? "ENABLED" : "DISABLED"; - string strRunsInCool = isRunsInCool ? "AVAILABLE" : "UNAVAILABLE"; + std::string strFlagEnable = m_noisyUploadTest ? "ENABLED" : "DISABLED"; + std::string strRunsInCool = isRunsInCool ? "AVAILABLE" : "UNAVAILABLE"; - ostringstream osCheckList; + std::ostringstream osCheckList; osCheckList << osNoisyMinStat.str() << "; " << osNoisyModuleList.str() << "; " << osNoisyModuleDiff.str() << "; " @@ -3051,7 +3051,7 @@ StatusCode SCTCalib::noisyStripsToSummaryXml(const std::map<Identifier, std::set << " <modules>" << linefeed << osModuleList.str() << " </modules>" << linefeed - << "</run>" << endl; + << "</run>" << std::endl; return StatusCode::SUCCESS; } @@ -3084,7 +3084,7 @@ SCTCalib::getNoisyChips(const std::set<Identifier>& stripIdList) const { IdentifierHash waferHash{m_pSCTHelper->wafer_hash(m_pSCTHelper->wafer_id(stripId))}; const InDetDD::SiDetectorElement* pElement{elements->getDetectorElement(waferHash)}; if (!pElement) { - ATH_MSG_FATAL("Element pointer is NULL"); + ATH_MSG_FATAL("Element pointer is nullptr"); continue; } int stripOnline{(pElement->swapPhiReadoutDirection()) ? lastStrip - stripOffline : stripOffline}; @@ -3102,7 +3102,7 @@ SCTCalib::getNoisyChips(const std::set<Identifier>& stripIdList) const { } -std::pair< string, float > +std::pair< std::string, float > SCTCalib::getNoisyLB(const Identifier& moduleId, int& chipId) const { std::string defectLB{""}; //return value if invalid float defectLBFrac{0.0}; //return value if invalid @@ -3124,7 +3124,7 @@ SCTCalib::getNoisyLB(const Identifier& moduleId, int& chipId) const { std::set<int> LBList; LBList.clear(); if (!m_calibLbTool) { - ATH_MSG_ERROR("NULL pointer m_calibLbTool line " <<__LINE__); + ATH_MSG_ERROR("nullptr m_calibLbTool line " <<__LINE__); return std::make_pair(defectLB, defectLBFrac); } diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx index 730053775cfb29c4ae0a8b4691ef5d3efcbfc81a..ae8c52db8eadbe910e7bbfa39d7ccb2559f4ff36 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -25,12 +25,11 @@ #include <set> -using namespace std; using namespace SCT_CalibAlgs; -static const string pathRoot{"/BSErrors/"}; -static const string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; -static const string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; +static const std::string pathRoot{"/BSErrors/"}; +static const std::string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; +static const std::string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; static const int n_BSErrorType{15}; static const int firstBSErrorType{0}; static const int lastBSErrorType{14}; @@ -64,7 +63,7 @@ bool SCT_CalibBsErrorTool::book() { bool result{true}; m_phistoVector.clear(); - string histoName{pathRoot+"GENERAL/"}; + std::string histoName{pathRoot+"GENERAL/"}; //histogram for numbers of events m_numberOfEventsHisto = new TH1I{"events", "Events", 1, 0.5, 1.5}; if (m_thistSvc->regHist(histoName.c_str(), m_numberOfEventsHisto ).isFailure()) { @@ -76,8 +75,8 @@ SCT_CalibBsErrorTool::book() { for (; waferItr not_eq waferItrE; ++waferItr) { Identifier waferId{*waferItr}; const int bec{m_pSCTHelper->barrel_ec(waferId)}; - const string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; - std::string histotitle{string{"SCT "} + detectorNames[bec2Index(bec)] + string{" BSErrors : plane "} + formattedPosition}; + const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; + std::string histotitle{std::string{"SCT "} + detectorNames[bec2Index(bec)] + std::string{" BSErrors : plane "} + formattedPosition}; const std::string name{pathRoot+detectorPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition}; TH1F* hitmapHisto_tmp{new TH1F{TString{formattedPosition}, TString{histotitle}, n_BSErrorType, firstBSErrorType-0.5, lastBSErrorType+0.5}}; if (m_thistSvc->regHist(name.c_str(), hitmapHisto_tmp).isFailure()) { @@ -136,7 +135,7 @@ SCT_CalibBsErrorTool::fillFromData() { void SCT_CalibBsErrorTool::fillBsErrorsForWafer(const Identifier& waferId, const int type) { int iWaferHash{static_cast<int>(m_pSCTHelper->wafer_hash(waferId))}; - const string osWafer{formatPosition(waferId, m_pSCTHelper,".")}; + const std::string osWafer{formatPosition(waferId, m_pSCTHelper,".")}; //--- Protection for wrong waferID if ( iWaferHash < 0 || iWaferHash >= m_maxHash ) { ATH_MSG_WARNING("WaferHash " << iWaferHash << " is out of range : [ bec.layer.eta.phi.side, BSErrorType ] = [ " << osWafer << ", " << type << " ]"); diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx index 2d6cd91f9101126249e6a4dc502500b93b41fc89..1ea03f4dade636fbb67ea7ab5e087e2e7d2d27de 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHitmapTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -28,11 +28,10 @@ #include "TFileCollection.h" #include "THashList.h" -using namespace std; using namespace SCT_CalibAlgs; -static const string pathRoot{"/HitMaps/"}; -static const string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; -static const string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; +static const std::string pathRoot{"/HitMaps/"}; +static const std::string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; +static const std::string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; SCT_CalibHitmapTool::SCT_CalibHitmapTool(const std::string& type, const std::string& name, const IInterface* parent): base_class(type, name, parent) @@ -69,7 +68,7 @@ SCT_CalibHitmapTool::book() { bool result{true}; //pointers to the histos are deleted by m_thistSvc methods m_phistoVector.clear(); - string histoName{pathRoot + "GENERAL/"}; + std::string histoName{pathRoot + "GENERAL/"}; //histogram for numbers of events m_numberOfEventsHisto = new TH1I{"events", "Events", 1, 0.5, 1.5}; if (m_thistSvc->regHist(histoName.c_str(), m_numberOfEventsHisto).isFailure()) { @@ -84,8 +83,8 @@ SCT_CalibHitmapTool::book() { for (; waferItr not_eq m_waferItrEnd; ++waferItr) { const Identifier& waferId{*waferItr}; const int bec{m_pSCTHelper->barrel_ec(waferId)}; - const string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; - std::string histotitle{string{"SCT "} + detectorNames[bec2Index(bec)] + string{" Hitmap: plane "} + formattedPosition}; + const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; + std::string histotitle{std::string{"SCT "} + detectorNames[bec2Index(bec)] + std::string{" Hitmap: plane "} + formattedPosition}; std::string name{hitmapPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition}; TH1F* hitmapHisto_tmp{new TH1F{TString{formattedPosition}, TString{histotitle}, nbins, firstStrip-0.5, lastStrip+0.5}}; @@ -120,7 +119,7 @@ SCT_CalibHitmapTool::read(const std::string& fileName) { SCT_ID::const_id_iterator waferItr{m_waferItrBegin}; for (; waferItr not_eq m_waferItrEnd; ++waferItr) { const Identifier& waferId{*waferItr}; - const string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; + const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)}; std::string name{detectorPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition}; TH1F* hitmapHisto_tmp{static_cast<TH1F*>(fileHitmap->Get(name.c_str()))}; if (hitmapHisto_tmp==nullptr) { diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx index 192c1e6c412bc1016c3a33fafc38d441a503b2d5..913d9fffeaf26ff3ea86fe93ebffaaccbd15df22 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx @@ -15,12 +15,11 @@ #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" -using namespace std; using namespace SCT_CalibAlgs; -static const string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; +static const std::string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; -static const string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; +static const std::string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; namespace { void initQueue(std::queue<int>& q, const int numvals, const int setval) { @@ -49,11 +48,11 @@ SCT_CalibHvTool::book() { bool result{true}; ATH_MSG_DEBUG("Book HVTrips"); //now initialize the queues (fill 100 spots with 0): - queue<int> qtemp; + std::queue<int> qtemp; initQueue(qtemp, m_maxq,0); // need to keep previous bins lbn 4 deep. initQueue(m_prevLBN, 4, 0); - vector<pair <int,int>> dummy; + std::vector<std::pair <int,int>> dummy; //first set num events processed to 0 m_phvtripProcessedEventsInt.insert(m_phvtripProcessedEventsInt.end(), n_elements, 1); m_phvtripRunningTotalInt.insert(m_phvtripRunningTotalInt.end(), n_elements, 0); @@ -163,11 +162,11 @@ SCT_CalibHvTool::fill(const bool fromData) { Identifier waferId{*waferItr}; IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)}; if (m_phvtripHasItTripped_prev[waferHash]>0) { - pair<int, int> wp; + std::pair<int, int> wp; wp.first = (m_phvtripPrevTime - 3*maxtbins); wp.second = (m_phvtripPrevTime + maxtbins); m_summarytrips[waferHash].push_back(wp); - pair<int,int> lbn; + std::pair<int,int> lbn; lbn.first = m_prevLBN.front(); lbn.second = m_prevLBN.back(); m_summarytripslb[waferHash].push_back(lbn); diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.cxx index 08241145474404a5fb8f4183d51b87842ecef458..920d0eb9f975ec9c383c9ace191d6867cbf76102 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibLbTool.cxx @@ -33,14 +33,13 @@ #include "TFile.h" #include "TMath.h" -using namespace std; using namespace SCT_CalibAlgs; -static const string pathRoot{"/LB/"}; +static const std::string pathRoot{"/LB/"}; static const int n_chipsPerSide{6}; static const int n_stripsPerChip{128}; -static const string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; -static const string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; +static const std::string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; +static const std::string detectorPaths[] {"SCTEC/", "SCTB/","SCTEA/"}; SCT_CalibLbTool::SCT_CalibLbTool(const std::string& type, const std::string& name, const IInterface* parent): base_class(type, name, parent) @@ -94,7 +93,7 @@ SCT_CalibLbTool::book() { //pointers to the histos are deleted by m_thistSvc methods m_phistoVector.clear(); m_phistoVector2D.clear(); - string histoName{pathRoot+"GENERAL/"}; + std::string histoName{pathRoot+"GENERAL/"}; m_LbRange = numberOfLb(); m_numberOfEventsHisto = new TH1I{"events", "Events", m_LbRange, 0.5, m_LbRange+0.5}; @@ -115,9 +114,9 @@ SCT_CalibLbTool::book() { for (; waferItr !=m_waferItrEnd; ++waferItr) { const Identifier& waferId{*waferItr}; const int bec{m_pSCTHelper->barrel_ec(waferId)}; - const string formattedPosition{formatPosition(waferId, m_pSCTHelper)+"_"}; + const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)+"_"}; //// - std::string histotitle{string{"SCT "} + detectorNames[bec2Index(bec)] + string{" Hitmap: plane "} + formattedPosition}; + std::string histotitle{std::string{"SCT "} + detectorNames[bec2Index(bec)] + std::string{" Hitmap: plane "} + formattedPosition}; std::string formattedPosition2D{formattedPosition + "_2D"}; std::string name2D{hitmapPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition + "_2D"}; TH2F* hitmapHistoLB_tmp2D{new TH2F{TString{formattedPosition2D}, TString{histotitle}, nbins, firstStrip-0.5, lastStrip+0.5, yAxisBins, 0.5, m_LbsToMerge*yAxisBins+0.5}}; @@ -129,9 +128,9 @@ SCT_CalibLbTool::book() { //// for (int iChip(0); iChip!=n_chipsPerSide; ++iChip) { int chipId{m_pSCTHelper->side(waferId)==0 ? iChip:iChip+n_chipsPerSide}; - const string formattedChipPosition{formattedPosition + std::to_string(chipId)}; - const string hname{pathRoot + detectorPaths[bec2Index(bec)] + "/" + formattedChipPosition}; - const string histTitle{string{"SCT"} + detectorNames[bec2Index(bec)] + string{" LB: chip "} + formattedChipPosition}; + const std::string formattedChipPosition{formattedPosition + std::to_string(chipId)}; + const std::string hname{pathRoot + detectorPaths[bec2Index(bec)] + "/" + formattedChipPosition}; + const std::string histTitle{std::string{"SCT"} + detectorNames[bec2Index(bec)] + std::string{" LB: chip "} + formattedChipPosition}; TH1F* hist_tmp{new TH1F{TString{formattedChipPosition}, TString{histTitle}, m_LbRange, 0.5, m_LbRange+0.5}}; if (m_thistSvc->regHist(hname.c_str(), hist_tmp).isFailure()) ATH_MSG_ERROR("Error in booking LB histogram"); m_phistoVector.push_back(hist_tmp); @@ -166,7 +165,7 @@ SCT_CalibLbTool::read(const std::string& fileName) { for (; waferItr !=m_waferItrEnd; ++waferItr) { const Identifier& waferId{*waferItr}; const int bec{m_pSCTHelper->barrel_ec(waferId)}; - const string formattedPosition{formatPosition(waferId, m_pSCTHelper)+"_"}; + const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)+"_"}; //// std::string name2D=detectorPaths[bec2Index(m_pSCTHelper->barrel_ec( waferId ))] + formattedPosition + "_2D"; TH2F* hitmapHistoLB_tmp2D = (TH2F*) fileLB->Get(name2D.c_str()); @@ -179,7 +178,7 @@ SCT_CalibLbTool::read(const std::string& fileName) { //// for (int iChip{0}; iChip!=n_chipsPerSide; ++iChip) { int chipId{m_pSCTHelper->side(waferId)==0 ? iChip : iChip+n_chipsPerSide}; - const string hname{detectorPaths[bec2Index(bec)] + "/" + formattedPosition + std::to_string(chipId)}; + const std::string hname{detectorPaths[bec2Index(bec)] + "/" + formattedPosition + std::to_string(chipId)}; TH1F* hist_tmp{static_cast<TH1F*>(fileLB->Get(hname.c_str()))}; if (hist_tmp==nullptr) { ATH_MSG_ERROR("Error in reading LB histogram"); @@ -221,7 +220,7 @@ SCT_CalibLbTool::fill(const bool fromData) { bool SCT_CalibLbTool::fillFromData() { if (!m_evtInfo) { - ATH_MSG_ERROR("The evtInfo pointer is NULL"); + ATH_MSG_ERROR("The evtInfo pointer is nullptr"); return false; } m_lumiBlock=m_evtInfo->lumiBlock(); diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt index 6b3894176da821a04d82c230d5e7b8f0d7c0b7e2..1898f1e1172ac0548ef4f7b541545a6afac40f31 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt @@ -5,16 +5,6 @@ # Declare the package name: atlas_subdir( PixelConditionsTools ) -# Possible extra dependencies: -set( extra_dep ) -set( extra_lib ) -if( NOT SIMULATIONBASE ) - # DO NOT ADD A DEPENDENCY ON PixelConditionsServices UNLESS YOU ALSO REMOVE - # THE DEPENDENCY OF PixelConditionsServices ON THIS PACKAGE!!!! - set( extra_dep InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/PixelGeoModel InnerDetector/InDetConditions/InDetByteStreamErrors ) - set( extra_lib PixelGeoModelLib InDetByteStreamErrors InDetConditionsSummaryService ) -endif() - # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel @@ -31,24 +21,25 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/GeoModel/GeoModelInterfaces DetectorDescription/GeoModel/GeoModelUtilities InnerDetector/InDetConditions/PixelConditionsData - InnerDetector/InDetConditions/PixelCoralClientUtils InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling - Tools/PathResolver - ${extra_dep} ) + InnerDetector/InDetDetDescr/PixelGeoModel + InnerDetector/InDetConditions/InDetByteStreamErrors + Tools/PathResolver ) # External dependencies: find_package( CLHEP ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( Eigen ) # Component(s) in the package: atlas_add_component( PixelConditionsTools src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GeoPrimitives GaudiKernel AthenaBaseComps SGTools AthenaPoolUtilities DetDescrConditions Identifier PixelConditionsData PixelCoralClientUtils InDetIdentifier GeoModelUtilities InDetReadoutGeometry PathResolver ${extra_lib} ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GeoPrimitives GaudiKernel AthenaBaseComps + SGTools AthenaPoolUtilities DetDescrConditions Identifier PixelCablingLib PixelConditionsData InDetIdentifier + GeoModelUtilities InDetReadoutGeometry PathResolver PixelGeoModelLib InDetByteStreamErrors ) # Install files from the package: atlas_install_headers( PixelConditionsTools ) diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.cxx b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.cxx index 9ff2ba4bd14591066d26d1f573a086a7c0ea1851..6c2cdeb041ff9b3ee7400dbb4ec80314c9a561c8 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef SIMULATIONBASE #include "PixelByteStreamErrorsTool.h" PixelByteStreamErrorsTool::PixelByteStreamErrorsTool(const std::string& type, const std::string& name, const IInterface* parent) @@ -360,5 +359,3 @@ unsigned int PixelByteStreamErrorsTool::getServiceRecordCount(int code) const { return m_ServiceRecords[code]; } -#endif - diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h index d294cecfb76269bd604a67feb9fd0a110631e5ce..64b8a6b94ea0098314af50055e3e05c0cbb4e348 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef PixelByteStreamErrorsTool_h #define PixelByteStreamErrorsTool_h -#ifndef SIMULATIONBASE #include "AthenaBaseComps/AthAlgTool.h" #include "PixelConditionsTools/IPixelByteStreamErrorsTool.h" @@ -127,4 +126,3 @@ inline InterfaceID& PixelByteStreamErrorsTool::interfaceID() { } #endif -#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx index 134ce1e05a451c8b57d46d6a83565c9a9396f8d4..47f56a6d50cfc08a5ea62e2f204c3cd159811b3f 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx @@ -26,15 +26,13 @@ StatusCode PixelConditionsSummaryTool::initialize(){ ATH_CHECK(m_condDCSStateKey.initialize()); ATH_CHECK(m_condDCSStatusKey.initialize()); - -#ifndef SIMULATIONBASE ATH_CHECK(m_BSErrContReadKey.initialize(m_useByteStream && !m_BSErrContReadKey.empty())); -#endif ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); ATH_CHECK(m_condTDAQKey.initialize()); ATH_CHECK(m_condDeadMapKey.initialize()); + ATH_CHECK(m_pixelCabling.retrieve()); for (unsigned int istate=0; istate<m_isActiveStates.size(); istate++) { if (m_isActiveStates[istate]=="READY") { m_activeState.push_back(PixelDCSStateData::DCSModuleState::READY); } @@ -65,7 +63,6 @@ StatusCode PixelConditionsSummaryTool::initialize(){ } bool PixelConditionsSummaryTool::isBSError([[maybe_unused]] const IdentifierHash & moduleHash) const { -#ifndef SIMULATIONBASE if (!m_useByteStream) { return false; } @@ -100,18 +97,15 @@ bool PixelConditionsSummaryTool::isBSError([[maybe_unused]] const IdentifierHash else if (errorcode) { return false; } -#endif return true; } bool PixelConditionsSummaryTool::isBSActive([[maybe_unused]] const IdentifierHash & moduleHash) const { -#ifndef SIMULATIONBASE SG::ReadHandle<InDetBSErrContainer> errCont(m_BSErrContReadKey); for (const auto* elt : *errCont) { IdentifierHash myHash=elt->first; if (myHash-m_pixelID->wafer_hash_max()==moduleHash) { return false; } } -#endif return true; } @@ -139,7 +133,7 @@ bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash) con return true; } -bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash, const Identifier & /*elementId*/) const { +bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash, const Identifier & elementId) const { if (m_useByteStream && !isBSActive(moduleHash)) { return false; } @@ -154,7 +148,7 @@ bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash, con if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } - return true; + return checkChipStatus(moduleHash, elementId); } double PixelConditionsSummaryTool::activeFraction(const IdentifierHash & /*moduleHash*/, @@ -165,7 +159,7 @@ double PixelConditionsSummaryTool::activeFraction(const IdentifierHash & /*modul } bool PixelConditionsSummaryTool::isGood(const Identifier & elementId, - const InDetConditions::Hierarchy /*h*/)const + const InDetConditions::Hierarchy h)const { Identifier moduleID = m_pixelID->wafer_id(elementId); IdentifierHash moduleHash = m_pixelID->wafer_hash(moduleID); @@ -190,6 +184,10 @@ bool PixelConditionsSummaryTool::isGood(const Identifier & elementId, if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } + if (h==InDetConditions::PIXEL_CHIP) { + return checkChipStatus(moduleHash, elementId); + } + return true; } @@ -218,9 +216,7 @@ bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash) const return true; } -bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash, - const Identifier & /*elementId*/) const -{ +bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash, const Identifier &elementId) const { if (m_useByteStream && !isBSError(moduleHash)) { return false; } @@ -242,36 +238,32 @@ bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash, if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } - return true; + return checkChipStatus(moduleHash, elementId); } double PixelConditionsSummaryTool::goodFraction(const IdentifierHash & moduleHash, - const Identifier & /*idStart*/, - const Identifier & /*idEnd*/) const + const Identifier & idStart, + const Identifier & idEnd) const { - if (m_useByteStream && !isBSError(moduleHash)) { return false; } - - SG::ReadCondHandle<PixelDCSStateData> dcsstate_data(m_condDCSStateKey); - bool isDCSActive = false; - for (unsigned int istate=0; istate<m_activeState.size(); istate++) { - if (m_activeState[istate]==dcsstate_data->getModuleStatus(moduleHash)) { isDCSActive=true; } - } - if (!isDCSActive) { return false; } + if (!isGood(moduleHash)) { return 0.0; } - SG::ReadCondHandle<PixelDCSStatusData> dcsstatus_data(m_condDCSStatusKey); - bool isDCSGood = false; - for (unsigned int istatus=0; istatus<m_activeStatus.size(); istatus++) { - if (m_activeStatus[istatus]==dcsstatus_data->getModuleStatus(moduleHash)) { isDCSGood=true; } - } - if (!isDCSGood) { return 0.0; } + Identifier moduleID = m_pixelID->wafer_id(moduleHash); - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return 1.0; } + int phiStart = m_pixelID->phi_index(idStart); + int etaStart = m_pixelID->eta_index(idStart); - if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return 1.0; } + int phiEnd = m_pixelID->phi_index(idEnd); + int etaEnd = m_pixelID->eta_index(idEnd); - // TODO!!! Calculate active fraction from dead map. + double nTotal = (std::abs(phiStart-phiEnd)+1.0)*(std::abs(etaStart-etaEnd)+1.0); - return 1.0; + double nGood = 0.0; + for (int i=std::min(phiStart,phiEnd); i<=std::max(phiStart,phiEnd); i++) { + for (int j=std::min(etaStart,etaEnd); j<=std::max(etaStart,etaEnd); j++) { + if (checkChipStatus(moduleHash, m_pixelID->pixel_id(moduleID,i,j))) { nGood++; } + } + } + return nGood/nTotal; } diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h index 916df3458c6465d0bd2f1afd9f45404fa5baa7ee..2005ea9279aa26657c9b3dd1dbce8c74a52eac6c 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** * @file PixelConditionsTools/PixelConditionsSummaryTool.h @@ -14,12 +14,10 @@ #include <string> #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "InDetConditionsSummaryService/IInDetConditionsTool.h" -#ifndef SIMULATIONBASE #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#endif - #include "Identifier/Identifier.h" #include "Identifier/IdentifierHash.h" #include "InDetIdentifier/PixelID.h" @@ -30,6 +28,7 @@ #include "PixelConditionsData/PixelDCSStatusData.h" #include "PixelConditionsData/PixelTDAQData.h" #include "StoreGate/ReadCondHandleKey.h" +#include "PixelCabling/IPixelCablingSvc.h" class PixelConditionsSummaryTool: public AthAlgTool, public IInDetConditionsTool{ public: @@ -52,6 +51,8 @@ class PixelConditionsSummaryTool: public AthAlgTool, public IInDetConditionsTool virtual bool isBSActive(const IdentifierHash & moduleHash) const override final; virtual bool isBSError(const IdentifierHash & moduleHash) const override final; + bool checkChipStatus(IdentifierHash moduleHash, Identifier pixid) const; + private: const PixelID* m_pixelID; @@ -74,13 +75,14 @@ class PixelConditionsSummaryTool: public AthAlgTool, public IInDetConditionsTool SG::ReadCondHandleKey<PixelModuleData> m_condDeadMapKey {this, "PixelModuleData", "PixelModuleData", "Pixel deadmap conditions key"}; -// SG::ReadCondHandleKey<PixelDeadMapCondData> m_condDeadMapKey -// {this, "PixelDeadMapCondData", "PixelDeadMapCondData", "Pixel deadmap conditions key"}; +// NEW FOR RUN3 SG::ReadCondHandleKey<PixelDeadMapCondData> m_condDeadMapKey +// NEW FOR RUN3 {this, "PixelDeadMapCondData", "PixelDeadMapCondData", "Pixel deadmap conditions key"}; + + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; -#ifndef SIMULATIONBASE SG::ReadHandleKey<InDetBSErrContainer> m_BSErrContReadKey {this, "PixelByteStreamErrs", "PixelByteStreamErrs", "PixelByteStreamErrs container key"}; -#endif }; @@ -89,4 +91,14 @@ inline InterfaceID& PixelConditionsSummaryTool::interfaceID(){ return IID_PixelConditionsSummaryTool; } +inline bool PixelConditionsSummaryTool::checkChipStatus(IdentifierHash moduleHash, Identifier pixid) const { + std::bitset<16> chipStatus(SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getChipStatus(moduleHash)); + if (chipStatus.any()) { + Identifier moduleID = m_pixelID->wafer_id(pixid); + std::bitset<16> circ; circ.set(m_pixelCabling->getFE(&pixid,moduleID)); + if ((chipStatus&circ).any()) { return false; } + } + return true; +} + #endif diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt index 4586d9d6930ea6a1f5185b80edda7d224b1dd82e..f81a2bc64d877330f1e7cf4b0b49997ba929056a 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt @@ -27,7 +27,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkGeometry ) # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) +find_package( Boost ) # Component(s) in the package: atlas_add_component( SCT_ConditionsAlgorithms diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ConfigurationCondAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ConfigurationCondAlg.cxx index c0e883ef568a97f7b7f39c0ff4405452bd1d76ab..a5484e9c6e2623b2a5e6b15b3315ff23d403bb8a 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ConfigurationCondAlg.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ConfigurationCondAlg.cxx @@ -196,7 +196,7 @@ StatusCode SCT_ConfigurationCondAlg::fillChannelData(SCT_ConfigurationCondData* bool link0ok{linkResults.first}; bool link1ok{linkResults.second}; // Loop over chips within module - std::vector<SCT_Chip*> chipsInMod; + std::vector<SCT_Chip> chipsInMod; chipsInMod.reserve(nChips); bool isBadSide0{true}; bool isBadSide1{true}; @@ -211,7 +211,7 @@ StatusCode SCT_ConfigurationCondAlg::fillChannelData(SCT_ConfigurationCondData* const int mask1{ run1 ? (channelItr->second[mask1Index].data<int>()) : static_cast<int>(channelItr->second[mask1Index].data<unsigned int>())}; const int mask2{ run1 ? (channelItr->second[mask2Index].data<int>()) : static_cast<int>(channelItr->second[mask2Index].data<unsigned int>())}; const int mask3{ run1 ? (channelItr->second[mask3Index].data<int>()) : static_cast<int>(channelItr->second[mask3Index].data<unsigned int>())}; - chipsInMod.push_back(new SCT_Chip(id, config, mask0, mask1, mask2, mask3)); + chipsInMod.emplace_back(id, config, mask0, mask1, mask2, mask3); if (id>=0 and id< 6 and (mask0!=0 or mask1!=0 or mask2!=0 or mask3!=0)) isBadSide0 = false; if (id>=6 and id<12 and (mask0!=0 or mask1!=0 or mask2!=0 or mask3!=0)) isBadSide1 = false; } @@ -226,27 +226,27 @@ StatusCode SCT_ConfigurationCondAlg::fillChannelData(SCT_ConfigurationCondData* unsigned int chipStatusWord{0}; for (const auto& thisChip:chipsInMod) { // Bad strips (only need to do this if at least one bad channel) - if (thisChip->numberOfMaskedChannels()!=0) { + if (thisChip.numberOfMaskedChannels()!=0) { // Add bad stips to vector badStripsVec.clear(); - thisChip->appendBadStripsToVector(badStripsVec); + thisChip.appendBadStripsToVector(badStripsVec); // Loop over bad strips and insert strip ID into set for (const auto& thisBadStrip:badStripsVec) { - const Identifier stripId{getStripId(truncatedSerialNumber, thisChip->id(), thisBadStrip, elements, ctx)}; + const Identifier stripId{getStripId(truncatedSerialNumber, thisChip.id(), thisBadStrip, elements, ctx)}; // If in rough order, may be better to call with itr of previous insertion as a suggestion if (stripId.is_valid()) writeCdo->setBadStripId(stripId, // strip Identifier - thisChip->id()<6 ? hash : oppWaferHash, // wafer IdentifierHash + thisChip.id()<6 ? hash : oppWaferHash, // wafer IdentifierHash m_pHelper->strip(stripId)); // strip number from 0 to 768 } } // Bad chips (= all strips bad) bitpacked // Should only do this for modules with at least one chip bad? - if (thisChip->numberOfMaskedChannels()==stripsPerChip) { - chipStatusWord |= (1<<thisChip->id()); + if (thisChip.numberOfMaskedChannels()==stripsPerChip) { + chipStatusWord |= (1<<thisChip.id()); nDisabledChips++; // A bad chip if (not isBadModule) nDisabledChipsExclusive++; // A bad chip in a good module } else { // Good chip - if (not isBadModule) nDisabledStripsExclusive += thisChip->numberOfMaskedChannels(); // Bad strips in a good chip of a good module + if (not isBadModule) nDisabledStripsExclusive += thisChip.numberOfMaskedChannels(); // Bad strips in a good chip of a good module } } @@ -254,10 +254,6 @@ StatusCode SCT_ConfigurationCondAlg::fillChannelData(SCT_ConfigurationCondData* if (chipStatusWord!=0) { writeCdo->setBadChips(moduleId, chipStatusWord); } - // Clear up memory associated with chips - for (const auto& thisChip: chipsInMod) { - delete thisChip; - } } const long unsigned int totalBad{writeCdo->getBadStripIds()->size()}; @@ -427,7 +423,7 @@ SCT_ConfigurationCondAlg::getStripId(const unsigned int truncatedSerialNumber, c const InDetDD::SiDetectorElement* pElement{elements->getDetectorElement(waferHash)}; if (!pElement) { - ATH_MSG_FATAL("Element pointer is NULL in 'getStripId' method"); + ATH_MSG_FATAL("Element pointer is nullptr in 'getStripId' method"); return invalidIdentifier; } strip = (pElement->swapPhiReadoutDirection()) ? (lastStrip-strip) : strip; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.cxx index c014c6374151f3b41e8be03d4b79723ef355e491..8f8df3467ce6cf2be5e9abff0765c27cf0405259 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -15,7 +15,6 @@ #include "SCT_ReadoutTestAlg.h" #include "Identifier/Identifier.h" -#include "SCT_ConditionsData/SCT_Chip.h" // Constructor SCT_ReadoutTestAlg::SCT_ReadoutTestAlg(const std::string& name, ISvcLocator* pSvcLocator) : @@ -35,8 +34,7 @@ StatusCode SCT_ReadoutTestAlg::initialize() { std::vector<std::string>::const_iterator end{m_chipConfigs.end()}; for (short ichip{0}; itr != end; ++itr, ++ichip) { - SCT_Chip* chip{initialiseChip(ichip, *itr)}; - m_chips.push_back(chip); + m_chips.push_back(initialiseChip(ichip, *itr)); } return StatusCode::SUCCESS; @@ -50,13 +48,13 @@ StatusCode SCT_ReadoutTestAlg::execute() { ATH_MSG_INFO("Calling execute"); ATH_MSG_INFO( "Chips before readout ..." ); - for (const SCT_Chip* chip: m_chips) ATH_MSG_INFO(*chip); + for (const SCT_Chip& chip: m_chips) ATH_MSG_INFO(chip); // Determin readout for this module ATH_CHECK(m_readout->determineReadout(Identifier{m_moduleId.value()}, m_chips, m_link0ok.value(), m_link1ok.value())); ATH_MSG_INFO("Chips after readout ..."); - for (const SCT_Chip* chip: m_chips) ATH_MSG_INFO(*chip); + for (const SCT_Chip& chip: m_chips) ATH_MSG_INFO(chip); return StatusCode::SUCCESS; } @@ -65,9 +63,6 @@ StatusCode SCT_ReadoutTestAlg::execute() { StatusCode SCT_ReadoutTestAlg::finalize() { ATH_MSG_INFO("Calling finalize"); - // Free up the memory associated to the chips - for (const SCT_Chip* chip: m_chips) delete chip; - return StatusCode::SUCCESS; } @@ -98,10 +93,10 @@ short SCT_ReadoutTestAlg::bin2dec(const char *bin) } // Initalise chip from id and config string (all channels are initially good) -SCT_Chip* SCT_ReadoutTestAlg::initialiseChip(short id, std::string configString) { +SCT_Chip SCT_ReadoutTestAlg::initialiseChip(short id, std::string configString) { // Opposite convention for LSB std::reverse(configString.begin(), configString.end()); short config{bin2dec(configString.c_str())}; const int minus1{-1}; - return new SCT_Chip(id, config, minus1, minus1, minus1, minus1); + return SCT_Chip(id, config, minus1, minus1, minus1, minus1); } diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.h index bd53b1e302b48bda31d15b53c0022217eec8d46c..c4c65519ee633ea286e86c4efd1749104826e7fe 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ReadoutTestAlg.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -19,6 +19,7 @@ // Athena #include "AthenaBaseComps/AthAlgorithm.h" +#include "SCT_ConditionsData/SCT_Chip.h" #include "SCT_ConditionsTools/ISCT_ReadoutTool.h" //Gaudi @@ -28,9 +29,6 @@ #include <string> #include <vector> -// Forward declarations -class SCT_chip; - /** * @class SCT_ReadoutTool * Example class to show calling the SCT_ReadoutTool @@ -50,7 +48,7 @@ class SCT_ReadoutTestAlg : public AthAlgorithm { ToolHandle<ISCT_ReadoutTool> m_readout{this, "SCT_ReadoutTool", "SCT_ReadoutTool", "Handle to the SCT_ReadoutTool"}; //!< List of chips for that module. *Modified in execute* This should be OK because this is a test alg. - std::vector<SCT_Chip*> m_chips; + std::vector<SCT_Chip> m_chips; StringArrayProperty m_chipConfigs{this, "ChipConfigurationList", {}, "The configuration of the chips in that module (from job options)"}; IntegerProperty m_moduleId{this, "ModuleId", 168497152, "The Module identifier (from job options)"}; @@ -60,7 +58,7 @@ class SCT_ReadoutTestAlg : public AthAlgorithm { /** Function to convert the configuration string into an int*/ short bin2dec(const char *bin); /** Initialise a chip given its id and configuration string*/ - SCT_Chip* initialiseChip(short id, std::string configString); + SCT_Chip initialiseChip(short id, std::string configString); }; //end of class diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamErrors.h b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamErrors.h index 697c6b0e44f6aaae427c92588b5f03a1659811b6..2962d799449c842edf127a94ef3a70837d0af5e8 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamErrors.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamErrors.h @@ -169,9 +169,11 @@ namespace SCT_ByteStreamErrors { }; template<ErrorType et> static constexpr uint64_t maskUpTo() { return ( uint64_t(1) << et ) - 1; } - static constexpr uint64_t ABCDErrorMask() { return maskUpTo<ABCDError_Error4>() & ~(maskUpTo<ABCDError_Chip0>()); } + // Bit mask for ABCDError_Chip0, ABCDError_Chip1, ..., ABCDError_Chip5 + static constexpr uint64_t ABCDErrorMask() { return maskUpTo<ABCDError_Chip5>() & ~(maskUpTo<ABCDError_Chip0>()); } + // Bit mask for TempMaskedChip0, TempMaskedChip1, ..., TempMaskedChip5 static constexpr uint64_t TempMaskedChipsMask() { return maskUpTo<TempMaskedChip5>() & ~(maskUpTo<TempMaskedChip0>()); } - inline ErrorType TempMaskedChipToBit(int chip){ return std::array<ErrorType, 6>{{ + inline ErrorType TempMaskedChipToBit(const int chip){ return std::array<ErrorType, 6>{{ TempMaskedChip0, TempMaskedChip1, TempMaskedChip2, diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h index 6fa3f41e70d3d433322897999ac0832661caa1c7..f89ba37dc96f0bab3a4be7e8942ef458efa2c9a9 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h @@ -20,6 +20,7 @@ // C++ STL #include <bitset> +#include <memory> #include <vector> class Identifier; @@ -41,7 +42,7 @@ class SCT_ReadoutData { public: SCT_ReadoutData(IMessageSvc* msgSvc=nullptr); - virtual ~SCT_ReadoutData(); + ~SCT_ReadoutData() = default; /** Default copy constructor*/ SCT_ReadoutData(const SCT_ReadoutData&) = default; @@ -113,7 +114,7 @@ public: void printStatus(const Identifier& moduleId) const; /** Set SCT_Chip vectors */ - void setChips(std::vector<SCT_Chip*>& chips); + void setChips(std::vector<SCT_Chip>& chips); /** Set link status */ void setLinkStatus(bool link0ok, bool link1ok); @@ -124,15 +125,15 @@ public: private: /** Private data*/ - std::vector<SCT_Chip*> m_chips; //!< Vector of actual SCT Chips for that module - std::vector<SCT_PortMap> m_chipMap; //!< Vector of port mapping from the chips in an SCT module - bool m_linkActive[2]; //!< Links status for link 0 and 1 - std::bitset<SCT_Parameters::NChips> m_chipInReadout; //!< Bitset indicating whether a chip is readout or not - SCT_Parameters::ModuleType m_type; //!< The type of this module (Barrel, Modified Barrel (0 or 1), Endcap) - std::vector<int> m_chipsOnLink0; //!< The chips read out on link 0 - std::vector<int> m_chipsOnLink1; //! <The chips read out on link 1 - - Athena::MsgStreamMember* m_msg; + std::vector<SCT_Chip>* m_chips{nullptr}; //!< Vector of actual SCT Chips for that module + std::vector<SCT_PortMap> m_chipMap{}; //!< Vector of port mapping from the chips in an SCT module + bool m_linkActive[2]{false, false}; //!< Links status for link 0 and 1 + std::bitset<SCT_Parameters::NChips> m_chipInReadout{}; //!< Bitset indicating whether a chip is readout or not + SCT_Parameters::ModuleType m_type{SCT_Parameters::BARREL}; //!< The type of this module (Barrel, Modified Barrel (0 or 1), Endcap) + std::vector<int> m_chipsOnLink0{}; //!< The chips read out on link 0 + std::vector<int> m_chipsOnLink1{}; //! <The chips read out on link 1 + + std::unique_ptr<Athena::MsgStreamMember> m_msg{}; }; #endif // SCT_ConditionData_SCT_ReadoutData_h diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_CalibDefectData.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_CalibDefectData.cxx index 05bbb3b8d42415d4ed719404d93b24bf3a261cb5..4f865d7e6e65b5837b3c7efa2ae222ddff53b553 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_CalibDefectData.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_CalibDefectData.cxx @@ -14,8 +14,6 @@ #include <sstream> #include <utility> -using namespace std; - //---------------------------------------------------------------------- //constructor SCT_CalibDefectData::SCT_CalibDefectData(): @@ -26,7 +24,7 @@ SCT_CalibDefectData::SCT_CalibDefectData(): // Add map entries of defects on module bool SCT_CalibDefectData::addModule(const Identifier & moduleId, const CalibModuleDefects & moduleDefects) { - return (m_defectMap.insert(make_pair(moduleId, moduleDefects))).second; + return (m_defectMap.insert(std::make_pair(moduleId, moduleDefects))).second; } //---------------------------------------------------------------------- @@ -47,7 +45,7 @@ SCT_CalibDefectData::CalibModuleDefects SCT_CalibDefectData::findModule(const Id // Method to print the map - useful debug tool std::string SCT_CalibDefectData::str() { - ostringstream txt; + std::ostringstream txt; if (m_defectMap.empty()){ txt << "No modules are in the SCT Calibration defect data map.\n"; } else { @@ -63,23 +61,23 @@ std::string SCT_CalibDefectData::str() // Print data for one module std::string SCT_CalibDefectData::moduleText( const Identifier & moduleId ){ CalibModuleDefects thisModuleDefects = findModule( moduleId ); - ostringstream txt; - ostringstream tmp; + std::ostringstream txt; + std::ostringstream tmp; if ( thisModuleDefects.begDefects.empty() ){ txt << "The SCT module Calibration defect data map is empty for module " << moduleId <<".\n"; } else { - txt << "\n" << left << setw(15) << "Bad strips" << setw(15) << "Defect type" << setw(15) << "Value:" << "\n"; + txt << "\n" << std::left << std::setw(15) << "Bad strips" << std::setw(15) << "Defect type" << std::setw(15) << "Value:" << "\n"; for ( unsigned int i = 0; i < thisModuleDefects.begDefects.size(); i++){ if ( thisModuleDefects.begDefects[i] == thisModuleDefects.endDefects[i] ){ - txt << left << setw(15) << thisModuleDefects.begDefects[i]; + txt << std::left << std::setw(15) << thisModuleDefects.begDefects[i]; } else{ tmp << thisModuleDefects.begDefects[i] << " - " << thisModuleDefects.endDefects[i]; - txt << left << setw(15) << tmp.str(); + txt << std::left << std::setw(15) << tmp.str(); } - txt << left << setw(15) << thisModuleDefects.typeOfDefect[i]; - txt << left << setw(15) << thisModuleDefects.parValue[i] << "\n"; + txt << std::left << std::setw(15) << thisModuleDefects.typeOfDefect[i]; + txt << std::left << std::setw(15) << thisModuleDefects.parValue[i] << "\n"; tmp.str(""); } } diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_DCSStatCondData.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_DCSStatCondData.cxx index 703cabed13e6235e88b76965d4435c7d62a4914a..c4a62aba98324c3b56459c3d85fca981ccbf7d88 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_DCSStatCondData.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_DCSStatCondData.cxx @@ -11,8 +11,6 @@ #include <iostream> #include <algorithm> -using namespace std; - ////////////////////////////////// //constructor SCT_DCSStatCondData::SCT_DCSStatCondData(): @@ -21,34 +19,34 @@ SCT_DCSStatCondData::SCT_DCSStatCondData(): } ////////////////////////////////// //add map entries -void SCT_DCSStatCondData::fill(const CondAttrListCollection::ChanNum& chanNum, const string param) { +void SCT_DCSStatCondData::fill(const CondAttrListCollection::ChanNum& chanNum, const std::string param) { if (m_bad_channels.find(chanNum)!=m_bad_channels.end()) { // chan num has an entry already //get the parameter list for this chan num - vector<string> par{(*m_bad_channels.find(chanNum)).second}; + std::vector<std::string> par{(*m_bad_channels.find(chanNum)).second}; - vector<string>::iterator par_itr{find(par.begin(), par.end(), param)}; + std::vector<std::string>::iterator par_itr{std::find(par.begin(), par.end(), param)}; if (par_itr==par.end()) { - // if this parameter (hv, chanstat etc) doesn't exist in the list add it to the param vector + // if this parameter (hv, chanstat etc) doesn't exist in the list add it to the param std::vector par.push_back(param); - //don't insert! not a new map entry, just update the vector + //don't insert! not a new map entry, just update the std::vector (*m_bad_channels.find(chanNum)).second = par; } } else { // no entry yet for this chan num, so start fresh - vector<string> par; + std::vector<std::string> par; par.push_back(param); - pair<map<CondAttrListCollection::ChanNum, vector<string> >::iterator, bool> successfulInsert{m_bad_channels.insert(make_pair(chanNum, par))}; - if (not successfulInsert.second) cout << "WARNING: SCT_ConditionsData map insert failed" << endl; + std::pair<std::map<CondAttrListCollection::ChanNum, std::vector<std::string> >::iterator, bool> successfulInsert{m_bad_channels.insert(make_pair(chanNum, par))}; + if (not successfulInsert.second) std::cout << "WARNING: SCT_ConditionsData map insert failed" << std::endl; } } ////////////////////////////////// //remove entries in map vector -void SCT_DCSStatCondData::remove(const CondAttrListCollection::ChanNum& chanNum, const string param) { - map<CondAttrListCollection::ChanNum, vector<string> >::iterator itr{m_bad_channels.find(chanNum)}; +void SCT_DCSStatCondData::remove(const CondAttrListCollection::ChanNum& chanNum, const std::string param) { + std::map<CondAttrListCollection::ChanNum, std::vector<std::string> >::iterator itr{m_bad_channels.find(chanNum)}; if (itr!=m_bad_channels.end()) { - vector<string>::iterator vec_itr{find((*itr).second.begin(), (*itr).second.end(), param)}; + std::vector<std::string>::iterator vec_itr{std::find((*itr).second.begin(), (*itr).second.end(), param)}; if (vec_itr!=(*itr).second.end()) { if ((*itr).second.size()>1) (*itr).second.erase(vec_itr); else m_bad_channels.erase(itr); @@ -57,10 +55,10 @@ void SCT_DCSStatCondData::remove(const CondAttrListCollection::ChanNum& chanNum, } ////////////////////////////////// //output map vector -int SCT_DCSStatCondData::output(const CondAttrListCollection::ChanNum& chanNum, vector<string>& usersVector) const { +int SCT_DCSStatCondData::output(const CondAttrListCollection::ChanNum& chanNum, std::vector<std::string>& usersVector) const { DCSConditions::const_iterator pPair{m_bad_channels.find(chanNum)}; if (pPair!=m_bad_channels.end()) { - const vector<string>& v{pPair->second}; + const std::vector<std::string>& v{pPair->second}; usersVector.insert(usersVector.begin(), v.begin(), v.end()); } return usersVector.size(); diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ReadoutData.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ReadoutData.cxx index 34fc076f9207c3f7e4741d53d122b2831e30413b..230cbe4584d0287bb184ff77eb67be8a7e937938 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ReadoutData.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ReadoutData.cxx @@ -35,22 +35,8 @@ static bool modified1(Identifier moduleId) { using namespace SCT_Parameters; // Constructor -SCT_ReadoutData::SCT_ReadoutData(IMessageSvc* msgSvc): - m_chips{}, - m_chipMap{}, - m_linkActive{}, - m_chipInReadout{}, - m_type{SCT_Parameters::BARREL}, - m_chipsOnLink0{}, - m_chipsOnLink1{}, - m_msg{nullptr} -{ - if (msgSvc) m_msg = new Athena::MsgStreamMember{msgSvc, "SCT_ReadoutData"}; -} - -// Destructor -SCT_ReadoutData::~SCT_ReadoutData() { - delete m_msg; +SCT_ReadoutData::SCT_ReadoutData(IMessageSvc* msgSvc) { + if (msgSvc) m_msg = std::make_unique<Athena::MsgStreamMember>(msgSvc, "SCT_ReadoutData"); } void SCT_ReadoutData::setModuleType(const Identifier& moduleId, int bec) { @@ -133,14 +119,14 @@ void SCT_ReadoutData::checkLink(int link) { // and if readout is sane. // Follow chip from the start chip for each side - SCT_Chip& startChip{*m_chips.at(link*6)}; + SCT_Chip& startChip{m_chips->at(link*6)}; bool linkSane{followReadoutUpstream(link, startChip)}; if (not linkSane) { std::vector<int>& chipsOnThisLink{(link==0) ? m_chipsOnLink0 : m_chipsOnLink1}; // Remove chips in that link from the readout - for (const int linkItr: chipsOnThisLink) setChipOut(*m_chips.at(linkItr)); + for (const int linkItr: chipsOnThisLink) setChipOut(m_chips->at(linkItr)); // We do not have ERROR/FAILURE if the readout is not sane as it possibly only affects one of the SCT modules if (m_msg) ATH_MSG_WARNING("Readout for link " << link << " not sane"); @@ -164,7 +150,7 @@ bool SCT_ReadoutData::hasConnectedInput(const SCT_Chip& chip) const { // The mapped chip should be talking on the same port as this chip is listening (if the chip is not an end) // Again, otherwise it'll never get to an end giving a timeout - if (m_chips.at(inChipId)->outPort()!=chip.inPort()) { + if (m_chips->at(inChipId).outPort()!=chip.inPort()) { if (m_msg) ATH_MSG_WARNING("Chip" << chip.id() << " is not an end and is listening on Port " << chip.inPort() << " but nothing is talking to it"); return false; } @@ -179,8 +165,8 @@ bool SCT_ReadoutData::isEndBeingTalkedTo(const SCT_Chip& chip) const { if (not chip.isEnd()) return false; // Is anything trying to talk to the end. - for (SCT_Chip* chipItr: m_chips) { - if (outputChip(*chipItr) == chip.id()) { + for (SCT_Chip& thisChip: *m_chips) { + if (outputChip(thisChip) == chip.id()) { if (m_msg) ATH_MSG_WARNING("Chip " << chip.id() << " is configured as end but something is trying to talk to it"); return true; } @@ -191,11 +177,11 @@ bool SCT_ReadoutData::isEndBeingTalkedTo(const SCT_Chip& chip) const { void SCT_ReadoutData::maskChipsNotInReadout() { // Mask chip (is set mask to 0 0 0 0) if not in readout // If the readout of a particular link is not sane mask all chips on that link - for (SCT_Chip* thisChip: m_chips) { - if (not isChipReadOut(*thisChip)) { - if (m_msg) ATH_MSG_DEBUG("Masking chip " << thisChip->id()); + for (SCT_Chip& thisChip: *m_chips) { + if (not isChipReadOut(thisChip)) { + if (m_msg) ATH_MSG_DEBUG("Masking chip " << thisChip.id()); uint32_t masked{0}; - thisChip->initializeMaskFromInts(masked, masked, masked, masked); + thisChip.initializeMaskFromInts(masked, masked, masked, masked); } } } @@ -254,7 +240,7 @@ bool SCT_ReadoutData::followReadoutUpstream(int link, const SCT_Chip& chip, int // Find the next chip if there is one connected if (not hasConnectedInput(chip)) return false; - SCT_Chip& nextChip{*m_chips.at(inputChip(chip))}; + SCT_Chip& nextChip{m_chips->at(inputChip(chip))}; return followReadoutUpstream(link, nextChip, remainingDepth-1); } @@ -282,7 +268,7 @@ bool SCT_ReadoutData::isLinkStandard(int link) const { void SCT_ReadoutData::printStatus(const Identifier& moduleId) const { // Print status for module (a la online) and whether it is standard or not - if (m_msg==nullptr) return; + if (not m_msg) return; if (not msgLvl(MSG::DEBUG)) return; bool standard{isLinkStandard(0) and isLinkStandard(1)}; @@ -315,10 +301,10 @@ void SCT_ReadoutData::printStatus(const Identifier& moduleId) const { msg(MSG::DEBUG) << ") " << (standard ? "Standard" : "Non-standard") << endmsg; } -void SCT_ReadoutData::setChips(std::vector<SCT_Chip*>& chips) { +void SCT_ReadoutData::setChips(std::vector<SCT_Chip>& chips) { // Set the chips and sort in order of ID - m_chips = chips; - std::sort(m_chips.begin(), m_chips.end(), [](SCT_Chip* a, SCT_Chip* b) { return a->id() < b->id(); }); + m_chips = &chips; + std::sort(m_chips->begin(), m_chips->end(), [](SCT_Chip& a, SCT_Chip& b) { return a.id() < b.id(); }); } void SCT_ReadoutData::setLinkStatus(bool link0ok, bool link1ok) { diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/SCT_ConditionsTools/ISCT_ReadoutTool.h b/InnerDetector/InDetConditions/SCT_ConditionsTools/SCT_ConditionsTools/ISCT_ReadoutTool.h index e4cf0527d6d6d1771938155c8b1def5be92a81bd..3c32ec3902c1566fb979bb8aa58ffa5c8270f36e 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/SCT_ConditionsTools/ISCT_ReadoutTool.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/SCT_ConditionsTools/ISCT_ReadoutTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -38,9 +38,9 @@ class ISCT_ReadoutTool : virtual public IAlgTool { DeclareInterfaceID(ISCT_ReadoutTool, 1, 0); /** Determine which chips are in the readout for a module of a particular type by Identifier*/ - virtual StatusCode determineReadout(const Identifier& moduleId, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const =0; + virtual StatusCode determineReadout(const Identifier& moduleId, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const =0; /** Determine which chips are in the readout for a module of a particular type by truncated serial number*/ - virtual StatusCode determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const =0; + virtual StatusCode determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const =0; }; #endif // SCT_ConditionTools_ISCT_ReadoutTool_h diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx index cbb28307214c9ef39547259e196039fa10653902..134e539d4f6dd960759a2cc6ea28301c602d3503 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx @@ -17,27 +17,27 @@ #include "StoreGate/ReadHandle.h" /** Constructor */ -SCT_ByteStreamErrorsTool::SCT_ByteStreamErrorsTool(const std::string& type, const std::string& name, const IInterface* parent) : +SCT_ByteStreamErrorsTool::SCT_ByteStreamErrorsTool(const std::string& type, const std::string& name, const IInterface* parent) : base_class(type, name, parent) { } /** Initialize */ -StatusCode +StatusCode SCT_ByteStreamErrorsTool::initialize() { StatusCode sc = detStore()->retrieve(m_sct_id, "SCT_ID") ; if (sc.isFailure()) { ATH_MSG_FATAL("Cannot retrieve SCT ID helper!"); return StatusCode::FAILURE; - } + } m_cntx_sct = m_sct_id->wafer_context(); sc = m_config.retrieve(); if (sc.isFailure()) { ATH_MSG_FATAL("Cannot retrieve ConfigurationConditionsTool!"); return StatusCode::FAILURE; - } - + } + // Read (Cond)Handle Keys ATH_CHECK(m_bsIDCErrContainerName.initialize()); ATH_CHECK(m_SCTDetEleCollKey.initialize()); @@ -57,18 +57,18 @@ SCT_ByteStreamErrorsTool::finalize() { * detector element. * In principle we could report about modules and/or strips too, and * use the id helper to navigate up or down the hierarchy to the wafer, - * but in practice we don't want to do the time-consuming isGood() for + * but in practice we don't want to do the time-consuming isGood() for * every strip, so lets only report about wafers.. */ -bool +bool SCT_ByteStreamErrorsTool::canReportAbout(InDetConditions::Hierarchy h) const { return (h==InDetConditions::SCT_SIDE or h==InDetConditions::SCT_CHIP); } const IDCInDetBSErrContainer* SCT_ByteStreamErrorsTool::getContainer(const EventContext& ctx) const { SG::ReadHandle<IDCInDetBSErrContainer> idcErrCont(m_bsIDCErrContainerName, ctx); - /** When running over ESD files without BSErr container stored, don't + /** When running over ESD files without BSErr container stored, don't * want to flood the user with error messages. Should just have a bunch * of empty sets, and keep quiet. */ @@ -103,11 +103,11 @@ SCT_ByteStreamErrorsTool::IDCCacheEntry* SCT_ByteStreamErrorsTool::getCacheEntry return cacheEntry; } -/** this is the principle method which can be accessed via +/** this is the principle method which can be accessed via * the ConditionsSummaryTool to decide if a wafer is good - in this - * case we want to return false if the wafer has an error that would + * case we want to return false if the wafer has an error that would * result in bad hits or no hits for that event */ -bool +bool SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash, const EventContext& ctx) const { { std::lock_guard<std::mutex> lock{m_cacheMutex}; @@ -119,7 +119,7 @@ SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash, const Even } auto errorCode = idcCachePtr->retrieve(elementIdHash); - + for(auto badError : SCT_ByteStreamErrors::BadErrors) { if(errorCode == badError) { ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << errorCode << " for ID " << elementIdHash ); @@ -132,20 +132,20 @@ SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash, const Even const Identifier wafer_id{m_sct_id->wafer_id(elementIdHash)}; const Identifier module_id{m_sct_id->module_id(wafer_id)}; unsigned int badChips{m_config->badChips(module_id, ctx)}; - unsigned int abcdErrorChips2{abcdErrorChips(module_id, ctx)}; - unsigned int tempMaskedChips2{tempMaskedChips(module_id, ctx)}; + unsigned int v_abcdErrorChips{abcdErrorChips(module_id, ctx)}; + unsigned int v_tempMaskedChips{tempMaskedChips(module_id, ctx)}; const int side{m_sct_id->side(wafer_id)}; bool allChipsBad{true}; - const int idMax{static_cast<short>(side==0 ? 6 : 12)}; - for (int id{idMax-6}; id<idMax; id++) { - bool issueABCDError{((abcdErrorChips2 >> id) & 0x1) != 0}; - bool isBadChip{((badChips >> id) & 0x1) != 0}; - bool isTempMaskedChip{((tempMaskedChips2 >> id) & 0x1) != 0}; + const int chipMax{static_cast<short>(side==0 ? N_CHIPS_PER_SIDE : N_CHIPS_PER_SIDE*N_SIDES)}; + for (int chip{chipMax-N_CHIPS_PER_SIDE}; chip<chipMax; chip++) { + bool issueABCDError{((v_abcdErrorChips >> chip) & 0x1) != 0}; + bool isBadChip{((badChips >> chip) & 0x1) != 0}; + bool isTempMaskedChip{((v_tempMaskedChips >> chip) & 0x1) != 0}; allChipsBad = (issueABCDError or isBadChip or isTempMaskedChip); if (not allChipsBad) break; } if (allChipsBad) return false; - + return true; } @@ -156,10 +156,10 @@ SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash) const { return isGood(elementIdHash, ctx); } -bool +bool SCT_ByteStreamErrorsTool::isGood(const Identifier& elementId, const EventContext& ctx, InDetConditions::Hierarchy h) const { if (not canReportAbout(h)) return true; - + if (h==InDetConditions::SCT_SIDE) { const IdentifierHash elementIdHash{m_sct_id->wafer_hash(elementId)}; return isGood(elementIdHash, ctx); @@ -233,14 +233,14 @@ SCT_ByteStreamErrorsTool::getChip(const Identifier& stripId, const EventContext& // Get strip number const int strip{m_sct_id->strip(stripId)}; - if (strip<0 or strip>=768) { + if (strip<0 or strip>=N_STRIPS_PER_SIDE) { // This check assumes present SCT. ATH_MSG_WARNING("strip number is invalid: " << strip); return -1; } // Conversion from strip to chip (specific for present SCT) - int chip{strip/128}; // One ABCD chip reads 128 strips + int chip{strip/N_STRIPS_PER_CHIP}; // One ABCD chip reads 128 strips // Relation between chip and offline strip is determined by the swapPhiReadoutDirection method. // If swap is false // offline strip: 0 767 @@ -253,9 +253,9 @@ SCT_ByteStreamErrorsTool::getChip(const Identifier& stripId, const EventContext& const bool swap{siElement->swapPhiReadoutDirection()}; const int side{m_sct_id->side(stripId)}; if (side==0) { - chip = swap ? 5 - chip : chip; + chip = swap ? (N_CHIPS_PER_SIDE -1) - chip : chip; } else { - chip = swap ? 11 - chip : 6 + chip; + chip = swap ? (N_CHIPS_PER_SIDE*N_SIDES-1) - chip : N_CHIPS_PER_SIDE + chip; } return chip; @@ -263,7 +263,7 @@ SCT_ByteStreamErrorsTool::getChip(const Identifier& stripId, const EventContext& //////////////////////////////////////////////////////////////////////////////////////// -/** The accessor method that can be used by clients to +/** The accessor method that can be used by clients to * retrieve a set of IdHashes of wafers with a given type of error. * e.g. for monitoring plots. */ @@ -286,7 +286,7 @@ SCT_ByteStreamErrorsTool::getErrorSet(int errorType, const EventContext& ctx) co return result; } -std::set<IdentifierHash> +std::set<IdentifierHash> SCT_ByteStreamErrorsTool::getErrorSet(int errorType) const { const EventContext& ctx{Gaudi::Hive::currentContext()}; return getErrorSet(errorType, ctx); @@ -294,7 +294,7 @@ SCT_ByteStreamErrorsTool::getErrorSet(int errorType) const { //////////////////////////////////////////////////////////////////////// -/** this function is used to populate the data of this tool from +/** this function is used to populate the data of this tool from * the InDetBSErrContainer in StoreGate */ @@ -320,16 +320,35 @@ SCT_ByteStreamErrorsTool::fillData(const EventContext& ctx) const { Identifier wafer_id{m_sct_id->wafer_id(hashId)}; Identifier module_id{m_sct_id->module_id(wafer_id)}; + if ( errCode == uint64_t{0} ) { + // That means this hashId was decoded but had no error + // In such case we want to fill the cache also with zero so we do not have to fill the cache again for a given view + // (see logic in: getErrorCodeWithCacheUpdate) + // Note: invocation of the [] operator on the map will create missing entry and set the value to default (here 0) + cacheEntry->abcdErrorChips[module_id]; + cacheEntry->tempMaskedChips[module_id]; + continue; + } + - if ( errCode == idcErrCont->emptyValue() ) continue; // not filled == all was ok in deciding + ATH_MSG_VERBOSE( "SCT_ByteStreamErrorsTool filling event cache for module " << module_id << " ec " << errCode ); - ATH_MSG_VERBOSE( "SCT_ByteStreamErrorsTool filling event cache for module " << module_id << " ec " << errCode ); + const int side{m_sct_id->side(m_sct_id->wafer_id(hashId))}; + // Each bit of errCode represents each SCT_ByteStreamErrors for one wafer + // Multiple bits can be true. + // Convert errCode to 12 bits of abcdErrorChips and 12 bits of tempMaskedChips for one module (=two wafers). + IDCInDetBSErrContainer::ErrorCode v_abcdErrorChips{errCode & SCT_ByteStreamErrors::ABCDErrorMask()}; + if (v_abcdErrorChips) { + v_abcdErrorChips >>= SCT_ByteStreamErrors::ABCDError_Chip0; // bit 0 (5) is for chip 0 (5) for both sides + v_abcdErrorChips <<= (side*N_CHIPS_PER_SIDE); // bit 0 (6) is for chip 0 on side 0 (1) + cacheEntry->abcdErrorChips[module_id] |= v_abcdErrorChips; + } + IDCInDetBSErrContainer::ErrorCode v_tempMaskedChips{errCode & SCT_ByteStreamErrors::TempMaskedChipsMask()}; + if (v_tempMaskedChips) { + v_tempMaskedChips >>= SCT_ByteStreamErrors::TempMaskedChip0; // bit 0 (5) is for chip 0 (5) for both sides0 + v_tempMaskedChips <<= (side*N_CHIPS_PER_SIDE); // bit 0 (6) is for chip 0 on side 0 (1) + cacheEntry->tempMaskedChips[module_id] |= v_tempMaskedChips; - int side{m_sct_id->side(m_sct_id->wafer_id(hashId))}; - if ( errCode & SCT_ByteStreamErrors::ABCDErrorMask() ) { - cacheEntry->abcdErrorChips[module_id] |= (1 << (errCode - SCT_ByteStreamErrors::ABCDError_Chip0 + side * 6)); - } else if (errCode & SCT_ByteStreamErrors::TempMaskedChipsMask()) { - cacheEntry->tempMaskedChips[module_id] |= (1 << (errCode- SCT_ByteStreamErrors::TempMaskedChip0 + side * 6)); } } @@ -345,12 +364,12 @@ unsigned int SCT_ByteStreamErrorsTool::tempMaskedChips(const Identifier& moduleI auto cacheEntry = getCacheEntry(ctx); if ( cacheEntry->IDCCache == nullptr ) return 0; - auto [status, bsErrorCode] = getErrorCodeWithCacheUpdate( moduleId, ctx, cacheEntry->tempMaskedChips); + auto [status, v_tempMaskedChips] = getErrorCodeWithCacheUpdate(moduleId, ctx, cacheEntry->tempMaskedChips); if ( status.isFailure() ) { ATH_MSG_ERROR("SCT_ByteStreamErrorsTool Failure getting temp masked chip errors"); } - return bsErrorCode; - + return v_tempMaskedChips; // 12 bits are used. + // Bit 0 is for chip 0 on side 0, bit 1 is for chip 1 on side 0, ..., and bit 11 is for chip 5 on side 1 } unsigned int SCT_ByteStreamErrorsTool::tempMaskedChips(const Identifier& moduleId) const { @@ -364,11 +383,12 @@ unsigned int SCT_ByteStreamErrorsTool::abcdErrorChips(const Identifier& moduleId auto cacheEntry = getCacheEntry(ctx); if ( cacheEntry->IDCCache == nullptr ) return 0; - auto [status, bsErrorCode] = getErrorCodeWithCacheUpdate( moduleId, ctx, cacheEntry->abcdErrorChips); + auto [status, v_abcdErrorChips] = getErrorCodeWithCacheUpdate(moduleId, ctx, cacheEntry->abcdErrorChips); if ( status.isFailure() ) { - ATH_MSG_ERROR("SCT_ByteStreamErrorsTool Failure getting ABC chip errors"); + ATH_MSG_ERROR("SCT_ByteStreamErrorsTool Failure getting ABCD chip errors"); } - return bsErrorCode; + return v_abcdErrorChips; // 12 bits are used. + // Bit 0 is for chip 0 on side 0, bit 1 is for chip 1 on side 0, ..., and bit 11 is for chip 5 on side 1 } unsigned int SCT_ByteStreamErrorsTool::abcdErrorChips(const Identifier& moduleId) const { diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.h b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.h index 230bda772cb2f69a8c02135fa992ac672dcacccd..2a0584c56d791dfc527eb8427e964c1b3adfaeea 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -90,6 +90,7 @@ public: virtual unsigned int abcdErrorChips(const Identifier& moduleId, const EventContext& ctx) const override; // Internally used private: + enum N_ELEMENTS { N_CHIPS_PER_SIDE = 6, N_SIDES = 2, N_STRIPS_PER_CHIP = 128, N_STRIPS_PER_SIDE = N_STRIPS_PER_CHIP*N_CHIPS_PER_SIDE }; ToolHandle<ISCT_ConfigurationConditionsTool> m_config{this, "ConfigTool", "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool", "Tool to retrieve SCT Configuration Tool"}; @@ -108,6 +109,8 @@ private: // infomations in granularity of Chips // misisng value mean that the map need updating // 0 as the value denotes no error + // error encoding is as follows: pattern for a module has length of 6 bits, side 0 is encoded in bits 0-5, side 1 in bits 6-11 + // so bit 0 is for chip 0 on side 0, bit 1 is for chip 1 on side 0, ..., and bit 11 is for chip 5 on side 1 std::map<Identifier, unsigned int> tempMaskedChips; std::map<Identifier, unsigned int> abcdErrorChips; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConditionsSummaryTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConditionsSummaryTool.cxx index f2a7bd11151a418e846a6393f5741362fd104ad1..82344fbb421c073d81102c0afc633eba91476fa6 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConditionsSummaryTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConditionsSummaryTool.cxx @@ -13,8 +13,6 @@ #include "GaudiKernel/EventContext.h" -using namespace std; - // Constructor SCT_ConditionsSummaryTool::SCT_ConditionsSummaryTool(const std::string& type, const std::string& name, const IInterface* parent) : base_class(type, name, parent), diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConfigurationConditionsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConfigurationConditionsTool.cxx index 05e7e867fa7c50b4b815060d983b17ef8b8fe695..01cb66d16d8cc6aafe95b64062d823ca5222a772 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConfigurationConditionsTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ConfigurationConditionsTool.cxx @@ -161,7 +161,7 @@ int SCT_ConfigurationConditionsTool::getChip(const Identifier& stripId, const Ev const IdentifierHash waferHash{m_pHelper->wafer_hash(m_pHelper->wafer_id(stripId))}; const InDetDD::SiDetectorElement* pElement{getDetectorElement(waferHash, ctx)}; if (pElement==nullptr) { - ATH_MSG_FATAL("Element pointer is NULL in 'badStrips' method"); + ATH_MSG_FATAL("Element pointer is nullptr in 'badStrips' method"); return invalidChipNumber; } strip = (pElement->swapPhiReadoutDirection()) ? lastStrip - strip: strip; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ElectricFieldTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ElectricFieldTool.cxx index 7dc7e9f4d9131b7c8b2ff59a5bf4c2ad11ef1e2a..9caa9e1d021852c38e3dd05d5355710e07880c25 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ElectricFieldTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ElectricFieldTool.cxx @@ -1,11 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_ElectricFieldTool.h" #include "CLHEP/Units/SystemOfUnits.h" +#include <cmath> + SCT_ElectricFieldTool::SCT_ElectricFieldTool(const std::string& t, const std::string& n, const IInterface* p) : base_class(t, n, p) { } @@ -49,7 +51,7 @@ double SCT_ElectricFieldTool::getElectricField(double positionZ, //------------ find depletion depth for model=0 and 1 ------------- double depletionDepth{bulkDepth}; - if (biasVoltage < fabs(depletionVoltage)) depletionDepth = sqrt(biasVoltage/fabs(depletionVoltage)) * bulkDepth; + if (biasVoltage < std::abs(depletionVoltage)) depletionDepth = sqrt(biasVoltage/std::abs(depletionVoltage)) * bulkDepth; if (y<=depletionDepth){ //---------- case for uniform electric field ------------------------ if( m_eFieldModel ==UNIFORM_FIELD ) { @@ -60,7 +62,7 @@ double SCT_ElectricFieldTool::getElectricField(double positionZ, //---------- case for flat diode model ------------------------------ if (m_eFieldModel==FLAT_DIODE) { - if (biasVoltage > fabs(depletionVoltage)) { + if (biasVoltage > std::abs(depletionVoltage)) { Ey = (biasVoltage+depletionVoltage)/depletionDepth - 2.*depletionVoltage*(bulkDepth-y)/(bulkDepth*bulkDepth); } else { double Emax{2.* depletionDepth * depletionVoltage / (bulkDepth*bulkDepth)}; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx index cb68f538c74729c80e638b4133bea05009bdaa81..0ee1f02af526f36bec2da99f7810ed06472ac144 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx @@ -1,15 +1,14 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_ReadoutTool.h" #include "InDetIdentifier/SCT_ID.h" +#include "SCT_ConditionsData/SCT_ReadoutData.h" #include <algorithm> -#include "SCT_ConditionsData/SCT_ReadoutData.h" - // Constructor SCT_ReadoutTool::SCT_ReadoutTool(const std::string& type, const std::string& name, const IInterface* parent): base_class(type, name, parent), @@ -37,7 +36,7 @@ StatusCode SCT_ReadoutTool::finalize() { return StatusCode::SUCCESS; } -StatusCode SCT_ReadoutTool::determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const { +StatusCode SCT_ReadoutTool::determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const { // Determine which chips are in the module readout from truncated serial number // Get moduleId @@ -49,7 +48,7 @@ StatusCode SCT_ReadoutTool::determineReadout(const int truncatedSerialNumber, st return determineReadout(moduleId, chips, link0ok, link1ok); } -StatusCode SCT_ReadoutTool::determineReadout(const Identifier& moduleId, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const { +StatusCode SCT_ReadoutTool::determineReadout(const Identifier& moduleId, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const { // This determineReadout(const Identifier is the main method of this class. // Methods of SCT_ReadoutData are called in the following order in this method: // setChips diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h index 2b896909288e588150ae207c4a32467f1e882ea6..b8cf553b47bf8f19c3fcc09541a40dfa2828484d 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -40,9 +40,9 @@ class SCT_ReadoutTool : public extends<AthAlgTool, ISCT_ReadoutTool> { StatusCode finalize() override; /** Determine which chips are in the readout for a module of a particular type by Identifier*/ - virtual StatusCode determineReadout(const Identifier& moduleId, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const override; + virtual StatusCode determineReadout(const Identifier& moduleId, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const override; /** Determine which chips are in the readout for a module of a particular type by truncated serial number*/ - virtual StatusCode determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip*>& chips, bool link0ok, bool link1ok) const override; + virtual StatusCode determineReadout(const int truncatedSerialNumber, std::vector<SCT_Chip>& chips, bool link0ok, bool link1ok) const override; private: diff --git a/InnerDetector/InDetConfig/python/ClusterizationConfig.py b/InnerDetector/InDetConfig/python/ClusterizationConfig.py index 51dbf00269e859b8997b325234e078a60bab3325..bdc5672a1c0e12396aa7af1bbeb893b257654bed 100644 --- a/InnerDetector/InDetConfig/python/ClusterizationConfig.py +++ b/InnerDetector/InDetConfig/python/ClusterizationConfig.py @@ -84,4 +84,4 @@ if __name__ == "__main__": top_acc.run(25) #with open('test4.pkl', mode="wb") as f: # dill.dump(acc, f) - top_acc.store(open("test00.pkl", "w")) \ No newline at end of file + top_acc.store(open("test00.pkl", "wb")) diff --git a/InnerDetector/InDetConfig/python/TrackRecoConfig.py b/InnerDetector/InDetConfig/python/TrackRecoConfig.py index 6b9d134785c108e1e4dc5405c5f23b312b5c9740..c7c7fa1734e70ed7ce8f94f1b867a79d69498722 100644 --- a/InnerDetector/InDetConfig/python/TrackRecoConfig.py +++ b/InnerDetector/InDetConfig/python/TrackRecoConfig.py @@ -154,6 +154,10 @@ def MergedPixelsToolCfg(flags, **kwargs) : kwargs.setdefault("MinimalSplitProbability", 0 ) kwargs.setdefault("DoIBLSplitting", True ) + # Enable duplcated RDO check for data15 because duplication mechanism was used. + if len(flags.Input.ProjectName)>=6 and flags.Input.ProjectName[:6]=="data15": + kwargs.setdefault("CheckDuplicatedRDO", True ) + InDetMergedPixelsTool = CompFactory.InDet.MergedPixelsTool( name = "InDetMergedPixelsTool", **kwargs) acc.addPublicTool(InDetMergedPixelsTool, primary=True) diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx index 387696487eb21e0dd719335d92ff0077d1015308..d64ab8734f80e513691fa36fa6b8ad3b16c8f32f 100755 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -301,7 +301,7 @@ const std::vector< const Trk::CylinderLayer* >* InDet::SiLayerBuilder::cylindric if (takeIt) (layerSurfaces[currentlayer]).push_back(surfaceOrder); } else if (!(*sidetIter)) // barrel chek and screen output - ATH_MSG_WARNING("NULL pointer to Barrel module given by SiDetectorManager! Please check db & dict.xml"); + ATH_MSG_WARNING("nullptr to Barrel module given by SiDetectorManager! Please check db & dict.xml"); } // SiDet Loop @@ -541,7 +541,7 @@ const std::vector< const Trk::DiscLayer* >* InDet::SiLayerBuilder::discLayers() std::vector< const Trk::DiscLayer* >* InDet::SiLayerBuilder::createDiscLayers(std::vector<const Trk::DiscLayer*>* dLayers) const { // this is the DBM flag - bool isDBM = (dLayers!=NULL); + bool isDBM = (dLayers!=nullptr); // get general layout InDetDD::SiDetectorElementCollection::const_iterator sidetIter = m_siMgr->getDetectorElementBegin(); @@ -671,7 +671,7 @@ std::vector< const Trk::DiscLayer* >* InDet::SiLayerBuilder::createDiscLayers(st takeBigger(discRingMaxR[currentlayer][currentring],currentRmax); } } else if (!(*sidetIter)) - ATH_MSG_WARNING("NULL pointer to Endcap module given by SCT_DetectorManager! Please check db & dict.xml"); + ATH_MSG_WARNING("nullptr to Endcap module given by SCT_DetectorManager! Please check db & dict.xml"); } // DetElement loop double minRmin = 10e10; diff --git a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt index a6c29222774f4da59fca7f781e8515b100288f5b..9122ee0e4257a57a1ffd8d3541ab0f898a3d98de 100644 --- a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt @@ -21,9 +21,6 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/PixelConditionsData Tools/PathResolver ) -# External dependencies: -find_package( tdaq-common ) - # Component(s) in the package: atlas_add_library( PixelCablingLib PixelCabling/*.h @@ -33,8 +30,7 @@ atlas_add_library( PixelCablingLib atlas_add_component( PixelCabling src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthenaBaseComps SGTools StoreGateLib + LINK_LIBRARIES GaudiKernel AthenaBaseComps SGTools StoreGateLib AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PixelConditionsData PathResolver PixelCablingLib ) atlas_add_test( PixelCablingConfigNew_test diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_OnlineIdType.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_OnlineIdType.cxx index ca112a068a94deef85aae801e98735053f96814a..a9519cc5b21f450c232fe6cbf3b182f13a141d54 100644 --- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_OnlineIdType.cxx +++ b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_OnlineIdType.cxx @@ -7,12 +7,11 @@ //STL #include <set> -using namespace std; namespace SCT_Cabling{ DataSource onlineIdType(const unsigned int rodId){ const unsigned int rod(rodId & 0xFFFFFF); - typedef set<unsigned int> UintSet; + typedef std::set<unsigned int> UintSet; // set of rod ids used in data and in montecarlo const UintSet commonSet={0x210000, 0x210001, 0x210002, 0x210003, 0x210004, 0x210005, 0x210006, 0x210007, 0x210008, 0x210009, 0x21000a, 0x220000, 0x220001, 0x220002, 0x220003, 0x220004, diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_TestCablingAlg.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_TestCablingAlg.cxx index 73f0525ec52c6d83dac8f4410465d1b9be1d3717..13e3aa3718839ed88720f8183dc0833123d2403f 100644 --- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_TestCablingAlg.cxx +++ b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_TestCablingAlg.cxx @@ -33,7 +33,6 @@ #include <algorithm> #include <map> -using namespace std; using namespace SCT_Cabling; SCT_TestCablingAlg::SCT_TestCablingAlg(const std::string& name, ISvcLocator* pSvcLocator): @@ -64,10 +63,10 @@ SCT_TestCablingAlg::coordString(const Identifier& offlineId) const { StatusCode SCT_TestCablingAlg::execute(const EventContext& ctx) const { // const string testAreaPath{CoveritySafe::getenv("TestArea")}; - const string testAreaPath = "."; - string filename{testAreaPath+"/cabling.txt"}; + const std::string testAreaPath = "."; + std::string filename{testAreaPath+"/cabling.txt"}; ATH_MSG_INFO("Filename: " << filename << " will be written to your $TestArea."); - ofstream opFile1{filename.c_str(), ios::out}; + std::ofstream opFile1{filename.c_str(), std::ios::out}; ATH_MSG_INFO("Executing..."); ATH_MSG_INFO("hash, offline Id, online Id(hex), serial number"); const unsigned int nHashesInCabling{2*m_cablingTool->size(ctx)}; @@ -76,8 +75,8 @@ SCT_TestCablingAlg::execute(const EventContext& ctx) const { Identifier offlineId{m_idHelper->wafer_id(hash)}; SCT_OnlineId onlineId{m_cablingTool->getOnlineIdFromHash(hash, ctx)}; SCT_SerialNumber sn{m_cablingTool->getSerialNumberFromHash(hash, ctx)}; - ATH_MSG_INFO(i << " " << offlineId << " " << hex << onlineId << dec << " " << sn << " " << coordString(offlineId)); - opFile1 << i << " " << offlineId << " " << hex << onlineId << dec << " " << sn << " " << coordString(offlineId) << std::endl; + ATH_MSG_INFO(i << " " << offlineId << " " << std::hex << onlineId << std::dec << " " << sn << " " << coordString(offlineId)); + opFile1 << i << " " << offlineId << " " << std::hex << onlineId << std::dec << " " << sn << " " << coordString(offlineId) << std::endl; if (m_cablingTool->getHashFromOnlineId(onlineId, ctx) != hash){ ATH_MSG_ERROR("?? " << m_cablingTool->getHashFromOnlineId(onlineId, ctx)); } @@ -88,7 +87,7 @@ SCT_TestCablingAlg::execute(const EventContext& ctx) const { m_cablingTool->getAllRods(rods, ctx); ATH_MSG_INFO("Num. of rods= " << rods.size()); ATH_MSG_INFO("First rod id " << std::hex << rods[0] << std::dec); - string sn{"20220130000299"}; + std::string sn{"20220130000299"}; ATH_MSG_INFO("Hash from serial number " << m_cablingTool->getHashFromSerialNumber(sn, ctx)); int tsn{130000299}; ATH_MSG_INFO("Hash from truncated serial number " << m_cablingTool->getHashFromSerialNumber(tsn, ctx)); @@ -112,15 +111,15 @@ SCT_TestCablingAlg::execute(const EventContext& ctx) const { //open a file for writing const std::string fullFileName{testAreaPath + "/SCT_Cabling_svc" + (m_POSIXtime ? ("_" +std::to_string(m_POSIXtime)) : "") + ".dat"}; ATH_MSG_INFO("Open file for write " << fullFileName); - ofstream opFile{fullFileName.c_str(), ios::out}; - opFile << XmlHeader << endl; - opFile << OpenRootTag << endl; - opFile << OpenRodMappingTag << endl; + std::ofstream opFile{fullFileName.c_str(), std::ios::out}; + opFile << XmlHeader << std::endl; + opFile << OpenRootTag << std::endl; + opFile << OpenRodMappingTag << std::endl; for (auto r: rods) { - opFile << formatRodOutput(r) << endl; + opFile << formatRodOutput(r) << std::endl; } - opFile << CloseRodMappingTag << endl; - opFile << OpenModuleMappingTag << endl; + opFile << CloseRodMappingTag << std::endl; + opFile << OpenModuleMappingTag << std::endl; for (unsigned int i{0}; i!=nHashesInCabling; ++i) { IdentifierHash hash{i}; Identifier offlineId{m_idHelper->wafer_id(hash)}; @@ -133,10 +132,10 @@ SCT_TestCablingAlg::execute(const EventContext& ctx) const { const int phi{m_idHelper->phi_module(offlineId)}; const int side{m_idHelper->side(offlineId)}; const unsigned int rodIndex{rodHashMap[onlineId.rod()]}; - opFile << formatModuleOutput(rodIndex, onlineId.fibre(), bec, layer, eta, phi, side, onlineId.rod() ,sn.str()) << endl; + opFile << formatModuleOutput(rodIndex, onlineId.fibre(), bec, layer, eta, phi, side, onlineId.rod() ,sn.str()) << std::endl; } - opFile << CloseModuleMappingTag << endl; - opFile << CloseRootTag << endl; + opFile << CloseModuleMappingTag << std::endl; + opFile << CloseRootTag << std::endl; opFile.close(); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdModule.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdModule.cxx index 0537351f32418de04807af27afc7e111a2f53e8d..d6ac1a49cc49abadbfda08b61775a6ecc04fe69f 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdModule.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdModule.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////// @@ -181,7 +181,7 @@ GeoVPhysVol * SCT_FwdModule::build(SCT_Identifier id) // - relative position of component is part of its shape GeoFullPhysVol * module = new GeoFullPhysVol(m_logVolume); - if (m_connector != NULL) module->add(m_connector->getVolume()); + if (m_connector != nullptr) module->add(m_connector->getVolume()); module->add(m_hybrid->getVolume()); module->add(m_spine->getVolume()); module->add(m_subspineL->getVolume()); diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdSensor.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdSensor.cxx index 9ebc1f0aeda390c32b946dcfb48784338693951e..d81d2ede7f8c907a979d89d8140f37b469e23df2 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdSensor.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_FwdSensor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////// @@ -166,7 +166,7 @@ const GeoLogVol * SCT_FwdSensor::preBuild() m_inactive = new GeoPhysVol(inactiveLog); m_inactive->ref(); } else { - m_inactive = NULL; + m_inactive = nullptr; } // Make the moduleside design for this sensor diff --git a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_DistortionsTool.cxx b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_DistortionsTool.cxx index fd9401c1492c9f7be504e265ccbb1bd3c5e72da9..dc11a9c8d104795845431d6e28b63cd0b19b2c19 100644 --- a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_DistortionsTool.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/src/SCT_DistortionsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_DistortionsTool.h" @@ -154,18 +154,18 @@ Amg::Vector2D SCT_DistortionsTool::correction(IdentifierHash id, const Amg::Vect // ***** Calculate correction ***** float tanThetaX = xdir/zdir; float tanThetaY = ydir/zdir; - float delX = fabs(delZ * tanThetaX); - float delY = fabs(delZ * tanThetaY); + float delX = std::abs(delZ * tanThetaX); + float delY = std::abs(delZ * tanThetaY); // Add/subtract depending on angle of track // Signs appropriate for Digitization - const float moveX(fabs(delX)); + const float moveX(std::abs(delX)); if(xdir > 0 && Side == 0)XCorr = -moveX;//'track' moving in +ve x dir if(xdir > 0 && Side != 0)XCorr = moveX;//'track' moving in +ve x dir if(xdir < 0 && Side == 0)XCorr = moveX;//'track' moving in -ve x dir if(xdir < 0 && Side != 0)XCorr = -moveX;//'track' moving in -ve x dir - const float moveY(fabs(delY)); + const float moveY(std::abs(delY)); if(ydir > 0 && Side == 0)YCorr = -moveY;//'track' moving in +ve y dir if(ydir > 0 && Side != 0)YCorr = moveY;//'track' moving in +ve y dir if(ydir < 0 && Side == 0)YCorr = moveY;//'track' moving in -ve y dir diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_BarrelModuleSideDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_BarrelModuleSideDesign.h index f5f669d83290500ed44ab899bed1029a1fcaa518..25f592381a1cb1d54df804206945cad084659f4d 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_BarrelModuleSideDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_BarrelModuleSideDesign.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -13,10 +13,10 @@ // Base class #include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" +#include "TrkSurfaces/RectangleBounds.h" namespace Trk{ - class RectangleBounds; - class SurfaceBounds; + class SurfaceBounds; } namespace InDetDD { @@ -62,7 +62,7 @@ namespace InDetDD { int readoutSide = -1); /** Destructor: */ - virtual ~SCT_BarrelModuleSideDesign(); + virtual ~SCT_BarrelModuleSideDesign() = default; /** Assignment operator: */ SCT_BarrelModuleSideDesign &operator=(const SCT_BarrelModuleSideDesign &design); @@ -166,7 +166,7 @@ namespace InDetDD { double m_totalDeadLength; //!< includes detector edge and gap between decetors double m_xPhiAbsSize; //!< size in xPhi/2 for active area double m_xEtaAbsSizeLow, m_xEtaAbsSizeHigh; //!< active area in xEta - Trk::RectangleBounds * m_bounds; //!< surface bound description + Trk::RectangleBounds m_bounds; //!< surface bound description }; /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ForwardModuleSideDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ForwardModuleSideDesign.h index 11e50c71cc7653955b944709b0ef77d020a851cb..9cf64bb4416042bcfdb4e58cf74be1ded0a9039f 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ForwardModuleSideDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ForwardModuleSideDesign.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -17,10 +17,10 @@ //Data member classes #include "SCT_ReadoutGeometry/SCT_ForwardFrameTransformation.h" #include "SCT_ReadoutGeometry/SCT_ForwardModuleSideGeometry.h" +#include "TrkSurfaces/TrapezoidBounds.h" namespace Trk{ - class TrapezoidBounds; - class SurfaceBounds; + class SurfaceBounds; } @@ -68,7 +68,7 @@ namespace InDetDD { int readoutSide = -1); /** Destructor: */ - virtual ~SCT_ForwardModuleSideDesign(); + virtual ~SCT_ForwardModuleSideDesign() = default; /////////////////////////////////////////////////////////////////// // Const methods: @@ -171,7 +171,7 @@ namespace InDetDD { private: SCT_ForwardModuleSideGeometry m_geometry; //!< geometry of module side SCT_ForwardFrameTransformation m_frame; //!< polar / cartesian frame transformation - Trk::TrapezoidBounds * m_bounds; + Trk::TrapezoidBounds m_bounds; }; diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripAnnulusDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripAnnulusDesign.h index 4c301aa644a4df5e5e3f3f0b172800c3abfa0bdd..d557e662d20bc18e6a05aa17debb665627280899 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripAnnulusDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripAnnulusDesign.h @@ -27,12 +27,13 @@ // Base class #include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" -#include <vector> -#include <stdexcept> // For throw stuff #include "InDetReadoutGeometry/SiCellId.h" #include "CLHEP/Geometry/Vector3D.h" // For unused phiMeasureSegment #include "CLHEP/Geometry/Transform3D.h" +#include <stdexcept> // For throw stuff +#include <vector> + namespace Trk { class RectangleBounds; class SurfaceBounds; @@ -53,8 +54,8 @@ public: const double &stripStart, const double &stripEnd); - ~StripAnnulusDesign(); - + ~StripAnnulusDesign() = default; + HepGeom::Point3D<double> sensorCenter() const; // Copy constructor and assignment: @@ -157,7 +158,7 @@ private: double m_pitch; double m_stripStartRadius; double m_stripEndRadius; - Trk::RectangleBounds *m_bounds; + std::unique_ptr<Trk::RectangleBounds> m_bounds; }; /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h index cf682b6d98f681003aa9f9693dabe2fbfc0afd01..be4e38e4883bd837816f5cb5d8454ce12452ea7c 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETREADOUTGEOMETRY_STRIPBOXDESIGN_H @@ -12,15 +12,17 @@ // Base class #include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" -#include <vector> -#include <stdexcept> // For throw stuff +#include "GeoModelKernel/GeoDefinitions.h" #include "InDetReadoutGeometry/SiCellId.h" +#include "TrkSurfaces/RectangleBounds.h" + #include "CLHEP/Geometry/Vector3D.h" // For unused phiMeasureSegment -#include "GeoModelKernel/GeoDefinitions.h" + +#include <stdexcept> // For throw stuff +#include <vector> namespace Trk { -class RectangleBounds; -class SurfaceBounds; + class SurfaceBounds; } namespace InDetDD { @@ -40,7 +42,7 @@ public: const double pitch, const double length); - ~StripBoxDesign(); + ~StripBoxDesign() = default; // Copy constructor and assignment: StripBoxDesign(const StripBoxDesign &design); @@ -154,7 +156,7 @@ private: int m_nStrips; double m_pitch; double m_length; - Trk::RectangleBounds *m_bounds; + Trk::RectangleBounds m_bounds; }; /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h index 68dff4a63170175d0da8b06c32daba051de85fa4..8178d2418b4ed1dc3c1536361c7438f9926ae30f 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h @@ -30,14 +30,16 @@ // Base class #include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" -#include <vector> -#include <stdexcept> // For throw stuff #include "InDetReadoutGeometry/SiCellId.h" +#include "TrkSurfaces/AnnulusBounds.h" + #include "CLHEP/Geometry/Vector3D.h" // For unused phiMeasureSegment #include "CLHEP/Geometry/Transform3D.h" +#include <vector> +#include <stdexcept> // For throw stuff + namespace Trk { -class AnnulusBounds; class SurfaceBounds; } @@ -59,7 +61,7 @@ public: const double &stereoAngle, const double ¢reR); - ~StripStereoAnnulusDesign(); + ~StripStereoAnnulusDesign() = default; HepGeom::Point3D<double> sensorCenter() const; @@ -194,7 +196,7 @@ private: const double m_stereo; const double m_R; const double m_lengthBF; - Trk::AnnulusBounds *m_bounds; + Trk::AnnulusBounds m_bounds; const double m_sinStereo; const double m_cosStereo; }; diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_BarrelModuleSideDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_BarrelModuleSideDesign.cxx index 0699d5ca3a96b9e979e7e76d00d3f296aa2edb17..179ab5350a5b0169cdd29ea3c05a8311c313db50 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_BarrelModuleSideDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_BarrelModuleSideDesign.cxx @@ -13,14 +13,10 @@ #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Geometry/Vector3D.h" -#include "TrkSurfaces/RectangleBounds.h" - #include <cmath> namespace InDetDD { -using std::abs; - // Constructor with parameters: SCT_BarrelModuleSideDesign::SCT_BarrelModuleSideDesign(const double thickness, const int crystals, @@ -58,15 +54,10 @@ SCT_BarrelModuleSideDesign::SCT_BarrelModuleSideDesign(const double thickness, m_xEtaAbsSizeLow = m_xEtaAbsSizeHigh = m_xPhiAbsSize = 0.0; } - m_bounds = new Trk::RectangleBounds(0.5*width(), 0.5*length()); + m_bounds = Trk::RectangleBounds(0.5*width(), 0.5*length()); } -SCT_BarrelModuleSideDesign::~SCT_BarrelModuleSideDesign() -{ - delete m_bounds; -} - // Returns distance to nearest detector edge // +ve = inside // -ve = outside @@ -75,8 +66,8 @@ SCT_BarrelModuleSideDesign::distanceToDetectorEdge(const SiLocalPosition & local double & etaDist, double & phiDist) const { // As the calculation is symmetric around 0,0 we only have to test it for one side. - double xEta = abs(localPosition.xEta() - m_xEtaStripPatternCentre); - double xPhi = abs(localPosition.xPhi() - m_xPhiStripPatternCentre); + double xEta = std::abs(localPosition.xEta() - m_xEtaStripPatternCentre); + double xPhi = std::abs(localPosition.xPhi() - m_xPhiStripPatternCentre); double xEtaEdge = 0.5 * length(); double xPhiEdge = 0.5 * width(); @@ -94,7 +85,7 @@ bool SCT_BarrelModuleSideDesign::nearBondGap(const SiLocalPosition & localPositi { // Symmetric around xEta = 0 so we can use absolute value. if (m_totalDeadLength==0) return false; - return ( abs(localPosition.xEta()) < 0.5*m_totalDeadLength + etaTol); + return ( std::abs(localPosition.xEta()) < 0.5*m_totalDeadLength + etaTol); } // check if the position is in active area @@ -102,10 +93,10 @@ bool SCT_BarrelModuleSideDesign::inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap) const { // in Phi - if (abs(chargePos.xPhi()-m_xPhiStripPatternCentre) > m_xPhiAbsSize) return false; + if (std::abs(chargePos.xPhi()-m_xPhiStripPatternCentre) > m_xPhiAbsSize) return false; // in Eta - double relEta = fabs(chargePos.xEta() - m_xEtaStripPatternCentre); + double relEta = std::abs(chargePos.xEta() - m_xEtaStripPatternCentre); if (relEta > m_xEtaAbsSizeHigh) return false; // bond gap @@ -119,11 +110,11 @@ bool SCT_BarrelModuleSideDesign::inActiveArea(const SiLocalPosition &chargePos, // an active area check, done in the Generator anyway, is removed here double SCT_BarrelModuleSideDesign::scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const { - double dstrip=fabs(chargePos.xPhi()-m_xPhiStripPatternCentre)/m_stripPitch; + double dstrip=std::abs(chargePos.xPhi()-m_xPhiStripPatternCentre)/m_stripPitch; dstrip=dstrip-static_cast<double>(int(dstrip))-0.5; // the above -0.5 is because we have an even number of strips, centre of detector // is in the middle of an interstrip gap - return fabs(dstrip); + return std::abs(dstrip); } std::pair<SiLocalPosition,SiLocalPosition> SCT_BarrelModuleSideDesign::endsOfStrip(const SiLocalPosition &position) const @@ -259,7 +250,7 @@ SCT_BarrelModuleSideDesign::cellIdOfPosition(const SiLocalPosition & localPositi const Trk::SurfaceBounds & SCT_BarrelModuleSideDesign::bounds() const { - return *m_bounds; + return m_bounds; } } // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideDesign.cxx index b8ac47c1f9df52b7a29005efbd157e4cd4c581a5..d5d70b297601d7cb044786eadc68ae21923ac03a 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideDesign.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,7 +16,6 @@ #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Geometry/Vector3D.h" #include "InDetReadoutGeometry/SiDiodesParameters.h" -#include "TrkSurfaces/TrapezoidBounds.h" namespace InDetDD { @@ -48,13 +47,7 @@ SCT_ForwardModuleSideDesign::SCT_ForwardModuleSideDesign(const double thickness, double radius = 0.5 * (radius1 + radius2 + halfHeight2 - halfHeight1); m_frame=SCT_ForwardFrameTransformation(etaCenter,phiCenter,radius); } - m_bounds = new Trk::TrapezoidBounds(0.5*minWidth(), 0.5*maxWidth(), 0.5*length()); -} - -// Destructor: -SCT_ForwardModuleSideDesign::~SCT_ForwardModuleSideDesign() -{ - delete m_bounds; + m_bounds = Trk::TrapezoidBounds(0.5*minWidth(), 0.5*maxWidth(), 0.5*length()); } void @@ -279,7 +272,7 @@ SCT_ForwardModuleSideDesign::shape() const const Trk::SurfaceBounds & SCT_ForwardModuleSideDesign::bounds() const { - return *m_bounds; + return m_bounds; } } // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideGeometry.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideGeometry.cxx index c8e7488e05e7ab70ea4976b049cdc89c85b58a7e..32853dd4b68ff3e661878262d4064fe3e7ee33c5 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideGeometry.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ForwardModuleSideGeometry.cxx @@ -16,7 +16,6 @@ namespace InDetDD { - using std::abs; using std::cos; using std::sin; @@ -89,10 +88,10 @@ SCT_ForwardModuleSideGeometry::distanceToDetectorEdge(const SiLocalPosition & lo // Distance to top/bottom. // Calculation symmetric around zero so we can use abs. - etaDist = m_halfLength - abs(localPosition.xEta()); + etaDist = m_halfLength - std::abs(localPosition.xEta()); // For phi distance use r*phiDiff. - phiDist = polar.r() * (m_rightSide - abs(polar.theta())); + phiDist = polar.r() * (m_rightSide - std::abs(polar.theta())); } @@ -114,7 +113,7 @@ bool SCT_ForwardModuleSideGeometry::inActiveArea(const SiLocalPosition &chargePo double xEta = chargePos.xEta(); double xPhi = chargePos.xPhi(); - if (abs(xEta) > m_halfLength) return false; + if (std::abs(xEta) > m_halfLength) return false; if (checkBondGap && m_nCrystals > 1) { // Check if in bond gap @@ -124,7 +123,7 @@ bool SCT_ForwardModuleSideGeometry::inActiveArea(const SiLocalPosition &chargePo // edge at xEta double edge = (xEta + m_radius) * m_tangent; - return (abs(xPhi) < edge); + return (std::abs(xPhi) < edge); } // DEPRECATED @@ -155,7 +154,7 @@ bool SCT_ForwardModuleSideGeometry::inActiveArea(const SCT_ForwardPolarPosition double SCT_ForwardModuleSideGeometry::stripPitch(const SCT_ForwardPolarPosition &polarPos) const { - return 2.0*polarPos.r()*fabs(sin(m_step*0.5)); + return 2.0*polarPos.r()*std::abs(sin(m_step*0.5)); } // give distance to the nearest diode in units of pitch, from 0.0 to 0.5, @@ -168,8 +167,8 @@ double SCT_ForwardModuleSideGeometry::scaledDistanceToNearestDiode(const SCT_For static_cast<int>(polarPos.theta()/m_step); else stripIndex = static_cast<int>(polarPos.theta()/m_step-1); const double thetaStrip = (stripIndex+0.5)*m_step; - const double pitch = 2.0*polarPos.r()*fabs(sin(m_step*0.5)); - return polarPos.r()*fabs(sin(polarPos.theta()-thetaStrip))/pitch; + const double pitch = 2.0*polarPos.r()*std::abs(sin(m_step*0.5)); + return polarPos.r()*std::abs(sin(polarPos.theta()-thetaStrip))/pitch; } // Method to calculate length of a module diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripAnnulusDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripAnnulusDesign.cxx index b600f1e9ecd248d4afa81458176042b24015d430..8d924b9434ef735be47f0962a1e2e438e7f1ea16 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripAnnulusDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripAnnulusDesign.cxx @@ -10,11 +10,6 @@ #include "Identifier/Identifier.h" #include "TrkSurfaces/RectangleBounds.h" -using namespace std; -using std::cos; -using std::sin; -using std::abs; - namespace InDetDD { StripAnnulusDesign::StripAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, @@ -40,10 +35,6 @@ StripAnnulusDesign::StripAnnulusDesign(const SiDetectorDesign::Axis &stripDirect std::unique_ptr<Trk::SurfaceBounds> m_bounds = std::make_unique<Trk::RectangleBounds>(width / 2.0, length / 2.0); // Awaiting new boundclass for Annulus shape } - StripAnnulusDesign::~StripAnnulusDesign() { - delete m_bounds; - } - HepGeom::Point3D<double> StripAnnulusDesign::sensorCenter() const { double centerR = (m_stripStartRadius + m_stripEndRadius) * 0.5; return HepGeom::Point3D<double>(centerR, 0., 0.); @@ -81,7 +72,7 @@ SiCellId StripAnnulusDesign::cellIdOfPosition(SiLocalPosition const &pos) const // // Find the strip // - int strip = floor(phi / m_pitch) + m_nStrips * 0.5; + int strip = std::floor(phi / m_pitch) + m_nStrips * 0.5; return SiCellId(strip); } @@ -90,8 +81,8 @@ SiLocalPosition StripAnnulusDesign::localPositionOfCell(SiCellId const &cellId) int strip = cellId.strip(); double r = (m_stripEndRadius - m_stripStartRadius) *0.5; double phi = (strip - m_nStrips*0.5 + 0.5) * m_pitch; - double xEta = r * cos(phi); - double xPhi = r * sin(phi); + double xEta = r * std::cos(phi); + double xPhi = r * std::sin(phi); return SiLocalPosition(xEta, xPhi, 0.0); } @@ -107,8 +98,8 @@ SiLocalPosition StripAnnulusDesign::localPositionOfCluster(SiCellId const &cellI double phi = pos.phi() + clusterWidth *0.5; double r = pos.r(); - pos.xPhi(r * sin(phi)); - pos.xEta(r * cos(phi)); + pos.xPhi(r * std::sin(phi)); + pos.xEta(r * std::cos(phi)); return pos; } @@ -124,10 +115,10 @@ std::pair<SiLocalPosition, SiLocalPosition> StripAnnulusDesign::endsOfStrip(SiLo double rEnd = m_stripEndRadius; double phi = (strip - m_nStrips*0.5 + 0.5) * m_pitch; - SiLocalPosition end1(rStart * cos(phi), rStart * sin(phi), 0.0); - SiLocalPosition end2(rEnd * cos(phi), rEnd * sin(phi), 0.0); + SiLocalPosition end1(rStart * std::cos(phi), rStart * std::sin(phi), 0.0); + SiLocalPosition end2(rEnd * std::cos(phi), rEnd * std::sin(phi), 0.0); - return pair<SiLocalPosition, SiLocalPosition>(end1, end2); + return std::pair<SiLocalPosition, SiLocalPosition>(end1, end2); } bool StripAnnulusDesign::inActiveArea(SiLocalPosition const &pos, bool /*checkBondGap*/) const { @@ -144,7 +135,7 @@ double StripAnnulusDesign::scaledDistanceToNearestDiode(SiLocalPosition const &p SiCellId cellId = cellIdOfPosition(pos); SiLocalPosition posStrip = localPositionOfCell(cellId); - return fabs(pos.xPhi() - posStrip.xPhi()) / m_pitch; + return std::abs(pos.xPhi() - posStrip.xPhi()) / m_pitch; } /// Return strip width, centre, length etc. Hard to find if this is used or not. diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx index e1299c9c44f800f70af0f4d526fd415899c9e8d9..d15c9d71dfffbc5eb713be60202693839d54ec00 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx @@ -1,16 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_ReadoutGeometry/StripBoxDesign.h" -#include <stdexcept> -#include <cmath> -#include "Identifier/Identifier.h" -#include "TrkSurfaces/RectangleBounds.h" + #include "GeoModelKernel/Units.h" +#include "Identifier/Identifier.h" -using namespace std; -using std::abs; +#include <stdexcept> +#include <cmath> namespace InDetDD { StripBoxDesign::StripBoxDesign(const SiDetectorDesign::Axis stripDirection, @@ -36,11 +34,7 @@ StripBoxDesign::StripBoxDesign(const SiDetectorDesign::Axis stripDirection, double width = m_nStrips * m_pitch; double fullLength = m_nRows * m_length; - m_bounds = new Trk::RectangleBounds(width / 2.0, fullLength / 2.0); -} - -StripBoxDesign::~StripBoxDesign() { - delete m_bounds; + m_bounds = Trk::RectangleBounds(width / 2.0, fullLength / 2.0); } void StripBoxDesign::getStripRow(SiCellId cellId, int *strip, int *row) const { @@ -82,20 +76,20 @@ void StripBoxDesign::neighboursOfCell(const SiCellId &cellId, const Trk::SurfaceBounds &StripBoxDesign::bounds() const { // Return smallest rectangle that fully encompasses the active area. - return *m_bounds; + return m_bounds; } SiCellId StripBoxDesign::cellIdOfPosition(SiLocalPosition const &pos) const { // // Find the row // - int strip = (int) floor(pos.xPhi() / m_pitch) + m_nStrips / 2; + int strip = static_cast<int>(std::floor(pos.xPhi() / m_pitch) + m_nStrips / 2); if (strip < 0 || strip >= m_nStrips) { return SiCellId(); // return an invalid id } - int row = (int) floor(pos.xEta() / m_length) + m_nRows / 2; + int row = static_cast<int>(std::floor(pos.xEta() / m_length) + m_nRows / 2); if (row < 0 || row >= m_nRows) { return SiCellId(); // return an invalid id @@ -150,7 +144,7 @@ std::pair<SiLocalPosition, SiLocalPosition> StripBoxDesign::endsOfStrip( SiLocalPosition end1(etaStart, phi, 0.0); SiLocalPosition end2(etaEnd, phi, 0.0); - return pair<SiLocalPosition, SiLocalPosition>(end1, end2); + return std::pair<SiLocalPosition, SiLocalPosition>(end1, end2); } bool StripBoxDesign::inActiveArea(SiLocalPosition const &pos, @@ -169,7 +163,7 @@ double StripBoxDesign::scaledDistanceToNearestDiode(SiLocalPosition const &pos) SiLocalPosition posStrip = localPositionOfCell(cellId); - return fabs(pos.xPhi() - posStrip.xPhi()) / m_pitch; + return std::abs(pos.xPhi() - posStrip.xPhi()) / m_pitch; } /// Return strip width, centre, length etc. Hard to find if this is used or not. @@ -235,8 +229,8 @@ void StripBoxDesign::distanceToDetectorEdge(SiLocalPosition const & pos, double & phiDist) const { // As the calculation is symmetric around 0,0 we only have to test it for one side. - double xEta = abs(pos.xEta()); //assuming centered around 0?!? - double xPhi = abs(pos.xPhi()); + double xEta = std::abs(pos.xEta()); //assuming centered around 0?!? + double xPhi = std::abs(pos.xPhi()); double xEtaEdge = 0.5 * length(); double xPhiEdge = 0.5 * width(); diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx index d59c28c0af09ac52bc133ba79a0ac9ebf352aa2e..0a357abdd34adb78903257b684bae64617a2937c 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx @@ -2,17 +2,13 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" +#include "Identifier/Identifier.h" + #include <stdexcept> #include <algorithm> // For upper_bound #include <iterator> // for std::distance() #include <cmath> -#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" -#include "Identifier/Identifier.h" -#include "TrkSurfaces/AnnulusBounds.h" - -using namespace std; -using std::cos; -using std::sin; namespace InDetDD { StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, @@ -21,10 +17,10 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis const int &readoutSide, const InDetDD::CarrierType &carrier, const int &nRows, - const vector<int> &nStrips, - const vector<double> &pitch, - const vector<double> &stripStartRadius, - const vector<double> &stripEndRadius, + const std::vector<int> &nStrips, + const std::vector<double> &pitch, + const std::vector<double> &stripStartRadius, + const std::vector<double> &stripEndRadius, const double &stereoAngle, const double ¢reR) : SCT_ModuleSideDesign(thickness, false, false, true, 1, 0, 0, 0, false, carrier, @@ -36,9 +32,9 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis m_stripEndRadius(stripEndRadius), m_stereo(stereoAngle), m_R(centreR), - m_lengthBF(2. * centreR * sin(stereoAngle*0.5)),// Eq. 5 p. 7 - m_sinStereo(sin(-m_stereo)), - m_cosStereo(cos(-m_stereo)) + m_lengthBF(2. * centreR * std::sin(stereoAngle*0.5)),// Eq. 5 p. 7 + m_sinStereo(std::sin(-m_stereo)), + m_cosStereo(std::cos(-m_stereo)) { if (nRows < 0) { throw std::runtime_error( @@ -72,12 +68,8 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis m_scheme.setDiodes(totalStrips); // AnnulusBounds(double minR, double maxR, double R, double phi, double phiS) - m_bounds = new Trk::AnnulusBounds(m_stripStartRadius[0], m_stripEndRadius.back(), m_R, m_nStrips[0] * m_pitch[0], m_stereo); - -} + m_bounds = Trk::AnnulusBounds(m_stripStartRadius[0], m_stripEndRadius.back(), m_R, m_nStrips[0] * m_pitch[0], m_stereo); -StripStereoAnnulusDesign::~StripStereoAnnulusDesign() { - delete m_bounds; } HepGeom::Point3D<double> StripStereoAnnulusDesign::sensorCenter() const { @@ -93,11 +85,11 @@ double StripStereoAnnulusDesign::sinStripAngleReco(double phiCoord, double etaCo double xSF = m_cosStereo * (x - m_R) - m_sinStereo * y + m_R; double ySF = m_sinStereo * (x - m_R) + m_cosStereo * y; - double phiPrime = atan2(ySF, xSF); + double phiPrime = std::atan2(ySF, xSF); // The minus sign below is because this routine is called by tracking software, which swaps x and y, then measures angles from y // to x - return -sin(phiPrime + m_stereo); + return -std::sin(phiPrime + m_stereo); } @@ -140,7 +132,7 @@ void StripStereoAnnulusDesign::neighboursOfCell(const SiCellId &cellId, std::vec const Trk::SurfaceBounds &StripStereoAnnulusDesign::bounds() const { - return *m_bounds; + return m_bounds; } SiCellId StripStereoAnnulusDesign::cellIdOfPosition(SiLocalPosition const &pos) const { @@ -152,11 +144,11 @@ SiCellId StripStereoAnnulusDesign::cellIdOfPosition(SiLocalPosition const &pos) return SiCellId(); // return an invalid id } - vector<double>::const_iterator endPtr = upper_bound(m_stripStartRadius.begin(), m_stripStartRadius.end(), r); + std::vector<double>::const_iterator endPtr = upper_bound(m_stripStartRadius.begin(), m_stripStartRadius.end(), r); int row = distance(m_stripStartRadius.begin(), endPtr) - 1; // Following should never happen, check is done on r above if (row < 0 || row >= m_nRows) { - cout << "ERROR! cellIdOfPosition: bad row = " << row << " for r = " << r << endl; + std::cout << "ERROR! cellIdOfPosition: bad row = " << row << " for r = " << r << std::endl; return SiCellId(); // return an invalid id } // @@ -169,8 +161,8 @@ SiCellId StripStereoAnnulusDesign::cellIdOfPosition(SiLocalPosition const &pos) // double xSF = m_cosStereo * (x - m_R) - m_sinStereo * y + m_R; double ySF = m_sinStereo * (x - m_R) + m_cosStereo * y; - double phiPrime = atan2(ySF, xSF); - int strip = floor(phiPrime / m_pitch[row]) + m_nStrips[row] *0.5; + double phiPrime = std::atan2(ySF, xSF); + int strip = std::floor(phiPrime / m_pitch[row]) + m_nStrips[row] *0.5; if (strip < 0) { // Outside return SiCellId(); // return an invalid id } @@ -193,12 +185,12 @@ SiLocalPosition StripStereoAnnulusDesign::stripPosAtR(int strip, int row, double double phiPrime = (strip - m_nStrips[row]*0.5 + 0.5) * m_pitch[row]; - double b = -2. * m_lengthBF * sin(m_stereo*0.5 + phiPrime); + double b = -2. * m_lengthBF * std::sin(m_stereo*0.5 + phiPrime); double c = m_lengthBF * m_lengthBF - r * r; - double rPrime = (-b + sqrt(b * b - 4. * c))*0.5; + double rPrime = (-b + std::sqrt(b * b - 4. * c))*0.5; - double xPrime = rPrime * cos(phiPrime); - double yPrime = rPrime * sin(phiPrime); + double xPrime = rPrime * std::cos(phiPrime); + double yPrime = rPrime * std::sin(phiPrime); double x = m_cosStereo * (xPrime - m_R) - m_sinStereo * yPrime + m_R; double y = m_sinStereo * (xPrime - m_R) + m_cosStereo * yPrime; @@ -236,10 +228,10 @@ SiLocalPosition StripStereoAnnulusDesign::localPositionOfCellPC(SiCellId const & // get phi of strip in the strip system double phiPrime = (strip - m_nStrips[row]*0.5 + 0.5) * m_pitch[row]; - double b = -2. * m_lengthBF * sin(m_stereo*0.5 + phiPrime); + double b = -2. * m_lengthBF * std::sin(m_stereo*0.5 + phiPrime); double c = m_lengthBF * m_lengthBF - r * r; // this is the radius in the strip system - double rPrime = (-b + sqrt(b * b - 4. * c))*0.5; + double rPrime = (-b + std::sqrt(b * b - 4. * c))*0.5; // flip this, since coordinate system is defined the other way round double phi = -1*phiPrime; @@ -276,7 +268,7 @@ std::pair<SiLocalPosition, SiLocalPosition> StripStereoAnnulusDesign::endsOfStri SiLocalPosition outerEnd = stripPosAtR(strip, row, m_stripEndRadius[row]); - return pair<SiLocalPosition, SiLocalPosition>(innerEnd, outerEnd); + return std::pair<SiLocalPosition, SiLocalPosition>(innerEnd, outerEnd); } bool StripStereoAnnulusDesign::inActiveArea(SiLocalPosition const &pos, bool /*checkBondGap*/) const { @@ -295,7 +287,7 @@ double StripStereoAnnulusDesign::scaledDistanceToNearestDiode(SiLocalPosition co // double posxP = m_cosStereo * (pos.xEta() - m_R) - m_sinStereo * pos.xPhi() + m_R; double posyP = m_sinStereo * (pos.xEta() - m_R) + m_cosStereo * pos.xPhi(); - double posphiP = atan2(posyP, posxP); + double posphiP = std::atan2(posyP, posxP); // // Get phiPrime of strip // @@ -303,10 +295,10 @@ double StripStereoAnnulusDesign::scaledDistanceToNearestDiode(SiLocalPosition co SiLocalPosition posStrip = localPositionOfCell(cellId); double posStripxP = m_cosStereo * (posStrip.xEta() - m_R) - m_sinStereo * posStrip.xPhi() + m_R; double posStripyP = m_sinStereo * (posStrip.xEta() - m_R) + m_cosStereo * posStrip.xPhi(); - double posStripphiP = atan2(posStripyP, posStripxP); + double posStripphiP = std::atan2(posStripyP, posStripxP); int strip, row; getStripRow(cellId, &strip, &row); - return fabs(posphiP - posStripphiP) / m_pitch[row]; + return std::abs(posphiP - posStripphiP) / m_pitch[row]; } /// Return strip width, centre, length etc. Hard to find if this is used or not. @@ -382,20 +374,20 @@ void StripStereoAnnulusDesign::distanceToDetectorEdge(SiLocalPosition const & po double rOuter = m_stripEndRadius[m_nRows - 1]; double xEta = pos.xEta(); double xPhi = pos.xPhi(); - double r = sqrt(xEta * xEta + xPhi * xPhi); + double r = std::sqrt(xEta * xEta + xPhi * xPhi); if (r < rInner) etaDist = r - rInner; else if (r > rOuter) etaDist = rOuter - r; else - etaDist = min(rOuter - r, r - rInner); + etaDist = std::min(rOuter - r, r - rInner); // For phi, we use the Strip frame. Transform to Strip-frame: double etaStrip = m_cosStereo * (xEta - m_R) - m_sinStereo * xPhi + m_R; double phiStrip = m_sinStereo * (xEta - m_R) + m_cosStereo * xPhi; // Put these into polar coordinates - double rStrip = sqrt(etaStrip * etaStrip + phiStrip * phiStrip); - double phiAngleStrip = atan2(phiStrip, etaStrip); + double rStrip = std::sqrt(etaStrip * etaStrip + phiStrip * phiStrip); + double phiAngleStrip = std::atan2(phiStrip, etaStrip); double phiAngleMax = m_pitch[0] * m_nStrips[0]*0.5; double phiAngleMin = -phiAngleMax; @@ -405,7 +397,7 @@ void StripStereoAnnulusDesign::distanceToDetectorEdge(SiLocalPosition const & po else if (phiAngleStrip > phiAngleMax) phiDist = rStrip * (phiAngleMax - phiAngleStrip); else - phiDist = rStrip * min(phiAngleMax - phiAngleStrip, phiAngleStrip - phiAngleMin); + phiDist = rStrip * std::min(phiAngleMax - phiAngleStrip, phiAngleStrip - phiAngleMin); return; } @@ -425,7 +417,7 @@ double StripStereoAnnulusDesign::stripLength(const InDetDD::SiCellId &cellId) co std::pair<SiLocalPosition, SiLocalPosition> end = endsOfStrip(lpoc); double dx = end.second.xEta() - end.first.xEta(); double dy = end.second.xPhi() - end.first.xPhi(); - return sqrt(dx * dx + dy * dy); + return std::sqrt(dx * dx + dy * dy); } diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx index 8efbc404c519a04f95f353b06a688e00daaf1eda..efb941aad16c92e25c629682d74c925c22d784ad 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx @@ -44,6 +44,7 @@ #include "CLHEP/Random/RandLandau.h" #include <algorithm> +#include <cmath> #include <memory> #include <sstream> #include <string> @@ -449,7 +450,7 @@ StatusCode SCT_FastDigitizationTool::digitize(const EventContext& ctx) const IdentifierHash detElHash = hitSiDetElement->identifyHash(); const double tanLorAng = m_sctTanLorentzAngleScalor*m_lorentzAngleTool->getTanLorentzAngle(detElHash); const int lorentzDirection = tanLorAng > 0. ? 1 : -1; - const bool useLorentzDrift = fabs(tanLorAng) > 0.01; + const bool useLorentzDrift = std::abs(tanLorAng) > 0.01; // shift parameters const double shift = m_lorentzAngleTool->getLorentzShift(detElHash); // lorenz angle effects : offset goes against the lorentzAngle @@ -503,7 +504,7 @@ StatusCode SCT_FastDigitizationTool::digitize(const EventContext& ctx) if (!hitSurface->bounds().insideLoc2(localEntry)) { // step towards the border - const double stepInY = signY*(fabs(localEntryY)-0.5*hitSiDetElement->length()); + const double stepInY = signY*(std::abs(localEntryY)-0.5*hitSiDetElement->length()); const double stepInX = stepInY*distX/distY; const double stepInZ = stepInY*distZ/distY; currentStep3D = Amg::Vector3D(stepInX,stepInY,stepInZ); @@ -681,7 +682,7 @@ StatusCode SCT_FastDigitizationTool::digitize(const EventContext& ctx) currentPosition3D += currentStep3D; } // if (currentPosition3D.z() > 0.501*signZ*thickness){ - if (fabs(currentPosition3D.z()) > 0.501*thickness) + if (std::abs(currentPosition3D.z()) > 0.501*thickness) { // step has led out of the silicon, correct for it lastStrip = true; @@ -858,7 +859,7 @@ StatusCode SCT_FastDigitizationTool::digitize(const EventContext& ctx) // Find length of strip at centre const double clusterWidth(potentialClusterRDOList.size()*hitSiDetElement->phiPitch(potentialClusterPosition)); //!< @TODO CHECK const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends(design->endsOfStrip(potentialClusterPosition)); - const double stripLength = fabs(ends.first.xEta()-ends.second.xEta()); + const double stripLength = std::abs(ends.first.xEta()-ends.second.xEta()); const InDet::SiWidth siWidth( Amg::Vector2D(int(potentialClusterRDOList.size()),1), Amg::Vector2D(clusterWidth,stripLength) ); // 2a) Cluster creation ------------------------------------ if (!m_clusterMaker.empty()) @@ -1060,7 +1061,7 @@ bool SCT_FastDigitizationTool::NeighbouringClusters(const std::vector<Identifier std::vector<Identifier>::const_iterator existingClusterRDOIter = existingClusterRDOList.begin(); for( ; existingClusterRDOIter != existingClusterRDOList.end(); ++existingClusterRDOIter) { - if(abs(m_sct_ID->strip(*existingClusterRDOIter) - m_sct_ID->strip(*potentialClusterRDOIter)) < 2) + if(std::abs(m_sct_ID->strip(*existingClusterRDOIter) - m_sct_ID->strip(*potentialClusterRDOIter)) < 2) { isNeighbour = true; break; diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py index b269a4895ad8530142fdeff83f36eaf6541b26cb..327807676eac0ab7acd4f0748bca29026a971a8b 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py +++ b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py @@ -124,7 +124,7 @@ def getSCT_FrontEnd(name="SCT_FrontEnd", **kwargs): sct_ReadCalibChipDataToolSetup = SCT_ReadCalibChipDataToolSetup() sct_ReadCalibChipDataToolSetup.setup() kwargs.setdefault("SCT_ReadCalibChipDataTool", sct_ReadCalibChipDataToolSetup.getTool()) - # DataCompressionMode: 1 is level mode x1x (default), 2 is edge mode 01x, 3 is expanded any hit xxx + # DataCompressionMode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1) from AthenaCommon.BeamFlags import jobproperties if digitizationFlags.PileUpPremixing: kwargs.setdefault("DataCompressionMode", 3) diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfigNew.py b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfigNew.py index 0f7abec4187b5aeb47f4cea2606d41c47f17cd08..42db1199644560516599d2a8b94cad8888b64cc4 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfigNew.py +++ b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfigNew.py @@ -190,7 +190,7 @@ def SCT_FrontEndCfg(flags, name="SCT_FrontEnd", **kwargs): # Setup the ReadCalibChip folders and Svc acc = SCT_ReadCalibChipDataCfg(flags) kwargs.setdefault("SCT_ReadCalibChipDataTool", acc.popPrivateTools()) - # DataCompressionMode: 1 is level mode x1x (default), 2 is edge mode 01x, 3 is expanded any hit xxx + # DataCompressionMode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1) if flags.Digitization.PileUpPremixing: kwargs.setdefault("DataCompressionMode", 3) elif flags.Detector.Overlay and flags.Input.isMC: diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_expandedmode.py b/InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_anyhitmode.py similarity index 72% rename from InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_expandedmode.py rename to InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_anyhitmode.py index d1186a38f1302ee6ef81e577a03cf4d7fdfba6b1..ec8ce74db6e268031cc58e5072951d413be22bf7 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_expandedmode.py +++ b/InnerDetector/InDetDigitization/SCT_Digitization/share/SCT_Digitization_jobOptions_anyhitmode.py @@ -1,4 +1,4 @@ -# JobOption fragment to activate expanded any hit mode +# JobOption fragment to activate any hit mode # Get the SCT Digitization Alg from AthenaCommon.AlgSequence import AlgSequence @@ -10,7 +10,7 @@ from AthenaCommon.AppMgr import ToolSvc from SCT_Digitization.SCT_DigitizationConf import SCT_FrontEnd theSCT_FrontEnd = SCT_FrontEnd("SCT_FrontEnd") -# DataCompressionMode: 1 is level mode(default), 2 is edge mode, 3 is expanded any hit mode +# DataCompressionMode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1) theSCT_FrontEnd.DataCompressionMode = 3 ToolSvc += theSCT_FrontEnd diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx index 93c63b2d19ac24a7cf3e64a2f4bad3409b91f1d2..aebb290d0f4d050a35fa7715c0513676d8c72d2e 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DetailedSurfaceChargesGenerator.cxx @@ -22,6 +22,9 @@ #include "TProfile.h" // for TProfile #include "TProfile2D.h" // for TProfile2D +// C++ Standard Library +#include <cmath> + using InDetDD::SiDetectorElement; using InDetDD::SCT_ModuleSideDesign; using InDetDD::SiLocalPosition; @@ -345,7 +348,7 @@ void SCT_DetailedSurfaceChargesGenerator::processSiHit(const SiDetectorElement* float tdrift{DriftTime(zReadout, element)}; //!< tdrift: perpandicular drift time if (tdrift>-2.0000002 and tdrift<-1.9999998) { ATH_MSG_DEBUG("Checking for rounding errors in compression"); - if ((fabs(z1)-0.5*sensorThickness)<0.000010) { + if ((std::abs(z1)-0.5*sensorThickness)<0.000010) { ATH_MSG_DEBUG("Rounding error found attempting to correct it. z1 = " << std::fixed << std::setprecision(8) << z1); if (z1<0.0) { z1= 0.0000005-0.5*sensorThickness; //set new coordinate to be 0.5nm inside wafer volume. @@ -720,7 +723,7 @@ double SCT_DetailedSurfaceChargesGenerator::induced(int istrip, double x, double if (y < 0. or y > m_bulk_depth) return 0.; const double xc{m_strip_pitch * (istrip + 0.5)}; - const double dx{fabs(x-xc)}; + const double dx{std::abs(x-xc)}; const int ix{static_cast<int>(dx / deltax)}; if (ix > 79) return 0.; const int iy{static_cast<int>(y / deltay)}; diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx index ab9a2aa71dd13aa7a7492ece11d98f58d8b0356d..205db667d0feddfec48de50bcbe5b6806af6c30a 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx @@ -29,6 +29,7 @@ #include "CLHEP/Random/RandomEngine.h" // C++ Standard Library +#include <cmath> #include <memory> #include <sstream> @@ -420,7 +421,7 @@ bool SCT_DigitizationTool::digitizeElement(const EventContext& ctx, SiChargedDio TimedHitPtr<SiHit> phit{*i++}; // skip hits which are more than 10us away - if (fabs(phit->meanTime()) < 10000. * CLHEP::ns) { + if (std::abs(phit->meanTime()) < 10000. * CLHEP::ns) { ATH_MSG_DEBUG("HASH = " << m_detID->wafer_hash(m_detID->wafer_id(phit->getBarrelEndcap(), phit->getLayerDisk(), phit->getPhiModule(), diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx index b29cde00aee63bafdce3d0f2f60e1ed4679cfe9e..e065036d12263b480933869594ad0c4901bea890 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx @@ -1,30 +1,28 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_FrontEnd.h" +#include "InDetIdentifier/SCT_ID.h" +#include "SiDigitization/SiHelper.h" +#include "SCT_Digitization/ISCT_Amp.h" +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" + // Random number #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGaussZiggurat.h" // for RandGaussZiggurat #include "CLHEP/Random/RandPoisson.h" #include "CLHEP/Random/RandomEngine.h" -#include "SiDigitization/SiHelper.h" -#include "SCT_Digitization/ISCT_Amp.h" - -#include "InDetIdentifier/SCT_ID.h" - -#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" -#include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" - // C++ Standard Library #include <algorithm> +#include <cmath> #include <iostream> // #define SCT_DIG_DEBUG -using namespace std; using namespace InDetDD; // constructor @@ -124,7 +122,7 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti float sinfi = sqrt(x1); float cosfi = sqrt(1.0 - x1); - sinfi = sinfi * m_OGcorr / fabs(m_OGcorr); + sinfi = sinfi * m_OGcorr / std::abs(m_OGcorr); float S = m_GainRMS * m_GainRMS + m_Ospread * m_Ospread; float D = (m_GainRMS * m_GainRMS - m_Ospread * m_Ospread) / (cosfi * cosfi - sinfi * sinfi); float S1 = sqrt((S + D) * 0.5); @@ -195,12 +193,12 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti data.m_NoiseFactor[i] = Noise * mode; // Fill the noise and offset values into the Analogue - if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode x1x + if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); - } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01x + } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); - } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode xxx or expanded read out mode + } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[2][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); @@ -279,7 +277,7 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti float x1 = (A - sqrt(A)) / (2.0 * A); sinfi[i] = sqrt(x1); cosfi[i] = sqrt(1.0 - x1); - sinfi[i] = sinfi[i] * m_OGcorr / fabs(m_OGcorr); + sinfi[i] = sinfi[i] * m_OGcorr / std::abs(m_OGcorr); float S = gainRMS * gainRMS + offsetRMS * offsetRMS; float D = (gainRMS * gainRMS - offsetRMS * offsetRMS) / (cosfi[i] * cosfi[i] - sinfi[i] * sinfi[i]); S1[i] = sqrt((S + D) / 2.0); @@ -317,12 +315,12 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti data.m_NoiseFactor[i] = noiseByChipVect[chip]; // Fill the noise and offset values into the Analogue - if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode x1x + if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); - } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01x + } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); - } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode xxx or expanded read out mode + } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); data.m_Analogue[2][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine); @@ -683,7 +681,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect const list_t &ChargesOnStrip = diode.totalCharge().chargeComposition(); - if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode x1x + if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X // Amplifier response data.m_Analogue[1][strip] += data.m_GainFactor[strip] * m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold); @@ -695,7 +693,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect if (strip > 0) { data.m_Analogue[1][strip - 1] += data.m_GainFactor[strip - 1] * response[0]; } - } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01x + } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X // Amplifier response m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold, response); for (short bin = 0; bin < bin_max; ++bin) { @@ -711,7 +709,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect data.m_Analogue[bin][strip - 1] += data.m_GainFactor[strip - 1] * response[bin]; } } - } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode xxx or expanded read out mode + } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode // Amplifier response m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold, response); for (short bin = 0; bin < bin_max; ++bin) { @@ -752,7 +750,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c if (roCell.isValid()) { int strip = roCell.strip(); if (strip > -1 and strip < m_strip_max) { - if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode x1x + if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X if (data.m_Analogue[1][strip] < m_Threshold) { SiHelper::belowThreshold(diode, true); // Below strip diode signal threshold data.m_StripHitsOnWafer[strip] = -1; @@ -763,7 +761,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c data.m_StripHitsOnWafer[strip] = 1; SiHelper::SetTimeBin(diode, 2, &msg()); // set timebin info } - } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01x + } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X if ((data.m_Analogue[0][strip] >= m_Threshold or data.m_Analogue[1][strip] < m_Threshold)) { SiHelper::belowThreshold(diode, true); // Below strip diode signal threshold data.m_StripHitsOnWafer[strip] = -1; @@ -841,7 +839,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti } if (data.m_Analogue[1][strip] > 0) { // Better way of doing this?! // set data.m_StripHitsOnWafer to x in prepareGainAndOffset - if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode x1x + if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X if (data.m_Analogue[1][strip] < m_Threshold) { data.m_StripHitsOnWafer[strip] = -2; // Below threshold } else { @@ -850,7 +848,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti ATH_MSG_ERROR("Can't add noise hit diode to collection"); } } - } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01x + } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X if ((data.m_Analogue[0][strip] >= m_Threshold or data.m_Analogue[1][strip] < m_Threshold)) { data.m_StripHitsOnWafer[strip] = -2; // Below threshold } else { diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h index 3096cb0b9372496091c5478d0e36180e9e4d7450..fd09f24cc844490a6831e0dc026e88e8ff5ca16b 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -124,8 +124,8 @@ class SCT_FrontEnd : public extends<AthAlgTool, ISCT_FrontEnd> { FloatProperty m_OGcorr{this, "OffsetGainCorrelation", 0.00001, "Gain/offset correlation for the strips"}; FloatProperty m_Threshold{this, "Threshold", 1.0, "Threshold"}; FloatProperty m_timeOfThreshold{this, "TimeOfThreshold", 30.0, "Threshold time"}; - ShortProperty m_data_compression_mode{this, "DataCompressionMode", 1, "Front End Data Compression Mode"}; - ShortProperty m_data_readout_mode{this, "DataReadOutMode", 0, "Front End Data Read out mode Mode"}; + ShortProperty m_data_compression_mode{this, "DataCompressionMode", 1, "Front End Data Compression Mode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1)"}; + ShortProperty m_data_readout_mode{this, "DataReadOutMode", 0, "Front End Data Read out mode Mode: 0 is condensed mode and 1 is expanded mode"}; BooleanProperty m_useCalibData{this, "UseCalibData", true, "Flag to set the use of calibration data for noise, Gain,offset etc."}; ToolHandle<ISCT_Amp> m_sct_amplifier{this, "SCT_Amp", "SCT_Amp", "Handle the Amplifier tool"}; //!< Handle the Amplifier tool diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx index c1a4d63885f91530eaeec34bf692b7f85f5b88a7..d8a74cebf9eeac1f88090e886eda806ab81c1ad9 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_SurfaceChargesGenerator.cxx @@ -24,15 +24,13 @@ #include "CLHEP/Random/RandGaussZiggurat.h" #include "CLHEP/Units/SystemOfUnits.h" -// STL +// C++ Standard Library #include <cmath> using InDetDD::SiDetectorElement; using InDetDD::SCT_ModuleSideDesign; using InDetDD::SiLocalPosition; -using namespace std; - // constructor SCT_SurfaceChargesGenerator::SCT_SurfaceChargesGenerator(const std::string& type, const std::string& name, @@ -403,7 +401,7 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element, float t_drift{driftTime(zReadout, element)}; // !< t_drift: perpandicular drift time if (t_drift>-2.0000002 and t_drift<-1.9999998) { ATH_MSG_DEBUG("Checking for rounding errors in compression"); - if ((fabs(z1) - 0.5 * thickness) < 0.000010) { + if ((std::abs(z1) - 0.5 * thickness) < 0.000010) { ATH_MSG_DEBUG("Rounding error found attempting to correct it. z1 = " << std::fixed << std::setprecision(8) << z1); if (z1 < 0.0) { z1 = 0.0000005 - 0.5 * thickness; diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt index 4c6340a28227d399e04b87250b4c38a8456b4883..5fe6725f6bc37d3a19729d370a0e4537271b2bf2 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt @@ -29,7 +29,6 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetSimEvent InnerDetector/InDetSimUtils/TRT_PAI_Process - MagneticField/MagFieldInterfaces Simulation/HitManagement MagneticField/MagFieldElements MagneticField/MagFieldConditions ) @@ -45,7 +44,7 @@ atlas_add_component( TRT_Digitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel PileUpToolsLib AthenaPoolUtilities GeoModelUtilities GeoPrimitives Identifier EventInfo GeneratorObjects TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetSimEvent MagFieldInterfaces HitManagement MagFieldElements MagFieldConditions) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel PileUpToolsLib AthenaPoolUtilities GeoModelUtilities GeoPrimitives Identifier EventInfo GeneratorObjects TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetSimEvent HitManagement MagFieldElements MagFieldConditions) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx index 5063ecfaf8ef2a37cbe19863c7cc87a766647879..8be4261e588c3f65e2840c54c9cd4342ff948cdb 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx @@ -155,9 +155,6 @@ StatusCode TRTDigitizationTool::initialize() //Retrieve TRT_CalDbTool ATH_CHECK(m_calDbTool.retrieve()); - // Get the magnetic field service - ATH_CHECK(m_magneticfieldsvc.retrieve()); - m_minpileuptruthEkin = m_settings->pileUpSDOsMinEkin(); // Set SDO readout range @@ -186,7 +183,7 @@ StatusCode TRTDigitizationTool::initialize() } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ATH_CHECK( m_fieldCondObjInputKey.initialize() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// return StatusCode::SUCCESS; @@ -321,14 +318,12 @@ StatusCode TRTDigitizationTool::lateInitialize(const EventContext& ctx) { ITRT_SimDriftTimeTool *pTRTsimdrifttimetool = &(*m_TRTsimdrifttimetool); - MagField::IMagFieldSvc *pMagfieldsvc = &(*m_magneticfieldsvc); const ITRT_CalDbTool* calDbTool=m_calDbTool.get(); m_pProcessingOfStraw = new TRTProcessingOfStraw( m_settings, m_manager, TRTpaiToolXe, pTRTsimdrifttimetool, - pMagfieldsvc, m_pElectronicsProcessing, m_pNoise, m_pDigConditions, @@ -361,11 +356,11 @@ StatusCode TRTDigitizationTool::processStraws(const EventContext& ctx, if (m_settings->useMagneticFieldMap()) { // Get field cache object - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; if (fieldCondObj == nullptr) { - ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key()); + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); return StatusCode::FAILURE; } fieldCondObj->getInitializedCache (fieldCache); diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h index d4f4f520a5878b6b4107623ff27574fb7fc1985a..9ad824c3832a4c68d545fcc5a31a7c98b379b499 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.h @@ -27,7 +27,6 @@ #include "TRTDigit.h" // For magneticfield -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "StoreGate/ReadHandleKey.h" @@ -133,10 +132,9 @@ private: ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc", "Merge service"}; ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number service ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc{this, "TRT_StrawNeighbourSvc", "TRT_StrawNeighbourSvc", ""}; - ServiceHandle < MagField::IMagFieldSvc > m_magneticfieldsvc{this, "MagFieldSvc", "AtlasFieldSvc", "MagFieldSvc used by TRTProcessingOfStraw"}; // Read handle for conditions object to get the field cache - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", - "Name of the Magnetic Field conditions object key"}; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."}; SG::ReadHandleKey<TRTUncompressedHitCollection> m_hitsContainerKey{this, "DataObjectName", "TRTUncompressedHits", "Data Object Name"}; std::string m_dataObjectName{""}; diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx index 0747a150eefee9626cdc12eb8e657d5a0311c2b6..2a5154bc67f6b7301e977c4e5b8fe599627ba574 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.cxx @@ -41,9 +41,6 @@ #include <cmath> #include <cstdlib> //Always include this when including cmath! -// For magneticfield -#include "MagFieldInterfaces/IMagFieldSvc.h" - // Logging #include "AthenaBaseComps/AthMsgStreamMacros.h" @@ -52,7 +49,6 @@ TRTProcessingOfStraw::TRTProcessingOfStraw(const TRTDigSettings* digset, const InDetDD::TRT_DetectorManager* detmgr, ITRT_PAITool* paitoolXe, ITRT_SimDriftTimeTool* simdrifttool, - MagField::IMagFieldSvc * magfieldsvc, TRTElectronicsProcessing * ep, TRTNoise * noise, TRTDigCondBase* digcond, @@ -76,7 +72,6 @@ TRTProcessingOfStraw::TRTProcessingOfStraw(const TRTDigSettings* digset, m_pDigConditions(digcond), m_pParticleTable(pdt), m_alreadywarnedagainstpdg0(false), - m_magneticfieldsvc(magfieldsvc), m_msg("TRTProcessingOfStraw"), m_id_helper(trt_id) @@ -609,11 +604,8 @@ void TRTProcessingOfStraw::ClustersToDeposits (MagField::AtlasFieldCache& fieldC globalPosition[1]=TRThitGlobalPos[1]*CLHEP::mm; globalPosition[2]=TRThitGlobalPos[2]*CLHEP::mm; - // MT Field cache is stored in cache - - // MT version uses cache, temporarily keep old version - if (fieldCache.useNewBfieldCache()) fieldCache.getField (globalPosition.data(), mField.data()); - else m_magneticfieldsvc->getField(&globalPosition, &mField); + // MT Field cache is stored in cache + fieldCache.getField (globalPosition.data(), mField.data()); map_x2 = mField.x()*mField.x(); // would be zero for a uniform field map_y2 = mField.y()*mField.y(); // would be zero for a uniform field diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h index 9f860212f343df8c3fd42486056484318d12484d..fd4702e88957f16d243e5fffd8e76c9e3b665f19 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h @@ -39,8 +39,6 @@ class TRTUncompressedHit; class ITRT_PAITool; class ITRT_SimDriftTimeTool; -namespace MagField { class IMagFieldSvc; } - namespace InDetDD { class TRT_DetectorManager; } class TRTDigSettings; @@ -57,7 +55,6 @@ public: const InDetDD::TRT_DetectorManager*, ITRT_PAITool*, ITRT_SimDriftTimeTool*, - MagField::IMagFieldSvc * magfieldsvc, TRTElectronicsProcessing * ep, TRTNoise * noise, TRTDigCondBase* digcond, @@ -237,8 +234,6 @@ private: Amg::Vector3D getGlobalPosition( int hitID, const TimedHitPtr<TRTUncompressedHit> *theHit ); - //Magnetic field stuff - MagField::IMagFieldSvc* m_magneticfieldsvc; mutable Athena::MsgStreamMember m_msg; protected: diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt index 34ec8b55bccdf5eb92526919b686767ae27056d6..8f3e63f96d16469556043e84310c8911394b5fd5 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt @@ -4,8 +4,16 @@ atlas_subdir( InDetEventAthenaPool ) # Component(s) in the package: -atlas_add_poolcnv_library( InDetEventAthenaPoolPoolCnv +atlas_add_library( InDetEventAthenaPool InDetEventAthenaPool/*.h src/*.h src/*.cxx + PUBLIC_HEADERS InDetEventAthenaPool + LINK_LIBRARIES Identifier GeneratorObjectsTPCnv AthAllocators AthContainers + AthenaBaseComps AthenaKernel SGTools StoreGateLib AthenaPoolCnvSvcLib + AthenaPoolUtilities AtlasSealCLHEP GaudiKernel InDetIdentifier + InDetReadoutGeometry TRT_ReadoutGeometry InDetEventTPCnv InDetRawData InDetSimData + InDetLowBetaInfo InDetPrepRawData SCT_ConditionsData TrkTrack ) + +atlas_add_poolcnv_library( InDetEventAthenaPoolPoolCnv FILES InDetRawData/PixelRDO_Container.h InDetRawData/SCT_RDO_Container.h InDetRawData/TRT_RDO_Container.h InDetPrepRawData/TRT_DriftCircleContainer.h InDetPrepRawData/PixelClusterContainer.h @@ -20,7 +28,7 @@ atlas_add_poolcnv_library( InDetEventAthenaPoolPoolCnv AthenaBaseComps AthenaKernel SGTools StoreGateLib AthenaPoolCnvSvcLib AthenaPoolUtilities AtlasSealCLHEP GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetEventTPCnv InDetRawData InDetSimData - InDetLowBetaInfo InDetPrepRawData SCT_ConditionsData TrkTrack ) + InDetLowBetaInfo InDetPrepRawData SCT_ConditionsData TrkTrack InDetEventAthenaPool ) atlas_add_dictionary( InDetEventAthenaPoolCnvDict InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h @@ -28,7 +36,6 @@ atlas_add_dictionary( InDetEventAthenaPoolCnvDict LINK_LIBRARIES Identifier GeneratorObjectsTPCnv ) # Install files from the package: -atlas_install_headers( InDetEventAthenaPool ) atlas_install_joboptions( share/*.py ) # Set up (a) test(s) for the converter(s): @@ -42,3 +49,19 @@ else() message( WARNING "Couldn't find AthenaPoolUtilitiesTest. No test(s) set up." ) endif() + +# Set up the tests of the package: +foreach( name + InDetSimDataCollectionCnv_p1_test + InDetSimDataCollectionCnv_p2_test + InDetSimDataCollectionCnv_p3_test ) + + atlas_add_test( ${name} + SOURCES test/${name}.cxx + LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} + AtlasHepMCLib IdDict IdDictParser InDetEventAthenaPool TestTools + ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" + PROPERTIES TIMEOUT 300 ) + set_target_properties ( InDetEventAthenaPool_${name} PROPERTIES ENABLE_EXPORTS True ) + +endforeach() diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/share/InDetEventAthenaPool_test.txt b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/share/InDetEventAthenaPool_test.txt new file mode 100644 index 0000000000000000000000000000000000000000..17b0492d2068b4539b318b7d46e23acf2224faff --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/share/InDetEventAthenaPool_test.txt @@ -0,0 +1 @@ +ApplicationMgr.ExtSvc += { "StoreGateSvc", "StoreGateSvc/DetectorStore" }; diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv.cxx index c7bc62d85e919f84d8de9b516cc128d54dce5c00..3357baf29b5b7d77e51f130f23e570cba0216e79 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RDO_ContainerCnv.h" @@ -28,7 +28,7 @@ namespace { } } else { - os<<" [SCT_RDO_Container==NULL]"; + os<<" [SCT_RDO_Container==nullptr]"; } return os.str(); } diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv_p0.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv_p0.cxx index 4228ff089e618cbfae37daf371d4ca30078bb377..3d2848f9a1b04ba550748b3a8c61ddd31dcae4e9 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv_p0.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/SCT_RDO_ContainerCnv_p0.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RDO_ContainerCnv_p0.h" @@ -22,7 +22,7 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv_p0::createTransient(const SCT_RDO_Contai const InDetRawDataCollection<SCT1_RawData>* rdoCollOld = *it; if (rdoCollOld==nullptr) { - throw std::runtime_error("Got NULL collection reading old format SCT_RDO_Container"); + throw std::runtime_error("Got nullptr of collection reading old format SCT_RDO_Container"); } // Ugly cast... The new format does not need it in its converters. diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2b89522aa6accee2447fd0f9962cf20913b19b8e --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h @@ -0,0 +1,159 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h + * @author Susumu Oda <Susumu.Oda@cern.ch> + * @date 2020-05-22 + * @brief Definitions of common methods for regression tests of InDetSimDataCollectionCnv_pX. + * Based on MuonEventTPCnv/test/MuonSimDataCollectionCnv_p1_test.cxx + * and InDetEventTPCnv/test/PixelClusterContainerCnv_p1_test.cxx. + */ + +#undef NDEBUG + +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "InDetIdentifier/PixelID.h" +#include "IdDictParser/IdDictParser.h" +#include "SGTools/TestStore.h" +#include "StoreGate/StoreGateSvc.h" +#include "TestTools/initGaudi.h" +#include "TestTools/leakcheck.h" + +#include "GaudiKernel/MsgStream.h" + +#include <cassert> +#include <iostream> + + +void compare(const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert( p1.isValid() == p2.isValid() ); + assert( p1.barcode() == p2.barcode() ); + assert( p1.eventIndex() == p2.eventIndex() ); + assert( p1.getEventCollectionAsChar() == p2.getEventCollectionAsChar() ); + assert( p1.cptr() == p2.cptr() ); + assert( p1 == p2 ); +} + + +void compare(const InDetSimData& p1, + const InDetSimData& p2) +{ + assert(p1.word() == p2.word()); + const std::vector<InDetSimData::Deposit>& dep1 = p1.getdeposits(); + const std::vector<InDetSimData::Deposit>& dep2 = p2.getdeposits(); + assert(dep1.size() == dep2.size()); + // In InDetSimData.h, typedef std::pair<HepMcParticleLink, float> Deposit; + for (size_t i = 0; i < dep1.size(); i++) { + compare(dep1[i].first, dep2[i].first); + assert(dep1[i].first == dep2[i].first); + assert(dep1[i].second == dep2[i].second); + } +} + + +void compare(const InDetSimDataCollection& p1, + const InDetSimDataCollection& p2) +{ + assert(p1.size() == p2.size()); + InDetSimDataCollection::const_iterator it1 = p1.begin(); + InDetSimDataCollection::const_iterator it2 = p2.begin(); + for (; it1 != p1.end(); ++it1, ++it2) { + assert(it1->first == it2->first); + compare(it1->second, it2->second); + } +} + + +// TCnv: InDetSimDataCollectionCnv_pX +// T: InDetSimDataCollection_pX +template<typename TCnv, typename T> +void testit(const InDetSimDataCollection& trans1) +{ + MsgStream log(0, "test"); + TCnv cnv; + T pers; + cnv.transToPers(&trans1, &pers, log); + InDetSimDataCollection trans2; + cnv.persToTrans(&pers, &trans2, log); + + compare(trans1, trans2); +} + + +// TCnv: InDetSimDataCollectionCnv_pX +// T: InDetSimDataCollection_pX +template<typename TCnv, typename T> +void test1(std::vector<HepMC::GenParticle*>& genPartVector) +{ + std::cout << "test1\n"; + const HepMC::GenParticle *particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(particle->barcode(), particle->parent_event()->event_number()); + assert(dummyHMPL.cptr()==particle); + Athena_test::Leakcheck check; + + InDetSimDataCollection trans1; + // Assumme genPartVector is filled by Athena_test::initMcEventCollection. Do not check the vector size. + for (int i=0; i<3; i++) { + std::vector<InDetSimData::Deposit> deps; + HepMcParticleLink trkLink1(genPartVector.at(0+(3*i))->barcode(), genPartVector.at(0+(3*i))->parent_event()->event_number()); + deps.emplace_back(trkLink1, 2.5+i); + HepMcParticleLink trkLink2(genPartVector.at(1+(3*i))->barcode(), genPartVector.at(1+(3*i))->parent_event()->event_number()); + deps.emplace_back(trkLink2, 13.5+i); + HepMcParticleLink trkLink3(genPartVector.at(2+(3*i))->barcode(), genPartVector.at(2+(3*i))->parent_event()->event_number()); + deps.emplace_back(trkLink3, 23.5+i); + + trans1[Identifier(1234+i)] = InDetSimData(deps, 4321+i); + trans1[Identifier(2345+i)] = InDetSimData(deps); + } + testit<TCnv, T>(trans1); +} + + +void makePixelID(ISvcLocator* pSvcLoc) +{ + auto pix_id = std::make_unique<PixelID>(); + IdDictParser parser; + parser.register_external_entity("InnerDetector", "IdDictInnerDetector.xml"); + IdDictMgr& idd = parser.parse("IdDictParser/ATLAS_IDS.xml"); + pix_id->initialize_from_dictionary(idd); + + StoreGateSvc* detStore = nullptr; + assert(pSvcLoc->service("DetectorStore", detStore).isSuccess()); + assert(detStore->record(std::move(pix_id), "PixelID")); +} + + +// TCnv: InDetSimDataCollectionCnv_pX +// T: InDetSimDataCollection_pX +template<typename TCnv, typename T> +int commonMain() +{ + // Initialize Gaudi + ISvcLocator* pSvcLoc = nullptr; + if (!Athena_test::initGaudi("InDetEventAthenaPool_test.txt", pSvcLoc)) { + std::cerr << "This test can not be run (initGaudi)" << std::endl; + return 0; + } + + // Make PixelID for InDetSimDataCollectionCnv_pX (TCnv) + makePixelID(pSvcLoc); + + std::vector<HepMC::GenParticle*> genPartVector; + // Fill genPartVector + // false is to skip Athena_test::initGaudi in Athena_test::initMcEventCollection. + if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector, false)) { + std::cerr << "This test can not be run (initMcEventCollection)" << std::endl; + return 0; + } + + test1<TCnv, T>(genPartVector); + + return 0; +} diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p1_test.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p1_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6c8b82505eb860ae5b2ec4b35e4521cf996ccd90 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p1_test.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p1_test.cxx + * @author Susumu Oda <Susumu.Oda@cern.ch> + * @date 2020-05-22 + * @brief Regression tests. + */ + +#undef NDEBUG + +#include "../src/InDetSimDataCollectionCnv_p1.h" + +#include "InDetSimDataCollectionCnv_common_test.h" + + +int main() +{ + return commonMain<InDetSimDataCollectionCnv_p1, InDetSimDataCollection_p1>(); +} diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p2_test.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p2_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fb1a5308198af748594dc0a89412075a4b1ef8e5 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p2_test.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p2_test.cxx + * @author Susumu Oda <Susumu.Oda@cern.ch> + * @date 2020-05-22 + * @brief Regression tests. + */ + +#undef NDEBUG + +#include "../src/InDetSimDataCollectionCnv_p2.h" + +#include "InDetSimDataCollectionCnv_common_test.h" + + +int main() +{ + return commonMain<InDetSimDataCollectionCnv_p2, InDetSimDataCollection_p2>(); +} diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p3_test.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p3_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3f7ec4523e1f5b2426236752b083b6e6e716bcbf --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p3_test.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p3_test.cxx + * @author Susumu Oda <Susumu.Oda@cern.ch> + * @date 2020-05-22 + * @brief Regression tests. + */ + +#undef NDEBUG + +#include "../src/InDetSimDataCollectionCnv_p3.h" + +#include "InDetSimDataCollectionCnv_common_test.h" + + +int main() +{ + return commonMain<InDetSimDataCollectionCnv_p3, InDetSimDataCollection_p3>(); +} diff --git a/InnerDetector/InDetEventCnv/InDetEventCnvTools/InDetEventCnvTools/InDetEventCnvTool.h b/InnerDetector/InDetEventCnv/InDetEventCnvTools/InDetEventCnvTools/InDetEventCnvTool.h index 91ebe89d7770b1d1ef5e7f0eeb62fcbf58ec85b7..f3a67fd6dd38a632b9080919fb748fcd3e4c660c 100755 --- a/InnerDetector/InDetEventCnv/InDetEventCnvTools/InDetEventCnvTools/InDetEventCnvTool.h +++ b/InnerDetector/InDetEventCnv/InDetEventCnvTools/InDetEventCnvTools/InDetEventCnvTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETEVENTCNVTOOL_H @@ -37,7 +37,8 @@ namespace InDet { See "mainpage" for discussion of jobOpts. */ - class InDetEventCnvTool : virtual public Trk::ITrkEventCnvTool, public AthAlgTool { +class InDetEventCnvTool : public extends<AthAlgTool, Trk::ITrkEventCnvTool> +{ public: enum InDetConcreteType { SCT, Pixel, TRT, Unknown }; @@ -46,27 +47,33 @@ namespace InDet { virtual ~InDetEventCnvTool() = default; - virtual StatusCode initialize(); + virtual StatusCode initialize() override; - virtual void checkRoT( const Trk::RIO_OnTrack& rioOnTrack ) const; + virtual void checkRoT( const Trk::RIO_OnTrack& rioOnTrack ) const override; /** use the passed identifier to recreate the detector element and PRD links on the passed RIO_OnTrack @param[in] rioOnTrack The RIO_OnTrack we're interested in @return std::pair of the pointers to the two corresponding objects*/ virtual std::pair<const Trk::TrkDetElementBase*, const Trk::PrepRawData*> - getLinks( Trk::RIO_OnTrack& rioOnTrack ) const; + getLinks( Trk::RIO_OnTrack& rioOnTrack ) const override; /** @copydoc Trk::ITrkEventCnvTool::prepareRIO_OnTrack( Trk::RIO_OnTrack* rot)*/ - virtual void prepareRIO_OnTrack( Trk::RIO_OnTrack* rot) const; + virtual void prepareRIO_OnTrack( Trk::RIO_OnTrack* rot) const override; + /** Similar, but just return the EL components rather then + changing ROT. */ + virtual void prepareRIO_OnTrackLink( const Trk::RIO_OnTrack* rot, + ELKey_t& key, + ELIndex_t& index ) const override; + /** @copydoc Trk::ITrkEventCnvTool::recreateRIO_OnTrack( Trk::RIO_OnTrack* rot)*/ - virtual void recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const; + virtual void recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const override; /** Return the detectorElement associated with this Identifier*/ - virtual const Trk::TrkDetElementBase* getDetectorElement(const Identifier& id, const IdentifierHash& idHash) const; + virtual const Trk::TrkDetElementBase* getDetectorElement(const Identifier& id, const IdentifierHash& idHash) const override; /** Return the detectorElement associated with this Identifier*/ - virtual const Trk::TrkDetElementBase* getDetectorElement(const Identifier& id) const; + virtual const Trk::TrkDetElementBase* getDetectorElement(const Identifier& id) const override; private: diff --git a/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx b/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx index d0ff5d6e4f4d6f405ac2f39772e751c43fdc382d..7e8ff0e44ee91b2ed7e1f139b717ffe463c7e6ff 100755 --- a/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx @@ -32,7 +32,7 @@ InDet::InDetEventCnvTool::InDetEventCnvTool(const std::string& t, const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), + base_class(t,n,p), m_setPrepRawDataLink(false), m_IDHelper(nullptr), m_pixelHelper(nullptr), @@ -40,7 +40,6 @@ InDet::InDetEventCnvTool::InDetEventCnvTool(const std::string& t, m_TRTHelper(nullptr), m_idDictMgr(nullptr) { - declareInterface<ITrkEventCnvTool>(this); declareProperty("RecreatePRDLinks", m_setPrepRawDataLink); } @@ -160,6 +159,29 @@ void InDet::InDetEventCnvTool::prepareRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const return; } +void +InDet::InDetEventCnvTool::prepareRIO_OnTrackLink( const Trk::RIO_OnTrack *RoT, + ELKey_t& key, + ELIndex_t& index) const +{ + const InDet::PixelClusterOnTrack* pixel = dynamic_cast<const InDet::PixelClusterOnTrack*>(RoT); + if (pixel!=0) { + prepareRIO_OnTrackElementLink<const InDet::PixelClusterContainer, InDet::PixelClusterOnTrack>(pixel, key, index); + return; + } + const InDet::SCT_ClusterOnTrack* sct = dynamic_cast<const InDet::SCT_ClusterOnTrack*>(RoT); + if (sct!=0) { + prepareRIO_OnTrackElementLink<const InDet::SCT_ClusterContainer, InDet::SCT_ClusterOnTrack>(sct, key, index); + return; + } + const InDet::TRT_DriftCircleOnTrack* trt = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(RoT); + if (trt!=0) { + prepareRIO_OnTrackElementLink<const InDet::TRT_DriftCircleContainer, InDet::TRT_DriftCircleOnTrack>(trt, key, index); + return; + } + return; +} + void InDet::InDetEventCnvTool::recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const { std::pair<const Trk::TrkDetElementBase *, const Trk::PrepRawData *> pair = getLinks( *RoT ); Trk::ITrkEventCnvTool::setRoT_Values( pair, RoT ); diff --git a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx index a66b99baca8229f85428967a496336c3f97d0305..6b70be5054a61606d63667a85b3ffa660f04a54c 100755 --- a/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx +++ b/InnerDetector/InDetEventCnv/InDetJiveXML/src/SCTRDORetriever.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetJiveXML/SCTRDORetriever.h" @@ -108,7 +108,7 @@ namespace JiveXML { //Get the hit detector element const InDetDD::SiDetectorElement *element = elements->getDetectorElement(waferHash); //Make sure we got the detector element - if (element == NULL){ + if (element == nullptr){ msg(MSG::WARNING) << "Unable to obtain detector element for SCT_RDO hit with id " << id << endmsg; continue ; } diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx index 23cb80d4d03e852d5299d1de944333f58cda2a8b..118fe9c1a148f5b87c4d17fa7150f8d50ad0b70c 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -21,6 +21,8 @@ #include "CLHEP/Geometry/Point3D.h" +#include <cmath> + #define AUXDATA(OBJ, TYP, NAME) \ static const SG::AuxElement::Accessor<TYP> acc_##NAME (#NAME); acc_##NAME(*(OBJ)) @@ -377,7 +379,7 @@ std::vector<SiHit*> SCT_PrepDataToxAOD::findAllHitsCompatibleWithCluster(const I for (const auto& hitIdentifier: prd->rdoList()) { ATH_MSG_DEBUG("Truth Strip " << diode.phiIndex() << " Cluster Strip " << m_SCTHelper->strip(hitIdentifier)); - if (abs(static_cast<int>(diode.phiIndex()) - m_SCTHelper->strip(hitIdentifier))<=1) { + if (std::abs(static_cast<int>(diode.phiIndex()) - m_SCTHelper->strip(hitIdentifier))<=1) { multiMatchingHits.push_back(siHit); break; } @@ -407,16 +409,16 @@ std::vector<SiHit*> SCT_PrepDataToxAOD::findAllHitsCompatibleWithCluster(const I const double maxDiff{0.00005}; // Check to see if the SiHits are compatible with each other. - if (fabs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<maxDiff and - fabs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<maxDiff and - fabs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<maxDiff) { + if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<maxDiff and + std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<maxDiff and + std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<maxDiff) { highestXPos = *siHitIter2; ajoiningHits.push_back(*siHitIter2); // Dont use hit more than once siHitIter2 = multiMatchingHits.erase(siHitIter2); - } else if (fabs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<maxDiff and - fabs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<maxDiff and - fabs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<maxDiff) { + } else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<maxDiff and + std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<maxDiff and + std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<maxDiff) { lowestXPos = *siHitIter2; ajoiningHits.push_back(*siHitIter2); // Dont use hit more than once diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt index dec3c29aa55351e6c61daabb732fd7e949d59d24..4e25e8e705e88b8698a604f5a33f752b0d874d64 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt @@ -19,7 +19,7 @@ find_package( AthenaPoolUtilitiesTest ) if( ATHENAPOOLUTILITIESTEST_FOUND ) set( INDETSIMEVENTATHENAPOOL_REFERENCE_TAG - InDetSimEventAthenaPoolReference-02-00-00 ) + InDetSimEventAthenaPoolReference-02-01-00 ) run_tpcnv_legacy_test( InDetSimEventTPCnv_HITS HITS.04919495._000416 REFERENCE_TAG ${INDETSIMEVENTATHENAPOOL_REFERENCE_TAG} ) else() diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt index 2fd4f5c476e202374a504b60103e28f731bea51b..5c31dc0a6617240870c805a4ed42293c4b150b01 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetSimEvent PRIVATE AtlasTest/TestTools + Control/AthenaKernel Control/StoreGate DetectorDescription/Identifier ) @@ -27,7 +28,7 @@ atlas_add_library( InDetSimEventTPCnv PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES GaudiKernel GeneratorObjectsTPCnv InDetSimEvent AthenaPoolCnvSvcLib StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools Identifier ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools Identifier AthenaKernel ) atlas_add_dictionary( InDetSimEventTPCnvDict InDetSimEventTPCnv/InDetSimEventTPCnvDict.h diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx index 428a76f6d624024e893dd9cf7cac83aaf5642cda..72eba048dcbf37a57f7eadf749513c8e5a97daed 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx @@ -258,7 +258,8 @@ void SiHitCollectionCnv_p2::persToTrans(const SiHitCollection_p2* persCont, SiHi unsigned int endHit = 0; unsigned int endBC = 0; unsigned int endId = 0; - + // Assume that all Hits should be linked to the hard-scatter GenEvent + const int event_number = HepMcParticleLink::getEventNumberAtPosition (0, EBC_MAINEVCOLL, SG::CurrentEventStore::store()); for (unsigned int i = 0; i < persCont->m_nHits.size(); i++) { if (persCont->m_nHits[i]) { @@ -298,7 +299,7 @@ void SiHitCollectionCnv_p2::persToTrans(const SiHitCollection_p2* persCont, SiHi HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink; partLink.setExtendedBarCode( HepMcParticleLink::ExtendedBarCode( persCont->m_barcode[idxBC], 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION) ); + HepMcParticleLink partLink( persCont->m_barcode[idxBC], event_number); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis; diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx index 07f4b1c0992ab006f3d53d2720eaa051463ea9b5..e329c1c4adbfe0c8c7c92aa2b594f4d99b3d19c6 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx @@ -14,7 +14,10 @@ #include "CLHEP/Geometry/Point3D.h" // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Athena +#include "AthenaKernel/ExtendedEventContext.h" #include "StoreGate/StoreGateSvc.h" // * * * stolen from eflowRec * * * // @@ -77,6 +80,8 @@ void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitC static const double dRcut = 1.0e-7; static const double dTcut = 1.0; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=nullptr; int lastId = -1; double stringFirstTheta = 0.0; @@ -103,7 +108,11 @@ void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitC lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); unsigned short index{0}; - if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { index = lastLink->eventIndex(); if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx index d4ade6a9d18ae4cc94cd931bd7a763ddfa1fa4b7..c1bda96002c0f83286aba7485cdd7ed0258954a5 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx @@ -294,6 +294,9 @@ void TRT_HitCollectionCnv_p3::persToTrans(const TRT_HitCollection_p3* persCont, unsigned int meanTimeofCount=0, startRCount=0, endRCount=0, hitEneCount=0; unsigned int idxBC=0, idxId=0, endHit=0, endBC=0, endId=0; + // Assume that all Hits should be linked to the hard-scatter GenEvent + const int event_number = HepMcParticleLink::getEventNumberAtPosition (0, EBC_MAINEVCOLL, SG::CurrentEventStore::store()); + // // loop over strings - index [i] // @@ -478,8 +481,7 @@ void TRT_HitCollectionCnv_p3::persToTrans(const TRT_HitCollection_p3* persCont, // - For charged particles kinEne is *zero*! // - HepMcParticleLink partLink(persCont->m_barcode[idxBC]); - partLink.setExtendedBarCode(HepMcParticleLink::ExtendedBarCode(persCont->m_barcode[idxBC], 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION));; + HepMcParticleLink partLink(persCont->m_barcode[idxBC], event_number); transCont->Emplace( strawId, partLink, persCont->m_id[idxId], kinEne, hitEne, startX, startY, startZ, endX, endY, endZ, meanTime ); diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx index 4fb8405218da3e3f6af9266202ce809274d0977d..a4986a1e28335c36a3e44a64851fbd414773ce0c 100644 --- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx +++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx @@ -15,8 +15,10 @@ // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" // Athena +#include "AthenaKernel/ExtendedEventContext.h" #include "StoreGate/StoreGateSvc.h" // Transient(Geant) to Persistent(Disk) @@ -50,6 +52,8 @@ void TRT_HitCollectionCnv_p4::transToPers(const TRTUncompressedHitCollection* tr // if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "In TRT_HitCollectionCnv_p4::transToPers()" << endmsg; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=NULL; int lastId = -1; double lastT = 0.0*CLHEP::ns; @@ -68,7 +72,11 @@ void TRT_HitCollectionCnv_p4::transToPers(const TRTUncompressedHitCollection* tr lastLink = &(trtHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); unsigned short index{0}; - if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) { + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { index = lastLink->eventIndex(); if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx index ca9d3a6f0e39c4719bada3754a8adf9e41a87aa4..a3fb4946519762f62a45d4d39d2de9da38644b43 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx @@ -3,19 +3,20 @@ */ #include "PixelRodDecoder.h" - +#include "CxxUtils/AthUnlikelyMacros.h" #include "PixelCabling/IPixelCablingSvc.h" #include "InDetIdentifier/PixelID.h" #include "PixelReadoutGeometry/PixelDetectorManager.h" #include "ExtractCondensedIBLhits.h" #include "PixelByteStreamModuleMask.h" +#include "ByteStreamData/RawEvent.h" #include "eformat/SourceIdentifier.h" #include "PixelConditionsData/PixelByteStreamErrors.h" +#include "xAODEventInfo/EventInfo.h" + +#include <fstream> #include <iostream> #include <string> -#include <fstream> - -#include "xAODEventInfo/EventInfo.h" //#define PIXEL_DEBUG ; @@ -36,6 +37,8 @@ using OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment; +inline bool isIBL( uint32_t robId ) { return ((robId>>16) & 0xFF)==0x14; } +inline bool isDBM( uint32_t robId ) { return ((robId>>16) & 0xFF)==0x15; } //--------------------------------------------------------------------------- constructor PixelRodDecoder::PixelRodDecoder @@ -118,7 +121,7 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD uint32_t rodId = robFrag->rod_source_id(); // get source ID => method of ROBFragment, Returns the source identifier of the ROD fragment uint32_t robId = robFrag->rob_source_id(); // get source ID => returns the Identifier of the ROB fragment. More correct to use w.r.t. rodId. uint32_t robBCID = robFrag->rod_bc_id(); - if (((robId>>16) & 0xFF)==0x14 && (robId != rodId)) { // isIBL(robId) + if ( isIBL( robId ) && robId != rodId ) { // isIBL(robId) generalwarning("Discrepancy in IBL SourceId: ROBID 0x" << std::hex << robId << " unequal to RODID 0x" << rodId); } @@ -126,32 +129,12 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD //SG::ReadCondHandle<PixelHitDiscCnfgData> pixHitDiscCnfg(m_condHitDiscCnfgKey); std::unique_ptr<SG::ReadCondHandle<PixelHitDiscCnfgData> > pixHitDiscCnfg; - // check the ROD status for truncation - if (robFrag->nstatus() != 0) { - const uint32_t* rob_status; - robFrag->status(rob_status); - - if ((*rob_status) != 0) { - addRODError(robId,*rob_status); - - ATH_MSG_DEBUG( "ROB status word for robid 0x"<< std::hex << robId << " is non-zero 0x" - << (*rob_status) << std::dec); - - if (((*rob_status) >> 27) & 0x1) { // TODO: find source of thse constants - addRODError( robId, PixelByteStreamErrors::TruncatedROB, decodingErrors ); - ATH_MSG_DEBUG("ROB status word for robid 0x"<< std::hex << robId << std::dec <<" indicates data truncation."); - return StatusCode::RECOVERABLE; - } - - if (((*rob_status) >> 31) & 0x1) { - addRODError( robId, PixelByteStreamErrors::MaskedROB, decodingErrors ); - ATH_MSG_DEBUG( "ROB status word for robid 0x"<< std::hex << robId<< std::dec <<" indicates resource was masked off."); - return StatusCode::RECOVERABLE; - } - } + { + StatusCode sc = checkRODStatus( robFrag, decodingErrors ); + if ( not sc.isSuccess() ) + return sc; } - unsigned int errorcode = 0; uint64_t bsErrCode = 0; // new BS Errors handling // m_errors->reset(); // reset the collection of errors @@ -208,9 +191,6 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD unsigned int nFragmentsPerFE[8] = {0}; // number of header-trailer pairs per IBL FE - uint32_t dataword_it_end = robFrag->rod_ndata(); // number of data words - uint32_t rawDataWord; - IdentifierHash skipHash = 0xffffffff, lastHash = 0xffffffff; // used for decoding to not have to search the vector all the time PixelRawCollection* coll = nullptr; @@ -225,7 +205,7 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD // Do a check on IBL Slink ID eformat::helper::SourceIdentifier sid_rob(robId); sLinkSourceId = (sid_rob.module_id()) & 0x000F; // retrieve S-Link number from the source Identifier (0xRRRL, L = Slink number) - if (((robId>>16) & 0xFF)==0x14 && sLinkSourceId>0x3) { // Check if SLink number for the IBL is correct! + if ( isIBL( robId ) && sLinkSourceId>0x3) { // Check if SLink number for the IBL is correct! generalwarning("In ROB 0x" << std::hex << robId << ": IBL/DBM SLink number not in correct range (0-3): SLink = " << std::dec << sLinkSourceId); } @@ -233,34 +213,17 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD // Store length of module fragments, for monitoring uint32_t nwords_in_module_fragment = 0; + bool corruptionError = false; + // To check duplicated pixels + Identifier previousPixelId; // ============== ============== ============== ============== ============== ============== ============== ============== // // loop over the data in the fragment - bool corruptionError = false; - for (uint32_t dataword_it = 0; dataword_it < dataword_it_end; ++dataword_it) { // loop over ROD - rawDataWord = vint[dataword_it]; // set the dataword to investigate - if (rawDataWord==0xaa1234aa){ - generalwarning("Evt marker encountered during loop on ROD datawords"); - corruptionError = true; - break; - } else if (rawDataWord==0xdd1234dd){ - generalwarning("ROB marker encountered during loop on ROD datawords"); - corruptionError = true; - break; - } else if (rawDataWord==0xee1234ee){ - generalwarning("ROD marker encountered during loop on ROD datawords"); - corruptionError = true; - break; - } + for (uint32_t dataword_it = 0, nwords = robFrag->rod_ndata(); dataword_it < nwords; ++dataword_it) { + const uint32_t rawDataWord = vint[dataword_it]; + corruptionError = corruptionError || checkDataWordsCorruption( rawDataWord ); uint32_t word_type = getDataType(rawDataWord, link_start); // get type of data word - unsigned int headererror; - int trailererror; - unsigned int MCCFlags; - unsigned int FEFlags; - - unsigned int serviceCode; - unsigned int serviceCodeCounter; ++nwords_in_module_fragment; @@ -280,8 +243,8 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD } else { ATH_MSG_DEBUG( "Header decoding starts" ); - } + link_start = true; // setting link (module) header found flag are_4condensed_words = false; receivedCondensedWords = false; @@ -291,8 +254,8 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD nwords_in_module_fragment = 1; if (m_is_ibl_present) { - if (((robId>>16) & 0xFF)==0x14) { isIBLModule=true; } - if (((robId>>16) & 0xFF)==0x15) { isDBMModule=true; } + isIBLModule = isIBL(robId); + isDBMModule = isDBM(robId); } errorcode = 0; // reset errorcode @@ -405,7 +368,7 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD } */ - headererror = decodeHeaderErrors(rawDataWord); // get link (module) header errors + uint32_t headererror = decodeHeaderErrors(rawDataWord); // get link (module) header errors if (headererror != 0) { // only treatment for header errors now, FIXME sc = StatusCode::RECOVERABLE; errorcode = errorcode | (headererror << 20); //encode error as HHHHMMMMMMMMFFFFFFFFTTTT for header, flagword, trailer errors @@ -734,8 +697,12 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD if (hitDiscCnfg == 2 && IBLtot[0] == 2) IBLtot[0] = 16; if (hitDiscCnfg == 2 && IBLtot[1] == 2) IBLtot[1] = 16; - // Insert the first part of the ToT info in the collection - coll->push_back(new RDO(pixelId, IBLtot[0], mBCID,mLVL1ID,mLVL1A)); + if (not m_checkDuplicatedPixel or + (m_checkDuplicatedPixel and previousPixelId!=pixelId)) { + // Insert the first part of the ToT info in the collection + coll->push_back(new RDO(pixelId, IBLtot[0], mBCID, mLVL1ID, mLVL1A)); + previousPixelId = pixelId; + } #ifdef PIXEL_DEBUG @@ -782,7 +749,11 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD continue; } - coll->push_back(new RDO(pixelId, IBLtot[1], mBCID, mLVL1ID, mLVL1A)); + if (not m_checkDuplicatedPixel or + (m_checkDuplicatedPixel and previousPixelId!=pixelId)) { + coll->push_back(new RDO(pixelId, IBLtot[1], mBCID, mLVL1ID, mLVL1A)); + previousPixelId = pixelId; + } #ifdef PIXEL_DEBUG ATH_MSG_VERBOSE( "Collection filled with pixelId: " << pixelId << " TOT = 0x" << std::hex << IBLtot[1] << std::dec << " mBCID = " << mBCID << " mLVL1ID = " << mLVL1ID << " mLVL1A = " << mLVL1A ); @@ -816,7 +787,11 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD } // Now the Collection is there for sure. Create RDO and push it into Collection. - coll->push_back(new RDO(pixelId, mToT, mBCID,mLVL1ID,mLVL1A)); + if (not m_checkDuplicatedPixel or + (m_checkDuplicatedPixel and previousPixelId!=pixelId)) { + coll->push_back(new RDO(pixelId, mToT, mBCID, mLVL1ID, mLVL1A)); + previousPixelId = pixelId; + } #ifdef PIXEL_DEBUG ATH_MSG_VERBOSE( "Collection filled with pixelId: " << pixelId << " TOT = 0x" << std::hex << mToT << std::dec << " mBCID = " << mBCID << " mLVL1ID = " << mLVL1ID << " mLVL1A = " << mLVL1A ); #endif @@ -858,7 +833,7 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD // mSkippedTrigTrailer = decodeSkippedTrigTrailer_IBL(rawDataWord); // decode skipped trigger counter bits => M -- temporarily removed - trailererror = decodeTrailerErrors_IBL(rawDataWord); // => E cPpl bzhv // taking all errors together. + uint32_t trailererror = decodeTrailerErrors_IBL(rawDataWord); // => E cPpl bzhv // taking all errors together. // Create a copy without the useless 'c' bit uint32_t trailererror_noC = 0; @@ -946,7 +921,7 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD ATH_MSG_VERBOSE( "Decoding Pixel trailer word: 0x" << std::hex << rawDataWord << std::dec ); - trailererror = decodeTrailerErrors(rawDataWord); // creating link (module) trailer error variable + uint32_t trailererror = decodeTrailerErrors(rawDataWord); // creating link (module) trailer error variable //mBitFlips = decodeTrailerBitflips(rawDataWord); -- temporarily removed if (trailererror != 0) { @@ -994,8 +969,8 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD << ", nnnnn (header) = 0x" << linkNum_IBLheader << std::dec); } - serviceCodeCounter = decodeServiceCodeCounter_IBL(rawDataWord); // frequency of the serviceCode (with the exceptions of serviceCode = 14,15 or 16) - serviceCode = decodeServiceCode_IBL(rawDataWord); // is a code. the corresponding meaning is listed in the table in the FE-I4 manual, pag. 105 + uint32_t serviceCodeCounter = decodeServiceCodeCounter_IBL(rawDataWord); // frequency of the serviceCode (with the exceptions of serviceCode = 14,15 or 16) + uint32_t serviceCode = decodeServiceCode_IBL(rawDataWord); // is a code. the corresponding meaning is listed in the table in the FE-I4 manual, pag. 105 // Treat the service code only if its meaning is valid (i.e. value < 31) if (serviceCode < 32) { @@ -1026,8 +1001,8 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD ATH_MSG_VERBOSE( "Decoding Pixel FEflag word: 0x" << std::hex << rawDataWord << std::dec ); - FEFlags = decodeFEFlags2(rawDataWord); // get FE flags - MCCFlags = decodeMCCFlags(rawDataWord); // get MCC flags + uint32_t FEFlags = decodeFEFlags2(rawDataWord); // get FE flags + uint32_t MCCFlags = decodeMCCFlags(rawDataWord); // get MCC flags uint32_t fe_number = (rawDataWord & 0x0F000000) >> 24; FEFlags = FEFlags & 0xF3; // mask out the parity bits, they don't work @@ -1664,6 +1639,48 @@ void PixelRodDecoder::addRODError(const uint32_t robid, const IDCInDetBSErrConta } } +StatusCode PixelRodDecoder::checkRODStatus( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, IDCInDetBSErrContainer& decodingErrors ) const { + // check the ROD status for truncation + if (robFrag->nstatus() != 0) { + const uint32_t* rob_status; + robFrag->status(rob_status); + uint32_t robId = robFrag->rob_source_id(); + if ( ATH_UNLIKELY( (*rob_status) != 0) ) { + addRODError(robId,*rob_status); + + ATH_MSG_DEBUG( "ROB status word for robid 0x"<< std::hex << robId << " is non-zero 0x" + << (*rob_status) << std::dec); + + if (((*rob_status) >> 27) & 0x1) { // TODO: find source of thse constants + addRODError( robId, PixelByteStreamErrors::TruncatedROB, decodingErrors ); + ATH_MSG_DEBUG("ROB status word for robid 0x"<< std::hex << robId << std::dec <<" indicates data truncation."); + return StatusCode::RECOVERABLE; + } + + if (((*rob_status) >> 31) & 0x1) { + addRODError( robId, PixelByteStreamErrors::MaskedROB, decodingErrors ); + ATH_MSG_DEBUG( "ROB status word for robid 0x"<< std::hex << robId<< std::dec <<" indicates resource was masked off."); + return StatusCode::RECOVERABLE; + } + } + } + return StatusCode::SUCCESS; +} + +bool PixelRodDecoder::checkDataWordsCorruption( uint32_t rawDataWord) const { + if ( ATH_UNLIKELY( rawDataWord==0xaa1234aa )) { + generalwarning("Evt marker encountered during loop on ROD datawords"); + return true; + } else if ( ATH_UNLIKELY( rawDataWord==0xdd1234dd ) ){ + generalwarning("ROB marker encountered during loop on ROD datawords"); + return true; + } else if ( ATH_UNLIKELY( rawDataWord==0xee1234ee) ){ + generalwarning("ROD marker encountered during loop on ROD datawords"); + return true; + } + return false; // no corruption +} + uint32_t PixelRodDecoder::treatmentFEFlagInfo(unsigned int serviceCode, unsigned int serviceCodeCounter) const { @@ -1831,3 +1848,5 @@ uint32_t PixelRodDecoder::treatmentFEFlagInfo(unsigned int serviceCode, unsigned return code; } + + diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.h b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.h index 09439d944bb1b77eb126458d168af01c2d4dd57b..e5a15c2f32e894a14ef258dec6f7975fef796331 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.h +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELRAWDATABYTESTREAM_PIXEL_RODDECODER_H @@ -10,7 +10,6 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" - #include "eformat/SourceIdentifier.h" #include "PixelConditionsTools/IPixelByteStreamErrorsTool.h" @@ -137,7 +136,7 @@ class PixelRodDecoder : virtual public IPixelRodDecoder, public AthAlgTool { unsigned m_maxNumGenWarnings{200}; // Maximum number of general warnings to print mutable std::atomic_uint m_numBCIDWarnings{}; unsigned m_maxNumBCIDWarnings{50}; // Maximum number of BCID and LVL1ID warnings to print - + BooleanProperty m_checkDuplicatedPixel{this, "CheckDuplicatedPixel", true, "Check duplicated pixels in fillCollection method"}; ServiceHandle<IPixelCablingSvc> m_pixelCabling; @@ -156,6 +155,11 @@ class PixelRodDecoder : virtual public IPixelRodDecoder, public AthAlgTool { //!< adds given ErrorCode to all hasIDs for given ROB void addRODError(uint32_t robid, IDCInDetBSErrContainer::ErrorCode, IDCInDetBSErrContainer& errorsCollection) const; + //! checks status word in ROD for truncations and similar, returns success or recoverable errors, fills errors container at the same time + StatusCode checkRODStatus( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, IDCInDetBSErrContainer& decodingErrors ) const; + + //! checks if data words do not look like header & trailer markers, return true if so, this is sign of data corruption + bool checkDataWordsCorruption( uint32_t word ) const; }; inline void PixelRodDecoder::setDet( const eformat::SubDetector det ) diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt index ae15f55b2bd4d4ccd7cdd1865fa85561347027f7..8ef12ddaab748e04cba3f27a770c80c0800cfe19 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt @@ -34,7 +34,7 @@ atlas_add_component( SCT_RawDataByteStreamCnv src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel InDetRawData InDetByteStreamErrors AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier xAODEventInfo InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry SCT_CablingLib TrigSteeringEvent) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel InDetRawData InDetByteStreamErrors AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier xAODEventInfo InDetIdentifier InDetReadoutGeometry SCT_ReadoutGeometry SCT_CablingLib TrigSteeringEvent SCT_ConditionsData SCT_ConditionsToolsLib ) # Run tests: atlas_add_test( TestSCTDecode diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx index ebe8e1dc15c0a78bde98ada29d714fc9abb372de..799c13013d55e87df77a3f8901e75ce55b846c69 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx @@ -64,7 +64,7 @@ StatusCode SCTRawDataProvider::execute(const EventContext& ctx) const SG::WriteHandle<SCT_RDO_Container> rdoContainer(m_rdoContainerKey, ctx); bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty(); if (not externalCacheRDO) { - ATH_CHECK(rdoContainer.record (std::make_unique<SCT_RDO_Container>(m_sctID->wafer_hash_max()))); + ATH_CHECK(rdoContainer.record (std::make_unique<SCT_RDO_Container>(m_sctID->wafer_hash_max(), EventContainers::Mode::OfflineFast))); ATH_MSG_DEBUG("Created container for " << m_sctID->wafer_hash_max()); } else { diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx index 640bc6d9f8e140f9f0f3a6bda91db0df866381c4..0171dbf8fe1f8b8cb6e63210c343b57b8e2f65c8 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx @@ -17,11 +17,6 @@ #include <array> #include <utility> -union RawWord { - uint32_t word32; - uint16_t word16[2]; -}; - // Constructor SCT_RodDecoder::SCT_RodDecoder(const std::string& type, const std::string& name, @@ -32,7 +27,7 @@ SCT_RodDecoder::SCT_RodDecoder(const std::string& type, const std::string& name, // Initialize -StatusCode SCT_RodDecoder::initialize() +StatusCode SCT_RodDecoder::initialize() { ATH_CHECK(AlgTool::initialize()); @@ -66,95 +61,95 @@ StatusCode SCT_RodDecoder::initialize() // Finalize -StatusCode SCT_RodDecoder::finalize() +StatusCode SCT_RodDecoder::finalize() { // Print out summaries of data and errors decoded ATH_MSG_INFO("SCT BytestreamCnv summary: " << m_headNumber <<" link headers found"); ATH_MSG_INFO("SCT BytestreamCnv summary: " << m_trailerNumber << " link trailers found"); - ATH_MSG_INFO("SCT decoding bytestream summary: " + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_singleCondHitNumber << " single strips with hit in condensed mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_pairedCondHitNumber << " paired strips with hit in condensed mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_firstExpHitNumber << " first strips with hit in expanded mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_evenExpHitNumber << " consecutive paired strips with hit in expanded mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_lastExpHitNumber << " last consecutive strips with hit in expanded mode"); if (m_headErrorBCID > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_headErrorLvl1ID << " LVL1d errors found"); } if (m_headErrorTimeout > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_headErrorTimeout << " timeout errors found"); } if (m_headErrorFormatter > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_headErrorFormatter << " formatter errors found"); } if (m_headErrorPreamble > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_headErrorPreamble << " preamble errors found"); } if (m_maskedLinkNumber > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_maskedLinkNumber << " masked links found"); } if (m_trailerErrorOverflow > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " << m_trailerErrorOverflow << " trailer data overflow errors found"); } if (m_trailerErrorLimit > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " << m_trailerErrorLimit << " header trailer limit errors found"); } if (m_trailerErrorBit > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: trailer-> " << m_trailerErrorBit << " trailer bit errors found"); } if (m_configDataBit > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: raw Data-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: raw Data-> " << m_configDataBit << " raw data found: Config data mode"); } if (m_flagErrorBit > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: flag-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: flag-> " << m_flagErrorBit << " module link flag bit errors found"); } - + if (m_condHit1Error > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " << m_condHit1Error << " 1st hit error found in condensed mode"); } if (m_condHit2Error > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " << m_condHit2Error << " 2nd hit error found in condensed mode"); } if (m_chipNumberError > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: hit-> " << m_chipNumberError << " Chip number > 5 error found"); } if (m_unknownDataFormat > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: unknown data-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: unknown data-> " << m_unknownDataFormat << " Unknown data format found"); } if (m_rodClockErrorNumber > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: ROD status word-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: ROD status word-> " << m_rodClockErrorNumber << " ROD clock errors found"); } if (m_maskedRODNumber > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: ROB status word-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: ROB status word-> " << m_maskedRODNumber << " masked RODs found"); } if (m_truncatedRODNumber > 0) { - ATH_MSG_INFO("SCT BytestreamCnv summary: ROB status word-> " + ATH_MSG_INFO("SCT BytestreamCnv summary: ROB status word-> " << m_truncatedRODNumber << " truncated ROBFragments"); } @@ -177,22 +172,24 @@ StatusCode SCT_RodDecoder::finalize() * To be sure that all of the errors are saved this helper class provides add method allowing to update/accumulate erorr. * The IDC, for a very good reasons (MT safety) do not allow for that. **/ -class SCT_RodDecoderErrorsHelper { -public: +struct SCT_RodDecoderErrorsHelper { SCT_RodDecoderErrorsHelper( IDCInDetBSErrContainer& idcContainer ) - : m_errorsIDC{ idcContainer } {} + : errorsIDC{ idcContainer } {} ~SCT_RodDecoderErrorsHelper() { - for ( auto [id, err]: m_accumulatedErrors ) { - m_errorsIDC.setOrDrop( id, err ); + for ( auto [id, err]: accumulatedErrors ) { + errorsIDC.setOrDrop( id, err ); } } + void noerror(const IdentifierHash id) { + accumulatedErrors[id]; // this adds 0 (no error) for an ID + } + void add(const IdentifierHash id, SCT_ByteStreamErrors::ErrorType etype) { - SCT_ByteStreamErrors::addError(m_accumulatedErrors[id], etype); + SCT_ByteStreamErrors::addError(accumulatedErrors[id], etype); } -private: - std::map<IdentifierHash, IDCInDetBSErrContainer::ErrorCode> m_accumulatedErrors; - IDCInDetBSErrContainer& m_errorsIDC; + std::map<IdentifierHash, IDCInDetBSErrContainer::ErrorCode> accumulatedErrors; + IDCInDetBSErrContainer& errorsIDC; }; @@ -228,14 +225,12 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB std::array<bool, N_STRIPS_PER_SIDE*N_SIDES> saved; saved.fill(false); - RawWord robData; - robData.word32=0; int errors{0}; // Encodes the errors on the header (bit 4: error in condensed mode 1st hit, bit 5: error in condensed mode 2nd hit) // These are for the trigger CacheHelper cache; cache.vecHash = vecHash; - + std::vector<int> errorHit; // For MissingLinkHeaderError @@ -249,21 +244,21 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB const uint32_t* robStatus; robFrag.status(robStatus); if ((*robStatus)!=0) { - ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID + ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID << " is non-zero " << (*robStatus) << std::dec); // First store generic "ROBFragmentError" error type. ATH_CHECK(addRODError(robID, SCT_ByteStreamErrors::ROBFragmentError, errs)); sc = StatusCode::RECOVERABLE; // Now look for specific problems, e.g. truncated or masked-off RODs if (((*robStatus) >> 27) & 0x1) { - ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID + ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID << std::dec << " indicates data truncation."); ATH_CHECK(addRODError(robID, SCT_ByteStreamErrors::TruncatedROD, errs)); m_truncatedRODNumber++; return sc; } if ((((*robStatus) >> 29) & 0x1) or (((*robStatus) >> 31) & 0x1)) { - ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID + ATH_MSG_DEBUG("ROB status word for robID " << std::hex << robID << std::dec << " indicates resource was masked off."); ATH_CHECK(addRODError(robID, SCT_ByteStreamErrors::MaskedROD, errs)); m_maskedRODNumber++; @@ -271,7 +266,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB } } } - + // Look at ROD status words OFFLINE_FRAGMENTS_NAMESPACE::PointerType vecRODStatus; const long unsigned int vecRODStatusSize{robFrag.rod_nstatus()}; @@ -294,22 +289,21 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // const bool hvOn{hvBits==0xF}; } } - + // Now look at the data words bool foundHeader{false}; - + OFFLINE_FRAGMENTS_NAMESPACE::PointerType vecROBData; const unsigned long int vecROBDataSize{robFrag.rod_ndata()}; robFrag.rod_data(vecROBData); // Loop over header, hit element, flagged ABCD error, raw data, trailer words for (unsigned long int i{0}; i<vecROBDataSize; i++) { - robData.word32 = vecROBData[i]; // The data is 16-bits wide packed to a 32-bit word (rob_it1). So we unpack it here. uint16_t data16[2]; - data16[1] = robData.word16[0]; - data16[0] = robData.word16[1]; - + data16[0] = ((vecROBData[i] >> 16) & 0xFFFF); + data16[1] = ( vecROBData[i] & 0xFFFF); + for (int n{0}; n<2; n++) { // Header if (((data16[n]>>13)&0x7) == 0x1) { @@ -318,16 +312,16 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // Create the last RDO of the previous link if any if (saved[side*N_STRIPS_PER_SIDE+strip]==false and oldStrip>=0) { - const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade; } } - + // Everything is set to default for a new hunt of RDO strip =0; oldStrip = -1; @@ -346,10 +340,10 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB if ((onlineID ==0) or (linkNumber > 95)) { ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); sc=StatusCode::RECOVERABLE; - ATH_MSG_DEBUG("Header: xxx Link number out of range (skipping following data)" + ATH_MSG_DEBUG("Header: xxx Link number out of range (skipping following data)" << std::dec << linkNumber); break; - } + } else { currentLinkIDHash = m_cabling->getHashFromOnlineId(onlineID); foundHashes.insert(currentLinkIDHash); @@ -366,28 +360,28 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::TimeOutError, errs)); sc=StatusCode::RECOVERABLE; } - + if (data16[n]&0x1000) { ATH_MSG_DEBUG(" Header: xxx Preamble Error " << currentLinkIDHash); m_headErrorPreamble++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::PreambleError, errs)); sc=StatusCode::RECOVERABLE; } - + if (data16[n]&0x400) { ATH_MSG_DEBUG(" Header: xxx LVL1 ID Error " << currentLinkIDHash); m_headErrorLvl1ID++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::LVL1IDError, errs)); sc=StatusCode::RECOVERABLE; } - + if (data16[n]&0x200) { ATH_MSG_DEBUG(" Header: xxx BCID Error " << currentLinkIDHash); m_headErrorBCID++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::BCIDError, errs)); sc=StatusCode::RECOVERABLE; } - + if ((data16[n]&0xF) > 11) { ATH_MSG_DEBUG(" Header: xxx Error in formatter " << currentLinkIDHash); m_headErrorFormatter++; @@ -398,9 +392,9 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB condensedMode = static_cast<bool>(data16[n]&0x100); continue; - + } // End header - + // Hit element else if (data16[n]&0x8000) { if (not foundHeader) { @@ -424,7 +418,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB timeBin = 0x2; // Assuming timeBin is 010 in super-condensed mode nStripsInWord = (data16[n]&0xF)+1; if (chip>=N_CHIPS_PER_SIDE) { - ATH_MSG_DEBUG(" Hit super-condensed : xxx Chip number = " << chip << " >= "<< N_CHIPS_PER_SIDE << " for hit " + ATH_MSG_DEBUG(" Hit super-condensed : xxx Chip number = " << chip << " >= "<< N_CHIPS_PER_SIDE << " for hit " << std::hex << data16[n]); m_chipNumberError++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); @@ -435,13 +429,13 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // Search for redundancy only for the master chip bool secondSide{false}; if ((side==1) and ((linkNumber%2)==0)) { - if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { + if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -453,13 +447,13 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB secondSide = true; } else if ((side==0) and ((linkNumber%2)!=0)) { - if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { + if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -480,14 +474,14 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB oldStrip = strip; // If it's the first super-condensed word oldSide = side; } - + if ((strip!=oldStrip) or (side!=oldSide)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -496,8 +490,8 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB groupSize = 0; } groupSize+=nStripsInWord; // Split clusters have the same strip number. - - } + + } else if (condensedMode) { // Super-condensed mode: // Chip info: 4 bits data16[n]>>11)&0xF @@ -509,7 +503,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB strip = chip*N_STRIPS_PER_CHIP + ((data16[n]>>4)&0x7F); timeBin = 0x2; // Assuming timeBin is 010 in condensed mode if (chip>=N_CHIPS_PER_SIDE) { - ATH_MSG_DEBUG(" Hit condensed : xxx Chip number = " << chip << " >= " << N_CHIPS_PER_SIDE << " for hit " + ATH_MSG_DEBUG(" Hit condensed : xxx Chip number = " << chip << " >= " << N_CHIPS_PER_SIDE << " for hit " << std::hex << data16[n]); m_chipNumberError++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); @@ -522,11 +516,11 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB if ((side==1) and ((linkNumber%2)==0)) { if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -538,13 +532,13 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB secondSide = true; } else if ((side==0) and ((linkNumber%2)!=0)) { - if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { + if (((strip!=oldStrip) or (side!=oldSide)) and (groupSize>0)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -570,11 +564,11 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB m_singleCondHitNumber++; if ((strip!=oldStrip) or (side!=oldSide)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } @@ -582,7 +576,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB oldSide = side; groupSize = 0; } - + if (data16[n]&0x4) { // Error in the hit ATH_MSG_DEBUG(" Hit condensed : xxx ERROR in 1-hit " << std::hex << data16[n]); errorHit.push_back(groupSize); @@ -591,7 +585,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB sc=StatusCode::RECOVERABLE; } groupSize = (groupSize>=2 ? groupSize : 1); - } + } else { // 2-hits if (strip >= N_STRIPS_PER_SIDE) { ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); @@ -604,18 +598,18 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB m_pairedCondHitNumber++; if ((strip!=oldStrip) or (side!=oldSide)) { // If it is a new cluster, make RDO with the previous cluster - const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(oldStrip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[oldSide*N_STRIPS_PER_SIDE+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; groupSize = 0; - } + } if (data16[n]&0x4) { // Error in the first hit ATH_MSG_DEBUG(" Hit condensed : xxx ERROR in 1st hit" << std::hex << data16[n]); errorHit.push_back(groupSize); @@ -632,11 +626,11 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB } groupSize = 2; } - } + } else { // Expanded mode: // Chip info from the first word of expanded cluster : 4 bits (data16[n]>>11)&0xF - // Chip number == (data16[n]>>11)&0x7 + // Chip number == (data16[n]>>11)&0x7 // Chip side == (data16[n]>>14)&0x1 // For example if (data16[n]>>11)&0xF = 0101 => chip5 or chip5 on side0, (data16[n]>>11)&0xF = 1101 => chip13 or chip5 on side1 if (not (data16[n]&0x8)) { // 1st hit cluster expanded @@ -645,14 +639,14 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB side = ((data16[n]>>14)&0x1); strip = chip*N_STRIPS_PER_CHIP + ((data16[n]>>4)&0x7F); timeBin = data16[n]&0x7; // Real way for obtaining timeBin info - + if (chip>=N_CHIPS_PER_SIDE) { ATH_MSG_DEBUG("Expanded hit: First hit xxx ERROR chip Nb = " << chip << " >= " << N_CHIPS_PER_SIDE); m_chipNumberError++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); continue; } - + // Search for redundancy only for the master chip bool secondSide{false}; if ((side==1) and ((linkNumber%2)==0)) { @@ -669,16 +663,16 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB foundHashes.insert(currentLinkIDHash); } groupSize = 1; - const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade; } groupSize = 0; - } + } else { // Next hits cluster expanded if (data16[n]&0x80) { // Paired hits if (strip >= N_STRIPS_PER_SIDE) { @@ -698,27 +692,27 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB strip++; timeBin = data16[n]&0x7; groupSize = 1; - const int rdoMade1{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade1{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade1 == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade1; } // Second hit from the pair strip++; timeBin = ((data16[n] >> 4) & 0x7); - const int rdoMade2{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade2{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade2 == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade2; } groupSize = 0; - } + } else { // Last hit of the cluster m_lastExpHitNumber++; if (chip>=N_CHIPS_PER_SIDE) { @@ -726,15 +720,15 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB m_chipNumberError++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); continue; - } + } strip++; timeBin = (data16[n]&0x7); groupSize = 1; - const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade; } @@ -743,7 +737,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB } } // End expanded mode } // End of hit element - + // FlaggedABCD error else if (((data16[n]>>13)&0x7) == 0x0) { // 000xxxxxxFFFFEEE @@ -764,11 +758,11 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB m_flagErrorBit++; // Error code of ABCD error should be 1, 2, 4 or 7. if (abcError!=0x1 and abcError!=0x2 and abcError!=0x4 and abcError!=0x7) { - ATH_MSG_DEBUG("ABCD error has an invalid error code " << abcError - << " the 16-bit word is 0x" << std::hex << data16[n] << std::dec + ATH_MSG_DEBUG("ABCD error has an invalid error code " << abcError + << " the 16-bit word is 0x" << std::hex << data16[n] << std::dec << " for hash " << currentLinkIDHash); ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ABCDError_Invalid, errs)); - } + } else { // Chip is 4 bits. The highest bit 3 represents side. Chip 0-5 on side 0 and chip 8-13 on side 1. const unsigned int sideABCDError{static_cast<unsigned int>(chip/8)}; @@ -779,6 +773,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB ATH_MSG_DEBUG("ABCD error and online ID have different side information for hash " << currentLinkIDHash << ". " << sideABCDError << " from ABCD error and " << currentLinkIDHash.value()%2 << " from online ID"); currentLinkIDHash = (currentLinkIDHash.value()/2)*2+sideABCDError; + errs.noerror(currentLinkIDHash); } // Chip should be 0-5 or 8-13. if (chip%8>=N_CHIPS_PER_SIDE) { @@ -786,7 +781,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB << " the 16-bit word is 0x" << std::hex << data16[n] << std::dec << " for hash " << currentLinkIDHash.value()); ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ABCDError_Invalid, errs)); - } + } else { if ( abcError==0x1) ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ABCDError_Error1, errs)); else if (abcError==0x2) ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ABCDError_Error2, errs)); @@ -803,7 +798,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ABCDError, errs)); sc=StatusCode::RECOVERABLE; continue; - } + } // Raw Data else if (((data16[n]>>13)&0x7) == 0x3) { @@ -821,21 +816,21 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::RawError, errs)); sc=StatusCode::RECOVERABLE; continue; - } + } // Trailer else if (((data16[n]>>13)&0x7) == 0x2) { foundHeader=false; - + m_trailerNumber++; - + if (data16[n]&0x1000) { ATH_MSG_DEBUG(" Trailer: xxx Trailer ERROR " << std::hex << data16[n]); m_trailerErrorBit++; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::TrailerError, errs)); sc=StatusCode::RECOVERABLE; } - + if (data16[n]&0x800) { // No data should appear between header and trailer // See 1.2.2 Formatter FPGA - Serial Data Decoding and Formatting of @@ -845,7 +840,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::HeaderTrailerLimitError, errs)); sc=StatusCode::RECOVERABLE; } - + if (data16[n]&0x400) { // Not sure if there are hit elements before (probably yes but in principle they are fine) ATH_MSG_DEBUG(" Trailer: xxx Data Overflow ERROR " << std::hex << data16[n]); @@ -856,24 +851,24 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB if (data16[n] & 0xF) { // First temporarily masked chip information // 0 means no masked chip (always has been 0 until April 2017) - // - // If Rx redundacy is not used, - // 1 means chips 0-5 are temporarily masked. - // 6 means chip 5 is temporarily masked. - // 7 means chips 6-11 are temporarily masked. - // 12 means chip 11 is temporarily masked. - // + // + // If Rx redundacy is not used, + // 1 means chips 0-5 are temporarily masked. + // 6 means chip 5 is temporarily masked. + // 7 means chips 6-11 are temporarily masked. + // 12 means chip 11 is temporarily masked. + // // If Rx redundacy is used and link-1 is not used, - // 1 means chips 0-11 are temporarily masked. - // 6 means chips 5-11 are temporarily masked. - // 7 means chips 6-11 are temporarily masked. - // 12 means chip 11 is temporarily masked. - // + // 1 means chips 0-11 are temporarily masked. + // 6 means chips 5-11 are temporarily masked. + // 7 means chips 6-11 are temporarily masked. + // 12 means chip 11 is temporarily masked. + // // If Rx redundacy is used and link-0 is not used, - // 1 means chips 0-5 are temporarily masked. - // 6 means chip 5 is temporarily masked. - // 7 means chips 6-11, 0-5 are temporarily masked. - // 12 means chips 11, 0-5 are temporarily masked. + // 1 means chips 0-5 are temporarily masked. + // 6 means chip 5 is temporarily masked. + // 7 means chips 6-11, 0-5 are temporarily masked. + // 12 means chips 11, 0-5 are temporarily masked. setFirstTempMaskedChip(currentLinkIDHash, (data16[n] & 0xF), errs).ignore(); } continue; @@ -891,11 +886,11 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // Create the last RDO of the last link of the event if (saved[side*N_STRIPS_PER_SIDE+strip]==false and oldStrip>=0) { - const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(strip, groupSize, timeBin, currentLinkIDHash, errors, rdoIDCont, cache, errorHit, errs)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; ATH_CHECK(addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs)); - } + } else { saved[side*N_STRIPS_PER_SIDE+strip] = rdoMade; } @@ -918,7 +913,8 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int timeBin, int errors, ISCT_RDO_Container& rdoIDCont, CacheHelper& cache, - const std::vector<int>& errorHit) const + const std::vector<int>& errorHit, + SCT_RodDecoderErrorsHelper & errs) const { if (((strip & 0x7f) + (groupSize-1) >= N_STRIPS_PER_CHIP) or (strip<0) or (strip>=N_STRIPS_PER_SIDE)) { ATH_MSG_WARNING("Cluster with " << groupSize << " strips, starting at strip " << strip @@ -931,12 +927,12 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int timeBin, if (collIDHash == cache.skipHash) { ATH_MSG_VERBOSE("Collection for Hash not to be decoded, skip"); return 0; - } + } else if (collIDHash != cache.lastHash) { cache.lastHash = collIDHash; // Maybe the new hash is not in the list, so test it - std::vector<IdentifierHash>::const_iterator hashIDIterator{find(cache.vecHash->begin(), - cache.vecHash->end(), + std::vector<IdentifierHash>::const_iterator hashIDIterator{find(cache.vecHash->begin(), + cache.vecHash->end(), collIDHash)}; if (hashIDIterator == cache.vecHash->end()) { ATH_MSG_VERBOSE("Collection for Hash not to be decoded, skip"); @@ -980,6 +976,7 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int timeBin, ATH_MSG_DEBUG(" Collection ID = " << collIDHash << " does not exist, create it "); // Create new collection sctRDOColl = new SCT_RDO_Collection(collIDHash); + errs.noerror( collIDHash ); // make sure the error information is filled for this ID sctRDOColl->setIdentifier(collID); StatusCode sc{rdoIDCont.addCollection(sctRDOColl, collIDHash)}; ATH_MSG_DEBUG("Adding " << collIDHash); @@ -987,8 +984,8 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int timeBin, ATH_MSG_ERROR("failed to add SCT RDO collection to container"); } } - - // Now the Collection is there for sure. Create RDO and push it into Collection. + + // Now the Collection is there for sure. Create RDO and push it into Collection. m_nRDOs++; sctRDOColl->push_back(std::make_unique<SCT3_RawData>(digitID, rawDataWord, &errorHit)); return 1; @@ -1048,7 +1045,7 @@ StatusCode SCT_RodDecoder::addSingleError(const IdentifierHash& hashID, // setFirstTempMaskedChip method -StatusCode SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashID, +StatusCode SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashID, unsigned int firstTempMaskedChip, SCT_RodDecoderErrorsHelper& errs) const { @@ -1057,7 +1054,7 @@ StatusCode SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashID, return StatusCode::RECOVERABLE; } if (firstTempMaskedChip==0) { - ATH_MSG_WARNING("setFirstTempMaskedChip: firstTempMaskedChip should be greater than 0. firstTempMaskedChip is " + ATH_MSG_WARNING("setFirstTempMaskedChip: firstTempMaskedChip should be greater than 0. firstTempMaskedChip is " << firstTempMaskedChip); return StatusCode::RECOVERABLE; } @@ -1086,16 +1083,16 @@ StatusCode SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashID, if (badLinks.first and not badLinks.second) { // link-1 is broken type = 1; - } + } else if (badLinks.second and not badLinks.first) { // link-0 is broken type = 2; - } + } else if (badLinks.first and badLinks.second) { // Both link-0 and link-1 are working ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are working. But Rx redundancy is used... Why?"); return StatusCode::RECOVERABLE; - } + } else { // Both link-0 and link-1 are broken ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are broken. But data are coming... Why?"); @@ -1182,7 +1179,7 @@ StatusCode SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashID, ATH_CHECK(addSingleError(hashSide1, SCT_ByteStreamErrors::TempMaskedChipToBit(iChip-N_CHIPS_PER_SIDE), errs)); } } - } + } else { // type=1, 2, 3, 4: cases using Rx redundancy bool toBeMasked{false}; diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h index 3337bcd375ee3c539125f65a19276e4f104447dc..7392c80fbc6bfcfbb96ba9f576d2b11d2336b26a 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h @@ -101,13 +101,15 @@ class SCT_RodDecoder : public extends<AthAlgTool, ISCT_RodDecoder> * @param rdoIDCont RDO ID Container to be filled. * @param cache Cache. * @param errorHit Hit error info. + * @param errorsCache - the cache to be filled for a given ID */ int makeRDO(int strip, int groupSize, int timeBin, const IdentifierHash& collIDHash, int errors, ISCT_RDO_Container& rdoIDCont, CacheHelper& cache, - const std::vector<int>& errorHit) const; + const std::vector<int>& errorHit, + SCT_RodDecoderErrorsHelper& errorsCache) const; /** * @brief Add an error for each wafer in the problematic ROD diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx index 04e2be4d1212b8313173b6a5be30f56c67c78a49..fdb9536be3ae39956df56a8a02514b6d77d8ccf3 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RodEncoder.h" @@ -125,7 +125,7 @@ void SCT_RodEncoder::fillROD(std::vector<uint32_t>& vec32Data, const uint32_t& r for (unsigned int iRDO1{0}; iRDO1<vecRDOs.size(); iRDO1++) { const SCT_RDORawData* rdo1{vecRDOs.at(iRDO1)}; if (rdo1 == nullptr) { - ATH_MSG_ERROR("RDO pointer is NULL. skipping this hit."); + ATH_MSG_ERROR("RDO pointer is nullptr. skipping this hit."); vec_isDuplicated.at(iRDO1) = true; continue; } diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt index 05507155665652c96cf406d8fa3c49c8d31ede57..8aefbd0a4cfff7558261ab05092ef3e9962678f4 100644 --- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt @@ -36,7 +36,7 @@ atlas_add_component( TRT_RawDataByteStreamCnv src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps Identifier ByteStreamData ByteStreamData_test InDetRawData StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib GaudiKernel TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver IRegionSelector TrigSteeringEvent ) + LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps Identifier ByteStreamData ByteStreamData_test InDetRawData StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib GaudiKernel TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver IRegionSelector TrigSteeringEvent TRT_CablingLib ) # Install files from the package: atlas_install_headers( TRT_RawDataByteStreamCnv ) diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRTRawDataProvider.cxx index b0b934bbf7750f1daf96ece1f4b87c006005501c..e246c6d68548de8afe8cf0375c9129351b3d02a3 100644 --- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRTRawDataProvider.cxx +++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRTRawDataProvider.cxx @@ -95,7 +95,7 @@ StatusCode TRTRawDataProvider::initialize() { StatusCode TRTRawDataProvider::execute() { SG::WriteHandle<TRT_RDO_Container> rdoContainer(m_rdoContainerKey); - rdoContainer = std::make_unique<TRT_RDO_Container>(m_trt_id->straw_hash_max()); + rdoContainer = std::make_unique<TRT_RDO_Container>(m_trt_id->straw_hash_max(), EventContainers::Mode::OfflineFast); ATH_CHECK(rdoContainer.isValid()); diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py index 4ef34f1cf866dd75643b49af943391ee6a5be18b..577deebb141c5d7b11cca1b954c274f34bd8ac0b 100755 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py @@ -108,7 +108,7 @@ if not jobproperties.Beam.beamType()=='cosmics': from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot_noTrig", extrapolator = InDetExtrapolator, - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) #ToolSvc += InDetAlignMonBeamSpot_noTrig @@ -232,7 +232,7 @@ if (InDetFlags.doPrintConfigurables()): from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks InDetAlignMonGenericTracks_noTrig = IDAlignMonGenericTracks (name = "InDetAlignMonGenericTracks_noTrig", trackSelection = m_alignMonTrackSelectionTool[1], - VxPrimContainerName = InDetKeys.PrimaryVertices()) + VxPrimContainerName = InDetKeys.xAODVertexContainer()) if jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam': InDetAlignMonGenericTracks_noTrig.tracksName = InDetKeys.Tracks() @@ -375,10 +375,10 @@ else: InDetAlignMonGenericTracks = IDAlignMonGenericTracks (name = "InDetAlignMonGenericTracks", trackSelection = m_alignMonTrackSelectionTool[1], tracksName = InDetKeys.ExtendedTracks(), - VxPrimContainerName = InDetKeys.PrimaryVertices()) + VxPrimContainerName = InDetKeys.xAODVertexContainer()) InDetAlignMonBeamSpot = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot", - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py index 83272832e54f51a2f7a1bbbb49ac4b636ef27be1..46d17ae2b7559ac62c153bb32c2c92c9ee72e0f5 100644 --- a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py +++ b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py @@ -166,12 +166,6 @@ if loadInDetRec_Options["TRTCalibT0TagCos"]: if loadInDetRec_Options["TRTCalibRtTagCos"]: conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"]) -#Trying to fix the Database problem -if loadInDetRec_Options["globalTag"] == "OFLCOND-RUN12-SDR-14": - conddb.addOverride('/PIXEL/PixdEdx','PixdEdx_January2011_mc-000-00') - from AthenaCommon.CfgGetter import getService - getService("AtlasFieldSvc").UseDCS = False - doJiveXML=False if doJiveXML: ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"] diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/bin/bsPlotVsMu.py b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/bsPlotVsMu.py new file mode 100644 index 0000000000000000000000000000000000000000..fb882d5ea113ffc97d1934deaee67747665b5790 --- /dev/null +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/bsPlotVsMu.py @@ -0,0 +1,445 @@ +#! /usr/bin/env python + +# Copyright (C) 2020-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function + +""" +Plot beamspot properties vs mu +""" +__author__ = 'Anthony Morley' +__version__ = '' +__usage__ = '''%prog [options] [database1] [database2] + +Database can be either connection string or db file: + + e.g COOLOFL_INDET/CONDBR2 (default) + beamspot.db/BEAMSPOT + +Example: + + bsPlotVsMu.py --rl 341123 --ru 341123 + +''' + +from DQUtils import fetch_iovs, process_iovs +from DQUtils.sugar import IOVSet,RANGEIOV_VAL,RunLumiType +from array import array +import math + +from InDetBeamSpotExample import BeamSpotData +BeamSpotData.varDefs = getattr(BeamSpotData,'varDefsGen') +from InDetBeamSpotExample.BeamSpotData import * +from CoolLumiUtilities.CoolDataReader import CoolDataReader + +import ROOT +ROOT.gROOT.SetBatch(1) + + +from optparse import OptionParser +parser = OptionParser(usage=__usage__, version=__version__) +parser.add_option('', '--folderBS', dest='folderBS', default='/Indet/Beampos', help='Folder name (default: /Indet/Beampos)') +parser.add_option('', '--folderLumi', dest='folderLumi', default='/TRIGGER/OFLLUMI/OflPrefLumi', help='Folder name (default: /TRIGGER/OFLLUMI/OflPrefLumi') +parser.add_option('', '--tagBS', dest='tagBS', default='IndetBeampos-RUN2-ES1-UPD2-22', help='Tag to compare (default: IndetBeampos-RUN2-ES1-UPD2-15)') +parser.add_option('', '--tagLumi', dest='tagLumi', default='OflPrefLumi-RUN2-UPD4-12', help='Tag to compare to (default: OflPrefLumi-RUN2-UPD4-10)') +parser.add_option('', '--rl', dest='runMin', type='int', default=None, help='Start run number (default: None)') +parser.add_option('', '--ru', dest='runMax', type='int', default=None, help='Start run number (default: None)') +parser.add_option('-p', '--plot', dest='plot', default='', help='quantity to plot, only make one plot') +parser.add_option('', '--plotGraph' , dest='plotGraph', action="store_true", default=False, help='plot a graph instead of an histogram') +(options,args) = parser.parse_args() + +db1 = args[0] if len(args)==1 else 'COOLOFL_INDET/CONDBR2' +db2 = args[1] if len(args)==2 else 'COOLOFL_TRIGGER/CONDBR2' + +# What variables to look at +varColl = [] + +if options.plot: + varColl.append(options.plot) +else: + varColl = ['posX','posY','posZ','sigmaX','sigmaY','sigmaZ'] + + + +def main(): + f1 = "%s::%s" % (db1, options.folderBS) + f2 = "%s::%s" % (db2, options.folderLumi) + + print( "="*100 ) + print( "Comparing: " ) + print( " * ", f1, options.tagBS ) + print( " * ", f2, options.tagLumi ) + print( "="*100 ) + + reuiredForNtuple = ['posX','posY','posZ','sigmaX','sigmaY','sigmaZ'] + checkNtupleProd = all(item in varColl for item in reuiredForNtuple) + if not checkNtupleProd: + print( 'Ntuple will not be filled missing vars') + + #Open up required databases + from PyCool import cool + from CoolConvUtilities import AtlCoolLib + cooldbBS = AtlCoolLib.indirectOpen(db1, True, True, False) + cooldbLumi = AtlCoolLib.indirectOpen(db2, True, True, False) + + folderBS = cooldbBS.getFolder(options.folderBS) + folderLumi = cooldbLumi.getFolder(options.folderLumi) + + + from InDetBeamSpotExample.COOLUtils import COOLQuery + coolQuery = COOLQuery() + + if options.runMin is not None: + iov1 = options.runMin << 32 + if options.runMax is not None: + iov2 = (options.runMax +1) << 32 + else : + iov2 = (options.runMin +1) << 32 + print( 'Plotting runs %i to %i ' % (iov1,iov2) ) + else : + print( 'No run selected -- ERROR' ) + return + + if (iov2>cool.ValidityKeyMax): + iov2=cool.ValidityKeyMax + + print( "Reading data from database") + itrBS = folderBS.browseObjects(iov1, iov2, cool.ChannelSelection.all(), options.tagBS) + print("...finished getting BS data") + + lbDict = dict() + + startRLB =0x7FFFFFFFFFFFFFFF + endRLB =0 + + outfile = ROOT.TFile("BeamspotLumi_%i.root" % (options.runMin),"recreate") + ntuple = ROOT.TNtuple( 'BeamspotLumi', 'BeamSpotLumi', "x:y:z:sigma_x:sigma_y:sigma_z:run:mu:lumi" ) + + + runs = set() + while itrBS.goToNext(): + + obj = itrBS.currentRef() + + since = obj.since() + + runBegin = since >> 32 + lumiBegin = since & 0xFFFFFFFF + + until = obj.until() + runUntil = until >> 32 + lumiUntil = until & 0xFFFFFFFF + + status = int(obj.payloadValue('status')) + if status != 59: + continue + + runs.add(runBegin) + + if since < startRLB: + startRLB = since + if until > endRLB: + endRLB = until + + values={} + for var in varColl: + values[var] = float(obj.payloadValue(var)) + values[var+'Err'] = float(obj.payloadValue(var+'Err')) + lbDict[since] = values + + print( 'Runs: ',runs ) + + lumi = array('d') + xd = array('d') + exd = array('d') + ydDict = {} + eydDict = {} + ydDict2 = {} + + sqtrt2pi = math.sqrt(2*math.pi) + + lblb = CoolDataReader('COOLONL_TRIGGER/CONDBR2', '/TRIGGER/LUMI/LBLB') + from DQUtils.sugar import RANGEIOV_VAL, RunLumi + from DQUtils import IOVSet + + grlIOVs=IOVSet.from_grl("data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml") + grlIOVs+=IOVSet.from_grl("data17_13TeV.periodAllYear_DetStatus-v99-pro22-01_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml") + grlIOVs+=IOVSet.from_grl("data18_13TeV.periodAllYear_DetStatus-v102-pro22-04_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml") + + + for run in runs: + iov1 = run << 32 + iov2 = (run + 1) << 32 + + itrLumi = folderLumi.browseObjects(iov1, iov2, cool.ChannelSelection.all(), options.tagLumi) + print( "...finished getting Lumi data for run %i" % run ) + + lblb.setIOVRangeFromRun(run) + lblb.readData() + if len(lblb.data) < 1: + print( 'No LBLB data found!' ) + continue + # Make time map + lblbMap = dict() + for obj in lblb.data: + lblbMap[obj.since()] = (obj.payload()['StartTime'], obj.payload()['EndTime']) + + + while itrLumi.goToNext(): + obj = itrLumi.currentRef() + + since = obj.since() + runBegin = since >> 32 + lumiBegin = since & 0xFFFFFFFF + + until = obj.until() + runUntil = until >> 32 + lumiUntil = until & 0xFFFFFFFF + + test_iov = IOVSet() + test_iov.add( RunLumiType(since), RunLumiType(since) ) + inGRL = False + for sinceGRL, untilGRL, grl_states in process_iovs(grlIOVs): + if ( sinceGRL.run <= ( since >> 32) and untilGRL.run >= (until >> 32 ) and sinceGRL.lumi <= ( since & 0xFFFFFFFF) and untilGRL.lumi >= (until & 0xFFFFFFFF ) ): + inGRL = True + break + if not inGRL: + continue + + + + mu = float(obj.payloadValue('LBAvEvtsPerBX')) + instlumi = float(obj.payloadValue('LBAvInstLumi')) + + if since in lbDict: + if lbDict[ since ]['sigmaX'] > 0.1 : + continue + startTime = lblbMap.get(obj.since(), (0., 0.))[0] + endTime = lblbMap.get(obj.until(), (0., 0.))[1] + mylumi = (endTime - startTime)/1e9 * instlumi/1e9 + lumi.append( mylumi ); # in fb^-1 + xd.append(mu) + exd.append(0) + + for var in varColl: + if not var in ydDict: + ydDict[var] = array('d') + ydDict2[var] = array('d') + eydDict[var] = array('d') + + ydDict2[var].append( mu/(lbDict[ since ][var] * sqtrt2pi )) + ydDict[var].append( lbDict[ since ][var] ) + eydDict[var].append( lbDict[ since ][var+'Err'] ) + + if checkNtupleProd: + ntuple.Fill( lbDict[ since ][ 'posX'], lbDict[ since ][ 'posY'], lbDict[ since ][ 'posZ'], lbDict[ since ][ 'sigmaX'], lbDict[ since ][ 'sigmaY'], lbDict[ since ][ 'sigmaZ'],runBegin, mu, mylumi) + + + runStart = startRLB >> 32 + runEnd = endRLB >> 32 + fillStart = fillEnd = 0 + timeStart = timeEnd = 0 + beamEnergy = 13 + try: + timeStart = coolQuery.lbTime( int(startRLB >> 32), int(startRLB & 0xFFFFFFFF) )[0] + except: + pass + try: + timeEnd = coolQuery.lbTime( int(endRLB >> 32), int(endRLB & 0xFFFFFFFF)-1 )[1] + except: + pass + try: + fillStart = coolQuery.getLHCInfo(timeStart).get('FillNumber',0) + except: + pass + try: + fillEnd = coolQuery.getLHCInfo(timeEnd).get('FillNumber',0) + except: + pass + try: + beamEnergy = coolQuery.getLHCInfo(timeStart).get('BeamEnergyGeV',0) + beamEnergy *= 2e-3 + except: + pass + + ntuple.Write() + + from InDetBeamSpotExample import ROOTUtils + ROOTUtils.setStyle() + canvas = ROOT.TCanvas('BeamSpotComparison', 'BeamSpotComparison', 1600, 1200) + + canvas.cd() + ROOT.gPad.SetTopMargin(0.05) + ROOT.gPad.SetLeftMargin(0.15) + ROOT.gPad.SetRightMargin(0.05) + + if not options.plotGraph: + ROOT.gPad.SetRightMargin(0.15) + + + #Plot each variable + for var in varColl: + if var not in ydDict: + print( 'Missing yd: ',var ) + if var not in eydDict: + print( 'Missing eyd: ',var ) + continue + + gr = ROOT.TGraphErrors(len(xd), xd, ydDict[var], exd, eydDict[var]) + + xmin = min(xd) + xmax = max(xd) + ymin = min(ydDict[var]) + ymax = max(ydDict[var]) + + h = (ymax-ymin) + ymin -= 0.25*h + ymaxSmall = ymax + 0.25*h + ymax += 0.75*h + + ymin2 = min(ydDict2[var]) + ymax2 = max(ydDict2[var]) + + h = (ymax2-ymin2) + ymin2 -= 0.25*h + ymax2 += 0.75*h + + h = (xmax-xmin) + xmin -= 0.05*h + xmax += 0.05*h + + #This histogram is made just to make it easier to manipulate the margins + histo = ROOT.TH2D('hd'+var, 'hd'+var, 100, xmin, xmax, 100, ymin, ymax) + histo.GetYaxis().SetTitle(varDef(var,'atit',var)) + histo.GetXaxis().SetTitle('Average interactions per bunch crossing') + histo.GetZaxis().SetTitle('Entries') + + histo2 = ROOT.TH2D('hd2'+var, 'hd2'+var, 100, xmin, xmax, 100, ymin2, ymax2) + histo2.GetYaxis().SetTitle( "<Interaction density> @ z=0 [interactions/mm]") + histo2.GetXaxis().SetTitle('Average interactions per bunch crossing') + histo2.GetZaxis().SetTitle('Entries') + + histo2W = ROOT.TH2D('hd3'+var, 'hd3'+var, 100, xmin, xmax, 100, ymin2, ymax2) + histo2W.GetYaxis().SetTitle( "<Interaction density> @ z=0 [interactions/mm]") + histo2W.GetXaxis().SetTitle('Average interactions per bunch crossing') + histo2W.GetZaxis().SetTitle('Integrated Luminosity (fb^{-1}/bin)') + + histoW = ROOT.TH2D('hdW'+var, 'hdW'+var, 100, xmin, xmax, 100, ymin, ymax) + histoW.GetYaxis().SetTitle(varDef(var,'atit',var)) + histoW.GetXaxis().SetTitle('Average interactions per bunch crossing') + histoW.GetZaxis().SetTitle('Integrated Luminosity (fb^{-1}/bin)') + + histoW1D = ROOT.TH1D('hd1D'+var, 'hd1D'+var, 100, ymin, ymaxSmall) + histoW1D.GetXaxis().SetTitle(varDef(var,'atit',var)) + histoW1D.GetYaxis().SetTitle('Integrated Luminosity (fb^{-1}/bin)') + + + + + histo.Draw(); + if options.plotGraph: + gr.Draw("p"); + else: + for mu, x, l in zip(xd, ydDict[var], lumi): + histo.Fill( mu, x ) + histoW.Fill( mu, x , l) + histoW1D.Fill( x, l) + for mu, x, l in zip(xd, ydDict2[var], lumi): + histo2.Fill( mu, x ) + histo2W.Fill( mu,x, l) + histo.Draw("colz") + + + histo.Write() + histoW.Write() + histo2.Write() + histo2W.Write() + histoW1D.Write() + + + # Add some information to the graph + ROOTUtils.atlasLabel( 0.53,0.87,False,offset=0.12,isForApproval=False,customstring="Internal",energy='%2.0f' % beamEnergy,size=0.055) + ROOTUtils.drawText(0.18,0.87,0.055, varDef(var,'title',var) ) + + comments = [] + + if runStart==runEnd: + comments.append('Run %i' % runStart) + else: + comments.append('Runs %i - %i' % (runStart,runEnd)) + + if fillStart==fillEnd: + comments.append('Fill %i' % fillStart) + else: + comments.append('Fills %i - %i' % (fillStart,fillEnd)) + + t1 = time.strftime('%d %b %Y',time.localtime(timeStart)) + t2 = time.strftime('%d %b %Y',time.localtime(timeEnd)) + if t1==t2: + comments.append(t1) + else: + comments.append('%s - %s' % (t1,t2)) + + ROOTUtils.drawText(0.18,0.81,0.05,';'.join(comments),font=42) + + canvas.Print( "Run_%d_%sVsMu.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%sVsMu.pdf" % ( options.runMin,var ) ) + if not options.plotGraph: + canvas.SetLogz(True) + canvas.Print( "Run_%d_%sVsMuLog.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%sVsMuLog.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(False) + + histo2.Draw("colz"); + ROOTUtils.atlasLabel( 0.53,0.87,False,offset=0.12,isForApproval=False,customstring="Internal",energy='%2.0f' % beamEnergy,size=0.055) + ROOTUtils.drawText(0.18,0.87,0.055, "Interaction density" ) + ROOTUtils.drawText(0.18,0.81,0.05,';'.join(comments),font=42) + canvas.Print( "Run_%d_Mu%sVsMu.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_Mu%sVsMu.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(True) + canvas.Print( "Run_%d_Mu%sVsMuLog.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_Mu%sVsMuLog.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(False) + + histoW.Draw("colz"); + histoW.SetMinimum(0.005); + ROOTUtils.atlasLabel( 0.53,0.87,False,offset=0.12,isForApproval=False,customstring="Internal",energy='%2.0f' % beamEnergy,size=0.055) + ROOTUtils.drawText(0.18,0.87,0.055, varDef(var,'title',var) ) + ROOTUtils.drawText(0.18,0.81,0.05,';'.join(comments),font=42) + canvas.Print( "Run_%d_%sVsMuW.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%sVsMuW.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(True) + canvas.Print( "Run_%d_%sVsMuWLog.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%sVsMuWLog.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(False) + + histo2W.Draw("colz"); + histo2W.SetMinimum(0.01); + + ROOTUtils.atlasLabel( 0.53,0.87,False,offset=0.12,isForApproval=False,customstring="Internal",energy='%2.0f' % beamEnergy,size=0.055) + ROOTUtils.drawText(0.18,0.87,0.055, "Interaction density" ) + ROOTUtils.drawText(0.18,0.81,0.05,';'.join(comments),font=42) + canvas.Print( "Run_%d_Mu%sVsMuW.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_Mu%sVsMuW.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(True) + canvas.Print( "Run_%d_Mu%sVsMuWLog.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_Mu%sVsMuWLog.pdf" % ( options.runMin,var ) ) + canvas.SetLogz(False) + + ymax = histoW1D.GetMaximum(); + histoW1D.GetYaxis().SetRangeUser(0,ymax*1.75) + histoW1D.Draw("colz"); + ROOTUtils.atlasLabel( 0.53,0.87,False,offset=0.12,isForApproval=False,customstring="Internal",energy='%2.0f' % beamEnergy,size=0.055) + ROOTUtils.drawText(0.18,0.87,0.055, varDef(var,'title',var) ) + ROOTUtils.drawText(0.18,0.81,0.05,"#mu=%2.4f RMS=%2.4f" % ( histoW1D.GetMean(), histoW1D.GetRMS() ),font=42) + canvas.Print( "Run_%d_%s1D.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%s1D.pdf" % ( options.runMin,var ) ) + canvas.SetLogy(True) + canvas.Print( "Run_%d_%s1DLog.png" % ( options.runMin,var ) ) + canvas.Print( "Run_%d_%s1DLog.pdf" % ( options.runMin,var ) ) + canvas.SetLogy(False) + + + +if __name__ == "__main__": + main() diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index cd5ec6f12eb9e356707a900e54a17ea593514a6f..433a8c7a9ed6628e9f9c126cab646262aaf6abe2 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -848,9 +848,6 @@ def getInDetHoleSearchTool(name = 'InDetHoleSearchTool', **kwargs) : if 'Extrapolator' not in kwargs : kwargs = setDefaults( kwargs, Extrapolator = getInDetExtrapolator()) - if 'PixelSummaryTool' not in kwargs : - kwargs = setDefaults( kwargs, PixelSummaryTool = getInDetPixelConditionsSummaryTool() if DetFlags.haveRIO.pixel_on() else None) - if 'SctSummaryTool' not in kwargs : kwargs = setDefaults( kwargs, SctSummaryTool = getInDetSCT_ConditionsSummaryTool() if DetFlags.haveRIO.SCT_on() else None) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py index 98c7273852edcb93b88f8fa7718bcf042a5e6e7d..13db06af68b8a4ecebe8fa933d574b1b011056ce 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py @@ -111,7 +111,7 @@ if not jobproperties.Beam.beamType()=='cosmics': from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot_noTrig", extrapolator = InDetExtrapolator, - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) #ToolSvc += InDetAlignMonBeamSpot_noTrig @@ -387,7 +387,7 @@ else: VxPrimContainerName = InDetKeys.xAODVertexContainer()) InDetAlignMonBeamSpot = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot", - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py index 7cfffe1a31d91e2ee54359a3b677051eca4eb700..619dd1fbbcf78679ebc82d5eeb96abd92c544db9 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py @@ -213,7 +213,7 @@ if InDetFlags.doMonitoringGlobal() or InDetFlags.doMonitoringPrimaryVertexingEnh if InDetFlags.doMonitoringGlobal(): from InDetVertexMonitoring.InDetVertexMonitoringConf import InDetVertexMonitoring InDetVertexMonitoring = InDetVertexMonitoring( name = "InDetVertexMonitoring", - VertexContainer = InDetKeys.PrimaryVertices(), + VertexContainer = InDetKeys.xAODVertexContainer(), DoControlPlots = False, histFolder = "InDetGlobal/PrimaryVertexMultiplicity" ) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py index 1b42891a27f2e84836aa480aeda9b3ba4976c56e..fc9c9a0f08e7cc54890bd01b252ff1a5e73febcc 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py @@ -81,6 +81,9 @@ if doErrorMonAlg: pixelAthMonAlgErrorMonAlg = helper.addAlgorithm(PixelAthErrorMonAlg, 'PixelAthErrorMonAlg') for k, v in kwargsErrMonAlg.items(): setattr(pixelAthMonAlgErrorMonAlg, k, v) + from PixelConditionsTools.PixelConditionsToolsConf import PixelByteStreamErrorsTool + # never attempt to write bytestream error objects + pixelAthMonAlgErrorMonAlg.PixelByteStreamErrorsTool = PixelByteStreamErrorsTool(ReadingESD = True) PixelAthErrorMonAlgCfg(helper, pixelAthMonAlgErrorMonAlg, **kwargsErrMonAlg) topSequence += helper.result() diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py index b34c0cd5b111614b26169c23aea2fd464ebf1172..18736a0d8bfa2327daea67e2ab3ede0425981c46 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py @@ -88,7 +88,8 @@ InDetTRT_Monitoring_Tool = TRT_Monitoring_Tool (name = " min_si_hits = minSiHitCut, # default = 3 min_pixel_hits = minPixHitCut, # default = 1 min_sct_hits = 0, - min_trt_hits = 10 + min_trt_hits = 10, + TrigDecisionObjectName = "xTrigDecision" if DQMonFlags.useTrigger else "" ) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py index 9f0bcb768a582d151e969862d1d0c3c89c6cc71a..aa7b9745a8a4a15d7db4890b4a5dcc3767f9d0db 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py @@ -6,6 +6,10 @@ include ("InDetRecExample/InDetRecCabling.py") if DetFlags.readRDOBS.pixel_on(): from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder InDetPixelRodDecoder = PixelRodDecoder(name = "InDetPixelRodDecoder") + # Disable duplcated pixel check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetPixelRodDecoder.CheckDuplicatedPixel=False ToolSvc += InDetPixelRodDecoder if (InDetFlags.doPrintConfigurables()): printfunc (InDetPixelRodDecoder) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index 7a3eba434634bb356aaa85944d0ea9b3fe8377bf..3de09a128508dae9886f4156f4876bdb35b9b9f7 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -110,7 +110,6 @@ if DetFlags.pixel_on(): UseDCSStateConditions=(globalflags.DataSource=='data') and InDetFlags.usePixelDCS(), UseDCSStatusConditions=(globalflags.DataSource=='data') and InDetFlags.usePixelDCS(), UseTDAQConditions=athenaCommonFlags.isOnline(), - ReadDeadMapKey="/PIXEL/PixMapOverlay", UseCalibConditions=True, UseCablingConditions=useCablingConditions, CablingMapFileName=IdMappingDat) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index 5c5d8674912bda31c4ad91c03fd6b3e8c386c265..052adfba56b96c7e1e0a39a0e16ca163024cc7bc 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -133,7 +133,10 @@ if InDetFlags.doPRDFormation(): # assign the tools if there are any if not InDetFlags.doTIDE_Ambi() and clusterSplitProbTool is not None : InDetMergedPixelsTool.SplitProbTool = clusterSplitProbTool if not InDetFlags.doTIDE_Ambi() and clusterSplitterTool is not None : InDetMergedPixelsTool.ClusterSplitter = clusterSplitterTool - + # Enable duplcated RDO check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetMergedPixelsTool.CheckDuplicatedRDO = True ToolSvc += InDetMergedPixelsTool if (InDetFlags.doPrintConfigurables()): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py index 104587dd0032c7ae8d935c46b27dc42260078b0f..11a40dc38b27427e3ce3644c8e90f262a6663203 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py @@ -82,8 +82,7 @@ def getInDetxAODParticleCreatorTool(prd_to_track_map=None, suffix="") : BadClusterID = InDetFlags.pixelClusterBadClusterID(), KeepParameters = True, KeepFirstParameters = InDetFlags.KeepFirstParameters(), - PerigeeExpression = _perigee_expression, - UpdateTrack = False) + PerigeeExpression = _perigee_expression) ToolSvc += InDetxAODParticleCreatorTool if InDetFlags.doPrintConfigurables(): diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigCommonTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigCommonTools.py index c9709f5f0bab02168e27132a3ac84bca1bb1ba2b..9951574a453416f46c27950ac63929d60a9f51ce 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigCommonTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigCommonTools.py @@ -1,6 +1,5 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function """ # @@ -15,6 +14,8 @@ ___version___ = "$Id: $" from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.DetFlags import DetFlags +from AthenaCommon.Logging import logging +log = logging.getLogger('InDetTrigCommonTools') # --- set Data/MC flag isMC = False @@ -131,5 +132,5 @@ if InDetTrigFlags.InDet25nsec(): ToolSvc += InDetTrigTRT_DriftCircleTool -print (InDetTrigTRT_DriftCircleTool) +log.debug(InDetTrigTRT_DriftCircleTool) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 887b932f4616419f58f63e45c44643ce0ceec148..f3f7f6e0025b97f34feb94ae9a035e8c82ba0dd4 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -131,7 +131,6 @@ class PixelConditionsServicesSetup: UseDCSStateConditions=self.useDCS, UseDCSStatusConditions=self.useDCS, UseTDAQConditions=self.useTDAQ, # should be false. This is only valid in RUN-1. - ReadDeadMapKey="/PIXEL/PixMapOverlay", UseCalibConditions=True, UseCablingConditions=useCablingConditions, CablingMapFileName=IdMappingDat) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index 55265be7c09873dfe9221cd3f43e0a31b0c8cb7d..11b940938dadcdad1c2283febee86cf2e5304846 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -674,7 +674,6 @@ if InDetTrigFlags.loadSummaryTool(): Extrapolator = InDetTrigExtrapolator, usePixel = DetFlags.haveRIO.pixel_on(), useSCT = DetFlags.haveRIO.SCT_on(), - PixelSummaryTool = InDetTrigPixelConditionsSummaryTool, SctSummaryTool = InDetTrigSCTConditionsSummaryTool, PixelLayerTool=InDetTrigTestPixelLayerTool, ) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py index 422959bc8289f628cccd6ac040b3aa8a83c117fb..655254ca3dd1455c539004f31e6bcb9ce1f1af78 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py @@ -46,6 +46,10 @@ class PixelClustering_EF( InDet__Pixel_TrgClusterization ): from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder InDetTrigPixelRodDecoder = PixelRodDecoder(name = "InDetTrigPixelRodDecoder") #InDetTrigPixelRodDecoder.OutputLevel=2 + # Disable duplcated pixel check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetTrigPixelRodDecoder.CheckDuplicatedPixel=False ToolSvc += InDetTrigPixelRodDecoder from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool @@ -80,6 +84,11 @@ class PixelClustering_EF( InDet__Pixel_TrgClusterization ): MaximalSplitSize = 49, MinimalSplitProbability = 0, ) + # Enable duplcated RDO check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetTrigMergedPixelsTool.CheckDuplicatedRDO = True + ToolSvc += InDetTrigMergedPixelsTool # PixelGangedAmbiguitiesFinder tool (public) diff --git a/InnerDetector/InDetG4/SCT_G4_SD/test/SctSensorSD_gtest.cxx b/InnerDetector/InDetG4/SCT_G4_SD/test/SctSensorSD_gtest.cxx index 3e6f9dcc56e90f4d512a230fd2d52c270bb5a182..b058ab89fc4242476506d2e492e0bb596797e8bc 100644 --- a/InnerDetector/InDetG4/SCT_G4_SD/test/SctSensorSD_gtest.cxx +++ b/InnerDetector/InDetG4/SCT_G4_SD/test/SctSensorSD_gtest.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "src/SctSensorSD.h" @@ -118,7 +118,7 @@ TEST_F( SctSensorSDtest, indexMethod ) G4String name = "logicalName"; G4LogicalVolume fLogical(box, material, name); G4String name1 = "physicalName"; - G4VPhysicalVolume* pPhysical = NULL; + G4VPhysicalVolume* pPhysical = nullptr; G4MyPhysicalVolume physicalVolume(0, G4ThreeVector(0,0,0), name1, &fLogical, pPhysical); physicalVolume.SetCopyNo(1000); G4int nReplica = 2; diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt index e01c086e997b5dcfdeb4a25c627d187d95d3eb83..d68394414689d5bcc182eaa86ccaa2d397bd28a9 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt @@ -26,6 +26,5 @@ atlas_add_component( InDetDiMuonMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaMonitoringLib xAODMuon xAODTracking GaudiKernel StoreGateLib SGtests ) # Install files from the package: -atlas_install_headers( InDetDiMuonMonitoring ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx index c9aabceb83ba52e40821fe022fbf76e118fbed52..ba1da34f5f486168c1bbe32f24b2ea8e79bb011b 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx @@ -1,28 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <sstream> -#include "GaudiKernel/IJobOptionsSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/StatusCode.h" #include "GaudiKernel/PhysicalConstants.h" -#include "InDetDiMuonMonitoring/DiMuMon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODMuon/Muon.h" +#include "DiMuMon.h" #include <math.h> -#include "TProfile.h" -#include "TMath.h" #include "TF1.h" -#include "TH1.h" -#include "TH2.h" #include "TCanvas.h" -#include "TString.h" -#include "TLorentzVector.h" -#include "TPostScript.h" #include "TStyle.h" #include "RooRealVar.h" @@ -41,11 +29,9 @@ DiMuMon::DiMuMon( const std::string & type, const std::string & name, const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ) , m_triggerChainName("NoTrig") - , m_muonCollection("Muons") { declareProperty( "resonName", m_resonName = "Zmumu" ); declareProperty( "triggerChainName", m_triggerChainName = "NoTrig" ); - declareProperty( "muonCollection", m_muonCollection = "Muons" ); declareProperty( "setDebug", m_setDebug = false ); declareProperty( "minInvmass", m_minInvmass = 60.); declareProperty( "maxInvmass", m_maxInvmass = 120.); @@ -72,6 +58,7 @@ DiMuMon::~DiMuMon() StatusCode DiMuMon::initialize(){ ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_muonCollection.initialize() ); if (m_regions.empty()) { m_regions.push_back("All"); @@ -257,24 +244,16 @@ StatusCode DiMuMon::bookHistograms() StatusCode DiMuMon::fillHistograms() { - // if (m_lumiBlockNum<402 || m_lumiBlockNum>1330) return StatusCode::SUCCESS; - - double muonMass = 105.66*Gaudi::Units::MeV; + const double muonMass = 105.66*Gaudi::Units::MeV; //retrieve all muons - const xAOD::MuonContainer* muons(0); - StatusCode sc = evtStore()->retrieve(muons, m_muonCollection); - if(sc.isFailure()){ + SG::ReadHandle<xAOD::MuonContainer> muons{m_muonCollection}; + if(!muons.isValid()){ ATH_MSG_WARNING("Could not retrieve muon container"); - return sc; + return StatusCode::FAILURE; } else ATH_MSG_DEBUG("Muon container successfully retrieved."); //make a new container xAOD::MuonContainer* goodMuons = new xAOD::MuonContainer( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( goodMuons, "myGoodMuons" + m_triggerChainName + m_resonName); - if (!sc.isSuccess()) { - ATH_MSG_WARNING("Could not record good muon tracks container."); - return StatusCode::FAILURE; - } //pick out the good muon tracks and store in the new container for(const auto* muon : *muons ) { @@ -308,11 +287,6 @@ StatusCode DiMuMon::fillHistograms() goodMuons->push_back(const_cast<xAOD::Muon*>(muon)); } - sc = evtStore()->setConst( goodMuons ); - if (!sc.isSuccess()) { - ATH_MSG_ERROR("Could not set good muon track collection to const"); - return StatusCode::FAILURE; - } //pair up the tracks of the good muons and fill histograms int nMuons = goodMuons->size(); @@ -614,7 +588,7 @@ void DiMuMon::RegisterHisto(MonGroup& mon, T* histo) { StatusCode sc = mon.regHist(histo); if (sc.isFailure() ) { - msg(MSG::WARNING) << "Cannot book histogram:" << endmsg; + ATH_MSG_WARNING( "Cannot book histogram:" ); } } diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.h similarity index 92% rename from InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h rename to InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.h index 07648797421d88eac48ea96d45f2d84651f6c096..5e260abc480ece3d30db2eee4e09b15fa15691ff 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DiMuMon_H @@ -12,6 +12,7 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODMuon/MuonContainer.h" class TH1F; @@ -62,7 +63,7 @@ class DiMuMon : public ManagedMonitorToolBase std::string m_resonName{}; std::string m_triggerChainName{}; - std::string m_muonCollection{}; + SG::ReadHandleKey<xAOD::MuonContainer> m_muonCollection{this, "muonCollection", "Muons"}; bool m_doFits{}; bool m_doSaveFits{}; diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx index 0657ecf56b9f0c3f83978e32960c0154a5758569..aecca645a76f3580de0a7cb84ec015599b5fbe42 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx @@ -1,3 +1,3 @@ -#include "InDetDiMuonMonitoring/DiMuMon.h" +#include "../DiMuMon.h" DECLARE_COMPONENT( DiMuMon ) diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h index 9c76bc489d27d3464f98c145f0d1eab38e643ec4..d2847b9ea97981993f54f857282fa16c853a9ee4 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************************** @@ -90,7 +90,7 @@ private: std::string m_stream; bool m_useBeamspot; - SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","VxPrimaryCandidate","Vertex Container for Global Beamsport Monitoring"}; + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","PrimaryVertices","Vertex Container for Global Beamsport Monitoring"}; bool m_vxContainerWithBeamConstraint; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackContainerName{this,"trackContainerName","TrackParticle container for Gloabl Beamsport Monitoring"}; diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx index 98bfffcc5ef8c0d18884755a014b62c8dc6ec6e8..8e0bade70f86e1ae83c4f8f7e6ec5485bc00f72c 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx @@ -80,8 +80,8 @@ StatusCode InDetGlobalPrimaryVertexMonTool::initialize() { if(!sc.isSuccess()) return sc; ATH_CHECK( m_vxContainerName.initialize() ); - ATH_CHECK( m_vxContainerNameWithoutBeamConstraint.initialize() ); - ATH_CHECK( m_vxContainerNameSplit.initialize() ); + ATH_CHECK( m_vxContainerNameWithoutBeamConstraint.initialize(m_doEnhancedMonitoring) ); + ATH_CHECK( m_vxContainerNameSplit.initialize(m_doEnhancedMonitoring) ); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py index 77939a9147591949dc116373d87a7ce4dff2c9cd..c2ea2bf8c04e15d9da6c12221f3ebf9979b02ddd 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py @@ -114,7 +114,7 @@ for trackCollection in trackCollections: tracksName = trackCollection, useExtendedPlots = True, triggerChainName = "all", - VxPrimContainerName = InDetKeys.PrimaryVertices() + VxPrimContainerName = InDetKeys.xAODVertexContainer() ) #ToolSvc += InDetAlignMonGenericTracks InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ] diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py index 0f6b56933ad591ecf84d85a957cbdd133367deb6..77bdacc15a1688a0b7cdbe3760944e06702e4151 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py @@ -75,6 +75,8 @@ def PixelMonitoringConfig(flags): pixelAthMonAlgErrorMonAlg = helper.addAlgorithm(PixelAthErrorMonAlg, 'PixelAthErrorMonAlg') for k, v in kwargsErrMonAlg.items(): setattr(pixelAthMonAlgErrorMonAlg, k, v) + from PixelConditionsTools.PixelConditionsToolsConf import PixelByteStreamErrorsTool + pixelAthMonAlgErrorMonAlg.PixelByteStreamErrorsTool = PixelByteStreamErrorsTool(ReadingESD = (flags.DQ.Environment == 'tier0ESD')) PixelAthErrorMonAlgCfg(helper, pixelAthMonAlgErrorMonAlg, **kwargsErrMonAlg) acc.merge(helper.result()) diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx index 2378a8e29b9159aa86cca5a07020a14288333bb9..5f5669ea3d4a73aa091d4724437c25201130c3f2 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx @@ -9,7 +9,7 @@ PixelAthErrorMonAlg::PixelAthErrorMonAlg( const std::string& name, ISvcLocator* m_pixelid(nullptr) { //jo flags - declareProperty("ErrorsTool", m_pixelErrorTool); + // declareProperty("ErrorsTool", m_pixelErrorTool); declareProperty("doOnline", m_doOnline = false); declareProperty("doModules", m_doModules = false); declareProperty("doLumiBlock", m_doLumiBlock = false); diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt index 711e9f89e38ea6a3d83f3f3912e16d56be50b7cf..2a99f2bce31e97789004c23a7b19070b6c1dc444 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt @@ -24,7 +24,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkTools/TrkToolInterfaces Trigger/TrigAnalysis/TrigAnalysisInterfaces PRIVATE - Luminosity/LumiBlockData + LumiBlock/LumiBlockData Control/AthenaKernel Control/AthContainers DetectorDescription/Identifier @@ -40,7 +40,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrackSummary Trigger/TrigEvent/TrigDecisionInterface MagneticField/MagFieldElements - MagneticField/MagFieldCondition ) + MagneticField/MagFieldConditions ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py index 4719887d4af504ed1f90716f2ccca5235a840312..ee832c2c61adc3f7004c37500a6c863731631d2e 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py @@ -77,7 +77,6 @@ def TrackSummaryToolWorkaround(flags): result.addPublicTool(InDetTestPixelLayerTool) InDetHoleSearchTool = CompFactory.InDet.InDetTrackHoleSearchTool(name = "InDetHoleSearchTool", Extrapolator = InDetExtrapolator, - PixelSummaryTool = InDetPixelConditionsSummaryTool, usePixel = flags.Detector.GeometryPixel, useSCT = flags.Detector.GeometrySCT, CountDeadModulesAfterLastHit = True, diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/HistogramOperations.cpp b/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/HistogramOperations.cpp index 4bafc2c9fa00e7dd5010dc2debce9541a91f386c..c3ba56d7bda8854a522e8c73c3a12deae99151c5 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/HistogramOperations.cpp +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/HistogramOperations.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -42,7 +42,7 @@ double HistogramOperations::BinwiseCompare( TH1 * NewInput, TH1 * OldInput, stri if ( newX == oldX && newY == oldY && newZ == oldZ ) { //Parse the argument as the allowed percentage change in each bin value - double allowedDiff = strtod( Argument.c_str(), NULL ); + double allowedDiff = strtod( Argument.c_str(), nullptr ); //Compare each bin double totalMismatch = 0.0; @@ -65,8 +65,8 @@ double HistogramOperations::BinwiseCompare( TH1 * NewInput, TH1 * OldInput, stri //Compare double mismatch = 0.0; - if(UsePercent) mismatch = fabs( newBinContent - oldBinContent ) * 100.0 / newBinContent; - else mismatch = fabs( newBinContent - oldBinContent ); + if(UsePercent) mismatch = std::abs( newBinContent - oldBinContent ) * 100.0 / newBinContent; + else mismatch = std::abs( newBinContent - oldBinContent ); //Add to the total mismatch score unless it's within the fuzz factor if ( mismatch > allowedDiff ) @@ -104,7 +104,7 @@ double HistogramOperations::BinwiseHackCompare( TH1 * NewInput, TH1 * OldInput, vector<double> binChange; for ( int argumentIndex = 0; argumentIndex < splitArgument.size(); argumentIndex++ ) { - binChange.push_back( strtod( splitArgument[argumentIndex].c_str(), NULL ) ); + binChange.push_back( strtod( splitArgument[argumentIndex].c_str(), nullptr ) ); } int newX = NewInput->GetNbinsX(); @@ -141,7 +141,7 @@ double HistogramOperations::BinwiseHackCompare( TH1 * NewInput, TH1 * OldInput, } //Compare - double mismatch = fabs( newBinContent - oldBinContent ) * 100.0 / newBinContent; + double mismatch = std::abs( newBinContent - oldBinContent ) * 100.0 / newBinContent; //Add to the total mismatch score unless it's within the fuzz factor if ( mismatch > binChange[xIndex] ) @@ -175,7 +175,7 @@ double HistogramOperations::BinwiseHackCompare( TH1 * NewInput, TH1 * OldInput, double HistogramOperations::KolmogorovTest( TH1 * NewInput, TH1 * OldInput, string Argument ) { //Parse the argument as the minimum allowed probability of match - double threshold = strtod( Argument.c_str(), NULL ); + double threshold = strtod( Argument.c_str(), nullptr ); //Perform the Kolmogorov-Smirnov test NewInput->Sumw2(); @@ -221,7 +221,7 @@ double HistogramOperations::CompareMean( TH1 * NewInput, TH1 * OldInput, string else { comparison = 0; - allowedDiff = strtod( Argument.c_str(), NULL ); + allowedDiff = strtod( Argument.c_str(), nullptr ); } //Loop over all axes @@ -230,8 +230,8 @@ double HistogramOperations::CompareMean( TH1 * NewInput, TH1 * OldInput, string double newMean = NewInput->GetMean(axisIndex); double oldMean = OldInput->GetMean(axisIndex); double seeChange = 0.0; - if(UsePercent) seeChange = fabs( newMean - oldMean ) * 100.0 / newMean; - else seeChange = fabs( newMean - oldMean ); + if(UsePercent) seeChange = std::abs( newMean - oldMean ) * 100.0 / newMean; + else seeChange = std::abs( newMean - oldMean ); if ( comparison == 0 && seeChange > allowedDiff ) { @@ -250,12 +250,12 @@ double HistogramOperations::CompareMean( TH1 * NewInput, TH1 * OldInput, string cerr << "WARNING: Mean of " << NewInput->GetName() << " has reduced on the " << axisIndex << " axis" << endl; result += oldMean - newMean; } - else if ( comparison == 3 && fabs(newMean) > fabs(oldMean) ) + else if ( comparison == 3 && std::abs(newMean) > std::abs(oldMean) ) { cerr << "WARNING: Absolute value of the mean of " << NewInput->GetName() << " has increased on the " << axisIndex << " axis" << endl; result += oldMean - newMean; } - else if ( comparison == 4 && fabs(newMean) < fabs(oldMean) ) + else if ( comparison == 4 && std::abs(newMean) < std::abs(oldMean) ) { cerr << "WARNING: Absolute value of the mean of " << NewInput->GetName() << " has decreased on the " << axisIndex << " axis" << endl; result += oldMean - newMean; @@ -284,7 +284,7 @@ double HistogramOperations::CompareSigma( TH1 * NewInput, TH1 * OldInput, string else { comparison = 0; - allowedDiff = strtod( Argument.c_str(), NULL ); + allowedDiff = strtod( Argument.c_str(), nullptr ); } //Loop over all axes @@ -293,8 +293,8 @@ double HistogramOperations::CompareSigma( TH1 * NewInput, TH1 * OldInput, string double newSigma = NewInput->GetRMS(axisIndex); double oldSigma = OldInput->GetRMS(axisIndex); double seeChange = 0.0; - if(UsePercent) seeChange = fabs( newSigma - oldSigma ) * 100.0 / newSigma; - else seeChange = fabs( newSigma - oldSigma ); + if(UsePercent) seeChange = std::abs( newSigma - oldSigma ) * 100.0 / newSigma; + else seeChange = std::abs( newSigma - oldSigma ); if ( comparison == 0 && seeChange > allowedDiff ) { @@ -322,10 +322,10 @@ double HistogramOperations::CompareSigma( TH1 * NewInput, TH1 * OldInput, string double HistogramOperations::CompareTotalEntries( TH1 * NewInput, TH1 * OldInput, string Argument ) { //Parse the argument as the allowed percentage change - double percentChange = strtod( Argument.c_str(), NULL ); + double percentChange = strtod( Argument.c_str(), nullptr ); //Calculate the percentage change in number of entries - double change = fabs( NewInput->GetEntries() - OldInput->GetEntries() ) * 100.0 / NewInput->GetEntries(); + double change = std::abs( NewInput->GetEntries() - OldInput->GetEntries() ) * 100.0 / NewInput->GetEntries(); //Warn if outside allowed range if ( change > percentChange ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/main.cpp b/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/main.cpp index 9fb9f62b16f8b8ee99a0a45bef02c877f116d84b..9bf92320e2a6e1891c77fc836690caac9ab5a338 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/main.cpp +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/scripts/CheckReprocessing/src/main.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -79,7 +79,7 @@ int main( int argc, char * argv[] ) directory = opendir( argv[argumentIndex] ); if (directory) { - while ( ( directoryEntry = readdir(directory) ) != NULL ) + while ( ( directoryEntry = readdir(directory) ) != nullptr ) { string entryName = directoryEntry->d_name; if ( entryName != "." && entryName != ".." ) @@ -108,7 +108,7 @@ int main( int argc, char * argv[] ) directory = opendir( argv[argumentIndex] ); if (directory) { - while ( ( directoryEntry = readdir(directory) ) != NULL ) + while ( ( directoryEntry = readdir(directory) ) != nullptr ) { string entryName = directoryEntry->d_name; if ( entryName != "." && entryName != ".." ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonAlg.cxx index dac02d6d4b255ced7daece9a4505e94dfa24da4b..a29a4483fa03afe8e46c3bc859ee220ad3ed94cf 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonAlg.cxx @@ -9,10 +9,9 @@ #include "SCT_ReadoutGeometry/SCT_DetectorManager.h" #include "StoreGate/ReadHandle.h" -using namespace std; using namespace SCT_Monitoring; -SCTErrMonAlg::SCTErrMonAlg(const string& name, ISvcLocator* pSvcLocator) +SCTErrMonAlg::SCTErrMonAlg(const std::string& name, ISvcLocator* pSvcLocator) :AthMonitorAlgorithm(name,pSvcLocator) { for (int reg{0}; reg<N_REGIONS_INC_GENERAL; reg++) { m_nMaskedLinks[reg] = 0; @@ -95,7 +94,7 @@ StatusCode SCTErrMonAlg::fillHistograms(const EventContext& ctx) const { // The numbers of disabled modules, links, strips do not change during a run. if (m_isFirstConfigurationDetails) { - lock_guard glock{m_mutex}; + std::lock_guard<std::mutex> glock{m_mutex}; if (m_isFirstConfigurationDetails) { ATH_CHECK(fillConfigurationDetails(ctx)); m_isFirstConfigurationDetails = false; @@ -129,7 +128,7 @@ StatusCode SCTErrMonAlg::fillHistograms(const EventContext& ctx) const { StatusCode SCTErrMonAlg::stop() { /// Fill /SCT/GENERAL/errors/Masked Links only for last event /// - array<int, N_REGIONS_INC_GENERAL> maskedLinksBin{ENDCAP_C_INDEX, BARREL_INDEX, ENDCAP_A_INDEX, GENERAL_INDEX}; + std::array<int, N_REGIONS_INC_GENERAL> maskedLinksBin{ENDCAP_C_INDEX, BARREL_INDEX, ENDCAP_A_INDEX, GENERAL_INDEX}; auto maskedLinksBinAcc{Monitored::Collection("maskedLinksBin", maskedLinksBin)}; auto maskedLinksAcc{Monitored::Collection("maskedLinks", m_nMaskedLinks)}; fill("SCTErrMonitor", maskedLinksBinAcc, maskedLinksAcc); @@ -141,10 +140,10 @@ StatusCode SCTErrMonAlg::fillConfigurationDetails(const EventContext& ctx) const { ATH_MSG_DEBUG("Inside fillConfigurationDetails()"); unsigned int nBadMods{static_cast<unsigned int>(m_configurationTool->badModules()->size())}; // bad modules - const map<IdentifierHash, pair<bool, bool>>* badLinks{m_configurationTool->badLinks(ctx)}; // bad links + const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{m_configurationTool->badLinks(ctx)}; // bad links unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0}; - for (const pair<IdentifierHash, pair<bool, bool>>& link: *badLinks) { - pair<bool, bool> status{link.second}; + for (const std::pair<IdentifierHash, std::pair<bool, bool>>& link: *badLinks) { + std::pair<bool, bool> status{link.second}; if ((status.first == false) and (status.second == true)) { ++nBadLink0; } @@ -156,20 +155,20 @@ SCTErrMonAlg::fillConfigurationDetails(const EventContext& ctx) const { } } - const map<Identifier, unsigned int>* badChips{m_configurationTool->badChips(ctx)}; // bad chips + const std::map<Identifier, unsigned int>* badChips{m_configurationTool->badChips(ctx)}; // bad chips unsigned int nBadChips{0}; - for (const pair<Identifier, unsigned int>& chip : *badChips) { + for (const std::pair<Identifier, unsigned int>& chip : *badChips) { unsigned int status{chip.second}; for (unsigned int i{0}; i < CHIPS_PER_MODULE; i++) { nBadChips += ((status & (1 << i)) == 0 ? 0 : 1); } } - set<Identifier> badStripsAll; // bad strips + std::set<Identifier> badStripsAll; // bad strips m_configurationTool->badStrips(badStripsAll, ctx); unsigned int nBadStrips{static_cast<unsigned int>(badStripsAll.size())}; - set<Identifier> badStripsExclusive; // bad strips w/o bad modules and chips + std::set<Identifier> badStripsExclusive; // bad strips w/o bad modules and chips m_configurationTool->badStrips(badStripsExclusive, ctx, true, true); int nBadStripsExclusive{static_cast<int>(badStripsExclusive.size())}; int nBadStripsExclusiveBEC[N_REGIONS] = { @@ -181,8 +180,8 @@ SCTErrMonAlg::fillConfigurationDetails(const EventContext& ctx) const { } /// Fill /SCT/GENERAL/Conf/SCTConfDetails /// - vector<int> vDetailedConfBin(ConfbinsDetailed); - vector<double> vNBad(ConfbinsDetailed); + std::vector<int> vDetailedConfBin(ConfbinsDetailed); + std::vector<double> vNBad(ConfbinsDetailed); for (unsigned int i{0}; i<ConfbinsDetailed; i++) { vDetailedConfBin[i] = i; if (i==0) vNBad[i] = nBadMods; @@ -233,7 +232,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { categoryErrorMap_t categoryErrorMap; int total_errors{0}; - array<int, N_REGIONS_INC_GENERAL> nMaskedLinks; + std::array<int, N_REGIONS_INC_GENERAL> nMaskedLinks; nMaskedLinks.fill(0); for (int errType{0}; errType < SCT_ByteStreamErrors::NUM_ERROR_TYPES; ++errType) { total_errors += fillByteStreamErrorsHelper(m_byteStreamErrTool->getErrorSet(errType), errType, categoryErrorMap, nMaskedLinks); @@ -242,9 +241,9 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { m_nMaskedLinks[reg] = nMaskedLinks[reg]; } /// Fill /SCT/GENERAL/errors/SCT_LinksWith*VsLbs /// - vector<int> vEta; - vector<int> vPhi; - vector<bool> vHasError; + std::vector<int> vEta; + std::vector<int> vPhi; + std::vector<bool> vHasError; for (int errCate{0}; errCate < CategoryErrors::N_ERRCATEGORY; ++errCate) { auto lumiBlockAcc{Monitored::Scalar<int>("lumiBlock", pEvent->lumiBlock())}; auto nCategoryErrorsAcc{Monitored::Scalar<int>("n_"+CategoryErrorsNames[errCate], @@ -274,7 +273,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { } auto etaAcc{Monitored::Collection("eta", vEta)}; auto phiAcc{Monitored::Collection("phi", vPhi)}; - auto hasErrorAcc{Monitored::Collection("hasError_"+CategoryErrorsNames[errCate]+"_"+subDetNameShort[iReg].Data()+"_"+to_string(iLay/2)+"_"+to_string(iLay%2), + auto hasErrorAcc{Monitored::Collection("hasError_"+CategoryErrorsNames[errCate]+"_"+subDetNameShort[iReg].Data()+"_"+std::to_string(iLay/2)+"_"+std::to_string(iLay%2), vHasError)}; fill("SCTErrMonitor", etaAcc, phiAcc, hasErrorAcc); } @@ -286,7 +285,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { m_firstEventOfLB[pEvent->lumiBlock()] = false; ATH_MSG_DEBUG("Detector Coverage calculation starts" ); - static const string names[numberOfProblemForCoverage] = { + static const std::string names[numberOfProblemForCoverage] = { "SCT_AllRegion", // All "SCT_MapOfDisabledLinks", // Disabled "SCT_MapOfLinksWithBadLinkLevelErrors", // BadLinkLevelError @@ -295,7 +294,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { "SCT_MapOfLinksWithPSTrip", // PSTrip (DCS) "SCT_MapOfLinksWithAnyProbelm" // Summary }; - static const string titles[numberOfProblemForCoverage] = { + static const std::string titles[numberOfProblemForCoverage] = { "Map of All Region", // All "Map of Disabled Links", // Disabled "Map of Links with bad LinkLevelErrors", // BadLinkLevelError @@ -305,7 +304,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { "Map of Links with Any Bad Problem" // Summary }; - lock_guard<mutex> lock{m_mutex}; + std::lock_guard<std::mutex> lock{m_mutex}; CacheEntry* ent{m_cache.get(ctx)}; if (ent->m_evt!=ctx.evt()) { // New event in this slot if (ent->m_mapSCT.empty()) { // First event @@ -323,7 +322,7 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { ent->m_evt = ctx.evt(); } - set<IdentifierHash> sctHash[numberOfProblemForCoverage]{{}}; + std::set<IdentifierHash> sctHash[numberOfProblemForCoverage]{{}}; disabledSCT(sctHash[disabled]); errorSCT(sctHash[badLinkError], sctHash[badRODError], sctHash[badError]); summarySCT(sctHash[allRegion], sctHash[summary]); @@ -355,12 +354,12 @@ SCTErrMonAlg::fillByteStreamErrors(const EventContext& ctx) const { } int -SCTErrMonAlg::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, +SCTErrMonAlg::fillByteStreamErrorsHelper(const std::set<IdentifierHash>& errors, int err_type, categoryErrorMap_t& categoryErrorMap, - array<int, N_REGIONS_INC_GENERAL>& nMaskedLinks) const { + std::array<int, N_REGIONS_INC_GENERAL>& nMaskedLinks) const { //--- Check categories of the BS error - array<bool, CategoryErrors::N_ERRCATEGORY> b_category; + std::array<bool, CategoryErrors::N_ERRCATEGORY> b_category; b_category.fill(false); b_category[CategoryErrors::MASKEDLINKALL] = @@ -397,7 +396,7 @@ SCTErrMonAlg::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, (err_type == SCT_ByteStreamErrors::TempMaskedChip2) or (err_type == SCT_ByteStreamErrors::TempMaskedChip3) or (err_type == SCT_ByteStreamErrors::TempMaskedChip4) or (err_type == SCT_ByteStreamErrors::TempMaskedChip5); - vector<int> numErrorsPerLumi[N_REGIONS]; + std::vector<int> numErrorsPerLumi[N_REGIONS]; if (m_doPerLumiErrors) { for (int reg{0}; reg<N_REGIONS; reg++) { const int nLayers{n_layers[reg]*2}; @@ -447,13 +446,13 @@ SCTErrMonAlg::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, } if (m_doPerLumiErrors) { - size_t size{static_cast<size_t>(N_REGIONS*n_layers[ENDCAP_C_INDEX]*N_SIDES)}; - vector<int> vErrorType; - vector<int> vLayerSide; - vector<float> vErrorFraction; - vector<bool> vIsEC; - vector<bool> vIsB; - vector<bool> vIsEA; + std::size_t size{static_cast<size_t>(N_REGIONS*n_layers[ENDCAP_C_INDEX]*N_SIDES)}; + std::vector<int> vErrorType; + std::vector<int> vLayerSide; + std::vector<float> vErrorFraction; + std::vector<bool> vIsEC; + std::vector<bool> vIsB; + std::vector<bool> vIsEA; vErrorType.reserve(size); vLayerSide.reserve(size); vErrorFraction.reserve(size); @@ -488,7 +487,7 @@ SCTErrMonAlg::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, } void -SCTErrMonAlg::numByteStreamErrors(const set<IdentifierHash>& errors, int& ntot) const { +SCTErrMonAlg::numByteStreamErrors(const std::set<IdentifierHash>& errors, int& ntot) const { for (const auto& fit: errors) { if (fit.is_valid()) { ntot++; @@ -496,10 +495,10 @@ SCTErrMonAlg::numByteStreamErrors(const set<IdentifierHash>& errors, int& ntot) } } -bool SCTErrMonAlg::disabledSCT(set<IdentifierHash>& sctHashDisabled) const { +bool SCTErrMonAlg::disabledSCT(std::set<IdentifierHash>& sctHashDisabled) const { bool altered{false}; sctHashDisabled.clear(); - const set<Identifier>* badModules{m_configurationTool->badModules()}; + const std::set<Identifier>* badModules{m_configurationTool->badModules()}; for (const Identifier& badModule: *badModules) { altered = true; @@ -512,16 +511,16 @@ bool SCTErrMonAlg::disabledSCT(set<IdentifierHash>& sctHashDisabled) const { return altered; } -bool SCTErrMonAlg::errorSCT(set<IdentifierHash>& sctHashBadLinkError, - set<IdentifierHash>& sctHashBadRODError, - set<IdentifierHash>& sctHashBadError) const { +bool SCTErrMonAlg::errorSCT(std::set<IdentifierHash>& sctHashBadLinkError, + std::set<IdentifierHash>& sctHashBadRODError, + std::set<IdentifierHash>& sctHashBadError) const { sctHashBadLinkError.clear(); sctHashBadRODError.clear(); sctHashBadError.clear(); //BadLinkLevelError for (SCT_ByteStreamErrors::ErrorType linkLevelBadErrors: SCT_ByteStreamErrors::LinkLevelBadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( linkLevelBadErrors )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( linkLevelBadErrors )}; for (const IdentifierHash& waferHash : sctErrors) { sctHashBadLinkError.insert(waferHash); } @@ -529,7 +528,7 @@ bool SCTErrMonAlg::errorSCT(set<IdentifierHash>& sctHashBadLinkError, //BadRODLevelError for (SCT_ByteStreamErrors::ErrorType RodLevelBadErrors: SCT_ByteStreamErrors::RodLevelBadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( RodLevelBadErrors )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( RodLevelBadErrors )}; for (const IdentifierHash& waferHash : sctErrors) { sctHashBadRODError.insert(waferHash); } @@ -537,7 +536,7 @@ bool SCTErrMonAlg::errorSCT(set<IdentifierHash>& sctHashBadLinkError, //BadError = BadLinkLevelError + BadRODLevelError for (SCT_ByteStreamErrors::ErrorType tmpBadError: SCT_ByteStreamErrors::BadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( tmpBadError )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( tmpBadError )}; for (const IdentifierHash& waferHash : sctErrors) { sctHashBadError.insert(waferHash); } @@ -546,7 +545,7 @@ bool SCTErrMonAlg::errorSCT(set<IdentifierHash>& sctHashBadLinkError, } // Total (SCT_ConditionsSummaryTool) -bool SCTErrMonAlg::summarySCT(set<IdentifierHash>& sctHashAll, set<IdentifierHash>& sctHashSummary) const { +bool SCTErrMonAlg::summarySCT(std::set<IdentifierHash>& sctHashAll, std::set<IdentifierHash>& sctHashSummary) const { bool altered{false}; sctHashAll.clear();//All sctHashSummary.clear(); @@ -563,7 +562,7 @@ bool SCTErrMonAlg::summarySCT(set<IdentifierHash>& sctHashAll, set<IdentifierHas } // Power supply trip (SCT_DCSConditionsTool) -bool SCTErrMonAlg::psTripDCSSCT(set<IdentifierHash>& sctHashPSTripDCS, float& psTripModules) const { +bool SCTErrMonAlg::psTripDCSSCT(std::set<IdentifierHash>& sctHashPSTripDCS, float& psTripModules) const { bool altered{false}; sctHashPSTripDCS.clear(); diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx index 56d22ab017ab4eb82cae8266689307d22a48e141..9e19bb6439ab437021e42e7bd88899e809b256f7 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTErrMonTool.cxx @@ -30,7 +30,6 @@ #include <map> #include <utility> -using namespace std; using namespace SCT_Monitoring; namespace { @@ -101,7 +100,7 @@ namespace { * the first and second plane numbers to be used, and the timebin. */ // ==================================================================================================== -SCTErrMonTool::SCTErrMonTool(const string& type, const string& name, const IInterface* parent) +SCTErrMonTool::SCTErrMonTool(const std::string& type, const std::string& name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) { } @@ -212,7 +211,7 @@ SCTErrMonTool::bookHistograms() { // SCTErrMonTool :: bookHistogramsRecurrent, Keisuke Koda 12.09.2016 //==================================================================================================== StatusCode SCTErrMonTool::bookHistogramsRecurrent() { - static const string profNames[numberOfProblemForCoverage] = { + static const std::string profNames[numberOfProblemForCoverage] = { "", // All "SCT_CoverageOfEnabledLinksVsLbs", // All - Disabled "SCT_CoverageWithNoBadLinkLevelErrorVsLbs", // All - BadLinkLevelError @@ -221,7 +220,7 @@ StatusCode SCTErrMonTool::bookHistogramsRecurrent() { "SCT_CoverageWithNoPSTripVsLbs", // All - PSTrip(DCS) "SCT_CoverageOfLinksWithNoBadProblemVsLbs" // All - Summary }; - static const string profTitles[numberOfProblemForCoverage] = { + static const std::string profTitles[numberOfProblemForCoverage] = { "", // All "Ave. Coverage of Enabled Links per LB", // All - Disabled "Ave. Coverage of Links with No Bad LinkLevelError per LB", // All - BadLinkLevelError @@ -445,7 +444,7 @@ SCTErrMonTool::procHistograms() { // SCTErrMonTool :: fillByteStreamErrorsHelper, Martin Flechl 10/09/2009 // ==================================================================================================== int -SCTErrMonTool::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, +SCTErrMonTool::fillByteStreamErrorsHelper(const std::set<IdentifierHash>& errors, bool lumi2DHist, int err_type) { //--- Check categories of the BS error @@ -527,7 +526,7 @@ SCTErrMonTool::fillByteStreamErrorsHelper(const set<IdentifierHash>& errors, // SCTErrMonTool :: numByteStreamErrors, Daniel Damiani 04/07/2011 // ==================================================================================================== void -SCTErrMonTool::numByteStreamErrors(const set<IdentifierHash>& errors, int& ntot) const { +SCTErrMonTool::numByteStreamErrors(const std::set<IdentifierHash>& errors, int& ntot) const { for (const auto& fit: errors) { if (fit.is_valid()) { @@ -692,7 +691,7 @@ SCTErrMonTool::fillByteStreamErrors() { StatusCode SCTErrMonTool::bookErrHistosHelper(MonGroup& mg, TString name, TString title, TString titlehitmap, TProfile2D_LW*& tprof, TH2F_LW*& th, const int layer, const bool barrel) const { - ostringstream streamhitmap; + std::ostringstream streamhitmap; streamhitmap << layer / 2 << "_" << layer % 2; @@ -730,7 +729,7 @@ SCTErrMonTool::bookErrHistosHelper(MonGroup& mg, TString name, TString title, TS StatusCode SCTErrMonTool::bookErrHistosHelper(MonGroup& mg, TString name, TString title, TProfile2D_LW*& tprof, const int layer, const bool barrel) const { - ostringstream streamhitmap; + std::ostringstream streamhitmap; streamhitmap << layer / 2 << "_" << layer % 2; @@ -761,8 +760,8 @@ SCTErrMonTool::bookErrHistos(int reg=-1) { // reg = 0:EC, 1:B, 2:EA if (reg==-1) return StatusCode::FAILURE; const int nLayers{n_layers[reg]*2}; - string regName{("SCT" + subDetNameShort[reg]).Data()}; - string layerTitle{layerName[reg].Data()}; + std::string regName{("SCT" + subDetNameShort[reg]).Data()}; + std::string layerTitle{layerName[reg].Data()}; layerTitle.at(0)=toupper(layerTitle.at(0)); if (m_doPerLumiErrors) { @@ -790,8 +789,8 @@ SCTErrMonTool::bookErrHistos(int reg=-1) { // reg = 0:EC, 1:B, 2:EA m_rateErrorsPerLumi[reg]->GetXaxis()->SetBinLabel(bin+1, SCT_ByteStreamErrors::ErrorTypeDescription[bin].c_str()); } for (int bin{0}; bin < nLayers; bin++) { - m_numErrorsPerLumi[reg]->GetYaxis()->SetBinLabel(bin+1, (to_string(bin/2) +"_"+ to_string(bin%2)).c_str()); - m_rateErrorsPerLumi[reg]->GetYaxis()->SetBinLabel(bin+1, (to_string(bin/2) +"_"+ to_string(bin%2)).c_str()); + m_numErrorsPerLumi[reg]->GetYaxis()->SetBinLabel(bin+1, (std::to_string(bin/2) +"_"+ std::to_string(bin%2)).c_str()); + m_rateErrorsPerLumi[reg]->GetYaxis()->SetBinLabel(bin+1, (std::to_string(bin/2) +"_"+ std::to_string(bin%2)).c_str()); } } } @@ -802,9 +801,9 @@ SCTErrMonTool::bookErrHistos(int reg=-1) { // reg = 0:EC, 1:B, 2:EA for (int layer{0}; layer < nLayers; ++layer) { for (int errType{0}; errType < CategoryErrors::N_ERRCATEGORY; ++errType) { MonGroup err2{this, "SCT/"+regName+"/errors/"+errorsString(errType).Data(), ManagedMonitorToolBase::lumiBlock, ATTRIB_UNMANAGED}; - string name1{("SCT_NumberOf" + errorsString(errType) + subDetNameShort[reg].Data() + "_").Data()}; - string title{("Num of " + errorsString(errType) + " per "+layerTitle).Data()}; - string name2{("SCT_T" + errorsString(errType) + subDetNameShort[reg].Data() + "_").Data()}; + std::string name1{("SCT_NumberOf" + errorsString(errType) + subDetNameShort[reg].Data() + "_").Data()}; + std::string title{("Num of " + errorsString(errType) + " per "+layerTitle).Data()}; + std::string name2{("SCT_T" + errorsString(errType) + subDetNameShort[reg].Data() + "_").Data()}; somethingFailed |= bookErrHistosHelper(err2, name1, title, name2, m_allErrsCate[errType][reg][layer], m_pallErrsCate[errType][reg][layer], layer, reg==BARREL_INDEX).isFailure(); } @@ -854,13 +853,13 @@ SCTErrMonTool::bookErrHistosGen() { // ==================================================================================================== StatusCode SCTErrMonTool::bookConfMapsGen() { - static const string SummaryBinNames[ConfbinsSummary] = { + static const std::string SummaryBinNames[ConfbinsSummary] = { "Mod Out", "Flagged Links", "Masked Links", "Errors", "Inefficient", "Noisy" }; - static const string DetailedBinNames[ConfbinsDetailed] = { + static const std::string DetailedBinNames[ConfbinsDetailed] = { "Modules", "Link 0", "Link 1", "Chips", "Strips (10^{2})" }; - static const string OnlineBinNames[ConfbinsOnline] = { + static const std::string OnlineBinNames[ConfbinsOnline] = { "Mod Out", "Flagged Links", "Masked Links", "Errors" }; static const TString regLabel[N_REGIONS_INC_GENERAL] = { @@ -878,7 +877,7 @@ SCTErrMonTool::bookConfMapsGen() { MonGroup{this, "SCT/GENERAL/Conf", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED} }; - string streamName{streamNameFunction()->getStreamName(this, ConfHist[GENERAL_INDEX], "", false)}; + std::string streamName{streamNameFunction()->getStreamName(this, ConfHist[GENERAL_INDEX], "", false)}; m_path = streamName.substr(0, streamName.rfind("SCT/GENERAL/Conf")); ATH_MSG_INFO("Global Path :" << m_path); @@ -1028,14 +1027,14 @@ SCTErrMonTool::fillCondDBMaps() { std::vector<TH2F> p2DmapHistoVectorAll[SCT_Monitoring::N_REGIONS]{}; for (int reg{0}; reg < N_REGIONS; ++reg) { - string regName{("SCT" + subDetNameShort[reg]).Data()}; + std::string regName{("SCT" + subDetNameShort[reg]).Data()}; const int nLayers{n_layers[reg]*2}; for (int layer{0}; layer < nLayers; ++layer) { - string mapName{string{"modulemap"} + subDetNameShort[reg].Data() + to_string(layer/2) + "_" + to_string(layer%2)}; + std::string mapName{std::string{"modulemap"} + subDetNameShort[reg].Data() + std::to_string(layer/2) + "_" + std::to_string(layer%2)}; TH2F hitsHisto_tmp2{TH2F(mapName.c_str(), - (string{"Module Out of Configuration : "}+subDetName[reg].Data()+", "+ - layerName[reg].Data()+" "+to_string(layer/2)+ - " side "+to_string(layer%2)).c_str(), + (std::string{"Module Out of Configuration : "}+subDetName[reg].Data()+", "+ + layerName[reg].Data()+" "+std::to_string(layer/2)+ + " side "+std::to_string(layer%2)).c_str(), n_etabins[reg], f_etabin[reg] - 0.5, l_etabin[reg] + 0.5, n_phibins[reg], f_phibin[reg] - 0.5, l_phibin[reg] + 0.5)}; hitsHisto_tmp2.GetXaxis()->SetTitle("Index in the direction of #eta"); @@ -1161,10 +1160,10 @@ StatusCode SCTErrMonTool::fillConfigurationDetails() { ATH_MSG_DEBUG("Inside fillConfigurationDetails()"); unsigned int nBadMods{static_cast<unsigned int>(m_ConfigurationTool->badModules()->size())}; // bad modules - const map<IdentifierHash, pair<bool, bool>>* badLinks{m_ConfigurationTool->badLinks()}; // bad links + const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{m_ConfigurationTool->badLinks()}; // bad links unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0}; - for (const pair<IdentifierHash, pair<bool, bool>>& link: *badLinks) { - pair<bool, bool> status{link.second}; + for (const std::pair<IdentifierHash, std::pair<bool, bool>>& link: *badLinks) { + std::pair<bool, bool> status{link.second}; if ((status.first == false) and (status.second == true)) { ++nBadLink0; } @@ -1176,20 +1175,20 @@ SCTErrMonTool::fillConfigurationDetails() { } } - const map<Identifier, unsigned int>* badChips{m_ConfigurationTool->badChips()}; // bad chips + const std::map<Identifier, unsigned int>* badChips{m_ConfigurationTool->badChips()}; // bad chips unsigned int nBadChips{0}; - for (const pair<Identifier, unsigned int>& chip : *badChips) { + for (const std::pair<Identifier, unsigned int>& chip : *badChips) { unsigned int status{chip.second}; for (unsigned int i{0}; i < CHIPS_PER_MODULE; i++) { nBadChips += ((status & (1 << i)) == 0 ? 0 : 1); } } - set<Identifier> badStripsAll; // bad strips + std::set<Identifier> badStripsAll; // bad strips m_ConfigurationTool->badStrips(badStripsAll); unsigned int nBadStrips{static_cast<unsigned int>(badStripsAll.size())}; - set<Identifier> badStripsExclusive; // bad strips w/o bad modules and chips + std::set<Identifier> badStripsExclusive; // bad strips w/o bad modules and chips m_ConfigurationTool->badStrips(badStripsExclusive, true, true); int nBadStripsExclusive{static_cast<int>(badStripsExclusive.size())}; int nBadStripsExclusiveBEC[N_REGIONS] = { @@ -1261,21 +1260,21 @@ SCTErrMonTool::resetConfigurationDetails() { // ==================================================================================================== bool SCTErrMonTool::getHisto(const int layer, const int reg, const int type, TH2* histo[2]) const { - static const string trm[2][N_REGIONS] = { // 2 is the number of types (noise, eff) + static const std::string trm[2][N_REGIONS] = { // 2 is the number of types (noise, eff) {"SCT/SCTEC/Noise/noiseoccupancymapECm_","SCT/SCTB/Noise/noiseoccupancymap_", "SCT/SCTEA/Noise/noiseoccupancymapECp_"}, {"SCT/SCTEC/eff/ineffm_", "SCT/SCTB/eff/ineff_", "SCT/SCTEA/eff/ineffp_"} }; - static const string trm_trig[2][N_REGIONS] = { // 2 is the number of types (noise, eff) + static const std::string trm_trig[2][N_REGIONS] = { // 2 is the number of types (noise, eff) {"SCT/SCTEC/Noise/noiseoccupancymaptriggerECm_", "SCT/SCTB/Noise/noiseoccupancymaptrigger_", "SCT/SCTEA/Noise/noiseoccupancymaptriggerECp_"}, {"SCT/SCTEC/eff/ineffm_", "SCT/SCTB/eff/ineff_", "SCT/SCTEA/eff/ineffp_"} }; - string shname1{m_path + trm[type][reg] + to_string(layer)}; - string shname2{m_path + trm[type][reg] + to_string(layer)}; + std::string shname1{m_path + trm[type][reg] + std::to_string(layer)}; + std::string shname2{m_path + trm[type][reg] + std::to_string(layer)}; if (testOffline or ((m_environment != AthenaMonManager::online) and (AthenaMonManager::dataType() != AthenaMonManager::cosmics))) { - shname1 = m_path + trm_trig[type][reg] + to_string(layer); - shname2 = m_path + trm_trig[type][reg] + to_string(layer); + shname1 = m_path + trm_trig[type][reg] + std::to_string(layer); + shname2 = m_path + trm_trig[type][reg] + std::to_string(layer); } if ((type==0) or (type==1)) { shname1 += "_0"; @@ -1317,11 +1316,11 @@ SCTErrMonTool::getHisto(const int layer, const int reg, const int type, TH2* his // ==================================================================================================== bool SCTErrMonTool::getHistoRecent(const int layer, const int reg, const int type, TH2* histo[2]) const { - static const string trm[1][N_REGIONS] = { + static const std::string trm[1][N_REGIONS] = { {"SCT/SCTEC/Noise/noiseoccupancymaprecentECm_", "SCT/SCTB/Noise/noiseoccupancymaprecent_", "SCT/SCTEA/Noise/noiseoccupancymaprecentECp_"} }; - string shname1{m_path + trm[type][reg] + to_string(layer) + "_0"}; - string shname2{m_path + trm[type][reg] + to_string(layer) + "_1"}; + std::string shname1{m_path + trm[type][reg] + std::to_string(layer) + "_0"}; + std::string shname2{m_path + trm[type][reg] + std::to_string(layer) + "_1"}; bool failedBooking{false}; histo[0] = nullptr; @@ -1402,16 +1401,16 @@ void SCTErrMonTool::fillWafer(moduleGeo_t module, TH2F* histo) const { //==================================================================================================== // SCTErrMonTool :: SyncSCT, Keisuke Kouda 12.09.2016 //==================================================================================================== -bool SCTErrMonTool::syncErrorSCT(set<IdentifierHash>& sctHashBadLinkError, - set<IdentifierHash>& sctHashBadRODError, - set<IdentifierHash>& sctHashBadError) const { +bool SCTErrMonTool::syncErrorSCT(std::set<IdentifierHash>& sctHashBadLinkError, + std::set<IdentifierHash>& sctHashBadRODError, + std::set<IdentifierHash>& sctHashBadError) const { sctHashBadLinkError.clear(); sctHashBadRODError.clear(); sctHashBadError.clear(); //BadLinkLevelError for (SCT_ByteStreamErrors::ErrorType linkLevelBadErrors: SCT_ByteStreamErrors::LinkLevelBadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( linkLevelBadErrors )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( linkLevelBadErrors )}; for (const IdentifierHash& waferHash : sctErrors) { sctHashBadLinkError.insert(waferHash); } @@ -1419,7 +1418,7 @@ bool SCTErrMonTool::syncErrorSCT(set<IdentifierHash>& sctHashBadLinkError, //BadRODLevelError for (SCT_ByteStreamErrors::ErrorType RodLevelBadErrors: SCT_ByteStreamErrors::RodLevelBadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( RodLevelBadErrors )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( RodLevelBadErrors )}; for (const IdentifierHash& waferHash: sctErrors) { sctHashBadRODError.insert(waferHash); } @@ -1427,7 +1426,7 @@ bool SCTErrMonTool::syncErrorSCT(set<IdentifierHash>& sctHashBadLinkError, //BadError = BadLinkLevelError + BadRODLevelError for (SCT_ByteStreamErrors::ErrorType tmpBadError: SCT_ByteStreamErrors::BadErrors) { - const set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( tmpBadError )}; + const std::set<IdentifierHash> sctErrors{m_byteStreamErrTool->getErrorSet( tmpBadError )}; for (const IdentifierHash& waferHash: sctErrors) { sctHashBadError.insert(waferHash); } @@ -1436,10 +1435,10 @@ bool SCTErrMonTool::syncErrorSCT(set<IdentifierHash>& sctHashBadLinkError, } //Disabled -bool SCTErrMonTool::syncDisabledSCT(set<IdentifierHash>& sctHashDisabled) const { +bool SCTErrMonTool::syncDisabledSCT(std::set<IdentifierHash>& sctHashDisabled) const { bool altered{false}; sctHashDisabled.clear(); - const set<Identifier>* badModules{m_ConfigurationTool->badModules()}; + const std::set<Identifier>* badModules{m_ConfigurationTool->badModules()}; for (const Identifier& badModule: *badModules) { altered = true; @@ -1453,7 +1452,7 @@ bool SCTErrMonTool::syncDisabledSCT(set<IdentifierHash>& sctHashDisabled) const } //Total (SCT_ConditionsSummaryTool) //All -bool SCTErrMonTool::summarySCT(set<IdentifierHash>& sctHashAll, set<IdentifierHash>& sctHashSummary) const { +bool SCTErrMonTool::summarySCT(std::set<IdentifierHash>& sctHashAll, std::set<IdentifierHash>& sctHashSummary) const { bool altered{false}; sctHashAll.clear();//All sctHashSummary.clear(); @@ -1470,7 +1469,7 @@ bool SCTErrMonTool::summarySCT(set<IdentifierHash>& sctHashAll, set<IdentifierHa } //Power supply trip (SCT_DCSConditionsTool) -bool SCTErrMonTool::psTripDCSSCT(set<IdentifierHash>& sctHashPSTripDCS, float& PSTripModules) const { +bool SCTErrMonTool::psTripDCSSCT(std::set<IdentifierHash>& sctHashPSTripDCS, float& PSTripModules) const { bool altered{false}; sctHashPSTripDCS.clear(); diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx index bf887f5fd3a344235b2f0418b1da05a03b91a60b..ff9b59949bc19b970bdf9548abdfeba42bff1813 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx @@ -45,15 +45,14 @@ // #include "TRandom.h" // Only for Testing using namespace SCT_Monitoring; -using namespace std; namespace {// anonymous namespace for functions at file scope static const bool testOffline{false}; - static const string histogramPath[N_REGIONS_INC_GENERAL] = { + static const std::string histogramPath[N_REGIONS_INC_GENERAL] = { "SCT/SCTEC/eff", "SCT/SCTB/eff", "SCT/SCTEA/eff", "SCT/GENERAL/eff" }; - static const string histogramPathRe[N_REGIONS] = { + static const std::string histogramPathRe[N_REGIONS] = { "SCT/SCTEC/eff/perLumiBlock", "SCT/SCTB/eff/perLumiBlock", "SCT/SCTEA/eff/perLumiBlock" }; @@ -148,6 +147,24 @@ int SCTHitEffMonAlg::becIdxLayer2Index(const int becIdx, const int layer) const } } +int SCTHitEffMonAlg::getWaferIndex(const int barrel_ec, const int layer_disk, const int side) const { + int waferIndex = -1; + if (barrel_ec == BARREL) { + // corresponds to the waferIndex of B3 side0 + waferIndex = 0; + } else if (barrel_ec == ENDCAP_A) { + // corresponds to the waferIndex of EA0 side0 + waferIndex = N_BARRELS*N_SIDES; + } else if (barrel_ec == ENDCAP_C) { + // corresponds to the waferIndex of EC0 side0 + waferIndex = N_BARRELS*N_SIDES + N_ENDCAPS*N_SIDES; + } else { + ATH_MSG_WARNING("The barrel_bc index" << barrel_ec << " is not defined."); + return waferIndex; + } + return waferIndex + layer_disk * N_SIDES + side; +} + double SCTHitEffMonAlg::getResidual(const Identifier& surfaceID, const Trk::TrackParameters* trkParam, const InDet::SCT_ClusterContainer* p_sctclcontainer) const { @@ -227,7 +244,7 @@ int SCTHitEffMonAlg::previousChip(double xl, int side, bool swap) const { return chipPos; } -StatusCode SCTHitEffMonAlg::failCut(bool value, string name) const { +StatusCode SCTHitEffMonAlg::failCut(bool value, std::string name) const { if (value) { ATH_MSG_VERBOSE("Passed " << name); return StatusCode::FAILURE; @@ -335,10 +352,10 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { if (solenoidOn and failCut(perigee->pT() >= m_minPt, "track cut: Min Pt")) { continue; } - if (not m_isCosmic and failCut(fabs(d0) <= m_maxD0, "track cut: max D0")) { + if (not m_isCosmic and failCut(std::abs(d0) <= m_maxD0, "track cut: max D0")) { continue; } - if (m_maxZ0sinTheta and failCut(fabs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { + if (m_maxZ0sinTheta and failCut(std::abs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { continue; } nTrkGood++; @@ -346,6 +363,8 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { // Loop over original track collection for (const Trk::Track* pthisTrack: *tracks) { + + // First, go through all cuts in this block ATH_MSG_VERBOSE("Starting new track"); if (pthisTrack==nullptr) { continue; @@ -371,10 +390,10 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { if (failCut(perigee->pT() >= m_minPt, "track cut: Min Pt")) { continue; } - if (not m_isCosmic and failCut(fabs(d0) <= m_maxD0, "track cut: max D0")) { + if (not m_isCosmic and failCut(std::abs(d0) <= m_maxD0, "track cut: max D0")) { continue; } - if (m_maxZ0sinTheta and failCut(fabs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { + if (m_maxZ0sinTheta and failCut(std::abs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { continue; } @@ -395,7 +414,17 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { 0, 0, 0 }; int pixelNHits{0}; + int pixelNHoles{0}; int trtNHits{0}; + + int sctNHitsPerRegion[N_LAYERS_TOTAL*N_SIDES] = {0}; + int sctNHolesPerRegion[N_LAYERS_TOTAL*N_SIDES] = {0}; + // Above two variables hold the number of hits for each SCT disk / layer. + // [N_LAYERS_TOTAL*N_SIDES(= 44)] indicates the waferIndex defined as below. + // 0- 7: B3 side0, B3 side1, B4 side0, ... B6 side1 + // 8-25: EA0 side0, EA1 side1, ... EA8 side1 + // 26-43: EC0 side0, EC1 side1, ... EC8 side1 + std::map < Identifier, double > mapOfTrackHitResiduals; double zmin = std::numeric_limits<float>::max(); double zmax = -std::numeric_limits<float>::max(); @@ -405,13 +434,23 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { float max_layerSide{-1.}; Identifier surfaceID; - // loop over all hits on track + // Loop over all TSOS (track state on surface) on track to check number of hits / holes on Pixel, SCT and TRT for (const Trk::TrackStateOnSurface* tsos: *(trackWithHoles->trackStateOnSurfaces())) { surfaceID = surfaceOnTrackIdentifier(tsos); if (not surfaceID.is_valid()) { continue; } + + // Check waferIndex; if the default value of -1 is kept, the corresponding TSOS is not associated with SCT. + int waferIndex = -1; + // Calculate waferIndex + if (m_sctId->is_sct(surfaceID)) { + waferIndex = getWaferIndex(m_sctId->barrel_ec(surfaceID), + m_sctId->layer_disk(surfaceID), + m_sctId->side(surfaceID)); + } + if (tsos->type(Trk::TrackStateOnSurface::Measurement) or tsos->type(Trk::TrackStateOnSurface::Outlier)) { if (m_pixelId->is_pixel(surfaceID)) { pixelNHits++; @@ -422,6 +461,13 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { if (m_sctId->is_sct(surfaceID)) { NHits[bec2Index(m_sctId->barrel_ec(surfaceID))]++; mapOfTrackHitResiduals[surfaceID] = getResidual(surfaceID, tsos->trackParameters(), &*p_sctclcontainer); + sctNHitsPerRegion[waferIndex]++; + } + } else if (tsos->type(Trk::TrackStateOnSurface::Hole)) { + if (m_pixelId->is_pixel(surfaceID)) { + pixelNHoles++; + } else if (m_sctId->is_sct(surfaceID)) { + sctNHolesPerRegion[waferIndex]++; } } @@ -460,6 +506,7 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { layersCrossedByTrack[i].resize(n_layers[i] * 2, false); } + // Loop over all TSOS again; this time, to extract SCT-related hits and holes. for (const Trk::TrackStateOnSurface* tsos: *(trackWithHoles->trackStateOnSurfaces())) { ATH_MSG_VERBOSE("Starting new hit"); surfaceID = surfaceOnTrackIdentifier(tsos); @@ -468,11 +515,38 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { continue; } - unsigned int isub{bec2Index(m_sctId->barrel_ec(surfaceID))}; - ATH_MSG_VERBOSE("New SCT candidate: " << m_sctId->print_to_string(surfaceID)); int side{m_sctId->side(surfaceID)}; int layer{m_sctId->layer_disk(surfaceID)}; + int bec{m_sctId->barrel_ec(surfaceID)}; + unsigned int isub{bec2Index(bec)}; + ATH_MSG_VERBOSE("New SCT candidate: " << m_sctId->print_to_string(surfaceID)); + + int waferIndex = getWaferIndex(bec, layer, side); + + Int_t sctNHitsExceptThisWafer{0}; + Int_t sctNHolesExceptThisWafer{0}; + + for (Int_t i=0; i<N_LAYERS_TOTAL*N_SIDES; i++) { + if (i != waferIndex) { + sctNHitsExceptThisWafer += sctNHitsPerRegion[i]; + sctNHolesExceptThisWafer += sctNHolesPerRegion[i]; + } + } + + // The track is required to satisfy: + // - Number of Si hits to be >= 8 + // - Number of Si holes to be <= 1 + // without counting on this TSOS object. (avoid tracking bias.) + if ((unsigned int)(sctNHitsExceptThisWafer + pixelNHits) < m_minSiHits) { + ATH_MSG_VERBOSE("This track is rejected due to the number of hits: " << sctNHitsExceptThisWafer * pixelNHits); + continue; + } + if ((unsigned int)(sctNHolesExceptThisWafer + pixelNHoles) > m_maxSiHoles) { + ATH_MSG_VERBOSE("This track is rejected due to the number of holes: " << sctNHolesExceptThisWafer * pixelNHoles); + continue; + } + std::string etaPhiSuffix = "_" + std::to_string(layer) + "_" + std::to_string(side); const int detIndex{becIdxLayer2Index(isub, layer)}; if (detIndex == -1) { @@ -486,12 +560,12 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { float dedicated_layerPlusHalfSide{static_cast<float>(layer) + static_cast<float>((side + 1) % 2) * 0.5f}; const Trk::TrackParameters* trkParamOnSurface{tsos->trackParameters()}; double trackHitResidual{getResidual(surfaceID, trkParamOnSurface, &*p_sctclcontainer)}; - + float distCut{m_effdistcut}; if (tsos->type(Trk::TrackStateOnSurface::Measurement) or tsos->type(Trk::TrackStateOnSurface::Outlier)) { eff = 1.; - } else if (tsos->type(Trk::TrackStateOnSurface::Hole) and (fabs(trackHitResidual) < distCut)) { + } else if (tsos->type(Trk::TrackStateOnSurface::Hole) and (std::abs(trackHitResidual) < distCut)) { eff = 1.; } @@ -579,7 +653,7 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { int ndf{trackWithHoles->fitQuality()->numberDoF()}; double chi2_div_ndf{ndf > 0. ? chi2 / ndf : -1.}; - if (failCut(fabs(phiUp) <= m_maxPhiAngle, "hit cut: incidence angle")) { + if (failCut(std::abs(phiUp) <= m_maxPhiAngle, "hit cut: incidence angle")) { continue; } @@ -679,3 +753,4 @@ StatusCode SCTHitEffMonAlg::fillHistograms(const EventContext& ctx) const { return StatusCode::SUCCESS; } + diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.h index 8d0308676a03921fbe1dd7ed060b1e68d4b292b2..2b58a1289a5e5d2a5757310bb7362d9304ce70bb 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.h @@ -68,6 +68,7 @@ class SCTHitEffMonAlg : public AthMonitorAlgorithm { ///Convert a layer/disk number (0-21) to a layer number (0-8 for endcaps, 0-3 for barrel) int layerIndex2layer(const int index) const; int becIdxLayer2Index(const int becIdx, const int layer) const; + int getWaferIndex(const int barrel_bc, const int layer_disk, const int side) const; std::string m_path; @@ -99,9 +100,11 @@ class SCTHitEffMonAlg : public AthMonitorAlgorithm { FloatProperty m_maxChi2{this, "MaxChi2", 3.}; FloatProperty m_maxD0{this, "Maxd0", 10., "mm of D0"}; FloatProperty m_minPt{this, "MinPt", 1000., "minimu pt in MeV/c"}; - FloatProperty m_effdistcut{this, "effDistanceCut", 2., "mm"}; + FloatProperty m_effdistcut{this, "effDistanceCut", 0.2, "mm"}; FloatProperty m_maxZ0sinTheta{this, "MaxZ0sinTheta", 0.}; UnsignedIntegerProperty m_maxTracks{this, "MaxTracks", 500}; + UnsignedIntegerProperty m_minSiHits{this, "MinimumNumberOfSiHits", 8, "Threshold for number of Si hits. Count Si hits excluding hits in the wafer under investigation to reduce track selection bias"}; + UnsignedIntegerProperty m_maxSiHoles{this, "MaximumNumberOfSiHoles", 1, "Threshold for number of Si holes. Count Si holes excluding holes in the wafer under investigation to reduce track selection bias"}; BooleanProperty m_insideOutOnly{this, "InsideOutOnly", false}; BooleanProperty m_isCosmic{this, "IsCosmic", false}; @@ -112,6 +115,7 @@ class SCTHitEffMonAlg : public AthMonitorAlgorithm { BooleanProperty m_requireGuardRing{this, "RequireGuardRing", false, "should be returned to true"}; BooleanProperty m_vetoBadChips{this, "VetoBadChips", true}; BooleanProperty m_useIDGlobal{this, "useIDGlobal", false}; + }; #endif // SCTHITEFFMONALG_H diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx index c3d5065cbbd644ba1297c98e7ae576d8cb287c08..d8919d158b7a93cef9895f82076321c7841499db 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx @@ -516,10 +516,10 @@ SCTHitEffMonTool::fillHistograms() { if (solenoidOn and failCut(perigee->pT() >= m_minPt, "track cut: Min Pt")) { continue; } - if (not m_isCosmic and failCut(fabs(d0) <= m_maxD0, "track cut: max D0")) { + if (not m_isCosmic and failCut(std::abs(d0) <= m_maxD0, "track cut: max D0")) { continue; } - if (m_maxZ0sinTheta and failCut(fabs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { + if (m_maxZ0sinTheta and failCut(std::abs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { continue; } nTrkGood++; @@ -552,10 +552,10 @@ SCTHitEffMonTool::fillHistograms() { if (failCut(perigee->pT() >= m_minPt, "track cut: Min Pt")) { continue; } - if (not m_isCosmic and failCut(fabs(d0) <= m_maxD0, "track cut: max D0")) { + if (not m_isCosmic and failCut(std::abs(d0) <= m_maxD0, "track cut: max D0")) { continue; } - if (m_maxZ0sinTheta and failCut(fabs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { + if (m_maxZ0sinTheta and failCut(std::abs(z0 * sin(perigeeTheta)) <= m_maxZ0sinTheta, "track cut: Max Z0sinTheta")) { continue; } @@ -673,7 +673,7 @@ SCTHitEffMonTool::fillHistograms() { if (tsos->type(Trk::TrackStateOnSurface::Measurement) or tsos->type(Trk::TrackStateOnSurface::Outlier)) { eff = 1.; - } else if (tsos->type(Trk::TrackStateOnSurface::Hole) and (fabs(trackHitResidual) < distCut)) { + } else if (tsos->type(Trk::TrackStateOnSurface::Hole) and (std::abs(trackHitResidual) < distCut)) { eff = 1.; } @@ -761,7 +761,7 @@ SCTHitEffMonTool::fillHistograms() { int ndf{trackWithHoles->fitQuality()->numberDoF()}; double chi2_div_ndf{ndf > 0. ? chi2 / ndf : -1.}; - if (failCut(fabs(phiUp) <= m_maxPhiAngle, "hit cut: incidence angle")) { + if (failCut(std::abs(phiUp) <= m_maxPhiAngle, "hit cut: incidence angle")) { continue; } @@ -993,7 +993,7 @@ SCTHitEffMonTool::getResidual(const Identifier& surfaceID, const Trk::TrackParam std::unique_ptr<const Trk::ResidualPull> residualPull{m_residualPullCalculator->residualPull(rio.get(), trkParam, Trk::ResidualPull::Unbiased)}; if (not residualPull) continue; - if (fabs(residualPull->residual()[Trk::loc1]) < fabs(trackHitResidual)) { + if (std::abs(residualPull->residual()[Trk::loc1]) < std::abs(trackHitResidual)) { trackHitResidual = residualPull->residual()[Trk::loc1]; } } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx index 2308a9b4ffb6fd3dd1e41ba5286c61a695562c6b..36ddd73858c2f7ca3aaf2e287699500244d72c5a 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx @@ -21,10 +21,8 @@ using namespace SCT_Monitoring; -using namespace std; - namespace { - static const string abbreviations[N_REGIONS] = { + static const std::string abbreviations[N_REGIONS] = { "ECm", "", "ECp" }; @@ -94,7 +92,7 @@ StatusCode SCTHitsNoiseMonAlg::fillHistograms(const EventContext& ctx) const { ++m_numberOfEventsRecent; // If track hits are selected, make the vector of track rdo identifiers - array<unordered_set<Identifier>, N_WAFERS> rdosOnTracks; + std::array<std::unordered_set<Identifier>, N_WAFERS> rdosOnTracks; if (m_doTrackHits) { if (makeVectorOfTrackRDOIdentifiers(rdosOnTracks, ctx).isFailure()) { ATH_MSG_WARNING("Couldn't make vector of track RDO identifiers"); @@ -110,7 +108,7 @@ StatusCode SCTHitsNoiseMonAlg::fillHistograms(const EventContext& ctx) const { return StatusCode::SUCCESS; } -StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Identifier>, N_WAFERS>& rdosOnTracks, const EventContext& ctx) const{ +StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const std::array<std::unordered_set<Identifier>, N_WAFERS>& rdosOnTracks, const EventContext& ctx) const{ static const unsigned int limits[N_REGIONS] = { N_DISKSx2, N_BARRELSx2, N_DISKSx2 }; @@ -150,20 +148,20 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id int local_tothits{0}; - vector<int> barrel_local_nhitslayer(N_BARRELSx2, 0); - vector<int> ECp_local_nhitslayer(N_DISKSx2, 0); - vector<int> ECm_local_nhitslayer(N_DISKSx2, 0); - vector<int>* hitsInLayer[N_REGIONS] = { + std::vector<int> barrel_local_nhitslayer(N_BARRELSx2, 0); + std::vector<int> ECp_local_nhitslayer(N_DISKSx2, 0); + std::vector<int> ECm_local_nhitslayer(N_DISKSx2, 0); + std::vector<int>* hitsInLayer[N_REGIONS] = { &ECm_local_nhitslayer, &barrel_local_nhitslayer, &ECp_local_nhitslayer }; const bool doThisSubsystem[N_REGIONS] = { m_doNegativeEndcap, true, m_doPositiveEndcap }; - vector<int> vLumiBlock[N_REGIONS]; - vector<int> vNumberOfHitsFromAllRDOs[N_REGIONS]; - vector<int> vNumberOfHitsFromSPs[N_REGIONS]; - vector<bool> vIsSelectedTriggerHits[N_REGIONS]; + std::vector<int> vLumiBlock[N_REGIONS]; + std::vector<int> vNumberOfHitsFromAllRDOs[N_REGIONS]; + std::vector<int> vNumberOfHitsFromSPs[N_REGIONS]; + std::vector<bool> vIsSelectedTriggerHits[N_REGIONS]; for (unsigned int jReg{0}; jReg<N_REGIONS; jReg++) { unsigned int size{0}; if (jReg==ENDCAP_C_INDEX or jReg==ENDCAP_A_INDEX) size = N_SIDES * N_MOD_ENDCAPS; @@ -174,14 +172,14 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id vIsSelectedTriggerHits[jReg].reserve(size); } - vector<int> vEtaOnTrack; - vector<int> vPhiOnTrack; - vector<float> vSystemIndexOnTrack; - vector<bool> vDTbinOnTrack; + std::vector<int> vEtaOnTrack; + std::vector<int> vPhiOnTrack; + std::vector<float> vSystemIndexOnTrack; + std::vector<bool> vDTbinOnTrack; - vector<int> vEta; - vector<int> vPhi; - vector<int> vNumberOfStrips; + std::vector<int> vEta; + std::vector<int> vPhi; + std::vector<int> vNumberOfStrips; // Outer Loop on RDO Collection for (const InDetRawDataCollection<SCT_RDORawData>* rdoCollection: *rdoContainer) { @@ -208,12 +206,12 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id // Now we want the space point container for this module // We have to compare module IDs- the SP collection is defined for the 'normal' (i.e. no stereo) module side // Define a set of spIDs - unordered_set<Identifier> mySetOfSPIds; + std::unordered_set<Identifier> mySetOfSPIds; for (int side{0}; side<N_SIDES; side++) { SpacePointContainer::const_iterator spContainerIterator{spacePointContainer->indexFind(side==0 ? theModuleHash0 : theModuleHash1)}; if (spContainerIterator==spacePointContainer->end()) continue; for (const Trk::SpacePoint* sp: **spContainerIterator) { - const vector<Identifier>& rdoList{(thisSide==side ? sp->clusterList().first : sp->clusterList().second)->rdoList()}; + const std::vector<Identifier>& rdoList{(thisSide==side ? sp->clusterList().first : sp->clusterList().second)->rdoList()}; mySetOfSPIds.insert(rdoList.begin(), rdoList.end()); } } @@ -266,14 +264,14 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id // We can now do the NO calculation for this wafer // For the Time Dependent plots - const string streamhitmap{"mapsOfHitsOnTracks" + abbreviations[systemIndex] + "_" + + const std::string streamhitmap{"mapsOfHitsOnTracks" + abbreviations[systemIndex] + "_" + "trackhitsmap_" + layerSide.name()}; auto etaMapsOfHitsOnTracksAcc{Monitored::Collection("eta_"+streamhitmap, vEtaOnTrack)}; auto phiMapsOfHitsOnTracksAcc{Monitored::Collection("phi_"+streamhitmap, vPhiOnTrack)}; fill("SCTHitsNoiseMonitor_" + std::to_string(systemIndex), etaMapsOfHitsOnTracksAcc, phiMapsOfHitsOnTracksAcc); - const string hitmap{"hitsmap" + abbreviations[systemIndex] + "_" + layerSide.name()}; + const std::string hitmap{"hitsmap" + abbreviations[systemIndex] + "_" + layerSide.name()}; auto etahitsmapAcc{Monitored::Collection("eta_"+hitmap, vEta)}; auto phihitsmapAcc{Monitored::Collection("phi_"+hitmap, vPhi)}; @@ -319,7 +317,7 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id ATH_MSG_WARNING("Couldn't retrieve clusters"); } - vector<long unsigned int> vGroupSize; + std::vector<long unsigned int> vGroupSize; for (const InDet::SCT_ClusterCollection* clusterCollection: *clusterContainer) { for (const InDet::SCT_Cluster* cluster: *clusterCollection) { vGroupSize.push_back(cluster->rdoList().size()); @@ -406,7 +404,7 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id for (unsigned int jReg{0}; jReg<N_REGIONS; ++jReg){ for (unsigned int element{0}; element < limits[jReg]; ++element) { LayerSideFormatter layerSide{element, jReg}; - const string occMap{"occupancymap" + abbreviations[jReg] + "_" + layerSide.name()}; + const std::string occMap{"occupancymap" + abbreviations[jReg] + "_" + layerSide.name()}; auto etaEacc{Monitored::Collection("eta_" + occMap, vEtaNOHO[jReg][element])}; auto phiAcc{Monitored::Collection("phi_" + occMap, vPhiNOHO[jReg][element])}; auto hoAcc{Monitored::Collection("HO_" + occMap, vHO2D[jReg][element])}; @@ -420,9 +418,9 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const array<unordered_set<Id } -StatusCode SCTHitsNoiseMonAlg::makeVectorOfTrackRDOIdentifiers(array<unordered_set<Identifier>, N_WAFERS>& rdosOnTracks, const EventContext& ctx) const{ +StatusCode SCTHitsNoiseMonAlg::makeVectorOfTrackRDOIdentifiers(std::array<std::unordered_set<Identifier>, N_WAFERS>& rdosOnTracks, const EventContext& ctx) const{ // Clear the rdosOnTracks vector - rdosOnTracks.fill(unordered_set<Identifier>()); + rdosOnTracks.fill(std::unordered_set<Identifier>()); SG::ReadHandle<SCT_RDO_Container> rdoContainer{m_dataObjectName, ctx}; if (not rdoContainer.isValid()) { ATH_MSG_FATAL("Could not find the data object " << m_dataObjectName.key() << " !"); @@ -465,7 +463,7 @@ StatusCode SCTHitsNoiseMonAlg::makeVectorOfTrackRDOIdentifiers(array<unordered_s } // if Cluster is in SCT ... if (RawDataClus->detectorElement()->isSCT()) { - const vector<Identifier>& rdoList{RawDataClus->rdoList()}; + const std::vector<Identifier>& rdoList{RawDataClus->rdoList()}; rdosOnTracks[RawDataClus->detectorElement()->identifyHash()].insert(rdoList.begin(), rdoList.end()); } } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx index 1bc9ec9f1e28caaaadb133cf5b924bf0ebe16415..4297bd07e8a8de119f34291a0f6d9351729d8005 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx @@ -39,7 +39,6 @@ #include <fstream> // for writing an xml summary (debugging) #include <iostream> -using namespace std; using namespace SCT_Monitoring; /** * Utility functions to use in this file only @@ -52,14 +51,14 @@ namespace { // use anonymous namespace to restrict scope to this file, equivalen }; // string names for the detector parts - static const string names[N_REGIONS] = { + static const std::string names[N_REGIONS] = { "Endcap C", "Barrel", "Endcap A" }; // abbreviations for detector parts - static const string abbreviations[N_REGIONS] = { + static const std::string abbreviations[N_REGIONS] = { "ECm", "", "ECp" }; - static const string streamDelimiter{"_"}; + static const std::string streamDelimiter{"_"}; // is the timebin in the desired pattern? bool @@ -97,8 +96,8 @@ namespace { // use anonymous namespace to restrict scope to this file, equivalen * numbers to be used, and the timebin. */ // ==================================================================================================== -SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const string& type, - const string& name, +SCTHitsNoiseMonTool::SCTHitsNoiseMonTool(const std::string& type, + const std::string& name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) { } @@ -361,10 +360,10 @@ SCTHitsNoiseMonTool::generalHistsandNoise(const EventContext& ctx) { } } - vector<int> barrel_local_nhitslayer(N_BARRELSx2, 0); - vector<int> ECp_local_nhitslayer(N_DISKSx2, 0); - vector<int> ECm_local_nhitslayer(N_DISKSx2, 0); - vector<int>* hitsInLayer[N_REGIONS] = { + std::vector<int> barrel_local_nhitslayer(N_BARRELSx2, 0); + std::vector<int> ECp_local_nhitslayer(N_DISKSx2, 0); + std::vector<int> ECm_local_nhitslayer(N_DISKSx2, 0); + std::vector<int>* hitsInLayer[N_REGIONS] = { &ECm_local_nhitslayer, &barrel_local_nhitslayer, &ECp_local_nhitslayer }; const bool doThisSubsystem[N_REGIONS] = { @@ -395,12 +394,12 @@ SCTHitsNoiseMonTool::generalHistsandNoise(const EventContext& ctx) { // Now we want the space point container for this module // We have to compare module IDs- the SP collection is defined for the 'normal' (i.e. no stereo) module side // Define a set of spIDs - unordered_set<Identifier> mySetOfSPIds; + std::unordered_set<Identifier> mySetOfSPIds; for (int side{0}; side<N_SIDES; side++) { SpacePointContainer::const_iterator spContainerIterator{spacePointContainer->indexFind(side==0 ? theModuleHash0 : theModuleHash1)}; if (spContainerIterator==spacePointContainer->end()) continue; for (const Trk::SpacePoint* sp: **spContainerIterator) { - const vector<Identifier>& rdoList{(side==thisSide ? sp->clusterList().first->rdoList() : sp->clusterList().second->rdoList())}; + const std::vector<Identifier>& rdoList{(side==thisSide ? sp->clusterList().first->rdoList() : sp->clusterList().second->rdoList())}; mySetOfSPIds.insert(rdoList.begin(), rdoList.end()); } } @@ -575,8 +574,8 @@ SCTHitsNoiseMonTool::book1DHitHists() { Identifier planeId{*planeIterator}; const int bec{m_pSCTHelper->barrel_ec(planeId)}; const unsigned int systemIndex{bec2Index(bec)}; - const string formattedPosition{positionString(*planeIterator)}; - string histotitle{string("SCT ") + names[systemIndex] + " Hitmap: plane " + formattedPosition}; + const std::string formattedPosition{positionString(*planeIterator)}; + std::string histotitle{std::string("SCT ") + names[systemIndex] + " Hitmap: plane " + formattedPosition}; h1Factory(formattedPosition, histotitle, HitHists[systemIndex], m_phitmapHistoVector, FIRST_STRIP - 0.5, LAST_STRIP + 0.5, N_BINS); if (bec == BARREL) ATH_MSG_DEBUG("Have registered the barrel hists"); @@ -594,13 +593,13 @@ SCTHitsNoiseMonTool::bookGeneralHits(const unsigned int systemIndex) { ATH_MSG_FATAL("Invalid subsystem index, should be 0-2, was " << systemIndex); return StatusCode::FAILURE; } - static const string paths[N_REGIONS] = { + static const std::string paths[N_REGIONS] = { "SCT/SCTEC/hits", "SCT/SCTB/hits", "SCT/SCTEA/hits" }; static const unsigned int limits[N_REGIONS] = { N_DISKSx2, N_BARRELSx2, N_DISKSx2 }; - static const string titles[N_REGIONS]{"Endcap C", "barrel", "Endcap A"}; + static const std::string titles[N_REGIONS]{"Endcap C", "barrel", "Endcap A"}; // if (newRunFlag()) { m_phitsHistoVector[systemIndex].clear(); @@ -609,11 +608,11 @@ SCTHitsNoiseMonTool::bookGeneralHits(const unsigned int systemIndex) { MonGroup hitHists{this, paths[systemIndex], run, ATTRIB_UNMANAGED}; for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; - string streamhitmap{"hitsmap" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string streamhitmaprecent{"hitsmaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string streamhits{"hits" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string histotitle{"SCT Hitmap for " + names[systemIndex] + ": " + layerSide.title()}; - string histotitlerecent{"SCT Hitmap from recent events for " + names[systemIndex] + ": " + + std::string streamhitmap{"hitsmap" + abbreviations[systemIndex] + "_" + layerSide.name()}; + std::string streamhitmaprecent{"hitsmaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; + std::string streamhits{"hits" + abbreviations[systemIndex] + "_" + layerSide.name()}; + std::string histotitle{"SCT Hitmap for " + names[systemIndex] + ": " + layerSide.title()}; + std::string histotitlerecent{"SCT Hitmap from recent events for " + names[systemIndex] + ": " + layerSide.title()}; h2Factory(streamhitmap, histotitle, bec, hitHists, m_phitsHistoVector[systemIndex]); if (m_environment == AthenaMonManager::online) { @@ -634,14 +633,14 @@ SCTHitsNoiseMonTool::bookClusterSize() { MonGroup clusizebGroup{this, "SCT/SCTB/hits", run, ATTRIB_UNMANAGED}; MonGroup clusizeeaGroup{this, "SCT/SCTEA/hits", run, ATTRIB_UNMANAGED}; MonGroup clusizeecGroup{this, "SCT/SCTEC/hits", run, ATTRIB_UNMANAGED}; - string disksidenameB[N_BARRELSx2] = { + std::string disksidenameB[N_BARRELSx2] = { "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1" }; - string disksidenameECp[N_DISKSx2] = { + std::string disksidenameECp[N_DISKSx2] = { "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1", "4_0", "4_1", "5_0", "5_1", "6_0", "6_1", "7_0", "7_1", "8_0", "8_1" }; - string disksidenameECm[N_DISKSx2] = { + std::string disksidenameECm[N_DISKSx2] = { "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1", "4_0", "4_1", "5_0", "5_1", "6_0", "6_1", "7_0", "7_1", "8_0", "8_1" }; @@ -664,7 +663,7 @@ SCTHitsNoiseMonTool::bookClusterSize() { StatusCode SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemIndex) { - static const string paths[N_REGIONS] = { + static const std::string paths[N_REGIONS] = { "SCT/SCTEC/Noise", "SCT/SCTB/Noise", "SCT/SCTEA/Noise" }; static const unsigned int limits[N_REGIONS] = { @@ -684,13 +683,13 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde // book 2D "noise" maps, containing hits that aren't associated to tracks for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; - const string streamhitmaptrigger{"noiseoccupancymaptrigger" + abbreviations[systemIndex] + "_" + + const std::string streamhitmaptrigger{"noiseoccupancymaptrigger" + abbreviations[systemIndex] + "_" + layerSide.name()}; - const string streamhitmaprecent{"noiseoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string histotitle{"SCT Noise Occupancy map for " + names[systemIndex] + ": " + layerSide.title()}; - string histotitletrigger{"SCT Noise Occupancy map for " + m_NOTriggerItem + " Trigger and " + + const std::string streamhitmaprecent{"noiseoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; + std::string histotitle{"SCT Noise Occupancy map for " + names[systemIndex] + ": " + layerSide.title()}; + std::string histotitletrigger{"SCT Noise Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[systemIndex] + ": " + layerSide.title()}; - string histotitlerecent{"SCT Noise Occupancy map in recent events for " + names[systemIndex] + ": " + + std::string histotitlerecent{"SCT Noise Occupancy map in recent events for " + names[systemIndex] + ": " + layerSide.title()}; prof2Factory(streamhitmaptrigger, histotitletrigger, bec, noiseOccMaps, m_pnoiseoccupancymapHistoVectorTrigger[systemIndex]); if (m_environment == AthenaMonManager::online) { @@ -698,11 +697,11 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde } } - string histNames[N_REGIONS]{"ECm", "BAR", "ECp"}; - string histTitles[N_REGIONS]{"ECm", "Barrel", "ECp"}; + std::string histNames[N_REGIONS]{"ECm", "BAR", "ECp"}; + std::string histTitles[N_REGIONS]{"ECm", "Barrel", "ECp"}; - string histNamesNO[N_REGIONS]{"ECC", "BAR", "ECA"}; - string histTitlesNO[N_REGIONS]{"EndCap C", "Barrel", "EndCap A"}; + std::string histNamesNO[N_REGIONS]{"ECC", "BAR", "ECA"}; + std::string histTitlesNO[N_REGIONS]{"EndCap C", "Barrel", "EndCap A"}; m_NO_vsLB[systemIndex] = TProfile_LW::create((histNamesNO[systemIndex]+"NO_vsLB").c_str(), ("NO vs LB for the "+histTitlesNO[systemIndex]+" (SP noise)").c_str(), NBINS_LBs, 0.5, NBINS_LBs + 0.5); @@ -726,12 +725,12 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde StatusCode SCTHitsNoiseMonTool::bookGeneralHitOccupancyMaps(const unsigned int systemIndex) { - static const string paths[N_REGIONS]{"SCT/SCTEC/Noise", "SCT/SCTB/Noise", "SCT/SCTEA/Noise"}; + static const std::string paths[N_REGIONS]{"SCT/SCTEC/Noise", "SCT/SCTB/Noise", "SCT/SCTEA/Noise"}; static const unsigned int limits[N_REGIONS]{N_DISKSx2, N_BARRELSx2, N_DISKSx2}; - static const string profileNames[N_REGIONS]{"ECm", "BAR", "ECp"}; - static const string profileTitles[N_REGIONS]{"ECm", "Barrel", "ECp"}; - static const string profileNames2[N_REGIONS]{"ECC", "BAR", "ECA"}; - static const string profileTitles2[N_REGIONS]{"EndCap C", "Barrel", "EndCap A"}; + static const std::string profileNames[N_REGIONS]{"ECm", "BAR", "ECp"}; + static const std::string profileTitles[N_REGIONS]{"ECm", "Barrel", "ECp"}; + static const std::string profileNames2[N_REGIONS]{"ECC", "BAR", "ECA"}; + static const std::string profileTitles2[N_REGIONS]{"EndCap C", "Barrel", "EndCap A"}; const Bec bec{index2Bec(systemIndex)}; @@ -748,11 +747,11 @@ SCTHitsNoiseMonTool::bookGeneralHitOccupancyMaps(const unsigned int systemIndex) // book 2D "noise" maps, containing hits that aren't associated to tracks for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; - const string streamhitmapR{"hitoccupancymap" + abbreviations[systemIndex] + "_" + layerSide.name()}; - const string streamhitmaprecentR{"hitoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string histotitleR{"SCT Hit Occupancy map for " + names[systemIndex] + ": " + layerSide.title()}; - string histotitletriggerR{"SCT Hit Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[systemIndex] + ": " + layerSide.title()}; - string histotitlerecentR{"SCT Hit Occupancy map in recent events for " + names[systemIndex] + ": " + layerSide.title()}; + const std::string streamhitmapR{"hitoccupancymap" + abbreviations[systemIndex] + "_" + layerSide.name()}; + const std::string streamhitmaprecentR{"hitoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; + std::string histotitleR{"SCT Hit Occupancy map for " + names[systemIndex] + ": " + layerSide.title()}; + std::string histotitletriggerR{"SCT Hit Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[systemIndex] + ": " + layerSide.title()}; + std::string histotitlerecentR{"SCT Hit Occupancy map in recent events for " + names[systemIndex] + ": " + layerSide.title()}; prof2Factory(streamhitmapR, histotitleR, bec, hitOccMaps, m_phitoccupancymapHistoVector[systemIndex]); if (m_environment == AthenaMonManager::online) { prof2Factory(streamhitmaprecentR, histotitlerecentR, bec, hitOccMaps, m_phitoccupancymapHistoVectorRecent[systemIndex]); @@ -825,7 +824,7 @@ SCTHitsNoiseMonTool::bookGeneralHitOccupancyMaps(const unsigned int systemIndex) StatusCode SCTHitsNoiseMonTool::checkNoiseMaps() { IdentifierHash next; - vector<float> vectorOfOccupancies; + std::vector<float> vectorOfOccupancies; if (m_doSpacePointBasedNoise) { // CAM Added code for track and SP algorithms @@ -836,7 +835,7 @@ SCTHitsNoiseMonTool::checkNoiseMaps() { } if (m_occSumUnbiasedRecent.size() and m_numberOfEventsRecent) { - for (pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { + for (std::pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { Identifier wafer_id{val.first}; int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; float occ{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; @@ -853,7 +852,7 @@ SCTHitsNoiseMonTool::checkNoiseMaps() { } if (m_hitoccSumUnbiasedRecent.size() and m_numberOfEventsRecent) { - for (pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { + for (std::pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { Identifier wafer_id{val.first}; int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; float hitocc{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; @@ -931,10 +930,10 @@ SCTHitsNoiseMonTool::resetNoiseMapHists() { // ==================================================================================================== StatusCode SCTHitsNoiseMonTool::resetNoiseMapsRecent() { - for (pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { + for (std::pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { val.second = 0.0; } - for (pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { + for (std::pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { val.second = 0.0; } return StatusCode::SUCCESS; @@ -970,7 +969,7 @@ SCTHitsNoiseMonTool::resetHitMapHists() { // // ==================================================================================================== StatusCode -SCTHitsNoiseMonTool::resetVecProf2(vector<TProfile2D*>& hists) const { +SCTHitsNoiseMonTool::resetVecProf2(std::vector<TProfile2D*>& hists) const { for (unsigned int i{0}; i < hists.size(); ++i) { if (hists[i]==nullptr) { continue; @@ -987,7 +986,7 @@ SCTHitsNoiseMonTool::resetVecProf2(vector<TProfile2D*>& hists) const { // // ==================================================================================================== StatusCode -SCTHitsNoiseMonTool::resetVecH2(vector<TH2F_LW*>& hists) const { +SCTHitsNoiseMonTool::resetVecH2(std::vector<TH2F_LW*>& hists) const { for (unsigned int i{0}; i < hists.size(); ++i) { if (hists[i]==nullptr) { continue; @@ -1044,9 +1043,9 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() { return StatusCode::SUCCESS; } -string +std::string SCTHitsNoiseMonTool::positionString(const Identifier& plane) const { - ostringstream position_txt; + std::ostringstream position_txt; position_txt << m_pSCTHelper->barrel_ec(plane) << "_" << m_pSCTHelper->layer_disk(plane) << "_" << m_pSCTHelper->phi_module(plane) << "_" << m_pSCTHelper->eta_module(plane) << "_" << m_pSCTHelper->side(plane); @@ -1056,7 +1055,7 @@ SCTHitsNoiseMonTool::positionString(const Identifier& plane) const { StatusCode SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { // Clear the RDOsOnTracks vector - m_RDOsOnTracks.fill(unordered_set<Identifier>()); + m_RDOsOnTracks.fill(std::unordered_set<Identifier>()); SG::ReadHandle<SCT_RDO_Container> rdoContainer{m_dataObjectName}; if (not rdoContainer.isValid()) { ATH_MSG_FATAL("Could not find the data object " << m_dataObjectName.key() << " !"); @@ -1095,7 +1094,7 @@ SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { } // if Cluster is in SCT ... if (RawDataClus->detectorElement()->isSCT()) { - const vector<Identifier>& rdoList{RawDataClus->rdoList()}; + const std::vector<Identifier>& rdoList{RawDataClus->rdoList()}; m_RDOsOnTracks[RawDataClus->detectorElement()->identifyHash()].insert(rdoList.begin(), rdoList.end()); } } @@ -1107,7 +1106,7 @@ SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { StatusCode SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { - static const string paths[N_REGIONS] = { + static const std::string paths[N_REGIONS] = { "SCT/SCTEC/hits/", "SCT/SCTB/hits/", "SCT/SCTEA/hits/" }; static const unsigned int limits[N_REGIONS] = { @@ -1127,12 +1126,12 @@ SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { // book Hitmaps and hits per layer histograms for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; - const string streamhitmap{"mapsOfHitsOnTracks" + abbreviations[systemIndex] + streamDelimiter + + const std::string streamhitmap{"mapsOfHitsOnTracks" + abbreviations[systemIndex] + streamDelimiter + "trackhitsmap_" + layerSide.name()}; - const string streamhitmaprecent{"mapsOfHitsOnTracksRecent" + abbreviations[systemIndex] + streamDelimiter + + const std::string streamhitmaprecent{"mapsOfHitsOnTracksRecent" + abbreviations[systemIndex] + streamDelimiter + "trackhitsmap_" + layerSide.name()}; - string histotitle{"SCT hits on tracks for " + names[systemIndex] + " " + layerSide.title()}; - string histotitlerecent{"SCT hits on tracks from recent events for " + names[systemIndex] + " " + + std::string histotitle{"SCT hits on tracks for " + names[systemIndex] + " " + layerSide.title()}; + std::string histotitlerecent{"SCT hits on tracks from recent events for " + names[systemIndex] + " " + layerSide.title()}; h2Factory(streamhitmap, histotitle, bec, tracksMon, m_ptrackhitsHistoVector[systemIndex]); if (m_environment == AthenaMonManager::online) { @@ -1153,8 +1152,8 @@ SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos() { } TH2F_LW* -SCTHitsNoiseMonTool::h2Factory(const string& name, const string& title, const Bec bec, - MonGroup& registry, vector<TH2F_LW*>& storageVector) const { +SCTHitsNoiseMonTool::h2Factory(const std::string& name, const std::string& title, const Bec bec, + MonGroup& registry, std::vector<TH2F_LW*>& storageVector) const { int firstEta{FIRST_ETA_BIN}, lastEta{LAST_ETA_BIN}, nEta{N_ETA_BINS}, firstPhi{FIRST_PHI_BIN}, lastPhi{LAST_PHI_BIN}, nPhi{N_PHI_BINS}; @@ -1178,7 +1177,7 @@ SCTHitsNoiseMonTool::h2Factory(const string& name, const string& title, const Be } TProfile2D* -SCTHitsNoiseMonTool::prof2DFactory(const string& name, const string& title, MonGroup& registry, int nbinx, +SCTHitsNoiseMonTool::prof2DFactory(const std::string& name, const std::string& title, MonGroup& registry, int nbinx, float xlo, float xhi, int nbiny, float ylo, float yhi) const { TProfile2D* tmp{new TProfile2D{name.c_str(), title.c_str(), nbinx, xlo - 0.5, xhi + 0.5, nbiny, ylo - 0.5, yhi + 0.5}}; @@ -1192,7 +1191,7 @@ SCTHitsNoiseMonTool::prof2DFactory(const string& name, const string& title, MonG } TProfile_LW* -SCTHitsNoiseMonTool::profFactory(const string& name, const string& title, MonGroup& registry) const { +SCTHitsNoiseMonTool::profFactory(const std::string& name, const std::string& title, MonGroup& registry) const { TProfile_LW* tmp{TProfile_LW::create(name.c_str(), title.c_str(), 3, 0, 3)}; tmp->SetYTitle("Fraction of 01X"); @@ -1207,8 +1206,8 @@ SCTHitsNoiseMonTool::profFactory(const string& name, const string& title, MonGro } TProfile2D* -SCTHitsNoiseMonTool::prof2Factory(const string& name, const string& title, const Bec bec, - MonGroup& registry, vector<TProfile2D*>& storageVector) const { +SCTHitsNoiseMonTool::prof2Factory(const std::string& name, const std::string& title, const Bec bec, + MonGroup& registry, std::vector<TProfile2D*>& storageVector) const { int firstEta{FIRST_ETA_BIN}, lastEta{LAST_ETA_BIN}, nEta{N_ETA_BINS}, firstPhi{FIRST_PHI_BIN}, lastPhi{LAST_PHI_BIN}, nPhi{N_PHI_BINS}; @@ -1232,7 +1231,7 @@ SCTHitsNoiseMonTool::prof2Factory(const string& name, const string& title, const } TH1F_LW* -SCTHitsNoiseMonTool::h1Factory(const string& name, const string& title, MonGroup& registry, const float lo, +SCTHitsNoiseMonTool::h1Factory(const std::string& name, const std::string& title, MonGroup& registry, const float lo, const float hi, const unsigned int nbins) const { TH1F_LW* tmp{TH1F_LW::create(name.c_str(), title.c_str(), static_cast<int>(nbins), lo, hi)}; bool success{registry.regHist(tmp).isSuccess()}; @@ -1244,8 +1243,8 @@ SCTHitsNoiseMonTool::h1Factory(const string& name, const string& title, MonGroup } TH1F_LW* -SCTHitsNoiseMonTool::h1Factory(const string& name, const string& title, MonGroup& registry, - vector<TH1F_LW*>& storageVector, const float lo, const float hi, const unsigned int nbins) const { +SCTHitsNoiseMonTool::h1Factory(const std::string& name, const std::string& title, MonGroup& registry, + std::vector<TH1F_LW*>& storageVector, const float lo, const float hi, const unsigned int nbins) const { TH1F_LW* tmp{TH1F_LW::create(name.c_str(), title.c_str(), static_cast<int>(nbins), lo, hi)}; bool success{registry.regHist(tmp).isSuccess()}; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonAlg.cxx index f418b7807fc9e2f583b4dba697e2e14b8f654762..30492cefe0ba29e56242ae9a99166dfafb731b8c 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCTLorentzMonAlg.h" @@ -11,6 +11,7 @@ #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "TrkTrackSummary/TrackSummary.h" +#include <cmath> #include <vector> SCTLorentzMonAlg::SCTLorentzMonAlg(const std::string& name, ISvcLocator* pSvcLocator) @@ -147,8 +148,8 @@ StatusCode SCTLorentzMonAlg::fillHistograms(const EventContext& ctx) const { ) { passesCuts = true; } else if ((track->perigeeParameters()->parameters()[Trk::qOverP] < 0.) and // use negative track only - (fabs(perigee->parameters()[Trk::d0]) < 1.) and // d0 < 1mm - (fabs(perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta])) < 1.) and // d0 < 1mm + (std::abs(perigee->parameters()[Trk::d0]) < 1.) and // d0 < 1mm + (std::abs(perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta])) < 1.) and // d0 < 1mm (trkp->momentum().mag() > 500.) and // Pt > 500MeV (summary->get(Trk::numberOfSCTHits) > 6)// and // #SCTHits >6 ) { diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx index 2830a5356a5656130f20e2997a310bf3ea18ee40..c7a5a06007a43eaa1d90593994917c356daa1a18 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @file SCTLorentzMonTool.cxx @@ -29,7 +29,6 @@ #include <cmath> #include <type_traits> -using namespace std; using namespace SCT_Monitoring; // ==================================================================================================== @@ -39,7 +38,7 @@ using namespace SCT_Monitoring; * of the filepath for histograms etc */ // ==================================================================================================== -SCTLorentzMonTool::SCTLorentzMonTool(const string& type, const string& name, const IInterface* parent): +SCTLorentzMonTool::SCTLorentzMonTool(const std::string& type, const std::string& name, const IInterface* parent): ManagedMonitorToolBase(type, name, parent) { } @@ -174,7 +173,7 @@ SCTLorentzMonTool::fillHistograms() { } } // find cluster size - const vector<Identifier>& rdoList{RawDataClus->rdoList()}; + const std::vector<Identifier>& rdoList{RawDataClus->rdoList()}; int nStrip{static_cast<int>(rdoList.size())}; const Trk::TrackParameters* trkp{dynamic_cast<const Trk::TrackParameters*>(tsos->trackParameters())}; if (trkp==nullptr) { @@ -206,8 +205,8 @@ SCTLorentzMonTool::fillHistograms() { ) { passesCuts = true; } else if ((track->perigeeParameters()->parameters()[Trk::qOverP] < 0.) and // use negative track only - (fabs(perigee->parameters()[Trk::d0]) < 1.) and // d0 < 1mm - (fabs(perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta])) < 1.) and // d0 < 1mm + (std::abs(perigee->parameters()[Trk::d0]) < 1.) and // d0 < 1mm + (std::abs(perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta])) < 1.) and // d0 < 1mm (trkp->momentum().mag() > 500.) and // Pt > 500MeV (summary->get(Trk::numberOfSCTHits) > 6)// and // #SCTHits >6 ) { @@ -255,28 +254,28 @@ SCTLorentzMonTool::checkHists(bool /*fromFinalize*/) { // ==================================================================================================== StatusCode SCTLorentzMonTool::bookLorentzHistos() { - const string stem{m_path + "/SCT/GENERAL/lorentz/"}; + const std::string stem{m_path + "/SCT/GENERAL/lorentz/"}; MonGroup Lorentz{this, m_path + "SCT/GENERAL/lorentz", run, ATTRIB_UNMANAGED}; - static const string hNum[N_BARRELS] = { + static const std::string hNum[N_BARRELS] = { "0", "1", "2", "3" }; - static const string hNumS[N_SIDES] = { + static const std::string hNumS[N_SIDES] = { "0", "1" }; static const int nProfileBins{360}; int success{1}; - static const string histNames1[nSurfaces]{"_100", "_111"}; - static const string histNames2[nSurfaces]{"_100_", "_111_"}; - static const string histTitles[nSurfaces]{"100 - ", "111 - "}; + static const std::string histNames1[nSurfaces]{"_100", "_111"}; + static const std::string histNames2[nSurfaces]{"_100_", "_111_"}; + static const std::string histTitles[nSurfaces]{"100 - ", "111 - "}; for (int l{0}; l < N_BARRELS; ++l) { // granularity set to one profile/layer for now for (int side{0}; side < nSides; ++side) { for (unsigned int iSurface{0}; iSurface<nSurfaces; iSurface++) { - string histName; + std::string histName; histName = "h_phiVsNstrips" + histNames2[iSurface] + hNum[l] + "Side" + hNumS[side]; - string histTitle; + std::string histTitle; histTitle = histTitles[iSurface] + "Inc. Angle vs nStrips for Layer Side" + hNum[l] + hNumS[side]; int iflag{0}; m_phiVsNstrips[l][side][iSurface] = pFactory(histName, histTitle, nProfileBins, -90., 90., Lorentz, iflag); @@ -293,7 +292,7 @@ SCTLorentzMonTool::bookLorentzHistos() { } TProfile* -SCTLorentzMonTool::pFactory(const string& name, const string& title, int nbinsx, float xlow, float xhigh, +SCTLorentzMonTool::pFactory(const std::string& name, const std::string& title, int nbinsx, float xlow, float xhigh, MonGroup& registry, int& iflag) const { TProfile* tmp{new TProfile{name.c_str(), title.c_str(), nbinsx, xlow, xhigh}}; bool success{registry.regHist(tmp).isSuccess()}; @@ -327,7 +326,7 @@ SCTLorentzMonTool::findAnglesToWaferSurface(const float (&vec)[3], // 3 is for x return iflag; } - float cosAlpha{sqrt(1.0f - sinAlpha * sinAlpha)}; + float cosAlpha{std::sqrt(1.0f - sinAlpha * sinAlpha)}; double phix{ cosAlpha * element->phiAxis().x() + sinAlpha * element->phiAxis().y()}; double phiy{-sinAlpha * element->phiAxis().x() + cosAlpha * element->phiAxis().y()}; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonAlg.cxx index d8c2ede9139475873ea404c6efbe8e51daa5e93f..8b3b28245f38e9fcc365d3a75b80a4daa7afe284 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonAlg.cxx @@ -19,12 +19,11 @@ #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/ThreadLocalContext.h" +#include <cmath> -using namespace std; using SCT_Monitoring::N_REGIONS; using SCT_Monitoring::bec2Index; - namespace { // some possible parameter key values enum ParameterKey { @@ -74,7 +73,7 @@ ATH_MSG_DEBUG("SCTTracksMonAlg::fillHistograms()"); m_doNegativeEndcap, true, m_doPositiveEndcap }; - bitset<N_TRIGGER_TYPES> firedTriggers{0}; + std::bitset<N_TRIGGER_TYPES> firedTriggers{0}; if (m_doTrigger and (not checkTriggers(firedTriggers).isSuccess())) { ATH_MSG_WARNING("Triggers not found!"); } @@ -132,7 +131,7 @@ ATH_MSG_DEBUG("SCTTracksMonAlg::fillHistograms()"); fill("SCTTracksMonitor", trk_etaAcc); if (track->perigeeParameters()->parameters()[Trk::qOverP] != 0.) { - auto trk_ptAcc{Monitored::Scalar<float>("trk_pt", fabs(1. / (track->perigeeParameters()->parameters()[Trk::qOverP] * 1000.)))}; + auto trk_ptAcc{Monitored::Scalar<float>("trk_pt", std::abs(1. / (track->perigeeParameters()->parameters()[Trk::qOverP] * 1000.)))}; fill("SCTTracksMonitor", trk_ptAcc); } auto trk_d0Acc{Monitored::Scalar<float>("trk_d0", track->perigeeParameters()->parameters()[Trk::d0])}; @@ -173,7 +172,7 @@ ATH_MSG_DEBUG("SCTTracksMonAlg::fillHistograms()"); const unsigned int subsystemIndex{bec2Index(bec)}; const bool doThisDetector{doThisSubsystem[subsystemIndex]}; hasHits[subsystemIndex] = true; - unique_ptr<const Trk::TrackParameters> trkParameters(nullptr); + std::unique_ptr<const Trk::TrackParameters> trkParameters(nullptr); const Trk::TrackParameters* trkParam{tsos->trackParameters()}; const Trk::RIO_OnTrack* rio{dynamic_cast<const Trk::RIO_OnTrack*>(tsos->measurementOnTrack())}; if (rio) { @@ -198,7 +197,7 @@ ATH_MSG_DEBUG("SCTTracksMonAlg::fillHistograms()"); ATH_MSG_DEBUG("Cluster Position Phi= " << clus->localParameters()[Trk::locX]); #endif if (not m_residualPullCalculator.empty()) { - unique_ptr<const Trk::ResidualPull> residualPull{m_residualPullCalculator->residualPull(rio, trkParam, + std::unique_ptr<const Trk::ResidualPull> residualPull{m_residualPullCalculator->residualPull(rio, trkParam, m_doUnbiasedCalc ? Trk::ResidualPull::Unbiased : Trk::ResidualPull::Biased)}; if (not residualPull) { ATH_MSG_WARNING("Residual Pull Calculator did not succeed!"); @@ -258,7 +257,7 @@ SCTTracksMonAlg::calculatePull(const float residual, const float trkErr, const f } StatusCode -SCTTracksMonAlg::checkTriggers(bitset<N_TRIGGER_TYPES>& firedTriggers) const { +SCTTracksMonAlg::checkTriggers(std::bitset<N_TRIGGER_TYPES>& firedTriggers) const { const EventContext& ctx = Gaudi::Hive::currentContext(); SG::ReadHandle<xAOD::EventInfo> evtInfo = GetEventInfo (ctx); @@ -271,6 +270,6 @@ SCTTracksMonAlg::checkTriggers(bitset<N_TRIGGER_TYPES>& firedTriggers) const { } bool -SCTTracksMonAlg::hasTriggerFired(const unsigned int trigger, const bitset<N_TRIGGER_TYPES>& firedTriggers) const { +SCTTracksMonAlg::hasTriggerFired(const unsigned int trigger, const std::bitset<N_TRIGGER_TYPES>& firedTriggers) const { return ((trigger < N_TRIGGER_TYPES) ? firedTriggers.test(trigger) : false); } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx index fd46ce7079389037074b45985d77945a18ae325d..e6fabac2801234cc19b2ae7fb1284cd05d9f8c61 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTTracksMonTool.cxx @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @file SCTTracksMonTool.cxx @@ -34,7 +34,6 @@ #include <cmath> -using namespace std; using namespace SCT_Monitoring; namespace { @@ -59,7 +58,7 @@ namespace { } } -const string SCTTracksMonTool::s_triggerNames[] = { +const std::string SCTTracksMonTool::s_triggerNames[] = { "RNDM", "BPTX", "L1CAL", "TGC", "RPC", "MBTS", "COSM", "Calib" }; @@ -71,8 +70,8 @@ const string SCTTracksMonTool::s_triggerNames[] = { * numbers to be used, and the timebin. */ // ==================================================================================================== -SCTTracksMonTool::SCTTracksMonTool(const string& type, - const string& name, +SCTTracksMonTool::SCTTracksMonTool(const std::string& type, + const std::string& name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) { } @@ -138,7 +137,7 @@ SCTTracksMonTool::fillHistograms() { m_doNegativeEndcap, true, m_doPositiveEndcap }; - bitset<N_TRIGGER_TYPES> firedTriggers{0}; + std::bitset<N_TRIGGER_TYPES> firedTriggers{0}; if (m_doTrigger and (not checkTriggers(firedTriggers).isSuccess())) { ATH_MSG_WARNING("Triggers not found!"); } @@ -187,7 +186,7 @@ SCTTracksMonTool::fillHistograms() { m_tracksPerRegion->Fill(etaRegion(trackPerigeeEta)); m_trk_eta->Fill(trackPerigeeEta); if (track->perigeeParameters()->parameters()[Trk::qOverP] != 0.) { - m_trk_pt->Fill(fabs(1. / (track->perigeeParameters()->parameters()[Trk::qOverP] * 1000.))); + m_trk_pt->Fill(std::abs(1. / (track->perigeeParameters()->parameters()[Trk::qOverP] * 1000.))); } m_trk_d0->Fill(track->perigeeParameters()->parameters()[Trk::d0]); m_trk_z0->Fill(track->perigeeParameters()->parameters()[Trk::z0]); @@ -250,7 +249,7 @@ SCTTracksMonTool::fillHistograms() { ATH_MSG_DEBUG("Cluster Position Phi= " << clus->localParameters()[Trk::locX]); #endif if (not m_residualPullCalculator.empty()) { - unique_ptr<const Trk::ResidualPull> residualPull{m_residualPullCalculator->residualPull(rio, trkParameters, + std::unique_ptr<const Trk::ResidualPull> residualPull{m_residualPullCalculator->residualPull(rio, trkParameters, m_doUnbiasedCalc ? Trk::ResidualPull::Unbiased : Trk::ResidualPull::Biased)}; if (not residualPull) { ATH_MSG_WARNING("Residual Pull Calculator did not succeed!"); @@ -374,10 +373,10 @@ SCTTracksMonTool::calculatePull(const float residual, const float trkErr, const StatusCode SCTTracksMonTool::bookGeneralHistos() { if (newRunFlag()) { - string stem{m_path + "/SCT/GENERAL/tracks/"}; + std::string stem{m_path + "/SCT/GENERAL/tracks/"}; MonGroup Tracks{this, m_path + "SCT/GENERAL/tracks", run, ATTRIB_UNMANAGED}; - const string regionNames[N_REGIONS]{"EndCapC", "Barrel", "EndCapA"}; + const std::string regionNames[N_REGIONS]{"EndCapC", "Barrel", "EndCapA"}; // Book histogram of number of tracks per region m_tracksPerRegion = new TH1F("tracksPerRegion", "Number of tracks in eta regions", N_REGIONS, 0, N_REGIONS); @@ -463,8 +462,8 @@ SCTTracksMonTool::bookGeneralHistos() { StatusCode -SCTTracksMonTool::h1Factory(const string& name, const string& title, const float extent, MonGroup& registry, - vector<TH1F*>& storageVector) const { +SCTTracksMonTool::h1Factory(const std::string& name, const std::string& title, const float extent, MonGroup& registry, + std::vector<TH1F*>& storageVector) const { static const unsigned int nbins{100}; const float lo{-extent}; const float hi{extent}; @@ -476,7 +475,7 @@ SCTTracksMonTool::h1Factory(const string& name, const string& title, const float } StatusCode -SCTTracksMonTool::checkTriggers(bitset<N_TRIGGER_TYPES>& firedTriggers) const { +SCTTracksMonTool::checkTriggers(std::bitset<N_TRIGGER_TYPES>& firedTriggers) const { SG::ReadHandle<xAOD::EventInfo> evtInfo{m_eventInfoKey}; if (evtInfo.isValid()) { firedTriggers = evtInfo->level1TriggerType(); @@ -487,6 +486,6 @@ SCTTracksMonTool::checkTriggers(bitset<N_TRIGGER_TYPES>& firedTriggers) const { } bool -SCTTracksMonTool::hasTriggerFired(const unsigned int trigger, const bitset<N_TRIGGER_TYPES>& firedTriggers) const { +SCTTracksMonTool::hasTriggerFired(const unsigned int trigger, const std::bitset<N_TRIGGER_TYPES>& firedTriggers) const { return ((trigger < N_TRIGGER_TYPES) ? firedTriggers.test(trigger) : false); } diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt index 14a6d8830d8901648b53d634b74019d9a7866bfb..79c1646ba47332575d76195782a50dc92f64c95e 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt @@ -46,6 +46,5 @@ atlas_add_component( TRT_Monitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} AthenaMonitoringLib GaudiKernel InDetRawData LumiBlockCompsLib CommissionEvent AthContainers AtlasDetDescr Identifier xAODEventInfo xAODTrigger EventPrimitives TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetRIO_OnTrack LWHists TrkTrack TrkTrackSummary TrkToolInterfaces TRT_DriftFunctionToolLib ) # Install files from the package: -atlas_install_headers( TRT_Monitoring ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx index c370f9d9b266d8bfbd512dca762840e3b3ebdee3..111a0cd10aae131ed5a490d02f426b40ab42308b 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifdef ONLINE // This tool is only meant for special online monitoring at Point 1 -#include "TRT_Monitoring/TRT_Hits_Monitoring_Tool.h" +#include "TRT_Hits_Monitoring_Tool.h" #include "TRT_ReadoutGeometry/TRT_DetectorManager.h" #include "StoreGate/ReadHandle.h" diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.h similarity index 100% rename from InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h rename to InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.h diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx index 8489cc144ad383aabff26161169e3dd41ccbc5a4..88680b033a191ec9eb3025dd5d0fc09a81acc00e 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "TRT_Monitoring/TRT_Monitoring_Tool.h" +#include "TRT_Monitoring_Tool.h" #include "AthContainers/DataVector.h" #include "TRT_ReadoutGeometry/TRT_DetectorManager.h" @@ -589,7 +589,7 @@ StatusCode TRT_Monitoring_Tool::initialize() { ATH_CHECK( m_xAODEventInfoKey.initialize() ); ATH_CHECK( m_TRT_BCIDCollectionKey.initialize() ); ATH_CHECK( m_comTimeObjectKey.initialize() ); - ATH_CHECK( m_trigDecisionKey.initialize() ); + ATH_CHECK( m_trigDecisionKey.initialize(!m_trigDecisionKey.empty()) ); ATH_MSG_INFO("My TRT_DAQ_ConditionsSvc is " << m_DAQSvc); @@ -1131,7 +1131,13 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { SG::ReadHandle<xAOD::EventInfo> xAODEventInfo(m_xAODEventInfoKey); SG::ReadHandle<InDetTimeCollection> trtBCIDCollection(m_TRT_BCIDCollectionKey); SG::ReadHandle<ComTime> comTimeObject(m_comTimeObjectKey); - SG::ReadHandle<xAOD::TrigDecision> trigDecision(m_trigDecisionKey); + const xAOD::TrigDecision* trigDecision(nullptr); + if (!m_trigDecisionKey.empty()) { + SG::ReadHandle<xAOD::TrigDecision> htrigDecision{m_trigDecisionKey}; + if (htrigDecision.isValid()) { + trigDecision = htrigDecision.get(); + } + } if (!xAODEventInfo.isValid()) { ATH_MSG_ERROR("Could not find event info object " << m_xAODEventInfoKey.key() << @@ -1170,7 +1176,7 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { " in store"); return StatusCode::FAILURE; } - if (!trigDecision.isValid()) { + if (!m_trigDecisionKey.empty() && !trigDecision) { ATH_MSG_INFO("Could not find trigger decision object " << m_trigDecisionKey.key() << " in store"); } @@ -1180,7 +1186,7 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { " in store"); } if (m_passEventBurst) { - ATH_CHECK( fillTRTTracks(*trackCollection, trigDecision.ptr(), comTimeObject.ptr()) ); + ATH_CHECK( fillTRTTracks(*trackCollection, trigDecision, comTimeObject.ptr()) ); } } diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h similarity index 100% rename from InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h rename to InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx index 3cabca0e153cc8ff64a6d295c3df5013e093a778..a3d13d00e114561d9ffaf39037a01e2184ebfa49 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx @@ -1,5 +1,5 @@ -#include "TRT_Monitoring/TRT_Monitoring_Tool.h" -#include "TRT_Monitoring/TRT_Hits_Monitoring_Tool.h" +#include "../TRT_Monitoring_Tool.h" +#include "../TRT_Hits_Monitoring_Tool.h" DECLARE_COMPONENT( TRT_Monitoring_Tool ) #ifdef ONLINE diff --git a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.h b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.h index 06679175767d9d12f912010a444c8906f85a0729..4b0952141628d549297a7a664bfa4e85a4565811 100755 --- a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.h +++ b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.h @@ -34,6 +34,8 @@ public: // Constructor with parameters: InDetRawDataContainer(unsigned int max); + InDetRawDataContainer(unsigned int max, EventContainers::Mode); + InDetRawDataContainer(EventContainers::IdentifiableCache<CollectionT>*); // Destructor: diff --git a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.icc b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.icc index e0acbeb4e1418ce9afe502b93a1a93e56ca7eb09..359344e42c96056974c4a4d589cebcdae34312cc 100755 --- a/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.icc +++ b/InnerDetector/InDetRawEvent/InDetRawData/InDetRawData/InDetRawDataContainer.icc @@ -20,6 +20,13 @@ InDetRawDataContainer< CollectionT>::InDetRawDataContainer(unsigned int max) : { } +template< class CollectionT> +// Constructor with parameters: +InDetRawDataContainer< CollectionT>::InDetRawDataContainer(unsigned int max, EventContainers::Mode mode) : + IdentifiableContainer<CollectionT>(max, mode) +{ +} + template< class CollectionT> InDetRawDataContainer< CollectionT>::InDetRawDataContainer(EventContainers::IdentifiableCache<CollectionT> *cache) : IdentifiableContainer<CollectionT>(cache) diff --git a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt index b86f1adf2ed4c2297702a793ed9fc27cb8f529f9..51a7228809b56d3da6c015826f918b52c8174330 100644 --- a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt @@ -10,7 +10,6 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps GaudiKernel InnerDetector/InDetConditions/TRT_ConditionsServices - MagneticField/MagFieldInterfaces PRIVATE Control/StoreGate InnerDetector/InDetConditions/TRT_ConditionsData @@ -21,7 +20,10 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkParameters Event/xAOD/xAODTracking Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkTrack ) + Tracking/TrkEvent/TrkTrack + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( ROOT COMPONENTS Minuit RIO Core Tree MathCore Hist pthread MathMore Minuit2 Matrix Physics HistPainter Rint ) @@ -31,7 +33,7 @@ atlas_add_component( InDetLowBetaFinder src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TRT_ConditionsServicesLib MagFieldInterfaces StoreGateLib SGtests TRT_ConditionsData InDetIdentifier InDetLowBetaInfo InDetRIO_OnTrack TrkParameters xAODTracking TrkRIO_OnTrack TrkTrack ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TRT_ConditionsServicesLib StoreGateLib SGtests TRT_ConditionsData InDetIdentifier InDetLowBetaInfo InDetRIO_OnTrack TrkParameters xAODTracking TrkRIO_OnTrack TrkTrack MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( InDetLowBetaFinder ) diff --git a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/InDetLowBetaFinder/LowBetaAlg.h b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/InDetLowBetaFinder/LowBetaAlg.h index 646454acfc8c9a1f15de36fa595b8f8c1d3bfb39..15a424e165196cccb4216799d8dc14baa81ad71b 100644 --- a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/InDetLowBetaFinder/LowBetaAlg.h +++ b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/InDetLowBetaFinder/LowBetaAlg.h @@ -24,7 +24,9 @@ author Christopher.Marino <Christopher.Marino@cern.ch> #include "AthenaBaseComps/AthAlgorithm.h" #include "TRT_ConditionsServices/ITRT_CalDbTool.h" #include "GaudiKernel/ToolHandle.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" #include "xAODTracking/TrackParticleContainer.h" #include "InDetLowBetaInfo/InDetLowBetaContainer.h" #include "TrkTrack/TrackCollection.h" @@ -84,7 +86,8 @@ namespace InDet /** trying to get ahold of the TRT calib DB: */ ToolHandle<ITRT_CalDbTool> m_trtconddbTool; - ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; private: // Functions/variables for using TrtToolsBetaLiklihood, see TrtToolsWrapper.cxx diff --git a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/src/LowBetaAlg.cxx b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/src/LowBetaAlg.cxx index 14a43596e32aa9c24cd45d24af45ec15440e55ee..bf4f0d3c9a262b811fea7d36d3ba70b050df91d6 100644 --- a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/src/LowBetaAlg.cxx +++ b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/src/LowBetaAlg.cxx @@ -43,7 +43,6 @@ namespace InDet m_trackParticleCollection("InDetTrackParticles"), m_InDetLowBetaOutputName("InDetLowBetaCandidates"), m_trtconddbTool("TRT_CalDbTool",this), - m_fieldServiceHandle("AtlasFieldSvc",name), m_TrtTool(0), m_TRTdEdxTool(), m_TrtToolsSuccess{}, @@ -58,7 +57,6 @@ namespace InDet declareProperty("CSMP_TimingOffset", m_TimingOffset); declareProperty("InDetLowBetaOutputName", m_InDetLowBetaOutputName); declareProperty("MC_flag", m_mcswitch); - declareProperty("AtlasFieldSvc", m_fieldServiceHandle, "Magnet Field used by this algorithm"); declareProperty("TRTCalDbTool", m_trtconddbTool); declareProperty("TRT_ToT_dEdx_Tool", m_TRTdEdxTool); @@ -66,7 +64,6 @@ namespace InDet // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * StatusCode LowBetaAlg::initialize(){ - ATH_CHECK( m_fieldServiceHandle.retrieve() ); ATH_CHECK(detStore()->retrieve(m_trtId, "TRT_ID")); m_TrtToolInitSuccess = !(initializeTrtToolBetaLiklihood().isFailure()); @@ -75,6 +72,9 @@ namespace InDet ATH_CHECK( m_trackParticleCollection.initialize() ); ATH_CHECK( m_UnslimmedTracksContainerName.initialize() ); ATH_CHECK( m_InDetLowBetaOutputName.initialize() ); + // Read handle for AtlasFieldCacheCondObj + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); + return StatusCode::SUCCESS; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -87,7 +87,17 @@ namespace InDet return StatusCode::FAILURE; } - if (m_fieldServiceHandle->solenoidOn()){//B field + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){//B field if (!m_trackParticleCollection.key().empty()){ diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx index 48e4913f4f8d72860cfdf06893b13eacdf0d65b6..d4304456c733894681100bec6082d536be5fd0b5 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @file SCT_Clusterization.cxx @@ -36,7 +36,7 @@ namespace InDet { ATH_MSG_INFO("SCT_Clusterization::initialize()!"); // Get the conditions summary service (continue anyway, just check the pointer - // later and declare everything to be 'good' if it is NULL) + // later and declare everything to be 'good' if it is nullptr) if (m_checkBadModules.value()) { ATH_MSG_INFO("Clusterization has been asked to look at bad module info"); ATH_CHECK(m_pSummaryTool.retrieve()); diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py index 50e84153ff18b2bf95dc1c5d6b46f995cc019b1b..6880029de6a0086885f6aa7126f51453b605e77c 100644 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py @@ -498,6 +498,11 @@ if doPixel: SplitClusterAmbiguityMap= "SplitClusterAmbiguityMap") if not InDetFlags.doTIDE_Ambi() and clusterSplitProbTool is not None : InDetMergedPixelsTool.SplitProbTool = clusterSplitProbTool if not InDetFlags.doTIDE_Ambi() and clusterSplitterTool is not None : InDetMergedPixelsTool.ClusterSplitter = clusterSplitterTool + # Enable duplcated RDO check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetMergedPixelsTool.CheckDuplicatedRDO = True + ToolSvc += InDetMergedPixelsTool from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder(name = "InDetPixelGangedAmbiguitiesFinder") diff --git a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg.h b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg.h index e8d07bb25a1b2d7ef6208a746eba700cfa5ad281..654e4b48175aeb20a0c048b994e6a70aa41e28be 100755 --- a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg.h +++ b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg/TRT_TrackExtensionAlg.h @@ -16,7 +16,7 @@ #define TRT_TrackExtensionAlg_H #include <string> -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "InDetRecToolInterfaces/ITRT_TrackExtensionTool.h" @@ -32,7 +32,7 @@ namespace InDet { - class TRT_TrackExtensionAlg : public AthAlgorithm { + class TRT_TrackExtensionAlg : public AthReentrantAlgorithm { /////////////////////////////////////////////////////////////////// // Public methods: @@ -47,7 +47,7 @@ namespace InDet { TRT_TrackExtensionAlg(const std::string &name, ISvcLocator *pSvcLocator); virtual ~TRT_TrackExtensionAlg() {} StatusCode initialize(); - StatusCode execute(); + StatusCode execute(const EventContext& ctx) const; StatusCode finalize(); /////////////////////////////////////////////////////////////////// @@ -55,9 +55,6 @@ namespace InDet { /////////////////////////////////////////////////////////////////// protected: - StatusCode execute_r(const EventContext& ctx) const; - - /////////////////////////////////////////////////////////////////// // Protected data /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx index c2da6d7be406d128899694c67438a2677751bf48..8d5191913f604117579961adb254a3be767691bb 100755 --- a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx +++ b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx @@ -16,7 +16,7 @@ InDet::TRT_TrackExtensionAlg::TRT_TrackExtensionAlg (const std::string& name,ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) { + AthReentrantAlgorithm(name, pSvcLocator) { } /////////////////////////////////////////////////////////////////// @@ -38,11 +38,7 @@ StatusCode InDet::TRT_TrackExtensionAlg::initialize() { // Execute /////////////////////////////////////////////////////////////////// -StatusCode InDet::TRT_TrackExtensionAlg::execute() { - return execute_r( Gaudi::Hive::currentContext() ); -} - -StatusCode InDet::TRT_TrackExtensionAlg::execute_r(const EventContext& ctx) const { +StatusCode InDet::TRT_TrackExtensionAlg::execute(const EventContext& ctx) const { Counter_t counter; // Get input tracks collection diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SiClusterOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SiClusterOnTrack.h index da6123160f8bef0d128ebcfdb443d5cf8bd8b5da..2130c7ef7fa2be13ce08ab401f74a85e2a62c50a 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SiClusterOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SiClusterOnTrack.h @@ -76,28 +76,34 @@ namespace InDet { /** returns global position (gathered through Surface constraint) - fullfills Trk::MeasurementBase interface */ - virtual const Amg::Vector3D& globalPosition() const; - + virtual const Amg::Vector3D& globalPosition() const override; + + virtual bool rioType(Trk::RIO_OnTrackType::Type type) const override + { + return (type == Trk::RIO_OnTrackType::SiCluster); + } + /** returns the DE hashID* - fullfills Trk::RIO_OnTrack interface*/ - IdentifierHash idDE() const; + virtual IdentifierHash idDE() const override; bool isBroadCluster() const; /**returns some information about this RIO_OnTrack. - fullfills Trk::RIO_OnTrack interface*/ - virtual MsgStream& dump( MsgStream& out ) const; + virtual MsgStream& dump( MsgStream& out ) const override; /**returns some information about this RIO_OnTrack. - fullfills Trk::RIO_OnTrack interface*/ - virtual std::ostream& dump( std::ostream& out ) const; + virtual std::ostream& dump( std::ostream& out ) const override; protected: friend class ::SiClusterOnTrackCnv_p1; /** ONLY for use in custom convertor Allows the custom convertor to reset values when persistying/reading back RoTs*/ - virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd)=0; + virtual void setValues(const Trk::TrkDetElementBase* detEl, + const Trk::PrepRawData* prd) override = 0; /** The IdentifierHash - probably not used*/ IdentifierHash m_idDE; diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h index fe29d8ddf5a8cf5c4ee2b66ec85eb599d227788e..1f61287693a488fe753301bd12fd3c9959ff3379 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h @@ -91,35 +91,39 @@ namespace InDet{ virtual ~TRT_DriftCircleOnTrack(); /**allows copying without losing the type information. Used in Trk::Track*/ - TRT_DriftCircleOnTrack* clone() const ; + virtual TRT_DriftCircleOnTrack* clone() const override; /** return the global position of this RIO_OnTrack @todo convention about z coordinate - fullfills Trk::MeasurementBase interface */ - const Amg::Vector3D& globalPosition() const final; + virtual const Amg::Vector3D& globalPosition() const override; /** returns the surface for the local to global transformation - fullfills Trk::MeasurementBase interface */ - const Trk::Surface& associatedSurface() const; - - + virtual const Trk::Surface& associatedSurface() const override; + + virtual bool rioType(Trk::RIO_OnTrackType::Type type) const override + { + return (type==Trk::RIO_OnTrackType::TRT_DriftCircle); + } + /** returns the PrepRawData - is a TRT_DriftCircle in this scope - fullfills Trk::RIO_OnTrack interface */ - const TRT_DriftCircle* prepRawData() const; + virtual const TRT_DriftCircle* prepRawData() const override; const ElementLinkToIDCTRT_DriftCircleContainer& prepRawDataLink() const; /** returns the DE hashID - fullfills Trk::RIO_OnTrack interface */ - IdentifierHash idDE() const; + virtual IdentifierHash idDE() const override; /** returns the detector element, assoicated with the PRD of this class - fullfills Trk::RIO_OnTrack interface */ - const InDetDD::TRT_BaseElement* detectorElement() const; + virtual const InDetDD::TRT_BaseElement* detectorElement() const override; /** returns the side on which the drift radius is. (for more information see the definition of @@ -143,9 +147,9 @@ namespace InDet{ double timeOverThreshold() const; /**returns some information about this RIO_OnTrack.*/ - virtual MsgStream& dump( MsgStream& out ) const; + virtual MsgStream& dump( MsgStream& out ) const override; /**returns some information about this RIO_OnTrack.*/ - virtual std::ostream& dump( std::ostream& out ) const; + virtual std::ostream& dump( std::ostream& out ) const override; float localAngle() const; float positionAlongWire() const; @@ -153,7 +157,7 @@ namespace InDet{ private: /** ONLY for use in custom convertor Allows the custom convertor to reset values when persistying/reading back RoTs*/ - virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd); + virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd) override; /** @brief Uses the passed loc3Dframe to calculate and set the global coord of this hit. The detector element surface is used*/ diff --git a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx index 73b9d65d7b37ed193cc496503495ce4b7c0abaa7..914a4dfdb1810af5ccea22210b20590019890574 100755 --- a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -133,10 +133,10 @@ const InDet::CompetingSCT_ClustersOnTrack* InDet::CompetingSCT_ClustersOnTrackTo // loop over all given PrepRawData std::list<const Trk::PrepRawData*>::const_iterator rioIter = RIO_List.begin(); for (; rioIter!=RIO_List.end(); ++rioIter) { - // check if given pointer is not NULL + // check if given pointer is not nullptr const InDet::SCT_Cluster* riopointer = dynamic_cast<const InDet::SCT_Cluster*>(*rioIter); if (!riopointer) { - //ATH_MSG_WARNING("That's mean: given list of PrepRawData* contains a NULL pointer resp. not a SCT_Cluster!"); + //ATH_MSG_WARNING("That's mean: given list of PrepRawData* contains a nullptr resp. not a SCT_Cluster!"); ATH_MSG_WARNING("Given list of PrepRawData* contains a non SCT_Cluster!"); ATH_MSG_WARNING("Entry will therefore be ignored!"); continue; diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt index 6e4f3440df3a67fbeb36350b95ae02d864af1303..48521af7bacd712eace0a9904c4b93b9cee7292e 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters Tracking/TrkTools/TrkToolInterfaces + Tracking/TrkExtrapolation/TrkExInterfaces PRIVATE DetectorDescription/AtlasDetDescr DetectorDescription/IdDictDetDescr @@ -28,7 +29,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkMeasurementBase Tracking/TrkEvent/TrkTrack - Tracking/TrkExtrapolation/TrkExInterfaces ) + ) # External dependencies: find_package( Eigen ) @@ -42,11 +43,15 @@ atlas_add_library( InDetTestBLayerLib src/*.cxx PUBLIC_HEADERS InDetTestBLayer INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces - PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry Particle TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack TrkExInterfaces ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives GaudiKernel InDetRecToolInterfaces + TrkEventPrimitives TrkParameters TrkToolInterfaces TrkExInterfaces + PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry Particle + TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack ) atlas_add_component( InDetTestBLayer src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces AtlasDetDescr IdDictDetDescr InDetIdentifier InDetReadoutGeometry Particle TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack TrkExInterfaces InDetTestBLayerLib ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives + GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces AtlasDetDescr IdDictDetDescr InDetIdentifier + InDetReadoutGeometry Particle TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack TrkExInterfaces InDetTestBLayerLib ) diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h b/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h index a087a632438b58fb800d483554d3169da54fc33a..eb3843a345c084f3eddf13572f7f6a49549c5f3f 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h @@ -11,6 +11,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "TrkParameters/TrackParameters.h" #include "TrkEventPrimitives/ResidualPull.h" +#include "TrkExInterfaces/IExtrapolator.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "InDetTestBLayer/TrackStateOnBLayerInfo.h" @@ -18,7 +19,10 @@ #include <vector> #include <string> -namespace Trk { class Track; class IExtrapolator; class TrackParticleBase; class IResidualPullCalculator;} +namespace Trk { +class Track; +class TrackParticleBase; +} namespace Rec { class TrackParticle; } class AtlasDetectorID; class Identifier; @@ -30,94 +34,122 @@ namespace InDet { class InDetTestBLayerTool : virtual public IInDetTestBLayerTool, public AthAlgTool { - public: - - InDetTestBLayerTool(const std::string& name, - const std::string& n, const IInterface* p); + public: + InDetTestBLayerTool(const std::string& name, const std::string& n, const IInterface* p); virtual ~InDetTestBLayerTool(); virtual StatusCode initialize() override; virtual StatusCode finalize() override; // bool expectHitInBLayer(const Rec::TrackParticle*) const ; - virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, bool recompute=false) const override; - virtual bool expectHitInBLayer(const Trk::Track*, bool recompute=false) const override; + virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, bool recompute = false) const override; + virtual bool expectHitInBLayer(const Trk::Track*, bool recompute = false) const override; virtual bool expectHitInBLayer(const Trk::TrackParameters* trackpar) const override; - virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::Track* ) const override; + virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::Track*) const override; virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::TrackParticleBase*) const override; //// return false if extrapolation failed - virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParticleBase*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnBlayerInfo(const Trk::Track*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParameters* trackpar, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - - virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParticleBase*, bool recompute=false) const override; - virtual bool expectHitInInnermostPixelLayer(const Trk::Track*, bool recompute=false) const override; + virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParticleBase*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual bool getTrackStateOnBlayerInfo(const Trk::Track*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParameters* trackpar, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + + virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParticleBase*, + bool recompute = false) const override; + virtual bool expectHitInInnermostPixelLayer(const Trk::Track*, bool recompute = false) const override; virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParameters* trackpar) const override; - virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::Track* ) const override; - virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::TrackParticleBase*) const override; - - virtual bool getTrackStateOnInnermostPixelLayerInfo(const Trk::TrackParticleBase*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnInnermostPixelLayerInfo(const Trk::Track*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnInnermostPixelLayerInfo(const Trk::TrackParameters* trackpar, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::Track*) const override; + virtual const Trk::ResidualPull* innermostPixelLayerHitResidual( + const Trk::TrackParticleBase*) const override; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParticleBase*, bool recompute=false) const override; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::Track*, bool recompute=false) const override; + virtual bool getTrackStateOnInnermostPixelLayerInfo( + const Trk::TrackParticleBase*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + + virtual bool getTrackStateOnInnermostPixelLayerInfo( + const Trk::Track*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + + virtual bool getTrackStateOnInnermostPixelLayerInfo( + const Trk::TrackParameters* trackpar, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + + virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParticleBase*, + bool recompute = false) const override; + virtual bool expectHitInNextToInnermostPixelLayer(const Trk::Track*, + bool recompute = false) const override; virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParameters* trackpar) const override; - virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::Track* ) const override; - virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::TrackParticleBase*) const override; - - virtual bool getTrackStateOnNextToInnermostPixelLayerInfo(const Trk::TrackParticleBase*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnNextToInnermostPixelLayerInfo(const Trk::Track*, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool getTrackStateOnNextToInnermostPixelLayerInfo(const Trk::TrackParameters* trackpar, - std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::Track*) const override; + virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual( + const Trk::TrackParticleBase*) const override; + virtual bool getTrackStateOnNextToInnermostPixelLayerInfo( + const Trk::TrackParticleBase*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual bool getTrackStateOnNextToInnermostPixelLayerInfo( + const Trk::Track*, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; + virtual bool getTrackStateOnNextToInnermostPixelLayerInfo( + const Trk::TrackParameters* trackpar, + std::vector<TrackStateOnBLayerInfo>& infoList) const override; private: - bool expectHitInPixelLayer(const Trk::TrackParticleBase*, int layer, bool recompute=false) const; - bool expectHitInPixelLayer(const Trk::Track*, int layer, bool recompute=false) const; - bool expectHitInPixelLayer(const Trk::TrackParameters* trackpar,int layer) const; + bool expectHitInPixelLayer(const Trk::TrackParticleBase*, int layer, bool recompute = false) const; + bool expectHitInPixelLayer(const Trk::Track*, int layer, bool recompute = false) const; + bool expectHitInPixelLayer(const Trk::TrackParameters* trackpar, int layer) const; const Trk::ResidualPull* pixelLayerHitResidual(const Trk::Track*, int layer) const; + const Trk::ResidualPull* pixelLayerHitResidual(const Trk::TrackParticleBase*, int layer) const; - bool getTrackStateOnPixelLayerInfo(const Trk::TrackParticleBase*, std::vector<TrackStateOnBLayerInfo>& infoList, - int layer) const; - bool getTrackStateOnPixelLayerInfo(const Trk::Track*, + int layer) const; + bool getTrackStateOnPixelLayerInfo(const Trk::Track*, std::vector<TrackStateOnBLayerInfo>& infoList, - int layer) const; - bool getTrackStateOnPixelLayerInfo(const Trk::TrackParameters* trackpar, + int layer) const; + bool getTrackStateOnPixelLayerInfo(const Trk::TrackParameters* trackpar, std::vector<TrackStateOnBLayerInfo>& infoList, - int layer) const; + int layer) const; + bool isActive(const Trk::TrackParameters* trackpar) const; - bool isActive(const Trk::TrackParameters* trackpar) const ; bool getPixelLayerParameters(const Trk::TrackParameters* trackpar, - std::vector<std::unique_ptr<const Trk::TrackParameters> >& blayerParam, + std::vector<std::unique_ptr<const Trk::TrackParameters>>& blayerParam, int layer) const; - double getFracGood(const Trk::TrackParameters* trackpar, double phiRegionSize, double etaRegionSize) const; - /** Pointer to Extrapolator AlgTool*/ - ToolHandle< Trk::IExtrapolator > m_extrapolator; + double getFracGood(const Trk::TrackParameters* trackpar, + double phiRegionSize, + double etaRegionSize) const; - /** Handles to IConditionsSummaryServices for Pixels */ - ToolHandle <IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelSummaryTool", "PixelConditionsSummaryTool/InDetPixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + /** Handle to Extrapolator AlgTool*/ + ToolHandle<Trk::IExtrapolator> m_extrapolator{ + this, + "Extrapolator", + {}, + "Extrapolator used to extrapolate to layers" + }; - /** pointer to the residual pull calculator **/ - ToolHandle < Trk::IResidualPullCalculator > m_residualPullCalculator; + /** Handles to IConditionsSummaryServices for Pixels */ + ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{ + this, + "PixelSummaryTool", + "PixelConditionsSummaryTool/InDetPixelConditionsSummaryTool", + "Tool to retrieve Pixel Conditions summary" + }; + + /** Handle to the residual pull calculator **/ + ToolHandle<Trk::IResidualPullCalculator> m_residualPullCalculator{ + this, + "ResidualPullCalculator", + "Trk::ResidualPullCalculator/ResidualPullCalculator", + "Calculate Residuals" + }; /** detector helper*/ const AtlasDetectorID* m_idHelper; diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx index b8333a1e0178060e286ce85bdc2c62781f5a35fa..6eee5fffd426b013cc3023252d240e153b3cd2de 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx @@ -17,7 +17,6 @@ #include "TrkGeometry/Layer.h" -#include "TrkExInterfaces/IExtrapolator.h" #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" #include "AtlasDetDescr/AtlasDetectorID.h" @@ -47,15 +46,11 @@ namespace InDet { InDetTestBLayerTool::InDetTestBLayerTool(const std::string& name, const std::string& n, const IInterface* p): AthAlgTool(name, n,p), - m_extrapolator(""), - m_residualPullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"), m_idHelper(nullptr), m_pixelId(nullptr), m_configured(false) { declareInterface<IInDetTestBLayerTool>(this); - declareProperty("Extrapolator" , m_extrapolator); - declareProperty("ResidualPullCalculator",m_residualPullCalculator); declareProperty("CheckActiveAreas", m_checkActiveAreas = false); declareProperty("CheckDeadRegions", m_checkDeadRegions = false); declareProperty("CheckAtLeastNearestNeighbors", m_checkAtLeastNearestNeighbors = false); @@ -106,11 +101,11 @@ namespace InDet { m_configured=false; } else{ - if ( m_pixelCondSummaryTool.retrieve().isFailure() ) { - ATH_MSG_FATAL("Failed to retrieve tool " << m_pixelCondSummaryTool); - return StatusCode::FAILURE; + if (m_pixelCondSummaryTool.retrieve().isFailure() ) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_pixelCondSummaryTool); + return StatusCode::FAILURE; } else { - ATH_MSG_INFO("Retrieved tool " << m_pixelCondSummaryTool); + ATH_MSG_INFO("Retrieved tool " << m_pixelCondSummaryTool); } } diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h index 32e167c5771021801c0ffa2975d70c3531c7e61c..53b5ace5b53aa32781d7d3cb03c1beb12875bcd1 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -114,7 +114,6 @@ namespace InDet /** Handles to IConditionsSummaryTools for Pixels and SCT*/ ToolHandle <IInDetConditionsTool> m_sctCondSummaryTool{this, "SctSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT Conditions summary"}; - ToolHandle <IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelSummaryTool", "PixelConditionsSummaryTool/InDetPixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; ToolHandle< IInDetTestPixelLayerTool > m_pixelLayerTool; diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx index fa4595eed1056b1c9b1cca293471f846a178d6fd..c559257aed067e6b25b361b785fee0afdcecfeae 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx @@ -76,9 +76,6 @@ StatusCode InDet::InDetTrackHoleSearchTool::initialize() { ATH_MSG_INFO("Retrieved tool " << m_extrapolator); if (m_usepix) { - // Get PixelConditionsSummaryTool - ATH_CHECK(m_pixelCondSummaryTool.retrieve()); - ATH_MSG_INFO("Retrieved tool " << m_pixelCondSummaryTool); // Get InDetPixelLayerTool from ToolService ATH_CHECK(m_pixelLayerTool.retrieve()); ATH_MSG_INFO("Retrieved tool " << m_pixelLayerTool); @@ -805,7 +802,6 @@ bool InDet::InDetTrackHoleSearchTool::isSensitive(const Trk::TrackParameters* pa if (m_atlasId->is_pixel(id)) { if (m_usepix) { ATH_MSG_VERBOSE("Found element is a Pixel module without a hit, see if it might be dead"); - isgood=m_pixelCondSummaryTool->isGood(idHash); isgood=m_pixelLayerTool->expectHit(parameters); if (isgood) { // this detElement is only cosidered as hole if the extrapolation of diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt index 1152422aa3a92ab34cc2c2c9b17916908f762449..e67789668db9308fca41341294e738d1bbc6e07e 100644 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/CMakeLists.txt @@ -19,13 +19,15 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetRecTools/InDetRecToolInterfaces - MagneticField/MagFieldInterfaces Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkPseudoMeasurementOnTrack Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary Tracking/TrkExtrapolation/TrkExInterfaces - Tracking/TrkEvent/TrkCaloClusterROI ) + Tracking/TrkEvent/TrkCaloClusterROI + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) @@ -41,7 +43,7 @@ atlas_add_component( InDetTrackScoringTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel TrkEventPrimitives TrkToolInterfaces GeoPrimitives InDetIdentifier InDetRIO_OnTrack InDetRecToolInterfaces MagFieldInterfaces TrkParameters TrkPseudoMeasurementOnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkCaloClusterROI) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel TrkEventPrimitives TrkToolInterfaces GeoPrimitives InDetIdentifier InDetRIO_OnTrack InDetRecToolInterfaces TrkParameters TrkPseudoMeasurementOnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkCaloClusterROI MagFieldElements MagFieldConditions) # Install files from the package: atlas_install_headers( InDetTrackScoringTools ) diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h index a6bbacd6374b1ad738f8ae88ab7d6306e8bd7a3f..3534b80f36fc19550a37c76b71c02629a3c03039 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetAmbiScoringTool.h @@ -20,6 +20,9 @@ #include "TrkParameters/TrackParameters.h" #include "AthenaKernel/CLASS_DEF.h" #include "AthenaKernel/IOVSvcDefs.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" #include <vector> #include <string> #include "BeamSpotConditionsData/BeamSpotData.h" @@ -32,10 +35,6 @@ namespace Trk { } -namespace MagField { - class IMagFieldSvc; -} - namespace InDet { class ITrtDriftCircleCutTool; @@ -85,7 +84,9 @@ class InDetAmbiScoringTool : virtual public Trk::ITrackScoringTool, SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle<Trk::IExtrapolator> m_extrapolator; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; /** use the scoring tuned to Ambiguity processing or not */ diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h index 40a0c6b8624fb8a882e82e6d13d7386e4ed95aac..3656ca2f99adfa76826004815ffc3456dce800b6 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/InDetTrackScoringTools/InDetTrtTrackScoringTool.h @@ -12,6 +12,9 @@ #include "TrkEventPrimitives/TrackScore.h" #include "TrkToolInterfaces/ITrackScoringTool.h" #include "TrkToolInterfaces/ITrackSummaryTool.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" #include <vector> #include <string> @@ -20,9 +23,6 @@ namespace Trk { class TrackSummary; } -namespace MagField { - class IMagFieldSvc; -} class TRT_ID ; @@ -77,9 +77,9 @@ private: ToolHandle<Trk::ITrackSummaryTool> m_trkSummaryTool; /** Returns minimum number of expected TRT drift circles depending on eta. */ ToolHandle<ITrtDriftCircleCutTool> m_selectortool; - /** to query magnetic field configuration */ - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; /** cuts for selecting good tracks*/ int m_minTRTonTrk; //!< minimum number of TRT hits diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx index 2c6058585271310ff07ffc833c88970a059c07d4..2ae8ce75a52f876e8a3655c1e6a7cd88b3a214f2 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetAmbiScoringTool.cxx @@ -16,7 +16,6 @@ #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "TMath.h" #include <vector> -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "GeoPrimitives/GeoPrimitives.h" #include "TrkCaloClusterROI/CaloClusterROI.h" #include "TrkCaloClusterROI/CaloClusterROI_Collection.h" @@ -46,8 +45,7 @@ InDet::InDetAmbiScoringTool::InDetAmbiScoringTool(const std::string& t, m_trkSummaryTool("Trk::TrackSummaryTool", this), m_selectortool("InDet::InDetTrtDriftCircleCutTool", this), m_summaryTypeScore(Trk::numberOfTrackSummaryTypes), - m_extrapolator("Trk::Extrapolator", this), - m_magFieldSvc("AtlasFieldSvc",n) + m_extrapolator("Trk::Extrapolator", this) { declareInterface<Trk::ITrackScoringTool>(this); @@ -82,7 +80,6 @@ InDet::InDetAmbiScoringTool::InDetAmbiScoringTool(const std::string& t, declareProperty("Extrapolator", m_extrapolator); declareProperty("SummaryTool" , m_trkSummaryTool); declareProperty("DriftCircleCutTool",m_selectortool ); - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("maxRPhiImpEM", m_maxRPhiImpEM = 50. ); declareProperty("doEmCaloSeed", m_useEmClusSeed = true ); @@ -154,20 +151,13 @@ StatusCode InDet::InDetAmbiScoringTool::initialize() ATH_CHECK(m_beamSpotKey.initialize()); - sc = m_magFieldSvc.retrieve(); - if (sc.isFailure()){ - msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endmsg; - return StatusCode::FAILURE; - } - else { - msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endmsg; - } - if (m_useAmbigFcn && m_useTRT_AmbigFcn) { msg(MSG::FATAL) << "Both on, normal ambi funciton and the one for back tracking, configuration problem, not recoverable" << endmsg; return StatusCode::FAILURE; } + // Read handle for AtlasFieldCacheCondObj + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if (m_useAmbigFcn || m_useTRT_AmbigFcn) setupScoreModifiers(); @@ -310,7 +300,17 @@ Trk::TrackScore InDet::InDetAmbiScoringTool::simpleScore( const Trk::Track& trac const Trk::TrackParameters* input = track.trackParameters()->front(); // cuts on parameters - if (m_magFieldSvc->solenoidOn()) { + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("simpleScore: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return Trk::TrackScore(0); + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){ if (fabs(input->pT()) < m_minPt) { ATH_MSG_DEBUG ("Track pt < "<<m_minPt<<", reject it"); return Trk::TrackScore(0); diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx index 32efae3af46e82f23417106b1465812ed70c0853..7418d8c3df470cafceacd71b2aa30465965a1541 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx @@ -14,7 +14,6 @@ #include "InDetIdentifier/TRT_ID.h" #include "TMath.h" #include <vector> -#include "MagFieldInterfaces/IMagFieldSvc.h" //--------------------------------------------------------------------------------------------------------------------- @@ -31,8 +30,7 @@ InDet::InDetTrtTrackScoringTool::InDetTrtTrackScoringTool(const std::string& t, m_maxTrtFittedRatio(-1), m_summaryTypeScore(Trk::numberOfTrackSummaryTypes), m_trkSummaryTool("Trk::TrackSummaryTool"), - m_selectortool("InDet::InDetTrtDriftCircleCutTool"), - m_magFieldSvc("AtlasFieldSvc",n) + m_selectortool("InDet::InDetTrtDriftCircleCutTool") { declareInterface<Trk::ITrackScoringTool>(this); @@ -50,7 +48,6 @@ InDet::InDetTrtTrackScoringTool::InDetTrtTrackScoringTool(const std::string& t, declareProperty("UseParameterization", m_parameterization = true); declareProperty("OldTransitionLogic" , m_oldLogic = false); declareProperty("minTRTPrecisionFraction", m_minTRTprecision = 0.5); - declareProperty("MagFieldSvc", m_magFieldSvc); m_summaryTypeScore[Trk::numberOfTRTHits] = 1; // 10 straws ~ 1 SCT m_summaryTypeScore[Trk::numberOfTRTHighThresholdHits] = 0; // addition for being TR @@ -87,15 +84,6 @@ StatusCode InDet::InDetTrtTrackScoringTool::initialize() msg(MSG::DEBUG) << "Retrieved tool " << m_selectortool << endmsg; } - sc = m_magFieldSvc.retrieve(); - if (sc.isFailure()){ - msg(MSG::FATAL) << "Failed to retrieve " << m_magFieldSvc << endmsg; - return StatusCode::FAILURE; - } - else { - msg(MSG::DEBUG) << "Retrieved " << m_magFieldSvc << endmsg; - } - sc = detStore()->retrieve(m_trtId, "TRT_ID"); if (sc.isFailure()){ msg(MSG::FATAL) << "Could not get TRT_ID helper !" << endmsg; @@ -104,6 +92,9 @@ StatusCode InDet::InDetTrtTrackScoringTool::initialize() if(m_useAmbigFcn) setupTRT_ScoreModifiers(); + // Read handle for AtlasFieldCacheCondObj + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); + return StatusCode::SUCCESS; } @@ -163,7 +154,18 @@ Trk::TrackScore InDet::InDetTrtTrackScoringTool::simpleScore( const Trk::Track& const Trk::TrackParameters* input = track.trackParameters()->front(); ///Reject track below the pT cut - if (m_magFieldSvc->solenoidOn()) { + + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("simpleScore: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return Trk::TrackScore(0); + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){//B field if(input->pT() < m_ptmin) { ATH_MSG_DEBUG( "Reject track below Pt cut !"); return Trk::TrackScore(0); diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/CMakeLists.txt index 021f0d86ab735bd25ee8386a8b448d695f1fcd9b..dd495026f16bfeec52fc47bc6db9d84924426714 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/CMakeLists.txt @@ -93,7 +93,7 @@ if( XAOD_STANDALONE ) SOURCES test/ut_InDetTrackSelectionTool.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess - InDetTrackSelectionToolLib ) + InDetTrackSelectionToolLib PROPERTIES TIMEOUT 600 ) endif() # Install files from the package: diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackCut.h b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackCut.h index e2acaa454250694394e13c4beec129ecd9b43eb7..3686b2fb8cdf179340e556a9cac33b520659f443 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackCut.h +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackCut.h @@ -11,7 +11,6 @@ #define INDETTRACKSELECTIONTOOL_INDETTRACKCUT_H #include "InDetTrackAccessor.h" -#include "AthenaBaseComps/AthCheckMacros.h" #include <map> #include <array> diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx index 0dc952cd00750907fed7e5f8f4ca7120f2682333..eed21a37bfd4e12e233dd2c178b2b078f01a97eb 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx @@ -140,17 +140,16 @@ int main( int argc, char* argv[] ) { for (const auto track : *tracks) { for (const auto& cutLevelPair : cutFuncs) { const auto& cutLevel = cutLevelPair.first; - if ( selTools[cutLevel]->accept( *track, primaryVertex ) - != cutFuncs[cutLevel]( *track, primaryVertex ) ) { + asg::AcceptData taccept = selTools[cutLevel]->accept( *track, primaryVertex ); + if ( bool (taccept) != cutFuncs[cutLevel]( *track, primaryVertex ) ) { Error( APP_NAME, "Track selection tool at %s cut level does not", cutLevel.data() ); Error( APP_NAME, " match hard-coded test function." ); - const auto& taccept = selTools[cutLevel]->getTAccept(); if (taccept) Error( APP_NAME, "Passes tool but not function" ); else Error( APP_NAME, "Passes function but not tool" ); for (size_t i_cut=0; i_cut < taccept.getNCuts(); ++i_cut) { const auto& cutName = taccept.getCutName(i_cut); - Info( APP_NAME, "Result of %s = %i", cutName.Data(), taccept.getCutResult(i_cut) ); + Info( APP_NAME, "Result of %s = %i", cutName.c_str(), taccept.getCutResult(i_cut) ); } dumpTrack( *track ); // output track info diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/CMakeLists.txt index 1545b9f81fd310564a22411497e995c45a6069ce..10381ef7f69c3dca629ccb54065b8e320d9ed17b 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/CMakeLists.txt @@ -21,14 +21,15 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives InnerDetector/InDetConditions/TRT_ConditionsServices InnerDetector/InDetRecEvent/InDetRIO_OnTrack - MagneticField/MagFieldInterfaces Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/TrkRIO_OnTrack Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary Tracking/TrkEvent/VxVertex - Tracking/TrkExtrapolation/TrkExInterfaces ) + Tracking/TrkExtrapolation/TrkExInterfaces + MagneticField/MagFieldElements + MagneticField/MagFieldConditions ) # External dependencies: find_package( CLHEP ) @@ -40,7 +41,7 @@ atlas_add_component( InDetTrackSelectorTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces AthContainers GeoPrimitives EventPrimitives TRT_ConditionsServicesLib InDetRIO_OnTrack MagFieldInterfaces TrkSurfaces TrkParticleBase TrkRIO_OnTrack TrkTrack TrkTrackSummary VxVertex TrkExInterfaces ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces AthContainers GeoPrimitives EventPrimitives TRT_ConditionsServicesLib InDetRIO_OnTrack TrkSurfaces TrkParticleBase TrkRIO_OnTrack TrkTrack TrkTrackSummary VxVertex TrkExInterfaces MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( InDetTrackSelectorTool ) diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetCosmicTrackSelectorTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetCosmicTrackSelectorTool.h index 33b7281ebe3bd81b621d8ce3273351991cea2643..cca93adf1f110f164b432826d8d8cdb29de05fae 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetCosmicTrackSelectorTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetCosmicTrackSelectorTool.h @@ -11,19 +11,18 @@ #include "TrkToolInterfaces/ITrackSelectorTool.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkParameters/TrackParameters.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" namespace Trk { - class IMagneticFieldTool; class ITrackSummaryTool; class Vertex; class TrackParticleBase; class Track; } -namespace MagField { - class IMagFieldSvc; -} namespace InDet { @@ -67,8 +66,8 @@ namespace InDet ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool; bool m_trackSumToolAvailable; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; }; //end of class definitions diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetDetailedTrackSelectorTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetDetailedTrackSelectorTool.h index f2843391c792a9e000c4fa0e360ef8a006558ce3..1d6522b977a43c0d9a7b6fd120cbb3ac40449c38 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetDetailedTrackSelectorTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/InDetTrackSelectorTool/InDetDetailedTrackSelectorTool.h @@ -13,6 +13,9 @@ #include "xAODTracking/TrackParticle.h" #include "xAODTracking/VertexFwd.h" #include "BeamSpotConditionsData/BeamSpotData.h" +// MagField cache +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" /** * @file InDetDetailedTrackSelectorTool.h @@ -30,13 +33,9 @@ */ -namespace MagField { - class IMagFieldSvc; -} namespace Trk { - class IMagneticFieldTool; class ITrackSummaryTool; class IExtrapolator; class Vertex; @@ -153,10 +152,11 @@ namespace InDet ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool; //!< Track summary tool ToolHandle<Trk::IExtrapolator> m_extrapolator; //!< Extrapolator tool SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; ToolHandle<ITrtDriftCircleCutTool> m_trtDCTool; //!< Tool to get eta dependent cut on number of TRT hits ToolHandle< InDet::IInDetTestBLayerTool > m_inDetTestBLayerTool; //Tool to test if the track crosses a dead module on the b-layer + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; bool m_trackSumToolAvailable; diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetCosmicTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetCosmicTrackSelectorTool.cxx index 49c81b0b2566cad15784256e213cd0f2d9564257..4bc59141999383fdb055c0ba5693c7aa2cc4504e 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetCosmicTrackSelectorTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetCosmicTrackSelectorTool.cxx @@ -6,7 +6,6 @@ // forward declares #include "TrkToolInterfaces/ITrackSummaryTool.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "VxVertex/Vertex.h" #include "TrkTrack/Track.h" #include "TrkParticleBase/TrackParticleBase.h" @@ -24,8 +23,7 @@ namespace InDet //---------------------------------------------------------------------------- InDetCosmicTrackSelectorTool::InDetCosmicTrackSelectorTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_trackSumToolAvailable(false), - m_magFieldSvc("AtlasFieldSvc",n) + m_trackSumToolAvailable(false) { declareInterface<ITrackSelectorTool>(this); declareProperty("maxZ0", m_maxZ0 = 150.); @@ -38,7 +36,6 @@ namespace InDet declareProperty("numberOfSiliconHitsTop", m_numberOfSiHitsTop = -1); declareProperty("numberOfSiliconHitsBottom", m_numberOfSiHitsBottom = -1); declareProperty("TrackSummaryTool", m_trackSumTool); - declareProperty("MagFieldSvc", m_magFieldSvc); } //---------------------------------------------------------------------------- @@ -64,11 +61,8 @@ namespace InDet m_trackSumToolAvailable = true; } - if (m_magFieldSvc.retrieve().isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_magFieldSvc << endmsg; - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved tool "<<m_magFieldSvc); + // Read handle for AtlasFieldCacheCondObj + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); return StatusCode::SUCCESS; } @@ -236,7 +230,17 @@ namespace InDet } // only check pt if mag. field is on - if (m_magFieldSvc->solenoidOn()) { + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return false; + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){//B field if (trackParameters[Trk::qOverP] == 0.) { ATH_MSG_DEBUG("Track rejected because of qOverP == 0."); return false; diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx index 20e1028bac3417eb54634c20b1877b6149ecd462..aa9374e1e9d1ef36754a95c7af4fafee30a11802 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx @@ -12,7 +12,6 @@ #include "TrkTrack/Track.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkParticleBase/TrackParticleBase.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "InDetRecToolInterfaces/ITrtDriftCircleCutTool.h" #include "InDetRecToolInterfaces/IInDetTestBLayerTool.h" @@ -39,7 +38,6 @@ namespace InDet : AthAlgTool(t,n,p) , m_trackSumTool("Trk::TrackSummaryTool", this) , m_extrapolator("Trk::Extrapolator", this) - , m_magFieldSvc("AtlasFieldSvc",n) , m_trtDCTool("InDet::InDetTrtDriftCircleCutTool", this) , m_inDetTestBLayerTool("", this) , m_trackSumToolAvailable(true) @@ -107,7 +105,6 @@ namespace InDet declareProperty("TrackSummaryTool" , m_trackSumTool); declareProperty("Extrapolator" , m_extrapolator); - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("TrtDCCutTool" , m_trtDCTool); declareProperty("InDetTestBLayerTool", m_inDetTestBLayerTool); @@ -153,12 +150,10 @@ namespace InDet }else{ m_trtDCTool.disable(); } - ATH_CHECK(m_magFieldSvc.retrieve()); - if(m_inDetTestBLayerTool.empty()){ - ATH_MSG_INFO(" The BLayerTool not specified, turning off cut. "); - } else { - ATH_CHECK( m_inDetTestBLayerTool.retrieve()); - } + + // Read handle for AtlasFieldCacheCondObj + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); + ATH_MSG_INFO("Using cuts on the number of Silicon hits"); if(m_usePtDependentCuts) { //checking whether sizes of cuts and pt interval expressed in vectors match @@ -688,7 +683,18 @@ namespace InDet const AmgVector(5)& perigeeParms = track->parameters(); - if (m_magFieldSvc->solenoidOn()) { + // only check pt if mag. field is on + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return false; + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){//B field if (perigeeParms[Trk::qOverP] == 0.) { ATH_MSG_DEBUG("Track rejected because of qOverP == 0."); return false; @@ -1072,7 +1078,18 @@ namespace InDet { const AmgVector(5)& perigeeParms = myPerigee.parameters(); - if (m_magFieldSvc->solenoidOn()) { + // only check pt if mag. field is on + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return false; + } + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.solenoidOn()){//B field if (perigeeParms[Trk::qOverP] == 0.) { ATH_MSG_DEBUG("Track rejected because of perigee qOverP == 0."); return false; diff --git a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h index 8f04b9082c2f5fbf7fbfa87c43e6e065eccee2f2..1b200392d0f81bf8c8542ed07c984e7c25f17771 100755 --- a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h @@ -126,13 +126,30 @@ namespace InDet { /**ID TRT helper*/ const TRT_ID* m_trtId{nullptr}; - /**Association tool - used to work out which (if any) PRDs are shared between - tracks*/ - PublicToolHandle<Trk::IPRD_AssociationTool> m_assoTool{this, "AssoTool", "InDet::InDetPRD_AssociationToolGangedPixels"}; - PublicToolHandle<Trk::IPixelToTPIDTool> m_pixeldedxtool{this, "PixelToTPIDTool", ""}; - PublicToolHandle<Trk::ITrackHoleSearchTool> m_holeSearchTool{this, "HoleSearch", "InDet::InDetTrackHoleSearchTool"}; - PublicToolHandle<InDet::IInDetTestBLayerTool> m_testBLayerTool{this, "TestBLayerTool", ""}; - ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool{this, "TRTStrawSummarySvc", "TRT_StrawStatusSummaryTool", "The ConditionsSummaryTool"}; + /**Association tool - used to work out which (if any) + * PRDs are shared between tracks*/ + PublicToolHandle<Trk::IPRD_AssociationTool> m_assoTool{ + this, + "AssoTool", + "InDet::InDetPRD_AssociationToolGangedPixels" + }; + PublicToolHandle<Trk::ITrackHoleSearchTool> m_holeSearchTool{ + this, + "HoleSearch", + "InDet::InDetTrackHoleSearchTool" + }; + ToolHandle<Trk::IPixelToTPIDTool> m_pixeldedxtool{ this, + "PixelToTPIDTool", + "" }; + ToolHandle<InDet::IInDetTestBLayerTool> m_testBLayerTool{ this, + "TestBLayerTool", + "" }; + ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool{ + this, + "TRTStrawSummarySvc", + "TRT_StrawStatusSummaryTool", + "The ConditionsSummaryTool" + }; BooleanProperty m_usePixel{this, "usePixel", true}; BooleanProperty m_useSCT{this, "useSCT", true}; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref index 1a1168732ccb2551d5cc58581f578293dd904bcb..77006b3a3a7ec824743897b411fae62eee7b84cf 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref @@ -1,12 +1,10 @@ InDetVKalVxInJetTool/InDetTrkInJetType_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +Initializing Gaudi ApplicationMgr using job opts /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +JobOptionsSvc INFO # =======> /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc += ["StoreGateSvc/ConditionStore", "CondSvc"] +JobOptionsSvc INFO Job options successfully read in from /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/SCT_ClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/SCT_ClusterOnTrackTool.cxx index 6eb0e9f90c0757e2852a77dfc08b494be9c2e635..d42aadacee2fa14056a309179357c4959190725f 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/SCT_ClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/SCT_ClusterOnTrackTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -173,6 +173,10 @@ InDet::SCT_ClusterOnTrackTool::correct // Local position and error matrix production // // let's start to re-compute cluster error if errorStrategy >=0 + // These were derived by the studies reported on 25th September 2006 + // https://indico.cern.ch/event/430391/contributions/1066157/attachments/929942/1317007/SCTSoft_25Sept06_clusters.pdf + // and on 4th February 2008 + // https://indico.cern.ch/event/22934/contributions/485813/attachments/379647/528096/ClusterErrors_04Feb08.pdf if (m_option_errorStrategy > -1) { Amg::MatrixX mat(2, 2); mat.setZero(); @@ -286,7 +290,7 @@ InDet::SCT_ClusterOnTrackTool::getCorrection(double phi, int nstrip) const { }; // Phi bins have 1 degree width, and cover 0-30 degrees - int phiBin = int(std::fabs(phi) / deg); + int phiBin = static_cast<int>(std::abs(phi) / deg); float correction(0.); @@ -350,7 +354,7 @@ InDet::SCT_ClusterOnTrackTool::getError(double phi, int nstrip) const { }; // Phi bins have 1 degree width, and cover 0-60 degrees - int phiBin = int(std::fabs(phi) / deg); + int phiBin = static_cast<int>(std::abs(phi) / deg); float sigma(0.); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h index 1e7d85354ed4e09c7a4a4585fa9292a24c236b2f..987803f0aa251a04aa50af2a2c407df6b098f0e5 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h @@ -184,6 +184,7 @@ namespace InDet { ToolHandle<InDet::IPixelClusterSplitter> m_clusterSplitter{this, "ClusterSplitter", "", "ToolHandle for the split probability tool"}; BooleanProperty m_doIBLSplitting{this, "DoIBLSplitting", false}; BooleanProperty m_doFastClustering{this, "DoFastClustering", false}; + BooleanProperty m_checkDuplicatedRDO{this, "CheckDuplicatedRDO", false, "Check duplicated RDOs using isDuplicated method"}; SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index b1f17b0ddccf112ba681b811a4af5adb09e14a94..9df4750836aa9e60a2c9d0d6f4e4cbe9cb48af3e 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //*************************************************************************** @@ -462,6 +462,8 @@ PixelCluster* ClusterMakerTool::pixelCluster( // - the error strategy, currently // 0: Cluster Width/sqrt(12.) // 1: Set to a different values for one and two-strip clusters (def.) + // The scale factors were derived by the study reported on 25th September 2006. + // https://indico.cern.ch/event/430391/contributions/1066157/attachments/929942/1317007/SCTSoft_25Sept06_clusters.pdf SCT_Cluster* ClusterMakerTool::sctCluster( const Identifier& clusterID, diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx index b6922211bc134b4c4227a98d92d55f96bb2289bd..157a9c2681696bdc9311e2cba78284ba821d8f18 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx @@ -177,7 +177,8 @@ namespace InDet { // Instead the method isDuplicated check wether the new // one has a larger LVL1 - if so it does replace the old // lvl1 with the new one. - if(!isDuplicated(**firstGroup, **lvl1Group, rdoID, lvl1, pixelID)) { + if(!m_checkDuplicatedRDO || + (m_checkDuplicatedRDO && !isDuplicated(**firstGroup, **lvl1Group, rdoID, lvl1, pixelID))) { (*firstGroup)->push_back(rdoID); (*totGroup)->push_back(tot); (*lvl1Group)->push_back(lvl1); @@ -228,7 +229,8 @@ namespace InDet { // one has a larger LVL1 - if so it does replace the old // lvl1 with the new one. - if(!isDuplicated(**firstGroup, **lvl1Group, gangedID, lvl1, pixelID)) { + if(!m_checkDuplicatedRDO || + (m_checkDuplicatedRDO && !isDuplicated(**firstGroup, **lvl1Group, gangedID, lvl1, pixelID))) { (*firstGroup)->push_back(gangedID); (*totGroup)->push_back(tot); (*lvl1Group)->push_back(lvl1); @@ -669,7 +671,7 @@ namespace InDet { if (m_usePixelMap and !(m_summaryTool->isGood(idHash,rdoID))) continue; const int lvl1= rdo->getLVL1A(); - if (checkDuplication(pixelID, rdoID, lvl1, collectionID)) continue; + if (m_checkDuplicatedRDO and checkDuplication(pixelID, rdoID, lvl1, collectionID)) continue; const int tot = rdo->getToT(); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/SCT_ClusteringTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/SCT_ClusteringTool.cxx index df50d0c6111aad20a27cef3ebf0279bf40ce6862..dd536f804be705cb517f4416d092c223d6d06a8f 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/SCT_ClusteringTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/SCT_ClusteringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -30,6 +30,7 @@ #include "GeoPrimitives/GeoPrimitives.h" #include <algorithm> +#include <cmath> namespace InDet { @@ -463,7 +464,7 @@ namespace InDet { // // Find length of strip at centre const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends(design->endsOfStrip(clusterDim.centre)); - const double stripLength(fabs(ends.first.xEta()-ends.second.xEta())); + const double stripLength(std::abs(ends.first.xEta()-ends.second.xEta())); // // Now make a SiCluster clusterNumber++; @@ -687,7 +688,7 @@ namespace InDet { // Find length of strip at centre // std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends(design->endsOfStrip(centre)); - stripL = fabs(ends.first.xEta()-ends.second.xEta()); + stripL = std::abs(ends.first.xEta()-ends.second.xEta()); double w = element->phiPitch(localPos)*iphipitch; double sn = element->sinStereoLocal(localPos); diff --git a/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx b/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx index c4fbbd58ba8195795f01a354ed41e9d269d3eeda..f9d6a701cfd1eb37a5a5b5c271e057f8126c5e71 100644 --- a/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx +++ b/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx @@ -78,6 +78,8 @@ StatusCode InDet::SiCombinatorialTrackFinder_xk::initialize ATLAS_NOT_THREAD_SAF } else { ATH_MSG_INFO("Retrieved tool " << m_pixelCondSummaryTool); } + } else { + m_pixelCondSummaryTool.disable(); } // Get SctConditionsSummaryTool diff --git a/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx index 7a47ddd31feaf7621d74c13464539b258613344a..552fea4dbae7dc935861d5cbfe2af5c760f51206 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx @@ -39,7 +39,7 @@ namespace InDet { StatusCode SiSpacePointMakerTool::initialize() { // Get the SCT Helper ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID")); - m_SCTgapParameter = std::fabs(m_SCTgapParameter); + m_SCTgapParameter = std::abs(m_SCTgapParameter); if (m_SCTgapParameter > 0.002) m_SCTgapParameter = 0.002; return StatusCode::SUCCESS; } @@ -141,19 +141,19 @@ namespace InDet { // point up to around z = +- 20 cm - if (std::fabs( m ) > limit) ok = false; - else if (std::fabs((n=-(midpoint2x2.dot(qs)/strip2Direction.dot(qs)))) > limit) ok = false; + if (std::abs( m ) > limit) ok = false; + else if (std::abs((n=-(midpoint2x2.dot(qs)/strip2Direction.dot(qs)))) > limit) ok = false; if ((not ok) and (stripLengthGapTolerance != 0.)) { const double qm = strip1Direction.mag() ; const double limitn = limit+(stripLengthGapTolerance/qm); - if (std::fabs(m) <= limitn) { + if (std::abs(m) <= limitn) { if (n==0.) n = -(midpoint2x2.dot(qs)/strip2Direction.dot(qs)); - if (std::fabs(n) <= limitn) { + if (std::abs(n) <= limitn) { double mn = strip1Direction.dot(strip2Direction)/(qm*qm); if ((m > 1.) or (n > 1.)) { double dm = (m-1.) ; @@ -170,7 +170,7 @@ namespace InDet { m += sm; n += (sm*mn); } - if (std::fabs(m) < limit and std::fabs(n) < limit) ok = true; + if (std::abs(m) < limit and std::abs(n) < limit) ok = true; } } } @@ -446,10 +446,10 @@ namespace InDet { double r = std::sqrt(T1(0,3)*T1(0,3)+T1(1,3)*T1(1,3)) ; double s = (T1(0,3)-T2(0,3))*T1(0,2)+(T1(1,3)-T2(1,3))*T1(1,2)+(T1(2,3)-T2(2,3))*T1(2,2); - double dm = (m_SCTgapParameter*r)*std::fabs(s*x12); + double dm = (m_SCTgapParameter*r)*std::abs(s*x12); double d = dm/std::sqrt((1.-x12)*(1.+x12)); - if (std::fabs(T1(2,2)) > 0.7) d*=(r/std::fabs(T1(2,3))); // endcap d = d*R/Z + if (std::abs(T1(2,2)) > 0.7) d*=(r/std::abs(T1(2,3))); // endcap d = d*R/Z stripLengthGapTolerance = d; @@ -709,13 +709,13 @@ namespace InDet { double b = In0.strip_direction().dot(In1.normal()); double l0 = In0.oneOverStrip()*slimit+limit ; - if(std::fabs(a) > (std::fabs(b)*l0)) return nullptr; + if(std::abs(a) > (std::abs(b)*l0)) return nullptr; double c =-In1.traj_direction().dot(In0.normal()); double d = In1.strip_direction().dot(In0.normal()); double l1 = In1.oneOverStrip()*slimit+limit ; - if(std::fabs(c) > (std::fabs(d)*l1)) return nullptr; + if(std::abs(c) > (std::abs(d)*l1)) return nullptr; double m = a/b; @@ -730,7 +730,7 @@ namespace InDet { double dmn = (n-1.)*cs; if(dmn > dm) dm = dmn; m-=dm; n-=(dm/cs); - if(std::fabs(m) > limit || std::fabs(n) > limit) return nullptr; + if(std::abs(m) > limit || std::abs(n) > limit) return nullptr; } else if(m < -limit || n < -limit) { double cs = In0.strip_direction().dot(In1.strip_direction())*(In0.oneOverStrip()*In0.oneOverStrip()); @@ -738,7 +738,7 @@ namespace InDet { double dmn = -(1.+n)*cs; if(dmn > dm) dm = dmn; m+=dm; n+=(dm/cs); - if(std::fabs(m) > limit || std::fabs(n) > limit) return nullptr; + if(std::abs(m) > limit || std::abs(n) > limit) return nullptr; } } Amg::Vector3D point(In0.position(m)); diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx index 4633fcab2437544244da77042256e59569b8cd82..70aea30a74f19b8bb675501a19f5bd7d8585d966 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx @@ -1330,7 +1330,8 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp if (dR < m_drmin || (data.iteration && (*r)->spacepoint->clusterList().second)) break; const float Tz = (Z-(*r)->z())/dR; - if (Tz < dzdrmin or Tz > dzdrmax) continue; + const float aTz = std::abs(Tz); + if (aTz < dzdrmin or aTz > dzdrmax) continue; // Comparison with vertices Z coordinates // @@ -1362,7 +1363,8 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp float Tz = ((*r)->z()-Z)/dR; - if (Tz < dzdrmin or Tz > dzdrmax) continue; + float aTz = std::abs(Tz); + if (aTz < dzdrmin or aTz > dzdrmax) continue; // Comparison with vertices Z coordinates // diff --git a/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/src/TRT_DetElementsRoadMaker_xk.cxx b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/src/TRT_DetElementsRoadMaker_xk.cxx index 2ae0916db5cb3893dd5c6e4a499dfda724d03391..5e2a20811d9612dd91ddc5bafeac883f36f76e2b 100755 --- a/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/src/TRT_DetElementsRoadMaker_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/src/TRT_DetElementsRoadMaker_xk.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -84,7 +84,6 @@ StatusCode InDet::TRT_DetElementsRoadMaker_xk::initialize() ATH_CHECK(m_roadDataKey.initialize()); ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); - ATH_MSG_INFO("initialize() init key: " << m_fieldCacheCondObjInputKey.key()); return sc; } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h index dad3c13029b90c9e16b5ec38f7b0e61ff27a719a..0456cd962d445f63b35cfcb859ab9a702a609958 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -122,11 +122,27 @@ namespace InDet unsigned int m_minTRThits; // Minimum number of TRT hits to give PID. bool m_OccupancyUsedInPID; // DEPRECATED!!! - ToolHandle<ITRT_ToT_dEdx> m_TRTdEdxTool; //!< the track selector tool - ToolHandle<InDet::ITRT_LocalOccupancy> m_LocalOccTool; //!< the track selector tool - ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool; - SG::ReadCondHandleKey<HTcalculator> m_HTReadKey{this,"HTcalculator","HTcalculator","HTcalculator in-key"}; - + ToolHandle<ITRT_ToT_dEdx> m_TRTdEdxTool{ this, + "TRT_ToT_dEdx_Tool", + {}, + "TRT ToT dEdx Tool"}; + ToolHandle<InDet::ITRT_LocalOccupancy> m_LocalOccTool{ + this, + "TRT_LocalOccupancyTool", + {}, + "TRT Local occupancy tool" + }; + ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool{ + this, + "TRTStrawSummaryTool", + "InDetTRTStrawStatusSummaryTool", + "TRT straw summary tool" + }; + + SG::ReadCondHandleKey<HTcalculator> m_HTReadKey{ this, + "HTcalculator", + "HTcalculator", + "HTcalculator in-key" }; }; } // end of namespace diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx index daa8d68c94babebe82cc9be0980746c6f6711404..8cb8f9dfe5f585532d7a4e7fbafe7756cfbf6e07 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx @@ -1,6 +1,5 @@ - /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -61,18 +60,12 @@ InDet::TRT_ElectronPidToolRun2::TRT_ElectronPidToolRun2(const std::string& t, co AthAlgTool(t,n,p), m_trtId(nullptr), m_TRTdetMgr(nullptr), - m_minTRThits(5), - m_TRTdEdxTool(), - m_LocalOccTool(), - m_TRTStrawSummaryTool("InDetTRTStrawStatusSummaryTool",this) + m_minTRThits(5) { declareInterface<ITRT_ElectronPidTool>(this); declareInterface<ITRT_ElectronToTTool>(this); declareProperty("MinimumTRThitsForIDpid", m_minTRThits); - declareProperty("TRT_ToT_dEdx_Tool", m_TRTdEdxTool); - declareProperty("TRT_LocalOccupancyTool", m_LocalOccTool); declareProperty("isData", m_DATA = true); - declareProperty("TRTStrawSummaryTool", m_TRTStrawSummaryTool); declareProperty("OccupancyUsedInPID", m_OccupancyUsedInPID=true); } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.cxx index 3da3e2d41d60923316d2a840b9402cb7f9c7b950..069992600700a62173992128fb00f0f182fca67b 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ToT_dEdx.cxx @@ -223,9 +223,24 @@ bool TRT_ToT_dEdx::isGood_Hit(const Trk::TrackStateOnSurface *itr, bool divideBy bool useHThits, double& length) const { const Trk::MeasurementBase* trkM = itr->measurementOnTrack(); - if (!trkM) return false; - const InDet::TRT_DriftCircleOnTrack *driftcircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(trkM); - if (!driftcircle) return false; + if (!trkM) { + return false; + } + + // Check if this is RIO on track + // annd if yes check if is TRT Drift Circle + // then set the ptr + const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr; + if (trkM->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(trkM); + if (tmpRio->rioType(Trk::RIO_OnTrackType::TRT_DriftCircle)) { + driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio); + } + } + + if (!driftcircle) { + return false; + } const Trk::TrackParameters* trkP = itr->trackParameters(); if(trkP==0)return false; @@ -745,7 +760,12 @@ double TRT_ToT_dEdx::mass(const Trk::TrackStateOnSurface *itr, const double pTrk TF1 blumRolandi( "BR", blumRolandiFunction.c_str(), 0.7, 100000); - blumRolandi.SetParameters(dEdxCorrection->paraDedxP1[gasType],dEdxCorrection->paraDedxP2[gasType],dEdxCorrection->paraDedxP3[gasType],dEdxCorrection->paraDedxP4[gasType],dEdxCorrection->paraDedxP5[gasType], 1. ); + blumRolandi.SetParameters(dEdxCorrection->paraDedxP1[gasType], + dEdxCorrection->paraDedxP2[gasType], + dEdxCorrection->paraDedxP3[gasType], + dEdxCorrection->paraDedxP4[gasType], + dEdxCorrection->paraDedxP5[gasType], + 1.); //blumRolandi.SetParameters(&dEdxCorrection->para_dEdx_BB); double betaGamma = blumRolandi.GetX(dEdx, bg_min, bg_max); @@ -760,9 +780,24 @@ double TRT_ToT_dEdx::mass(const Trk::TrackStateOnSurface *itr, const double pTrk ITRT_ToT_dEdx::EGasType TRT_ToT_dEdx::gasTypeInStraw(const Trk::TrackStateOnSurface *itr) const { const Trk::MeasurementBase* trkM = itr->measurementOnTrack(); - if (!trkM) return kUnset; - const InDet::TRT_DriftCircleOnTrack *driftcircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(trkM); - if (!driftcircle) return kUnset; + if (!trkM) { + return kUnset; + } + + // Check if this is RIO on track + //annd if yes check if is TRT Drift Circle + //then set the ptr + const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr; + if (trkM->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(trkM); + if (tmpRio->rioType(Trk::RIO_OnTrackType::TRT_DriftCircle)) { + driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio); + } + } + + if (!driftcircle) { + return kUnset; + } return gasTypeInStraw(driftcircle); } @@ -850,14 +885,32 @@ double TRT_ToT_dEdx::correctToT_corrRZ(const Trk::TrackStateOnSurface *itr) cons return 0; } -double TRT_ToT_dEdx::correctToT_corrRZ(const Trk::TrackStateOnSurface *itr, bool divideByL, bool corrected, double length) const +double +TRT_ToT_dEdx::correctToT_corrRZ(const Trk::TrackStateOnSurface* itr, + bool divideByL, + bool corrected, + double length) const { const Trk::MeasurementBase* trkM = itr->measurementOnTrack(); const Trk::TrackParameters* trkP = itr->trackParameters(); - const InDet::TRT_DriftCircleOnTrack *driftcircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(trkM); - if (!driftcircle) return 0; - if (driftcircle->prepRawData()==0) return 0; + // Check if this is RIO on track + // annd if yes check if is TRT Drift Circle + // then set the ptr + const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr; + if (trkM && trkM->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(trkM); + if (tmpRio->rioType(Trk::RIO_OnTrackType::TRT_DriftCircle)) { + driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio); + } + } + + if (!driftcircle) { + return 0; + } + if (driftcircle->prepRawData()==0) { + return 0; + } Identifier DCId = driftcircle->identify(); unsigned int BitPattern = driftcircle->prepRawData()->getWord(); @@ -1666,13 +1719,28 @@ double TRT_ToT_dEdx::hitOccupancyCorrection(const Trk::TrackStateOnSurface *itr) const TRTDedxcorrection* dEdxCorrection{*readHandle}; const Trk::MeasurementBase* trkM = itr->measurementOnTrack(); - const InDet::TRT_DriftCircleOnTrack *driftcircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(trkM); - + + // Check if this is RIO on track + // annd if yes check if is TRT Drift Circle + // then set the ptr + const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr; + if (trkM && trkM->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(trkM); + if (tmpRio->rioType(Trk::RIO_OnTrackType::TRT_DriftCircle)) { + driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio); + } + } + const Trk::TrackParameters* trkP = itr->trackParameters(); Identifier DCId = driftcircle->identify(); int isHT = driftcircle->highLevel(); int isShared=0; - const Trk::RIO_OnTrack* hit_trt = trkM ? dynamic_cast<const Trk::RIO_OnTrack*>(trkM) : nullptr; + + const Trk::RIO_OnTrack* hit_trt = nullptr; + if (trkM && trkM->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + hit_trt = static_cast<const Trk::RIO_OnTrack*>(trkM); + } + if (hit_trt) { if ( m_assoTool->isShared(*(hit_trt->prepRawData())) ) isShared=1; } diff --git a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/CMakeLists.txt b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/CMakeLists.txt index 0a359dbd9b2033b2130895d9646a67eb3d314f0e..996ce28a2b30a416193fa3935bd494a064e1faf2 100644 --- a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/CMakeLists.txt @@ -14,7 +14,6 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetRecEvent/InDetRIO_OnTrack - MagneticField/MagFieldInterfaces Tracking/TrkEvent/TrkPseudoMeasurementOnTrack Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkFitter/TrkFitterInterfaces @@ -28,7 +27,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( TRT_SegmentToTrackTool src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces TrkEventPrimitives InDetIdentifier InDetRIO_OnTrack MagFieldInterfaces TrkPseudoMeasurementOnTrack TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces MagFieldElements MagFieldConditions) + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces TrkEventPrimitives InDetIdentifier InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces MagFieldElements MagFieldConditions) # Install files from the package: atlas_install_headers( TRT_SegmentToTrackTool ) diff --git a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool.h b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool.h index 37374984bd1edd067e376e5c6031dccd7d83897d..3604bbafe593ea0c4965eec904dc57d3f83df420 100644 --- a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool.h +++ b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool.h @@ -53,12 +53,6 @@ namespace Trk { } -namespace MagField { - - class IMagFieldSvc; - -} - namespace InDet { //class TrackSegment; @@ -111,12 +105,11 @@ namespace InDet { {this, "TrackSummaryTool", "InDetTrackSummaryToolNoHoleSearch"}; ToolHandle<Trk::ITrackScoringTool> m_scoringTool ; //!< Track scoring tool - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc ; //!< Magnetic field service //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Read handle for conditions object to get the field cache - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", - "Name of the Magnetic Field conditions object key"}; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx index 77d6dadc382105e9247ea0e2ded06c17ee0ec2a0..3afdb7a568965ca9c18b8a8b1fe65dd6c048417e 100644 --- a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx +++ b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx @@ -14,8 +14,6 @@ #include "TrkExInterfaces/IExtrapolator.h" //Scoring tool #include "TrkToolInterfaces/ITrackScoringTool.h" -//Magnetic field tool -#include "MagFieldInterfaces/IMagFieldSvc.h" using Amg::Vector3D; using CLHEP::mm; @@ -31,7 +29,6 @@ namespace InDet { m_fitterTool("Trk::KalmanFitter/InDetTrackFitter"), m_extrapolator ("Trk::Extrapolator/InDetExtrapolator"), m_scoringTool("Trk::TrackScoringTool/TrackScoringTool"), - m_magFieldSvc("AtlasFieldSvc", name), m_trtId(nullptr) { declareInterface<InDet::ITRT_SegmentToTrackTool>( this ); @@ -49,9 +46,6 @@ namespace InDet { declareProperty("RefitterTool" ,m_fitterTool ); //Track refit tool declareProperty("Extrapolator" ,m_extrapolator ); //Extrapolator tool declareProperty("ScoringTool" ,m_scoringTool ); //Track scoring tool - - declareProperty( "MagFieldSvc" ,m_magFieldSvc ); //Magnetic field tool - } TRT_SegmentToTrackTool::~TRT_SegmentToTrackTool() @@ -82,11 +76,9 @@ namespace InDet { // ATH_CHECK( m_scoringTool.retrieve() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); - ATH_CHECK( detStore()->retrieve(m_trtId, "TRT_ID") ); //////////////////////////////////////////////////////////////////////////////// - ATH_CHECK( m_fieldCondObjInputKey.initialize()); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize()); //////////////////////////////////////////////////////////////////////////////// // Get output print level @@ -164,7 +156,7 @@ namespace InDet { // if (!tS.fitQuality()) { ATH_MSG_DEBUG ("Segment has no fit quality ! Discard..."); - return 0; + return nullptr; } const Trk::FitQuality* fq = tS.fitQuality()->clone(); @@ -186,7 +178,7 @@ namespace InDet { // clean up delete fq; fq = 0; delete ep; ep = 0; - return 0; + return nullptr; } // --- create new track state on surface vector @@ -211,7 +203,7 @@ namespace InDet { delete ntsos; ntsos = 0; delete segPar; segPar = 0; delete fq; fq = 0; - return 0; + return nullptr; } // now create a perigee TSOS @@ -351,7 +343,7 @@ namespace InDet { ATH_MSG_DEBUG ("Could not produce perigee"); delete newTrack; newTrack = 0; delete segPar; segPar = 0; - return 0; + return nullptr; } // keep some values @@ -462,17 +454,16 @@ namespace InDet { MagField::AtlasFieldCache fieldCache; // Get field cache object - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx}; + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; if (fieldCondObj == nullptr) { - ATH_MSG_ERROR("segToTrack: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key()); - return 0; + ATH_MSG_ERROR("segToTrack: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; } fieldCondObj->getInitializedCache (fieldCache); - // MT version uses cache, temporarily keep old version - if (fieldCache.useNewBfieldCache()) fieldCache.getField (Amg::Vector3D(.5*(pos1+pos2)).data(),field1.data()); - else m_magFieldSvc->getField(Amg::Vector3D(.5*(pos1+pos2)).data(),field1.data()); + // MT version uses cache + fieldCache.getField (Amg::Vector3D(.5*(pos1+pos2)).data(),field1.data()); field1 *= m_fieldUnitConversion; // field in Tesla @@ -550,7 +541,7 @@ namespace InDet { if(!fitTrack){ ATH_MSG_DEBUG ("Refit of TRT track segment failed!"); - return 0; + return nullptr; } // @@ -570,7 +561,7 @@ namespace InDet { if (!perTrack || !perTrack->covariance() ){ ATH_MSG_ERROR ("Cast of perigee fails, should never happen !"); - return 0; + return nullptr; }else { ATH_MSG_VERBOSE ("Perigee after refit with fudges to make it converge : " << (*perTrack) ); @@ -625,7 +616,7 @@ namespace InDet { const AmgSymMatrix(5)& CM = *perTrack->covariance(); if( CM(1,1)==0.||CM(3,3)==0. ) { ATH_MSG_DEBUG ("Hacked perigee covariance is CRAP, reject track"); - delete fitTrack; return 0; + delete fitTrack; return nullptr; } else { ATH_MSG_VERBOSE ("Perigee after fit with scaled covariance matrix : " << *perTrack); } diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.cxx index 62eecac0ec39f59403131bbfa5bd073378983229..65ba9a7e8812a46057baf775fdb657e7c2ef5906 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.cxx @@ -2,34 +2,18 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/ITHistSvc.h" #include "TrigTrackingxAODCnvMT.h" #include "TrkToolInterfaces/ITrackParticleCreatorTool.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" #include "xAODTracking/TrackParticleAuxContainer.h" #include "xAODTracking/TrackParticleContainer.h" -#include "VxVertex/VxContainer.h" -#include "VxVertex/VxTrackAtVertex.h" -#include "Particle/TrackParticle.h" #include "TrkTrack/Track.h" -#include "TrkTrack/LinkToTrack.h" #include "TrkParameters/TrackParameters.h" -#include "Particle/TrackParticleContainer.h" -#include "TrkToolInterfaces/IPRD_AssociationTool.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "IRegionSelector/IRegSelSvc.h" #include "TrkTrackSummary/TrackSummary.h" -#include "Identifier/Identifier.h" -#include "InDetIdentifier/PixelID.h" -#include "AtlasDetDescr/AtlasDetectorID.h" -#include "IdDictDetDescr/IdDictManager.h" -#include "CxxUtils/phihelper.h" - #include <cmath> #include <algorithm> -#include "TrigTimeAlgs/TrigTimerSvc.h" namespace InDet { @@ -37,94 +21,18 @@ namespace InDet TrigTrackingxAODCnvMT::TrigTrackingxAODCnvMT(const std::string &name, ISvcLocator *pSvcLocator) - : AthAlgorithm (name, pSvcLocator), + : AthReentrantAlgorithm (name, pSvcLocator), m_particleCreatorTool("Trk::ParticleCreatorTool"), - m_residualCalc("Trk::ResidualPullCalculator"), - m_doIBLresidual(false), - m_slice_name(""), - m_mon_doSliceSpecific(true), - m_mon_counter(1), - m_mon_prescale(1), - m_mon_ptmin(1), - m_roiCollectionKey(""), m_trackKey(""), m_trackParticleKey("") - { declareProperty("ParticleCreatorTool", m_particleCreatorTool); - declareProperty("ResidualPullCalculator", m_residualCalc); - declareProperty("doIBLresidual", m_doIBLresidual); - - declareProperty("TrackParticlesName", m_trackParticleKey = std::string("TrackParticles"), "TrackParticle container"); declareProperty("TrackName", m_trackKey = std::string("Tracks"), "Track Collection"); - declareProperty("roiCollectionName", - m_roiCollectionKey = std::string("rois"), - "RoI Collection"); - - - //+++ DQM (SA): monitoring - declareProperty("MonSliceSpecific", m_mon_doSliceSpecific); - declareProperty("MonPrescale", m_mon_prescale); - declareProperty("MonPtmin", m_mon_ptmin); - // Common for all slices - /* declareMonitoredStdContainer("trk_d0", m_dqm_d0); - declareMonitoredStdContainer("trk_z0", m_dqm_z0); - declareMonitoredStdContainer("trk_phi", m_dqm_phi); - declareMonitoredStdContainer("trk_eta", m_dqm_eta); - declareMonitoredStdContainer("trk_qoverp", m_dqm_qOverP); - declareMonitoredStdContainer("trk_nPIXHits", m_dqm_npix_hits); - declareMonitoredStdContainer("trk_nSCTHits", m_dqm_nsct_hits); - declareMonitoredStdContainer("trk_nTRTHits", m_dqm_ntrt_hits); - declareMonitoredStdContainer("trk_chi2dof", m_dqm_chi2dof); - declareMonitoredStdContainer("roi_etaRoi", m_dqm_eta_roi); - declareMonitoredStdContainer("roi_phiRoi", m_dqm_phi_roi); - declareMonitoredVariable("roi_nTrkPart", m_dqm_ntrkpart); - declareMonitoredVariable("roi_nTracks", m_dqm_ntrk); - declareMonitoredVariable("roi_nVertices", m_dqm_nvertex); - declareMonitoredVariable("roi_eta", m_roiEta); - declareMonitoredVariable("roi_etaWidth", m_roiEtaWidth); - declareMonitoredVariable("roi_phi", m_roiPhi); - declareMonitoredVariable("roi_phiWidth", m_roiPhiWidth); - declareMonitoredVariable("roi_z", m_roiZ); - declareMonitoredVariable("roi_zWidth", m_roiZ_Width); - // Bjet slice - declareMonitoredVariable("bj_sumPt", m_dqm_bj_sumpt); - // Muon slice - declareMonitoredVariable("mu_d0", m_dqm_mu_d0); - declareMonitoredVariable("mu_z0", m_dqm_mu_z0); - declareMonitoredVariable("mu_eta", m_dqm_mu_eta); - declareMonitoredVariable("mu_phi", m_dqm_mu_phi); - declareMonitoredVariable("mu_qOverP", m_dqm_mu_qOverP); - declareMonitoredVariable("mu_pt", m_dqm_mu_pt); - declareMonitoredVariable("mu_nPIXHits", m_dqm_mu_npix_hits); - declareMonitoredVariable("mu_nSCTHits", m_dqm_mu_nsct_hits); - declareMonitoredVariable("mu_nTRTHits", m_dqm_mu_ntrt_hits); - declareMonitoredVariable("mu_chi2Dof", m_dqm_mu_chi2dof); - declareMonitoredVariable("mu_etaRoi", m_dqm_mu_eta_roi); - declareMonitoredVariable("mu_phiRoi", m_dqm_mu_phi_roi); - // Tau slice - declareMonitoredStdContainer("ta_roiDR", m_dqm_ta_roidr); - declareMonitoredVariable("ta_lPt", m_dqm_ta_L_pt); - declareMonitoredVariable("ta_fracPt", m_dqm_ta_frac_pt); - declareMonitoredVariable("ta_sumCh", m_dqm_ta_sum_ch); - declareMonitoredVariable("ta_asyCh", m_dqm_ta_asy_ch); - declareMonitoredVariable("ta_m", m_dqm_ta_m); - //IBL related - declareMonitoredStdContainer("IBLz", m_dqm_ibl_z); - declareMonitoredStdContainer("IBLresx", m_dqm_ibl_res_x); - declareMonitoredStdContainer("IBLresy", m_dqm_ibl_res_y); - declareMonitoredStdContainer("IBLHitExpectedAndFound", m_dqm_ibl_hit_expected_found); - //Timers - m_timerMemAlloc = nullptr; - m_timerFeatureAttach = nullptr; - m_timerTrackConversion = nullptr; - */ - } TrigTrackingxAODCnvMT::~TrigTrackingxAODCnvMT() @@ -135,534 +43,73 @@ namespace InDet /////////////////////////////////////////////////////////////////// StatusCode TrigTrackingxAODCnvMT::initialize() { - msg() << MSG::DEBUG << name() << " initialize() " << PACKAGE_VERSION << endmsg; - - if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) { - msg(MSG::FATAL) << "Could not get AtlasDetectorID helper" << endmsg; - return StatusCode::FAILURE; - } - - if (detStore()->retrieve(m_pixelId, "PixelID").isFailure()) { - msg(MSG::ERROR) << "Could not get PixelID helper !" << endmsg; - return StatusCode::FAILURE; - } - - if ( m_particleCreatorTool.retrieve().isFailure() ) { - msg() << MSG::FATAL << "Failed to retrieve tool " << m_particleCreatorTool << endmsg; - return StatusCode::FAILURE; - } - else{ - msg() << MSG::INFO << "Retrieved tool " << m_particleCreatorTool << endmsg; - } - - if ( m_residualCalc.retrieve().isFailure() ) { - msg() << MSG::FATAL << "Failed to retrieve tool " << m_residualCalc << endmsg; - return StatusCode::FAILURE; - } - else{ - msg() << MSG::INFO << "Retrieved tool " << m_particleCreatorTool << endmsg; - } + ATH_CHECK(m_particleCreatorTool.retrieve()); - - ATH_CHECK( m_roiCollectionKey.initialize() ); - ATH_CHECK( m_trackKey.initialize() ); ATH_CHECK( m_trackParticleKey.initialize() ); - //+++ DQM (SA): monitoring - std::string tmp_alg_name = this->name(); - std::vector<std::string> slice_names; - slice_names.push_back("Bphysics"); - slice_names.push_back("Electron"); - slice_names.push_back("MinBias"); - slice_names.push_back("Photon"); - slice_names.push_back("Bjet"); - slice_names.push_back("FullScan"); - slice_names.push_back("Muon"); - slice_names.push_back("Tau"); - - m_slice_name=""; - - std::vector<std::string>::const_iterator iter; - for (iter = slice_names.begin(); iter != slice_names.end(); ++iter) { - if(tmp_alg_name.find( (*iter), 0) != std::string::npos ) m_slice_name = (*iter); - } - - //Initialise timer - /* - m_timerMemAlloc = addTimer("MemoryAlloc"); - m_timerFeatureAttach = addTimer("FeatureAttach"); - m_timerTrackConversion = addTimer("TrackConversion"); - */ return StatusCode::SUCCESS; } /////////////////////////////////////////////////////////////////// // Execute HLT Algorithm /////////////////////////////////////////////////////////////////// - StatusCode TrigTrackingxAODCnvMT::execute() { - - - ATH_MSG_DEBUG("execute()"); - + StatusCode TrigTrackingxAODCnvMT::execute(const EventContext& ctx) const { - //---------------------------------------------------------------------- - // Navigate throw the trigger element to retrieve the last TrackCollection - //---------------------------------------------------------------------- - //const TrackCollection* allTracksFromStoreGate; - - //initialize monitored objects - bool runAlg = true; - StatusCode statCode(StatusCode::SUCCESS); - - if (statCode!=StatusCode::SUCCESS){ - msg() << MSG::ERROR << "ErrorCode check to avoid unchecked SC" << endmsg; - } - - //+++ DQM (SA): monitoring - // ResetMon(); - - const auto &ctx = getContext(); - auto tpHandle = SG::makeHandle (m_trackParticleKey, ctx); + auto tpHandle = SG::makeHandle (m_trackParticleKey, ctx); ATH_CHECK( tpHandle.record (std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()) ); xAOD::TrackParticleContainer* tpCont=tpHandle.ptr(); - // - //float tmp_eta_roi = -999; - //float tmp_phi_roi = -999; - ATH_MSG_DEBUG(" Getting RoI"); - auto roiCollection = SG::makeHandle(m_roiCollectionKey, ctx); - ATH_MSG_DEBUG(" Got RoICollection size "<<roiCollection->size() ); - - if (roiCollection->size()==0) { - ATH_MSG_DEBUG("RoICollection size 0"); - // tmp_eta_roi = 0; - // tmp_phi_roi = 0; - } else { - - //TrigRoiDescriptor* roi = *(roiCollection->begin()); - //tmp_eta_roi = roi->eta(); - //tmp_phi_roi = roi->phi(); - } auto tracks = SG::makeHandle(m_trackKey, ctx); ATH_MSG_VERBOSE(" Input track collection has size " << tracks->size()); if ( tracks->size() == 0 ) { ATH_MSG_DEBUG(" Input track collection has 0 size. Algorithm not executed!"); - runAlg = false; - } - - - //convert tracks - - - - - if(runAlg) { - //Memory Alloc - // if(doTiming()) m_timerMemAlloc->start(); - tpCont->reserve(tracks->size()); - // if(doTiming()) m_timerMemAlloc->stop(); -// const InDet::BeamSpotData* BsData = m_particleCreatorTool->CacheBeamSpotData(ctx); - for(unsigned int idtr=0; idtr< tracks->size(); ++idtr) { - const ElementLink<TrackCollection> trackLink(*tracks, idtr); - - if (m_doIBLresidual) fillIBLResidual(tracks->at(idtr)); - - // if(doTiming()) m_timerTrackConversion->start(); - xAOD::TrackParticle* tp = m_particleCreatorTool->createParticle( trackLink, tpCont); - // if(doTiming()) m_timerTrackConversion->stop(); - - if(msgLvl(MSG::DEBUG) && (tp != 0)){ - int npix, nsct, ntrt, npixh, nscth; - npix = nsct = ntrt = npixh = nscth = -1; - const Trk::Track *tr = tp->track(); - if (tr){ - const Trk::TrackSummary *ts = tr->trackSummary(); - if (ts){ - npix = ts->get(Trk::numberOfPixelHits); - nsct = ts->get(Trk::numberOfSCTHits); - ntrt = ts->get(Trk::numberOfTRTHits); - nscth= ts->get(Trk::numberOfSCTHoles); - npixh= ts->get(Trk::numberOfPixelHoles); - - } - } - - msg() << MSG::DEBUG << "REGTEST: " << std::setw(5) << idtr - << " pT: " << std::setw(10) << tp->pt() - << " eta: " << tp->eta() - << " phi: " << tp->phi() - << " d0: " << tp->d0() - << " z0: " << tp->z0() - << "\t" << npix << "/" << nsct << "/" << ntrt << "//" << npixh << "/" << nscth - << endmsg; - - } - } - } - - - ATH_MSG_DEBUG("REGTEST container size = " << tpCont->size()); - - // for (xAOD::TrackParticleContainer::iterator itr = tpCont->begin(); itr != tpCont->end(); ++itr) { - //FillMonPerTrack(*itr, tmp_eta_roi, tmp_phi_roi); - //} - - if (runAlg){ - //+++ DQM (SA): per RoI quantities - // FillMonPerRoi(roi, *tracks, tmp_eta_roi, tmp_phi_roi); - //++m_mon_counter; - return StatusCode::SUCCESS; - } else { - return statCode; - } - } - - //--------------------------------------------------------------------------- - // update the monitoring arrays - //--------------------------------------------------------------------------- - void TrigTrackingxAODCnvMT::FillMonPerTrack(const xAOD::TrackParticle *particle, - const double &tmp_eta_roi, const double &tmp_phi_roi) { - - //+++ Prescale - if (m_mon_counter != m_mon_prescale) return; - - //+++ Common for all slices - float tmp_eta = -999; - float tmp_phi = -999; - - tmp_eta = particle->eta(); - tmp_phi = particle->phi(); - m_dqm_d0.push_back(particle->d0()); - m_dqm_z0.push_back(particle->z0()); - m_dqm_eta.push_back(tmp_eta); - m_dqm_phi.push_back(tmp_phi); - m_dqm_qOverP.push_back(particle->qOverP()); - - uint8_t numberOfPixelHits = 0; - particle->summaryValue(numberOfPixelHits, xAOD::numberOfPixelHits); - m_dqm_npix_hits.push_back(static_cast<int>(numberOfPixelHits)); - uint8_t numberOfSCTHits = 0; - particle->summaryValue(numberOfSCTHits, xAOD::numberOfSCTHits); - m_dqm_nsct_hits.push_back(static_cast<int>(numberOfSCTHits)); - uint8_t numberOfTRTHits = 0; - particle->summaryValue(numberOfTRTHits, xAOD::numberOfTRTHits); - if (fabs(particle->eta())<1.9){ - m_dqm_ntrt_hits.push_back(static_cast<int>(numberOfTRTHits)); - } else { - m_dqm_ntrt_hits.push_back(-1); - } - - uint8_t expectInnermostHit = 0; - particle->summaryValue(expectInnermostHit, xAOD::expectInnermostPixelLayerHit ); - uint8_t numberOfInnermostHits = 0; - particle->summaryValue(numberOfInnermostHits, xAOD::numberOfInnermostPixelLayerHits ); - if (numberOfInnermostHits>1) numberOfInnermostHits = 1; - if (expectInnermostHit>0){ - m_dqm_ibl_hit_expected_found.push_back(float(numberOfInnermostHits)); - } - else { - m_dqm_ibl_hit_expected_found.push_back(-1.); - } - - if(particle->numberDoF()>0) { - m_dqm_chi2dof.push_back(particle->chiSquared() / particle->numberDoF()); } - - m_dqm_eta_roi.push_back(tmp_eta_roi); - m_dqm_phi_roi.push_back(tmp_phi_roi); - - //+++ Slice specific - if (m_mon_doSliceSpecific) { - if (m_slice_name == "Tau") { - float tmp_deta = tmp_eta - tmp_eta_roi; - float tmp_dphi = tmp_phi - tmp_phi_roi; - float tmp_roidr = sqrt(tmp_deta*tmp_deta + tmp_dphi*tmp_dphi); - m_dqm_ta_roidr.push_back(tmp_roidr); - } - } - - return; - } - - void TrigTrackingxAODCnvMT::fillIBLResidual(const Trk::Track *track){ - ATH_MSG_DEBUG("In fillIBLResidual"); - const DataVector<const Trk::TrackStateOnSurface>* trackStates=track->trackStateOnSurfaces(); - - for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it=trackStates->begin(); - it!=trackStates->end(); - it++) { - if (!(*it)) { - msg(MSG::WARNING) << "TrackStateOnSurface == Null" << endmsg; - continue; - } - - ATH_MSG_VERBOSE("type of state on surface" << (*it)->dumpType()); - if ((*it)->type(Trk::TrackStateOnSurface::Measurement) ){ - - ATH_MSG_VERBOSE ("try to get measurement for track state"); - // Get pointer to measurement on track - const Trk::MeasurementBase *measurement = (*it)->measurementOnTrack(); - - /* - ATH_MSG_VERBOSE("(*it)->trackParameters() " << (*it)->trackParameters()); - if ((*it)->trackParameters() !=0) - ATH_MSG_VERBOSE(" (*it)->trackParameters()->associatedSurface() " << &((*it)->trackParameters()->associatedSurface())); - */ - - if( (*it)->trackParameters() !=0 && - /*&((*it)->trackParameters()->associatedSurface()) !=0 && */ - (*it)->trackParameters()->associatedSurface().associatedDetectorElement() !=0 && - (*it)->trackParameters()->associatedSurface().associatedDetectorElement()->identify() !=0 ) - { - - Identifier id; - id = (*it)->trackParameters()->associatedSurface().associatedDetectorElement()->identify(); - float zmod = (*it)->trackParameters()->associatedSurface().associatedDetectorElement()->center().z(); - if (m_idHelper->is_pixel(id)) - { - ATH_MSG_VERBOSE("Found pixel module : Associated track parameter"); - if(m_pixelId->is_barrel(id)) - { - ATH_MSG_VERBOSE("Found pixel barrel"); - if(m_pixelId->layer_disk(id) == 0) - { - ATH_MSG_VERBOSE("Found Innermost Pixel Layer " << id.get_compact()); - - const Trk::ResidualPull* pull = m_residualCalc->residualPull(measurement,(*it)->trackParameters(),Trk::ResidualPull::Unbiased); - m_dqm_ibl_z.push_back(zmod); - if (pull){ - m_dqm_ibl_res_x.push_back(pull->residual()[Trk::locX]); - m_dqm_ibl_res_y.push_back(pull->residual()[Trk::locY]); - delete pull; - } else { - msg(MSG::WARNING) << "Could not calculate the pulls" << endmsg; - m_dqm_ibl_res_x.push_back(-1.); //out of range of the profile - m_dqm_ibl_res_y.push_back(-1.); - } - } - } - } - } - } else { - ATH_MSG_VERBOSE("Not a measurement type"); - } - } - - } - - - void TrigTrackingxAODCnvMT::FillMonPerRoi(const TrigRoiDescriptor* roi, const TrackCollection* tracks, const double &tmp_eta_roi, const double &tmp_phi_roi) { - - //+++ Prescale - if (m_mon_counter >= m_mon_prescale) { - m_mon_counter = 1; - } else { - return; - } - - - //+++ Common for all slices - if (tracks) m_dqm_ntrk = tracks->size(); - - if (roi) - { - m_roiEta = roi->eta(); - m_roiEtaWidth = roi->etaPlus() - roi->etaMinus(); - m_roiPhi = roi->phi(); - m_roiPhiWidth = CxxUtils::wrapToPi(roi->phiPlus() - roi->phiMinus()); - m_roiZ = roi->zed(); - m_roiZ_Width = roi->zedPlus() - roi->zedMinus(); - } - - //+++ Slice specific - if (m_mon_doSliceSpecific) { - //+++ Bjet - if (m_slice_name == "Bjet") { - const Trk::Perigee* tmpMp = 0; - if (tracks) { - for (auto track : *tracks) { - tmpMp = track->perigeeParameters(); - if (tmpMp) { - m_dqm_bj_sumpt += tmpMp->pT()/1000; - } - } - } - //+++ Muon - } else if (m_slice_name == "Muon") { - - m_dqm_mu_eta_roi = tmp_eta_roi; - m_dqm_mu_phi_roi = tmp_phi_roi; - - //+++ Find leading track with pT > X - const Trk::Track* tpL = 0; - const Trk::Perigee* tmpMp = 0; - float tmp_pt_max = 0; - if (tracks) { - for (auto track : *tracks) { - tmpMp = track->perigeeParameters(); - if (tmpMp) { - float tmp_pt = tmpMp->pT()/1000; - if ((tmp_pt > tmp_pt_max) && (tmp_pt > m_mon_ptmin)) { - tpL = track; - tmp_pt_max = tmp_pt; - } - } - } - } - - //+++ Fill leading histograms - const Trk::TrackSummary * tmpSum = 0; - const Trk::FitQuality * tmpQty = 0; - if (tpL) { - tmpMp = tpL->perigeeParameters(); - tmpSum = tpL->trackSummary(); - tmpQty = tpL->fitQuality(); - } - if (tmpMp){ - m_dqm_mu_d0 = tmpMp->parameters()[Trk::d0]; - m_dqm_mu_z0 = tmpMp->parameters()[Trk::z0]; - m_dqm_mu_phi = tmpMp->parameters()[Trk::phi]; - m_dqm_mu_eta = tmpMp->eta(); - m_dqm_mu_qOverP = tmpMp->parameters()[Trk::qOverP]; - m_dqm_mu_pt = tmpMp->pT(); - } - if (tmpSum){ - m_dqm_mu_npix_hits = tmpSum->get(Trk::numberOfPixelHits); - m_dqm_mu_nsct_hits = tmpSum->get(Trk::numberOfSCTHits); - m_dqm_mu_ntrt_hits = tmpSum->get(Trk::numberOfTRTHits); - } - if (tmpQty){ - if (tmpQty->numberDoF()>0) m_dqm_mu_chi2dof = tmpQty->chiSquared() / tmpQty->numberDoF(); - } - //+++ Tau - } else if (m_slice_name == "Tau") { - - //+++ Find L and NL pT track and sum charge - const Trk::Track* tpL = 0; - const Trk::Track* tpNL = 0; - const Trk::Perigee* tmpLMp = 0; - const Trk::Perigee* tmpNLMp = 0; - float tmp_pt_max = 0; - int tmp_pos_ch = 0; - int tmp_neg_ch = 0; - float tmp_px = 0; - float tmp_py = 0; - float tmp_pz = 0; - float tmp_e = 0; - if (tracks) { - for (auto track : *tracks) { - tmpLMp = track->perigeeParameters(); - if (tmpLMp) { - float tmp_qOverP = tmpLMp->parameters()[Trk::qOverP]; - float tmp_p = 0; - if (tmp_qOverP != 0) tmp_p = fabs(1/tmp_qOverP)/1000; - float tmp_pt = tmp_p*sin(tmpLMp->parameters()[Trk::theta]); - tmp_px += tmp_pt*cos(tmpLMp->parameters()[Trk::phi]); - tmp_py += tmp_pt*sin(tmpLMp->parameters()[Trk::phi]); - tmp_pz += tmp_p*cos(tmpLMp->parameters()[Trk::theta]); - tmp_e += sqrt(tmp_p*tmp_p + 0.140*0.140); // All tracks get the pi mass - if ((tmp_pt > tmp_pt_max) && (tmp_pt > m_mon_ptmin)) { - tpNL = tpL; - tpL = track; - tmp_pt_max = tmp_pt; - } - if (tmp_qOverP < 0) { - ++tmp_neg_ch; - } else { - ++tmp_pos_ch; - } - } - } - } - - //+++ Fill m and pT of L and NL track - float tmp_p2 = tmp_px*tmp_px + tmp_py*tmp_py + tmp_pz*tmp_pz; - float tmp_m2 = tmp_e*tmp_e - tmp_p2; - if (tmp_m2 >= 0) m_dqm_ta_m = sqrt( tmp_m2 ); - if (tpL) tmpLMp = tpL->perigeeParameters(); - if (tpNL) tmpNLMp = tpNL->perigeeParameters(); - if (tmpLMp){ - m_dqm_ta_L_pt = tmpLMp->pT()/1000; - if (tmpNLMp) { - float tmp_NL_pt = tmpNLMp->pT()/1000; - if (m_dqm_ta_L_pt!=0) m_dqm_ta_frac_pt = tmp_NL_pt / m_dqm_ta_L_pt; - } - } - - //+++ Charge Asymmetry - float tmp_sumpart = tmp_pos_ch + tmp_neg_ch; - if (tmp_sumpart != 0) { - m_dqm_ta_sum_ch = tmp_pos_ch - tmp_neg_ch; - m_dqm_ta_asy_ch = m_dqm_ta_sum_ch / tmp_sumpart; - } else { - m_dqm_ta_asy_ch = -999; + //convert tracks + tpCont->reserve(tracks->size()); + for(unsigned int idtr=0; idtr< tracks->size(); ++idtr) { + const ElementLink<TrackCollection> trackLink(*tracks, idtr); + + xAOD::TrackParticle* tp = m_particleCreatorTool->createParticle( trackLink, tpCont); + + if(msgLvl(MSG::DEBUG) && (tp != 0)){ + int npix, nsct, ntrt, npixh, nscth; + npix = nsct = ntrt = npixh = nscth = -1; + const Trk::Track *tr = tp->track(); + if (tr){ + const Trk::TrackSummary *ts = tr->trackSummary(); + if (ts){ + npix = ts->get(Trk::numberOfPixelHits); + nsct = ts->get(Trk::numberOfSCTHits); + ntrt = ts->get(Trk::numberOfTRTHits); + nscth= ts->get(Trk::numberOfSCTHoles); + npixh= ts->get(Trk::numberOfPixelHoles); + + } } + msg() << MSG::DEBUG << "REGTEST: " << std::setw(5) << idtr + << " pT: " << std::setw(10) << tp->pt() + << " eta: " << tp->eta() + << " phi: " << tp->phi() + << " d0: " << tp->d0() + << " z0: " << tp->z0() + << "\t" << npix << "/" << nsct << "/" << ntrt << "//" << npixh << "/" << nscth + << endmsg; } } - return; - } - - void TrigTrackingxAODCnvMT::ResetMon() { - - // Common - m_dqm_d0.clear(); - m_dqm_z0.clear(); - m_dqm_phi.clear(); - m_dqm_eta.clear(); - m_dqm_qOverP.clear(); - m_dqm_npix_hits.clear(); - m_dqm_nsct_hits.clear(); - m_dqm_ntrt_hits.clear(); - m_dqm_chi2dof.clear(); - m_dqm_eta_roi.clear(); - m_dqm_phi_roi.clear(); - m_dqm_ntrkpart = 0; - m_dqm_ntrk = 0; - m_dqm_nvertex = 0; - - m_dqm_ibl_z.clear(); - m_dqm_ibl_res_x.clear(); - m_dqm_ibl_res_y.clear(); - m_dqm_ibl_hit_expected_found.clear(); - // Bjet - m_dqm_bj_sumpt = 0; - - // Muon - m_dqm_mu_d0 = -999; - m_dqm_mu_z0 = -999; - m_dqm_mu_eta = -999; - m_dqm_mu_phi = -999; - m_dqm_mu_qOverP = -999; - m_dqm_mu_pt = -999999; - m_dqm_mu_npix_hits = 0; - m_dqm_mu_nsct_hits = 0; - m_dqm_mu_ntrt_hits = 0; - m_dqm_mu_chi2dof = -999; - m_dqm_mu_eta_roi = -999; - m_dqm_mu_phi_roi = -999; - // Tau - m_dqm_ta_roidr.clear(); - m_dqm_ta_L_pt = 0; - m_dqm_ta_frac_pt = 0; - m_dqm_ta_sum_ch = -999; - m_dqm_ta_asy_ch = -999; - m_dqm_ta_m = -999; - - return; + ATH_MSG_DEBUG("REGTEST container size = " << tpCont->size()); + return StatusCode::SUCCESS; } - - } // end namespace diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.h b/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.h index 4283b5091d04a045507e38cae322d64cbd552503..3b8c9e35f52ee2ae99b2d7719019e9ad8409bca3 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.h +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigParticleCreation/src/TrigTrackingxAODCnvMT.h @@ -21,24 +21,21 @@ #include "GaudiKernel/ToolHandle.h" // Base class -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" +#include "xAODTracking/TrackParticleContainer.h" #include "TrkTrack/TrackCollection.h" -//!< Trigger specific stuff -#include "TrigInterfaces/FexAlgo.h" - // STL #include <string> -#include <vector> class TH1F; class AtlasDetectorID; -class Identifier; class PixelID; +class TrigRoiDescriptorCollection; namespace Trk { @@ -46,89 +43,21 @@ namespace Trk { class IResidualPullCalculator; } - - namespace InDet { - class TrigTrackingxAODCnvMT : public AthAlgorithm + class TrigTrackingxAODCnvMT : public AthReentrantAlgorithm { public: TrigTrackingxAODCnvMT(const std::string &name, ISvcLocator *pSvcLocator); virtual ~TrigTrackingxAODCnvMT(); StatusCode initialize(); - StatusCode execute(); - - private: - void ResetMon(); - void FillMonPerTrack(const xAOD::TrackParticle *, const double&, const double&); - void FillMonPerRoi(const TrigRoiDescriptor* , const TrackCollection* tracks, const double&, const double&); - void fillIBLResidual(const Trk::Track *track); + StatusCode execute(const EventContext& ctx) const; private: ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreatorTool; - ToolHandle< Trk::IResidualPullCalculator > m_residualCalc; - const AtlasDetectorID* m_idHelper{}; - const PixelID* m_pixelId{}; - - bool m_doIBLresidual{}; - - //Monitoring - std::string m_slice_name; - bool m_mon_doSliceSpecific{}; - int m_mon_counter{}; - int m_mon_prescale{}; - float m_mon_ptmin{}; - //Common Variables - std::vector<float> m_dqm_d0; - std::vector<float> m_dqm_z0; - std::vector<float> m_dqm_phi; - std::vector<float> m_dqm_eta; - std::vector<float> m_dqm_qOverP; - std::vector<int> m_dqm_npix_hits; - std::vector<int> m_dqm_nsct_hits; - std::vector<int> m_dqm_ntrt_hits; - std::vector<float> m_dqm_chi2dof; - std::vector<float> m_dqm_eta_roi; - std::vector<float> m_dqm_phi_roi; - double m_roiPhi{}, m_roiEta{}, m_roiZ{}; - double m_roiPhiWidth{}, m_roiEtaWidth{}, m_roiZ_Width{}; - int m_dqm_ntrkpart{}; - int m_dqm_ntrk{}; - int m_dqm_nvertex{}; - //Bjet - float m_dqm_bj_sumpt{}; - //Muon - float m_dqm_mu_d0{}; - float m_dqm_mu_z0{}; - float m_dqm_mu_eta{}; - float m_dqm_mu_phi{}; - float m_dqm_mu_qOverP{}; - float m_dqm_mu_pt{}; - int m_dqm_mu_npix_hits{}; - int m_dqm_mu_nsct_hits{}; - int m_dqm_mu_ntrt_hits{}; - float m_dqm_mu_chi2dof{}; - float m_dqm_mu_eta_roi{}; - float m_dqm_mu_phi_roi{}; - //Tau - std::vector<float> m_dqm_ta_roidr; - float m_dqm_ta_L_pt{}; //+++ pT of leading (L) pT track - float m_dqm_ta_frac_pt{}; //+++ fraction pT_L/pT_NL, NL= next-to-leading - float m_dqm_ta_sum_ch{}; //+++ Charge sum all tracks - float m_dqm_ta_asy_ch{}; //+++ Charge asymmetry all tracks - float m_dqm_ta_m{}; //+++ Inv mass all tracks - - // - std::vector<float> m_dqm_ibl_z; //IBL coordinate along z - std::vector<float> m_dqm_ibl_res_x; - std::vector<float> m_dqm_ibl_res_y; - std::vector<float> m_dqm_ibl_hit_expected_found; - - - - SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey; + SG::ReadHandleKey<TrackCollection> m_trackKey; SG::WriteHandleKey<xAOD::TrackParticleContainer> m_trackParticleKey; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx index 630002a00e3ec502c34a3291644a68b8083676d9..afd0994945ea1e5eacab77f4544cfcbc92ca2b12 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //*************************************************************************** @@ -36,6 +36,8 @@ #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" +#include <cmath> + namespace InDet{ using namespace InDet; @@ -91,7 +93,7 @@ namespace InDet{ declareMonitoredStdContainer("SctOccupancyHashId", m_occupancyHashId); - m_clusterCollection = NULL; + m_clusterCollection = nullptr; // error strategy // @@ -231,7 +233,7 @@ namespace InDet{ //initialisation of monitored quantities m_numSctIds = 0; m_numSctClusters = 0; - m_clusterCollection = NULL; + m_clusterCollection = nullptr; m_listOfSctIds.clear(); m_ClusHashId.clear(); m_SctBSErr.clear(); @@ -307,7 +309,7 @@ namespace InDet{ } if (!roi){ - ATH_MSG_WARNING( "Received NULL RoI" ); + ATH_MSG_WARNING( "Received nullptr RoI" ); return HLT::NAV_ERROR; } @@ -321,7 +323,7 @@ namespace InDet{ if ( RoiPhiWidth<-M_PI ) RoiPhiWidth += 1e-7; if (!roi->isFullscan()){ - if( fabs(RoiEtaWidth/2. - m_etaHalfWidth) > 0.02) { + if( std::abs(RoiEtaWidth/2. - m_etaHalfWidth) > 0.02) { ATH_MSG_DEBUG( "ROI range is different from configuration: " ); ATH_MSG_DEBUG( "eta width = " << RoiEtaWidth << "; with etaPlus = " << roi->etaPlus() << "; etaMinus = " << roi->etaMinus() ); ATH_MSG_DEBUG( "etaHalfWidth from config: " << m_etaHalfWidth ); diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigPixRawDataProvider.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigPixRawDataProvider.cxx index 09e026709559a19b013b16165a1c217fe351dee1..f7e531d826b57bd3205d4f387268d6a919aaf261 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigPixRawDataProvider.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigPixRawDataProvider.cxx @@ -77,7 +77,7 @@ namespace InDet { } //RDO container - m_container = new PixelRDO_Container(m_id->wafer_hash_max()); + m_container = new PixelRDO_Container(m_id->wafer_hash_max(), EventContainers::Mode::OfflineFast); m_container ->addRef(); // make sure it is never deleted diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx index f700a0d7d786c2588a790b92a3d5f104e706e84b..e919472bbc15b9f29dc755099f5ced1cca4b79a1 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx @@ -81,7 +81,7 @@ namespace InDet { msg(MSG::INFO) << "Retrieved tool " << m_cablingTool << endmsg; //RDO Container - m_container = new SCT_RDO_Container(m_id->wafer_hash_max()); + m_container = new SCT_RDO_Container(m_id->wafer_hash_max(), EventContainers::Mode::OfflineFast); m_container ->addRef(); // make sure it is never deleted IIncidentSvc* pIncsvc; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigTRTRawDataProvider.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigTRTRawDataProvider.cxx index 04ac7e97435c1bbbbf5f0e54b991f983afa723c3..151170bccb0e1ad040b4c1e85ec02e4213e8474c 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigTRTRawDataProvider.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigTRTRawDataProvider.cxx @@ -80,7 +80,7 @@ namespace InDet { } else msg(MSG::INFO) << "Retrieved service " << m_IdMapping << endmsg; - m_container = new TRT_RDO_Container(m_id->straw_layer_hash_max()); + m_container = new TRT_RDO_Container(m_id->straw_layer_hash_max(), EventContainers::Mode::OfflineFast); m_container ->addRef(); // make sure it is never deleted return StatusCode::SUCCESS; diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt b/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt index 886c20f374d83d94f58e2dea26a5e5e5cad266db..3ae3de73ee1c535822d90037155a1a5b47a1b940 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt @@ -81,7 +81,7 @@ atlas_add_component( InDetPhysValMonitoring atlas_install_headers( InDetPhysValMonitoring ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py share/*.txt ) -atlas_install_runtime( share/*.hdef share/*.xml share/*.xsl ) +atlas_install_runtime( share/*.xml ) atlas_install_runtime( test/InDetPhysValMonitoring_TestConfiguration.xml ) # build postprocessing program diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/AlgTestHistoDefSvc.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/AlgTestHistoDefSvc.h deleted file mode 100644 index d2a5c8a8ab3ae9ea28397fd9ffcaec28dbfcded4..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/AlgTestHistoDefSvc.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef AlgTestHistoDefSvc_h -#define AlgTestHistoDefSvc_h -/** - * @file AlgTestHistoDefSvc.h - * Header file for Algorithm to test histogram definition svc - * @author Shaun Roe - * @date 5 September, 2015 - **/ -//STL -#include <string> - -//Gaudi -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" - -//package includes -#include "IHistogramDefinitionSvc.h" - -class ISvcLocator; -class StatusCode; - -/** - * AlgTestHistoDefSvc exercises the routines of the histogram definition service - **/ -class AlgTestHistoDefSvc:public AthAlgorithm{ - public: - AlgTestHistoDefSvc( const std::string & name, ISvcLocator * pSvcLocator); - ~AlgTestHistoDefSvc(); - // Standard Gaudi functions - StatusCode initialize(); //!< Gaudi initialiser - StatusCode execute(); //!< Gaudi executer - StatusCode finalize(); //!< Gaudi finaliser - - private: - ServiceHandle<IHistogramDefinitionSvc> m_histoDefSvc; -}; -#endif diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h index dcc8eeae3da69f4f21d405c4259f722d729e5fe4..6416676735700e9d4d91b6f45df3c9132b36ddcd 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h @@ -78,8 +78,8 @@ private: void fillTrackCutFlow(const asg::AcceptData& accept); void fillCutFlow(const asg::AcceptData& accept, std::vector<std::string> & names, std::vector<int> & cutFlow); // Get truth particles into a vector, possibly using the pileup from the event - const std::vector<const xAOD::TruthParticle *> getTruthParticles(); - const std::vector<const xAOD::TruthVertex*> getTruthVertices(); + const std::vector<const xAOD::TruthParticle *> getTruthParticles() const; + std::pair<const std::vector<const xAOD::TruthVertex*>, const std::vector<const xAOD::TruthVertex*>> getTruthVertices() const; // const Trk::TrackParameters* getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters, const Trk::MeasurementBase* measurement ); diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ToolTestMonitoringPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ToolTestMonitoringPlots.h deleted file mode 100644 index f7345235d4c0eb66796f96d76c8489771764f0f2..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ToolTestMonitoringPlots.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef INDETPHYSVALMONITORING_ToolTestMonitoringPlots_H -#define INDETPHYSVALMONITORING_ToolTestMonitoringPlots_H -/** - * @file ToolTestMonitoringPlots.h - * header file for class of same name - * @author shaun roe - * @date 14 September 2015 -**/ -//STL includes -#include <string> - -//#gaudi includes -#include "GaudiKernel/ToolHandle.h" - -//local include -#include "AthenaMonitoring/ManagedMonitorToolBase.h" - -//fwd declaration -class InDetTestPlot; - - -/** - * @brief Tool to book and fill test histograms in monitoring framework - */ -class ToolTestMonitoringPlots:public ManagedMonitorToolBase{ -public: - ///Constructor with parameters - ToolTestMonitoringPlots(const std::string & type, const std::string & name, const IInterface* parent); - ///Destructor - virtual ~ToolTestMonitoringPlots(); - /** \name BaseclassMethods Baseclass methods reimplemented - }**/ - //@{ - virtual StatusCode initialize(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); - //@} -private: - ///prevent default construction - ToolTestMonitoringPlots(); - - ///histograms - std::unique_ptr< InDetTestPlot > m_monPlots; -}; - -#endif diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/TestPlots.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/TestPlots.py deleted file mode 100644 index 37111d45489cb4b2a1be49abd9f0a7a363e37575..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/TestPlots.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.AppMgr import ServiceMgr - -from AthenaCommon.AppMgr import theApp - - -#-------------------------------------------------------------- -# Load Geometry -#-------------------------------------------------------------- -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetDescrVersion = "ATLAS-R1-2010-02-00-00" -globalflags.DetGeo="atlas" -globalflags.InputFormat="pool" -globalflags.DataSource="geant4" -print globalflags - - - -import AtlasGeoModel.SetGeometryVersion -import AtlasGeoModel.GeoModelInit - - -#-------------------------------------------------------------- -# Load ReadCalibData Alg and Service -#-------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from InDetPhysValMonitoring.InDetPhysValMonitoringConf import HistogramDefinitionSvc -ToolSvc = ServiceMgr.ToolSvc -ServiceMgr+=HistogramDefinitionSvc() -ServiceMgr.HistogramDefinitionSvc.DefinitionSource="../share/testHDef.xml" -ServiceMgr.HistogramDefinitionSvc.DefinitionFormat="text/xml" - -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -monMan = AthenaMonManager( "PhysValMonManager" ) -monMan.ManualDataTypeSetup = True -monMan.DataType = "monteCarlo" -monMan.Environment = "altprod" -monMan.ManualRunLBSetup = True -monMan.Run = 1 -monMan.LumiBlock = 1 -monMan.FileKey = "TestPlots" -topSequence += monMan - - - -from InDetPhysValMonitoring.InDetPhysValMonitoringConf import ToolTestMonitoringPlots -tool1 = ToolTestMonitoringPlots() - -ToolSvc += tool1 -monMan.AthenaMonTools += [tool1] - - -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -svcMgr.THistSvc.Output += ["TestPlots DATAFILE='TestPlots.root' OPT='RECREATE'"] - - -#-------------------------------------------------------------- -# Event selector settings. Use McEventSelector -#-------------------------------------------------------------- -import AthenaCommon.AtlasUnixGeneratorJob - -theApp.EvtMax = 1 - - -#-------------------------------------------------------------- -# Set output lvl (VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) -#-------------------------------------------------------------- -ServiceMgr.MessageSvc.OutputLevel = INFO -ServiceMgr.HistogramDefinitionSvc.OutputLevel = INFO -ServiceMgr.MessageSvc.infoLimit = 100000 - -#-------------------------------------------------------------- -# Load IOVDbSvc -#-------------------------------------------------------------- -#IOVDbSvc.GlobalTag='OFLCOND-RUN12-SDR-25' -#IOVDbSvc.OutputLevel = DEBUG - diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml index cf1822536e12ae1c5e49058da8d78138b69d6415..e7cc7e5953197a2ae6802f6a9735fc329e83293b 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml @@ -780,6 +780,38 @@ <x title="Number of interactions" n="81" lo="-0.5" hi="80.5"/> <y title="Number of reco vertices" lo="0.0" hi="60.0"/> </h> +<h id="vx_hs_reco_eff" type="TEfficiency" title="HS vertex reconstruction efficiency"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="HS vertex reconstruction efficiency" lo="0.8" hi="1.2"/> +</h> +<h id="vx_hs_sel_eff" type="TEfficiency" title="HS vertex selection efficiency (sum[pt,track^2])"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="HS vertex selection efficiency" lo="0.6" hi="1.2"/> +</h> +<h id="vx_hs_reco_long_reso" type="TProfile" title="Reco Longitudinal Resolution"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="Reco longitudinal resolution [mm]" lo="0.0" hi="1.0"/> +</h> +<h id="vx_hs_reco_trans_reso" type="TProfile" title="Reco Transverse Resolution"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="Reco transverse resolution [mm]" lo="0.0" hi="1.0"/> +</h> +<h id="vx_hs_truth_long_reso_vs_PU" type="TH2" title="Truth Longitudinal Resolution vs. PU (2D)"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="|Reco-truth| longitudinal resolution [mm]" n="20" lo="-0.08" hi="0.08"/> +</h> +<h id="vx_hs_truth_trans_reso_vs_PU" type="TH2" title="Truth Transverse Resolution vs. PU (2D)"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="|Reco-truth| transverse resolution [mm]" n="20" lo="0.0" hi="0.02"/> +</h> +<h id="vx_hs_truth_long_reso" type="TH1" title="Truth Longitudinal Resolution"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="|Reco-truth| longitudinal resolution [mm]" lo="0.0" hi="1.0"/> +</h> +<h id="vx_hs_truth_trans_reso" type="TH1" title="Truth Transverse Resolution"> + <x title="Local PU density [vertices/mm]" n="4" lo="0.0" hi="2.0"/> + <y title="|Reco-truth| transverse resolution [mm]" lo="0.0" hi="1.0"/> +</h> <h id="vx_nTracks" type="TH1F" title="Number of tracks at vertex"> <x title="Number of Tracks" n="150" lo="0" hi="150"/> <y title="Entries"/> diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef deleted file mode 100644 index 56c47fef359a483e28a63fe4c1dd6fa37f0458ad..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef +++ /dev/null @@ -1,411 +0,0 @@ -TH1F num_truthmatch_match "num_truthmatch_match" 10 0 10 "Num. matching truth" "Entries" default -TH1F nparticle "Number of Truth Particles" 200 0 2000 "Num. truth particles" "Entries" default -TH1F ntracksel "Number of Selected Tracks" 200 0 1000 "Num. tracks" "Entries" default -TH1F ntrack "Number of Tracks" 200 0 1000 "Num. tracks" "Entries" default -# -#testing -TH1F 002_Al_N_01 "Test Case: Visible E_{T} (SRoe)" 100 0 100 "Visible E_{T} (sroe)" "Entries" default -TH1F test "Test Case: Visible E_{T} (GeV)" 100 0 100 "Visible E_{T} (GeV)" "Entries" default -TProfile testProfile "Test of TProfile" 20 -50 50 0 200 "#eta" "Entries" default -# -#pT -TH1F recpT "p_{T} of selected rec tracks (in GeV)" 200 0. 200 "p_{T} (GeV/c)" "Entries" default -TH1F recpTLow "p_{T} of selected rec tracks (in GeV)" 200 0. 20 "p_{T} (GeV/c)" "Entries" default -# -#basic plots -TH1F basicd0 "d_{0} of selected tracks (in mm)" 200 -2 2 "d_{0}(mm)" "Entries" default -TH1F basicz0 "z_{0} of selected tracks (in mm)" 120 -300 300 "z_{0}(mm)" "Entries" default -TH1F basicphi "#phi of selected tracks" 100 -4 4 "#phi" "Entries" default -TH1F basiceta "#eta of selected tracks" 100 -5 5 "#eta" "Entries" default -TH1F basictheta "#theta of selected tracks" 100 0 3.1415926 "#theta" "Entries" default -TH1F basicqOverP "q/p of selected tracks (in GeV)" 200 -0.01 0.01 "p_{T}(GeV/c)" "Entries" default -TH1F truthd0 "d_{0} of selected truth (in mm)" 200 -2 2 "d_{0}(mm)" "Entries" default -TH1F truthz0 "z_{0} of selected truth (in mm)" 120 -300 300 "z_{0}(mm)" "Entries" default -TH1F truthphi "#phi of selected truth" 100 -4 4 "#phi" "Entries" default -TH1F trutheta "#eta of selected truth" 100 -5 5 "#theta" "Entries" default -TH1F truththeta "#theta of selected truth" 100 0 3.1415926 "#theta" "Entries" default -TH1F truthqOverP "q/p of selected truth (in GeV)" 200 -0.005 0.005 "p_{T}(GeV/c)" "Entries" default -TH1F truthz0st "z_{0} sin(#theta) of selected truth " 200 -300 300 "p_{T}(GeV/c)" "Entries" default -TH1F truthprodR "Radial distance (r) of truth vtx parameter from origin" 100 0.0 2.0 "(mm)" "Entries" default -TH1F truthprodZ "Longitudinal (z) distance of truth vtx parameter from origin" 100 0 300 "(mm)" "Entries" default - -# -#fakes -TH1F fakepT "p_{T} of selected fake tracks (in GeV)" 200 0. 200 "p_{T}(GeV/c)" "Entries" default -TH1F fakepTlow "p_{T} of selected fake tracks (in GeV)" 200 0 20 "p_{T}(GeV/c)" "Entries" default -TH1F fakephi "#phi of selected fake tracks" 100 -3.1415926 3.1415926 "#phi" "Entries" default -TH1F fakeeta "#eta of selected fake tracks" 100 -5 5 "#eta" "Entries" default -TH1F faked0 "d_{0} of selected fake tracks (in mm)" 200 -5 5 "d_{0}(mm)" "Entries" default -TH1F fakez0 "z_{0} of selected fake tracks (in mm)" 120 -300 300 "z_{0}(mm)" "Entries" default -TProfile track_fakerate_vs_eta "Fraction of tracks with <50% truth match probability" 40 -4.0 4.0 0 1 "#eta" "Fake Rate" default -TProfile track_fakerate_vs_pt "Fraction of tracks with <50% truth match probability" 40 0 200 0 1 "p_{T} [GeV]" "Fake Rate" default -TProfile track_fakerate_vs_phi "Fraction of tracks with <50% truth match probability" 40 -3.1415926 3 .1415926 0 1 "#phi" "Fake Rate" default -TProfile track_fakerate_vs_d0 "Fraction of tracks with <50% truth match probability" 40 -300 300 0 1 "d_{0} [mm]" "Fake Rate" default -TProfile track_fakerate_vs_z0 "Fraction of tracks with <50% truth match probability" 40 -1500 1500 0 1 "z_{0} [mm]" "Fake Rate" default -# - -# -# Extended fakerate plots -# - -# -- "Kinematics" -TProfile track_fakerate_vs_RfirstHit " " 40 0. 300. 0 1 "R of first track measurement [mm]" "Fakerate" default -TProfile track_fakerate_vs_ZfirstHit " " 40 -1500. 1500. 0 1 "z of first track measurement [mm]" "Fak"rate" default - -# -- B-layer -TProfile track_fakerate_vs_nBLayerHits " " 5 -0.5 4.5 0 1 "Number of B-layer hits" "Fakerate" default -TProfile track_fakerate_vs_nBLayerOutliers " " 5 -0.5 4.5 0 1 "Number of B-layer outliers" "Fakerate"default -TProfile track_fakerate_vs_nBLayerSplitHits " " 5 -0.5 4.5 0 1 "Number of B-layer split hits" "Fakerate" default -TProfile track_fakerate_vs_nBLayerSharedHits " " 5 -0.5 4.5 0 1 "Number of B-layer shared hits" "Fakerate" default - -# -- Pixel -TProfile track_fakerate_vs_nPixHits " " 16 -0.5 15.5 0 1 "Number of pixel hits" "Fakerate" default -TProfile track_fakerate_vs_nPixHoles " " 11 -0.5 10.5 0 1 "Number of pixel holes" "Fakerate" default -TProfile track_fakerate_vs_nPixSharedHits " " 11 -0.5 10.5 0 1 "Number of pixel shared hits" "Fakerate" default -TProfile track_fakerate_vs_nPixOutliers " " 11 -0.5 10.5 0 1 "Number of pixel outliers" "Fakerate" default -TProfile track_fakerate_vs_nPixContribLayers " " 6 -0.5 5.5 0 1 "Number of contributing pixel layers" "Fakerate" default -TProfile track_fakerate_vs_nPixSplitHits " " 11 -0.5 10.5 0 1 "Number of pixel split hits" "Fakerate" default -TProfile track_fakerate_vs_nPixGangedHits " " 11 -0.5 10.5 0 1 "Number of pixel ganged hits" "Fakerate" default - -# -- SCT -TProfile track_fakerate_vs_nSCTHits " " 21 -0.5 20.5 0 1 "Number of SCT hits" "Fakerate" default -TProfile track_fakerate_vs_nSCTHoles " " 21 -0.5 20.5 0 1 "Number of SCT holes" "Fakerate" default -TProfile track_fakerate_vs_nSCTDoubleHoles " " 21 -0.5 20.5 0 1 "Number of SCT double holes" "Fakerate" default -TProfile track_fakerate_vs_nSCTSharedHits " " 21 -0.5 20.5 0 1 "Number of SCT shared hits" "Fakerate" default -TProfile track_fakerate_vs_nSCTOutliers " " 21 -0.5 20.5 0 1 "Number of SCT outliers" "Fakerate" default - -# -- Silicon -TProfile track_fakerate_vs_nSiHits " " 21 -0.5 20.5 0 1 "Number of Si hits" "Fakerate" default - -# -- TRT -TProfile track_fakerate_vs_nTRTHits " " 61 -0.5 60.5 0 1 "Number of TRT hits" "Fakerate" default -TProfile track_fakerate_vs_nTRTHighThresholdHits " " 61 -0.5 60.5 0 1 "Number of TRT HT hits" "Fakerate" default -TProfile track_fakerate_vs_nTRTOutliers " " 61 -0.5 60.5 0 1 "Number of TRT outliers" "Fakerate" default -TProfile track_fakerate_vs_nTRTHighThresholdOutliers " " 61 -0.5 60.5 0 1 "Number of TRT HT outliers" "Fakerate" default - -#GOOD eff plots -TProfile trackeff_vs_eta "Fraction of reco-matched truth track" 20 -2.5 2.5 0 2 "#eta" "Efficiency" default -TProfile trackeff_vs_pt "Fraction of reco-matched truth track" 40 0 50 0 2 "Pt (GeV)" "Efficiency" default -TProfile trackeff_vs_phi "Fraction of reco-matched truth track" 100 -3.1415926 3.1415926 0 2 "#phi" "Efficiency" default -TProfile trackeff_vs_d0 "Fraction of reco-matched truth track" 100 -25 25 0 2 "d0" "Efficiency" default -TProfile trackeff_vs_z0 "Fraction of reco-matched truth track" 100 -250 250 0 2 "z0" "Efficiency" default -TProfile trackeff_vs_R "Fraction of reco-matched truth track" 100 0 50 0 2 "R" "Efficiency" default -TProfile trackeff_vs_Z "Fraction of reco-matched truth track" 100 -350 350 0 2 "Z" "Efficiency" default -TProfile trackeff_vs_prodR "Track Efficiency vs Production Vertex Radius" 100 0 1500 0 2 "prod_R" "Efficiency" default -TProfile trackeff_vs_prodZ "Track Efficiency vs Production Vertex Z" 100 0 2000 0 2 "prod_Z" "Efficiency" default -TProfile low_Pt_lepton_frac "Fraction of Primary Leptons with Pt below 3 GeV" 100 0 1500 0 2 "prod_R" "Efficiency" default - -#layer-by-layer efficiencies -TEfficiency eff_hit_vs_eta_l0pix_barrel "Cluster Efficiency: Pixel Barrel IBL" 10 0 2.5 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_pix_barrel "Cluster Efficiency: Pixel Barrel" 10 0 2.5 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_pix_endcap "Cluster Efficiency: Pixel Endcap" 4 1.5 2.5 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_sct_barrel "Cluster Efficiency: SCT Barrel" 7 0 1.75 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_sct_endcap "Cluster Efficiency: SCT Endcap" 6 1 2.5 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_trt_barrel "Cluster Efficiency: TRT Barrel" 5 0 1.25 0 2 "#eta" "Cluster Efficiency" default -TEfficiency eff_hit_vs_eta_trt_endcap "Cluster Efficiency: TRT Endcap" 6 0.75 2.25 0 2 "#eta" "Cluster Efficiency" default - -#vertices -TH1F vx_x "X position of vertex" 200 -1.0 1.0 "X (mm)" "Entries" default -TH1F vx_y "Y position of vertex" 200 -1.0 1.0 "Y (mm)" "Entries" default -TH1F vx_z "Z position of vertex" 100 -300.0 300.0 "Z (mm)" "Entries" default -TH1F vx_err_x "X position error of vertex" 100 0.0 0.2 "#sigma(X) (mm)" "Entries" default -TH1F vx_err_y "Y position error of vertex" 100 0.0 0.2 "#sigma(Y) (mm)" "Entries" default -TH1F vx_err_z "Z position error of vertex" 100 0.0 1.0 "#sigma(Z) (mm)" "Entries" default -TH1F vx_chi2_over_ndf "vertex #chi^2 / ndf" 50 0 10. "#chi^{2}/ndf" "Entries" default -TH1F vx_type "Vertex type" 7 0 7 "Vertex type" "Entries" default -TH1F vx_type_truth "Vertex Truth-Matched type" 5 -0.5 4.5 "Vertex Truth-Matched type" "Vertex Truth-Matched type" "Entries" default -TH1F vx_hs_classification 5 -0.5 4.5 "Event hardscatter vertex classification" "Hardscatter classification" "Entries" default -TProfile vx_nReco_vs_nTruth_inclusive "Number of reco vertices (INCLUSIVE) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_matched "Number of reco vertices (MATCHED) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_merged "Number of reco vertices (MERGED) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_split "Number of reco vertices (SPLIT) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_fake "Number of reco vertices (FAKE) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_dummy "Number of reco vertices (DUMMY) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_clean "Number of reco vertices (CLEAN) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_lowpu "Number of reco vertices (LOWPU) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_highpu "Number of reco vertices (HIGHPU) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_hssplit "Number of reco vertices (HSSPLIT) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TProfile vx_nReco_vs_nTruth_none "Number of reco vertices (NONE) vs Number of interactions" 81 -0.5 80.5 0.0 60.0 "Number of interactions" "Number of reco vertices" default -TH1F vx_nTracks "Number of tracks at vertex" 150 0 150 "Number of Tracks" "Entries" default -TH1F vx_track_weights "Weights of tracks at vertex" 100 0. 10.0 "Weight" "Entries" default -TH1F vx_track_pt "Tracks at vertex p_{T}" 100 0 20. "p_{T} (GeV)" "Entries" default -TH1F vx_track_eta "Tracks at vertex #eta" 100 -2.7 2.7 "#eta" "Entries" default -TH1F vx_track_nSiHits "Tracks at vertex number of Silicon Hits" 15 5 20 "Num. Si Hits" "Entries" default -TH1F vx_track_nSiHoles "Tracks at vertex number of Silicon Holes" 5 0 5 "Num. Si Holes" "Entries" default -TH1F vx_track_d0 "Tracks at vertex d_{0}" 100 -2.0 2.0 "d_{0} (mm)" "Entries" default -TH1F vx_track_err_d0 "Tracks at vertex d_{0} error" 50 0.0 1.0 "#sigma(d_{0}) (mm)" "Entries" default -TH1F vx_track_z0 "Tracks at vertex z_{0} - z_{0}^{vertex}" 100 -5.0 5.0 "z_{0}-z_{0}^{vertex} (mm)" "Entries" default -TH1F vx_track_err_z0 "Tracks at vertex z_{0} error" 50 0.0 5.0 "#sigma(z_{0}) (mm)" "Entries" default -# -# Bad Match Rate (BMR) plots -TProfile BadMatchRate "Fraction of Tracks with < 50.1% Truth Matching Probability" 20 -2.5 2.5 0 2 "x" "Bad Match Rate" default -TProfile BadMatchRate_vs_logpt "Fraction of Tracks with < 50.1% TMP vs Log(Pt)" 10 -0.5 2 0 2 "x" "Bad Match Rate vs Log(Pt)" default - -TProfile ReallyFakeRate "Fraction of Tracks with < 50.0% Truth Matching Probability" 20 -2.5 2.5 0 2 "x" "Really Fake Rate" default -# - -# Dummy Plots -TH2 primary_photon_eta_vs_conversion_radius "Primary Photon #eta vs Conversion Radius" 100 0 1500 20 -2.5 2.5 "Conversion Radius [mm]" "#eta" default -TH2 primary_photon_pt_vs_decay_radius "Primary Photon p_{T} vs Decay Radius" 100 0 1500 100 0 500 "Decay Radius [mm]" "p_{T} (GeV)" default -TH1F primary_photon_pt "Primary Photon p_{T}" 100 0 500 "p_{T} (GeV)" "Entries" default -TH2 brem_photon_eta_vs_radius_of_conversion "Brem Photon #eta vs Radius of Conversion" 100 0 1500 20 -2.5 2.5 "Radius of Conversion [mm]" "#eta" default -TH2 brem_photon_pt_vs_radius_of_origin_of_conversion "Brem Photon p_{T} vs Radius of Origin of Conversion" 100 0 1500 100 0 500 "Radius of Origin of Conversion [mm]" "p_{T} (GeV)" default -TH1F lepton_disappearance_radius "Radius at which electrons and positrons from the primary disappear" 100 0 1500 "Radius of Disappearance [mm]" "Entries" default -TH1F nOut_of_lepdeath "Number of Particles out of the electron/positron endpoint" 6 0 5 "Number of Particles" "Entries" default -TH2 brem_spectrum "log of the Energy of Brem Photons vs Radius of Emission" 100 0 1500 100 -3 3 "Radius of Emission [mm]" "log(Energy (GeV))" default -TH2 energy_remaining "Fraction of electron/positron energy left at ECal vs production radius" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default -TH2 energy_remaining_vs_eta "Fraction of electron/positron energy left at ECal vs Initial #eta" 20 -2.5 2.5 100 0 1.25 "#eta" "Fraction of Energy Remaining" default -TH2 energy_remaining_vs_prodR_TRT_barrel "Fraction of electron/positron energy left at ECal vs production radius (0 < |#eta| < 0.625)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default -TH2 energy_remaining_vs_prodR_type_A_endcap "Fraction of electron/positron energy left at ECal vs production radius (1.070 < |#eta| < 1.304)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default -TH2 energy_remaining_vs_prodR_type_A_and_B "Fraction of electron/positron energy left at ECal vs production radius (1.304 < |#eta| < 1.752)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default -TH2 energy_remaining_vs_prodR_type_B_endcap "Fraction of electron/positron energy left at ECal vs production radius (1.752 < |#eta| < 2.0)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default -TH2 truthMatchProbability_vs_delta_R "Truth Matching Probability of electron/positron vs #DeltaR" 50 0 1.0 100 0 1.0 "#DeltaR" "Truth Matching Probability" default -TH1 minimum_delta_R "Minimum #DeltaR for primary conversions within 100 mm of the origin" 50 0 1.0 "#DeltaR" "Entries" default - -# Track Parameter Resolution Plots -#Track Parameter TH2s vs eta -TH2 res_d0_vs_eta "d_{0}: deviation vs #eta" 20 -2.5 2.5 2000 -1.0 1.0 "#eta" "d_{0}^{rec} - d_{0}^{tru}" default -TH2 res_z0_vs_eta "z_{0}: deviation vs #eta" 20 -2.5 2.5 200 -1.5 1.5 "#eta" "z_{0}^{rec} - z_{0}^{tru}" default -TH2 res_phi_vs_eta "#phi: deviation vs #eta" 20 -2.5 2.5 3000 -0.03 0.03 "#eta" "#phi^{rec} - #phi^{tru}" default -TH2 res_theta_vs_eta "#theta: deviation vs #eta" 20 -2.5 2.5 2000 -0.1 0.1 "#eta" "#theta^{rec} - #theta^{tru}" default -TH2 res_z0*sin(theta)_vs_eta "z_{0}*sin(#theta): deviation vs #eta" 20 -2.5 2.5 200 -1.5 1.5 "#eta" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" default -TH2 res_qopt_vs_eta "qopt: deviation vs #eta" 20 -2.5 2.5 200 -0.4 0.4 "#eta" "(q/pt)^{rec} - (q/pt)^{tru}" default - -#Track Parameter Means vs eta -TH1F resmean_d0_vs_eta "d_{0} Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "d_{0}^{rec} - d_{0}^{tru}" default -TH1F resmean_z0_vs_eta "z_{0} Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "z_{0}^{rec} - z_{0}^{tru}" default -TH1F resmean_phi_vs_eta "#phi Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "#phi^{rec} - #phi^{tru}" default -TH1F resmean_theta_vs_eta "#theta Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "#theta^{rec} - #theta^{tru}" default -TH1F resmean_z0*sin(theta)_vs_eta "z_{0}*sin(#theta) Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" default -TH1F resmean_qopt_vs_eta "q/pt Track Measurement Bias vs #eta" 20 -2.5 2.5 "#eta" "(q/pt)^{rec} - (q/pt)^{tru}" default - -#Track Parameter Resolutions vs eta -TH1F reswidth_d0_vs_eta "d_{0} Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(d_{0}^{rec} - d_{0}^{tru})" default -TH1F reswidth_z0_vs_eta "z_{0} Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(z_{0}^{rec} - z_{0}^{tru})" default -TH1F reswidth_phi_vs_eta "#phi Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(#phi^{rec} - #phi^{tru})" default -TH1F reswidth_theta_vs_eta "#theta Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(#theta^{rec} - #theta^{tru})" default -TH1F reswidth_z0*sin(theta)_vs_eta "z_{0}*sin(#theta) Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})" default -TH1F reswidth_qopt_vs_eta "q/pt Track Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma((q/pt)^{rec} - (q/pt)^{tru})" default - -#Track Parameter TH2s vs log(Pt) -TH2 res_d0_vs_pt "d_{0}: deviation vs log(Pt)" 10 -0.5 2.0 2000 -1.0 1.0 "log(Pt) (GeV)" "d_{0}^{rec} - d_{0}^{tru}" default -TH2 res_z0_vs_pt "z_{0}: deviation vs log(Pt)" 10 -0.5 2.0 200 -1.5 1.5 "log(Pt) (GeV)" "z_{0}^{rec} - z_{0}^{tru}" default -TH2 res_phi_vs_pt "#phi: deviation vs log(Pt)" 10 -0.5 2.0 3000 -0.03 0.03 "log(Pt) (GeV)" "#phi^{rec} - #phi^{tru}" default -TH2 res_theta_vs_pt "#theta: deviation vs log(Pt)" 10 -0.5 2.0 2000 -0.1 0.1 "log(Pt) (GeV)" "#theta^{rec} - #theta^{tru}" default -TH2 res_z0*sin(theta)_vs_pt "z_{0}*sin(#theta): deviation vs log(Pt)" 10 -0.5 2.0 200 -1.5 1.5 "log(Pt) (GeV)" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" default -TH2 res_qopt_vs_pt "qopt: deviation vs log(Pt)" 10 -0.5 2.0 200 -0.4 0.4 "log(Pt) (GeV)" "(q/pt)^{rec} - (q/pt)^{tru}" default - -#Track Parameter Means vs log(Pt) -TH1F resmean_d0_vs_pt "d_{0} Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "d_{0}^{rec} - d_{0}^{tru}" default -TH1F resmean_z0_vs_pt "z_{0} Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "z_{0}^{rec} - z_{0}^{tru}" default -TH1F resmean_phi_vs_pt "#phi Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#phi^{rec} - #phi^{tru}" default -TH1F resmean_theta_vs_pt "#theta Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#theta^{rec} - #theta^{tru}" default -TH1F resmean_z0*sin(theta)_vs_pt "z_{0}*sin(#theta) Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" default -TH1F resmean_qopt_vs_pt "q/pt Track Measurement Bias vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "(q/pt)^{rec} - (q/pt)^{tru}" default - -#Track Parameter Resolutions vs log(Pt) -TH1F reswidth_d0_vs_pt "d_{0} Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma(d_{0}^{rec} - d_{0}^{tru})" default -TH1F reswidth_z0_vs_pt "z_{0} Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma(z_{0}^{rec} - z_{0}^{tru})" default -TH1F reswidth_phi_vs_pt "#phi Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma(#phi^{rec} - #phi^{tru})" default -TH1F reswidth_theta_vs_pt "#theta Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma(#theta^{rec} - #theta^{tru})" default -TH1F reswidth_z0*sin(theta)_vs_pt "z_{0}*sin(#theta) Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})" default -TH1F reswidth_qopt_vs_pt "q/pt Track Resolution vs log(Pt)" 10 -0.5 2.0 "log(Pt) (GeV)" "#sigma((q/pt)^{rec} - (q/pt)^{tru})" default - -#Basic Track Pulls -TH1F pull_d0 "Pull of d_{0}" 200 -5.0 5.0 "pull" "counts" default -TH1F pull_z0 "Pull of z_{0}" 200 -5.0 5.0 "pull" "counts" default -TH1F pull_phi "Pull of #phi" 200 -5.0 5.0 "pull" "counts" default -TH1F pull_theta "Pull of #theta" 200 -5.0 5.0 "pull" "counts" default -TH1F pull_z0*sin(theta) "Pull of z_{0}*sin(#theta)" 200 -5.0 5.0 "pull" "counts" default -TH1F pull_qopt "Pull of (q/pt)" 200 -5.0 5.0 "pull" "counts" default - -#Track Pull TH2s vs eta -TH2 pull_d0_vs_eta "d_{0}: Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "d_{0}^{rec} - d_{0}^{tru})/#sigma_d_0" default -TH2 pull_z0_vs_eta "z_{0}: Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "z_{0}^{rec} - z_{0}^{tru})/#sigma_z_0" default -TH2 pull_phi_vs_eta "#phi: Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "#phi^{rec} - #phi^{tru})/#sigma_#phi" default -TH2 pull_theta_vs_eta "#theta: Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "#theta^{rec} - #theta^{tru})/#sigma_#theta" default -TH2 pull_z0*sin(theta)_vs_eta "z_{0}*sin(#theta): Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})/#sigma_z_0*sin(#theta)" default -TH2 pull_qopt_vs_eta "q/pt: Pull vs #eta" 20 -2.5 2.5 200 -5.0 5.0 "#eta" "(q/pt)^{rec} - (q/pt)^{tru})/#sigma_(q/pt)" default - -#Track Pull Means vs eta -TH1F pullmean_d0_vs_eta "d_{0} Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "d_{0}^{rec} - d_{0}^{tru}" default -TH1F pullmean_z0_vs_eta "z_{0} Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "z_{0}^{rec} - z_{0}^{tru}" default -TH1F pullmean_phi_vs_eta "#phi Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "#phi^{rec} - #phi^{tru}" default -TH1F pullmean_theta_vs_eta "#theta Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "#theta^{rec} - #theta^{tru}" default -TH1F pullmean_z0*sin(theta)_vs_eta "z_{0}*sin(#theta) Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" default -TH1F pullmean_qopt_vs_eta "q/pt Track Pull Mean vs #eta" 20 -2.5 2.5 "#eta" "(q/pt)^{rec} - (q/pt)^{tru}" default - -#Track Pull Resolutions vs eta -TH1F pullwidth_d0_vs_eta "d_{0} Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(d_{0}^{rec} - d_{0}^{tru})" default -TH1F pullwidth_z0_vs_eta "z_{0} Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(z_{0}^{rec} - z_{0}^{tru})" default -TH1F pullwidth_phi_vs_eta "#phi Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(#phi^{rec} - #phi^{tru})" default -TH1F pullwidth_theta_vs_eta "#theta Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(#theta^{rec} - #theta^{tru})" default -TH1F pullwidth_z0*sin(theta)_vs_eta "z_{0}*sin(#theta) Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})" default -TH1F pullwidth_qopt_vs_eta "q/pt Track Pull Resolution vs #eta" 20 -2.5 2.5 "#eta" "#sigma((q/pt)^{rec} - (q/pt)^{tru})" default - -# -#hitResidual plots -#x residuals - -#TH1F residualx_pixel_barrel "Residual: Pixel Barrel X" 120 -3000 3000 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_pixel_barrel "Residual: Pixel Barrel X" 120 -50 50 "x residual(#mum)" "Entries" default - -TH1F residualx_pixel_barrel_1hit "Residual: Pixel Barrel X 1 hit" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_pixel_barrel_2ormorehits "Residual: Pixel Barrel X >=2 hits" 120 -50 50 "x residual(#mum)" "Entries" default - -#TH1F residualx_sct_barrel "Residual: SCT Barrel X" 120 -50 50 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_sct_barrel "Residual: SCT Barrel X" 120 -300 300 "x residual(#mum)" "Entries" default - -TH1F residualx_sct_barrel_1hit "Residual: SCT Barrel X 1 hit" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_sct_barrel_2ormorehits "Residual: SCT Barrel X >=2 hits" 120 -50 50 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_barrel "Residual: B-Layer Barrel X" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_barrel_1hit "Residual: B-Layer Barrel X 1 hit" 120 -50 50 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_barrel_2ormorehits "Residual: B-Layer Barrel X >=2 hits" 120 -50 50 "x residual(#mum)" "Entries" default - -#TH1F residualx_trt_barrel "Residual: TRT Barrel X" 120 -3000 3000 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_trt_barrel "Residual: TRT Barrel X" 200 -500 500 "x residual(#mum)" "Entries" default - -#endcaps - -#TH1F residualx_pixel_endcap "Residual: Pixel Endcap X" 120 -3000 3000 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_pixel_endcap "Residual: Pixel Endcap X" 120 -50 50 "x residual(#mum)" "Entries" default - -TH1F residualx_pixel_endcap_1hit "Residual: Pixel Endcap X 1 hit" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_pixel_endcap_2ormorehits "Residual: Pixel Endcap X >=2 hits" 120 -50 50 "x residual(#mum)" "Entries" default - -#TH1F residualx_sct_endcap "Residual: SCT Endcap X" 120 -3000 3000 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_sct_endcap "Residual: SCT Endcap X" 140 -70 70 "x residual(#mum)" "Entries" default - -TH1F residualx_sct_endcap_1hit "Residual: SCT Endcap X 1 hit" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_sct_endcap_2ormorehits "Residual: SCT Endcap X >=2 hits" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_endcap "Residual: B-Layer Endcap X" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_endcap_1hit "Residual: B-Layer Endcap X 1 hit" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_blayer_endcap_2ormorehits "Residual: B-Layer Endcap X >=2 hits" 120 -3000 3000 "x residual(#mum)" "Entries" default - -#TH1F residualx_trt_endcap "Residual: TRT Endcap X" 120 -50 50 "x residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualx_trt_endcap "Residual: TRT Endcap X" 200 -500 500 "x residual(#mum)" "Entries" default - -TH1F residualx_dbm_neg "Residual: DBM -side X" 120 -3000 3000 "x residual(#mum)" "Entries" default -TH1F residualx_dbm_pos "Residual: DBM +side X" 120 -3000 3000 "x residual(#mum)" "Entries" default -#y residuals - -#TH1F residualy_pixel_barrel "Residual: Pixel Barrel Y" 120 -50 50 "y residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualy_pixel_barrel "Residual: Pixel Barrel Y" 120 -300 300 "y residual(#mum)" "Entries" default - -TH1F residualy_pixel_barrel_1hit "Residual: Pixel Barrel Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_pixel_barrel_2ormorehits "Residual: Pixel Barrel Y >=2 hits" 120 -50 50 "x residual(#mum)" "Entries" default -TH1F residualy_sct_barrel "Residual: SCT Barrel Y" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_sct_barrel_1hit "Residual: SCT Barrel Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_sct_barrel_2ormorehits "Residual: SCT Barrel Y >=2 hits" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_barrel "Residual: B-Layer Barrel Y" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_barrel_1hit "Residual: B-Layer Barrel Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_barrel_2ormorehits "Residual: B-Layer Barrel Y >=2 hits" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_trt_barrel "Residual: TRT Barrel Y" 120 0 2500 "y residual(#mum)" "Entries" default - -#endcaps - -#TH1F residualy_pixel_endcap "Residual: Pixel Endcap Y" 120 -50 50 "y residual(#mum)" "Entries" default #ORIGINAL LINE -TH1F residualy_pixel_endcap "Residual: Pixel Endcap Y" 120 -300 300 "y residual(#mum)" "Entries" default - -TH1F residualy_pixel_endcap_1hit "Residual: Pixel Endcap Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_pixel_endcap_2ormorehits "Residual: Pixel Endcap Y >=2 hits" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_sct_endcap "Residual: SCT Endcap Y" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_sct_endcap_1hit "Residual: SCT Endcap Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_sct_endcap_2ormorehits "Residual: SCT Endcap Y >=2 hits" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_endcap "Residual: B-Layer Endcap Y" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_endcap_1hit "Residual: B-Layer Endcap Y 1 hit" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_blayer_endcap_2ormorehits "Residual: B-Layer Endcap Y >=2 hits" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_trt_endcap "Residual: TRT Endcap Y" 120 -50 50 "y residual(#mum)" "Entries" default -TH1F residualy_dbm_neg "Residual: DBM -side Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualy_dbm_pos "Residual: DBM +side Y" 10 -5 5 "y residual(#mum)" "Entries" default -#pulls -#barrel, x -TH1F residualpullx_blayer_barrel "Residualpull: B-Layer Barrel X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_pixel_barrel "Residualpull: Pixel Barrel X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_sct_barrel "Residualpull: SCT Barrel X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_trt_barrel "Residualpull: TRT Barrel X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_dbm_barrel "Residualpull: DBM -side X" 10 -5 5 "x residual(#mum)" "Entries" default -#endcap, x -TH1F residualpullx_blayer_endcap "Residualpull: B-Layer Endcap X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_pixel_endcap "Residualpull: Pixel Endcap X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_sct_endcap "Residualpull: SCT Endcap X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_trt_endcap "Residualpull: TRT Endcap X" 10 -5 5 "x residual(#mum)" "Entries" default -TH1F residualpullx_dbm_endcap "Residualpull: DBM +side X" 10 -5 5 "x residual(#mum)" "Entries" default -#barrel, y -TH1F residualpully_blayer_barrel "Residualpull: B-Layer Barrel Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_pixel_barrel "Residualpull: Pixel Barrel Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_sct_barrel "Residualpull: SCT Barrel Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_trt_barrel "Residualpull: TRT Barrel Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_dbm_barrel "Residualpull: DBM -side Y" 10 -5 5 "y residual(#mum)" "Entries" default -#endcap,y -TH1F residualpully_blayer_endcap "Residualpull: B-Layer Endcap Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_pixel_endcap "Residualpull: Pixel Endcap Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_sct_endcap "Residualpull: SCT Endcap Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_trt_endcap "Residualpull: TRT Endcap Y" 10 -5 5 "y residual(#mum)" "Entries" default -TH1F residualpully_dbm_endcap "Residualpull: DBM +side Y" 10 -5 5 "y residual(#mum)" "Entries" default -# -#TrackInJets -TH1F recInJetpT "p_{T} of selected rec tracks in jets(in GeV)" 200 0. 200 "p_{T}(GeV/c)" "Entries" default -TH1F nTrackInJet "Number of Tracks in Jet" 50 0. 50 "N Tracks" "Entries" "default" -TH1F sumPtinJet "Sum p_{T} of Tracks in Jet" 25 0 500 "sum p_{T}(GeV/c)" "Entries" default -TH1F fracPtInJet "Sum p_{T} of Tracks over jet p_{T}" 60 0 3 "sum Track p_{T}/jet p_{T}" "Entries" default - -#spectrum plots -TH1F nSCTHits "# SCT hits" 20 0. 20 "# SCT Hits" "Entries" default -TH1F nPixHits "# Pix hits" 20 0. 20 "# Pix Hits" "Entries" default -TH1F nTotHits "# Total hits" 20 0. 20 "# Totat Hits" "Entries" default -TH1F nSCTDeadSensors "# SCT DeadSensors" 20 0. 20 "# SCT DeadSensors" "Entries" default -TH1F nPixDeadSensors "# Pix DeadSensors" 20 0. 20 "# Pix DeadSensors" "Entries" default -TH1F nTotDeadSensors "# Total DeadSensors" 20 0. 20 "# Total DeadSensors" "Entries" default -TProfile nSCTHits_vs_eta "# SCT hits vs Eta" 80 -4 4 0 20 "#eta" "# SCT Hits" default -TProfile nPixHits_vs_eta "# Pix hits vs Eta" 80 -4 4 0 20 "#eta" "# Pix Hits" default -TProfile nTotHits_vs_eta "# total hits vs Eta" 80 -4 4 0 20 "#eta" "# total Hits" default -TProfile nSCTDeadSensors_vs_eta "# SCT deadsensors vs Eta" 80 -4 4 0 20 "#eta" "# SCT deadsensors" default -TProfile nPixDeadSensors_vs_eta "# pix deadsensors vs Eta" 80 -4 4 0 20 "#eta" "# pix deadsensors" default -TProfile nTotDeadSensors_vs_eta "# total deadsensors vs Eta" 80 -4 4 0 20 "#eta" "# total deadsensors" default -TH1F recoMatchProbabilitySpectrum "truth match probability spectrum" 40 0. 1 "truth match probability" "Entries" default -TH1F recoEtaSpectrum "reco eta spectrum" 80 -4 4 "#eta" "Entries" default -TH1F recoPhiSpectrum "reco phi spectrum" 60 -3 3 "#phi" "Entries" default -TH1F recoPtSpectrum "reco pt spectrum" 100 0. 100 "pt (GeV/c)" "Entries" default -TH1F truthEtaSpectrum "truth eta spectrum" 80 -4 4 "#eta" "Entries" default -TH1F truthPhiSpectrum "truth phi spectrum" 60 -3 3 "#phi" "Entries" default -TH1F truthPtSpectrum "truth pt spectrum" 100 0. 100 "pt (GeV/c)" "Entries" default - -#HitContent plots -TProfile HitContent_vs_eta_NBlayerHits "Number of B-Layer clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of B-layer clusters>" default -TProfile HitContent_vs_eta_NPixelHits "Number of Pixel clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel clusters>" default -TProfile HitContent_vs_eta_DBMHitsNeg "Number of DBM Clusters" 20 -3.8 -2.5 0 100 "#eta" "<Number of DBM clusters, - side>" default -TProfile HitContent_vs_eta_DBMHitsPos "Number of DBM Clusters" 20 2.5 3.8 0 100 "#eta" "<Number of DBM Clusters, + side>" default -TProfile HitContent_vs_eta_NPixelHoles "Number of Pixel Holes" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Holes>" default -TProfile HitContent_vs_eta_NSCTHits "Number of SCT Clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of SCT Clusters>" default -TProfile HitContent_vs_eta_NSCTHoles "Number of SCT Holes" 20 -2.5 2.5 0 100 "#eta" "<Number of SCT Holes>" default -TProfile HitContent_vs_eta_NTRTHits "Number of TRT Clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of TRT Hits>" default -TProfile HitContent_vs_eta_NTRTHighThresholdHits "Number of TRT high threshold clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of High Thresh TRT Hits>" default -TProfile HitContent_vs_eta_NBlayerOutliers "Number of B-layer outliers" 20 -2.5 2.5 0 100 "#eta" "<Number of B-layer Outliers>" default -TProfile HitContent_vs_eta_NBlayerSharedHits "Number of shared B-layer clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of B-layer Shared Hits>" default -TProfile HitContent_vs_eta_NBLayerSplitHits "Number of split B-layer clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of B-layer Split Hits>" default -TProfile HitContent_vs_eta_NPixelOutliers "Number of Pixel outliers" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Outliers>" default -TProfile HitContent_vs_eta_NPixelContribLayers "Number of contributed Pixel layers" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Layers>" default -TProfile HitContent_vs_eta_NPixelSharedHits "Number of shared Pixel clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Shared Hits>" default -TProfile HitContent_vs_eta_NPixelSplitHits "Number of split Pixel clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Split Hits>" default -TProfile HitContent_vs_eta_NPixelGangedHits "Number of ganged Pixel clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of Pixel Ganged Hits>" default -TProfile HitContent_vs_eta_NPixelGangedHitsFlaggedFakes "Number of ganged flagged fake Pixel hits vs eta" 20 -2.5 2.5 0 2 "#eta" "Flagged Fakes in Pixel" default -TProfile HitContent_vs_eta_NSCTOutliers "Number of SCT Outliers" 20 -2.5 2.5 0 100 "#eta" "<Number of SCT Outliers>" default -TProfile HitContent_vs_eta_NSCTDoubleHoles "Number of SCT double holes" 20 -2.5 2.5 0 100 "#eta" "<Number of SCT Double Holes>" default -TProfile HitContent_vs_eta_NSCTSharedHits "Number of SCT Shared clusters" 20 -2.5 2.5 0 100 "#eta" "<Number of SCT Shared Hits>" default -TProfile HitContent_vs_eta_NTRTOutliers "Number of TRT outliers" 20 -2.5 2.5 0 100 "#eta" "<Number of TRT Outliers>" default -TProfile HitContent_vs_eta_NTRTHighThresholdOutliers "Number of TRT High Threshold outliers" 20 -2.5 2.5 0 100 "#eta" "<Number of TRT High Thresh Outliers>" default - -#trackinjet efficiencies -TProfile trackinjeteff_vs_eta "Track in jets efficiency vs #eta" 20 -2.5 2.5 0 2.0 "#eta" "Efficiency" default -TProfile trackinjeteff_vs_phi "Track in jets efficiency vs #phi" 24 180 180 0 2.0 "#phi" "Efficiency" default -TProfile trackinjeteff_vs_pt "Track in jets efficiency vs p_{T} for |#eta| < 2.5 (Det. Paper def.)" 25 0 50 0 2.0 "p_{T} (GeV/c)" "Efficiency" default -TProfile trackinjeteff_vs_dr "Track in jets efficiency vs #DeltaR for |#eta| < 2.5 (Det. Paper def.)" 10 0 0.4 0 2.0 "#DeltaR" "Efficiency" default -TProfile trackinjeteff_vs_dr_lt_j50 "Track in jets efficiency vs #DeltaR for |#eta| < 2.5 (E_{T}(jet) < 50 GeV)" 10 0 0.2 0 2.0 "#DeltaR" "Efficiency" default -TProfile trackinjeteff_vs_dr_gr_j100 "Track in jets efficiency vs #DeltaR for |#eta| < 2.5 (E_{T}(jet) > 100 GeV)" 10 0 0.2 0 2.0 "#DeltaR" "Efficiency" default -TProfile trackinjeteff_vs_jetet "Track in jets efficiency vs jet E_{T} for |#eta| < 2.5 " 10 0 250 0 2.0 "E_{jet} (GeV)" "Efficiency" default - - -#trackinjet bad match rates -TProfile trackinjet_badmatchrate_vs_dr_gr_j100 "Fraction of tracks with < 80% truth matching probability in Jets with E_{T} > 100 GeV" 10 0 0.2 0 2 "#DeltaR" "Bad Match Rate" default - diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/postInclude.RDOAnalysis.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/postInclude.RDOAnalysis.py new file mode 100644 index 0000000000000000000000000000000000000000..49dad4570c36a4b98feb57fa830c0d693dedc1bf --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/postInclude.RDOAnalysis.py @@ -0,0 +1,20 @@ +from RDOAnalysis.RDOAnalysisConf import PixelRDOAnalysis +topSequence += PixelRDOAnalysis() +PixelRDOAnalysis = PixelRDOAnalysis() +PixelRDOAnalysis.NtupleFileName = '/PixelRDOAnalysis/' +PixelRDOAnalysis.HistPath = '/PixelRDOAnalysis/' + +from RDOAnalysis.RDOAnalysisConf import SCT_RDOAnalysis +topSequence += SCT_RDOAnalysis() +SCT_RDOAnalysis = SCT_RDOAnalysis() +SCT_RDOAnalysis.NtupleFileName = '/SCT_RDOAnalysis/' +SCT_RDOAnalysis.HistPath = '/SCT_RDOAnalysis/' + +#---------------------------- +# Histogram and Tree Service +#---------------------------- +if not hasattr(ServiceMgr, 'THistSvc'): + from GaudiSvc.GaudiSvcConf import THistSvc + ServiceMgr += THistSvc() +ServiceMgr.THistSvc.Output += ["PixelRDOAnalysis DATAFILE='PixelRDOAnalysis.root' OPT='RECREATE'"] +ServiceMgr.THistSvc.Output += ["SCT_RDOAnalysis DATAFILE='SCT_RDOAnalysis.root' OPT='RECREATE'"] diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AlgTestHistoDefSvc.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AlgTestHistoDefSvc.cxx deleted file mode 100644 index ba07d88e2b4432658450f39644b1cf9efbd5d045..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AlgTestHistoDefSvc.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file AlgTestHistoDefSvc.cxx - * Implementation file for HistogramDefinitionSvc service test algorithm - * @author Shaun Roe - * @date 5 September, 2015 - **/ - -// STL -// to access environment - - -// Gaudi -#include "GaudiKernel/StatusCode.h" -#include "InDetPhysValMonitoring/HistogramDefinitionSvc.h" -// Athena -// Package -#include "InDetPhysValMonitoring/AlgTestHistoDefSvc.h" - - - -using namespace std; - -AlgTestHistoDefSvc::AlgTestHistoDefSvc (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, - pSvcLocator), - m_histoDefSvc("HistogramDefinitionSvc", name) { // nop -} - -AlgTestHistoDefSvc::~AlgTestHistoDefSvc() { - // nop -} - -StatusCode -AlgTestHistoDefSvc::initialize() { - ATH_CHECK(m_histoDefSvc.retrieve()); - ATH_MSG_INFO("Test algorithm for HistogramDefinitionSvc"); - // - ATH_MSG_INFO("Printing histogram definition for 002_Al_N_01"); - std::string definition = m_histoDefSvc->definition("002_Al_N_01", "").str(); - ATH_MSG_INFO("Titles : " << m_histoDefSvc->definition("002_Al_N_01", "").allTitles); - ATH_MSG_INFO(definition); - // - ATH_MSG_INFO("Printing histogram definition for nparticles"); - definition = m_histoDefSvc->definition("nparticles", "").str(); - ATH_MSG_INFO(definition); - // - ATH_MSG_INFO("Printing histogram definition for testProfile"); - definition = m_histoDefSvc->definition("testProfile", "").str(); - ATH_MSG_INFO(definition); - // - ATH_MSG_INFO("Printing histogram definition for test2D"); - definition = m_histoDefSvc->definition("test2D", "").str(); - ATH_MSG_INFO(definition); - // - ATH_MSG_INFO("Printing histogram definition for testEfficiency"); - definition = m_histoDefSvc->definition("testEfficiency", "").str(); - ATH_MSG_INFO(definition); - ATH_MSG_INFO("Printing definition for inclusion test"); - definition = m_histoDefSvc->definition("include").str(); - ATH_MSG_INFO(definition); - // - ATH_MSG_INFO("Printing histogram definition for non-existent definition"); - definition = m_histoDefSvc->definition("utterRubbish", "").str(); - ATH_MSG_INFO(definition); - - return StatusCode::SUCCESS; -} - -StatusCode -AlgTestHistoDefSvc::execute() { - return StatusCode::SUCCESS; -} - -StatusCode -AlgTestHistoDefSvc::finalize() { - msg(MSG::INFO) << "finalize()" << endmsg; - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ErrorHandler.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ErrorHandler.h deleted file mode 100644 index 7b7bcd9784a8aa3aafbed563a34aa37ddb36fad9..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ErrorHandler.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// ErrorHandler.h -// HDef -// -// Created by sroe on 18/03/2016. -// - -#ifndef ErrorHandler_h -#define ErrorHandler_h -#include <stdexcept> -#include <xercesc/sax2/DefaultHandler.hpp> -#include <iostream> -class XmlErrorHandler: public xercesc::DefaultHandler { -public: - void - warning(const xercesc::SAXParseException& e) { - std::cout << "warning: " << toNative(e.getMessage()) << std::endl; - } - - void - error(const xercesc::SAXParseException& e) { - throw std::runtime_error(toNative(e.getMessage())); - } - - void - fatalError(const xercesc::SAXParseException& e) { - error(e); - } -}; - -#endif /* ErrorHandler_h */ diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/HistogramDefinitionSvc.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/HistogramDefinitionSvc.cxx index 04517d84a46e5c03aeac533daedc6a13c303f4be..793a3a05045d9397d84f3ef674f830df7ac792da 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/HistogramDefinitionSvc.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/HistogramDefinitionSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // @@ -10,8 +10,6 @@ // #include "InDetPhysValMonitoring/HistogramDefinitionSvc.h" -#include "ReadFromText.h" -#include "ReadFromXml.h" #include "ReadFromXmlDom.h" #include "IReadHistoDef.h" namespace { @@ -47,7 +45,8 @@ HistogramDefinitionSvc::initialize() { ATH_MSG_INFO("Set format:" << m_formatString.value()); ATH_MSG_INFO("format " << m_format); if (m_format == TEXT_PLAIN) { - m_reader.reset(new ReadFromText(m_source.value())); + ATH_MSG_FATAL("Text format histogram definition files are deprecated."); + return StatusCode::FAILURE; } if (m_format == TEXT_XML) { m_reader.reset(new ReadFromXmlDom(m_source.value())); diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx index b39e0b77b14a678584a1ae23b1d4e37ca9a46efa..d7eaa5113295b5f9bbc06bf19e56e1b0698b8015 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx @@ -13,6 +13,13 @@ #include <cmath> #include "logLinearBinning.h" +namespace{ + constexpr float undefinedValue{-9999.}; + constexpr float smallestAllowableSin(1e-8); + constexpr float smallestAllowableTan(1e-8); + constexpr float smallestAllowableQoverPt(1e-8); +} + InDetPerfPlot_Resolution::InDetPerfPlot_Resolution(InDetPlotBase* pParent, const std::string& sDir) : InDetPlotBase(pParent, sDir), m_resolutionMethod(IDPVM::ResolutionHelper::iterRMS_convergence), m_primTrk(false), @@ -250,8 +257,10 @@ InDetPerfPlot_Resolution::fill(const xAOD::TrackParticle& trkprt, const xAOD::Tr void InDetPerfPlot_Resolution::getPlots() { - float eta = -TMath::Log(TMath::Tan(m_truetrkP[THETA] / 2)); - + const float tanHalfTheta = std::tan(m_truetrkP[THETA] * 0.5); + const bool tanThetaIsSane = std::abs(tanHalfTheta) > smallestAllowableTan; + float eta = undefinedValue; + if (tanThetaIsSane) eta = -std::log(tanHalfTheta); for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) { if(iparam == PT) continue; m_pull[iparam]->Fill(m_pullP[iparam]); @@ -271,7 +280,6 @@ InDetPerfPlot_Resolution::getPlots() { m_pullHelpereta[iparam]->Fill(eta, m_pullP[iparam]); if(m_iDetailLevel >= 200){ - if (m_trkP[QOVERPT] >= 0.) { m_resHelpereta_pos[iparam]->Fill(eta, m_resP[iparam]); m_resHelperpt_pos[iparam]->Fill(m_truetrkP[PT], m_resP[iparam]); @@ -291,10 +299,16 @@ InDetPerfPlot_Resolution::getPlotParameters() { for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) { m_resP[iparam] = m_trkP[iparam] - m_truetrkP[iparam]; m_sigP[iparam] = m_trkErrP[iparam]; - (m_sigP[iparam] != 0) ? m_pullP[iparam] = m_resP[iparam] / m_sigP[iparam] : m_pullP[iparam] = -9999.; + (m_sigP[iparam] != 0) ? m_pullP[iparam] = m_resP[iparam] / m_sigP[iparam] : m_pullP[iparam] = undefinedValue; + } + bool saneQoverPt = std::abs(m_truetrkP[QOVERPT]) > smallestAllowableQoverPt; + if (not saneQoverPt){ + m_resP[QOVERPT] = undefinedValue; + m_sigP[QOVERPT] = undefinedValue; + } else { + m_resP[QOVERPT] = (m_trkP[QOVERPT] - m_truetrkP[QOVERPT]) * (1 / m_truetrkP[QOVERPT]); // relative q/pt resolution + m_sigP[QOVERPT] *= m_trkP[PT]; // relative q/pt error } - m_resP[QOVERPT] = (m_trkP[QOVERPT] - m_truetrkP[QOVERPT]) * (1 / m_truetrkP[QOVERPT]); // relative q/pt resolution - m_sigP[QOVERPT] *= m_trkP[PT]; // relative q/pt error } void @@ -302,18 +316,21 @@ InDetPerfPlot_Resolution::getTrackParameters(const xAOD::TrackParticle& trkprt) m_trkP[D0] = trkprt.d0(); m_trkP[Z0] = trkprt.z0(); - m_trkP[QOVERPT] = trkprt.qOverP() * (1 / std::sin(trkprt.theta())); + const float sinTheta{std::sin(trkprt.theta())}; + const bool saneSineValue = (std::abs(sinTheta) > smallestAllowableSin); + const float inverseSinTheta = saneSineValue ? 1./sinTheta : undefinedValue; + m_trkP[QOVERPT] = saneSineValue ? trkprt.qOverP()*inverseSinTheta : undefinedValue; m_trkP[THETA] = trkprt.theta(); m_trkP[PHI] = trkprt.phi0(); m_trkP[PT] = trkprt.pt() / Gaudi::Units::GeV; - m_trkP[Z0SIN] = trkprt.z0() * std::sin(trkprt.theta()); + m_trkP[Z0SIN] = trkprt.z0() * sinTheta; // Track fit errors m_trkErrP[D0] = std::sqrt(trkprt.definingParametersCovMatrix()(0, 0)); m_trkErrP[Z0] = std::sqrt(trkprt.definingParametersCovMatrix()(1, 1)); m_trkErrP[PHI] = std::sqrt(trkprt.definingParametersCovMatrix()(2, 2)); m_trkErrP[THETA] = std::sqrt(trkprt.definingParametersCovMatrix()(3, 3)); - m_trkErrP[QOVERPT] = std::sqrt(trkprt.definingParametersCovMatrix()(4, 4)) * (1 / std::sin(trkprt.theta())); + m_trkErrP[QOVERPT] = std::sqrt(trkprt.definingParametersCovMatrix()(4, 4)) * inverseSinTheta; m_trkErrP[Z0SIN] = std::sqrt(std::pow(m_trkErrP[Z0] * std::sin(m_trkP[THETA]), 2) + std::pow(m_trkP[Z0] * m_trkErrP[THETA] * std::cos(m_trkP[THETA]), 2) + 2 * m_trkP[Z0] * std::sin(m_trkP[THETA]) * std::cos(m_trkP[THETA]) * trkprt.definingParametersCovMatrix()(1, 3)); // Fixing incorrect formula for z0sin error @@ -330,46 +347,49 @@ InDetPerfPlot_Resolution::getTrackParameters(const xAOD::TrackParticle& trkprt) } else { double pt = trkprt.pt(); double diff_qp = -pt / std::abs(trkprt.qOverP()); - double diff_theta = pt / tan(trkprt.theta()); + double diff_theta = pt / std::tan(trkprt.theta()); const std::vector<float>& cov = trkprt.definingParametersCovMatrixVec(); double pt_err2 = diff_qp * (diff_qp * cov[14] + diff_theta * cov[13]) + diff_theta * diff_theta * cov[9]; - m_trkErrP[PT] = sqrt(pt_err2) / Gaudi::Units::GeV; + m_trkErrP[PT] = std::sqrt(pt_err2) / Gaudi::Units::GeV; } } -void + + void InDetPerfPlot_Resolution::getTrackParameters(const xAOD::TruthParticle& truthprt) { // "d0", "z0", "phi", "theta" , "qOverP" // Perigee for truth particles are in aux container - int nParams = 6; - - for (int iParams = 0; iParams < nParams; iParams++) { - m_truetrkP[iParams] = -9999.; + for (int iParams = 0; iParams < NPARAMS; iParams++) { + m_truetrkP[iParams] = undefinedValue; if (truthprt.isAvailable<float>(m_paramProp[iParams])) { m_truetrkP[iParams] = (truthprt.auxdata<float>(m_paramProp[iParams])); } } - - (truthprt.isAvailable<float>("d0")) ? m_truetrkP[D0] = truthprt.auxdata<float>("d0") : m_truetrkP[D0] = -9999.; - (truthprt.isAvailable<float>("z0")) ? m_truetrkP[Z0] = truthprt.auxdata<float>("z0") : m_truetrkP[Z0] = -9999.; - (truthprt.isAvailable<float>("theta")) ? m_truetrkP[THETA] = truthprt.auxdata<float>("theta") : m_truetrkP[THETA] = - -9999.; - (truthprt.isAvailable<float>("phi")) ? m_truetrkP[PHI] = truthprt.auxdata<float>("phi") : m_truetrkP[PHI] = -9999.; - (truthprt.isAvailable<float>("theta") && - truthprt.isAvailable<float>("qOverP")) ? m_truetrkP[QOVERPT] = truthprt.auxdata<float>("qOverP") * - (1 / - std::sin(truthprt.auxdata<float>("theta"))) : - m_truetrkP[QOVERPT] = -9999.; - - - m_truetrkP[PT] = truthprt.pt() / Gaudi::Units::GeV; - (truthprt.isAvailable<float>("z0") && - truthprt.isAvailable<float>("theta")) ? m_truetrkP[Z0SIN] = m_truetrkP[Z0] * - std::sin(m_truetrkP[THETA]) : m_truetrkP[Z0SIN] = - -9999.; + //rescale Pt + if (m_truetrkP[PT] != undefinedValue) m_truetrkP[PT] = truthprt.pt() / Gaudi::Units::GeV; + //special cases + //need both theta and qOverP for qOverPT + //we didnt check qOverP yet, since the closest named variable (strangely; see header) is ptqopt + const float qOverP = truthprt.isAvailable<float>("qOverP") ? truthprt.auxdata<float>("qOverP") : undefinedValue; + if ((qOverP != undefinedValue) and (m_truetrkP[THETA] != undefinedValue)){ + const float sinTheta =std::sin(m_truetrkP[THETA]); + if (std::abs(sinTheta) > smallestAllowableSin){ + m_truetrkP[QOVERPT] = qOverP /sinTheta; + } else { + m_truetrkP[QOVERPT] = undefinedValue; + } + } + //need both z0 and theta for z0sinTheta + if ((m_truetrkP[Z0] != undefinedValue) and (m_truetrkP[THETA] != undefinedValue)){ + const float sinTheta =std::sin(m_truetrkP[THETA]); + m_truetrkP[Z0SIN] = m_truetrkP[Z0] * sinTheta; + } else { + m_truetrkP[Z0SIN] = undefinedValue; + } } + void InDetPerfPlot_Resolution::finalizePlots() { diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.cxx index fc60fc1efd900560b655689538d86fbd9ad801e8..c4745c4f26265ddd1194dbe1198538e6bfe0cc60 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.cxx @@ -11,8 +11,9 @@ using namespace IDPVM; -InDetPerfPlot_VertexTruthMatching::InDetPerfPlot_VertexTruthMatching(InDetPlotBase* pParent, const std::string& sDir) : +InDetPerfPlot_VertexTruthMatching::InDetPerfPlot_VertexTruthMatching(InDetPlotBase* pParent, const std::string& sDir, const int iDetailLevel) : InDetPlotBase(pParent, sDir), + m_iDetailLevel(iDetailLevel), m_vx_type_truth(nullptr), m_vx_hs_classification(nullptr), m_vx_nReco_vs_nTruth_inclusive(nullptr), @@ -25,39 +26,211 @@ InDetPerfPlot_VertexTruthMatching::InDetPerfPlot_VertexTruthMatching(InDetPlotBa m_vx_nReco_vs_nTruth_lowpu(nullptr), m_vx_nReco_vs_nTruth_highpu(nullptr), m_vx_nReco_vs_nTruth_hssplit(nullptr), - m_vx_nReco_vs_nTruth_none(nullptr) + m_vx_nReco_vs_nTruth_none(nullptr), + m_vx_hs_reco_eff(nullptr), + m_vx_hs_sel_eff(nullptr), + m_vx_hs_reco_long_reso(nullptr), + m_vx_hs_reco_trans_reso(nullptr), + m_vx_hs_truth_long_reso_vs_PU(nullptr), + m_vx_hs_truth_trans_reso_vs_PU(nullptr), + m_vx_hs_truth_long_reso(nullptr), + m_vx_hs_truth_trans_reso(nullptr) { // nop } -void -InDetPerfPlot_VertexTruthMatching::initializePlots() { +void InDetPerfPlot_VertexTruthMatching::initializePlots() { IDPVM_BOOK(m_vx_type_truth); - IDPVM_BOOK(m_vx_hs_classification); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_inclusive); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_matched); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_merged); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_split); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_fake); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_dummy); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_clean); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_lowpu); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_highpu); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_hssplit); - IDPVM_BOOK(m_vx_nReco_vs_nTruth_none); + if (m_iDetailLevel >= 200) { + IDPVM_BOOK(m_vx_hs_classification); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_inclusive); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_matched); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_merged); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_split); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_fake); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_dummy); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_clean); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_lowpu); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_highpu); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_hssplit); + IDPVM_BOOK(m_vx_nReco_vs_nTruth_none); + IDPVM_BOOK(m_vx_hs_reco_eff); + IDPVM_BOOK(m_vx_hs_sel_eff); + IDPVM_BOOK(m_vx_hs_reco_long_reso); + IDPVM_BOOK(m_vx_hs_reco_trans_reso); + IDPVM_BOOK(m_vx_hs_truth_long_reso); + IDPVM_BOOK(m_vx_hs_truth_trans_reso); + IDPVM_BOOK(m_vx_hs_truth_long_reso_vs_PU); + IDPVM_BOOK(m_vx_hs_truth_trans_reso_vs_PU); + } + +} + +const xAOD::Vertex* InDetPerfPlot_VertexTruthMatching::getHSRecoVertexSumPt2(const xAOD::VertexContainer& recoVertices) const { + const xAOD::Vertex* recoHSVertex = nullptr; + float sumPtMax = -1.; + const xAOD::TrackParticle* trackTmp = nullptr; + float sumPtTmp; + for (const auto& vtx : recoVertices.stdcont()) { + if (vtx) { + sumPtTmp = 0.; + for (size_t i = 0; i < vtx->nTrackParticles(); i++) { + trackTmp = vtx->trackParticle(i); + if (trackTmp) { + sumPtTmp += std::pow(trackTmp->pt(), 2); + } + } + if (sumPtTmp > sumPtMax) { + sumPtMax = sumPtTmp; + recoHSVertex = vtx; + } + } + } + return recoHSVertex; +} + +template<typename U, typename V> +float InDetPerfPlot_VertexTruthMatching::getRadialDiff2(const U* vtx1, const V* vtx2) const { + return (std::pow((vtx1->x() - vtx2->x()), 2) + std::pow((vtx1->y() - vtx2->y()), 2) + std::pow((vtx1->z() - vtx2->z()), 2)); +} + +float InDetPerfPlot_VertexTruthMatching::getLocalPUDensity(const xAOD::TruthVertex* vtxOfInterest, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices, const float radialWindow) const { + float radialWindow2 = std::pow(radialWindow, 2); + int nTracksInWindow = 0; + float localPUDensity; + float radialDiff2; + for (const auto& vtx : truthHSVertices) { + if (vtx != vtxOfInterest) { + radialDiff2 = getRadialDiff2(vtxOfInterest, vtx); + if (radialDiff2 < radialWindow2) { + nTracksInWindow += 1; + } + } + } + for (const auto& vtx : truthPUVertices) { + if (vtx != vtxOfInterest) { + radialDiff2 = getRadialDiff2(vtxOfInterest, vtx); + if (radialDiff2 < radialWindow2) { + nTracksInWindow += 1; + } + } + } + localPUDensity = (float)(nTracksInWindow) / (2 * radialWindow); + return localPUDensity; +} + +float InDetPerfPlot_VertexTruthMatching::getRecoLongitudinalReso(const xAOD::Vertex* recoVtx) const { + return std::sqrt(recoVtx->covariancePosition()(2, 2)); +} +float InDetPerfPlot_VertexTruthMatching::getRecoTransverseReso(const xAOD::Vertex* recoVtx) const { + float x = recoVtx->x(); + float y = recoVtx->y(); + float xErr2 = recoVtx->covariancePosition()(0, 0); + float yErr2 = recoVtx->covariancePosition()(1, 1); + float xyCov = recoVtx->covariancePosition()(0, 1); + float r2 = std::pow(x, 2) + std::pow(y, 2); + return std::sqrt(std::pow(x, 2) / r2 * xErr2 + std::pow(y, 2) / r2 * yErr2 + 2 * x * y / r2 * xyCov); } -void -InDetPerfPlot_VertexTruthMatching::fill(const xAOD::Vertex& vertex) { +// Copied from Graham: +void InDetPerfPlot_VertexTruthMatching::fillResoHist(TH1* resoHist, const TH2* resoHist2D) { + + TH1* projHist = nullptr; + int safety_counter; + TFitResultPtr fitResult; + double mean; + double rms; + double itr_rms = -1.; + double itr_rms_err; + + for (int i = 1; i < resoHist2D->GetNbinsX() + 1; i++) { + + projHist = resoHist2D->ProjectionY("projectionY", i, i); + + if (projHist->GetEntries() == 0.) { + resoHist->SetBinContent(i, 0.); + resoHist->SetBinError(i, 0.); + continue; + } + + safety_counter = 0; + + fitResult = projHist->Fit("gaus", "QS0"); + if (!fitResult.Get()) { + // Is it necessary to also require fitResult->Status() % 1000 == 0 for a successful fit? + // --> fitStatus = migradResult + 10 * minosResult + 100 * hesseResult + 1000 * improveResult + resoHist->SetBinContent(i, 0.); + resoHist->SetBinError(i, 0.); + continue; + } + mean = fitResult->Parameter(1); + rms = fitResult->Parameter(2); + + while (true) { + + projHist->SetAxisRange(mean - 3 * rms, mean + 3 * rms, "X"); + + fitResult = projHist->Fit("gaus", "QS0"); + if (!fitResult.Get()) { + itr_rms = 0.; + itr_rms_err = 0.; + break; + } + itr_rms = fitResult->Parameter(2); + itr_rms_err = fitResult->ParError(2); + + if ((fabs(itr_rms - rms) < 0.0001) || (safety_counter == 5)) { + break; + } + + safety_counter++; + mean = fitResult->Parameter(1); + rms = itr_rms; + continue; + + } + + resoHist->SetBinContent(i, itr_rms); + resoHist->SetBinError(i, itr_rms_err); - // fill vertex truth match type + } +} + +const xAOD::TruthVertex* InDetPerfPlot_VertexTruthMatching::getTruthVertex(const xAOD::Vertex* recoVtx) const { + const xAOD::TruthVertex* truthVtx = nullptr; + if (recoVtx) { + const static xAOD::Vertex::Decorator<std::vector<InDetVertexTruthMatchUtils::VertexTruthMatchInfo>> truthMatchingInfos("TruthEventMatchingInfos"); + const std::vector<InDetVertexTruthMatchUtils::VertexTruthMatchInfo>& truthInfos = truthMatchingInfos(*recoVtx); + if (!truthInfos.empty()) { + const InDetVertexTruthMatchUtils::VertexTruthMatchInfo& truthInfo = truthInfos.at(0); + const ElementLink<xAOD::TruthEventBaseContainer> truthEventLink = std::get<0>(truthInfo); + const xAOD::TruthEvent* truthEvent = nullptr; + if (truthEventLink.isValid()) { + truthEvent = static_cast<const xAOD::TruthEvent*>(*truthEventLink); + if (truthEvent) { + truthVtx = truthEvent->truthVertex(0); + } + } + } + else { + ATH_MSG_WARNING("TruthEventMatchingInfos DECORATOR yields empty vector -- returning nullptr!"); + } + } + return truthVtx; +} + +void InDetPerfPlot_VertexTruthMatching::fill(const xAOD::Vertex& vertex) { + + // Get the match type info for each vertex: const static xAOD::Vertex::Decorator<InDetVertexTruthMatchUtils::VertexMatchType> recoVtxMatchTypeInfo("VertexMatchType"); + InDetVertexTruthMatchUtils::VertexMatchType matchType; if (recoVtxMatchTypeInfo.isAvailable(vertex)) { try { - ATH_MSG_DEBUG("VERTEX DECORATOR ======= "<< recoVtxMatchTypeInfo(vertex)<< ", with nTRACKS === " << vertex.nTrackParticles() << ", vertex index = " << vertex.index()<< " AT (" << vertex.x() << ", " << vertex.y() << ", " << vertex.z() << ")"); - fillHisto(m_vx_type_truth, recoVtxMatchTypeInfo(vertex)); + matchType = recoVtxMatchTypeInfo(vertex); + ATH_MSG_DEBUG("VERTEX DECORATOR ======= " << matchType << ", with nTRACKS === " << vertex.nTrackParticles() << ", vertex index = " << vertex.index() << " AT (x, y, z) = (" << vertex.x() << ", " << vertex.y() << ", " << vertex.z() << ")"); + fillHisto(m_vx_type_truth, matchType); } catch (SG::ExcBadAuxVar &) { ATH_MSG_WARNING("VertexMatchType DECORATOR seems to be available, but may be broken ==========="); @@ -65,64 +238,149 @@ InDetPerfPlot_VertexTruthMatching::fill(const xAOD::Vertex& vertex) { } else { ATH_MSG_WARNING("VertexMatchType DECORATOR is NOT available ==========="); - } + } -} //end InDetPerfPlot_VertexTruthMatching::fill(const xAOD::Vertex& vertex) +} // void InDetPerfPlot_VertexTruthMatching::fill(const xAOD::Vertex& vertex) { -void -InDetPerfPlot_VertexTruthMatching::fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthVertices) { +void InDetPerfPlot_VertexTruthMatching::fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices) { - // Fill our histogram - // We just need to add the size of the vertex container as an argument, are there other things we might need to fill in this kind of function? - // Inclusive: - fillHisto(m_vx_nReco_vs_nTruth_inclusive, (float)truthVertices.size(), (float)vertexContainer.size()); - - // Let's also plot the vertices by vertex match type: - const static xAOD::Vertex::Decorator<InDetVertexTruthMatchUtils::VertexMatchType> recoVtxMatchTypeInfo("VertexMatchType"); - std::map<InDetVertexTruthMatchUtils::VertexMatchType, int> breakdown = {}; - breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MATCHED] = 0; - breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MERGED] = 0; - breakdown[InDetVertexTruthMatchUtils::VertexMatchType::SPLIT] = 0; - breakdown[InDetVertexTruthMatchUtils::VertexMatchType::FAKE] = 0; - breakdown[InDetVertexTruthMatchUtils::VertexMatchType::DUMMY] = 0; - for (const auto& vertex : vertexContainer.stdcont()) { - if (recoVtxMatchTypeInfo.isAvailable(*vertex)) { - breakdown[recoVtxMatchTypeInfo(*vertex)] += 1; - } - } - fillHisto(m_vx_nReco_vs_nTruth_matched, (float)truthVertices.size(), (float)breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MATCHED]); - fillHisto(m_vx_nReco_vs_nTruth_merged, (float)truthVertices.size(), (float)breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MERGED]); - fillHisto(m_vx_nReco_vs_nTruth_split, (float)truthVertices.size(), (float)breakdown[InDetVertexTruthMatchUtils::VertexMatchType::SPLIT]); - fillHisto(m_vx_nReco_vs_nTruth_fake, (float)truthVertices.size(), (float)breakdown[InDetVertexTruthMatchUtils::VertexMatchType::FAKE]); - fillHisto(m_vx_nReco_vs_nTruth_dummy, (float)truthVertices.size(), (float)breakdown[InDetVertexTruthMatchUtils::VertexMatchType::DUMMY]); - - // And by hardscatter type: - InDetVertexTruthMatchUtils::HardScatterType hsType = InDetVertexTruthMatchUtils::classifyHardScatter(vertexContainer); - fillHisto(m_vx_hs_classification, hsType); - switch(hsType) { - case InDetVertexTruthMatchUtils::HardScatterType::CLEAN: { - fillHisto(m_vx_nReco_vs_nTruth_clean, (float)truthVertices.size(), (float)vertexContainer.size()); - break; - } - case InDetVertexTruthMatchUtils::HardScatterType::LOWPU: { - fillHisto(m_vx_nReco_vs_nTruth_lowpu, (float)truthVertices.size(), (float)vertexContainer.size()); - break; - } - case InDetVertexTruthMatchUtils::HardScatterType::HIGHPU: { - fillHisto(m_vx_nReco_vs_nTruth_highpu, (float)truthVertices.size(), (float)vertexContainer.size()); - break; + if (m_iDetailLevel >= 200) { + + // Fill our histograms + // Inclusive: + int nTruthVertices = (int)(truthHSVertices.size() + truthPUVertices.size()); + int nRecoVertices = (int)vertexContainer.size(); + fillHisto(m_vx_nReco_vs_nTruth_inclusive, nTruthVertices, nRecoVertices); + + // Let's also plot the vertices by vertex match type: + const static xAOD::Vertex::Decorator<InDetVertexTruthMatchUtils::VertexMatchType> recoVtxMatchTypeInfo("VertexMatchType"); + std::map<InDetVertexTruthMatchUtils::VertexMatchType, int> breakdown = {}; + breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MATCHED] = 0; + breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MERGED] = 0; + breakdown[InDetVertexTruthMatchUtils::VertexMatchType::SPLIT] = 0; + breakdown[InDetVertexTruthMatchUtils::VertexMatchType::FAKE] = 0; + breakdown[InDetVertexTruthMatchUtils::VertexMatchType::DUMMY] = 0; + + const xAOD::TruthVertex* truthVtx = nullptr; + float localPUDensity; + + // Best reco HS vertex identified via sumpt2 + const xAOD::Vertex* bestRecoHSVtx_sumpt2 = getHSRecoVertexSumPt2(vertexContainer); // Could potentially use the first vertex in the container if sumpt2-ordered + // Best reco HS vertex identified via truth HS weights + const xAOD::Vertex* bestRecoHSVtx_truth = InDetVertexTruthMatchUtils::bestHardScatterMatch(vertexContainer); + + // Did we correctly select the best reco HS vertex using sumpt2? + truthVtx = getTruthVertex(bestRecoHSVtx_sumpt2); + localPUDensity = getLocalPUDensity(truthVtx, truthHSVertices, truthPUVertices); + fillHisto(m_vx_hs_sel_eff, localPUDensity, (bestRecoHSVtx_sumpt2 == bestRecoHSVtx_truth)); + + // Did we successfully reconstruct our truth HS vertex? + bool truthHSVtxRecoed = false; + float minTruthRecoRadialDiff2 = std::pow(m_cutMinTruthRecoRadialDiff, 2); + float truthRecoRadialDiff2 = -1.; + const xAOD::TruthVertex* truthHSVtx = nullptr; + // Check that we have *exactly* 1 truth HS vertex + if (truthHSVertices.size() != 0) { + if (truthHSVertices.size() != 1) { + ATH_MSG_WARNING("Size of truth HS vertex vector is >1 -- only using the first one in the vector."); + } + truthHSVtx = truthHSVertices.at(0); + // If the radial difference between the truth-pkg-selected best reco HS vertex and the truth HS vertex is + // less than some cut (e.g., 0.1 mm), then we say the truth HS vertex is reconstructed + truthRecoRadialDiff2 = getRadialDiff2(bestRecoHSVtx_truth, truthHSVtx); + if (truthRecoRadialDiff2 < minTruthRecoRadialDiff2) { + truthHSVtxRecoed = true; + minTruthRecoRadialDiff2 = truthRecoRadialDiff2; + } } - case InDetVertexTruthMatchUtils::HardScatterType::HSSPLIT: { - fillHisto(m_vx_nReco_vs_nTruth_hssplit, (float)truthVertices.size(), (float)vertexContainer.size()); - break; + else { + ATH_MSG_WARNING("Size of truth HS vertex vector is 0 -- assuming truth HS vertex to NOT be reconstructed."); } - case InDetVertexTruthMatchUtils::HardScatterType::NONE: { - fillHisto(m_vx_nReco_vs_nTruth_none, (float)truthVertices.size(), (float)vertexContainer.size()); - break; + + // Iterate over vertices: + InDetVertexTruthMatchUtils::VertexMatchType matchType; + for (const auto& vertex : vertexContainer.stdcont()) { + + // Skip dummy vertex (last one in the container) + if (vertex->vertexType() == xAOD::VxType::NoVtx) { + continue; + } + + fill(*vertex); + + matchType = recoVtxMatchTypeInfo(*vertex); + breakdown[matchType] += 1; + + // If we have reconstructed the truth HS vertex but we have a different reco vertex closer to the truth HS vertex + // than the best one identified by the truth pkg, we say we have NOT successfully reconstructed the truth HS vertex + if (truthHSVtxRecoed && (vertex != bestRecoHSVtx_truth)) { + truthRecoRadialDiff2 = getRadialDiff2(vertex, truthHSVtx); + if (truthRecoRadialDiff2 < minTruthRecoRadialDiff2) { + truthHSVtxRecoed = false; + minTruthRecoRadialDiff2 = truthRecoRadialDiff2; + } + } + + } // end loop over vertices + + // Now fill plots relating to the reconstruction of our truth HS vertex (efficiency and resolutions) + if (truthHSVertices.size() != 0) { + localPUDensity = getLocalPUDensity(truthHSVtx, truthHSVertices, truthPUVertices); + if (truthHSVtxRecoed) { + fillHisto(m_vx_hs_reco_eff, localPUDensity, 1); + fillHisto(m_vx_hs_reco_long_reso, localPUDensity, getRecoLongitudinalReso(bestRecoHSVtx_truth)); + fillHisto(m_vx_hs_reco_trans_reso, localPUDensity, getRecoTransverseReso(bestRecoHSVtx_truth)); + fillHisto(m_vx_hs_truth_long_reso_vs_PU, localPUDensity, truthHSVtx->z() - bestRecoHSVtx_truth->z()); + fillHisto(m_vx_hs_truth_trans_reso_vs_PU, localPUDensity, std::sqrt(std::pow(truthHSVtx->x() - bestRecoHSVtx_truth->x(), 2) + std::pow(truthHSVtx->y() - bestRecoHSVtx_truth->y(), 2))); + } + else { + fillHisto(m_vx_hs_reco_eff, localPUDensity, 0); + } } - default: { - break; + + fillHisto(m_vx_nReco_vs_nTruth_matched, nTruthVertices, breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MATCHED]); + fillHisto(m_vx_nReco_vs_nTruth_merged, nTruthVertices, breakdown[InDetVertexTruthMatchUtils::VertexMatchType::MERGED]); + fillHisto(m_vx_nReco_vs_nTruth_split, nTruthVertices, breakdown[InDetVertexTruthMatchUtils::VertexMatchType::SPLIT]); + fillHisto(m_vx_nReco_vs_nTruth_fake, nTruthVertices, breakdown[InDetVertexTruthMatchUtils::VertexMatchType::FAKE]); + fillHisto(m_vx_nReco_vs_nTruth_dummy, nTruthVertices, breakdown[InDetVertexTruthMatchUtils::VertexMatchType::DUMMY]); + + // And by hardscatter type: + InDetVertexTruthMatchUtils::HardScatterType hsType = InDetVertexTruthMatchUtils::classifyHardScatter(vertexContainer); + fillHisto(m_vx_hs_classification, hsType); + switch (hsType) { + case InDetVertexTruthMatchUtils::HardScatterType::CLEAN: { + fillHisto(m_vx_nReco_vs_nTruth_clean, nTruthVertices, nRecoVertices); + break; + } + case InDetVertexTruthMatchUtils::HardScatterType::LOWPU: { + fillHisto(m_vx_nReco_vs_nTruth_lowpu, nTruthVertices, nRecoVertices); + break; + } + case InDetVertexTruthMatchUtils::HardScatterType::HIGHPU: { + fillHisto(m_vx_nReco_vs_nTruth_highpu, nTruthVertices, nRecoVertices); + break; + } + case InDetVertexTruthMatchUtils::HardScatterType::HSSPLIT: { + fillHisto(m_vx_nReco_vs_nTruth_hssplit, nTruthVertices, nRecoVertices); + break; + } + case InDetVertexTruthMatchUtils::HardScatterType::NONE: { + fillHisto(m_vx_nReco_vs_nTruth_none, nTruthVertices, nRecoVertices); + break; + } + default: { + break; + } } } -}//end InDetPerfPlot_VertexTruthMatching::fill(const xAOD::VertexContainer& vertexContainer, const xAOD::TruthEventContainer& truthHSEvents) +} // end InDetPerfPlot_VertexTruthMatching::fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices) + +void InDetPerfPlot_VertexTruthMatching::finalizePlots() { + + if (m_iDetailLevel >= 200) { + fillResoHist(m_vx_hs_truth_long_reso, m_vx_hs_truth_long_reso_vs_PU); + fillResoHist(m_vx_hs_truth_trans_reso, m_vx_hs_truth_trans_reso_vs_PU); + } + +} // end InDetPerfPlot_VertexTruthMatching::finalizePlots() diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.h index 76262ac536aa8e1e1cc4356b6f632ea0a3a89ded..754427d18db61c7907d47040e4bfdcd7abf4c0d1 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_VertexTruthMatching.h @@ -14,6 +14,8 @@ #include "InDetPhysValMonitoringUtilities.h" // Tracking includes: +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" #include "xAODTracking/VertexFwd.h" // xAOD truth object includes: @@ -28,35 +30,63 @@ // std includes #include <string> -class TH1; +// root includes +#include "TF1.h" +#include "TH1.h" +#include "TH2.h" +#include "TFitResult.h" +#include "TFitResultPtr.h" ///class holding plots for truth matched vertices class InDetPerfPlot_VertexTruthMatching: public InDetPlotBase { public: - InDetPerfPlot_VertexTruthMatching(InDetPlotBase* pParent, const std::string& dirName); - void fill(const xAOD::Vertex& vertex); - void fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthVertices); + InDetPerfPlot_VertexTruthMatching(InDetPlotBase* pParent, const std::string& dirName, const int iDetailLevel = 10); + void fill(const xAOD::Vertex& vertex); + void fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices); private: - ///truth type - TH1* m_vx_type_truth; - ///hardscatter classification - TH1* m_vx_hs_classification; - ///vertex reco efficiency - TProfile* m_vx_nReco_vs_nTruth_inclusive; - TProfile* m_vx_nReco_vs_nTruth_matched; - TProfile* m_vx_nReco_vs_nTruth_merged; - TProfile* m_vx_nReco_vs_nTruth_split; - TProfile* m_vx_nReco_vs_nTruth_fake; - TProfile* m_vx_nReco_vs_nTruth_dummy; - TProfile* m_vx_nReco_vs_nTruth_clean; - TProfile* m_vx_nReco_vs_nTruth_lowpu; - TProfile* m_vx_nReco_vs_nTruth_highpu; - TProfile* m_vx_nReco_vs_nTruth_hssplit; - TProfile* m_vx_nReco_vs_nTruth_none; - ///@} - - // plot base has no default implementation of this; we use it to book the histos - void initializePlots(); + int m_iDetailLevel; + float m_cutMinTruthRecoRadialDiff = 0.1; + ///truth type + TH1* m_vx_type_truth; + ///hardscatter classification + TH1* m_vx_hs_classification; + ///vertex reco efficiency + TProfile* m_vx_nReco_vs_nTruth_inclusive; + TProfile* m_vx_nReco_vs_nTruth_matched; + TProfile* m_vx_nReco_vs_nTruth_merged; + TProfile* m_vx_nReco_vs_nTruth_split; + TProfile* m_vx_nReco_vs_nTruth_fake; + TProfile* m_vx_nReco_vs_nTruth_dummy; + TProfile* m_vx_nReco_vs_nTruth_clean; + TProfile* m_vx_nReco_vs_nTruth_lowpu; + TProfile* m_vx_nReco_vs_nTruth_highpu; + TProfile* m_vx_nReco_vs_nTruth_hssplit; + TProfile* m_vx_nReco_vs_nTruth_none; + // HS vertex reconstruction efficiency vs PU + TEfficiency* m_vx_hs_reco_eff; + // HS vertex selection efficiency vs PU + TEfficiency* m_vx_hs_sel_eff; + // For reco (covariance) resolutions: + TProfile* m_vx_hs_reco_long_reso; + TProfile* m_vx_hs_reco_trans_reso; + // For reco-truth resolutions: + TH2* m_vx_hs_truth_long_reso_vs_PU; + TH2* m_vx_hs_truth_trans_reso_vs_PU; + TH1* m_vx_hs_truth_long_reso; + TH1* m_vx_hs_truth_trans_reso; + ///@} +private: + // plot base has no default implementation of this; we use it to book the histos + void initializePlots(); + const xAOD::Vertex* getHSRecoVertexSumPt2(const xAOD::VertexContainer& recoVertices) const; + template<typename U, typename V> + float getRadialDiff2(const U* vtx1, const V* vtx2) const; + float getLocalPUDensity(const xAOD::TruthVertex* vtxOfInterest, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices, const float radialWindow = 2.0) const; + float getRecoLongitudinalReso(const xAOD::Vertex* recoVtx) const; + float getRecoTransverseReso(const xAOD::Vertex* recoVtx) const; + const xAOD::TruthVertex* getTruthVertex(const xAOD::Vertex* recoVtx) const; + void fillResoHist(TH1* resoHist, const TH2* resoHist2D); + void finalizePlots(); }; #endif diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx index 7c873dc9e911721684092be5aee6cc76794bf5f9..80be6f74dcd152b3ee590798875253f5a00219f1 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx @@ -160,15 +160,15 @@ InDetPhysValMonitoringTool::initialize() { if (m_truthSelectionTool.get() ) { m_truthCutFlow = CutFlow(m_truthSelectionTool->nCuts()); } - m_monPlots = std::make_unique<InDetRttPlots> (nullptr, m_dirName + m_folder); + m_monPlots = std::make_unique<InDetRttPlots> (nullptr, m_dirName + m_folder, m_detailLevel); // m_detailLevel := DEBUG, enable expert histograms ATH_CHECK( m_trkParticleName.initialize() ); - ATH_CHECK( m_truthParticleName.initialize(m_pileupSwitch == "All" and not m_truthParticleName.key().empty() ) ); + ATH_CHECK( m_truthParticleName.initialize( (m_pileupSwitch == "HardScatter" or m_pileupSwitch == "All") and not m_truthParticleName.key().empty() ) ); ATH_CHECK( m_vertexContainerName.initialize() ); ATH_CHECK( m_truthVertexContainerName.initialize( not m_truthVertexContainerName.key().empty() ) ); ATH_CHECK( m_eventInfoContainerName.initialize() ); - ATH_CHECK( m_truthEventName.initialize( m_pileupSwitch == "HardScatter" and not m_truthEventName.key().empty()) ); + ATH_CHECK( m_truthEventName.initialize( (m_pileupSwitch == "HardScatter" or m_pileupSwitch == "All") and not m_truthEventName.key().empty() ) ); ATH_CHECK( m_truthPileUpEventName.initialize( (m_pileupSwitch == "PileUp" or m_pileupSwitch == "All") and not m_truthPileUpEventName.key().empty() ) ); ATH_CHECK( m_jetContainerName.initialize( not m_jetContainerName.key().empty()) ); @@ -202,9 +202,8 @@ InDetPhysValMonitoringTool::fillHistograms() { SG::ReadHandle<xAOD::EventInfo> pie = SG::ReadHandle<xAOD::EventInfo>(m_eventInfoContainerName); std::vector<const xAOD::TruthParticle*> truthParticlesVec = getTruthParticles(); - std::vector<const xAOD::TruthVertex*> truthVertices = getTruthVertices(); IDPVM::CachedGetAssocTruth getAsTruth; // only cache one way, track->truth, not truth->tracks - + if (not tracks.isValid()) { return StatusCode::FAILURE; } @@ -229,12 +228,17 @@ InDetPhysValMonitoringTool::fillHistograms() { //Filling plots for all reconstructed vertices and the hard-scatter ATH_MSG_DEBUG("Filling vertices info monitoring plots"); - //Decorate vertices + // Fill vectors of truth HS and PU vertices + std::pair<std::vector<const xAOD::TruthVertex*>, std::vector<const xAOD::TruthVertex*>> truthVertices = getTruthVertices(); + std::vector<const xAOD::TruthVertex*> truthHSVertices = truthVertices.first; + std::vector<const xAOD::TruthVertex*> truthPUVertices = truthVertices.second; + + // Decorate vertices if (m_useVertexTruthMatchTool && m_vtxValidTool) { ATH_CHECK(m_vtxValidTool->matchVertices(*vertices)); ATH_MSG_DEBUG("Hard scatter classification type: " << InDetVertexTruthMatchUtils::classifyHardScatter(*vertices) << ", vertex container size = " << vertices->size()); } - m_monPlots->fill(*vertices, truthVertices); + m_monPlots->fill(*vertices, truthHSVertices, truthPUVertices); ATH_MSG_DEBUG("Filling vertex/event info monitoring plots"); //Filling vertexing plots for the reconstructed hard-scatter as a function of mu @@ -452,7 +456,6 @@ InDetPhysValMonitoringTool::fillHistograms() { StatusCode InDetPhysValMonitoringTool::bookHistograms() { ATH_MSG_INFO("Booking hists " << name() << "with detailed level: " << m_detailLevel); - m_monPlots->setDetailLevel(m_detailLevel); // DEBUG, enable expert histograms m_monPlots->initialize(); std::vector<HistData> hists = m_monPlots->retrieveBookedHistograms(); for (auto hist : hists) { @@ -494,7 +497,7 @@ InDetPhysValMonitoringTool::procHistograms() { } const std::vector<const xAOD::TruthParticle*> -InDetPhysValMonitoringTool::getTruthParticles() { +InDetPhysValMonitoringTool::getTruthParticles() const { // truthParticles.clear(); std::vector<const xAOD::TruthParticle*> tempVec {}; if (m_pileupSwitch == "All") { @@ -553,11 +556,13 @@ InDetPhysValMonitoringTool::getTruthParticles() { return tempVec; } -const std::vector<const xAOD::TruthVertex*> -InDetPhysValMonitoringTool::getTruthVertices() { +std::pair<const std::vector<const xAOD::TruthVertex*>, const std::vector<const xAOD::TruthVertex*>> +InDetPhysValMonitoringTool::getTruthVertices() const { - std::vector<const xAOD::TruthVertex*> truthVertices = {}; - truthVertices.reserve(100); + std::vector<const xAOD::TruthVertex*> truthHSVertices = {}; + truthHSVertices.reserve(5); + std::vector<const xAOD::TruthVertex*> truthPUVertices = {}; + truthPUVertices.reserve(100); const xAOD::TruthVertex* truthVtx = nullptr; bool doHS = false; @@ -577,14 +582,14 @@ InDetPhysValMonitoringTool::getTruthVertices() { } if (doHS) { - if (!m_truthEventName.key().empty()) { + if (not m_truthEventName.key().empty()) { ATH_MSG_VERBOSE("Getting TruthEvents container."); SG::ReadHandle<xAOD::TruthEventContainer> truthEventContainer(m_truthEventName); if (truthEventContainer.isValid()) { for (const auto& evt : *truthEventContainer) { truthVtx = evt->truthVertex(0); if (truthVtx) { - truthVertices.push_back(truthVtx); + truthHSVertices.push_back(truthVtx); } } } @@ -595,14 +600,14 @@ InDetPhysValMonitoringTool::getTruthVertices() { } if (doPU) { - if (!m_truthPileUpEventName.key().empty()) { + if (not m_truthPileUpEventName.key().empty()) { ATH_MSG_VERBOSE("Getting TruthEvents container."); SG::ReadHandle<xAOD::TruthPileupEventContainer> truthPileupEventContainer(m_truthPileUpEventName); if (truthPileupEventContainer.isValid()) { for (const auto& evt : *truthPileupEventContainer) { truthVtx = evt->truthVertex(0); if (truthVtx) { - truthVertices.push_back(truthVtx); + truthPUVertices.push_back(truthVtx); } } } @@ -612,7 +617,7 @@ InDetPhysValMonitoringTool::getTruthVertices() { } } - return truthVertices; + return std::make_pair<const std::vector<const xAOD::TruthVertex*>, const std::vector<const xAOD::TruthVertex*>>((const std::vector<const xAOD::TruthVertex*>)truthHSVertices, (const std::vector<const xAOD::TruthVertex*>)truthPUVertices); } diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx index c9b438103fb9972086375b4efda7fb8e167e1d7c..547002cf1a89e1264ae5d7d63f7b6f7d3cf4a969 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx @@ -15,7 +15,7 @@ #include <cmath> // std::isnan() #include <limits> -InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir) : InDetPlotBase(pParent, sDir), +InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir, const int iDetailLevel) : InDetPlotBase(pParent, sDir), m_trackParameters(this, "Tracks/Selected/Parameters"), m_nTracks(this, "Tracks/Tracks"), m_hitResidualPlot(this, "Tracks/Hits/Residuals"), @@ -32,13 +32,14 @@ InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir) : m_resolutionPlotSecd(nullptr), m_doTrackInJetPlots(true) //FIX CONFIGURATION { + this->m_iDetailLevel = iDetailLevel; m_trackParticleTruthProbKey = "truthMatchProbability"; m_truthProbLowThreshold = 0.5; if(m_iDetailLevel >= 200){ m_resolutionPlotSecd = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "Tracks/Matched/Resolutions/Secondary")); m_hitsMatchedTracksPlots = std::unique_ptr<InDetPerfPlot_Hits>(new InDetPerfPlot_Hits(this, "Tracks/Matched/HitsOnTracks")); - m_vertexTruthMatchingPlots = std::unique_ptr<InDetPerfPlot_VertexTruthMatching>(new InDetPerfPlot_VertexTruthMatching(this, "Vertices/AllPrimaryVertices")); + m_vertexTruthMatchingPlots = std::unique_ptr<InDetPerfPlot_VertexTruthMatching>(new InDetPerfPlot_VertexTruthMatching(this, "Vertices/AllPrimaryVertices", m_iDetailLevel)); } //A lot of Jets... do we need these at all??? @@ -125,7 +126,7 @@ InDetRttPlots::fillFakeRate(const xAOD::TrackParticle& track, const bool isFake, //Fill Vertexing Plots // void -InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthVertices) { +InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices) { // fill vertex container general properties // m_verticesVsMuPlots.fill(vertexContainer); //if ever needed // fill vertex-specific properties, for all vertices and for hard-scattering vertex @@ -135,9 +136,6 @@ InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const std::vec continue; // skip dummy vertex } m_vertexPlots.fill(*vtx); - if(m_iDetailLevel >= 200){ - m_vertexTruthMatchingPlots->fill(*vtx); - } ATH_MSG_DEBUG("IN InDetRttPlots::fill, filling for all vertices"); if (vtx->vertexType() == xAOD::VxType::PriVtx) { m_hardScatterVertexPlots.fill(*vtx); @@ -146,7 +144,7 @@ InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const std::vec } } if(m_iDetailLevel >= 200){ - m_vertexTruthMatchingPlots->fill(vertexContainer, truthVertices); + m_vertexTruthMatchingPlots->fill(vertexContainer, truthHSVertices, truthPUVertices); } } diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h index fd1bb3e8ed3ab138cffbcf4ce55cfd21ed4bfde4..c4302232d859cc4ba1e7067e17b916e5a7769b11 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h @@ -47,7 +47,7 @@ ///class holding all plots for Inner Detector RTT Validation and implementing fill methods class InDetRttPlots: public InDetPlotBase { public: - InDetRttPlots(InDetPlotBase* pParent, const std::string& dirName); + InDetRttPlots(InDetPlotBase* pParent, const std::string& dirName, const int iDetailLevel = 10); ///fill for things needing truth and track only void fill(const xAOD::TrackParticle& particle, const xAOD::TruthParticle& truthParticle); @@ -61,7 +61,7 @@ public: ///fill for things needing all truth - not just the ones from the reco tracks ///fill reco-vertex related plots - void fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthVertices); + void fill(const xAOD::VertexContainer& vertexContainer, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices); ///fill reco-vertex related plots that need EventInfo void fill(const xAOD::VertexContainer& vertexContainer, unsigned int nPU); diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.cxx deleted file mode 100644 index 8914fbf1294e44c255ac17ec6cca92c4c72090dd..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.cxx +++ /dev/null @@ -1,260 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// ReadFromText.cpp -// HDef -// -// Created by sroe on 16/07/2015. -// 2015 sroe -// - -#include "ReadFromText.h" -#include <fstream> -#include <iostream> -// #include <regex> //buggy?? -#include <sys/stat.h> -#include <algorithm> -// to find the file: -#include "PathResolver/PathResolver.h" -namespace { - std::vector<std::string> - split(const std::string& str, int delimiter(int) = std::isspace) { - std::vector<std::string> result; - auto e = str.end(); - auto i = str.begin(); - - while (i != e) { - i = std::find_if_not(i, e, delimiter); - if (i == e) { - break; - } - auto j = std::find_if(i, e, delimiter); - result.push_back(std::string(i, j)); - i = j; - } - return result; - } -} - - -ReadFromText::ReadFromText() : m_source("unspecified file"), m_format("text/plain") { -} - -ReadFromText::ReadFromText(const std::string& source) : m_source(source), m_format("text/plain") { - m_source = PathResolver::find_file(source, "DATAPATH"); -} - -std::string -ReadFromText::source() const { - return m_source; -} - -std::string -ReadFromText::format() const { - return m_format; -} - -bool -ReadFromText::histoDefinitionMap(std::map<std::string, SingleHistogramDefinition>& usersmap) const { - bool ok(true); - - for (auto i:m_vectorOfDefinitions) { - if (i.empty()) { - continue; - } - if (not i.validType()) { - continue; - } - ok = (usersmap.insert(std::pair<std::string, SingleHistogramDefinition>(i.stringIndex(), i))).second; - if (not ok) { - std::cout << "ReadFromText: bad insertion for " << i.stringIndex() << std::endl; - } - } - return(not usersmap.empty()); -} - -bool -ReadFromText::insertDefinition(const SingleHistogramDefinition& oneDefinition) { - bool ok(true); - - m_vectorOfDefinitions.push_back(oneDefinition); - return ok; -} - -bool -ReadFromText::initialize() { - bool ok(true); - - std::ifstream myfile; - - myfile.open(source()); - if (myfile.is_open()) { - std::string line; - while (std::getline(myfile, line)) { - ok = insertDefinition(parseTextLine(line)); - } - myfile.close(); - } else { - std::cout << "ReadFromText: File '" << source() << "' not found" << std::endl; - ok = false; - } - - return ok; -} - -SingleHistogramDefinition -ReadFromText::parseTextLine(const std::string& line) { - SingleHistogramDefinition s; - - typedef std::vector<std::string> StringVec; - enum RegXHistoGroups { - TOTAL, TYPE, NAME, TITLE, NXBINS, XLO, XHI, NYBINS, YLO, YHI, XLABEL, YLABEL, FOLDER, NGROUPS - }; - enum HistoType { - TH1, TPROFILE, TH2, INVALID - }; - // bool found(true); - /** use lamda expression for delimiter function, get largest chunks between quotes (") - TH1 case: - [0] TH1F 002_Al_N_01 - [1] Visible E_{T} (GeV) - [2] 100 0 100 - [3] Visible E_{T} (GeV) - [4] <empty> - [5] Y axis label - [6] myfolder - - TProfile - [0] TProfile Identifier - [1] "title of this histogram" - [2] xbins xlo xhi ylo yhi - [3] "x axis title" - [4] <empty> - [5] "y axis title" - [6] myfolder - - TH2 case: - [0] TH2F 2D_Identifier - [1] "title of this histogram" - [2] xbins xlo xhi ybins ylo yhi - [3] "x axis title" - [4] <empty> - [5] "y axis title" - [6] myfolder - **/ - HistoType hType(TH1); - // todo: should make an array of functions and delegate - StringVec m(NGROUPS); - m[TOTAL] = line; - StringVec chunks = split(line, [](int d) -> int { - return d == (int) '"'; - }); - const int minimumPossibleSize(3); - if (chunks.size() < minimumPossibleSize) { - return s; - } - StringVec typeAndName = split(chunks[0]); - m[TYPE] = typeAndName[0]; - m[NAME] = typeAndName[1]; - m[TITLE] = chunks[1]; - StringVec nBinsStartEnd = split(chunks[2]); - std::cout << "chunks[2]: '" << chunks[2] << "'" << std::endl; - if (nBinsStartEnd.size() < 3) { - return s; - } - m[NXBINS] = nBinsStartEnd[0]; - m[XLO] = nBinsStartEnd[1]; - m[XHI] = nBinsStartEnd[2]; - if (nBinsStartEnd.size() == 5) { // TProfile; limits given for Y axis also - hType = TPROFILE; - m[NYBINS] = ""; - m[YLO] = nBinsStartEnd[3]; - m[YHI] = nBinsStartEnd[4]; - } - if (nBinsStartEnd.size() == 6) { // 2D histogram; limits given for Y axis also - hType = TH2; - m[NYBINS] = nBinsStartEnd[3]; - m[YLO] = nBinsStartEnd[4]; - m[YHI] = nBinsStartEnd[5]; - } - m[XLABEL] = chunks[3]; - // chunks[4] is the space between two quoted strings - m[YLABEL] = chunks[5]; - std::string str = chunks[6]; - // remove all spaces - str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); - m[FOLDER] = str; - /** - for (const auto &s:m){ - if (s.empty()) std::cout<<"ReadFromText: Problem parsing this line: "<<line<<std::endl; - found&=!(s.empty()); - }**/ - unsigned int nbinsX(0); - float xLo(std::nanf("")); - float xHi(std::nanf("")); - try{ - nbinsX = (unsigned int) (std::stoul(m[NXBINS])); - xLo = std::stof(m[XLO]); - xHi = std::stof(m[XHI]); - } catch (std::invalid_argument& e) { - std::cout << "Problem converting some of the arguments : " << m[NXBINS] << "; " << m[XLO] << "; " << m[XHI] << - std::endl; - hType = INVALID; - } - - switch (hType) { - case TH1: - { - // SingleHistogramDefinition(Titles_t name, Titles_t histoType, Titles_t title, NBins_t nbinsX,Var_t xLo, Var_t - // xHi,Titles_t xName); - SingleHistogramDefinition sx(m[NAME], m[TYPE], m[TITLE], nbinsX, xLo, xHi, m[XLABEL], m[YLABEL], m[FOLDER]); - return sx; - - break; - } - - case TPROFILE: - { - const unsigned int nBinsY = 0; - const float yLo(std::stof(m[YLO])); - const float yHi(std::stof(m[YHI])); - // SingleHistogramDefinition(Titles_t name, Titles_t histoType, Titles_t title, NBins_t nbinsX, NBins_t - // nbinsY,Var_t xLo, Var_t xHi, Var_t yLo, Var_t yHi, Titles_t xName, Titles_t yName, Titles_t theFolder=""); - SingleHistogramDefinition sx(m[NAME], m[TYPE], m[TITLE], nbinsX, nBinsY, xLo, xHi, yLo, yHi, m[XLABEL], m[YLABEL], - m[FOLDER]); - return sx; - - break; - } - - case TH2: - { - const unsigned int nBinsY(std::stof(m[NYBINS])); - const float yLo(std::stof(m[YLO])); - const float yHi(std::stof(m[YHI])); - // SingleHistogramDefinition(Titles_t name, Titles_t histoType, Titles_t title, NBins_t nbinsX, NBins_t - // nbinsY,Var_t xLo, Var_t xHi, Var_t yLo, Var_t yHi, Titles_t xName, Titles_t yName, Titles_t theFolder=""); - SingleHistogramDefinition sx(m[NAME], m[TYPE], m[TITLE], nbinsX, nBinsY, xLo, xHi, yLo, yHi, m[XLABEL], m[YLABEL], - m[FOLDER]); - return sx; - - break; - } - - default: - { - std::cout << "ReadFromText.cxx: Possible problem in parsing this line: \n" << line << "\nof file " << source() << - std::endl; - return SingleHistogramDefinition(); - } - } -} - -bool -ReadFromText::sourceExists() const { - struct stat buffer; - - return(stat(m_source.c_str(), &buffer) == 0); -} diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.h deleted file mode 100644 index fe4e7934f643cef6c796b684df2417feb90f6e1a..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromText.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// ReadFromText.h -// HDef -// -// Created by sroe on 16/07/2015. -// - -#ifndef ReadFromText_h -#define ReadFromText_h -#include "IReadHistoDef.h" -#include "InDetPhysValMonitoring/SingleHistogramDefinition.h" -#include <vector> - -class ReadFromText: public IReadHistoDef { -public: - ReadFromText(); - ReadFromText(const std::string& source); - std::string source() const final; - std::string format() const final; - bool histoDefinitionMap(std::map<std::string, SingleHistogramDefinition>& usersMap) const; - bool insertDefinition(const SingleHistogramDefinition& oneDefinition); - bool initialize() final; - bool sourceExists() const; -private: - std::vector <SingleHistogramDefinition> m_vectorOfDefinitions; - SingleHistogramDefinition parseTextLine(const std::string& line); - std::string m_source; - const std::string m_format; -}; -#endif /* defined(ReadFromText_h) */ diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.cxx deleted file mode 100644 index fc8bba18d0a44e65b24c8e678a1eb9a772201958..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// ReadFromXml.cxx -// HDef -// -// Created by sroe on 15/03/2016. -// - -#include "ReadFromXml.h" -#include "xmlUtilities.h" -#include "XmlContentHandlers.h" -#include "ErrorHandler.h" -#include <sys/stat.h> -#include <xercesc/sax2/SAX2XMLReader.hpp> -#include <xercesc/sax2/XMLReaderFactory.hpp> -#include "PathResolver/PathResolver.h" - -ReadFromXml::ReadFromXml() : m_source("unspecified file"), m_format("text/xml") { -} - -ReadFromXml::ReadFromXml(const std::string& source) : m_format("text/xml") { - m_source = PathResolver::find_file(source, "DATAPATH"); -} - -std::string -ReadFromXml::source() const { - return m_source; -} - -std::string -ReadFromXml::format() const { - return m_format; -} - -bool -ReadFromXml::histoDefinitionMap(std::map<std::string, SingleHistogramDefinition>& usersmap) const { - bool ok(true); - - for (auto i:m_vectorOfDefinitions) { - // std::cout<<i.str()<<std::endl; - if (i.empty()) { - continue; - } - if (not i.validType()) { - continue; - } - ok &= (usersmap.insert(std::pair<std::string, SingleHistogramDefinition>(i.stringIndex(), i))).second; - } - return(ok and(not usersmap.empty())); -} - -bool -ReadFromXml::insertDefinition(const SingleHistogramDefinition& /*oneDefinition*/) { - bool ok(true); - - // m_vectorOfDefinitions.push_back(oneDefinition); - return ok; -} - -bool -ReadFromXml::initialize() { - bool ok(true); - - if (m_source.empty() or(not sourceExists())) { - throw std::runtime_error("Could not open file in ReadFromXml initialize"); - } - ; - myXerces::Lib xercesFrame; // RAII xerces context - std::unique_ptr<xercesc::SAX2XMLReader> parser(xercesc::XMLReaderFactory::createXMLReader()); - // using SAX2 API, so register content and error handlers - HDefContentHandler handler(m_vectorOfDefinitions); - XmlErrorHandler errHandler; - parser->setContentHandler(&handler); - parser->setErrorHandler(&errHandler); - // open file and parse - parser->parse(m_source.c_str()); - return ok; -} - -bool -ReadFromXml::sourceExists() const { - struct stat buffer; - - return(stat(m_source.c_str(), &buffer) == 0); -} diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.h deleted file mode 100644 index 84f2814a6c87d3274fe0c2e7ebf8a09ba93ba85a..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXml.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// ReadFromXml.h -// HDef -// -// Created by sroe on 15/03/2016. -// - -#ifndef IDVPM_ReadFromXml_h -#define IDVPM_ReadFromXml_h -#include "IReadHistoDef.h" -#include <vector> -#include "InDetPhysValMonitoring/SingleHistogramDefinition.h" - - -class ReadFromXml: public IReadHistoDef { -public: - ReadFromXml(); - ReadFromXml(const std::string& source); - std::string source() const final; - std::string format() const final; - bool histoDefinitionMap(std::map<std::string, SingleHistogramDefinition>& usersMap) const final; - bool insertDefinition(const SingleHistogramDefinition& oneDefinition); - bool initialize() final; - bool sourceExists() const final; -private: - std::vector <SingleHistogramDefinition> m_vectorOfDefinitions; - SingleHistogramDefinition parseTextLine(const std::string& line); - std::string m_source; - const std::string m_format; -}; -#endif /* ReadFromXml_h */ \ No newline at end of file diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/XmlContentHandlers.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/XmlContentHandlers.h deleted file mode 100644 index 4ff85275f055a3137b3f48f9d10385a508e12643..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/XmlContentHandlers.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// XmlContentHandlers.hpp -// HDef -// -// Created by sroe on 16/03/2016. -// - -#ifndef XmlContentHandlers_h -#define XmlContentHandlers_h - -#include <stdexcept> -#include <vector> -#include <xercesc/sax2/Attributes.hpp> -#include <xercesc/sax2/DefaultHandler.hpp> -#include "xmlUtilities.h" -#include <array> -#include <regex> -#include <cmath> -#include "InDetPhysValMonitoring/SingleHistogramDefinition.h" - - -unsigned int -partialHdefFromAttributes(SingleHistogramDefinition& s, const xercesc::Attributes& attrs) { - unsigned int nFilled(0); - // id, type and title are *possible* attributes - XercesString histoStrings[] = { - fromNative("id"), fromNative("type"), fromNative("title") - }; - const XMLCh* val(nullptr); - unsigned int idx { - 0 - }; - - for (auto& h:histoStrings) { - if ((val = attrs.getValue(h.c_str())) != 0) { - switch (idx) { - case 0: - s.name = toNative(val); - break; - - case 1: - s.histoType = toNative(val); - break; - - case 2: - s.title = toNative(val); - break; - } - nFilled++; - } - idx++; - } - return nFilled; -} - -unsigned int -xAxisFromAttributes(SingleHistogramDefinition& s, const xercesc::Attributes& attrs) { - unsigned int nFilled(0); - // title, n, lo and hi are currently *necessary* attributes - XercesString histoStrings[] = { - fromNative("title"), fromNative("n"), fromNative("lo"), fromNative("hi") - }; - const XMLCh* val(nullptr); - unsigned int idx { - 0 - }; - - IHistogramDefinitionSvc::axesLimits_t xaxis(std::nanf(""), std::nanf("")); - - for (auto& h:histoStrings) { - if ((val = attrs.getValue(h.c_str())) != 0) { - switch (idx) { - case 0: - s.xTitle = toNative(val); - break; - - case 1: - s.nBinsX = std::stof(toNative(val)); - break; - - case 2: - xaxis.first = std::stof(toNative(val)); - break; - - case 3: - xaxis.second = std::stof(toNative(val)); - break; - } - nFilled++; - } - idx++; - } - s.xAxis = xaxis; - return nFilled; -} - -unsigned int -yAxisFromAttributes(SingleHistogramDefinition& s, const xercesc::Attributes& attrs) { - unsigned int nFilled(0); - // title, n, lo and hi are currently *necessary* attributes - XercesString histoStrings[] = { - fromNative("title"), fromNative("n"), fromNative("lo"), fromNative("hi") - }; - const XMLCh* val(nullptr); - unsigned int idx { - 0 - }; - - IHistogramDefinitionSvc::axesLimits_t yaxis(std::nanf(""), std::nanf("")); - - for (auto& h:histoStrings) { - if ((val = attrs.getValue(h.c_str())) != 0) { - switch (idx) { - case 0: - s.yTitle = toNative(val); - break; - - case 1: - s.nBinsY = std::stof(toNative(val)); - break; - - case 2: - yaxis.first = std::stof(toNative(val)); - break; - - case 3: - yaxis.second = std::stof(toNative(val)); - break; - } - nFilled++; - } - idx++; - } - s.yAxis = yaxis; - return nFilled; -} - -unsigned int -zAxisFromAttributes(SingleHistogramDefinition& s, const xercesc::Attributes& attrs) { - unsigned int nFilled(0); - // title, n, lo and hi are currently *necessary* attributes - XercesString histoStrings[] = { - fromNative("title"), fromNative("n"), fromNative("lo"), fromNative("hi") - }; - const XMLCh* val(nullptr); - unsigned int idx { - 0 - }; - - IHistogramDefinitionSvc::axesLimits_t zaxis(std::nanf(""), std::nanf("")); - - for (auto& h:histoStrings) { - if ((val = attrs.getValue(h.c_str())) != 0) { - switch (idx) { - case 0: - s.zTitle = toNative(val); - break; - - case 1: - s.nBinsZ = std::stof(toNative(val)); - break; - - case 2: - zaxis.first = std::stof(toNative(val)); - break; - - case 3: - zaxis.second = std::stof(toNative(val)); - break; - } - nFilled++; - } - idx++; - } - s.zAxis = zaxis; - return nFilled; -} - -unsigned int -partialHdefFromText(SingleHistogramDefinition& s, const std::string& line) { - unsigned int nFilled(0); - enum RegXHistoGroups { - TOTAL, TITLE, NBINS, XLO, XHI, XAXIS, YAXIS, DUMMY, FOLDER, NGROUPS - }; - - std::string rex = - R"delim(^\s+"([^"]+)"\s+(\d+)\s+([-+.0-9eE]+)\s+([-+.0-9eE]+)\s+"([^"]+)"\s+"([^"]+)"\s*(.*)\s*$)delim"; - std::regex reg(rex); - std::smatch m; - - if (std::regex_match(line, m, reg)) { - const bool hasFolder = (m.size() == NGROUPS); - s.title = m[TITLE].str(); - s.xTitle = m[XAXIS].str(); - s.yTitle = m[YAXIS].str(); - s.xAxis = IHistogramDefinitionSvc::axesLimits_t(std::stof(m[XLO].str()), std::stof(m[XHI].str())); - s.nBinsX = std::stoi(m[NBINS].str()); - if (hasFolder) { - s.folder = m[FOLDER].str(); - } - nFilled = (int) m.size() - 1; - } - return nFilled; -} - -unsigned int -partialHdefFromTProfText(SingleHistogramDefinition& s, const std::string& line) { - unsigned int nFilled(0); - enum RegXHistoGroups { - TOTAL, TITLE, NBINS, XLO, XHI, YLO, YHI, XAXIS, YAXIS, DUMMY, FOLDER, NGROUPS - }; - - // text like: "Test of TProfile" 20 -50 50 0 200 "#eta" "testEntries" - std::string rex = - R"delim(^\s+"([^"]+)"\s+(\d+)\s+([-+.0-9eE]+)\s+([-+.0-9eE]+)\s+([-+.0-9eE]+)\s+([-+.0-9eE]+)\s+"([^"]+)"\s+"([^"]+)"\s*(.*)\s*$)delim"; - std::regex reg(rex); - std::smatch m; - - if (std::regex_match(line, m, reg)) { - const bool hasFolder = (m.size() == NGROUPS); - s.title = m[TITLE].str(); - s.xTitle = m[XAXIS].str(); - s.yTitle = m[YAXIS].str(); - s.xAxis = IHistogramDefinitionSvc::axesLimits_t(std::stof(m[XLO].str()), std::stof(m[XHI].str())); - s.yAxis = IHistogramDefinitionSvc::axesLimits_t(std::stof(m[YLO].str()), std::stof(m[YHI].str())); - s.nBinsX = std::stoi(m[NBINS].str()); - if (hasFolder) { - s.folder = m[FOLDER].str(); - } - nFilled = (int) m.size() - 1; - } - return nFilled; -} - -class HDefContentHandler: public xercesc::DefaultHandler { -public: - enum HistoTypes { - UNKNOWN, TH1, TPROFILE, TH2, TH3, TEFFICIENCY, NTYPES - }; - HDefContentHandler(std::vector<SingleHistogramDefinition>& defs) : m_histoType(UNKNOWN), m_numberFilled(0), - m_currentDefinition{}, m_definitions(defs), m_currentText() { - // nop - } - - void - startElement(const XMLCh* const /*uri*/, const XMLCh* const localName, const XMLCh* const /*qName*/, - const xercesc::Attributes& attrs) { - const static XercesString hdefStr = fromNative("hdef"); - const static XercesString hStr = fromNative("h"); - const static XercesString xStr = fromNative("x"); - const static XercesString yStr = fromNative("y"); - const static XercesString zStr = fromNative("z"); - unsigned int nFilled(0); - - if (localName == hStr) { - setHistoType(attrs); - nFilled = partialHdefFromAttributes(m_currentDefinition, attrs); - m_currentText.clear(); - } - if (localName == xStr) { - nFilled = xAxisFromAttributes(m_currentDefinition, attrs); - } - if (localName == yStr) { - nFilled = yAxisFromAttributes(m_currentDefinition, attrs); - } - if (localName == zStr) { - nFilled = zAxisFromAttributes(m_currentDefinition, attrs); - } - m_currentText.clear(); - m_numberFilled += nFilled; - } - - void - endElement(const XMLCh* const /*uri*/, const XMLCh* const localName, const XMLCh* const /*qName*/) { - const static XercesString hdefStr = fromNative("hdef"); - const static XercesString hStr = fromNative("h"); - const static XercesString xStr = fromNative("x"); - const static XercesString yStr = fromNative("y"); - - if (localName == hStr) { - std::string line = toNative(m_currentText); - if (m_histoType == TH1) { - unsigned int n = partialHdefFromText(m_currentDefinition, line); - m_numberFilled += n; - } - if (m_histoType == TPROFILE) { - unsigned int n = partialHdefFromTProfText(m_currentDefinition, line); - m_numberFilled += n; - } - - m_currentDefinition.m_empty = (m_numberFilled == 0); - m_currentDefinition.allTitles = m_currentDefinition.titleDigest(); - m_definitions.push_back(m_currentDefinition); - } - } - - void - characters(const XMLCh* const chars, const XMLSize_t length) { - m_currentText.append(chars, length); - } - -private: - HistoTypes m_histoType; - unsigned int m_numberFilled; - SingleHistogramDefinition m_currentDefinition; - std::vector<SingleHistogramDefinition>& m_definitions; - XercesString m_currentText; - void - setHistoType(const xercesc::Attributes& attrs) { - m_histoType = UNKNOWN; - const XMLCh* val(nullptr); - const static XercesString TH1Str = fromNative("TH1F"); - const static XercesString TProfileStr = fromNative("TProfile"); - const static XercesString TH2Str = fromNative("TH2F"); - const static XercesString TH3Str = fromNative("TH3F"); - const static XercesString TEffStr = fromNative("TEfficiency"); - XercesString t = fromNative("type"); - val = attrs.getValue(t.c_str()); - if (val == 0) { - return; - } - if (val == TH1Str) { - m_histoType = TH1; - } - if (val == TProfileStr) { - m_histoType = TPROFILE; - } - if (val == TH2Str) { - m_histoType = TH2; - } - if (val == TH3Str) { - m_histoType = TH3; - } - if (val == TEffStr) { - m_histoType = TEFFICIENCY; - } - } -}; - - - - - -#endif /* XmlContentHandlers_hpp */ diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx index 7799a62a513c3855cb6ec1e9b5a87b181da924ef..f7f4a4fd66cab8e78bcdd3ba400dee56462f1651 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ #include "InDetPhysValMonitoring/InDetPhysValMonitoringTool.h" #include "../InDetPhysValTruthDecoratorAlg.h" #include "../InDetPhysHitDecoratorAlg.h" @@ -7,12 +10,10 @@ #include "../dRMatchingTool.h" #include "../TrackSelectionTool.h" #include "InDetPhysValMonitoring/HistogramDefinitionSvc.h" -#include "InDetPhysValMonitoring/AlgTestHistoDefSvc.h" #include "../AthTruthSelectionTool.h" #include "../DummyTrackSlimmingTool.h" -DECLARE_COMPONENT( AlgTestHistoDefSvc ) DECLARE_COMPONENT( HistogramDefinitionSvc ) DECLARE_COMPONENT( InDetPhysValMonitoringTool ) DECLARE_COMPONENT( InDetPhysValTruthDecoratorAlg ) diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh index d6e264bd65c805577ee2dbe9072493d51a2f1a3d..5086401058bb4020b8a914e70eb483bbb33ddef9 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh index 0d6de7f0bf7b9d09c928af4c13f7b94dc2c0798f..eb4d9f2de97a49d95479e750a9b1b7247f36689c 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh index d63a8cf9921e261b68c2141ad6f9c462b7e58353..148333086560accb235a402e25a7a8f5a4b122c5 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..214093a27a6559b757dc6ba4945d8b782f3e6891 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single mu 100GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422036.ParticleGun_single_mu_Pt100.merge.EVNT.e7967_e5984_tid20254953_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_mu_100GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_mu_100GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_mu_100GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_mu_100GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh index 492d1c56a33b2b14f7048e38cf19d9ae3f2bde6e..726e0bcf4173db34353d6c5e3395855c1af2b332 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh index 3270aaaf11a037d3ec17dc3a093ed7ca6b979e3f..7e8ca67601355b8336845ca9c8a952f422140334 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..cf55b9bfb7867964508519f11197a35582db2511 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single mu 1GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422032.ParticleGun_single_mu_Pt1.merge.EVNT.e7967_e5984_tid20254902_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_mu_1GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_mu_1GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_mu_1GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_mu_1GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh index 3ca26b9e6306f58b768e01cfed0b3d78074d1af1..82b60f8d7e0610be5a82f1b280742a0c3de9c60a 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..2789b5caa69e55fa74ca5faa625fbb4aa68e71f3 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single mu 20GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422035.ParticleGun_single_mu_Pt20.merge.EVNT.e7967_e5984_tid20255021_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_mu_20GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_mu_20GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_mu_20GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_mu_20GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..7e985c36938a12df85edcf93bffe8d1a63c52a57 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single mu 5GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422033.ParticleGun_single_mu_Pt5.merge.EVNT.e7967_e5984_tid20254920_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_mu_5GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_mu_5GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_mu_5GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_mu_5GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh index 738f743f6942e7a1defe0f5985cd37b99216c997..eaaca9a8252c684a13fd9f2c20614e7b4ee214aa 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..27666acc52d30ebb3bbd6658abac9d0441a73e70 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single piplus 1GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422047.ParticleGun_single_piplus_Pt1.merge.EVNT.e7967_e5984_tid20255138_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_piplus_1GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_piplus_1GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_piplus_1GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_piplus_1GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh index 8b66d4d6726e9915df546ee89a064eb9ef244a56..1a87aacf0da3586bdd23a534e355fbd69b87bf50 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh @@ -94,9 +94,9 @@ case $ArtProcess in AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' - rec_tf_exit_code = $? - echo "art-result: $rec_tf_exit_code reco_${ArtInFile}" - if [ $rec_tf_exit_code -ne 0 ] ;then + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco_${file}" + if [ $rec_tf_exit_code -ne 0 ] ;then success_run=$rec_tf_exit_code fi ls -lR diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh new file mode 100755 index 0000000000000000000000000000000000000000..7d17e449811e0a1d3eab1b1db152f2a2ecfd3375 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# art-description: art job for InDetPhysValMonitoring, Single piplus 5GeV +# art-type: grid +# art-input: user.keli:user.keli.mc16_13TeV.422048.ParticleGun_single_piplus_Pt5.merge.EVNT.e7967_e5984_tid20255154_00 +# art-input-nfiles: 1 +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* + +# Fix ordering of output in logfile +exec 2>&1 +run() { (set -x; exec "$@") } + +# Following specify DCube output directories. Set empty to disable. +dcube_sim_fixref="dcube_sim" +dcube_sim_lastref="dcube_sim_last" +dcube_pixel_fixref="dcube_pixel" +dcube_pixel_lastref="dcube_pixel_last" +dcube_sct_fixref="dcube_sct" +dcube_sct_lastref="dcube_sct_last" +dcube_rec_fixref="dcube" +dcube_rec_lastref="dcube_last" + +artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art +name="run2" +script="`basename \"$0\"`" +hits=physval.HITS.root +dcubemon_sim=SiHitValid.root +dcubemon_rec=physval.ntuple.root +dcubemon_pixel=PixelRDOAnalysis.root +dcubemon_sct=SCT_RDOAnalysis.root +dcubecfg_sim=$artdata/InDetPhysValMonitoring/dcube/config/run2_SiHitValid.xml +dcuberef_sim=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SiHitValid_piplus_5GeV_simreco.root +dcubecfg_pixel=$artdata/InDetPhysValMonitoring/dcube/config/run2_PixelRDOAnalysis.xml +dcuberef_pixel=$artdata/InDetPhysValMonitoring/ReferenceHistograms/PixelRDOAnalysis_piplus_5GeV_simreco.root +dcubecfg_sct=$artdata/InDetPhysValMonitoring/dcube/config/run2_SCTRDOAnalysis.xml +dcuberef_sct=$artdata/InDetPhysValMonitoring/ReferenceHistograms/SCT_RDOAnalysis_piplus_5GeV_simreco.root +dcubecfg_rec=$artdata/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml +dcuberef_rec=$artdata/InDetPhysValMonitoring/ReferenceHistograms/physval_piplus_5GeV_simreco.root +art_dcube=$ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py + +lastref_dir=last_results + + +# Sim step (based on PanDA job 3777178576 which made HITS.12860054._032508.pool.root.1, which is the input for AMI config q221): + run Sim_tf.py \ + --AMITag s3505 \ + --inputEVNTFile ${ArtInFile} \ + --outputHITSFile "$hits" \ + --skipEvents 0 \ + --maxEvents 10000 \ + --runNumber 410470 \ + --firstEvent 24303001 \ + --randomSeed 24304 \ + --DataRunNumber 284500 \ + --physicsList FTFP_BERT_ATL_VALIDATION \ + --truthStrategy MC15aPlus \ + --simulator FullG4 \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01_VALIDATION' \ + --preExec EVNTtoHITS:'simFlags.SimBarcodeOffset.set_Value_and_Lock(200000)' \ + EVNTtoHITS:'simFlags.TRTRangeCut=30.0; simFlags.TightMuonStepping=True' \ + --preInclude EVNTtoHITS:'SimulationJobOptions/preInclude.FrozenShowersFCalOnly.py' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.SiHitAnalysis.py' +sim_tf_exit_code=$? +echo "art-result: $sim_tf_exit_code sim" + +if [ $sim_tf_exit_code -eq 0 ] ;then + + echo "download latest result" + run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" + run ls -la "$lastref_dir" + # DCube Sim hit plots + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_fixref} \ + -c ${dcubecfg_sim} \ + -r ${dcuberef_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sim_lastref} \ + -c ${dcubecfg_sim} \ + -r ${lastref_dir}/${dcubemon_sim} \ + ${dcubemon_sim} + echo "art-result: $? plots for sim with fixed reference" + + # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. + run Reco_tf.py \ + --inputHITSFile "$hits" \ + --outputAODFile physval.AOD.root \ + --outputNTUP_PHYSVALFile ${dcubemon_rec} \ + --steering doRAWtoALL \ + --checkEventCount False \ + --ignoreErrors True \ + --maxEvents -1 \ + --valid True \ + --validationFlags doInDet \ + --preExec 'from InDetRecExample.InDetJobProperties import InDetFlags; \ + InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ + from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ + InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ + InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ + InDetPhysValFlags.doPhysValOutput.set_Value_and_Lock(True); \ + rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ + rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ + rec.doLArg=False; rec.doLucid=False; rec.doMuon=False; rec.doMuonCombined=False; \ + rec.doSemiDetailedPerfMon=True; rec.doTau=False; rec.doTile=False;\ + from ParticleBuilderOptions.AODFlags import AODFlags;\ + AODFlags.ThinGeantTruth.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ + AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ + AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) '\ + --postInclude 'default:PyJobTransforms/UseFrontier.py,InDetPhysValMonitoring/postInclude.RDOAnalysis.py' + rec_tf_exit_code=$? + echo "art-result: $rec_tf_exit_code reco" + + if [ $rec_tf_exit_code -eq 0 ] ;then + + echo "compare with a fixed R22" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_fixref} \ + -c ${dcubecfg_rec} \ + -r ${dcuberef_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_rec_lastref} \ + -c ${dcubecfg_rec} \ + -r ${lastref_dir}/${dcubemon_rec} \ + ${dcubemon_rec} + echo "art-result: $? rec plots" + + echo "compare with a fixed R22 for PixelRDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_fixref} \ + -c ${dcubecfg_pixel} \ + -r ${dcuberef_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_pixel_lastref} \ + -c ${dcubecfg_pixel} \ + -r ${lastref_dir}/${dcubemon_pixel} \ + ${dcubemon_pixel} + echo "art-result: $? pixel plots" + + echo "compare with a fixed R22 for SCT_RDOAnalysis" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_fixref} \ + -c ${dcubecfg_sct} \ + -r ${dcuberef_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + + echo "compare with last build" + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x ${dcube_sct_lastref} \ + -c ${dcubecfg_sct} \ + -r ${lastref_dir}/${dcubemon_sct} \ + ${dcubemon_sct} + echo "art-result: $? SCT plots" + fi + +fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU0_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU0_reco.sh index 23d58d7a3e90ad0f87b17c32db7e69e21d86dbe3..91315337749144f7d619c41c2a371b4c3913b7d5 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU0_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU0_reco.sh @@ -11,6 +11,7 @@ exec 2>&1 run() { (set -x; exec "$@") } +lastref_dir=last_results artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art inputRDO=${artdata}/InDetPhysValMonitoring/inputs/OUT.RDO_ttbar_PU0.pool.root dcubeXml="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml" @@ -43,10 +44,10 @@ run Reco_tf.py \ AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' -rec_tf_exit_code = $? +rec_tf_exit_code=$? echo "art-result: $rec_tf_exit_code reco" -if [ $rec_tf_exit_code -eq 0 ] ;then +if [ $rec_tf_exit_code -eq 0 ] ;then echo "download latest result" run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" run ls -la "$lastref_dir" @@ -63,7 +64,7 @@ if [ $rec_tf_exit_code -eq 0 ] ;then $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ -p -x dcube_last \ -c ${dcubeXml} \ - -r last_results/physval.ntuple.root \ + -r ${lastref_dir}/physval.ntuple.root \ physval.ntuple.root echo "art-result: $? plots" fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh index 18d231499f4150015a83c7c5577f5800c380499f..8bf728909983f839f607e71b47bc868c5592b024 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh @@ -11,6 +11,7 @@ exec 2>&1 run() { (set -x; exec "$@") } +lastref_dir=last_results artdata=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art inputRDO=${artdata}/InDetPhysValMonitoring/inputs/OUT.RDO_ttbar_PU40.pool.root dcubeXml="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/dcube/config/IDPVMPlots_R22.xml" @@ -43,10 +44,10 @@ run Reco_tf.py \ AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False); \ AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);\ AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False) ' -rec_tf_exit_code = $? +rec_tf_exit_code=$? echo "art-result: $rec_tf_exit_code reco" -if [ $rec_tf_exit_code -eq 0 ] ;then +if [ $rec_tf_exit_code -eq 0 ] ;then echo "download latest result" run art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" run ls -la "$lastref_dir" @@ -63,7 +64,7 @@ if [ $rec_tf_exit_code -eq 0 ] ;then $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ -p -x dcube_last \ -c ${dcubeXml} \ - -r last_results/physval.ntuple.root \ + -r ${lastref_dir}/physval.ntuple.root \ physval.ntuple.root echo "art-result: $? plots" fi diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx index cff0b8d5b91b9b605356f53163deae82fc97d542..f4a4c03cfddf93191775ffcd815302785ebe63e8 100755 --- a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx +++ b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -405,11 +405,11 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { for (; rioIterator != (*containerIterator)->end(); rioIterator++) { // get the surface center of the RIO if (!(*rioIterator)) { - ATH_MSG_WARNING( "NULL pointer to RIO" ); + ATH_MSG_WARNING( "nullptr to RIO" ); continue; } if (!((*rioIterator)->detectorElement())) { - ATH_MSG_WARNING( "in RIO: NULL pointer to detElement" ); + ATH_MSG_WARNING( "in RIO: nullptr to detElement" ); continue; } diff --git a/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt index 14eebba8b7d4c4a54b9b287a1aea11ff261d1954..fab173e34b7df627866ad82d8cb8147fd8fdece8 100644 --- a/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt @@ -29,7 +29,7 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Eigen ) -find_package( ROOT COMPONENTS Core Geometry Tree MathCore Hist RIO pthread TBB ) +find_package( ROOT COMPONENTS Core Tree Hist RIO ) # Generate a CINT dictionary source file: atlas_add_root_dictionary( InDetTruthVertexValidationLib _cintDictSource @@ -41,14 +41,14 @@ atlas_add_root_dictionary( InDetTruthVertexValidationLib _cintDictSource atlas_add_library( InDetTruthVertexValidationLib Root/*.cxx ${_cintDictSource} PUBLIC_HEADERS InDetTruthVertexValidation - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} EventPrimitives xAODTracking AsgTools xAODEventInfo xAODTruth ${extra_libs}) if( NOT XAOD_STANDALONE ) atlas_add_component( InDetTruthVertexValidation src/*.cxx src/*.h src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${extra_libs} EventPrimitives xAODTracking AthenaBaseComps AsgTools xAODEventInfo xAODTruth InDetTruthVertexValidationLib ) endif() diff --git a/LArCalorimeter/LArCellRec/ATLAS_CHECK_THREAD_SAFETY b/LArCalorimeter/LArCellRec/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..1774de260def5bf35b9d8b3c884ed245b06d405d --- /dev/null +++ b/LArCalorimeter/LArCellRec/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +LArCalorimeter/LArCellRec diff --git a/LArCalorimeter/LArCellRec/CMakeLists.txt b/LArCalorimeter/LArCellRec/CMakeLists.txt index 8bd8478b945db4f6f251daf289329951e985fa53..bde13e2f6559e4c93a0d5704f7ec9882de5db2e0 100644 --- a/LArCalorimeter/LArCellRec/CMakeLists.txt +++ b/LArCalorimeter/LArCellRec/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Control/AthenaKernel Control/StoreGate + Control/CxxUtils DetectorDescription/AtlasDetDescr DetectorDescription/Identifier GaudiKernel @@ -45,12 +46,15 @@ find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( TBB ) -# Component(s) in the package: +#Component(s) in the package: atlas_add_component( LArCellRec src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${TBB_LIBRARIES} CaloConditions CaloDetDescrLib CaloEvent CaloIdentifier CaloRecLib CaloUtilsLib AthAllocators AthenaBaseComps AthenaKernel StoreGateLib SGtests AtlasDetDescr Identifier GaudiKernel LArIdentifier LArRawEvent LArRecConditions LArCOOLConditions LArSimEvent CaloTriggerToolLib AthenaPoolUtilities xAODEventInfo xAODTrigL1Calo GeneratorObjects LArRecEvent LArCablingLib TrigT1CaloCalibConditions TrigT1CaloCondSvcLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${TBB_LIBRARIES} CaloConditions CaloDetDescrLib CaloEvent CaloIdentifier + CaloRecLib CaloUtilsLib AthAllocators AthenaBaseComps AthenaKernel StoreGateLib CxxUtils SGtests AtlasDetDescr Identifier GaudiKernel LArIdentifier + LArRawEvent LArRecConditions LArCOOLConditions LArSimEvent CaloTriggerToolLib AthenaPoolUtilities xAODEventInfo xAODTrigL1Calo GeneratorObjects + LArRecEvent LArCablingLib TrigT1CaloCalibConditions TrigT1CaloCondSvcLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/LArCalorimeter/LArCellRec/src/LArCellDeadOTXCorr.h b/LArCalorimeter/LArCellRec/src/LArCellDeadOTXCorr.h index f8a728430ee680007411456c0272db97118e6a89..44259ee53835900bb54f93f6a9f053ac2f233c76 100644 --- a/LArCalorimeter/LArCellRec/src/LArCellDeadOTXCorr.h +++ b/LArCalorimeter/LArCellRec/src/LArCellDeadOTXCorr.h @@ -41,6 +41,7 @@ #include "StoreGate/ReadCondHandle.h" #include "tbb/concurrent_unordered_map.h" +#include "CxxUtils/checker_macros.h" #include "LArRecConditions/LArBadChannelCont.h" #include "LArCabling/LArOnOffIdMapping.h" @@ -95,97 +96,100 @@ class LArCellDeadOTXCorr private: SG::ReadCondHandleKey<LArBadFebCont> m_badFebKey{this,"BadFebKey","LArBadFeb","Key of Bad-Feb object"}; SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "CablingKey", "LArOnOffIdMap","Cabling key"}; - //std::string m_TTLocation; - SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_TTLocation; - std::vector<double> m_triggerNoiseCut; - bool m_useL1CaloDBProp; - mutable std::atomic<bool> m_useL1CaloDB; - - CaloRec::Array<1> m_etaCalibrationSizes; - CaloRec::Array<1> m_energyCalibrationTypes; - CaloRec::Array<1> m_etaCalibrations; - CaloRec::Array<1> m_energyCalibrations; - - - static const std::map<int, int> m_typeSizeMapping; - - //CaloRec::Array<1> m_ignoredTTs; - std::vector<unsigned int> m_ignoredTTs; - - - struct IdHash - { - size_t operator() (const Identifier& id) const - { return id.get_compact(); } - }; - mutable tbb::concurrent_unordered_map<Identifier,Identifier,IdHash> m_cellTTMapping; - mutable tbb::concurrent_unordered_map<Identifier, std::pair<unsigned int, int>, IdHash> m_idIndexMapping; - - const CaloIdManager* m_caloMgr; - const CaloLVL1_ID* m_lvl1Helper; - const CaloCell_ID* m_calo_id; - const LArOnlineID* m_onlineID; - const CaloLVL1_ID* m_TT_ID; - - - L1CaloCondSvc* m_l1CondSvc; - //CaloTriggerTowerService* m_ttSvc; - ToolHandle<CaloTriggerTowerService> m_ttSvc; - // L1CaloTTIdTools* m_l1CaloTTIdTools; - - double TTID_etaWidth(double eta) const; - double TTID_phiWidth(double eta) const; - int TTID_pos_neg_z(double eta) const; - int TTID_regionIndex(double eta) const; - int TTID_etaIndex(double eta) const; - int TTID_phiIndex(double eta, double phi) const; - static const double BASEDETA; - static const double BASEDPHI; - static const double FCALDETA; - static const double ETAMAXREGION0; - static const double ETAMAXREGION1; - static const double ETAMAXREGION2; - static const double ETAMAXREGION3; - static const double ETAMIN; - static const double PHIMIN; - - - // functions used to calculate trigger energy from parabola fit - double getA(double x1, double y1, - double x2, double y2, - double x3, double y3) const; - - double getB(double a, - double x1, double y1, - double x2, double y2) const; - - double getC(double a, double b, - double x1, double y1) const; - - - /** - * @brief Compute L1 energy with 5 samples around the maximum of the pulse. - * @param ADCsamples : ADC samples of the trigger tower - * @param pedestal : pedestal of the tower - * @param eta : eta of the tower - * @param type : em=0, had=1 - * @return L1 energy - * - * - * Energy is first estimated with a Landau-Landau fit; then a calibration factor depending on eta and the energy is applied. - */ - double getL1Energy(const std::vector<uint_least16_t> & ADCsamples, int pedestal, double eta, int type) const; - - void getInitialFitParameters(const std::vector<uint_least16_t> & ADCsamples, - double & max, - double& maxPos, - unsigned int& TTADCMaxIndex) const; - - double getEtaCalibration(double eta, int type) const; - double getEnergyCalibration(double eta, int type, double energy) const; - double getMaxOverSumRatio(const std::vector<uint_least16_t>& ADCsamples, int pedestal) const; - - static const std::map<int,int> defineSizeType(); + SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_TTLocation; + std::vector<double> m_triggerNoiseCut; + bool m_useL1CaloDBProp; + mutable std::atomic<bool> m_useL1CaloDB; + + CaloRec::Array<1> m_etaCalibrationSizes; + CaloRec::Array<1> m_energyCalibrationTypes; + CaloRec::Array<1> m_etaCalibrations; + CaloRec::Array<1> m_energyCalibrations; + + static const std::map<int, int> m_typeSizeMapping; + + // CaloRec::Array<1> m_ignoredTTs; + std::vector<unsigned int> m_ignoredTTs; + + struct IdHash + { + size_t operator()(const Identifier& id) const { return id.get_compact(); } + }; + + /* Using concurent unordered map for thread safety*/ + mutable tbb::concurrent_unordered_map<Identifier, Identifier, IdHash> + m_cellTTMapping ATLAS_THREAD_SAFE; + mutable tbb:: + concurrent_unordered_map<Identifier, std::pair<unsigned int, int>, IdHash> + m_idIndexMapping ATLAS_THREAD_SAFE; + + const CaloIdManager* m_caloMgr; + const CaloLVL1_ID* m_lvl1Helper; + const CaloCell_ID* m_calo_id; + const LArOnlineID* m_onlineID; + const CaloLVL1_ID* m_TT_ID; + + L1CaloCondSvc* m_l1CondSvc; + // CaloTriggerTowerService* m_ttSvc; + ToolHandle<CaloTriggerTowerService> m_ttSvc; + // L1CaloTTIdTools* m_l1CaloTTIdTools; + + double TTID_etaWidth(double eta) const; + double TTID_phiWidth(double eta) const; + int TTID_pos_neg_z(double eta) const; + int TTID_regionIndex(double eta) const; + int TTID_etaIndex(double eta) const; + int TTID_phiIndex(double eta, double phi) const; + static const double BASEDETA; + static const double BASEDPHI; + static const double FCALDETA; + static const double ETAMAXREGION0; + static const double ETAMAXREGION1; + static const double ETAMAXREGION2; + static const double ETAMAXREGION3; + static const double ETAMIN; + static const double PHIMIN; + + // functions used to calculate trigger energy from parabola fit + double getA(double x1, + double y1, + double x2, + double y2, + double x3, + double y3) const; + + double getB(double a, double x1, double y1, double x2, double y2) const; + + double getC(double a, double b, double x1, double y1) const; + + /** + * @brief Compute L1 energy with 5 samples around the maximum of the pulse. + * @param ADCsamples : ADC samples of the trigger tower + * @param pedestal : pedestal of the tower + * @param eta : eta of the tower + * @param type : em=0, had=1 + * @return L1 energy + * + * + * Energy is first estimated with a Landau-Landau fit; then a calibration + * factor depending on eta and the energy is applied. + */ + double getL1Energy(const std::vector<uint_least16_t>& ADCsamples, + int pedestal, + double eta, + int type) const; + + void getInitialFitParameters(const std::vector<uint_least16_t>& ADCsamples, + double& max, + double& maxPos, + unsigned int& TTADCMaxIndex) const; + + double getEtaCalibration(double eta, int type) const; + double getEnergyCalibration(double eta, int type, double energy) const; + double getMaxOverSumRatio(const std::vector<uint_least16_t>& ADCsamples, + int pedestal) const; + + static const std::map<int, int> defineSizeType(); }; diff --git a/LArCalorimeter/LArCellRec/src/LArCellEmMiscalib.h b/LArCalorimeter/LArCellRec/src/LArCellEmMiscalib.h index b92ff7245fd3c0e321a95b56ece13ec2011b54cf..f1eaf8f794e7776260cf696426d5574eb82ed071 100755 --- a/LArCalorimeter/LArCellRec/src/LArCellEmMiscalib.h +++ b/LArCalorimeter/LArCellRec/src/LArCellEmMiscalib.h @@ -41,7 +41,7 @@ class LArCellEmMiscalib : public CaloCellCorrection const std::string& name, const IInterface* parent) ; - virtual ~LArCellEmMiscalib() {}; + virtual ~LArCellEmMiscalib()=default; /*! Constructor */ virtual StatusCode initialize() override; @@ -55,8 +55,8 @@ class LArCellEmMiscalib : public CaloCellCorrection void smearingPerRegion(); const LArEM_ID* m_larem_id; - const DataHandle<CaloIdManager> m_caloIdMgr; - const DataHandle<CaloDetDescrManager> m_calodetdescrmgr; + const CaloIdManager* m_caloIdMgr; + const CaloDetDescrManager* m_calodetdescrmgr; IAtRndmGenSvc* m_AtRndmGenSvc; CLHEP::HepRandomEngine* m_engine; diff --git a/LArCalorimeter/LArCellRec/src/LArCellHVCorr.cxx b/LArCalorimeter/LArCellRec/src/LArCellHVCorr.cxx index 0e8de34bcf3e5d019f8f2d675235840c4962586f..158d04b0f3f76828b4f0ea570a7704ad359385a0 100644 --- a/LArCalorimeter/LArCellRec/src/LArCellHVCorr.cxx +++ b/LArCalorimeter/LArCellRec/src/LArCellHVCorr.cxx @@ -30,6 +30,7 @@ StatusCode LArCellHVCorr::initialize() { float LArCellHVCorr::getCorrection(const Identifier id) { + //Here we ADD const-ness so const_cast is fine return const_cast<const LArCellHVCorr*>(this)->getCorrection (id); } diff --git a/LArCalorimeter/LArCellRec/src/LArCellRescaler.h b/LArCalorimeter/LArCellRec/src/LArCellRescaler.h index 9ef555c8b6f4f88d4a138d7c160308f1764ed1d8..2825a8f8b47ea2367362b7762a7392cc6bc3eddb 100755 --- a/LArCalorimeter/LArCellRec/src/LArCellRescaler.h +++ b/LArCalorimeter/LArCellRec/src/LArCellRescaler.h @@ -12,6 +12,7 @@ #include "CaloConditions/CaloCellFactor.h" #include "StoreGate/DataHandle.h" #include "AthenaKernel/IOVSvcDefs.h" +#include "CxxUtils/checker_macros.h" #include <string> class CaloCell; @@ -28,7 +29,9 @@ ToolSvc.LArCellRescaler.CorrectionKey="myCorrectionKey" */ -class LArCellRescaler : public CaloCellCorrection { +//Not safe due to callbacks +class ATLAS_NOT_THREAD_SAFE LArCellRescaler : public CaloCellCorrection +{ public: diff --git a/LArCalorimeter/LArCellRec/src/LArNonLinearity.cxx b/LArCalorimeter/LArCellRec/src/LArNonLinearity.cxx index e9d731e0dad5f182145e298323f2aad80df46961..21853e05f95eb1c19c4b74302b5b02474ebd00a4 100644 --- a/LArCalorimeter/LArCellRec/src/LArNonLinearity.cxx +++ b/LArCalorimeter/LArCellRec/src/LArNonLinearity.cxx @@ -87,7 +87,7 @@ StatusCode LArNonLinearity::initialize() ATH_MSG_INFO( " Initialize LArNonLinearity " ); // pointer to DD manager and helpers: - const DataHandle<CaloIdManager> caloIdMgr; + const CaloIdManager* caloIdMgr; ATH_CHECK( detStore()->retrieve(caloIdMgr) ); m_emID = caloIdMgr->getEM_ID(); diff --git a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx index 8a0b30657dcc51774772cc9b89f1ea45beeaca01..c75c8e931d35ae775bba4497c6e621d6f736b359 100644 --- a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx +++ b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx @@ -10,11 +10,10 @@ LArClusterCollisionTimeAlg:: LArClusterCollisionTimeAlg(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name,pSvcLocator), m_nEvt(0), - m_nCollEvt(0) - { - declareProperty("InputName", m_clusterContainerName="LArClusterEM"); - declareProperty("OutputName",m_outputName="LArClusterCollTime"); - } + m_nCollEvt(0), + m_clusterContainerName{this, "InputName", "LArClusterEM"}, + m_outputName{this, "OutputName", "LArClusterCollTime"} + {} //__________________________________________________________________________ //Destructor diff --git a/LArCalorimeter/LArCnv/LArByteStream/python/LArRawDataReadingConfig.py b/LArCalorimeter/LArCnv/LArByteStream/python/LArRawDataReadingConfig.py index 138661dda9d26e57357c2461592439950d747fea..b490df92fa776b4508c5e3ca6b34c2e7770a87e3 100644 --- a/LArCalorimeter/LArCnv/LArByteStream/python/LArRawDataReadingConfig.py +++ b/LArCalorimeter/LArCnv/LArByteStream/python/LArRawDataReadingConfig.py @@ -15,6 +15,8 @@ def LArRawDataReadingCfg(configFlags, **kwargs): kwargs.setdefault("LArDigitKey", configFlags.Overlay.BkgPrefix + "FREE") kwargs.setdefault("LArRawChannelKey", "") + kwargs.setdefault("FailOnCorruption",False) + acc.addEventAlgo(LArRawDataReadingAlg(**kwargs)) return acc diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx index 192662a4bd0a730a1890a4ad1cc901ee38f3accf..f0d852f2c4463e253f5e684a4e1243fb4579655b 100644 --- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx +++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx @@ -28,6 +28,8 @@ LArRawDataReadingAlg::LArRawDataReadingAlg(const std::string& name, ISvcLocator* m_doFebHeaders = !m_febHeaderKey.empty(); ATH_CHECK(m_febHeaderKey.initialize(m_doFebHeaders)); + ATH_CHECK(m_eventInfoKey.initialize() ); + ATH_CHECK(m_robDataProviderSvc.retrieve()); ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID")); return StatusCode::SUCCESS; @@ -80,11 +82,19 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const { ATH_MSG_VERBOSE("Decoding ROB fragment 0x" << std::hex << rob.rob_source_id () << " with " << std::dec << rob.rod_fragment_size_word() << "ROB words"); if (rob.rod_fragment_size_word() <3) { - ATH_MSG_ERROR("Encountered corrupt ROD fragment, less than 3 words!"); if (m_failOnCorruption) { + ATH_MSG_ERROR("Encountered corrupt ROD fragment, less than 3 words!"); return StatusCode::FAILURE; - }else + }else { + // set corruption flag for this event + SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx); + if (!eventInfo->updateErrorState(xAOD::EventInfo::LAr,xAOD::EventInfo::Error)) { + ATH_MSG_WARNING( " cannot set error state for LAr " ); + } else { + ATH_MSG_WARNING( " error state for LAr data corruption set" ); + } continue; + } } eformat::helper::Version ver(rob.rod_version()); @@ -125,13 +135,21 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const { const uint32_t onsum = rodBlock->onlineCheckSum(); const uint32_t offsum = rodBlock->offlineCheckSum(); if(onsum!=offsum) { - ATH_MSG_ERROR("Checksum error:"); - ATH_MSG_ERROR("online checksum = 0x" << MSG::hex << onsum); - ATH_MSG_ERROR("offline checksum = 0x" << MSG::hex << offsum << MSG::dec); - if (m_failOnCorruption) + if (m_failOnCorruption) { + ATH_MSG_ERROR("Checksum error:"); + ATH_MSG_ERROR("online checksum = 0x" << MSG::hex << onsum); + ATH_MSG_ERROR("offline checksum = 0x" << MSG::hex << offsum << MSG::dec); return StatusCode::FAILURE; - else - continue; //Jump to the next ROD-block + } else { + // set corruption flag for this event + SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx); + if (!eventInfo->updateErrorState(xAOD::EventInfo::LAr,xAOD::EventInfo::Error)) { + ATH_MSG_WARNING( " cannot set error state for LAr " ); + } else { + ATH_MSG_WARNING( " error state for LAr data corruption set" ); + } + continue; //Jump to the next ROD-block + } } } @@ -139,11 +157,12 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const { do { HWIdentifier fId(Identifier32(rodBlock->getFEBID())); if (!m_onlineId->isValidId(fId)) { - ATH_MSG_ERROR("Invalid FEB identifer 0x" << std::hex << fId.get_identifier32().get_compact()); - if (m_failOnCorruption) + if (m_failOnCorruption){ + ATH_MSG_ERROR("Invalid FEB identifer 0x" << std::hex << fId.get_identifier32().get_compact()); return StatusCode::FAILURE; - else + } else { continue; + } } const int NthisFebChannel=m_onlineId->channelInSlotMax(fId); diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.h b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.h index 16152ba179c44bfc7da32a8fe66c41b08b2ccc44..9ab0798169ad45e7059d19eaf6aa4384bac970db 100644 --- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.h +++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.h @@ -12,6 +12,8 @@ #include "LArCabling/LArOnOffIdMapping.h" #include "GaudiKernel/ServiceHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" //Event classes class LArRawChannelContainer; @@ -34,6 +36,8 @@ class LArRawDataReadingAlg : public AthReentrantAlgorithm { SG::WriteHandleKey<LArDigitContainer> m_digitKey{this,"LArDigitKey","FREE"}; SG::WriteHandleKey<LArFebHeaderContainer> m_febHeaderKey{this,"LArFebHeaderKey","LArFebHeader"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "eventInfoKey", "EventInfo", "Key for EventInfo object"}; + //Service providing the input data ServiceHandle<IROBDataProviderSvc> m_robDataProviderSvc{this,"ROBDataProviderSvc","ROBDataProviderSvc"}; diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml index d5608b5a44d9a6a4b216e18010c8ed609b747ab6..1c508a2baa508d353c6ec8353a20531cbc635679 100644 --- a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml @@ -14,7 +14,12 @@ <class name="LArNoisyROSummary_p5" id="4AE11DAE-F40C-4B90-B105-0A7BA5D29C1D"/> <class name="std::vector<std::pair<unsigned int, std::vector<int> > >" /> <!-- pair<unsigned,vector<int> > and associated pair_base --> - <class pattern="std::*pair*<unsigned int*std::vector<int*" /> + <class pattern="std::*pair*<unsigned int*std::vector<int*> >" /> + <exclusion> + <!-- Exclude internal traits classes using pair that could be + matched by the previous rules. --> + <class pattern="*<std::pair*" /> + </exclusion> </lcgdict> diff --git a/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py b/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py index f4ae4b2a6325b701f7e88db2b29f858ec99dcaca..ca363c26e4bdd14ace498c95a595c988c3cdedfd 100644 --- a/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py +++ b/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py @@ -23,9 +23,10 @@ def LArMonitoringConfig(inputFlags): # algos which can run in ESD but not AOD: if inputFlags.DQ.Environment != 'AOD': - from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg - acc.merge(BunchCrossingCondAlgCfg(inputFlags)) - acc.merge(LArCollisionTimeMonConfig(inputFlags)) + if inputFlags.DQ.DataType != 'cosmics': + from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg + acc.merge(BunchCrossingCondAlgCfg(inputFlags)) + acc.merge(LArCollisionTimeMonConfig(inputFlags)) # and others on RAW data only if inputFlags.DQ.Environment in ('online', 'tier0', 'tier0Raw'): diff --git a/LArCalorimeter/LArExample/TestLArDetDescr/CMakeLists.txt b/LArCalorimeter/LArExample/TestLArDetDescr/CMakeLists.txt index 2d7296d2527deb5aade913ae400b27f736143997..49484db3737f4ff99ac9f1cd30b51f6a03831537 100644 --- a/LArCalorimeter/LArExample/TestLArDetDescr/CMakeLists.txt +++ b/LArCalorimeter/LArExample/TestLArDetDescr/CMakeLists.txt @@ -27,7 +27,7 @@ atlas_add_component( TestLArDetDescr src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloIdentifier AthenaBaseComps GaudiKernel CaloGeoHelpers CaloTTDetDescr StoreGateLib SGtests LArIdentifier ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloIdentifier AthenaBaseComps GaudiKernel CaloGeoHelpers CaloTTDetDescr StoreGateLib SGtests LArIdentifier CaloTrackingGeometryLib ) # Install files from the package: atlas_install_headers( TestLArDetDescr ) diff --git a/LArCalorimeter/LArExample/TestLArHardwareID/CMakeLists.txt b/LArCalorimeter/LArExample/TestLArHardwareID/CMakeLists.txt index 0a1e974d3d3f93839df708026d25347d62ec3b23..7af2ab21a883cdcfb9aba52a92859350e50b34de 100644 --- a/LArCalorimeter/LArExample/TestLArHardwareID/CMakeLists.txt +++ b/LArCalorimeter/LArExample/TestLArHardwareID/CMakeLists.txt @@ -24,7 +24,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( TestLArHardwareID src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel CaloIdentifier CaloTriggerToolLib AthenaKernel StoreGateLib SGtests LArCablingLib LArIdentifier LArRecConditions PathResolver ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel CaloIdentifier CaloTriggerToolLib AthenaKernel StoreGateLib SGtests LArCablingLib LArIdentifier LArRecConditions PathResolver RegistrationServicesLib ) # Install files from the package: atlas_install_headers( TestLArHardwareID ) diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EMECConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EMECConstruction.cxx index 91e7853089f1570e8a2d24e992e85f6a236d396d..5d68a241f47e633c7d79b39fd9f807a5565857a8 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EMECConstruction.cxx +++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EMECConstruction.cxx @@ -79,6 +79,7 @@ #include "LArGeoEndcap/EMECConstruction.h" #include "LArGeoEndcap/EMECSupportConstruction.h" +#include "GeoModelKernel/GeoUnidentifiedShape.h" LArGeo::EMECConstruction::EMECConstruction(bool is_tb, bool has_inner, bool has_outer) : m_fullGeo(true), m_isTB(is_tb), m_hasInnerWheel(has_inner), m_hasOuterWheel(has_outer), @@ -580,42 +581,56 @@ void LArGeo::EMECConstruction::place_custom_solids( const GeoMaterial *Glue, const GeoMaterial *Lead ) { - for(auto shape: absorbers){ - GeoLogVol* log_volume = new GeoLogVol(shape->name(), shape, Absorber); - GeoPhysVol* phys_volume = new GeoPhysVol(log_volume); - fullPV->add(new GeoIdentifierTag(1)); - fullPV->add(new GeoTransform(GeoTrf::Transform3D::Identity())); - fullPV->add(phys_volume); - if(multilayered_absorbers > 0){ - GeoPhysVol* glue_phys = phys_volume; - std::string lead_name = shape->name(); - size_t repl = lead_name.find("Absorber"); - if(std::string::npos != repl) lead_name.replace(repl, 8, "Lead"); - else throw std::runtime_error(lead_name + ": cannot find 'Absorber'"); - if(multilayered_absorbers != 2){ - std::string glue_name = shape->name(); - glue_name.replace(repl, 8, "Glue"); - LArCustomShape* glue_shape = new LArCustomShape(glue_name); - GeoLogVol* glue_log = new GeoLogVol(glue_name, glue_shape, Glue); - glue_phys = new GeoPhysVol(glue_log); - phys_volume->add(new GeoIdentifierTag(1)); - phys_volume->add(new GeoTransform(GeoTrf::Transform3D::Identity())); - phys_volume->add(glue_phys); - } - LArCustomShape* lead_shape = new LArCustomShape(lead_name); - GeoLogVol *lead_log = new GeoLogVol(lead_name, lead_shape, Lead); - GeoPhysVol *lead_phys = new GeoPhysVol(lead_log); - glue_phys->add(new GeoIdentifierTag(1)); - glue_phys->add(new GeoTransform(GeoTrf::Transform3D::Identity())); - glue_phys->add(lead_phys); - } + + // This lambda function creates a proxy for the LArCustomShape: + auto toUnidentified = [] (const LArCustomShape *inputShape) + { + std::string name= inputShape->name(); + return new GeoUnidentifiedShape("LArCustomShape",name); + }; + + + for(auto shape: absorbers){ + GeoLogVol* log_volume = new GeoLogVol(shape->name(), toUnidentified(shape), Absorber); + GeoPhysVol* phys_volume = new GeoPhysVol(log_volume); + fullPV->add(new GeoIdentifierTag(1)); + fullPV->add(new GeoTransform(GeoTrf::Transform3D::Identity())); + fullPV->add(phys_volume); + if(multilayered_absorbers > 0){ + GeoPhysVol* glue_phys = phys_volume; + std::string lead_name = shape->name(); + size_t repl = lead_name.find("Absorber"); + if(std::string::npos != repl) lead_name.replace(repl, 8, "Lead"); + else throw std::runtime_error(lead_name + ": cannot find 'Absorber'"); + if(multilayered_absorbers != 2){ + std::string glue_name = shape->name(); + glue_name.replace(repl, 8, "Glue"); + LArCustomShape* glue_shape = new LArCustomShape(glue_name); + GeoLogVol* glue_log = new GeoLogVol(glue_name, toUnidentified(glue_shape), Glue); + glue_phys = new GeoPhysVol(glue_log); + phys_volume->add(new GeoIdentifierTag(1)); + phys_volume->add(new GeoTransform(GeoTrf::Transform3D::Identity())); + phys_volume->add(glue_phys); + glue_shape->ref(); glue_shape->unref(); + } + LArCustomShape* lead_shape = new LArCustomShape(lead_name); + GeoLogVol *lead_log = new GeoLogVol(lead_name, toUnidentified(lead_shape), Lead); + GeoPhysVol *lead_phys = new GeoPhysVol(lead_log); + glue_phys->add(new GeoIdentifierTag(1)); + glue_phys->add(new GeoTransform(GeoTrf::Transform3D::Identity())); + glue_phys->add(lead_phys); + lead_shape->ref(); lead_shape->unref(); } + shape->ref(); shape->unref(); + + } for(auto shape: electrodes){ - GeoLogVol* log_volume = new GeoLogVol(shape->name(), shape, Electrode); - GeoPhysVol* phys_volume = new GeoPhysVol(log_volume); - fullPV->add(new GeoIdentifierTag(1)); - fullPV->add(new GeoTransform(GeoTrf::Transform3D::Identity())); - fullPV->add(phys_volume); + GeoLogVol* log_volume = new GeoLogVol(shape->name(), toUnidentified(shape), Electrode); + GeoPhysVol* phys_volume = new GeoPhysVol(log_volume); + fullPV->add(new GeoIdentifierTag(1)); + fullPV->add(new GeoTransform(GeoTrf::Transform3D::Identity())); + fullPV->add(phys_volume); + shape->ref(); shape->unref(); } } diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx index a0babe38b5396409967b7b9a93bd8c10645fdcc5..df7728fca43acc5c3ae7abd0f04452eeb5bcd11f 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx +++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx @@ -433,7 +433,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos) const double r = (rmin + rmax) * 0.5; const GeoShape* warmwall = solidCyl; const double dphi = 5.*Gaudi::Units::deg; - auto put = [&warmwall, &warmhole_pos, &r, &h1, &dz](double pos){ + auto put = [&warmwall, &warmhole_pos, &r, &h1](double pos){ const double x = r*cos(pos), y = r*sin(pos); warmwall = &(warmwall->subtract( h1 << GeoTrf::Translate3D(x, y, warmhole_pos) @@ -457,7 +457,6 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos) << endmsg; const double rmin = currentRecord->getDouble("RMIN")*Gaudi::Units::cm; const double rmax = currentRecord->getDouble("RMIN")*Gaudi::Units::cm + currentRecord->getDouble("DR")*Gaudi::Units::cm; - const double dz = currentRecord->getDouble("DZ")*Gaudi::Units::cm / 2.; const double coldhole_radius = 0.5*150.*Gaudi::Units::mm; const double coldhole_pos = 21.5*Gaudi::Units::mm; GeoTube *coldhole = new GeoTube(0., coldhole_radius, (rmax - rmin) * 4); @@ -465,7 +464,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos) const double r = (rmin + rmax) * 0.5; const GeoShape *coldwall = solidCyl; const double dphi = 5.*Gaudi::Units::deg; - auto put = [&coldwall, &coldhole_pos, &r, &h1, &dz](double pos){ + auto put = [&coldwall, &coldhole_pos, &r, &h1](double pos){ const double x = r*cos(pos), y = r*sin(pos); coldwall = &(coldwall->subtract( h1 << GeoTrf::Translate3D(x, y, coldhole_pos) diff --git a/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.cxx index a9ec23252c01382b256ec33d58e728d21424fe42..db4ff004b799d58df2d76b5fa5f1de80126c307c 100755 --- a/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -20,7 +20,6 @@ #include "LWHists/TH1F_LW.h" #include "LWHists/TH2F_LW.h" -#include "LArRecEvent/LArCollisionTime.h" #include "xAODEventInfo/EventInfo.h" @@ -59,7 +58,6 @@ LArCollisionTimeMonTool::LArCollisionTimeMonTool(const std::string& type, declareProperty( "timeDiffCut" , m_timeCut = 5.0 ); declareProperty( "nCells" , m_minCells = 2 ); declareProperty( "eWeighted" , m_eWeighted = true ); - declareProperty( "Key" , m_key="LArCollisionTime"); declareProperty( "histPath" , m_histPath="LArCollisionTime"); declareProperty( "BunchCrossingTool" , m_bunchGroupTool); declareProperty( "TrainFrontDistance" , m_distance = 30); @@ -91,7 +89,9 @@ StatusCode LArCollisionTimeMonTool::initialize() { ManagedMonitorToolBase::initialize().ignore(); - CHECK(m_bunchGroupTool.retrieve()); + ATH_CHECK( m_EventInfoKey.initialize() ); + ATH_CHECK( m_key.initialize() ); + ATH_CHECK(m_bunchGroupTool.retrieve()); ATH_MSG_DEBUG( "Successful Initialize LArCollisionTimeMonTool " ); return StatusCode::SUCCESS; } @@ -227,11 +227,11 @@ LArCollisionTimeMonTool::fillHistograms() m_eventsCounter++; // --- retrieve event information --- - const xAOD::EventInfo* event_info; + SG::ReadHandle<xAOD::EventInfo> event_info{m_EventInfoKey}; unsigned bunch_crossing_id = 0; unsigned lumi_block = 0; //double event_time_minutes = -1; - if (evtStore()->retrieve( event_info ).isFailure()) { + if (!event_info.isValid()) { ATH_MSG_ERROR( "Failed to retrieve EventInfo object" ); return StatusCode::FAILURE; } @@ -251,8 +251,8 @@ LArCollisionTimeMonTool::fillHistograms() int bcid_distance = m_bunchGroupTool->distanceFromFront(bunch_crossing_id, Trig::IBunchCrossingTool::BunchCrossings); // Retrieve LArCollision Timing information - const LArCollisionTime * larTime; - if(evtStore()->retrieve(larTime,m_key).isFailure()) + SG::ReadHandle<LArCollisionTime> larTime{m_key}; + if(!larTime.isValid()) { ATH_MSG_WARNING( "Unable to retrieve LArCollisionTime event store" ); return StatusCode::SUCCESS; // Check if failure shd be returned. VB @@ -260,7 +260,7 @@ LArCollisionTimeMonTool::fillHistograms() ATH_MSG_DEBUG( "LArCollisionTime successfully retrieved from event store" ); } - if (larTime and !(event_info->isEventFlagBitSet(xAOD::EventInfo::LAr,3))) {// Do not fill histo if noise burst suspected + if (!(event_info->isEventFlagBitSet(xAOD::EventInfo::LAr,3))) {// Do not fill histo if noise burst suspected // Calculate the time diff between ECC and ECA m_ECTimeDiff = larTime->timeC() - larTime->timeA(); m_ECTimeAvg = (larTime->timeC() + larTime->timeA()) / 2.0; diff --git a/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.h b/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.h index e7b1463bb1a8d3c123be3ab52fc1f4227bf17f45..953acade241451835fafb3076c09d9198b5e0a75 100755 --- a/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.h +++ b/LArCalorimeter/LArMonTools/src/LArCollisionTimeMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -13,22 +13,17 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" -//#include "CoolLumiUtilities/IBunchGroupTool.h" +#include "LArRecEvent/LArCollisionTime.h" #include <map> #include <string> #include <bitset> #include <vector> -//#include "TH1.h" -//#include "TH2I.h" -//#include "TH2F.h" #include "TMath.h" #include "TTree.h" class ITHistSvc; -//class TH1F; -//class TH2F; class TTree; class TH1F_LW; class TH2F_LW; @@ -108,7 +103,9 @@ class LArCollisionTimeMonTool: public ManagedMonitorToolBase bool m_bcid_init; - std::string m_histPath, m_key; + std::string m_histPath; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<LArCollisionTime> m_key{this, "Key", "LArCollisionTime"}; void cleanup(); }; diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx index c9194ed5dbcb1d81a599552c6cf8701a7cea2963..698da2bed0039ebe6c146c7e0ae2d042e677a0cb 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -66,7 +66,6 @@ LArCoverage::LArCoverage(const std::string& type, m_hCaloNoiseToolHEC(), m_hCaloNoiseToolFCAL() { - declareProperty("LArRawChannelKey",m_rawChannelsKey="LArRawChannels"); declareProperty("LArBadChannelMask",m_badChannelMask); declareProperty("Nevents",m_nevents = 50); @@ -111,6 +110,7 @@ LArCoverage::initialize() m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper); m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID); + ATH_CHECK( m_EventInfoKey.initialize() ); ATH_CHECK( m_noiseCDOKey.initialize() ); ATH_CHECK( m_rawChannelsKey.initialize() ); // End Initialize @@ -127,9 +127,9 @@ LArCoverage::bookHistograms() // if(isNewRun ){// Commented by B.Trocme to comply with new ManagedMonitorToolBase - const xAOD::EventInfo* thisEventInfo; + SG::ReadHandle<xAOD::EventInfo> thisEventInfo{m_EventInfoKey}; uint32_t lb1 = 0; - if ((evtStore()->retrieve(thisEventInfo))!=StatusCode::SUCCESS) + if (!thisEventInfo.isValid()) ATH_MSG_WARNING( "No EventInfo object found! Can't read run number!" ); else{ lb1 = thisEventInfo->lumiBlock(); diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.h b/LArCalorimeter/LArMonTools/src/LArCoverage.h index 368e524a1ffec9286d271ef5f0032115a27ea890..ee6e42884baf25b0c64ddab4ccb0d5b2a60408d5 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.h +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.h @@ -1,6 +1,6 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -86,7 +86,8 @@ private: /** Handle to bad-channel tools */ ToolHandle<ILArBadChannelMasker> m_badChannelMask; - SG::ReadHandleKey<LArRawChannelContainer> m_rawChannelsKey; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<LArRawChannelContainer> m_rawChannelsKey{this, "LArRawChannelKey", "LArRawChannels"}; SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"}; SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MFKey", "LArBadFeb", "SG missing FEBs key"}; SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; diff --git a/LArCalorimeter/LArMonTools/src/LArFEBMon.cxx b/LArCalorimeter/LArMonTools/src/LArFEBMon.cxx index e36456d6cc28b494768310eec9bed1e7af1e8a19..0aa4592d192facbe6d00605fa81d775f4316a71c 100755 --- a/LArCalorimeter/LArMonTools/src/LArFEBMon.cxx +++ b/LArCalorimeter/LArMonTools/src/LArFEBMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -15,8 +15,6 @@ #include "LArFEBMon.h" #include "LArRecEvent/LArEventBitInfo.h" -#include "LArRawEvent/LArFebHeaderContainer.h" -#include "LArRawEvent/LArFebErrorSummary.h" #include "LArRawConditions/LArDSPThresholdsComplete.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" @@ -125,8 +123,8 @@ LArFEBMon::~LArFEBMon() { // ******************************************************************** StatusCode LArFEBMon::initialize() { - ATH_MSG_INFO( "Initializing LArFEBMon " ); - + ATH_MSG_DEBUG( "Initializing LArFEBMon " ); + StatusCode sc = detStore()->retrieve(m_onlineHelper, "LArOnlineID"); if (sc.isFailure()) { ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); @@ -144,6 +142,10 @@ StatusCode LArFEBMon::initialize() { ATH_MSG_DEBUG( "Missing FEBs key" << m_BFKey.key() << " initialized" ); } + ATH_CHECK( m_EventInfoKey.initialize() ); + ATH_CHECK( m_LArFebHeaderContainerKey.initialize() ); + ATH_CHECK( m_LArFebErrorSummaryKey.initialize() ); + ManagedMonitorToolBase::initialize().ignore(); return sc; @@ -363,9 +365,9 @@ StatusCode LArFEBMon::fillHistograms() { // Retrieve event info to get event time,trigger type... // Retrieved at beg of method now to get the LVL1 type // to check consistency with DSP trigger type - const xAOD::EventInfo* thisEvent=0; + SG::ReadHandle<xAOD::EventInfo> thisEvent{m_EventInfoKey}; - if(evtStore()->retrieve(thisEvent).isFailure()) { + if(!thisEvent.isValid()) { ATH_MSG_WARNING( "Failed to retrieve EventInfo object" ); return StatusCode::FAILURE; } @@ -381,12 +383,11 @@ StatusCode LArFEBMon::fillHistograms() { //ATH_MSG_INFO( "LArFEBMon Lumi block: "<<lumi_block); - const LArFebHeaderContainer* hdrCont; - const LArFebErrorSummary* lArFebErrorSummary; - StatusCode sc = evtStore()->retrieve(hdrCont); - if (sc.isFailure() || !hdrCont) { + SG::ReadHandle<LArFebHeaderContainer> hdrCont{m_LArFebHeaderContainerKey}; + SG::ReadHandle<LArFebErrorSummary> lArFebErrorSummary{m_LArFebErrorSummaryKey}; + if (!hdrCont.isValid()) { ATH_MSG_WARNING( "No LArFebHeaderContainer found in TDS" ); - return sc; + return StatusCode::FAILURE; } if (hdrCont->size()==0) { @@ -394,13 +395,12 @@ StatusCode LArFEBMon::fillHistograms() { return StatusCode::FAILURE; } - sc=evtStore()->retrieve( lArFebErrorSummary, "LArFebErrorSummary"); - if (sc.isFailure()) { + if (!lArFebErrorSummary.isValid()) { ATH_MSG_WARNING( "No LArFebErrorSummary found in TDS" ); return StatusCode::FAILURE; } - + StatusCode sc; uint32_t firstEventType = (*hdrCont->begin())->DetEventType(); // At 1st event, retrieve DSP thresholds and fill histogram with values for all channels diff --git a/LArCalorimeter/LArMonTools/src/LArFEBMon.h b/LArCalorimeter/LArMonTools/src/LArFEBMon.h index 7b1fbd4f28ab95d72c4eeec7475e6857f9b20a32..7b7a8f67496abf9f158085ab5c69acf35790bf6b 100755 --- a/LArCalorimeter/LArMonTools/src/LArFEBMon.h +++ b/LArCalorimeter/LArMonTools/src/LArFEBMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef LARMONTOOLS_LARFEBMON_H @@ -13,6 +13,8 @@ #include "Identifier/HWIdentifier.h" #include "StoreGate/ReadCondHandleKey.h" #include "LArRecConditions/LArBadChannelCont.h" +#include "LArRawEvent/LArFebHeaderContainer.h" +#include "LArRawEvent/LArFebErrorSummary.h" #include "TrigDecisionTool/TrigDecisionTool.h" @@ -76,6 +78,9 @@ private: const LArOnlineID* m_onlineHelper; LArOnlineIDStrHelper* m_strHelper; SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MissingFEBKey", "LArBadFeb", "SG key for missing FEBs"}; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<LArFebHeaderContainer> m_LArFebHeaderContainerKey{this, "LArFebHeaderContainerKey", "LArFebHeader"}; + SG::ReadHandleKey<LArFebErrorSummary> m_LArFebErrorSummaryKey{this, "LArFebErrorSummaryKey", "LArFebErrorSummary"}; // trig. decision tool ToolHandle<Trig::TrigDecisionTool> m_trigDec; bool m_trigok; diff --git a/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.cxx index 1199808b0675abb09b16957e7c0ee5f6b2bd7d56..05ccf97fb31a9bd590ae6bc43a9695ff8bc0d4da 100644 --- a/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -48,7 +48,6 @@ LArHVCorrectionMonTool::LArHVCorrectionMonTool(const std::string& type, m_larCablingService("LArCablingLegacyService"), m_eventsCounter(0) { - declareProperty("LArRawChannelKey",m_channelKey="LArRawChannels"); declareProperty("ErrorThreshold",m_threshold=0.02); declareProperty("EtaGranularity",m_delta_eta=0.01); declareProperty("PhiGranularity",m_delta_phi=0.01); @@ -93,6 +92,8 @@ StatusCode LArHVCorrectionMonTool::initialize() ATH_CHECK( m_scaleCorrKey.initialize() ); ATH_CHECK( m_onlineScaleCorrKey.initialize() ); + ATH_CHECK( m_channelKey.initialize() ); + // LArOnlineIDStrHelper m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper); m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID); @@ -252,10 +253,9 @@ LArHVCorrectionMonTool::fillHistograms() float nonNominal[] = {0.,0.,0.,0.,0.,0.,0.,0.}; // Retrieve Raw Channels Container - const LArRawChannelContainer* pRawChannelsContainer; - StatusCode sc = evtStore()->retrieve(pRawChannelsContainer, m_channelKey); - if(sc.isFailure()) { - ATH_MSG_WARNING( "Can't retrieve LArRawChannelContainer with key " << m_channelKey ); + SG::ReadHandle<LArRawChannelContainer> pRawChannelsContainer{m_channelKey}; + if(!pRawChannelsContainer.isValid()) { + ATH_MSG_WARNING( "Can't retrieve LArRawChannelContainer with key " << m_channelKey.key() ); return StatusCode::SUCCESS; } diff --git a/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.h b/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.h index f503eca3ca07da6f7f98749e544ab42aafac8b75..9ef21ab1ad1b1365166b77da4cbb27a92fedbad2 100644 --- a/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.h +++ b/LArCalorimeter/LArMonTools/src/LArHVCorrectionMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -98,7 +98,7 @@ class LArHVCorrectionMonTool: public ManagedMonitorToolBase void SetTH1Style(TH1I_LW* h); // Properties - std::string m_channelKey; + SG::ReadHandleKey<LArRawChannelContainer> m_channelKey{this, "LArRawChannelKey", "LArRawChannels"}; float m_threshold; float m_delta_eta; float m_delta_phi; diff --git a/LArCalorimeter/LArMonTools/src/LArNoisyROMon.cxx b/LArCalorimeter/LArMonTools/src/LArNoisyROMon.cxx index 9eacace0a6ad90adad704ec3eaf4c102050db486..beccdac2b127a6446f03581db2a8193bb63f3488 100644 --- a/LArCalorimeter/LArMonTools/src/LArNoisyROMon.cxx +++ b/LArCalorimeter/LArMonTools/src/LArNoisyROMon.cxx @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "LArNoisyROMon.h" #include "LArOnlineIDStrHelper.h" #include "LArRecEvent/LArEventBitInfo.h" -#include "LArRecEvent/LArNoisyROSummary.h" #include "LArIdentifier/LArOnlineID.h" #include "xAODEventInfo/EventInfo.h" @@ -39,7 +38,6 @@ LArNoisyROMon::LArNoisyROMon(const std::string& type, declareProperty("L1NoiseBurstTriggers",m_L1_NoiseBurst_Triggers); declareProperty("m_lumi_blocks", m_lumi_blocks = 3000 ); declareProperty("doHisto", m_doHisto=true); - declareProperty("inputKey", m_inputKey="LArNoisyROSummary"); m_NoiseTime.time = 0; m_NoiseTime.time_ns = 0; @@ -69,6 +67,9 @@ LArNoisyROMon::~LArNoisyROMon() StatusCode LArNoisyROMon::initialize() { + ATH_CHECK( m_inputKey.initialize() ); + ATH_CHECK( m_eventInfoKey.initialize() ); + if ( !(detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID" ).isSuccess()) ) { ATH_MSG_FATAL( "unable to retrieve LArOnlineID from detStore" ); @@ -165,18 +166,16 @@ StatusCode LArNoisyROMon::fillHistograms() m_eventCounter++; // retrieve - const LArNoisyROSummary* noisyRO; - sc = evtStore()->retrieve(noisyRO,m_inputKey); - if (sc.isFailure()) + SG::ReadHandle<LArNoisyROSummary> noisyRO{m_inputKey}; + if (!noisyRO.isValid()) { ATH_MSG_WARNING( "Can't retrieve LArNoisyROSummary " ); return StatusCode::SUCCESS; } - const xAOD::EventInfo* eventInfo; - sc = evtStore()->retrieve(eventInfo); - if (sc.isFailure()) + SG::ReadHandle<xAOD::EventInfo> eventInfo{m_eventInfoKey}; + if (!eventInfo.isValid()) { ATH_MSG_WARNING( "Can't retrieve EventInfo " ); return StatusCode::SUCCESS; diff --git a/LArCalorimeter/LArMonTools/src/LArNoisyROMon.h b/LArCalorimeter/LArMonTools/src/LArNoisyROMon.h index 15ae55f7598edd571387f915c128e073629c9a78..2dec5a0d73c9ed62c64e80d523e8d8949cdeb241 100644 --- a/LArCalorimeter/LArMonTools/src/LArNoisyROMon.h +++ b/LArCalorimeter/LArMonTools/src/LArNoisyROMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -17,6 +17,7 @@ #include "Identifier/HWIdentifier.h" #include "LArIdentifier/LArOnlineID.h" +#include "LArRecEvent/LArNoisyROSummary.h" #include <string> #include <array> @@ -161,7 +162,8 @@ private: std::vector<std::string> m_L1_NoiseBurst_Triggers; unsigned int m_lumi_blocks; bool m_doHisto; - std::string m_inputKey; + SG::ReadHandleKey<LArNoisyROSummary> m_inputKey{this, "inputKey", "LArNoisyROSummary"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "eventInfoKey", "EventInfo"}; }; inline size_t LArNoisyROMon::partitionNumber(const HWIdentifier hwid) { diff --git a/LArCalorimeter/LArMonTools/src/LArRODMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArRODMonTool.cxx index f3ade697549be635c528e13f720aefc1472c70c9..1147d2b7e21d55cf59930f62455f9b061e3682a0 100755 --- a/LArCalorimeter/LArMonTools/src/LArRODMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArRODMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -29,7 +29,6 @@ #include "LArRawEvent/LArDigitContainer.h" #include "LArRawEvent/LArRawChannel.h" #include "LArRawEvent/LArRawChannelContainer.h" -#include "LArRawEvent/LArFebHeaderContainer.h" #include "LArRawEvent/LArFebHeader.h" @@ -178,6 +177,7 @@ LArRODMonTool::initialize() { ATH_CHECK(m_channelKey_fromBytestream.initialize()); ATH_CHECK(m_digitContainerKey.initialize()); ATH_CHECK(m_eventInfoKey.initialize()); + ATH_CHECK(m_febContKey.initialize()); ATH_CHECK(m_keyOFC.initialize()); ATH_CHECK(m_keyShape.initialize()); @@ -594,9 +594,8 @@ LArRODMonTool::bookHistograms() bool LArRODMonTool::FebStatus_Check() { m_ignoreFEBs.clear(); - const LArFebHeaderContainer* febCont=NULL; - StatusCode sc = evtStore()->retrieve(febCont); - if (sc.isFailure() || !febCont) { + SG::ReadHandle<LArFebHeaderContainer> febCont{m_febContKey}; + if (!febCont.isValid()) { ATH_MSG_WARNING( "No LArFEB container found in TDS" ); return false; } diff --git a/LArCalorimeter/LArMonTools/src/LArRODMonTool.h b/LArCalorimeter/LArMonTools/src/LArRODMonTool.h index 8d313c35491643aeababce8cc9c46d20147ff570..b8a9b4e9009cd6d9505cd760070a2c6baa448296 100644 --- a/LArCalorimeter/LArMonTools/src/LArRODMonTool.h +++ b/LArCalorimeter/LArMonTools/src/LArRODMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //Dear emacs, this is -*-c++-*- @@ -23,6 +23,7 @@ #include "LArIdentifier/LArOnlineID.h" #include "LArRawConditions/LArADC2MeV.h" #include "LArRecConditions/ILArBadChannelMasker.h" +#include "LArRawEvent/LArFebHeaderContainer.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadHandleKey.h" @@ -204,6 +205,7 @@ private: SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this,"EventInfoKey","EventInfo","SG Key of EventInfo object"}; + SG::ReadHandleKey<LArFebHeaderContainer> m_febContKey{this, "LArFebHeaderContainerKey", "LArFebHeader"}; // Keys for LArRawChannels containers SG::ReadHandleKey<LArRawChannelContainer> m_channelKey_fromBytestream{this,"LArRawChannelKey_fromBytestream","LArRawChannels","SG key of LArRawChannels produced by teh DSP"}; SG::ReadHandleKey<LArRawChannelContainer> m_channelKey_fromDigits{this,"LArRawChannelKey_fromDigits","LArRawChannels_FromDigits","SG key of LArRawChannels produced offline"}; diff --git a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx index 4014369b537810a8b5ad5904a6bad84099d3227d..853abe1e6379ac267e6b7fb5add63365570c0727 100644 --- a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx @@ -19,8 +19,6 @@ #include "LArIdentifier/LArOnlineID.h" #include "LArIdentifier/LArOnlID_Exception.h" #include "LArRawEvent/LArRawChannel.h" -#include "LArRawEvent/LArRawChannelContainer.h" -//#include "LArRecEvent/LArNoisyROSummary.h" #include "LArRecEvent/LArEventBitInfo.h" #include "AthenaKernel/Units.h" @@ -115,8 +113,6 @@ LArRawChannelMonTool::LArRawChannelMonTool( const std::string & type, { declareProperty( "dataNameBase", m_data_name_base = "LArRawChannel" ); - declareProperty( "LArRawChannelContainerKey", - m_LArRawChannel_container_key = "LArRawChannels" ); declareProperty( "calo_noise_tool", m_calo_noise_tool ); declareProperty( "masking_tool", m_masking_tool ); declareProperty( "ATLASReadyFilterTool", m_filterAtlasReady_tools ); @@ -176,6 +172,9 @@ StatusCode LArRawChannelMonTool::initialize() ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_EventInfoKey.initialize() ); + ATH_CHECK( m_LArRawChannel_container_key.initialize() ); + ATH_CHECK( detStore()->retrieve( m_lar_online_id_ptr, "LArOnlineID" ) ); ATH_CHECK( detStore()->retrieve( m_calo_id_mgr_ptr ) ); ATH_CHECK( m_cable_service_tool.retrieve() ); @@ -354,7 +353,7 @@ StatusCode LArRawChannelMonTool::bookHistograms() if ( is_new_interval ) { // --- exit if no LArRawChannelContainer exists --- - m_has_lar_raw_channels = evtStore()->contains<LArRawChannelContainer>(m_LArRawChannel_container_key); + m_has_lar_raw_channels = SG::ReadHandle<LArRawChannelContainer>(m_LArRawChannel_container_key).isValid(); if ( !m_has_lar_raw_channels ) return StatusCode::SUCCESS; // --- To remeber which ft have been booked in which detector --- @@ -1201,24 +1200,24 @@ StatusCode LArRawChannelMonTool::fillHistograms() ATH_CHECK( detStore()->retrieve (ddman, "CaloMgr") ); // --- retrieve raw channels --- - const LArRawChannelContainer *raw_channels = 0; - if ( !evtStore()->retrieve( raw_channels, m_LArRawChannel_container_key ).isSuccess() ) { + SG::ReadHandle<LArRawChannelContainer> raw_channels{m_LArRawChannel_container_key}; + if ( !raw_channels.isValid() ) { ATH_MSG_WARNING( "Cannot retrieve LArRawChannelContainer with key: " - << m_LArRawChannel_container_key ); + << m_LArRawChannel_container_key.key() ); return StatusCode::FAILURE; } // --- retrieve event information --- - const xAOD::EventInfo* event_info; + SG::ReadHandle<xAOD::EventInfo> event_info{m_EventInfoKey}; uint32_t bunch_crossing_id = 0; uint32_t lumi_block = 0; bool isEventFlaggedByLArNoisyROAlg = false; // keep default as false bool isEventFlaggedByLArNoisyROAlgInTimeW = false; // keep deault as false bool isEventFlaggedByLArNoisyROAlg_W =false; // keep deault as false // double event_time_minutes = -1; - if ( evtStore()->retrieve( event_info ).isSuccess()) { + if ( event_info.isValid() ) { //ATH_MSG_DEBUG( "event_info->isEventFlagBitSet(xAOD::EventInfo::LAr,0"<<event_info->isEventFlagBitSet(xAOD::EventInfo::LAr,0) ); // Check for LArNoisyROAlg event info diff --git a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h index 5d399caebad83daa936aacda2308b3aac970957a..ff6bc10bbce1692b7b091af99d419df9880f1fff 100644 --- a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h +++ b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef LARMONTOOLS_LARRAWCHANNELMONTOOL_H @@ -20,6 +20,7 @@ #include "CaloInterface/ICaloNoiseTool.h" #include "LArCabling/LArCablingLegacyService.h" #include "LArRecConditions/ILArBadChannelMasker.h" +#include "LArRawEvent/LArRawChannelContainer.h" // --- boost --- #include <boost/shared_ptr.hpp> @@ -126,7 +127,8 @@ class LArRawChannelMonTool: public ManagedMonitorToolBase // --- Naming Conventions --- std::string m_data_name_base; - std::string m_LArRawChannel_container_key; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<LArRawChannelContainer> m_LArRawChannel_container_key{this, "LArRawChannelContainerKey", "LArRawChannels"}; // --- Monitoring Controls --- std::vector<double> m_occupancy_thresholds; diff --git a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py index c0e3c203ad25ae739c4685599b4604b0dd8851ea..6eeca6d65fc88a8ff11d4e508107ebf38cc702d6 100644 --- a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py +++ b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py @@ -11,11 +11,12 @@ from LumiBlockComps.BunchCrossingCondAlgDefault import BunchCrossingCondAlgDefau BunchCrossingCondAlgDefault() if DQMonFlags.monManEnvironment() == 'tier0ESD': - from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld - topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags) - if globalflags.DataSource()=='data': - from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfigOld - topSequence +=LArAffectedRegionsConfigOld(DQMonFlags) + include ("LArCellRec/LArCollisionTime_jobOptions.py") + from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld + topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags) + if globalflags.DataSource()=='data': + from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfigOld + topSequence +=LArAffectedRegionsConfigOld(DQMonFlags) if DQMonFlags.monManEnvironment() == 'tier0Raw': from LArMonitoring.LArNoisyROMonAlg import LArNoisyROMonConfigOld diff --git a/LArCalorimeter/LArOnlDbPrep/CMakeLists.txt b/LArCalorimeter/LArOnlDbPrep/CMakeLists.txt index 4fed65c1a032699e172c641477c90397e9f17b5a..4bd32ce71f6ebdbd8e52b5f4e6151c25789a9959 100644 --- a/LArCalorimeter/LArOnlDbPrep/CMakeLists.txt +++ b/LArCalorimeter/LArOnlDbPrep/CMakeLists.txt @@ -31,7 +31,7 @@ atlas_add_component( LArOnlDbPrep src/*.cxx src/components/*.cxx INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CaloIdentifier CaloTriggerToolLib AthenaBaseComps GaudiKernel LArRecConditions LArCablingLib CaloDetDescrLib StoreGateLib SGtests AthenaPoolUtilities LArCOOLConditions LArIdentifier ) + LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CaloIdentifier CaloTriggerToolLib AthenaBaseComps GaudiKernel LArRecConditions LArCablingLib CaloDetDescrLib StoreGateLib SGtests AthenaPoolUtilities LArCOOLConditions LArIdentifier CaloInterfaceLib ) # Install files from the package: atlas_install_headers( LArOnlDbPrep ) diff --git a/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml b/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml index e4da2675ce3db2d62d007824e744f2e959e62013..f3c34216d8e825b86151bf6295bbc97510c88f31 100644 --- a/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml +++ b/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml @@ -20,7 +20,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArAutoCorrP*"/> + <class pattern="*pair*<unsigned*LArAutoCorrP>"/> <class name="std::vector<LArAutoCorrP>"/> <class name="std::vector<std::pair<unsigned int, LArAutoCorrP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArAutoCorrP> > >"/> @@ -35,7 +35,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArCaliPulseParamsP*"/> + <class pattern="*pair*<unsigned*LArCaliPulseParamsP>"/> <class name="std::vector<LArCaliPulseParamsP>"/> <class name="std::vector<std::pair<unsigned int, LArCaliPulseParamsP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArCaliPulseParamsP> > >"/> @@ -50,7 +50,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArDAC2uAP*"/> + <class pattern="*pair*<unsigned*LArDAC2uAP>"/> <class name="std::vector<LArDAC2uAP>"/> <class name="std::vector<std::pair<unsigned int,LArDAC2uAP> >"/> <class name="std::vector<std::pair<unsigned int,std::vector<LArDAC2uAP> > >"/> @@ -65,7 +65,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArDetCellParamsP*"/> + <class pattern="*pair*<unsigned*LArDetCellParamsP>"/> <class name="std::vector<LArDetCellParamsP>"/> <class name="std::vector<std::pair<unsigned int, LArDetCellParamsP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArDetCellParamsP> > >"/> @@ -80,7 +80,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArfSamplP*"/> + <class pattern="*pair*<unsigned*LArfSamplP>"/> <class name="std::vector<LArfSamplP>"/> <class name="std::vector<std::pair<unsigned int, LArfSamplP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArfSamplP> > >"/> @@ -94,7 +94,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArH6OscillationP*"/> + <class pattern="*pair*<unsigned*LArH6OscillationP>"/> <class name="std::vector<LArH6OscillationP>"/> <class name="std::vector<std::pair<unsigned int, LArH6OscillationP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArH6OscillationP> > >"/> @@ -107,7 +107,7 @@ <!-- picked up by iterator pattern below. --> <!-- <class name="LArSingleFloatP" /> --> <class name="LArConditionsSubset<LArSingleFloatP>" /> - <class pattern="*pair*<unsigned*LArSingleFloatP*"/> + <class pattern="*pair*<unsigned*LArSingleFloatP>"/> <class name="std::vector<LArSingleFloatP>"/> <class name="std::vector<std::pair<unsigned int, LArSingleFloatP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArSingleFloatP> > >"/> @@ -123,7 +123,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArMinBiasP*"/> + <class pattern="*pair*<unsigned*LArMinBiasP>"/> <class name="std::vector<LArMinBiasP>"/> <class name="std::vector<std::pair<unsigned int, LArMinBiasP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArMinBiasP> > >"/> @@ -139,7 +139,7 @@ </class> - <class pattern="*pair*<unsigned*LArMinBiasAverageP*"/> + <class pattern="*pair*<unsigned*LArMinBiasAverageP>"/> <class name="std::vector<LArMinBiasAverageP>"/> <class name="std::vector<std::pair<unsigned int, LArMinBiasAverageP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArMinBiasAverageP> > >"/> @@ -155,7 +155,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArMphysOverMcalP*"/> + <class pattern="*pair*<unsigned*LArMphysOverMcalP>"/> <class name="std::vector<LArMphysOverMcalP>"/> <class name="std::vector<std::pair<unsigned int, LArMphysOverMcalP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArMphysOverMcalP> > >"/> @@ -170,7 +170,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArNoiseP*"/> + <class pattern="*pair*<unsigned*LArNoiseP>"/> <class name="std::vector<LArNoiseP>"/> <class name="std::vector<std::pair<unsigned int, LArNoiseP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArNoiseP> > >"/> @@ -190,7 +190,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArOFCP*"/> + <class pattern="*pair*<unsigned*LArOFCP>"/> <class name="std::vector<LArOFCP>"/> <class name="std::vector<std::pair<unsigned int, LArOFCP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArOFCP> > >"/> @@ -208,7 +208,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArPedestalP*"/> + <class pattern="*pair*<unsigned*LArPedestalP>"/> <class name="std::vector<LArPedestalP>"/> <class name="std::vector<std::pair<unsigned int, LArPedestalP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArPedestalP> > >"/> @@ -224,7 +224,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArPhysCaliTdiffP*"/> + <class pattern="*pair*<unsigned*LArPhysCaliTdiffP>"/> <class name="std::vector<LArPhysCaliTdiffP>"/> <class name="std::vector<std::pair<unsigned int, LArPhysCaliTdiffP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArPhysCaliTdiffP> > >"/> @@ -240,7 +240,7 @@ <class name="LArConditionsSubset<LArRampP>" id="4019776D-D528-4401-9CBD-7956C4B00607" > <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArRampP*"/> + <class pattern="*pair*<unsigned*LArRampP>"/> <class name="std::vector<LArRampP>"/> <class name="std::vector<std::pair<unsigned int, LArRampP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArRampP> > >"/> @@ -256,7 +256,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LAruA2MeVP*"/> + <class pattern="*pair*<unsigned*LAruA2MeVP>"/> <class name="std::vector<LAruA2MeVP>"/> <class name="std::vector<std::pair<unsigned int, LAruA2MeVP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LAruA2MeVP> > >"/> @@ -268,6 +268,7 @@ <class name="LArDSPThresholdsP" /> + <!--- ============================== --> <exclusion> <class name="integral_constant<bool,true>" /> diff --git a/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml b/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml index 4aef6414961d38aee3be62202f857d08758fe8b6..a7db3408daa7f97461d139019674336d22c77c94 100644 --- a/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml +++ b/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml @@ -16,7 +16,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArShapeP*"/> + <class pattern="*pair*<unsigned*LArShapeP>"/> <class name="std::vector<LArShapeP>"/> <class name="std::vector<std::pair<unsigned int, LArShapeP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArShapeP> > >"/> @@ -30,7 +30,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArTdriftP*"/> + <class pattern="*pair*<unsigned*LArTdriftP>"/> <class name="std::vector<LArTdriftP>"/> <class name="std::vector<std::pair<unsigned int, LArTdriftP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArTdriftP> > >"/> @@ -45,7 +45,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArRinjP*"/> + <class pattern="*pair*<unsigned*LArRinjP>"/> <class name="std::vector<LArRinjP>"/> <class name="std::vector<std::pair<unsigned int, LArRinjP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArRinjP> > >"/> @@ -59,7 +59,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArCableLengthP*"/> + <class pattern="*pair*<unsigned*LArCableLengthP>"/> <class name="std::vector<LArCableLengthP>"/> <class name="std::vector<std::pair<unsigned int, LArCableLengthP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArCableLengthP> > >"/> @@ -73,7 +73,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArCableAttenuationP*"/> + <class pattern="*pair*<unsigned*LArCableAttenuationP>"/> <class name="std::vector<LArCableAttenuationP>"/> <class name="std::vector<std::pair<unsigned int, LArCableAttenuationP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArCableAttenuationP> > >"/> @@ -87,7 +87,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArTshaperP*"/> + <class pattern="*pair*<unsigned*LArTshaperP>"/> <class name="std::vector<LArTshaperP>"/> <class name="std::vector<std::pair<unsigned int, LArTshaperP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArTshaperP> > >"/> @@ -101,7 +101,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArOFCBinP*"/> + <class pattern="*pair*<unsigned*LArOFCBinP>"/> <class name="std::vector<LArOFCBinP>"/> <class name="std::vector<std::pair<unsigned int, LArOFCBinP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArOFCBinP> > >"/> @@ -115,7 +115,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArEMEC_CphiP*"/> + <class pattern="*pair*<unsigned*LArEMEC_CphiP>"/> <class name="std::vector<LArEMEC_CphiP>"/> <class name="std::vector<std::pair<unsigned int, LArEMEC_CphiP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_CphiP> > >"/> @@ -129,7 +129,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArEMEC_HValphaP*"/> + <class pattern="*pair*<unsigned*LArEMEC_HValphaP>"/> <class name="std::vector<LArEMEC_HValphaP>"/> <class name="std::vector<std::pair<unsigned int, LArEMEC_HValphaP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_HValphaP> > >"/> @@ -143,7 +143,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArEMEC_HVbetaP*"/> + <class pattern="*pair*<unsigned*LArEMEC_HVbetaP>"/> <class name="std::vector<LArEMEC_HVbetaP>"/> <class name="std::vector<std::pair<unsigned int, LArEMEC_HVbetaP> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_HVbetaP> > >"/> @@ -161,7 +161,7 @@ <class name="std::vector<LArCaliWave>" /> <!-- <class name="std::vector<std::vector<LArCaliWaveVec> >" /> --> - <class pattern="*pair*<unsigned*LArCaliWaveVec*"/> + <class pattern="*pair*<unsigned*LArCaliWaveVec>"/> <class name="std::vector<LArCaliWaveVec>"/> <class name="std::vector<std::pair<unsigned int, LArCaliWaveVec> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArCaliWaveVec> > >"/> @@ -176,7 +176,7 @@ <field name="m_subsetMap" transient="true" /> </class> - <class pattern="*pair*<unsigned*LArPhysWave*"/> + <class pattern="*pair*<unsigned*LArPhysWave>"/> <class name="std::vector<LArPhysWave>"/> <class name="std::vector<std::pair<unsigned int, LArPhysWave> >"/> <class name="std::vector<std::pair<unsigned int, std::vector<LArPhysWave> > >"/> diff --git a/LArCalorimeter/LArTest/LArConditionsTest/CMakeLists.txt b/LArCalorimeter/LArTest/LArConditionsTest/CMakeLists.txt index 85b8260d974908ad2f80c4cfba4809d9442a285e..0bdbf862d930cc701f4ada3989d89f9e032fa2b5 100644 --- a/LArCalorimeter/LArTest/LArConditionsTest/CMakeLists.txt +++ b/LArCalorimeter/LArTest/LArConditionsTest/CMakeLists.txt @@ -37,7 +37,7 @@ atlas_add_component( LArConditionsTest src/LArConditionsTestAlg.cxx src/LArCablingTest.cxx INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRawUtilsLib LArToolsLib CaloDetDescrLib CaloEvent CaloIdentifier AthenaKernel AthenaPoolUtilities LArCOOLConditions ) + LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRawUtilsLib LArToolsLib CaloDetDescrLib CaloEvent CaloIdentifier AthenaKernel AthenaPoolUtilities LArCOOLConditions CaloInterfaceLib ) # Install files from the package: atlas_install_headers( LArConditionsTest ) diff --git a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTest.ref b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTest.ref index b25e3bb004c8c04e032e2150ea9c4929026d57d8..ec597394b3fd2134ea8d90a655d781a6ba496664 100644 --- a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTest.ref +++ b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTest.ref @@ -1,7 +1,7 @@ -Fri Dec 20 03:55:08 CET 2019 +Thu May 21 18:33:58 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.9] [x86_64-centos7-gcc8-opt] [atlas-work3g/b671f9d07ec] -- built on [2019-12-19T2256] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [atlas-work3/a38808b681cd] -- built on [2020-05-21T1646] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" @@ -11,9 +11,9 @@ Py:Athena INFO including file "AtlasGeoModel/SetGeometryVersion.py" AtlasGeoModel/SetGeometryVersion.py is OBSOLETE Py:Athena INFO SetGeometryVersion.py obtained major release version 22 Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -Py:ConfigurableDb INFO Read module info for 5631 configurables from 29 genConfDb files +Py:ConfigurableDb INFO Read module info for 5533 configurables from 44 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version Athena-22.0.9 +EventInfoMgtInit: Got release version Athena-22.0.14 Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 Py:Athena INFO including file "LArRawConditions/LArIdMap_ATLAS_jobOptions.py" Py:Athena INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py" @@ -36,24 +36,23 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v32r2) - running on lxplus720.cern.ch on Fri Dec 20 03:55:19 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus7106.cern.ch on Thu May 21 18:34:11 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize AthDictLoaderSvc INFO in initialize... AthDictLoaderSvc INFO acquired Dso-registry -ClassIDSvc INFO getRegistryEntries: read 3732 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3736 CLIDRegistry entries for module ALL CoreDumpSvc INFO install f-a-t-a-l handler... (flag = -1) CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus720.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 10 servers found for host lxplus7106.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -73,7 +72,7 @@ IOVDbSvc INFO Folder /LAR/Identifier/FebRodMap, adding new key tag w IOVDbFolder INFO Read from meta data only for folder /TagInfo IOVDbSvc INFO Initialised with 3 connections and 10 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully -ClassIDSvc INFO getRegistryEntries: read 1908 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1967 CLIDRegistry entries for module ALL IOVDbSvc INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found. IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" @@ -90,9 +89,9 @@ IOVDbSvc INFO Added taginfo remove for /CALO/Ofl/Identifier/CaloTTOn IOVDbSvc INFO Added taginfo remove for /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas IOVDbSvc INFO Added taginfo remove for /LAR/LArCellPositionShift IOVDbSvc INFO Added taginfo remove for /LAR/Identifier/LArTTCellMapAtlas -ClassIDSvc INFO getRegistryEntries: read 325 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 268 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 24 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 237 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 239 CLIDRegistry entries for module ALL DetDescrCnvSvc INFO initializing DetDescrCnvSvc INFO Found DetectorStore service DetDescrCnvSvc INFO filling proxies for detector managers @@ -172,8 +171,8 @@ LArHVLineID INFO setDictVersion of LArHighVoltage is OK LArHVLineID INFO [initLevelsFromDict] m_dict OK ... LArHVLineID INFO [initialize_from_dictionary] > HV line range -> 11/1/48:79/0:15 | 11/1/148:179/0:15 | 11/1/80:93/0:7 | 11/1/180:193/0:7 | 11/1/200:231/0:15 | 11/1/232:263/0:15 | 11/1/296,297,306,307/0:15 | 11/1/299,304,305,308,309/0:15 | 11/1/264:279/0:15 | 11/1/280:295/0:15 | 11/1/0:47/0:15 | 11/1/320:322/0:15 | 11/1/100:147/0:15 | 11/1/324,325/0:15 | 11/1/312:315/0:15 | 11/1/316:319/0:15 | 11/1/300:303/0:15 | 11/1/310,311/0:15 | 11/1/323/0:15 | 11/1/326,327/0:15 | 11/1/94:99/0:15 | 11/1/194:199/0:15 LArHVLineID INFO [init_hashes()] > Hvline_size= 5008 -LAr::DetectorFa... INFO new description with barrel croystat bolts -LAr::DetectorFa... INFO new coil bumper description +LAr::BarrelCryo... INFO new description with barrel croystat bolts +LAr::BarrelCryo... INFO new coil bumper description BarrelConstruction INFO Getting primary numbers for ATLAS, ATLAS-R2-2016-01-00-01 BarrelConstruction INFO Makes detailed absorber sandwich ? 1 1 BarrelConstruction INFO Use sagging in geometry ? 0 @@ -198,7 +197,7 @@ TileDddbManager INFO n_tilb = 21 TileDddbManager INFO n_tileSwitches = 1 CaloIDHelper_ID... INFO in createObj: creating a TileID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt TileHWIDDetDesc... INFO in createObj: creating a TileHWID helper object in the detector store TileHWID INFO initialize_from_dictionary AtlasDetectorID INFO initialize_from_dictionary - OK @@ -210,9 +209,9 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_ID helper object in th AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt CaloIDHelper_ID... INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK LArMiniFCAL_ID INFO initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID. @@ -220,7 +219,7 @@ AtlasDetectorID INFO initialize_from_dictionary - OK TileDetDescrMan... INFO Entering create_elements() ClassIDSvc INFO getRegistryEntries: read 66 CLIDRegistry entries for module ALL AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 7029 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 7030 CLIDRegistry entries for module ALL CondInputLoader INFO Initializing CondInputLoader... CondInputLoader INFO Adding base classes: + ( 'AthenaAttributeList' , 'ConditionStore+/LAR/Identifier/CalibIdMap' ) -> @@ -252,7 +251,6 @@ LArConditionsTe... DEBUG initialize done LArConditionsTe... DEBUG input handles: 0 LArConditionsTe... DEBUG output handles: 0 LArConditionsTe... DEBUG Data Deps for LArConditionsTestAlg -HistogramPersis...WARNING Histograms saving not required. EventSelector INFO Enter McEventSelector Initialization AthenaEventLoopMgr INFO Setup EventSelector service EventSelector ApplicationMgr INFO Application Manager Initialized successfully @@ -263,7 +261,7 @@ ApplicationMgr INFO Application Manager Started successfully AthenaEventLoopMgr INFO ===>>> start of run 0 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr -ClassIDSvc INFO getRegistryEntries: read 114 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LARAlign_CSC_01 for folder /LAR/Align IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LArCellPositionShift-ideal for folder /LAR/LArCellPositionShift @@ -293,12 +291,12 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_SuperCell_ID helper ob AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt CaloIDHelper_ID... INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt AtlasDetectorID INFO initialize_from_dictionary - OK CaloIdMgrDetDes... INFO Finished CaloIdMgrDetDes... INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv @@ -6908,28 +6906,28 @@ CondInputLoader INFO Finalizing CondInputLoader... IncidentProcAlg2 INFO Finalize EventSelector INFO finalize IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.11 ))s -IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.06 ))s -IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.03 ))s -IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.08 ))s +IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.26 ))s +IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.20 ))s +IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.08 ))s +IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.31 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s -IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.02 ))s -IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.06 ))s +IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.03 ))s +IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.08 ))s IOVDbFolder WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc INFO bytes in (( 0.36 ))s +IOVDbSvc INFO bytes in (( 0.96 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 0.36 ))s +IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 0.96 ))s IOVDbSvc INFO Connection COOLOFL_CALO/OFLP200 : nConnect: 1 nFolders: 3 ReadTime: (( 0.00 ))s AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -cObjR_ALL INFO Time User : Tot= 370 [ms] Ave/Min/Max= 185(+- 165)/ 20/ 350 [ms] #= 2 -cObj_ALL INFO Time User : Tot= 430 [ms] Ave/Min/Max= 86(+- 162)/ 0/ 410 [ms] #= 5 -ChronoStatSvc INFO Time User : Tot= 3.48 [s] #= 1 +cObjR_ALL INFO Time User : Tot= 430 [ms] Ave/Min/Max= 215(+- 205)/ 10/ 420 [ms] #= 2 +cObj_ALL INFO Time User : Tot= 0.5 [s] Ave/Min/Max= 0.1(+- 0.19)/ 0/ 0.48 [s] #= 5 +ChronoStatSvc INFO Time User : Tot= 3.61 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestReadNoReg.ref b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestReadNoReg.ref index f633eb0398456d09ecf82a46f95f808f80be3b97..51432591bcb835ef80ab89efa327fe62da9730f6 100644 --- a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestReadNoReg.ref +++ b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestReadNoReg.ref @@ -1,7 +1,7 @@ -Fri Dec 20 03:51:13 CET 2019 +Thu May 21 18:50:21 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.9] [x86_64-centos7-gcc8-opt] [atlas-work3g/b671f9d07ec] -- built on [2019-12-19T2256] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [atlas-work3/a38808b681cd] -- built on [2020-05-21T1646] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" @@ -11,9 +11,9 @@ Py:Athena INFO including file "AtlasGeoModel/SetGeometryVersion.py" AtlasGeoModel/SetGeometryVersion.py is OBSOLETE Py:Athena INFO SetGeometryVersion.py obtained major release version 22 Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -Py:ConfigurableDb INFO Read module info for 5631 configurables from 29 genConfDb files +Py:ConfigurableDb INFO Read module info for 5533 configurables from 44 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version Athena-22.0.9 +EventInfoMgtInit: Got release version Athena-22.0.14 Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 Py:Athena INFO including file "LArRawConditions/LArIdMap_ATLAS_jobOptions.py" Py:Athena INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py" @@ -38,24 +38,23 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v32r2) - running on lxplus720.cern.ch on Fri Dec 20 03:51:22 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus7106.cern.ch on Thu May 21 18:50:34 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize AthDictLoaderSvc INFO in initialize... AthDictLoaderSvc INFO acquired Dso-registry -ClassIDSvc INFO getRegistryEntries: read 3732 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3736 CLIDRegistry entries for module ALL CoreDumpSvc INFO install f-a-t-a-l handler... (flag = -1) CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus720.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 10 servers found for host lxplus7106.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -76,29 +75,10 @@ IOVDbFolder INFO Read from meta data only for folder /TagInfo IOVDbSvc INFO Initialised with 3 connections and 10 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully CondProxyProvider INFO Initializing CondProxyProvider - package version EventSelectorAthenaPool-00-00-00 -PoolSvc INFO File is not in Catalog! Attempt to open it anyway. -DbSession INFO Open DbSession -Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 99993A5D-2110-B45C-8015-27A23799B9A5 -Domain[ROOT_All] INFO LarCondTestNoReg.root -RootDatabase.open INFO LarCondTestNoReg.root File version:61804 -LarCondTestNoRe... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 99993A5D-2110-B45C-8015-27A23799B9A5 -Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] -PoolSvc INFO File is not in Catalog! Attempt to open it anyway. -DbSession INFO Open DbSession -Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] -Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 99993A5D-2110-B45C-8015-27A23799B9A5 -Domain[ROOT_All] INFO LarCondTestNoReg.root -RootDatabase.open INFO LarCondTestNoReg.root File version:61804 -LarCondTestNoRe... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 99993A5D-2110-B45C-8015-27A23799B9A5 -Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] -DbSession INFO Open DbSession -Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] -Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 Domain[ROOT_All] INFO LarCondTestNoReg.root -RootDatabase.open INFO LarCondTestNoReg.root File version:61804 -ClassIDSvc INFO getRegistryEntries: read 4556 CLIDRegistry entries for module ALL +RootDatabase.open INFO LarCondTestNoReg.root File version:62002 +ClassIDSvc INFO getRegistryEntries: read 4616 CLIDRegistry entries for module ALL IOVDbSvc INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found. IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" @@ -116,9 +96,9 @@ IOVDbSvc INFO Added taginfo remove for /CALO/Ofl/Identifier/CaloTTPp IOVDbSvc INFO Added taginfo remove for /LAR/LArCellPositionShift IOVDbSvc INFO Added taginfo remove for /LAR/Identifier/LArTTCellMapAtlas LarCondTestNoRe... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] -ClassIDSvc INFO getRegistryEntries: read 325 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 268 CLIDRegistry entries for module ALL EventPersistenc... INFO Added successfully Conversion service:McCnvSvc DetDescrCnvSvc INFO initializing DetDescrCnvSvc INFO Found DetectorStore service @@ -163,12 +143,12 @@ EventPersistenc... INFO Added successfully Conversion service:DetDescrCnvSvc EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc DbSession INFO Open DbSession Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] -Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 Domain[ROOT_All] INFO LarCondTestNoReg.root -RootDatabase.open INFO LarCondTestNoReg.root File version:61804 +RootDatabase.open INFO LarCondTestNoReg.root File version:62002 ClassIDSvc INFO getRegistryEntries: read 161 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 18 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 33 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 35 CLIDRegistry entries for module ALL GeoModelSvc::RD...WARNING Getting PixTBMatComponents with default tag GeoModelSvc::RD...WARNING Getting PixTBMaterials with default tag GeoModelSvc::RD...WARNING Getting InDetMatComponents with default tag @@ -207,8 +187,8 @@ LArHVLineID INFO setDictVersion of LArHighVoltage is OK LArHVLineID INFO [initLevelsFromDict] m_dict OK ... LArHVLineID INFO [initialize_from_dictionary] > HV line range -> 11/1/48:79/0:15 | 11/1/148:179/0:15 | 11/1/80:93/0:7 | 11/1/180:193/0:7 | 11/1/200:231/0:15 | 11/1/232:263/0:15 | 11/1/296,297,306,307/0:15 | 11/1/299,304,305,308,309/0:15 | 11/1/264:279/0:15 | 11/1/280:295/0:15 | 11/1/0:47/0:15 | 11/1/320:322/0:15 | 11/1/100:147/0:15 | 11/1/324,325/0:15 | 11/1/312:315/0:15 | 11/1/316:319/0:15 | 11/1/300:303/0:15 | 11/1/310,311/0:15 | 11/1/323/0:15 | 11/1/326,327/0:15 | 11/1/94:99/0:15 | 11/1/194:199/0:15 LArHVLineID INFO [init_hashes()] > Hvline_size= 5008 -LAr::DetectorFa... INFO new description with barrel croystat bolts -LAr::DetectorFa... INFO new coil bumper description +LAr::BarrelCryo... INFO new description with barrel croystat bolts +LAr::BarrelCryo... INFO new coil bumper description BarrelConstruction INFO Getting primary numbers for ATLAS, ATLAS-R2-2016-01-00-01 BarrelConstruction INFO Makes detailed absorber sandwich ? 1 1 BarrelConstruction INFO Use sagging in geometry ? 0 @@ -233,7 +213,7 @@ TileDddbManager INFO n_tilb = 21 TileDddbManager INFO n_tileSwitches = 1 CaloIDHelper_ID... INFO in createObj: creating a TileID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt TileHWIDDetDesc... INFO in createObj: creating a TileHWID helper object in the detector store TileHWID INFO initialize_from_dictionary AtlasDetectorID INFO initialize_from_dictionary - OK @@ -245,9 +225,9 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_ID helper object in th AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt CaloIDHelper_ID... INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK LArMiniFCAL_ID INFO initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID. @@ -287,7 +267,6 @@ LArConditionsTe... DEBUG initialize done LArConditionsTe... DEBUG input handles: 0 LArConditionsTe... DEBUG output handles: 0 LArConditionsTe... DEBUG Data Deps for LArConditionsTestAlg -HistogramPersis...WARNING Histograms saving not required. EventSelector INFO Enter McEventSelector Initialization AthenaEventLoopMgr INFO Setup EventSelector service EventSelector ApplicationMgr INFO Application Manager Initialized successfully @@ -297,7 +276,7 @@ CondInputLoader INFO created CondCont<AthenaAttributeList> with key 'Condit ApplicationMgr INFO Application Manager Started successfully AthenaEventLoopMgr INFO ===>>> start of run 0 <<<=== EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr -ClassIDSvc INFO getRegistryEntries: read 114 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LARAlign_CSC_01 for folder /LAR/Align IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LArCellPositionShift-ideal for folder /LAR/LArCellPositionShift @@ -327,12 +306,12 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_SuperCell_ID helper ob AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt CaloIDHelper_ID... INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt AtlasDetectorID INFO initialize_from_dictionary - OK CaloIdMgrDetDes... INFO Finished CaloIdMgrDetDes... INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv @@ -6274,7 +6253,7 @@ LArConditionsTe... DEBUG Total number of correction objects 20 LArConditionsTe... DEBUG End of testCondObjects AthenaEventLoopMgr INFO ===>>> done processing event #0, run #0 1 events processed so far <<<=== LarCondTestNoRe... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 /cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] E01BD448-BF95-DB11-983E-0015C5098AA3 /cvmfs/atlas-co... INFO Database being retired... @@ -6286,28 +6265,28 @@ CondInputLoader INFO Finalizing CondInputLoader... IncidentProcAlg2 INFO Finalize EventSelector INFO finalize IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.11 ))s -IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.05 ))s -IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.03 ))s -IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.07 ))s +IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.23 ))s +IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.15 ))s +IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.11 ))s +IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.30 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s -IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.02 ))s -IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.04 ))s +IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.10 ))s +IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.27 ))s IOVDbFolder WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc INFO bytes in (( 0.33 ))s +IOVDbSvc INFO bytes in (( 1.17 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 0.33 ))s +IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 1.17 ))s IOVDbSvc INFO Connection COOLOFL_CALO/OFLP200 : nConnect: 1 nFolders: 3 ReadTime: (( 0.00 ))s AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -cObjR_ALL INFO Time User : Tot= 270 [ms] Ave/Min/Max= 1.05(+- 16.2)/ 0/ 260 [ms] #=257 -cObj_ALL INFO Time User : Tot= 400 [ms] Ave/Min/Max= 44.4(+- 95.1)/ 0/ 310 [ms] #= 9 -ChronoStatSvc INFO Time User : Tot= 3.6 [s] #= 1 +cObjR_ALL INFO Time User : Tot= 300 [ms] Ave/Min/Max= 1.17(+- 16.8)/ 0/ 270 [ms] #=257 +cObj_ALL INFO Time User : Tot= 400 [ms] Ave/Min/Max= 44.4(+- 98.6)/ 0/ 320 [ms] #= 9 +ChronoStatSvc INFO Time User : Tot= 3.7 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestWriteNoReg.ref b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestWriteNoReg.ref index c954f91b01346f684b8a5e3f92cb58f688232391..a1c38459619ea59c7008a11dd8f60bcfbd46d93b 100644 --- a/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestWriteNoReg.ref +++ b/LArCalorimeter/LArTest/LArConditionsTest/share/LArConditionsTestWriteNoReg.ref @@ -1,7 +1,7 @@ -Fri Dec 20 03:55:52 CET 2019 +Thu May 21 18:52:24 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.9] [x86_64-centos7-gcc8-opt] [atlas-work3g/b671f9d07ec] -- built on [2019-12-19T2256] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [atlas-work3/a38808b681cd] -- built on [2020-05-21T1646] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" @@ -11,9 +11,9 @@ Py:Athena INFO including file "AtlasGeoModel/SetGeometryVersion.py" AtlasGeoModel/SetGeometryVersion.py is OBSOLETE Py:Athena INFO SetGeometryVersion.py obtained major release version 22 Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -Py:ConfigurableDb INFO Read module info for 5631 configurables from 29 genConfDb files +Py:ConfigurableDb INFO Read module info for 5533 configurables from 44 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version Athena-22.0.9 +EventInfoMgtInit: Got release version Athena-22.0.14 Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 Py:Athena INFO including file "LArRawConditions/LArIdMap_ATLAS_jobOptions.py" Py:Athena INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py" @@ -37,24 +37,23 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v32r2) - running on lxplus720.cern.ch on Fri Dec 20 03:56:01 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus7106.cern.ch on Thu May 21 18:52:37 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize AthDictLoaderSvc INFO in initialize... AthDictLoaderSvc INFO acquired Dso-registry -ClassIDSvc INFO getRegistryEntries: read 3732 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3736 CLIDRegistry entries for module ALL CoreDumpSvc INFO install f-a-t-a-l handler... (flag = -1) CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus720.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 10 servers found for host lxplus7106.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -74,7 +73,7 @@ IOVDbSvc INFO Folder /LAR/Identifier/FebRodMap, adding new key tag w IOVDbFolder INFO Read from meta data only for folder /TagInfo IOVDbSvc INFO Initialised with 3 connections and 10 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully -ClassIDSvc INFO getRegistryEntries: read 1908 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1967 CLIDRegistry entries for module ALL IOVDbSvc INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found. IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" @@ -91,9 +90,9 @@ IOVDbSvc INFO Added taginfo remove for /CALO/Ofl/Identifier/CaloTTOn IOVDbSvc INFO Added taginfo remove for /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas IOVDbSvc INFO Added taginfo remove for /LAR/LArCellPositionShift IOVDbSvc INFO Added taginfo remove for /LAR/Identifier/LArTTCellMapAtlas -ClassIDSvc INFO getRegistryEntries: read 325 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 268 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 24 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 237 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 239 CLIDRegistry entries for module ALL DetDescrCnvSvc INFO initializing DetDescrCnvSvc INFO Found DetectorStore service DetDescrCnvSvc INFO filling proxies for detector managers @@ -173,8 +172,8 @@ LArHVLineID INFO setDictVersion of LArHighVoltage is OK LArHVLineID INFO [initLevelsFromDict] m_dict OK ... LArHVLineID INFO [initialize_from_dictionary] > HV line range -> 11/1/48:79/0:15 | 11/1/148:179/0:15 | 11/1/80:93/0:7 | 11/1/180:193/0:7 | 11/1/200:231/0:15 | 11/1/232:263/0:15 | 11/1/296,297,306,307/0:15 | 11/1/299,304,305,308,309/0:15 | 11/1/264:279/0:15 | 11/1/280:295/0:15 | 11/1/0:47/0:15 | 11/1/320:322/0:15 | 11/1/100:147/0:15 | 11/1/324,325/0:15 | 11/1/312:315/0:15 | 11/1/316:319/0:15 | 11/1/300:303/0:15 | 11/1/310,311/0:15 | 11/1/323/0:15 | 11/1/326,327/0:15 | 11/1/94:99/0:15 | 11/1/194:199/0:15 LArHVLineID INFO [init_hashes()] > Hvline_size= 5008 -LAr::DetectorFa... INFO new description with barrel croystat bolts -LAr::DetectorFa... INFO new coil bumper description +LAr::BarrelCryo... INFO new description with barrel croystat bolts +LAr::BarrelCryo... INFO new coil bumper description BarrelConstruction INFO Getting primary numbers for ATLAS, ATLAS-R2-2016-01-00-01 BarrelConstruction INFO Makes detailed absorber sandwich ? 1 1 BarrelConstruction INFO Use sagging in geometry ? 0 @@ -199,7 +198,7 @@ TileDddbManager INFO n_tilb = 21 TileDddbManager INFO n_tileSwitches = 1 CaloIDHelper_ID... INFO in createObj: creating a TileID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileNeighbour_reduced.txt TileHWIDDetDesc... INFO in createObj: creating a TileHWID helper object in the detector store TileHWID INFO initialize_from_dictionary AtlasDetectorID INFO initialize_from_dictionary - OK @@ -211,9 +210,9 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_ID helper object in th AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal2DNeighbors-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsNext-April2011.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCal3DNeighborsPrev-April2011.txt CaloIDHelper_ID... INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK LArMiniFCAL_ID INFO initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID. @@ -221,7 +220,7 @@ AtlasDetectorID INFO initialize_from_dictionary - OK TileDetDescrMan... INFO Entering create_elements() ClassIDSvc INFO getRegistryEntries: read 66 CLIDRegistry entries for module ALL AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 7029 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 7030 CLIDRegistry entries for module ALL CondInputLoader INFO Initializing CondInputLoader... CondInputLoader INFO Adding base classes: + ( 'AthenaAttributeList' , 'ConditionStore+/LAR/Identifier/CalibIdMap' ) -> @@ -254,7 +253,6 @@ LArConditionsTe... DEBUG input handles: 0 LArConditionsTe... DEBUG output handles: 0 LArConditionsTe... DEBUG Data Deps for LArConditionsTestAlg ToolSvc.OutputC... INFO Initializing ToolSvc.OutputConditionsAlgTool - package version AthenaServices-00-00-00 -HistogramPersis...WARNING Histograms saving not required. EventSelector INFO Enter McEventSelector Initialization AthenaEventLoopMgr INFO Setup EventSelector service EventSelector ApplicationMgr INFO Application Manager Initialized successfully @@ -265,7 +263,7 @@ ApplicationMgr INFO Application Manager Started successfully AthenaEventLoopMgr INFO ===>>> start of run 0 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr -ClassIDSvc INFO getRegistryEntries: read 114 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LARAlign_CSC_01 for folder /LAR/Align IOVDbFolder INFO HVS tag OFLCOND-CSC-00-01-00 resolved to LArCellPositionShift-ideal for folder /LAR/LArCellPositionShift @@ -295,12 +293,12 @@ CaloIDHelper_ID... INFO in createObj: creating a LArHEC_SuperCell_ID helper ob AtlasDetectorID INFO initialize_from_dictionary - OK CaloIDHelper_ID... INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt -LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt +LArFCAL_Base_ID INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt CaloIDHelper_ID... INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store AtlasDetectorID INFO initialize_from_dictionary - OK -TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3/2019-12-18T2131/Athena/22.0.9/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt +TileNeighbour INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-20T2143/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/TileSuperCellNeighbour.txt AtlasDetectorID INFO initialize_from_dictionary - OK CaloIdMgrDetDes... INFO Finished CaloIdMgrDetDes... INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv @@ -6910,12 +6908,12 @@ CondInputLoader INFO Finalizing CondInputLoader... OutputCondition... INFO Finalize: preparing to write conditions objects DbSession INFO Open DbSession Domain[ROOT_All] INFO > Access DbDomain UPDATE [ROOT_All] -Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 Domain[ROOT_All] INFO LarCondTestNoReg.root -RootDatabase.open INFO LarCondTestNoReg.root File version:61804 +RootDatabase.open INFO LarCondTestNoReg.root File version:62002 OutputCondition... INFO Identified a total of 3 objects to write out: OutputCondition... INFO 0: LArRampMC#/LArCalorimeter/LArTests/LArRampsSingleGroup#/LArCalorimeter/LArTests/LArRampsSingleGroup -ClassIDSvc INFO getRegistryEntries: read 32 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 33 CLIDRegistry entries for module ALL OutputCondition... INFO 1: LArRampMC#/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping#/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping OutputCondition... INFO 2: LArRampMC#/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping#/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping StorageSvc INFO Building shape according to reflection information using shape ID for: @@ -6929,7 +6927,7 @@ StorageSvc INFO DataHeaderForm_p6 [7BE56CEF-C866-4BEE-9348-A5F34B5F1DA OutputCondition... INFO Written 3 objects to output stream OutputCondition... INFO Register objects in IOV database, interval of validity [run,LB] from [0,0] to [2147483647,4294967295] OutputCondition... INFO Register object LArRampMC#/LArCalorimeter/LArTests/LArRampsSingleGroup in IOV database folder /LArCalorimeter/LArTests/LArRampsSingleGroup without tagging -ClassIDSvc INFO getRegistryEntries: read 859 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 861 CLIDRegistry entries for module ALL IOVDbSvc INFO Opening COOL connection for sqlite://;schema=mycool.db;dbname=OFLP200 OutputCondition... INFO Register object LArRampMC#/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping in IOV database folder /LArCalorimeter/LArTests/LArRampsSubDetectorGrouping without tagging OutputCondition... INFO Register object LArRampMC#/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping in IOV database folder /LArCalorimeter/LArTests/LArRampsFeedThroughGrouping without tagging @@ -6937,36 +6935,36 @@ OutputCondition... INFO Registered 3 objects in IOV database IncidentProcAlg2 INFO Finalize EventSelector INFO finalize IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.11 ))s -IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.07 ))s -IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.02 ))s -IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.09 ))s +IOVDbFolder INFO Folder /LAR/Align (PoolRef) db-read 5/1 objs/chan/bytes 5/1/840 (( 0.28 ))s +IOVDbFolder INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/7600740 (( 0.16 ))s +IOVDbFolder INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/30500 (( 0.10 ))s +IOVDbFolder INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 5/1 objs/chan/bytes 5/1/3901460 (( 0.37 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s IOVDbFolder INFO Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas (PoolRef) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s -IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.02 ))s -IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.04 ))s +IOVDbFolder INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 2/1 objs/chan/bytes 2/1/390 (( 0.04 ))s +IOVDbFolder INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 5/0 objs/chan/bytes 5/1/865 (( 0.08 ))s IOVDbFolder WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc INFO bytes in (( 0.35 ))s +IOVDbSvc INFO bytes in (( 1.04 ))s IOVDbSvc INFO Disconnecting from sqlite://;schema=mycool.db;dbname=OFLP200 IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 1 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 0.35 ))s +IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 6 nFolders: 6 ReadTime: (( 1.04 ))s IOVDbSvc INFO Connection COOLOFL_CALO/OFLP200 : nConnect: 1 nFolders: 3 ReadTime: (( 0.00 ))s LarCondTestNoRe... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] 4C176DB9-5467-A847-9A9B-8F36CBEB4F80 +Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] 45F2DD4D-41E2-5E4B-A8AB-77C060E29F59 Domain[ROOT_All] INFO > Deaccess DbDomain UPDATE [ROOT_All] AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -commitOutput INFO Time User : Tot= 0 [us] #= 1 fRep_ALL INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 4 -cRepR_ALL INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #=255 +commitOutput INFO Time User : Tot= 10 [ms] #= 1 +cRepR_ALL INFO Time User : Tot= 20 [ms] Ave/Min/Max=0.0784(+-0.882)/ 0/ 10 [ms] #=255 cRep_ALL INFO Time User : Tot= 100 [ms] Ave/Min/Max= 25(+- 37.7)/ 0/ 90 [ms] #= 4 -cObjR_ALL INFO Time User : Tot= 350 [ms] Ave/Min/Max= 175(+- 165)/ 10/ 340 [ms] #= 2 -cObj_ALL INFO Time User : Tot= 400 [ms] Ave/Min/Max= 80(+- 150)/ 0/ 380 [ms] #= 5 -ChronoStatSvc INFO Time User : Tot= 4.17 [s] #= 1 +cObjR_ALL INFO Time User : Tot= 420 [ms] Ave/Min/Max= 210(+- 200)/ 10/ 410 [ms] #= 2 +cObj_ALL INFO Time User : Tot= 490 [ms] Ave/Min/Max= 98(+- 186)/ 0/ 470 [ms] #= 5 +ChronoStatSvc INFO Time User : Tot= 4.35 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/LumiBlock/LumiBlockComps/CMakeLists.txt b/LumiBlock/LumiBlockComps/CMakeLists.txt index 9da1ecb9e5bf843bae13bc0161b28c82de23f4ad..d954796bd1b9878d8ca2d342a4fbf814b37f550c 100644 --- a/LumiBlock/LumiBlockComps/CMakeLists.txt +++ b/LumiBlock/LumiBlockComps/CMakeLists.txt @@ -32,7 +32,7 @@ atlas_add_library( LumiBlockCompsLib atlas_add_component( LumiBlockComps src/components/*.cxx - LINK_LIBRARIES GaudiKernel LumiBlockCompsLib ) + LINK_LIBRARIES GaudiKernel LumiBlockCompsLib AthenaPoolUtilities ) atlas_add_dictionary( LumiBlockCompsDict LumiBlockComps/LumiBlockCompsDict.h @@ -57,7 +57,7 @@ atlas_add_test( LBDurationCondAlg_test atlas_add_test( LuminosityCondAlg_test SOURCES test/LuminosityCondAlg_test.cxx - LINK_LIBRARIES GaudiKernel LumiBlockCompsLib ) + LINK_LIBRARIES GaudiKernel LumiBlockCompsLib AthenaPoolUtilities ) atlas_add_test( TrigLiveFractionCondAlg_test SOURCES test/TrigLiveFractionCondAlg_test.cxx @@ -75,6 +75,10 @@ atlas_add_test( TrigLiveFractionCondAlgConfig_test SCRIPT python -m LumiBlockComps.TrigLiveFractionCondAlgConfig LOG_SELECT_PATTERN "ComponentAccumulator|^---|^IOVDbSvc" ) +atlas_add_test( LumiBlockMuWriterConfig_test + SCRIPT python -m LumiBlockComps.LumiBlockMuWriterConfig + LOG_SELECT_PATTERN "ComponentAccumulator|^---|^IOVDbSvc" ) + atlas_add_test( BunchCrossingCondAlg SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/python/BunchCrossingCondAlgTest.py diff --git a/LumiBlock/LumiBlockComps/LumiBlockComps/ILumiCalcSvc.h b/LumiBlock/LumiBlockComps/LumiBlockComps/ILumiCalcSvc.h deleted file mode 100644 index 17c513a1a01d4be38b4966fa6bd740d239c8e428..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/LumiBlockComps/ILumiCalcSvc.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ILumiCalcSvc.h -// Header file for class ILumiCalcSvc -// Author: R.Hawkings<richard.hawkings@cern.ch> -// B.Radics<radbal@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef LUMIBLOCKCOMPS_ILUMIBLOCKSVC_H -#define LUMIBLOCKCOMPS_ILUMIBLOCKSVC_H - -/** - * @class ILumiCalcSvc - * @brief This class defines a protocol to process lumiblock - * @brief iov information, given a list of lumiblocks - */ - -#include <string> -#include <list> -#include <utility> - -#include "TString.h" - -#include "GaudiKernel/INamedInterface.h" - -class TTree; - -typedef std::pair< TString, std::list<TString> > tvtPair; - -class ILumiCalcSvc -: virtual public ::INamedInterface -{ - -public: - DeclareInterfaceID(ILumiCalcSvc, 1, 0); - - // Default calculation of ILumi based on "LumiBlocks" and - // "IncompleteLumiBlocks" collections in MetaData store - virtual StatusCode calcLumi() = 0; - // Get a pointer the the TTree table of the calculation - // NOTE: only call this AFTER calcLumi or calcLumiFromLBC - virtual TTree * getLumiTree() = 0; - // Print some details to output screen - virtual void print() = 0; - - /// register trigger-lbc combination - virtual bool registerLBCollection(const TString& tname, const TString& regexpr, const std::list<TString>& trigpar) = 0 ; - -}; - -#endif diff --git a/LumiBlock/LumiBlockComps/LumiBlockComps/LumiBlockCompsDict.h b/LumiBlock/LumiBlockComps/LumiBlockComps/LumiBlockCompsDict.h index bed0888bddf3ecb937e58358527ff61df2b818fe..d1e31778626ded073b9df1ffd0d1c83c4352b591 100644 --- a/LumiBlock/LumiBlockComps/LumiBlockComps/LumiBlockCompsDict.h +++ b/LumiBlock/LumiBlockComps/LumiBlockComps/LumiBlockCompsDict.h @@ -1,6 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "LumiBlockComps/ILumiCalcSvc.h" #include "LumiBlockComps/ILumiBlockMuTool.h" diff --git a/LumiBlock/LumiBlockComps/LumiBlockComps/selection.xml b/LumiBlock/LumiBlockComps/LumiBlockComps/selection.xml index 00b20a00f577e5a40b8b570d8162b42c1ba9fef0..851671c7f310fb9ad5b8a33f1ee3a6af0b376fdc 100644 --- a/LumiBlock/LumiBlockComps/LumiBlockComps/selection.xml +++ b/LumiBlock/LumiBlockComps/LumiBlockComps/selection.xml @@ -1,6 +1,5 @@ <lcgdict> - <class name="ILumiCalcSvc"/> <class name="ILumiBlockMuTool"/> </lcgdict> diff --git a/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.cxx b/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.cxx index 5f0fe741095c2e8d9ea49cb1b71f02a4e6edc5d0..60e7beb2cfa71d2526894086829b6d6c2c369bc2 100644 --- a/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.cxx +++ b/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.cxx @@ -10,7 +10,6 @@ #include "LumiBlockMetaDataTool.h" #include "GoodRunsLists/IGoodRunsListSelectorTool.h" #include "GoodRunsLists/TGoodRunsListReader.h" -#include "LumiBlockComps/ILumiCalcSvc.h" #include "xAODLuminosity/SortLumiBlockRangeByStart.h" #include "DBDataModel/CollectionMetadata.h" diff --git a/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.h b/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.h index 653fe5b3f84fbff74767c03e03edf271f77f9778..fb954daf2c1e24564c515e2b502bd65e08a5ddc3 100644 --- a/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.h +++ b/LumiBlock/LumiBlockComps/Root/LumiBlockMetaDataTool.h @@ -41,13 +41,13 @@ class LumiBlockMetaDataTool virtual StatusCode finalize() override; /// Function collecting the metadata from a new input file - virtual StatusCode beginInputFile(const SG::SourceID&); + virtual StatusCode beginInputFile(const SG::SourceID&) override; /// Function collecting the metadata from a new input file - virtual StatusCode endInputFile(const SG::SourceID&); + virtual StatusCode endInputFile(const SG::SourceID&) override; /// Function writing the collected metadata to the output - virtual StatusCode metaDataStop(); + virtual StatusCode metaDataStop() override; private: /// Fill metaDataStore and ntuples diff --git a/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterConfig.py b/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..d11045f8bc4e7b7ec641a0560d87e9e95c62bd70 --- /dev/null +++ b/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterConfig.py @@ -0,0 +1,50 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# File: LumiBlockComps/python/LumiBlockMuWriterConfig.py +# Created: May 2020, sss +# Purpose: Configure LumiBlockMuWriter. +# + + +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +def LumiBlockMuWriterCfg (configFlags, name = 'LumiBlockMuWriter'): + result = ComponentAccumulator() + + if configFlags.Beam.Type == 'cosmics': + condkey = '' + else: + from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg + result.merge (LuminosityCondAlgCfg (configFlags)) + condkey = result.getCondAlgo ('LuminosityCondAlg').LuminosityOutputKey + + LumiBlockMuWriter = CompFactory.LumiBlockMuWriter # LumiBlockComps + alg = LumiBlockMuWriter (name, LumiDataKey = condkey) + result.addCondAlgo (alg) + return result + + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.loadAllDynamicFlags() + + print ('--- collisions') + flags1 = ConfigFlags.clone() + flags1.Input.Files = defaultTestFiles.RAW + flags1.lock() + acc1 = LumiBlockMuWriterCfg (flags1) + acc1.printCondAlgs (summariseProps=True) + acc1.wasMerged() + + print ('--- cosmics') + flags2 = ConfigFlags.clone() + flags2.Beam.Type = 'cosmics' + flags2.lock() + acc2 = LumiBlockMuWriterCfg (flags2) + acc2.printCondAlgs (summariseProps=True) + acc2.wasMerged() diff --git a/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterDefault.py b/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterDefault.py new file mode 100644 index 0000000000000000000000000000000000000000..2dc94cbb4084be178ca2541608236490c045203e --- /dev/null +++ b/LumiBlock/LumiBlockComps/python/LumiBlockMuWriterDefault.py @@ -0,0 +1,60 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# File: LumiBlockComps/python/LumiBlockMuWriterDefault.py +# Created: May 2020, sss +# Purpose: Configure LumiBlockMuWriter. +# + + +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaCommon.BeamFlags import jobproperties + + +def LumiBlockMuWriterDefault (name = 'LumiBlockMuWriter'): + from AthenaCommon.AlgSequence import AthSequencer + from AthenaCommon.AlgSequence import AlgSequence + + condSeq = AthSequencer ('AthCondSeq') + topSequence = AlgSequence() + if hasattr (condSeq, name) or hasattr (topSequence, name): + return + + LumiBlockMuWriter = CompFactory.LumiBlockMuWriter # LumiBlockComps + if jobproperties.Beam.beamType() == 'cosmics': + condkey = '' + else: + from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgDefault + condalg = LuminosityCondAlgDefault() + condkey = condalg.LuminosityOutputKey + + alg = LumiBlockMuWriter (name, LumiDataKey = condkey) + + cnvseq = None + cnvalg = getattr (condSeq, 'xAODMaker::EventInfoCnvAlg', None) + if cnvalg: + cnvseq = condSeq + else: + cnvalg = getattr (topSequence, 'xAODMaker::EventInfoCnvAlg', None) + if cnvalg: + cnvseq = topSequence + + # FIXME: If EventInfoCnvAlg is in topSequence, then this needs to come + # after it. Otherwise, schedule to condSeq so we'll be run early. + if cnvalg and cnvseq is topSequence: + topSequence += alg + else: + condSeq += alg + + from AthenaCommon.GlobalFlags import globalflags + from RecExConfig.ObjKeyStore import objKeyStore + + if (cnvalg and + not globalflags.InputFormat.is_bytestream() and + not objKeyStore.isInInput ("xAOD::EventInfo")): + sgil = getattr (topSequence, 'SGInputLoader', None) + if sgil: + for k in sgil.Load[:]: + if k[1].find ('EventInfo') >= 0: + sgil.Load.remove (k) + return + diff --git a/LumiBlock/LumiBlockComps/python/LumiCalcPyAthena.py b/LumiBlock/LumiBlockComps/python/LumiCalcPyAthena.py deleted file mode 100644 index 9b59952c36710e3d28ab06448f14e1c1c79ef826..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/python/LumiCalcPyAthena.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function - -import AthenaPython.PyAthena as PyAthena -from AthenaPython.PyAthena import StatusCode - -class LumiCalcPyAthena( PyAthena.Alg ): - - def __init__ ( self, name = "LumiCalcPyAthena", **kw ): - ## initialize base class - kw['name'] = name - super(LumiCalcPyAthena, self).__init__(**kw) - - #handle to lumicalcSvc - self.lcSvc = kw.get('lcSvc', 'LumiCalcSvc/LumiCalcSvc') - - #handle to storegate - self.sgSvc = None - - return - - def initialize(self): - - self.sgSvc = PyAthena.py_svc('StoreGateSvc') - if not self.sgSvc : - self.msg.error("could not retrieve a handle to the event store !") - return StatusCode.Failure - - - self.lcSvc = PyAthena.py_svc('LumiCalcSvc/LumiCalcSvc', iface='ILumiCalcSvc') - if not self.lcSvc : - self.msg.error("could not retrieve a handle to the lumicalc Service !") - return StatusCode.Failure - - - return StatusCode.Success - - def execute(self): - - return StatusCode.Success - - - def finalize(self): - - print("Getting handle on LumiTree...") - self.lcSvc.getLumiTree() - #print "Now printing out the whole tree..." - #tree.Scan("*") - - - - return StatusCode.Success - diff --git a/LumiBlock/LumiBlockComps/python/LuminosityCondAlgConfig.py b/LumiBlock/LumiBlockComps/python/LuminosityCondAlgConfig.py index 1011958409824c234afd7ac7e85aafbd06fcabb4..d991f41e12e3f325ddd10e428020d17a5ec53e3f 100644 --- a/LumiBlock/LumiBlockComps/python/LuminosityCondAlgConfig.py +++ b/LumiBlock/LumiBlockComps/python/LuminosityCondAlgConfig.py @@ -30,6 +30,8 @@ def LuminosityCondAlgCfg (configFlags, useOnlineLumi=None, suffix=None): if configFlags.Input.isMC: log.info ("LuminosityCondAlgCfg called for MC!") kwargs = luminosityCondAlgMCCfg (configFlags, name, result) + elif configFlags.Beam.Type != 'collisions': + kwargs = luminosityCondAlgCosmicsCfg (configFlags, name, result) elif ((useOnlineLumi is None and configFlags.Common.useOnlineLumi) or (useOnlineLumi is not None and useOnlineLumi)): kwargs = luminosityCondAlgOnlineCfg (configFlags, name, result) @@ -59,7 +61,12 @@ def luminosityCondAlgMCCfg (configFlags, name, result): 'BunchGroupInputKey' : '', 'FillParamsInputKey' : '' } - +def luminosityCondAlgCosmicsCfg (configFlags, name, result): + return { 'LuminosityFolderInputKey' : '', + 'OnlineLumiCalibrationInputKey' : '', + 'BunchLumisInputKey' : '', + 'BunchGroupInputKey' : '', + 'FillParamsInputKey' : '' } # Configuration for offline default luminosity used in Run2 def luminosityCondAlgRun2Cfg (configFlags, name, result): diff --git a/LumiBlock/LumiBlockComps/python/LuminosityCondAlgDefault.py b/LumiBlock/LumiBlockComps/python/LuminosityCondAlgDefault.py index 34efdbb5bcea863e8ca1ec46321171c5a83ea640..c7c87b4684bcd84a19e744f1bc5c061eb8a170aa 100644 --- a/LumiBlock/LumiBlockComps/python/LuminosityCondAlgDefault.py +++ b/LumiBlock/LumiBlockComps/python/LuminosityCondAlgDefault.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # # File: LumiBlockComps/python/LuminosityCondAlgDefault.py # Created: May 2019, sss, from existing LuminosityToolDefault. @@ -38,13 +38,13 @@ def LuminosityCondAlgDefault (name = 'LuminosityCondAlg', kwargs = {} from IOVDbSvc.CondDB import conddb - if isOnline: - kwargs = configureOnlineLuminosityCondAlg (name) - - elif conddb.isMC: + if conddb.isMC: mlog.info("LuminosityCondAlgDefault called for MC!") kwargs = configureLuminosityCondAlgMC (name) + elif isOnline: + kwargs = configureOnlineLuminosityCondAlg (name) + elif conddb.dbdata == "COMP200": kwargs = configureLuminosityCondAlgRun1 (name) diff --git a/LumiBlock/LumiBlockComps/share/LumiBlockMuWriterConfig_test.ref b/LumiBlock/LumiBlockComps/share/LumiBlockMuWriterConfig_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..91beb8b7506454af7fdd7659166a8c3fb5d8b928 --- /dev/null +++ b/LumiBlock/LumiBlockComps/share/LumiBlockMuWriterConfig_test.ref @@ -0,0 +1,26 @@ +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [atlas-work3/85ffba7a6ec] -- built on [2020-05-15T0253] +--- collisions +Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1 +Py:MetaReader INFO Current mode used: peeker +Py:MetaReader INFO Current filenames: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1'] +Py:LuminosityCondAlg INFO luminosityCondAlgRun2Config requested /TRIGGER/OFLLUMI/OflPrefLumi +Py:LuminosityCondAlg INFO Created Run2 LuminosityCondAlg using folder /TRIGGER/OFLLUMI/OflPrefLumi +Py:ComponentAccumulator INFO Condition Algorithms +Py:ComponentAccumulator INFO \__ CondInputLoader (cond alg) +Py:ComponentAccumulator INFO * Load: [['CondAttrListCollection', '/TRIGGER/OFLLUMI/OflPrefLumi'], ['CondAttrListCollection', '/TDAQ/OLC/CALIBRATIONS']] +Py:ComponentAccumulator INFO \__ OnlineLumiCalibrationCondAlg (cond alg) +Py:ComponentAccumulator INFO * CalibrationFolderInputKey: /TDAQ/OLC/CALIBRATIONS +Py:ComponentAccumulator INFO * LumiCalibOutputKey: OnlineLumiCalibrationCondData +Py:ComponentAccumulator INFO \__ LuminosityCondAlg (cond alg) +Py:ComponentAccumulator INFO * BunchGroupInputKey: +Py:ComponentAccumulator INFO * BunchLumisInputKey: +Py:ComponentAccumulator INFO * FillParamsInputKey: +Py:ComponentAccumulator INFO * LuminosityFolderInputKey: /TRIGGER/OFLLUMI/OflPrefLumi +Py:ComponentAccumulator INFO * LuminosityOutputKey: LuminosityCondData +Py:ComponentAccumulator INFO * OnlineLumiCalibrationInputKey: OnlineLumiCalibrationCondData +Py:ComponentAccumulator INFO \__ LumiBlockMuWriter (cond alg) +Py:ComponentAccumulator INFO * LumiDataKey: LuminosityCondData +--- cosmics +Py:ComponentAccumulator INFO Condition Algorithms +Py:ComponentAccumulator INFO \__ LumiBlockMuWriter (cond alg) +Py:ComponentAccumulator INFO * LumiDataKey: diff --git a/LumiBlock/LumiBlockComps/share/LumiBlockMuWriter_jobOptions.py b/LumiBlock/LumiBlockComps/share/LumiBlockMuWriter_jobOptions.py index 440c6bfa1a3df46d7abb914108d5639a71e8db1c..814024cd8a2eb4a4f279075585e412e4d1b8692c 100644 --- a/LumiBlock/LumiBlockComps/share/LumiBlockMuWriter_jobOptions.py +++ b/LumiBlock/LumiBlockComps/share/LumiBlockMuWriter_jobOptions.py @@ -1,12 +1,5 @@ """ Configuration for LumiBlockMuWriter to write mu into xAOD::EventInfo """ -from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgDefault -condalg = LuminosityCondAlgDefault() - -from LumiBlockComps.LumiBlockCompsConf import LumiBlockMuWriter -muWriter = LumiBlockMuWriter("LumiBlockMuWriter",LumiDataKey=condalg.LuminosityOutputKey) - -from AthenaCommon.AlgSequence import AthSequencer -condSeq = AthSequencer("AthCondSeq") -condSeq += muWriter +from LumiBlockComps.LumiBlockMuWriterDefault import LumiBlockMuWriterDefault +LumiBlockMuWriterDefault() diff --git a/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc.py b/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc.py index 33d96ff44d5caf584884363241567914f37085d0..598c9151effb5c27cfb4764cd1ca21a46696d90a 100644 --- a/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc.py +++ b/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc.py @@ -8,11 +8,3 @@ from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc( "MetaDataSvc" ) svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ] -# add LumiCalcSvc to ServiceMgr and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.UseMC = True -LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -svcMgr += LumiCalcSvc diff --git a/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc_GRL.py b/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc_GRL.py index 5868abe22c3b2532e24d13c7f932cbd3f9dce093..c291032c5bb595ea949e79e8bf56fbf3a59ba887 100644 --- a/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc_GRL.py +++ b/LumiBlock/LumiBlockComps/share/LumiBlock_LumiCalc_GRL.py @@ -14,13 +14,3 @@ ToolSvc += GoodRunsListSelectorTool() GoodRunsListSelectorTool.OutputLevel = INFO GoodRunsListSelectorTool.GoodRunsListVec = [ 'grl_topmix_mu.xml' ] # or grl_topmix_e.xml GoodRunsListSelectorTool.PassThrough = False - -# add LumiCalcSvc to ServiceMgr and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.UseMC = True -LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -svcMgr += LumiCalcSvc - diff --git a/LumiBlock/LumiBlockComps/share/LumiBlock_jobOptions_data.py b/LumiBlock/LumiBlockComps/share/LumiBlock_jobOptions_data.py index b4dbad6bec6309be00df5afb2a77337664a6ae42..38557f83344e3a176890bfff94f50d022e152d80 100644 --- a/LumiBlock/LumiBlockComps/share/LumiBlock_jobOptions_data.py +++ b/LumiBlock/LumiBlockComps/share/LumiBlock_jobOptions_data.py @@ -27,18 +27,6 @@ GoodRunsListSelectorTool.OutputLevel = INFO GoodRunsListSelectorTool.GoodRunsListVec = [ 'top_noveto_muchannel_7TeV.xml' ] # <<<<--- Edit this line! GoodRunsListSelectorTool.PassThrough = False -# add LumiCalcSvc to ServiceMgr and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu10"] -LumiCalcSvc.UseMC = False -LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -LumiCalcSvc.UseLumiTag = "OflLumi-7TeV-002" -LumiCalcSvc.LumiEstFolder = "/TRIGGER/OFLLUMI/LBLESTOFL" -svcMgr += LumiCalcSvc -#====================================================================================== - from RecExConfig.RecFlags import rec rec.AutoConfiguration = ['everything'] rec.readRDO = False diff --git a/LumiBlock/LumiBlockComps/share/LumiCalcPyAthena_jobOptions.py b/LumiBlock/LumiBlockComps/share/LumiCalcPyAthena_jobOptions.py deleted file mode 100644 index c63716891bce2d96e2128096eeb78a75678de560..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/share/LumiCalcPyAthena_jobOptions.py +++ /dev/null @@ -1,42 +0,0 @@ -from AthenaCommon.AppMgr import ServiceMgr -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.AlgSequence import AlgSequence -import AthenaPoolCnvSvc.ReadAthenaPool -from PartPropSvc.PartPropSvcConf import PartPropSvc - -# the POOL converters -include( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py") -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) - -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -from AthenaCommon.AppMgr import theApp - -# Input AOD file -ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/user/r/radbal/scratch0/data/TopMix/user.RichardHawkings.0108175.topmix_Muon.AOD.v4._00057.pool.root" ] - -# Number of Events to process -if not "EvtMax" in dir(): EvtMax=5 -theApp.EvtMax = EvtMax - -# the Top Algorithm Sequence -topSequence = AlgSequence() - -# Add the service and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.UseMC = True -# explicit list of LumiBlockCollections names -LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -# NOTE: UseInputStore must be *False* by default BUT just for this example we set it to True -LumiCalcSvc.UseInputStore = True -svcMgr += LumiCalcSvc - -# Add LumiCalcPyAthena Alg -from LumiBlockComps.LumiCalcPyAthena import LumiCalcPyAthena -theJob = AlgSequence() -theJob += LumiCalcPyAthena() -LumiCalcPyAthena.OutputLevel = INFO diff --git a/LumiBlock/LumiBlockComps/share/LumiCalc_topOptions.py b/LumiBlock/LumiBlockComps/share/LumiCalc_topOptions.py index 02c2ccb108400417fd565a75a3afb996991cb099..6afcf4504aa116682f99f0576fec50e0a02fcf73 100644 --- a/LumiBlock/LumiBlockComps/share/LumiCalc_topOptions.py +++ b/LumiBlock/LumiBlockComps/share/LumiCalc_topOptions.py @@ -1,6 +1,6 @@ ######################################## # Job to run RecExCommon, schedule -# LumiBlockMetaDataTool and LumiCalcSvc +# LumiBlockMetaDataTool # but don't write out any AOD outputfile # the Input AOD File @@ -23,16 +23,6 @@ from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" ) LumiBlockMetaDataTool.OutputLevel = DEBUG -# add LumiCalcSvc and configure -from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc -LumiCalcSvc = LumiCalcSvc() -LumiCalcSvc.Triggers = ["EF_mu20"] -LumiCalcSvc.UseMC = True -LumiCalcSvc.LBCollNames = ["LumiBlocks_GoodDQ0"] #, "IncompleteLumiBlocks_GoodDQ0"] -#LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"] -LumiCalcSvc.Verbose = False -svcMgr += LumiCalcSvc - # Either use aodtoaod.py as it is #include ("RecExCommon/aodtoaod.py") diff --git a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx index 3f6decf3f3bd9cadf2202664e7a805de9383a9c7..99854b1abb697114400af524d91a59faf4817422 100644 --- a/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx +++ b/LumiBlock/LumiBlockComps/src/LumiBlockMuWriter.cxx @@ -15,7 +15,7 @@ StatusCode LumiBlockMuWriter::initialize() { ATH_MSG_INFO("LumiBlockMuWriter::initialize()"); - ATH_CHECK(m_lumiDataKey.initialize()); + ATH_CHECK(m_lumiDataKey.initialize(SG::AllowEmpty)); ATH_CHECK(m_actIntPerXKey.initialize()); ATH_CHECK(m_aveIntPerXKey.initialize()); @@ -28,14 +28,18 @@ StatusCode LumiBlockMuWriter::execute(const EventContext& ctx) const float actualMu = 0.0; float muToLumi = 0.0; - SG::ReadCondHandle<LuminosityCondData> lumiData (m_lumiDataKey, ctx); - if (lumiData->lbAverageLuminosity() != 0 || - lumiData->lbAverageInteractionsPerCrossing() != 0) { - muToLumi = lumiData->muToLumi(); - if( std::abs( muToLumi ) > 0.00001 ) { - unsigned int bcid = ctx.eventID().bunch_crossing_id(); - actualMu = lumiData->lbLuminosityPerBCIDVector().at(bcid) / muToLumi; + float aveIntPerX = 0.0; + if (!m_lumiDataKey.empty()) { + SG::ReadCondHandle<LuminosityCondData> lumiData (m_lumiDataKey, ctx); + if (lumiData->lbAverageLuminosity() != 0 || + lumiData->lbAverageInteractionsPerCrossing() != 0) { + muToLumi = lumiData->muToLumi(); + if( std::abs( muToLumi ) > 0.00001 ) { + unsigned int bcid = ctx.eventID().bunch_crossing_id(); + actualMu = lumiData->lbLuminosityPerBCIDVector().at(bcid) / muToLumi; + } } + aveIntPerX = lumiData->lbAverageInteractionsPerCrossing(); } SG::WriteDecorHandle<xAOD::EventInfo,float> actIntPerXDecor(m_actIntPerXKey,ctx); @@ -43,14 +47,18 @@ StatusCode LumiBlockMuWriter::execute(const EventContext& ctx) const ATH_MSG_ERROR( "actIntPerXDecor.isPresent check fails" ); return StatusCode::FAILURE; } - actIntPerXDecor(0) = actualMu; + if (!actIntPerXDecor.isAvailable()) { + actIntPerXDecor(0) = actualMu; + } SG::WriteDecorHandle<xAOD::EventInfo,float> aveIntPerXDecor(m_aveIntPerXKey,ctx); if (!aveIntPerXDecor.isPresent()) { ATH_MSG_ERROR( "aveIntPerXDecor.isPresent check fails" ); return StatusCode::FAILURE; } - aveIntPerXDecor(0) = lumiData->lbAverageInteractionsPerCrossing(); + if (!aveIntPerXDecor.isAvailable()) { + aveIntPerXDecor(0) = aveIntPerX; + } return StatusCode::SUCCESS; } diff --git a/LumiBlock/LumiBlockComps/src/LumiCalcSvc.cxx b/LumiBlock/LumiBlockComps/src/LumiCalcSvc.cxx deleted file mode 100644 index b0c0cd6d8177761ba4061d443fabca8bfc2f3f1a..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/src/LumiCalcSvc.cxx +++ /dev/null @@ -1,272 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// LumiCalcSvc.cxx -// Implementation file for class LumiCalcSvc -// Author: B.Radics<radbal@cern.ch> -// based on Richard Hawkings' LumiCalc.py -/////////////////////////////////////////////////////////////////// - -// for size_t -#include <cstddef> - -// GaudiKernel includes -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/FileIncident.h" - -// Athena include files -#include "StoreGate/StoreGate.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "AthenaPoolUtilities/AthenaAttributeList.h" - -// Gaudi/Athena access -#include "GaudiKernel/ISvcLocator.h" -#include "AthenaBaseComps/AthService.h" - -#include <string> - -// ROOT -#include "TTree.h" - -// stl includes -#include <iomanip> -#include <iostream> - -#include "LumiCalcSvc.h" -#include "xAODLuminosity/LumiBlockRangeContainer.h" -#include "xAODLuminosity/LumiBlockRangeAuxContainer.h" - -LumiCalcSvc::LumiCalcSvc(const std::string& name, - ISvcLocator* pSvcLocator ) : - base_class(name, pSvcLocator), - m_pMetaDataStore ("StoreGateSvc/MetaDataStore", name), - m_pInputStore ("StoreGateSvc/InputMetaDataStore", name), - m_tHistSvc(0), - m_sourcedb("COOLONL_TRIGGER/OFLP200"), - m_parlumiestfolder("/TRIGGER/LUMI/LBLEST"), - m_parlumilvl1folder("/TRIGGER/LUMI/LVL1COUNTERS"), - m_parlumihltfolder("/TRIGGER/LUMI/HLTCOUNTERS"), - m_parlvl1prescalesfolder("/TRIGGER/LVL1/Prescales"), - m_parlvl1menufolder("/TRIGGER/LVL1/Menu"), - m_parhltmenufolder("/TRIGGER/HLT/Menu"), - m_recordTTree(true), - m_fileCurrentlyOpened(false) -{ - // Properties for configuration of LumiCalcSvc - declareProperty("SourceDb", m_sourcedb); - declareProperty("LumiEstFolder", m_parlumiestfolder); - declareProperty("LumiLVL1CountersFolder", m_parlumilvl1folder); - declareProperty("LumiHLTCountersFolder", m_parlumihltfolder); - declareProperty("LVL1PrescalesFolder", m_parlvl1prescalesfolder); - declareProperty("LVL1MenuFolder", m_parlvl1menufolder); - declareProperty("HLTMenuFolder", m_parhltmenufolder); - declareProperty("Triggers", m_triggers); - declareProperty("LBCollNames", m_lbcnames); - declareProperty("UseMC", m_UseMC = false); - declareProperty("OnlineLumi", m_Online = false); - declareProperty("UseLumiTag", m_UseLumiTag = "OflLumi-Dec2009-001"); // ATLAS_PREFERRED or OflLumi_Fake0/1 - declareProperty("UseLumiMethod", m_UseLumiMethod = "ATLAS_PREFERRED"); // ATLAS_PREFERRED or OflLumi_Fake0/1 - declareProperty("UseLumiChannel", m_UseLumiChannel = 0); // - declareProperty("Verbose", m_Verbose = false); - declareProperty("UseInputStore", m_UseInputStore = false); - - m_lumicalc = new LumiCalculator(); - - m_LumiTree = nullptr; -} - -//=========================================================================== -LumiCalcSvc::~LumiCalcSvc(){ - delete m_lumicalc; -} - -//=========================================================================== -StatusCode LumiCalcSvc::initialize(){ - - ATH_CHECK( m_pMetaDataStore.retrieve() ); - ATH_CHECK( m_pInputStore.retrieve() ); - - // Set to be listener for begin/end of event - ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name()); - ATH_CHECK( incSvc.retrieve() ); - - incSvc->addListener(this, "BeginInputFile", 60); // pri has to be < 100 to be after MetaDataSvc. - incSvc->addListener(this, "EndInputFile", 50); // pri has to be > 10 to be before MetaDataSvc. - incSvc->addListener(this, "EndRun", 50); // pri has to be > 10 to be before MetaDataSvc. - - /// Initialize histogram service - ATH_CHECK( service("THistSvc", m_tHistSvc) ); - - /// Create TTree - m_LumiTree = new TTree("LumiMetaData","LumiMetaData"); - ATH_CHECK( m_tHistSvc->regTree("/AANT/Lumi",m_LumiTree) ); - - m_lumicalc->setTree(m_LumiTree); - - return StatusCode::SUCCESS; -} - -//=========================================================================== -// Calculates lumi on a user defined input MetaData LumiBlockCollection -StatusCode LumiCalcSvc::calcLumi(){ - - StatusCode status = doDbQuery(m_pMetaDataStore); - if (!status.isSuccess()){ - ATH_MSG_WARNING("Couldn't do Db Query for LumiCalcSvc"); - } - - return status; - -} - -//=========================================================================== -StatusCode LumiCalcSvc::doDbQuery(StoreGateSvc_t sg) { - - StatusCode status = StatusCode::SUCCESS; - - doRecordTree(true);// record history to m_LumiTree TTree - StoreGateSvc_t store = sg; - m_LumiTree=m_lumicalc->getTree(); - - if (!m_triggers.value().empty() && !m_lbcnames.value().empty()) { - // collect trigger names - std::list<TString> trignames; - for (std::vector<std::string>::const_iterator it = m_triggers.value().begin(); it != m_triggers.value().end(); ++it) - trignames.push_back(*it); - // fill registry with lbc names+triggers - for(std::vector<std::string>::const_iterator itr = m_lbcnames.value().begin(); itr != m_lbcnames.value().end(); itr++) { - const std::string lbcollname = (*itr); - this->registerLBCollection(lbcollname,"no description available",trignames); - } - } - - // Try to Calculate lumi based on list of LumiBlocks in MetaData store - //=========================================================================== - - // loop over registered lbc-trigger combinations - std::map<TString,tvtPair>::iterator ritr = m_registry.begin(); - for (; ritr!=m_registry.end(); ++ritr) { - - const std::string& lbcollname = ritr->first.Data(); - const std::string& description = ritr->second.first.Data(); - std::list<TString> trignames = ritr->second.second; - - if (trignames.empty()) { - ATH_MSG_INFO("No trigger names registered for lb coll: " << lbcollname << ". Copying trigger names from LumiCalcSvc."); - for (std::vector<std::string>::const_iterator it = m_triggers.value().begin(); it != m_triggers.value().end(); ++it) - trignames.push_back(*it); - } - - if (store->contains<xAOD::LumiBlockRangeContainer>(lbcollname)) { - // const DataHandle<xAOD::LumiBlockRangeContainer> iovc; - const xAOD::LumiBlockRangeContainer* lbcoll = 0; - status = store->retrieve(lbcoll, lbcollname); - - if (!status.isSuccess()) { - ATH_MSG_DEBUG("Could not find LumiBlockRangeContainer >>" << lbcollname << "<< in " << store->name()); - }else { - ATH_MSG_DEBUG(" Found LumiBlockRangeContainer >>" << lbcollname << "<< in " << store->name() << " OK "); - ATH_MSG_INFO(" Calculating Integrated Luminosity based on >>" << lbcollname << "<< in " << store->name()); - if (!description.empty()) { ATH_MSG_INFO(" Description of >>" << lbcollname << "<< = " << description); } - - /* - const LumiBlockRangeContainer* lbcoll = iovc; - // check against problems - if(dynamic_cast< const LumiBlockCollection * >(lbcoll) == 0){ - log << MSG::ERROR << "Input LumiBlockRangeContainer to LumiCalcSvc is not of type LumiBlockRangeContainer" << endmsg; - status = StatusCode::FAILURE; - return status; - }else{ - if(lbcoll->empty()){ - log << MSG::WARNING << "Input LumiBlockCollection is empty, not calculating!" << endmsg; - status = StatusCode::SUCCESS; - return status; - } - } - */ - - for( std::list<TString>::const_iterator it = trignames.begin(); it != trignames.end(); ++it){ - const std::string trigname = it->Data(); - m_lumicalc->SetCollName(lbcollname); - m_lumicalc->UseLumiTag(m_UseLumiTag); - if(m_UseLumiChannel == -1)m_lumicalc->UseLumiMethod(m_UseLumiMethod); - if(m_UseLumiChannel != -1)m_lumicalc->UseLumiChannel(m_UseLumiChannel); - m_lumicalc->UseMC(m_UseMC.value()); - m_lumicalc->UseOnlineLumi(m_Online.value()); - m_lumicalc->Verbose(m_Verbose.value()); - m_lumicalc->IntegrateLumi(lbcoll, trigname); - ATH_MSG_INFO("=========================================================="); - if(m_Verbose.value() != true)print(); - // detailed list of calculation to screen on demand - if(m_Verbose.value() == true)printTree(); - } - } - } else { - ATH_MSG_WARNING("Could not find LumiBlockCollection >>" << lbcollname << "<< in " << store->name()); - } - } // end loop over registered lbc-trigger combinations - - return status; -} - -//=========================================================================== -void LumiCalcSvc::handle(const Incident& inc) { - - const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc); - std::string fileName; - if (fileInc == 0) { fileName = "Undefined "; } - else { fileName = fileInc->fileName(); } - ATH_MSG_DEBUG("handle() " << inc.type() << " for file: " << fileName); - - if (inc.type() == "BeginInputFile") { - ATH_MSG_DEBUG("BeginInputFile incident fired!"); - m_fileCurrentlyOpened = true; - if(m_UseInputStore == true){ - doDbQuery(m_pInputStore).ignore(); - } - } - else if (inc.type() == "EndInputFile") { - m_fileCurrentlyOpened = false; - - } - else if (inc.type() == "EndRun") { - } -} - -StatusCode LumiCalcSvc::stop(){ - - if (m_fileCurrentlyOpened == true) ATH_MSG_DEBUG("File was read partially"); - if (m_fileCurrentlyOpened == false) ATH_MSG_DEBUG("File was read fully"); - - return StatusCode::SUCCESS; - -} - - -//=========================================================================== -void LumiCalcSvc::printTree(){ - - if(m_LumiTree != nullptr)m_LumiTree->Scan("*"); - -} - -//=========================================================================== -bool -LumiCalcSvc::registerLBCollection(const TString& tname, const TString& regexpr, const std::list<TString>& trigpar) -{ - - if (m_registry.find(tname)!=m_registry.end()) { - ATH_MSG_WARNING("registerLBCollection() :: LB collection with name <" << tname << "> already registered. Return false."); - return false; - } - - ATH_MSG_DEBUG("registerLBCollection() :: LB collection with name <" << tname << "> registered."); - m_registry[tname] = tvtPair(regexpr,trigpar); - - return true; -} - diff --git a/LumiBlock/LumiBlockComps/src/LumiCalcSvc.h b/LumiBlock/LumiBlockComps/src/LumiCalcSvc.h deleted file mode 100644 index d455ab42bf8fbae26cd749cdbb93f6018663ca08..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/src/LumiCalcSvc.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef XAOD_ANALYSIS - -///////////////////////// -*- C++ -*- ///////////////////////////// -// LumiCalcSvc.h -// Header file for class LumiCalcSvc -// Author: B.Radics<radbal@cern.ch> -// based on Richard Hawkings' LumiCalc.py -/////////////////////////////////////////////////////////////////// -#ifndef LUMIBLOCKCOMPS_LUMICALCSVC_H -#define LUMIBLOCKCOMPS_LUMICALCSVC_H - -/** - * @class LumiCalcSvc - * @brief This implementes the methods for ILumiCalcSvc - */ - -// Gaudi/Athena access -//#include "LumiBlockComps/ILumiCalcSvc.h" -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/Property.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/ITHistSvc.h" -#include "AthenaBaseComps/AthService.h" -#include "LumiCalc/LumiCalculator.h" -#include "LumiBlockComps/ILumiCalcSvc.h" - -class TTree; -class ILumiCalcSvc; -class StoreGateSvc; - -class LumiCalcSvc : public extends<AthService, ILumiCalcSvc, IIncidentListener> -{ - -public: - - /// Constructor - LumiCalcSvc(const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor - virtual ~LumiCalcSvc(); - - /// Gaudi Service Implementation - //@{ - virtual StatusCode initialize() override; - virtual StatusCode stop() override; - //@} - - /// Incident service handle listening for BeginInputFile and EndInputFile. - virtual void handle(const Incident& incident) override; - - // print some values (inst lumi, lumiblock number, time, prescales, etc.) to screen - virtual void print() override {}; - - // main user function - // By default tries both "LumiBlocks" and "IncompleteLumiBlocks" - virtual StatusCode calcLumi() override; - - // retrieve the details of the calculation as a TTree table - virtual TTree * getLumiTree() override { return m_LumiTree; } - - /// register trigger - virtual - bool registerLBCollection(const TString& tname, const TString& regexpr, const std::list<TString>& trigpar) override; - -private: - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - StatusCode doDbQuery(StoreGateSvc_t sg); - void doRecordTree(bool b){m_recordTTree = b;} - void printTree(); - - - StoreGateSvc_t m_pMetaDataStore; - StoreGateSvc_t m_pInputStore; - - // StoreGateSvc* p_inputstore; // input metadata store - // StoreGateSvc* p_metadatastore; // metadata store - ITHistSvc * m_tHistSvc; - - // Configurable Properties - StringArrayProperty m_triggers; - StringArrayProperty m_lbcnames; - StringProperty m_sourcedb; - StringProperty m_parlumiestfolder; - StringProperty m_parlumilvl1folder; - StringProperty m_parlumihltfolder; - StringProperty m_parlvl1prescalesfolder; - StringProperty m_parlvl1menufolder; - StringProperty m_parhltmenufolder; - StringProperty m_UseLumiTag; - StringProperty m_UseLumiMethod; - int m_UseLumiChannel; - BooleanProperty m_UseMC; - BooleanProperty m_Online; - BooleanProperty m_Verbose; - BooleanProperty m_UseInputStore; - - // The Lumicalculator; - LumiCalculator * m_lumicalc; - - // A TTree to bookkeep the calculation - TTree * m_LumiTree; - bool m_recordTTree; - - // Bookkeep if file is partially read - bool m_fileCurrentlyOpened; - - // lbc trigger combo registry - std::map< TString, tvtPair > m_registry; -}; - - -#endif //> !ATHENAKERNEL_LUMICALCSVC_H - -#endif diff --git a/LumiBlock/LumiBlockComps/src/components/LumiBlockComps_entries.cxx b/LumiBlock/LumiBlockComps/src/components/LumiBlockComps_entries.cxx index 77ff68ff92db6d1aeaea96cf44484f36383e3991..c2f750eede8e9cd93bea44085bd8b7d93450977f 100644 --- a/LumiBlock/LumiBlockComps/src/components/LumiBlockComps_entries.cxx +++ b/LumiBlock/LumiBlockComps/src/components/LumiBlockComps_entries.cxx @@ -4,7 +4,6 @@ #ifndef XAOD_ANALYSIS //full-athena-only components #include "../LumiBlockMuTool.h" -#include "../LumiCalcSvc.h" #include "../LumiBlockTester.h" #include "../LBDurationCondAlg.h" #include "../LuminosityCondAlg.h" @@ -18,7 +17,6 @@ DECLARE_COMPONENT( CreateLumiBlockCollectionFromFile ) #ifndef XAOD_ANALYSIS DECLARE_COMPONENT( LumiBlockTester ) DECLARE_COMPONENT( LumiBlockMuTool ) -DECLARE_COMPONENT( LumiCalcSvc ) DECLARE_COMPONENT( LBDurationCondAlg ) DECLARE_COMPONENT( LuminosityCondAlg ) DECLARE_COMPONENT( BunchCrossingCondAlg ) @@ -28,6 +26,4 @@ DECLARE_COMPONENT(LumiBlockMuWriter) #endif DECLARE_COMPONENT( LumiBlockMetaDataTool ) -#include "../xAOD2NtupLumiSvc.h" -DECLARE_COMPONENT( xAOD2NtupLumiSvc ) diff --git a/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.cxx b/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.cxx deleted file mode 100644 index 6e628711404459478a1b773d4b3e5d130475a90f..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "xAOD2NtupLumiSvc.h" - -#include "GaudiKernel/ITHistSvc.h" - -#include "TKey.h" -#include "TTree.h" -#include "TFile.h" - -#include "xAODLuminosity/LumiBlockRangeContainer.h" -#include "xAODLuminosity/LumiBlockRangeAuxContainer.h" -#include "xAODRootAccess/TEvent.h" - -#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/IIncidentSvc.h" - -// Constructor -xAOD2NtupLumiSvc::xAOD2NtupLumiSvc(const std::string& name, ISvcLocator *svcLoc) : - AthService(name, svcLoc) -{ - -} - - - -StatusCode xAOD2NtupLumiSvc::initialize() { - - ServiceHandle<IIncidentSvc> isvc("IncidentSvc",name()); - isvc->addListener( this, "MetaDataStop", 0, true); - - return StatusCode::SUCCESS; - -} - -void xAOD2NtupLumiSvc::handle(const Incident& inc) { - if (inc.type() == "MetaDataStop") { - finish().ignore(); - } -} - -StatusCode xAOD2NtupLumiSvc::finish(){ - - ServiceHandle<StoreGateSvc> metastore("StoreGateSvc/MetaDataStore",name()); - - //see if we have any luminosity to propagate to ntuples - std::vector<std::string> keys; - metastore->keys<xAOD::LumiBlockRangeContainer>(keys); - //if there is no lumi, then we are done - if(!keys.size()) return StatusCode::SUCCESS; - - - - //use xAOD::RootAccess to create a metadata file - //put all lumiblock types into output so that hadd merging the ntuples is 'safe' - xAOD::TEvent evt; - TFile* outFile = new TFile("metadata.out.root","RECREATE"); - if(evt.writeTo( outFile ).isFailure()) return StatusCode::FAILURE; - std::vector<std::string> allKeys = {"LumiBlocks","IncompleteLumiBlocks","SuspectLumiBlocks"}; - for(auto& key : allKeys) { - bool foundKey(false);for(uint i=0;i<keys.size();i++) {if(keys[i]==key) {foundKey=true;break;}} - if(foundKey) { - auto lbs = metastore->retrieveUniquePrivateCopy<xAOD::LumiBlockRangeContainer>(key); //returns unique_ptr - auto lbsAux = metastore->retrieveUniquePrivateCopy<xAOD::LumiBlockRangeAuxContainer>(key+"Aux."); //returns unique_ptr - if( evt.recordMeta( lbs.release() , key ).isFailure() ) return StatusCode::FAILURE; //technically we wont need to store the interface container, but doesnt harm us - if( evt.recordMeta( lbsAux.release() , key+"Aux.").isFailure() ) return StatusCode::FAILURE; - } else { - //record a dummy interface and aux container - xAOD::LumiBlockRangeContainer* dummy = new xAOD::LumiBlockRangeContainer; - xAOD::LumiBlockRangeAuxContainer* dummyAux = new xAOD::LumiBlockRangeAuxContainer; - dummy->setStore(dummyAux); - if( evt.recordMeta( dummy , key).isFailure() ) return StatusCode::FAILURE; - if( evt.recordMeta( dummyAux , key+"Aux.").isFailure() ) return StatusCode::FAILURE; - } - } - - if( evt.finishWritingTo( outFile ).isFailure() ) return StatusCode::FAILURE; - - TTree* metatree = dynamic_cast<TTree*>(outFile->Get("MetaData"))->CloneTree(); - metatree->SetDirectory(0); - - //copy this MetaData tree to every output stream that contains a Tree - ServiceHandle<ITHistSvc> histSvc("THistSvc",name()); - std::vector<std::string> histsvcTrees = histSvc->getTrees(); - std::set<TString> doneStreams; - for(unsigned int i=0;i<histsvcTrees.size();i++) { - //strip the tree name (all after last /) - TString ss(histsvcTrees[i].c_str()); - int secondSlash = TString(ss(1,ss.Length())).First('/'); - TString ssPath = ss(0,secondSlash+1); - if(doneStreams.find(ssPath)!=doneStreams.end()) continue; - TString sss = ssPath;sss += "/MetaData"; - ATH_CHECK(histSvc->regTree(sss.Data(),metatree->CloneTree())); - doneStreams.insert(ssPath); - } - - outFile->Close(); - delete outFile; - //now delete the actual file - std::remove("metadata.out.root"); - - return StatusCode::SUCCESS; -} - diff --git a/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.h b/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.h deleted file mode 100644 index 750ad96c9ceae903397ec06ecf320d9f75801f8e..0000000000000000000000000000000000000000 --- a/LumiBlock/LumiBlockComps/src/xAOD2NtupLumiSvc.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __XAOD2NTUPLUMISVC__ -#define __XAOD2NTUPLUMISVC__ - -///Use this service to write out luminosity bookkeeping information -///to ntuples (managed by THistSvc) that can then be used with -///getLumi.exe to check luminosity covered -/// -///Usage ... only needed when running on data: -/// theApp.CreateSvc += ['xAOD2NtupLumiSvc'] -/// svcMgr.MetaDataSvc.MetaDataTools += [ "LumiBlockMetaDataTool" ] - - - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/IIncidentListener.h" - - - - -class xAOD2NtupLumiSvc : public AthService, - virtual public IIncidentListener { - -public: - xAOD2NtupLumiSvc(const std::string& name, ISvcLocator *svcLoc); - - virtual void handle(const Incident& inc); - - virtual StatusCode initialize(); - - StatusCode finish(); - - -}; - - -#endif - diff --git a/MagneticField/MagFieldConditions/CMakeLists.txt b/MagneticField/MagFieldConditions/CMakeLists.txt index 1a0c270a9d278cba049e4e26b37b0e4a888e5cbb..70586fd0b15e883e703c7c5e61aceb94c44b2176 100644 --- a/MagneticField/MagFieldConditions/CMakeLists.txt +++ b/MagneticField/MagFieldConditions/CMakeLists.txt @@ -8,7 +8,6 @@ atlas_subdir( MagFieldConditions ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/StoreGate - MagneticField/MagFieldInterfaces GaudiKernel PRIVATE MagneticField/MagFieldElements diff --git a/MagneticField/MagFieldElements/CMakeLists.txt b/MagneticField/MagFieldElements/CMakeLists.txt index 13dde183f9d9d9a5eb0842117929b9b3479e73f0..f556de2b9ab150f402a61bb52297c8190596a8c3 100644 --- a/MagneticField/MagFieldElements/CMakeLists.txt +++ b/MagneticField/MagFieldElements/CMakeLists.txt @@ -8,7 +8,6 @@ atlas_subdir( MagFieldElements ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps - MagneticField/MagFieldInterfaces Control/CxxUtils Event/EventPrimitives PRIVATE diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt index c6ecbab52ec16eb4adb9ddf70e2c4820880905b9..e360e754467a1c3536642fad3e1b372122635045 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt @@ -58,8 +58,4 @@ atlas_add_component( MuonCalibAlgs # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibEventBase/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibEventBase/CMakeLists.txt index 38504da97580f863133d1e92bc348bfa21f30a36..6acb3d14002fae572e7c4c3eb4406e28bd7e1c4c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibEventBase/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibEventBase/CMakeLists.txt @@ -21,5 +21,5 @@ atlas_add_library( MuonCalibEventBase src/*.cxx PUBLIC_HEADERS MuonCalibEventBase INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives MuonCalibIdentifier MuonRDO ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives MuonCalibIdentifier MuonRDO MuonCalibStl ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt index 0ff9c728305d059fb65e6bfa43aa2dd88968da5b..0f364468ef86a6970f2ca1af02506b32a0e8dc94 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt @@ -58,8 +58,4 @@ atlas_add_dictionary( CalibNtupleAnalysisAlgDict # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/NSWCalibTools/INSWCalibTool.h b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/NSWCalibTools/INSWCalibTool.h index e7ddd2c229b541acd69fc5f7293ead15949327af..b570ce5a58a2163ec45aedfebec19539d20cc843 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/NSWCalibTools/INSWCalibTool.h +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/NSWCalibTools/INSWCalibTool.h @@ -11,6 +11,9 @@ #include <cmath> #include <vector> +#include "TF1.h" + + static const InterfaceID IID_INSWCalibTool("Muon::INSWCalibTool",1,0); namespace NSWCalib { @@ -43,6 +46,7 @@ namespace Muon { virtual StatusCode calibrate(const Muon::MM_RawData* mmRawData, const Amg::Vector3D& globalPos, NSWCalib::CalibratedStrip& calibStrip) const = 0; + virtual StatusCode mmGasProperties(float &vDrift, float &longDiff, float &transDiff, float &interactionDensityMean, float &interactionDensitySigma, TF1* &lorentzAngleFunction) const = 0; }; } diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx index 9aea1734791b1989332b282544400556510ad0a9..69b1eb1176af2657ab54b6a245f8d59499a25e04 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx @@ -6,10 +6,33 @@ #include "GaudiKernel/SystemOfUnits.h" #include "GaudiKernel/PhysicalConstants.h" + namespace { static constexpr double const& toRad = M_PI/180; static constexpr double const& pitchErr = 0.425 * 0.425 / 12; static constexpr double const& reciprocalSpeedOfLight = 1. / Gaudi::Units::c_light; // mm/ns + + // since the final operation gas is not yet fixed different, different mixtures are added for studies + static const std::map<std::string, float> map_transDiff {{"ArCo2_937", 0.036}, + {"ArCo2_8020", 0.019}, {"ArCo2iC4H10_9352", 0.035}}; + static const std::map<std::string, float> map_longDiff {{"ArCo2_937", 0.019}, + {"ArCo2_8020", 0.022 }, {"ArCo2iC4H10_9352", 0.0195}}; + static const std::map<std::string, float> map_vDrift {{"ArCo2_937", 0.047}, + {"ArCo2_8020", 0.040}, {"ArCo2iC4H10_9352", 0.045}}; + + //Functional form fit to agree with Garfield simulations. Fit and parameters from G. Iakovidis + // For now only the parametrisation for 93:7 is available + static const std::map<std::string, std::vector<float>> map_lorentzAngleFunctionPars { + {"ArCo2_937", std::vector<float>{0, 58.87, -2.983, -10.62, 2.818}}, + {"ArCo2_8020", std::vector<float>{0, 58.87, -2.983, -10.62, 2.818}}, + {"ArCo2iC4H10_9352", std::vector<float>{0, 58.87, -2.983, -10.62, 2.818}}}; + + // For now only the parametrisation for 93:7 is available + static const std::map<std::string, float> map_interactionDensitySigma {{"ArCo2_937", 4.04 / 5.}, + {"ArCo2_8020", 4.04 / 5.}, {"ArCo2iC4H10_9352", 4.04 / 5.}}; + static const std::map<std::string, float> map_interactionDensityMean {{"ArCo2_937", 16.15 / 5.}, + {"ArCo2_8020", 16.15 / 5.}, {"ArCo2iC4H10_9352", 16.15 / 5.}}; + } Muon::NSWCalibTool::NSWCalibTool(const std::string& t, @@ -25,6 +48,7 @@ Muon::NSWCalibTool::NSWCalibTool(const std::string& t, declareProperty("transDiff",m_transDiff=0.036); //mm/mm declareProperty("ionUncertainty",m_ionUncertainty=4.0); //ns declareProperty("timeOffset", m_timeOffset = -100); //ns + declareProperty("GasMixture", m_gasMixture = "ArCo2_937"); } @@ -38,10 +62,28 @@ StatusCode Muon::NSWCalibTool::initialize() return StatusCode::FAILURE; } ATH_CHECK(m_fieldCondObjInputKey.initialize()); - m_lorentzAngleFunction = new TF1("lorentzAngleFunction","[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x",0,2); - m_lorentzAngleFunction->SetParameters(0,58.87, -2.983, -10.62, 2.818); + ATH_CHECK(initializeGasProperties()); return StatusCode::SUCCESS; +} + +StatusCode Muon::NSWCalibTool::initializeGasProperties() { + if (map_vDrift.count(m_gasMixture) == 0) { + ATH_MSG_FATAL("Configured Micromegas with unkown gas mixture: " << m_gasMixture); + return StatusCode::FAILURE; + } + m_vDrift = map_vDrift.find(m_gasMixture)->second; + m_transDiff = map_transDiff.find(m_gasMixture)->second; + m_longDiff = map_longDiff.find(m_gasMixture)->second; + m_interactionDensitySigma = map_interactionDensitySigma.find(m_gasMixture)->second; + m_interactionDensityMean = map_interactionDensityMean.find(m_gasMixture)->second; + + m_lorentzAngleFunction = new TF1("lorentzAngleFunction", "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x", 0, 2); + for (uint i_par = 0; i_par < map_lorentzAngleFunctionPars.find(m_gasMixture)->second.size(); i_par++) { + m_lorentzAngleFunction -> SetParameter(i_par, map_lorentzAngleFunctionPars.find(m_gasMixture)->second[i_par]); + } + + return StatusCode::SUCCESS; } StatusCode Muon::NSWCalibTool::calibrate( const Muon::MM_RawData* mmRawData, const Amg::Vector3D& globalPos, NSWCalib::CalibratedStrip& calibStrip) const @@ -98,3 +140,14 @@ StatusCode Muon::NSWCalibTool::finalize() m_lorentzAngleFunction->Delete(); return StatusCode::SUCCESS; } + + +StatusCode Muon::NSWCalibTool::mmGasProperties(float &vDrift, float &longDiff, float &transDiff, float &interactionDensityMean, float &interactionDensitySigma, TF1* &lorentzAngleFunction) const { + vDrift = m_vDrift; + longDiff = m_longDiff; + transDiff = m_transDiff; + interactionDensityMean = m_interactionDensityMean; + interactionDensitySigma = m_interactionDensitySigma; + lorentzAngleFunction = m_lorentzAngleFunction; + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h index c12c56d17b93e37cac7f008677defacf704483a5..6abecefb29e8e36b94c3d8a52b6c5aaffa571eb0 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.h @@ -4,6 +4,9 @@ #ifndef NSWCalibTool_h #define NSWCalibTool_h +#include <map> +#include <string> + #include "NSWCalibTools/INSWCalibTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -17,8 +20,6 @@ #include "TRandom3.h" #include "TTree.h" -#include "TF1.h" -#include <vector> namespace Muon { @@ -30,26 +31,33 @@ namespace Muon { virtual ~NSWCalibTool() = default; - StatusCode calibrate( const Muon::MM_RawData* mmRawData, const Amg::Vector3D& globalPos, NSWCalib::CalibratedStrip& calibStrip) const; + virtual StatusCode calibrate( const Muon::MM_RawData* mmRawData, const Amg::Vector3D& globalPos, NSWCalib::CalibratedStrip& calibStrip) const override; - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + StatusCode mmGasProperties(float &vDrift, float &longDiff, float &transDiff, float &interactionDensityMean, float &interactionDensitySigma, TF1* &lorentzAngleFunction) const override; private: ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; + StatusCode initializeGasProperties(); TF1* m_lorentzAngleFunction; - + float m_vDrift; float m_timeRes; float m_longDiff; float m_transDiff; + float m_interactionDensitySigma; + float m_interactionDensityMean; float m_ionUncertainty; double m_timeOffset; + + std::string m_gasMixture; }; - -} + + +} // namespace Muon #endif diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonByteStream/CMakeLists.txt index 56299daf69e7b9c3250b8b028f2e3905d74ce6d8..0a285740346c15db6ee7365ada8dc3c594263fd9 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/CMakeLists.txt @@ -37,7 +37,7 @@ atlas_add_component( MuonByteStream src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel StoreGateLib SGtests AthenaPoolUtilities CSCcablingLib RPCcablingInterfaceLib MuonIdHelpersLib MuonRDO TrigSteeringEvent AthViews) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel StoreGateLib SGtests AthenaPoolUtilities CSCcablingLib RPCcablingInterfaceLib MuonIdHelpersLib MuonRDO TrigSteeringEvent AthViews MuonMDT_CnvToolsLib MuonCSC_CnvToolsLib MuonRPC_CnvToolsLib MuonCnvToolInterfacesLib ) # Install files from the package: atlas_install_headers( MuonByteStream ) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/CscDigitToCscRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/CscDigitToCscRDO.h index 7915b56a20ffdfb9c199e34081a0d9b5d1728cf0..c3086871d849644c219d2998aee3979c5abaca0e 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/CscDigitToCscRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/CscDigitToCscRDO.h @@ -1,14 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONBYTESTREAMCNVTEST_CSCDIGITTOCSCRDO_H #define MUONBYTESTREAMCNVTEST_CSCDIGITTOCSCRDO_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthAlgorithm.h" - -class IMuonDigitizationTool; +#include "GaudiKernel/ToolHandle.h" +#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" // Author: Ketevi A. Assamagan // BNL, October 27, 2003 @@ -25,11 +24,10 @@ class CscDigitToCscRDO : public AthAlgorithm { public: CscDigitToCscRDO(const std::string& name, ISvcLocator* pSvcLocator); - ~CscDigitToCscRDO(); + ~CscDigitToCscRDO()=default; StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: ToolHandle<IMuonDigitizationTool> m_digTool{this}; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h index f2d841d8690d0fb13d8af6bbc088cf52d22f3d19..f931ddfdff0d56627bb5795971129820c2c67497 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h @@ -27,6 +27,10 @@ class MdtDigitToMdtRDO : public AthReentrantAlgorithm { private: StatusCode fill_MDTdata(const EventContext& ctx) const; + + // NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in + // release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the + // RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode fillTagInfo() const; protected: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigit.h index 2695a1de11a7e17f20a29b9f816b3b34146ea86d..ed6be35c27143c29caf65a4554fda716ddc34602 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigit.h @@ -1,25 +1,23 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONBYTESTREAMCNVTEST_MUONRDOTOMUONDIGIT_H #define MUONBYTESTREAMCNVTEST_MUONRDOTOMUONDIGIT_H -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthAlgorithm.h" - -class IMuonDigitizationTool; +#include "GaudiKernel/ToolHandle.h" +#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" class MuonRdoToMuonDigit : public AthAlgorithm { public: MuonRdoToMuonDigit(const std::string& name, ISvcLocator* pSvcLocator); - ~MuonRdoToMuonDigit(); + ~MuonRdoToMuonDigit()=default; StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h index 69794fbf48bf05fbe414c06809cff959cb877abc..2c413ae82cbe0f9ae7f916e6e1d40a0d59671f4d 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MuonRdoToMuonDigitTool.h @@ -25,6 +25,8 @@ #include "MuonSTGC_CnvTools/ISTGC_RDO_Decoder.h" #include "MuonMM_CnvTools/IMM_RDO_Decoder.h" #include "TGCcablingInterface/ITGCcablingSvc.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" class MdtDigitContainer; class CscDigitContainer; @@ -69,7 +71,7 @@ class MuonRdoToMuonDigitTool : virtual public IMuonDigitizationTool, public AthA ~MuonRdoToMuonDigitTool()=default; virtual StatusCode initialize() override; - virtual StatusCode digitize(const EventContext& ctx) override; + virtual StatusCode digitize(const EventContext& ctx) override; private: @@ -82,7 +84,7 @@ class MuonRdoToMuonDigitTool : virtual public IMuonDigitizationTool, public AthA StatusCode decodeCsc(CscDigitContainer*, const CscRawDataCollection *, CscDigitCollection*&, Identifier&); StatusCode decodeRpcRDO(const EventContext& ctx, RpcDigitContainer*); - StatusCode decodeRpc(RpcDigitContainer*, const RpcPad *, RpcDigitCollection*& ); + StatusCode decodeRpc(RpcDigitContainer*, const RpcPad *, RpcDigitCollection*&, const RpcCablingCondData* rpcCab); StatusCode decodeTgcRDO(const EventContext& ctx, TgcDigitContainer*); StatusCode decodeTgc(TgcDigitContainer*, const TgcRdo *, Identifier&); @@ -107,6 +109,7 @@ class MuonRdoToMuonDigitTool : virtual public IMuonDigitizationTool, public AthA ToolHandle<Muon::ISTGC_RDO_Decoder> m_stgcRdoDecoderTool; ToolHandle<Muon::IMM_RDO_Decoder> m_mmRdoDecoderTool; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + SG::ReadCondHandleKey<RpcCablingCondData> m_rpcReadKey{this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; // cabling service const ITGCcablingSvc* m_tgcCabling; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h index 9b681d39a7d605d5712da02588c05edb6647b9a2..6d11c6fef7491860cd7ffbf03cdca60d0019bc7a 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/RpcDigitToRpcRDO.h @@ -48,8 +48,13 @@ private: StatusCode fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData*) const; + // NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in + // release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the + // RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode fillTagInfo() const; + const MuonGM::MuonDetectorManager* m_MuonMgr; + IntegerProperty m_fast_debug{this, "FastDebug", 0, "bits for debugging 'fast' algos"}; IntegerProperty m_monitoring{this, "Monitoring", 0, "bits for monitoring sequence"}; @@ -82,8 +87,7 @@ private: SG::WriteHandleKey<RpcPadContainer> m_padContainerKey{this,"OutputObjectName","RPCPAD","WriteHandleKey for Output RpcPadContainer"}; SG::ReadHandleKey<RpcDigitContainer> m_digitContainerKey{this,"InputObjectName","RPC_DIGITS","ReadHandleKey for Input RpcDigitContainer"}; - const MuonGM::MuonDetectorManager* m_MuonMgr{}; - std::string m_cablingType{"MuonRPC_Cabling"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h index dfec6d1b64949e428d66442de7d7a22b1093b236..c0a292e2b28b742c90563c48117bca0f1c038096 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/TgcDigitToTgcRDO.h @@ -32,6 +32,9 @@ private: StatusCode getCabling(); + // NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in + // release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the + // RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode fillTagInfo() const; StatusCode fill_TGCdata(const EventContext& ctx) const; @@ -42,13 +45,13 @@ private: protected: ServiceHandle<ITGCcablingServerSvc> m_tgc_cabling_server; + const ITGCcablingSvc* m_cabling; SG::WriteHandleKey<TgcRdoContainer> m_rdoContainerKey{this,"OutputObjectName","TGCRDO","WriteHandleKey for Output TgcRdoContainer"}; SG::ReadHandleKey<TgcDigitContainer> m_digitContainerKey{this,"InputObjectName","TGC_DIGITS","ReadHandleKey for Input TgcDigitContainer"}; - const ITGCcablingSvc * m_cabling{}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - std::string m_cablingType; + std::string m_cablingType; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscDigitToCscRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscDigitToCscRDO.cxx index 84fd15d3a9ff469a2903369265b04163c9d0607a..1e4abb0aeb9a388fb29b6227b84697dc0147e965 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscDigitToCscRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/CscDigitToCscRDO.cxx @@ -1,43 +1,25 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Author: Ketevi A. Assamagan - -#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" - #include "MuonByteStreamCnvTest/CscDigitToCscRDO.h" -CscDigitToCscRDO::CscDigitToCscRDO(const std::string& name, - ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), +CscDigitToCscRDO::CscDigitToCscRDO(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator), m_digTool("CscDigitToCscRDOTool", this ) { declareProperty("CscDigitToRDOTool", m_digTool); } -CscDigitToCscRDO::~CscDigitToCscRDO() { - -} - StatusCode CscDigitToCscRDO::initialize() { - ATH_CHECK( m_digTool.retrieve() ); - ATH_MSG_DEBUG( "Retrieved CSC Digit -> RDO Tool." ); + ATH_CHECK(m_digTool.retrieve()); + ATH_MSG_DEBUG("Retrieved CSC Digit -> RDO Tool."); return StatusCode::SUCCESS; } StatusCode CscDigitToCscRDO::execute() { - ATH_MSG_DEBUG( "in execute()" ); + ATH_MSG_DEBUG("in execute()"); return m_digTool->digitize(Gaudi::Hive::currentContext()); } - -StatusCode CscDigitToCscRDO::finalize() -{ - ATH_MSG_DEBUG( "finalize." ); - return StatusCode::SUCCESS; -} - - - diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx index 041e9d83422e5968b6f72d14be5ae3e46f60f72d..2e69f7421a4a86d179d64c11f39cb1c56a69cce3 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx @@ -259,6 +259,9 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata(const EventContext& ctx) const { } +// NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in +// release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the +// RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode MdtDigitToMdtRDO::fillTagInfo() const { ServiceHandle<ITagInfoMgr> tagInfoMgr ("TagInfoMgr", name()); @@ -266,7 +269,7 @@ StatusCode MdtDigitToMdtRDO::fillTagInfo() const { return StatusCode::FAILURE; } - std::string cablingType="NewMDT_Cabling"; + std::string cablingType="NewMDT_Cabling"; // everything starting from Run2 should be 'New' StatusCode sc = tagInfoMgr->addTag("MDT_CablingType",cablingType); if(sc.isFailure()) { diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigit.cxx index 6ef2bff255f6fa915e045e1073ae2350483fc9e5..118bcd03c920f94c6c2fd353d661124d3527ce3c 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigit.cxx @@ -1,9 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonByteStreamCnvTest/MuonRdoToMuonDigit.h" -#include "MuonDigToolInterfaces/IMuonDigitizationTool.h" MuonRdoToMuonDigit::MuonRdoToMuonDigit(const std::string& name, ISvcLocator* pSvcLocator) @@ -13,10 +12,6 @@ MuonRdoToMuonDigit::MuonRdoToMuonDigit(const std::string& name, declareProperty("MuonRdoToMuonDigitTool", m_digTool); } -MuonRdoToMuonDigit::~MuonRdoToMuonDigit() { - -} - StatusCode MuonRdoToMuonDigit::initialize() { ATH_CHECK( m_digTool.retrieve() ); @@ -29,11 +24,3 @@ StatusCode MuonRdoToMuonDigit::execute() return m_digTool->digitize(Gaudi::Hive::currentContext()); } - -StatusCode MuonRdoToMuonDigit::finalize() -{ - ATH_MSG_DEBUG( "finalize." ); - return StatusCode::SUCCESS; -} - - diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx index 65143011d46b250f79a0d972391601c6833e1395..1eebe131cce08ee7570d134116be938887302b17 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MuonRdoToMuonDigitTool.cxx @@ -124,6 +124,8 @@ StatusCode MuonRdoToMuonDigitTool::initialize() { if (m_decodesTgcRDO) ATH_CHECK( m_stgcRdoDecoderTool.retrieve() ); if (m_decodeMmRDO) ATH_CHECK( m_mmRdoDecoderTool.retrieve() ); + ATH_CHECK(m_rpcReadKey.initialize()); + return StatusCode::SUCCESS; } @@ -251,11 +253,14 @@ StatusCode MuonRdoToMuonDigitTool::decodeRpcRDO(const EventContext& ctx, RpcDigi ATH_MSG_DEBUG( "Retrieved " << rdoContainer->size() << " RPC RDOs." ); // now decode RDO into digits RpcPadContainer::const_iterator rpcPAD = rdoContainer->begin(); - + + SG::ReadCondHandle<RpcCablingCondData> cablingCondData{m_rpcReadKey, ctx}; + const RpcCablingCondData* rpcCabling{*cablingCondData}; + for (; rpcPAD!=rdoContainer->end();++rpcPAD) { if ( !(*rpcPAD)->empty() ) { - StatusCode status = this->decodeRpc (rpcContainer, *rpcPAD, collection ); + StatusCode status = this->decodeRpc(rpcContainer, *rpcPAD, collection, rpcCabling); if ( status.isFailure() ) return status; } } @@ -509,7 +514,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeCsc(CscDigitContainer* cscContainer, co return StatusCode::SUCCESS; } -StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, const RpcPad * rdoColl, RpcDigitCollection*& collection ) { +StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, const RpcPad * rdoColl, RpcDigitCollection*& collection, const RpcCablingCondData* rpcCab) { IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); @@ -546,7 +551,7 @@ StatusCode MuonRdoToMuonDigitTool::decodeRpc(RpcDigitContainer* rpcContainer, co const RpcFiredChannel * rpcChan = (*itD); std::vector<RpcDigit*>* digitVec = - m_rpcRdoDecoderTool->getDigit(rpcChan, sectorId, padId, cmaId); + m_rpcRdoDecoderTool->getDigit(rpcChan, sectorId, padId, cmaId, rpcCab); if (digitVec==NULL) { ATH_MSG_FATAL( "Error in the RPC RDO decoder " ); diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx index a7d92cd55ea7cb1dbdb729b4baa31c2daebc1938..c31aba97f64c43be1d3fb6d97fae4b99b2482dda 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcDigitToRpcRDO.cxx @@ -23,14 +23,15 @@ static double time_correction(double, double, double); namespace { static constexpr unsigned int const& rpcRawHitWordLength = 7; - static constexpr double const& inverseSpeedOfLight = 1e6 / Gaudi::Units::c_light; // Gaudi::Units::c_light=2.99792458e+8, but need 299.792458 + static constexpr double const& inverseSpeedOfLight = 1 / Gaudi::Units::c_light; // need 1/299.792458 } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// RpcDigitToRpcRDO::RpcDigitToRpcRDO(const std::string& name, ISvcLocator* pSvcLocator) : - AthReentrantAlgorithm(name, pSvcLocator) + AthReentrantAlgorithm(name, pSvcLocator), + m_MuonMgr(nullptr) { } @@ -46,10 +47,6 @@ StatusCode RpcDigitToRpcRDO::initialize() ATH_CHECK(detStore()->retrieve(m_MuonMgr)); ATH_CHECK(m_cabling.retrieve()) ; - if (m_cabling->rpcCabSvcType() == "simLike_MapsFromFiles" || m_cabling->rpcCabSvcType() == "dataLike") m_cablingType="MuonRPC_Cabling"; - else if (m_cabling->rpcCabSvcType() == "simulationLike") m_cablingType="RPCcablingSim"; - else if (m_cabling->rpcCabSvcType() == "simulationLikeInitialization" ) m_cablingType="RPCcabling"; - else ATH_MSG_WARNING( "Unknown cabling type: rpcCabSvcType()="<< m_cabling->rpcCabSvcType() ); ATH_CHECK(m_readKey.initialize()); @@ -152,7 +149,7 @@ StatusCode RpcDigitToRpcRDO::execute(const EventContext& ctx) const { return StatusCode::SUCCESS; } -StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData* /*readCdo*/) const { +StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& ctx, const RpcCablingCondData* readCdo) const { std::string space = " "; @@ -197,7 +194,7 @@ StatusCode RpcDigitToRpcRDO::fill_RPCdata(RPCsimuData& data, const EventContext& Amg::Vector3D pos = descriptor->stripPos(channelId); // get now strip_code from cablingSvc - unsigned long int strip_code_cab = m_cabling->strip_code_fromOffId (StationName, StationEta, StationPhi, + unsigned long int strip_code_cab = readCdo->strip_code_fromOffId (StationName, StationEta, StationPhi, DoubletR, DoubletZ, DoubletP, GasGap, MeasuresPhi, Strip); @@ -236,21 +233,21 @@ double time_correction(double x, double y, double z) return std::sqrt(x*x+y*y+z*z)*inverseSpeedOfLight; } - +// NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in +// release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the +// RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode RpcDigitToRpcRDO::fillTagInfo() const { ServiceHandle<ITagInfoMgr> tagInfoMgr ("TagInfoMgr", name()); ATH_CHECK(tagInfoMgr.retrieve()); - StatusCode sc = tagInfoMgr->addTag("RPC_CablingType",m_cablingType); - + std::string cablingType="MuonRPC_Cabling"; + StatusCode sc = tagInfoMgr->addTag("RPC_CablingType",cablingType); if(sc.isFailure()) { - ATH_MSG_WARNING( "RPC_CablingType " << m_cablingType - << " not added to TagInfo " ); + ATH_MSG_WARNING( "RPC_CablingType " << cablingType << " not added to TagInfo " ); return sc; } else { - ATH_MSG_DEBUG( "RPC_CablingType " << m_cablingType - << " is Added TagInfo " ); + ATH_MSG_DEBUG( "RPC_CablingType " << cablingType << " is Added TagInfo " ); } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx index f6cf5f9e71138e2957e1b050bb37a3db4b4e14a5..e94672280c4cdc01200021d2dd66e45fb9617061 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.cxx @@ -12,7 +12,7 @@ RpcRdoToRpcDigit::RpcRdoToRpcDigit(const std::string& name, StatusCode RpcRdoToRpcDigit::initialize() { - ATH_CHECK( m_idHelperSvc.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); // get RPC cabling ATH_CHECK(m_rpcCablingServerSvc.retrieve()); @@ -23,6 +23,8 @@ StatusCode RpcRdoToRpcDigit::initialize() ATH_CHECK( m_rpcRdoDecoderTool.retrieve() ); + ATH_CHECK(m_rpcReadKey.initialize()); + return StatusCode::SUCCESS; } @@ -47,16 +49,19 @@ StatusCode RpcRdoToRpcDigit::execute(const EventContext& ctx) const // now decode RDO into digits RpcPadContainer::const_iterator rpcPAD = rdoContainer->begin(); + SG::ReadCondHandle<RpcCablingCondData> cablingCondData{m_rpcReadKey, ctx}; + const RpcCablingCondData* rpcCabling{*cablingCondData}; + for (; rpcPAD!=rdoContainer->end();++rpcPAD) { if ( (*rpcPAD)->size() > 0 ) { - ATH_CHECK(this->decodeRpc ( *rpcPAD, wh_rpcDigit.ptr(), collection )); + ATH_CHECK(this->decodeRpc(*rpcPAD, wh_rpcDigit.ptr(), collection, rpcCabling)); } } return StatusCode::SUCCESS; } -StatusCode RpcRdoToRpcDigit::decodeRpc( const RpcPad * rdoColl, RpcDigitContainer *rpcContainer, RpcDigitCollection*& collection ) const +StatusCode RpcRdoToRpcDigit::decodeRpc(const RpcPad * rdoColl, RpcDigitContainer *rpcContainer, RpcDigitCollection*& collection, const RpcCablingCondData* rpcCab) const { const IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); @@ -86,7 +91,7 @@ StatusCode RpcRdoToRpcDigit::decodeRpc( const RpcPad * rdoColl, RpcDigitContaine // For each CM, loop on the fired channels for (const RpcFiredChannel * rpcChan : *coinMatrix) { const std::vector<RpcDigit*>* digitVec = - m_rpcRdoDecoderTool->getDigit(rpcChan, sectorId, padId, cmaId); + m_rpcRdoDecoderTool->getDigit(rpcChan, sectorId, padId, cmaId, rpcCab); if (!digitVec) { ATH_MSG_FATAL( "Error in the RPC RDO decoder " ); diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h index d53c9ff812417ddd785c876be47675823aa3ee3c..896ffd8657114766bcb2a9414943cde86e70eef2 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/RpcRdoToRpcDigit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONBYTESTREAMCNVTEST_RPCRDOTORPCDIGIT_H @@ -12,6 +12,8 @@ #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" #include "MuonRDO/RpcPadContainer.h" #include "MuonDigitContainer/RpcDigitContainer.h" +#include "RPC_CondCabling/RpcCablingCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "RPCcablingInterface/IRPCcablingServerSvc.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" @@ -26,13 +28,14 @@ class RpcRdoToRpcDigit : public AthReentrantAlgorithm { virtual StatusCode execute(const EventContext& ctx) const override final; private: - StatusCode decodeRpc( const RpcPad *, RpcDigitContainer *, RpcDigitCollection*& ) const; + StatusCode decodeRpc(const RpcPad *, RpcDigitContainer *, RpcDigitCollection*&, const RpcCablingCondData* rpcCab) const; ToolHandle<Muon::IRPC_RDO_Decoder> m_rpcRdoDecoderTool{this,"rpcRdoDecoderTool","Muon::RpcRDO_Decoder",""}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<IRPCcablingServerSvc> m_rpcCablingServerSvc{this, "RPCcablingServerSvc", "RPCcablingServerSvc", ""}; const IRPCcablingSvc * m_rpcCabling{}; SG::ReadHandleKey<RpcPadContainer> m_rpcRdoKey{this, "RpcRdoContainer", "RPCPAD", "Rpc RDO Input"}; SG::WriteHandleKey<RpcDigitContainer> m_rpcDigitKey{this, "RpcDigitContainer", "RPC_DIGITS", "Rpc Digit Output"}; + SG::ReadCondHandleKey<RpcCablingCondData> m_rpcReadKey{this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx index 97302353c4d27cb648a66f09d444bf2d9ce92af0..42421fa862f8a783c12de42c37baeadf4fa8b2f8 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/TgcDigitToTgcRDO.cxx @@ -18,9 +18,10 @@ ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -TgcDigitToTgcRDO::TgcDigitToTgcRDO(const std::string& name, ISvcLocator* pSvcLocator) - : AthReentrantAlgorithm(name, pSvcLocator), - m_tgc_cabling_server("TGCcablingServerSvc", name) +TgcDigitToTgcRDO::TgcDigitToTgcRDO(const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator), + m_tgc_cabling_server("TGCcablingServerSvc", name), + m_cabling(nullptr) { declareProperty ( "isNewTgcDigit", m_isNewTgcDigit = true ); } @@ -220,6 +221,9 @@ TgcRdo * TgcDigitToTgcRDO::getTgcRdo(const TgcRawData * rawData, std::map<uint1 return rdo; } +// NOTE: although this function has no clients in release 22, currently the Run2 trigger simulation is still run in +// release 21 on RDOs produced in release 22. Since release 21 accesses the TagInfo, it needs to be written to the +// RDOs produced in release 22. The fillTagInfo() function thus needs to stay in release 22 until the workflow changes StatusCode TgcDigitToTgcRDO::fillTagInfo() const { ServiceHandle<ITagInfoMgr> tagInfoMgr ("TagInfoMgr", name()); @@ -242,7 +246,6 @@ StatusCode TgcDigitToTgcRDO::fillTagInfo() const StatusCode TgcDigitToTgcRDO::getCabling() { - m_cabling = nullptr; ATH_CHECK( m_tgc_cabling_server->giveCabling(m_cabling) ); int maxRodId,maxSswId, maxSbloc,minChannelId, maxChannelId; diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt index cd0e03a55a7b06935b0c4199d6c4b586e3fa63ce..d8673e394020b71f830455754ce40c23c7c13bf4 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt @@ -73,7 +73,7 @@ find_package( AthenaPoolUtilitiesTest ) if( ATHENAPOOLUTILITIESTEST_FOUND ) set( MUONEVENTATHENAPOOL_REFERENCE_TAG - MuonEventAthenaPoolReference-03-00-00 ) + MuonEventAthenaPoolReference-03-01-00 ) run_tpcnv_legacy_test( MuonEventTPCnv_17.0.0 ESD-17.0.0 REFERENCE_TAG ${MUONEVENTATHENAPOOL_REFERENCE_TAG} ) run_tpcnv_legacy_test( MuonEventTPCnv_20.1.7.2 ESD-20.1.7.2 diff --git a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/CMakeLists.txt index 7b031abffb1d13b18d1958e0f64cedbf12c6537f..798927efa842b85619c5257360c5f2ea7968bafa 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/CMakeLists.txt @@ -26,7 +26,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( MuonEventCnvTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests Identifier EventPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack TrkDetElementBase TrkPrepRawData TrkRIO_OnTrack ) + LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests Identifier EventPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack TrkDetElementBase TrkPrepRawData TrkRIO_OnTrack TrkEventCnvToolsLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx index ba57a538aa0cb8937797437f434a755e54fe861e..87112ea879f68dbd25b985ae712939d22388561f 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx @@ -39,10 +39,9 @@ Muon::MuonEventCnvTool::MuonEventCnvTool( const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), + base_class(t,n,p), m_muonMgr(nullptr) { - declareInterface<ITrkEventCnvTool>(this); } StatusCode Muon::MuonEventCnvTool::initialize() @@ -162,6 +161,44 @@ void Muon::MuonEventCnvTool::prepareRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const { return; } +void +Muon::MuonEventCnvTool::prepareRIO_OnTrackLink( const Trk::RIO_OnTrack *RoT, + ELKey_t& key, + ELIndex_t& index) const +{ + const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(RoT); + if (mdt){ + prepareRIO_OnTrackElementLink<const Muon::MdtPrepDataContainer, Muon::MdtDriftCircleOnTrack>(mdt, key, index); + return; + } + const Muon::CscClusterOnTrack* csc = dynamic_cast<const Muon::CscClusterOnTrack*>(RoT); + if (csc){ + prepareRIO_OnTrackElementLink<const Muon::CscPrepDataContainer, Muon::CscClusterOnTrack>(csc, key, index); + return; + } + const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(RoT); + if (rpc){ + prepareRIO_OnTrackElementLink<const Muon::RpcPrepDataContainer, Muon::RpcClusterOnTrack>(rpc, key, index); + return; + } + const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack*>(RoT); + if (tgc){ + prepareRIO_OnTrackElementLink<const Muon::TgcPrepDataContainer, Muon::TgcClusterOnTrack>(tgc, key, index); + return; + } + const Muon::sTgcClusterOnTrack* stgc = dynamic_cast<const Muon::sTgcClusterOnTrack*>(RoT); + if (stgc){ + prepareRIO_OnTrackElementLink<const Muon::sTgcPrepDataContainer, Muon::sTgcClusterOnTrack>(stgc, key, index); + return; + } + const Muon::MMClusterOnTrack* mm = dynamic_cast<const Muon::MMClusterOnTrack*>(RoT); + if (mm){ + prepareRIO_OnTrackElementLink<const Muon::MMPrepDataContainer, Muon::MMClusterOnTrack>(mm, key, index); + return; + } + return; +} + void Muon::MuonEventCnvTool::recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const { std::pair<const Trk::TrkDetElementBase *, const Trk::PrepRawData *> pair = getLinks( *RoT ); diff --git a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h index 30e9db72e4fac39ce8dc0ec7c757b0c2dc8211ac..24e23e02791735f96feac4f09e6a330f59bf528e 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h +++ b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h @@ -33,7 +33,8 @@ namespace Muon { class MuonIdHelperSvc; /**Tool used in the persisency convertors to help rebuild EDM objects*/ - class MuonEventCnvTool : virtual public Trk::ITrkEventCnvTool, public AthAlgTool { + class MuonEventCnvTool : public extends<AthAlgTool, Trk::ITrkEventCnvTool> + { public: enum MuonConcreteType { MDT, RPC, CSC, TGC, MM, STGC, TypeUnknown }; @@ -51,7 +52,13 @@ namespace Muon { /** @copydoc Trk::ITrkEventCnvTool::prepareRIO_OnTrack( Trk::RIO_OnTrack* rot)*/ virtual void prepareRIO_OnTrack( Trk::RIO_OnTrack* rot) const override; - /** Take the passed RoT and recreate it (i.e. fill missing pointers etc)*/ + /** Similar, but just return the EL components rather then + changing ROT. */ + virtual void prepareRIO_OnTrackLink( const Trk::RIO_OnTrack* rot, + ELKey_t& key, + ELIndex_t& index ) const override; + + /** Take the passed RoT and recreate it (i.e. fill missing pointers etc)*/ virtual void recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const override; /** Return the detectorElement associated with this Identifier*/ diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h index adf9374cd63948d4f981f0b0b40cda73303a9cee..949baf576782120bcab8f9c8b58a9e38785adbfe 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MM__CLUSTER_ON_TRACK_P1_TRK_H @@ -10,10 +10,10 @@ // file: MM_ClusterOnTrack_p1.h // //----------------------------------------------------------------------------- +#include <vector> + #include "AthenaPoolUtilities/TPObjRef.h" #include "DataModelAthenaPool/ElementLink_p3.h" - - namespace Muon { /** Version 1 of the persistent class representing the transient class Muon::MM_ClusterOnTrack */ @@ -32,6 +32,9 @@ namespace Muon /** position along strip (double in transient world)*/ float m_positionAlongStrip; + std::vector<float> m_stripDriftDists; + std::vector<float> m_stripDriftDistErrors_0_0; + std::vector<float> m_stripDriftDistErrors_1_1; }; } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/CscClusterOnTrackCnv_p2.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/CscClusterOnTrackCnv_p2.cxx index 86449e1b17f1de027d2d8547aa45353e57847e00..da79dc3b1c1b56e02ffd89c7471d318b0ad36158 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/CscClusterOnTrackCnv_p2.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/CscClusterOnTrackCnv_p2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -38,7 +38,7 @@ persToTrans( const Muon::CscClusterOnTrack_p2 *persObj, static_cast<Muon::CscTimeStatus>((persObj->m_status)>>8), persObj->m_time); - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::CscClusterOnTrack *>(transObj)); + m_eventCnvTool->recreateRIO_OnTrack(transObj); if (transObj->detectorElement()==0) log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " << "probably because of a problem with the Identifier/IdentifierHash : (" @@ -51,8 +51,11 @@ transToPers( const Muon::CscClusterOnTrack *transObj, Muon::CscClusterOnTrack_p2 *persObj, MsgStream &log ) { // Prepare ELs - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::CscClusterOnTrack *>(transObj)); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_CSC_Container eltmp (key, index); + m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log); persObj->m_id = transObj->identify().get_identifier32().get_compact(); persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.cxx index c04b6e3dde07b4da4abe823e191c4dbc3b976156..c6e7b752ae2e394a2c5305397c3a8bd3e916a2aa 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -26,17 +26,29 @@ persToTrans( const Muon::MM_ClusterOnTrack_p1 *persObj, Amg::MatrixX localCovariance; fillTransFromPStore( &m_errorMxCnv, persObj->m_localErrMat, &dummy, log ); EigenHelpers::vectorToEigenMatrix(dummy.values, localCovariance, "RIO_OnTrackCnv_p2"); - + + std::vector<Amg::MatrixX> stripDriftDistErrors; + stripDriftDistErrors.reserve(persObj->m_stripDriftDistErrors_0_0.size()); + for(uint i_strip = 0; i_strip < persObj->m_stripDriftDistErrors_0_0.size(); i_strip++) { + Amg::MatrixX tmp(2, 2); + tmp(0, 0) = persObj->m_stripDriftDistErrors_0_0.at(i_strip); + tmp(1, 1) = persObj->m_stripDriftDistErrors_1_1.at(i_strip); + stripDriftDistErrors.push_back(tmp); + } + + *transObj = Muon::MMClusterOnTrack (rio, localParams, localCovariance, Identifier (persObj->m_id), nullptr, - persObj->m_positionAlongStrip + persObj->m_positionAlongStrip, + persObj->m_stripDriftDists, + stripDriftDistErrors ); // Attempt to call supertool to fill in detElements - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::MMClusterOnTrack *>(transObj)); + m_eventCnvTool->recreateRIO_OnTrack(transObj); if (transObj->detectorElement()==0) log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " << "probably because of a problem with the Identifier/IdentifierHash : (" @@ -51,15 +63,29 @@ transToPers( const Muon::MMClusterOnTrack *transObj, // Prepare ELs // std::cout<<"BLAH! MM_ClusterOnTrackCnv_p1::transToPers"<<std::endl; - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::MMClusterOnTrack *>(transObj)); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_MM_Container eltmp (key, index); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log); persObj->m_positionAlongStrip = transObj->positionAlongStrip(); + persObj->m_stripDriftDists = transObj->stripDriftDists(); + + persObj->m_stripDriftDistErrors_0_0.reserve(transObj->stripDriftDistErrors().size()); + persObj->m_stripDriftDistErrors_1_1.reserve(transObj->stripDriftDistErrors().size()); + + for(uint i_strip = 0; i_strip < transObj->stripDriftDistErrors().size(); i_strip++){ + persObj->m_stripDriftDistErrors_0_0.push_back(transObj->stripDriftDistErrors().at(i_strip)(0,0)); + persObj->m_stripDriftDistErrors_1_1.push_back(transObj->stripDriftDistErrors().at(i_strip)(1,1)); + } + persObj->m_id = transObj->identify().get_identifier32().get_compact(); persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log ); Trk::ErrorMatrix pMat; EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "CscClusterOnTrackCnv_p2"); persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log ); + } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.cxx index e6e17e17aef3bd6c4390b3c1b69b809bbc6ecf98..6766fde514aace5c5f06b0d5711a8554b168c477 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -59,8 +59,11 @@ transToPers( const Muon::MdtDriftCircleOnTrack *transObj, Muon::MdtDriftCircleOnTrack_p2 *persObj, MsgStream &log) { // Prepare ELs - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::MdtDriftCircleOnTrack *>(transObj)); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_MDT_Container eltmp (key, index); + m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log); persObj->m_id = transObj->identify().get_identifier32().get_compact(); persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/RpcClusterOnTrackCnv_p3.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/RpcClusterOnTrackCnv_p3.cxx index 2309ae8ff21edcf5c929c6e731a7a072b336c91e..47f2d376a203e6231a4cb8302f86ec14af212e19 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/RpcClusterOnTrackCnv_p3.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/RpcClusterOnTrackCnv_p3.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -38,7 +38,7 @@ persToTrans( const Muon::RpcClusterOnTrack_p3 *persObj, ); // Attempt to call supertool to fill in detElements - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::RpcClusterOnTrack *>(transObj)); + m_eventCnvTool->recreateRIO_OnTrack(transObj); if (transObj->detectorElement()==0) log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " << "probably because of a problem with the Identifier/IdentifierHash : (" @@ -51,9 +51,12 @@ transToPers( const Muon::RpcClusterOnTrack *transObj, Muon::RpcClusterOnTrack_p3 *persObj, MsgStream &log ) { // Prepare ELs - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::RpcClusterOnTrack *>(transObj)); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_RPC_Container eltmp (key, index); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + m_elCnv.transToPers(&eltmp,&persObj->m_prdLink,log); persObj->m_positionAlongStrip = transObj->positionAlongStrip(); persObj->m_time = transObj->time(); persObj->m_id = transObj->identify().get_identifier32().get_compact(); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.cxx index 21423ab6a225ccb59cf994e944a3cbf28bc7a66c..04fa3ceb5b861c468bc0418fa3ae085e756c52c4 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -28,7 +28,7 @@ persToTrans( const Muon::STGC_ClusterOnTrack_p1 *persObj, transObj->m_positionAlongStrip = persObj->m_positionAlongStrip; // Attempt to call supertool to fill in detElements - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::sTgcClusterOnTrack *>(transObj)); + m_eventCnvTool->recreateRIO_OnTrack(transObj); if (transObj->detectorElement()==0) log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " << "probably because of a problem with the Identifier/IdentifierHash : (" @@ -45,25 +45,18 @@ transToPers( const Muon::sTgcClusterOnTrack *transObj, // << transObj->identify()<<"/"<<transObj->idDE()<<endmsg; // Prepare ELs - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::sTgcClusterOnTrack *>(transObj)); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_STGC_Container eltmp (key, index); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log); persObj->m_positionAlongStrip = transObj->positionAlongStrip(); persObj->m_id = transObj->identify().get_identifier32().get_compact(); persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log ); Trk::ErrorMatrix pMat; EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "STGC_ClusterOnTrackCnv_p1"); persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log ); - - // Extra check. - // Attempt to call supertool to fill in detElements - Muon::sTgcClusterOnTrack * nonconst = const_cast<Muon::sTgcClusterOnTrack *>(transObj); - nonconst->m_detEl=0; - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::sTgcClusterOnTrack *>(nonconst)); - if (nonconst->detectorElement()==0) - log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " - << "probably because of a problem with the Identifier/IdentifierHash : (" - << nonconst->identify()<<"/"<<nonconst->idDE()<<")"<<endmsg; } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/TgcClusterOnTrackCnv_p2.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/TgcClusterOnTrackCnv_p2.cxx index 2e70c80ed9d6bff88dab720150f0312527d8b2ef..a352e956f040ec4884f3191ecc32782d1c942f48 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/TgcClusterOnTrackCnv_p2.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonRIO_OnTrack/TgcClusterOnTrackCnv_p2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -36,7 +36,7 @@ persToTrans( const Muon::TgcClusterOnTrack_p2 *persObj, persObj->m_positionAlongStrip); // Attempt to call supertool to fill in detElements - m_eventCnvTool->recreateRIO_OnTrack(const_cast<Muon::TgcClusterOnTrack *>(transObj)); + m_eventCnvTool->recreateRIO_OnTrack(transObj); if (transObj->detectorElement()==0) log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, " << "probably because of a problem with the Identifier/IdentifierHash : (" @@ -49,9 +49,12 @@ transToPers( const Muon::TgcClusterOnTrack *transObj, Muon::TgcClusterOnTrack_p2 *persObj, MsgStream &log ) { // Prepare ELs - m_eventCnvTool->prepareRIO_OnTrack(const_cast<Muon::TgcClusterOnTrack *>(transObj)); + Trk::IEventCnvSuperTool::ELKey_t key; + Trk::IEventCnvSuperTool::ELIndex_t index; + m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index); + ElementLinkToIDC_TGC_Container eltmp (key, index); - m_elCnv.transToPers(&transObj->prepRawDataLink(),&persObj->m_prdLink,log); + m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log); persObj->m_positionAlongStrip = transObj->positionAlongStrip(); persObj->m_id = transObj->identify().get_identifier32().get_compact(); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonSegment/MuonSegmentCnv_p2.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonSegment/MuonSegmentCnv_p2.cxx index 97963c8f5b465655daf3648c49422ea2be163472..84877ba871b3a665953d56f9f6b26a24fac82418 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonSegment/MuonSegmentCnv_p2.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonSegment/MuonSegmentCnv_p2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -41,10 +41,6 @@ void MuonSegmentCnv_p2::transToPers( const Muon::MuonSegment *transObj, Muon::Mu persObj->m_segment = baseToPersistent( &m_segmentCnv, transObj, log ); m_localDirCnv.transToPers(&transObj->localDirection(),&persObj->m_localDirection,log); - //if (transObj->m_localDirection!=0) - // m_localDirCnv.transToPers(&persObj->m_localDirection,const_cast<Trk::LocalDirection*>(transObj->m_localDirection),log); - //else - // log<<MSG::WARNING<<"MuonSegment is apparently missing a LocalDirection. Dumping:"<<*transObj<<endmsg; m_surfCnv=0; if (transObj->associatedSurface().isFree() ) // if this is a free surface, write it out 'as is' persObj->m_associatedSurface = toPersistent(&m_surfCnv, &transObj->associatedSurface(), log); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscClusterOnTrackCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscClusterOnTrackCnv_p2_test.cxx index 34cf5ee62a8dc1c49727ca88ae036a8077a2c186..26604644ee58a5bb85674f3d27673259d6fc93f4 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscClusterOnTrackCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/CscClusterOnTrackCnv_p2_test.cxx @@ -93,9 +93,9 @@ void compare (const Muon::CscClusterOnTrack& p1, assert (p2.time() == p2.time()); assert (p1.status() == p2.status()); assert (p1.timeStatus() == p2.timeStatus()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 682318842); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); - } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MM_ClusterOnTrackCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MM_ClusterOnTrackCnv_p1_test.cxx index 7859470415f88b9c07f2a41b0f0ddd68b7e77016..880ea808d12d72aa2f5c53f482b7dc95d3898c9d 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MM_ClusterOnTrackCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MM_ClusterOnTrackCnv_p1_test.cxx @@ -92,9 +92,9 @@ void compare (const Muon::MMClusterOnTrack& p1, compare (static_cast<const Muon::MuonClusterOnTrack&>(p1), static_cast<const Muon::MuonClusterOnTrack&>(p2)); assert (p1.detectorElement() == p2.detectorElement()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 480457663); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); - } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MdtDriftCircleOnTrackCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MdtDriftCircleOnTrackCnv_p2_test.cxx index ac26b1590274107161de777dab69ff7e3e7a5d34..68e8cfa48d76c350e070d6efcf0a473275b9313d 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MdtDriftCircleOnTrackCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/MdtDriftCircleOnTrackCnv_p2_test.cxx @@ -91,7 +91,8 @@ void compare (const Muon::MdtDriftCircleOnTrack& p1, static_cast<const Trk::RIO_OnTrack&>(p2)); assert (p1.status() == p2.status()); assert (p1.detectorElement() == p2.detectorElement()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 546340330); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); assert (p1.localAngle() == p2.localAngle()); assert (p1.positionAlongWire() == p2.positionAlongWire()); diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/RpcClusterOnTrackCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/RpcClusterOnTrackCnv_p3_test.cxx index 11a140ee72f07624e6203b2de1877767d865e39d..68ceaaa4e3a4e28486c724e12dff1bc1d2dbcd69 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/RpcClusterOnTrackCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/RpcClusterOnTrackCnv_p3_test.cxx @@ -91,9 +91,9 @@ void compare (const Muon::RpcClusterOnTrack& p1, static_cast<const Muon::MuonClusterOnTrack&>(p2)); assert (p1.detectorElement() == p2.detectorElement()); assert (p2.time() == p2.time()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 765705747); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); - } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/STGC_ClusterOnTrackCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/STGC_ClusterOnTrackCnv_p1_test.cxx index c22867642b51dc96f1e3b919a94c968c46cb879d..89c60e3441c4d43de3245c43753c083254697643 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/STGC_ClusterOnTrackCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/STGC_ClusterOnTrackCnv_p1_test.cxx @@ -92,9 +92,9 @@ void compare (const Muon::sTgcClusterOnTrack& p1, compare (static_cast<const Muon::MuonClusterOnTrack&>(p1), static_cast<const Muon::MuonClusterOnTrack&>(p2)); assert (p1.detectorElement() == p2.detectorElement()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 998593386); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); - } diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/TgcClusterOnTrackCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/TgcClusterOnTrackCnv_p2_test.cxx index 842cf537f4764c89896e0455e6df3986a3402b68..94fa9855729a72278d254a5d34d195f0b0efc3b0 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/TgcClusterOnTrackCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/TgcClusterOnTrackCnv_p2_test.cxx @@ -90,9 +90,9 @@ void compare (const Muon::TgcClusterOnTrack& p1, compare (static_cast<const Muon::MuonClusterOnTrack&>(p1), static_cast<const Muon::MuonClusterOnTrack&>(p2)); assert (p1.detectorElement() == p2.detectorElement()); - assert (p1.prepRawDataLink().key() == p2.prepRawDataLink().key()); + // Link key gets modified during writing. + assert (p2.prepRawDataLink().key() == 871204267); assert (p1.prepRawDataLink().index() == p2.prepRawDataLink().index()); - } diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx index b03ae910adb7b436430bd0b553bc5375136daee1..6c99ffa0f4f4abf3a69dde461906aa730440a763 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx @@ -50,29 +50,29 @@ namespace JiveXML { StatusCode TrigRpcDataRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) { //be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieving " << dataTypeName()); // retrieve the collection of RDO const RpcPadContainer* rdoContainer; if ( evtStore()->retrieve( rdoContainer, m_sgKey).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Muon::RpcPadContainer '" << m_sgKey << "' was not retrieved." << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Muon::RpcPadContainer '" << m_sgKey << "' was not retrieved."); return StatusCode::SUCCESS; } else{ if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Muon::RpcPadContainer retrieved" << endmsg; - msg(MSG::DEBUG) << rdoContainer->size() << " RPC RDO collections." << endmsg; + ATH_MSG_DEBUG("Muon::RpcPadContainer retrieved"); + ATH_MSG_DEBUG(rdoContainer->size() << " RPC RDO collections."); } } const DataHandle<RpcPad> firstRdoColl; const DataHandle<RpcPad> lastRdoColl; if ( evtStore()->retrieve(firstRdoColl,lastRdoColl).isFailure() ) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RpcPad collections not found" << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("RpcPad collections not found"); return StatusCode::SUCCESS; } else{ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RpcPad collections retrieved" << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("RpcPad collections retrieved"); } int ndata=0; @@ -97,21 +97,22 @@ namespace JiveXML { SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ + if(!MuonDetMgr){ ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); return StatusCode::FAILURE; } //loop on pad - /*SG::ReadCondHandle<RpcCablingCondData> readHandle{m_readKey}; - const RpcCablingCondData* readCdo{*readHandle};*/ + SG::ReadCondHandle<RpcCablingCondData> readHandle{m_readKey, Gaudi::Hive::currentContext()}; + const RpcCablingCondData* rpcCabling{*readHandle}; + const DataHandle<RpcPad> itColl(firstRdoColl); for (; itColl!=lastRdoColl; ++itColl){ if ( itColl->size() == 0 ) continue; ipad++; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Ipad " << ipad << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Ipad " << ipad); //Get pad online id and sector id uint16_t padId = itColl->onlineId(); uint16_t sectorId = itColl->sector() ; @@ -130,14 +131,14 @@ namespace JiveXML { for (; itD != itD_e ; ++itD) { idata++; const RpcFiredChannel * rpcChan = (*itD); - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RpcFiredChannel: " << + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("RpcFiredChannel: " << " sectorId " << sectorId << " padId " << padId << " cmId " << cmaId << " bcid " << rpcChan->bcid() << " time " << rpcChan->time() << " ijk " << rpcChan->ijk() << - " ch " << rpcChan->channel() << endmsg; + " ch " << rpcChan->channel()); //look for trigger hits if(rpcChan->ijk()==6){ //found trigger hit. Look for confirm hits @@ -151,10 +152,10 @@ namespace JiveXML { //write trigger hit only once if(idata1==0){ - std::vector<Identifier>* digitVec = m_rpcDecoder->getOfflineData(rpcChan, sectorId, padId, cmaId, time); + std::vector<Identifier>* digitVec = m_rpcDecoder->getOfflineData(rpcChan, sectorId, padId, cmaId, time, rpcCabling); // Loop on the digits corresponding to the fired channel ///// following still unused - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of digits: " << digitVec->size()<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Number of digits: " << digitVec->size()); // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; @@ -163,7 +164,7 @@ namespace JiveXML { std::list<Identifier>::const_iterator it_list; for (it_list=stripList.begin() ; it_list != stripList.end() ; ++it_list) { Identifier stripOfflineId = *it_list; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId)<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" cablingId " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId)); const MuonGM::RpcReadoutElement* element = MuonDetMgr->getRpcReadoutElement(stripOfflineId); char ChID[100]; @@ -188,20 +189,20 @@ namespace JiveXML { } idata1++; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RpcFiredChannel1:" << + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("RpcFiredChannel1:" << " sectorId1 " << sectorId << " padId1 " << padId << " cmId1 " << cmaId << " bcid1 " << rpcChan1->bcid() << " time1 " << rpcChan1->time() << " ijk1 " << rpcChan1->ijk() << - " ch1 " << rpcChan1->channel() << endmsg; + " ch1 " << rpcChan1->channel()); //write confirm hits - std::vector<Identifier>* digitVec1 = m_rpcDecoder->getOfflineData(rpcChan1, sectorId, padId, cmaId, time1); + std::vector<Identifier>* digitVec1 = m_rpcDecoder->getOfflineData(rpcChan1, sectorId, padId, cmaId, time1, rpcCabling); // Loop on the digits corresponding to the fired channel - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of digits: " << digitVec1->size()<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Number of digits: " << digitVec1->size()); // transform the pad sectorId according to the cabling convention uint16_t side = (sectorId<32) ? 0 : 1; @@ -210,7 +211,7 @@ namespace JiveXML { std::list<Identifier>::const_iterator it_list1; for (it_list1=stripList1.begin() ; it_list1 != stripList1.end() ; ++it_list1) { Identifier stripOfflineId1 = *it_list1; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId1 " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId1)<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" cablingId1 " << m_idHelperSvc->rpcIdHelper().show_to_string(stripOfflineId1)); const MuonGM::RpcReadoutElement* element1 = MuonDetMgr->getRpcReadoutElement(stripOfflineId1); @@ -252,7 +253,7 @@ namespace JiveXML { myDataMap["barcode"] = barcode; //Be verbose - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< x.size() << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(dataTypeName() << ": "<< x.size()); //forward data to formating tool return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx index 712de32de20654b9bfa8a8a70ac69b8d091b1a0c..5ef7c5f25e392fbd1ca0c7a8aeb9cc1d11dc0a3f 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx @@ -11,9 +11,10 @@ #include "MdtCalibSvc/MdtCalibrationTool.h" #include "MdtCalibSvc/MdtCalibrationSvcSettings.h" #include "MdtCalibSvc/MdtCalibrationSvcInput.h" -#include "MuonPrepRawData/MdtTwinPrepData.h" // TWIN TUBES +#include "MuonPrepRawData/MdtTwinPrepData.h" #include "GeoModelUtilities/GeoGetIds.h" #include "GaudiKernel/ThreadLocalContext.h" +#include "GaudiKernel/PhysicalConstants.h" #include <vector> #include <algorithm> @@ -22,13 +23,15 @@ using namespace MuonGM; using namespace Trk; using namespace Muon; +namespace { + static constexpr double const& inverseSpeedOfLight = 1 / Gaudi::Units::c_light; // need 1/299.792458 +} + Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), m_muonMgr(nullptr), m_calibrationTool("MdtCalibrationTool",this), - m_mdtCalibSvcSettings(new MdtCalibrationSvcSettings() ), - m_calibHit(nullptr), - m_invSpeed(1./299.792458), + m_mdtCalibSvcSettings(new MdtCalibrationSvcSettings()), m_calibratePrepData(true), m_mdtDecoder("Muon::MdtRDO_Decoder/MdtRDO_Decoder", this), m_fullEventDone(false), @@ -62,7 +65,7 @@ Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, c declareProperty("CalibrationTool",m_calibrationTool); } -StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() { +StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() { ATH_CHECK(AthAlgTool::initialize()); ATH_CHECK(detStore()->retrieve(m_muonMgr)); ATH_CHECK(m_calibrationTool.retrieve()); @@ -88,7 +91,6 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() { }// end if(m_useTwin){ // - TWIN TUBES - m_calibHit = new MdtCalibHit(); m_mdtCalibSvcSettings->initialize(); // check if the layout includes elevator chambers @@ -116,16 +118,15 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::initialize() { } // check if initializing of DataHandle objects success - ATH_CHECK( m_rdoContainerKey.initialize() ); - ATH_CHECK( m_mdtPrepDataContainerKey.initialize() ); - ATH_CHECK( m_readKey.initialize() ); - + ATH_CHECK(m_rdoContainerKey.initialize()); + ATH_CHECK(m_mdtPrepDataContainerKey.initialize()); + ATH_CHECK(m_readKey.initialize()); + ATH_CHECK(m_muDetMgrKey.initialize()); return StatusCode::SUCCESS; } StatusCode Muon::MdtRdoToPrepDataToolCore::finalize() { - delete m_calibHit; return StatusCode::SUCCESS; } @@ -213,6 +214,9 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M return true; } + SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey}; + const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr(); + IdentifierHash rdoHash = hash; // before BMEs were installed, RDOs were indexed by offline hashes (same as PRD) if (m_BMEpresent) { // after BMEs were installed, the RDOs are indexed by the detectorElement hash of a multilayer Identifier elementId; @@ -236,7 +240,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M MdtCsmContainer::const_iterator rdoColli2 = rdoContainer.indexFind(rdoHash2); if( rdoColli != rdoContainer.end() && rdoColli2 != rdoContainer.end() ) { // Handle both at once - if(processCsm(*rdoColli, idWithDataVect, *rdoColli2).isFailure()){ + if(processCsm(*rdoColli, idWithDataVect, muDetMgr, *rdoColli2).isFailure()){ ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact()) << " and " << (unsigned long long)((*rdoColli2)->identify().get_compact())); @@ -246,7 +250,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M else if(rdoColli != rdoContainer.end()){ // Handle just one ATH_MSG_DEBUG("Only one RDO container was found for hash " << hash << " despite BME - Missing " << rdoHash2 ); - if ( processCsm(*rdoColli, idWithDataVect).isFailure() ) { + if ( processCsm(*rdoColli, idWithDataVect, muDetMgr).isFailure() ) { ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); return false; } @@ -254,7 +258,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M else if(rdoColli2 != rdoContainer.end()){ // Handle just one ATH_MSG_DEBUG("Only one RDO container was found for hash " << hash << " despite BME - Missing " << rdoHash ); - if ( processCsm(*rdoColli2, idWithDataVect).isFailure() ) { + if ( processCsm(*rdoColli2, idWithDataVect, muDetMgr).isFailure() ) { ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); return false; } @@ -267,7 +271,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M // process CSM if data was found MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); if( rdoColli != rdoContainer.end() ) { - if ( processCsm(*rdoColli, idWithDataVect).isFailure() ) { + if ( processCsm(*rdoColli, idWithDataVect, muDetMgr).isFailure() ) { ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); return false; } @@ -277,7 +281,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M // process CSM if data was found MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); if( rdoColli != rdoContainer.end() ) { - if ( processCsm(*rdoColli, idWithDataVect).isFailure() ) { + if ( processCsm(*rdoColli, idWithDataVect, muDetMgr).isFailure() ) { ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); return false; } @@ -426,7 +430,7 @@ void Muon::MdtRdoToPrepDataToolCore::printPrepData( ) } -StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MdtCsm *rdoColl2 ) { +StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm* rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MuonGM::MuonDetectorManager* muDetMgr, const MdtCsm* rdoColl2) { // first handle the case of twin tubes if(m_useTwin){ @@ -436,7 +440,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(elementId); if( chIndex == MuonStationIndex::BOL && ( m_useAllBOLTwin || (std::abs(m_idHelperSvc->mdtIdHelper().stationEta(elementId)) == 4 && m_idHelperSvc->mdtIdHelper().stationPhi(elementId) == 7) ) ) { - return processCsmTwin(rdoColl, idWithDataVect); + return processCsmTwin(rdoColl, idWithDataVect, muDetMgr); } } @@ -562,7 +566,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std Identifier channelId = newDigit->identify(); Identifier parentId = m_idHelperSvc->mdtIdHelper().parentID(channelId); if( m_idHelperSvc->mdtIdHelper().stationName(parentId) == m_BMGid && m_BMGpresent) { - std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(m_muonMgr->getMdtReadoutElement(channelId)->identify()); + std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(muDetMgr->getMdtReadoutElement(channelId)->identify()); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), channelId) != (myIt->second).end() ) { ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_idHelperSvc->mdtIdHelper().show_to_string(channelId) ); @@ -634,7 +638,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std Muon::MdtDriftCircleStatus digitStatus = Muon::MdtStatusDriftTime; // do lookup once - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); + const MdtReadoutElement* descriptor = muDetMgr->getMdtReadoutElement(channelId); if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); @@ -655,7 +659,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std if (newDigit->is_masked()) { digitStatus = Muon::MdtStatusMasked; }else{ - digitStatus = getMdtDriftRadius(newDigit, radius, errRadius, descriptor); + digitStatus = getMdtDriftRadius(newDigit, radius, errRadius, descriptor, muDetMgr); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " << " Id is: "<<m_idHelperSvc->toString(channelId)); @@ -775,7 +779,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std return StatusCode::SUCCESS; } -StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect) +StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm* rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MuonGM::MuonDetectorManager* muDetMgr) { ATH_MSG_DEBUG(" ***************** Start of processCsmTwin"); @@ -842,7 +846,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, //IdentifierHash channelHash = newDigit->identifyHash(); if( m_idHelperSvc->mdtIdHelper().stationName(channelId) == m_BMGid && m_BMGpresent) { - std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(m_muonMgr->getMdtReadoutElement(channelId)->identify()); + std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(muDetMgr->getMdtReadoutElement(channelId)->identify()); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), channelId) != (myIt->second).end() ) { ATH_MSG_DEBUG("processCsm : Deleting BMG digit with identifier" << m_idHelperSvc->mdtIdHelper().show_to_string(channelId) ); @@ -860,11 +864,9 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, // find the correct twin-pair (tube-1 & tube-3 are twin pair 1, tube-2 & tube-4 are twin pair 2) int twinPair = -1; if( tube%4 == 1){ twinPair = (tube + 1)/2 ;} - if( tube%4 == 3){ twinPair = (tube - 1)/2 ;} - if( tube%4 == 2){ twinPair = (tube + 2)/2 ;} - if( tube%4 == 0){ twinPair = tube/2 ;} - - + else if( tube%4 == 3){ twinPair = (tube - 1)/2 ;} + else if( tube%4 == 2){ twinPair = (tube + 2)/2 ;} + else { twinPair = tube/2 ;} // tube%4 == 0 // fill the digitColl map if( mdtDigitColl[ m_twin_chamber[multilayer-1][layer-1][twinPair-1] ].first == 0){ @@ -933,7 +935,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, Muon::MdtDriftCircleStatus digitStatus = Muon::MdtStatusDriftTime; // do lookup once - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); + const MdtReadoutElement * descriptor = muDetMgr->getMdtReadoutElement(channelId); if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); @@ -944,7 +946,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, if (digit->is_masked()) { digitStatus = Muon::MdtStatusMasked; }else{ - digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); + digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor, muDetMgr); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " << " Id is: "<<m_idHelperSvc->toString(channelId)); @@ -986,7 +988,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, double radius(0.); double errRadius(0.); Muon::MdtDriftCircleStatus digitStatus = Muon::MdtStatusDriftTime; // call the function to calculate radii and twin coordinate - digitStatus = getMdtTwinPosition(digit, second_digit, radius, errRadius, zTwin, errZTwin, secondHitIsPrompt); + digitStatus = getMdtTwinPosition(digit, second_digit, radius, errRadius, zTwin, errZTwin, secondHitIsPrompt, muDetMgr); if( zTwin <-99999 ) { ATH_MSG_WARNING("MDT Twin PrepData with very large, negative twin coordinate " << zTwin << " Id is: "<<m_idHelperSvc->toString(digit->identify()) << " Twin Id is: "<<m_idHelperSvc->toString(second_digit->identify())); } @@ -1009,7 +1011,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, } // do lookup once - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(promptHit_channelId); + const MdtReadoutElement * descriptor = muDetMgr->getMdtReadoutElement(promptHit_channelId); if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the DetManager <" <<m_idHelperSvc->toString(promptHit_channelId)<<"> =>>ignore this hit"); @@ -1058,8 +1060,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, << " radius = " << radius << " +- " << errRadius); Amg::Vector3D gpos_centertube = twin_newPrepData->globalPosition(); - const MdtReadoutElement* detEl = m_muonMgr->getMdtReadoutElement(promptHit_channelId); - // Amg::Vector3D locpos_centertube = detEl->globalToLocalCoords(gpos_centertube, promptHit_channelId); + const MdtReadoutElement* detEl = muDetMgr->getMdtReadoutElement(promptHit_channelId); Amg::Vector3D locpos_centertube = Amg::Vector3D(0.,0.,zTwin); Amg::Vector3D gpos_twin = detEl->localToGlobalCoords(locpos_centertube, promptHit_channelId); @@ -1120,7 +1121,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, Muon::MdtDriftCircleStatus digitStatus = Muon::MdtStatusDriftTime; // do lookup once - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); + const MdtReadoutElement * descriptor = muDetMgr->getMdtReadoutElement(channelId); if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); @@ -1131,7 +1132,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, if (digit->is_masked()) { digitStatus = Muon::MdtStatusMasked; }else{ - digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); + digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor, muDetMgr); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " << " Id is: "<<m_idHelperSvc->toString(channelId)); @@ -1192,7 +1193,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, Muon::MdtDriftCircleStatus second_digitStatus = Muon::MdtStatusDriftTime; // do lookup once - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); + const MdtReadoutElement * descriptor = muDetMgr->getMdtReadoutElement(channelId); if (!descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" <<m_idHelperSvc->toString(channelId)<<"> =>>ignore this hit"); @@ -1203,14 +1204,14 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, if (digit->is_masked()) { digitStatus = Muon::MdtStatusMasked; }else{ - digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor); + digitStatus = getMdtDriftRadius(digit, radius, errRadius, descriptor, muDetMgr); if( radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " << " Id is: "<<m_idHelperSvc->toString(channelId)); } } - const MdtReadoutElement * second_descriptor = m_muonMgr->getMdtReadoutElement(second_channelId); + const MdtReadoutElement * second_descriptor = muDetMgr->getMdtReadoutElement(second_channelId); if (!second_descriptor){ ATH_MSG_WARNING("Detector Element not found for Identifier from the cabling service <" <<m_idHelperSvc->toString(second_channelId)<<"> =>>ignore this hit"); @@ -1222,7 +1223,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, if (second_digit->is_masked()) { second_digitStatus = Muon::MdtStatusMasked; }else{ - second_digitStatus = getMdtDriftRadius(second_digit, second_radius, second_errRadius, second_descriptor); + second_digitStatus = getMdtDriftRadius(second_digit, second_radius, second_errRadius, second_descriptor, muDetMgr); if( second_radius < -999 ) { ATH_MSG_WARNING("MDT PrepData with very large, negative radius " << " Id is: "<<m_idHelperSvc->toString(second_channelId)); @@ -1305,14 +1306,12 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, } -MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtDriftRadius(const MdtDigit * digit, - double& radius, double& errRadius, const MuonGM::MdtReadoutElement * descriptor) { +MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtDriftRadius(const MdtDigit* digit, double& radius, double& errRadius, const MuonGM::MdtReadoutElement* descriptor, const MuonGM::MuonDetectorManager* muDetMgr) { ATH_MSG_DEBUG("in getMdtDriftRadius()"); if( m_calibratePrepData ){ Identifier channelId = digit->identify(); - //const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); // here check validity // if invalid, reset flags @@ -1322,65 +1321,46 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtDriftRadius(const MdtDigit <<m_idHelperSvc->toString(channelId)<<"> inconsistent with the geometry of detector element <" <<m_idHelperSvc->toString(descriptor->identify())<<"> =>>ignore this hit"); return MdtStatusUnDefined; - } - - m_calibHit->setIdentifier( channelId ); - m_calibHit->setTdc( digit->tdc() ); - m_calibHit->setAdc( digit->adc() ); - m_calibHit->setGeometry(descriptor); + } // use center (cached) to get the tube position instead of tubepos const Amg::Vector3D& position = descriptor->center(channelId); + MdtCalibHit calibHit(channelId, digit->tdc(), digit->adc(), position, descriptor); MdtCalibrationSvcInput inputData; double signedTrackLength = position.mag(); - inputData.tof = signedTrackLength*m_invSpeed; - - // double measured_perp = position.perp(); - // if (descriptor->getStationS() != 0.) { - // measured_perp = sqrt(measured_perp*measured_perp- - // descriptor->getStationS()*descriptor->getStationS()); - // } - // double measured_x = measured_perp * cos( position.phi() ); - // double measured_y = measured_perp * sin( position.phi() ); - // const Amg::Vector3D measured_position(measured_x, measured_y, position.z()); - // ATH_MSG_VERBOSE("Measured position is "<<measured_position); - // MdtCalibHit calib_hit( channelId, digit->tdc(), digit->adc(), measured_position, descriptor ); - m_calibHit->setGlobalPointOfClosestApproach(position); - - bool drift_ok = m_calibrationTool->driftRadiusFromTime(*m_calibHit,inputData,*m_mdtCalibSvcSettings,false); + inputData.tof = signedTrackLength*inverseSpeedOfLight; + + calibHit.setGlobalPointOfClosestApproach(position); + + bool drift_ok = m_calibrationTool->driftRadiusFromTime(calibHit,inputData,*m_mdtCalibSvcSettings,false); if (!drift_ok) { - if( m_calibHit->driftTime() < 0. ) return MdtStatusBeforeSpectrum; + if( calibHit.driftTime() < 0. ) return MdtStatusBeforeSpectrum; else return MdtStatusAfterSpectrum; } - radius = m_calibHit->driftRadius(); - errRadius = m_calibHit->sigmaDriftRadius(); + radius = calibHit.driftRadius(); + errRadius = calibHit.sigmaDriftRadius(); ATH_MSG_VERBOSE("Calibrated drift radius is "<<radius<<"+/-"<<errRadius); } else { Identifier channelId = digit->identify(); radius = 0.; - errRadius = m_muonMgr->getMdtReadoutElement(channelId)->innerTubeRadius()/sqrt(12); // 14.6/sqrt(12) + errRadius = muDetMgr->getMdtReadoutElement(channelId)->innerTubeRadius()/sqrt(12); // 14.6/sqrt(12) } return MdtStatusDriftTime; } -MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit * digit, const MdtDigit * second_digit, - double& radius, double& errRadius, - double& zTwin, double& errZTwin, bool& secondHitIsPrompt) { +MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit* digit, const MdtDigit* second_digit, double& radius, double& errRadius, double& zTwin, double& errZTwin, bool& secondHitIsPrompt, const MuonGM::MuonDetectorManager* muDetMgr) { ATH_MSG_DEBUG("in getMdtTwinPosition()"); - // StatusCode status = StatusCode::SUCCESS; - if( m_calibratePrepData ){ // start digit Identifier channelId = digit->identify(); - //IdentifierHash channelHash = digit->identifyHash(); - const MdtReadoutElement * descriptor = m_muonMgr->getMdtReadoutElement(channelId); + const MdtReadoutElement * descriptor = muDetMgr->getMdtReadoutElement(channelId); // here check validity // if invalid, reset flags @@ -1412,8 +1392,7 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit // start second digit Identifier second_channelId = second_digit->identify(); - //IdentifierHash second_channelHash = second_digit->identifyHash(); - const MdtReadoutElement * second_descriptor = m_muonMgr->getMdtReadoutElement(second_channelId); + const MdtReadoutElement * second_descriptor = muDetMgr->getMdtReadoutElement(second_channelId); // here check validity // if invalid, reset flags @@ -1470,9 +1449,9 @@ MdtDriftCircleStatus MdtRdoToPrepDataToolCore::getMdtTwinPosition(const MdtDigit else{ Identifier channelId = digit->identify(); radius = 0.; - errRadius = m_muonMgr->getMdtReadoutElement(channelId)->innerTubeRadius()/sqrt(12); // 14.6/sqrt(12) + errRadius = muDetMgr->getMdtReadoutElement(channelId)->innerTubeRadius()/sqrt(12); // 14.6/sqrt(12) zTwin = 0.; - double tubelength = m_muonMgr->getMdtReadoutElement(channelId)->getTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(channelId),m_idHelperSvc->mdtIdHelper().tube(channelId)); + double tubelength = muDetMgr->getMdtReadoutElement(channelId)->getTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(channelId),m_idHelperSvc->mdtIdHelper().tube(channelId)); errZTwin = tubelength/2.; } diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h index 5500a4f339661dfbafe18ba66e7936fb49082767..bef289b649818dd48b610772afc42435a5c677b2 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h @@ -18,6 +18,7 @@ #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" #include "MdtCalibSvc/MdtCalibrationTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <string> @@ -27,7 +28,6 @@ class MdtCalibHit; namespace MuonGM { - class MuonDetectorManager; class MdtReadoutElement; } @@ -62,26 +62,20 @@ namespace Muon StatusCode decode( std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& selectedIdVect ) override; //new decode method for Rob based readout StatusCode decode( const std::vector<uint32_t>& robIds ) override; - - virtual StatusCode processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MdtCsm *rdoColl2 = nullptr); - - Muon::MdtDriftCircleStatus getMdtDriftRadius(const MdtDigit * digit, double& radius, double& errRadius, const MuonGM::MdtReadoutElement * descriptor); - - // + TWIN TUBE - virtual StatusCode processCsmTwin(const MdtCsm *rdoColll, std::vector<IdentifierHash>& idWithDataVect); - // method to get the twin tube 2nd coordinate - Muon::MdtDriftCircleStatus getMdtTwinPosition(const MdtDigit * prompt_digit, const MdtDigit * twin_digit, - double& radius, double& errRadius, - double& zTwin, double& errZTwin, bool& twinIsPrompt); - - // - TWIN TUBE // dump methods for debugging virtual void printInputRdo() override; virtual void printPrepData() override; protected: - + virtual StatusCode processCsm(const MdtCsm* rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MuonGM::MuonDetectorManager* muDetMgr, const MdtCsm* rdoColl2=nullptr); + + Muon::MdtDriftCircleStatus getMdtDriftRadius(const MdtDigit* digit, double& radius, double& errRadius, const MuonGM::MdtReadoutElement* descriptor, const MuonGM::MuonDetectorManager* muDetMgr); + + virtual StatusCode processCsmTwin(const MdtCsm *rdoColll, std::vector<IdentifierHash>& idWithDataVect, const MuonGM::MuonDetectorManager* muDetMgr); + // method to get the twin tube 2nd coordinate + Muon::MdtDriftCircleStatus getMdtTwinPosition(const MdtDigit* prompt_digit, const MdtDigit* twin_digit, double& radius, double& errRadius, double& zTwin, double& errZTwin, bool& twinIsPrompt, const MuonGM::MuonDetectorManager* muDetMgr); + // adds the container to StoreGate, return false is the adding false. enum SetupMdtPrepDataContainerStatus { FAILED = 0, ADDED, ALREADYCONTAINED @@ -106,9 +100,7 @@ namespace Muon /// MDT calibration service ToolHandle<MdtCalibrationTool> m_calibrationTool; - MdtCalibrationSvcSettings* m_mdtCalibSvcSettings; - MdtCalibHit* m_calibHit; - double m_invSpeed; + MdtCalibrationSvcSettings* m_mdtCalibSvcSettings; /// MdtPrepRawData containers Muon::MdtPrepDataContainer* m_mdtPrepDataContainer; @@ -147,6 +139,8 @@ namespace Muon SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; + }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx index 7ea6d41f79ae93baa7529d37386b5fe8a7fa98e9..f9feaf81d21fba17a7aaee29a257800c35283743 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx @@ -124,61 +124,21 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are ATH_MSG_WARNING( "Station and Substation cuts lists should match in length, no cut perfomed" ); return false; } - } + } - //ATH_MSG_DEBUG( "isCut called, give hit ID:" << ID ); - std::vector<int> cutList; //this will chose the correct cut list (StationName or Station Region) - - enum class IdEnum { MDT, CSC, RPC, TGC } idEnum; - auto pIdHelper = [&]() -> const MuonIdHelper& { - switch (idEnum) { - case IdEnum::MDT: { return m_idHelperSvc->mdtIdHelper(); } - case IdEnum::CSC: { return m_idHelperSvc->cscIdHelper(); } - case IdEnum::RPC: { return m_idHelperSvc->rpcIdHelper(); } - default: { return m_idHelperSvc->tgcIdHelper(); } - } - }; - //determine technology - if (m_idHelperSvc->isMdt(ID)){ - idEnum = IdEnum::MDT; - ATH_MSG_DEBUG( "ID is an MDT" ); - } - else if (m_idHelperSvc->isCsc(ID)){ - idEnum = IdEnum::CSC; - ATH_MSG_DEBUG( "ID is an CSC" ); - } - else if (m_idHelperSvc->isRpc(ID)){ - idEnum = IdEnum::RPC; - ATH_MSG_DEBUG( "ID is an RPC" ); - } - else if (m_idHelperSvc->isTgc(ID)){ - idEnum = IdEnum::TGC; - ATH_MSG_DEBUG( "ID is a TGC" ); - } - else{ - ATH_MSG_ERROR( "Failure to determine technology type of ID#, returning false" ); - return false; - } - - unsigned int staName = pIdHelper().stationName(ID); - unsigned int staPhi = pIdHelper().stationPhi(ID); + unsigned int staName = m_idHelperSvc->stationName(ID); + unsigned int staPhi = m_idHelperSvc->stationPhi(ID); int sector = FindSector(staName,staPhi); - // ATH_MSG_DEBUG( "Phi Station is " << staPhi - // << " and Station name is " << staName ); - - //ATH_MSG_DEBUG( "Phi Sector is " << sector ); - - //Routine for cutting all EES and some EEL chambers if(m_cutEE && staName == 15) return true; if(m_cutEE && staName == 14){ int listSize = m_EELeta.size(); for (int i=0;i<listSize;i++){ - if(m_EELeta[i]==(pIdHelper().stationEta(ID)) && m_EELsector[i]==sector) break; + if(m_EELeta[i]==(m_idHelperSvc->stationEta(ID)) && m_EELsector[i]==sector) break; if(i==(listSize-1)) return true; //if fails last entry, cut = true } } @@ -205,9 +165,9 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are int listSize = cutList.size(); for (int i=0; i<listSize;i++){ - ATH_MSG_DEBUG( "Region " << pIdHelper().stationRegion(ID) + ATH_MSG_DEBUG( "Region " << m_idHelperSvc->stationRegion(ID) << " compared with " << cutList[i] ); - if( cutList[i] == pIdHelper().stationRegion(ID)){ + if( cutList[i] == m_idHelperSvc->stationRegion(ID)){ ATH_MSG_DEBUG( "Return True" ); return true; } @@ -239,9 +199,9 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are int listSize = cutList.size(); for (int i=0; i<listSize;i++){ - ATH_MSG_DEBUG( "Station Name " << pIdHelper().stationName(ID) << " compared with " + ATH_MSG_DEBUG( "Station Name " << m_idHelperSvc->stationName(ID) << " compared with " <<cutList[i] ); - if( cutList[i] == pIdHelper().stationName(ID)){ + if( cutList[i] == m_idHelperSvc->stationName(ID)){ if (!m_cutSubstation){ return true; } @@ -299,8 +259,8 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are int etaListSize; int phiListSize; int phi; //this variable is the phi index for tgcs, the sector for everyone else - unsigned int staName = pIdHelper().stationName(ID); - unsigned int staPhi = pIdHelper().stationPhi(ID); + unsigned int staName = m_idHelperSvc->stationName(ID); + unsigned int staPhi = m_idHelperSvc->stationPhi(ID); int sector = FindSector(staName,staPhi); phi = sector; @@ -315,7 +275,7 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are if (m_tgcEtaList.size()==0 && m_tgcEndPhiList.size()==0 && m_tgcForPhiList.size()==0) return false; genEtaList = m_tgcEtaList; - phi = pIdHelper().stationPhi(ID); + phi = m_idHelperSvc->stationPhi(ID); //Is it forward? if (staName == 41 || staName == 43 || staName == 45 || staName == 47) genPhiList = m_tgcForPhiList; @@ -330,11 +290,12 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are if (m_mdtSectorList.size()==0 && m_mdtEndEtaList.size()==0 && m_mdtBarEtaList.size()==0) return false; genPhiList = m_mdtSectorList; - if (pIdHelper().isBarrel(ID)) - genEtaList = m_mdtBarEtaList; - else - genEtaList = m_mdtEndEtaList; - } + if (m_idHelperSvc->isEndcap(ID)) { + genEtaList = m_mdtEndEtaList; + } else { + genEtaList = m_mdtBarEtaList; + } + } //rpc? else if(m_idHelperSvc->isRpc(ID)){ @@ -363,9 +324,9 @@ bool MuonIdCutTool::isCut(Identifier ID) const { //false indicates all cuts are if(m_cutEta){ etapass = false; for (int i=0; i<etaListSize;i++){ - ATH_MSG_DEBUG( "Eta Station " << pIdHelper().stationEta(ID) + ATH_MSG_DEBUG( "Eta Station " << m_idHelperSvc->stationEta(ID) << " compared with list to keep " << genEtaList[i] ); - if( genEtaList[i] == pIdHelper().stationEta(ID)) + if( genEtaList[i] == m_idHelperSvc->stationEta(ID)) etapass = true; } } diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.cxx b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.cxx index ade463fa5bec8da3b4dc0cd83379bda745be4530..fdf2423147c91c323452a5aea9b3a70f36326cbc 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.cxx @@ -1,12 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// CSC_PrepDataToxAOD.cxx -// Implementation file for class CSC_PrepDataToxAOD -/////////////////////////////////////////////////////////////////// - #include "CSC_PrepDataToxAOD.h" #include "EventPrimitives/EventPrimitivesHelpers.h" @@ -19,10 +14,8 @@ // Constructor with parameters: CSC_PrepDataToxAOD::CSC_PrepDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") -{ - + AthAlgorithm(name,pSvcLocator) +{ } // Initialize method: @@ -32,7 +25,6 @@ StatusCode CSC_PrepDataToxAOD::initialize() m_trackMeasVal="CSC_Clusters_TrackMeasVal"; ATH_CHECK(m_cscPrds.initialize()); ATH_CHECK(m_trackMeasVal.initialize()); - ATH_CHECK(m_idHelper.retrieve()); return StatusCode::SUCCESS; } @@ -81,9 +73,3 @@ StatusCode CSC_PrepDataToxAOD::execute() return StatusCode::SUCCESS; } - -// Finalize method: -StatusCode CSC_PrepDataToxAOD::finalize() -{ - return StatusCode::SUCCESS; -} diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.h b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.h index 3dc96da88c2592d1727b2852c559972874af2e78..e862d6329bfa684b7986384e5a8542685a2fef57 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.h +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/CSC_PrepDataToxAOD.h @@ -1,47 +1,33 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// CSC_PrepDataToxAOD.h -// Header file for class CSC_PrepDataToxAOD -/////////////////////////////////////////////////////////////////// - #ifndef CSC_PREPDATATOXAOD_H #define CSC_PREPDATATOXAOD_H #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include <string> -#include <map> -#include <vector> -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "Identifier/Identifier.h" - #include "xAODTracking/TrackMeasurementValidationContainer.h" - #include "StoreGate/WriteHandleKey.h" #include "StoreGate/ReadHandleKey.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" +#include <string> +#include <map> +#include <vector> + class CSC_PrepDataToxAOD : public AthAlgorithm { public: // Constructor with parameters: CSC_PrepDataToxAOD(const std::string &name,ISvcLocator *pSvcLocator); - // Basic algorithm methods: virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); - private: - SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrds; SG::WriteHandleKey<xAOD::TrackMeasurementValidationContainer> m_trackMeasVal; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; }; diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h index 03c77cebecd45e2419382610c5f3c15a562ae616..1e32dea5e101e6662d4e8f0195e7683f854abf6f 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/MuonPrepDataToxAOD.h @@ -1,34 +1,26 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonPrepDataToxAOD.h -// Header file for class MuonPrepDataToxAOD -/////////////////////////////////////////////////////////////////// - #ifndef MUONPREPDATATOXAOD_H #define MUONPREPDATATOXAOD_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" + #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" -#include <string> - #include "xAODTracking/TrackMeasurementValidation.h" #include "xAODTracking/TrackMeasurementValidationContainer.h" #include "xAODTracking/TrackMeasurementValidationAuxContainer.h" - #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" #include "EventPrimitives/EventPrimitivesHelpers.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "AtlasHepMC/GenParticle.h" -#include "Identifier/Identifier.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include <string> template <class PRDCOL, class SDOCOL> class MuonPrepDataToxAOD : public AthAlgorithm { @@ -37,8 +29,7 @@ public: // Constructor with parameters: MuonPrepDataToxAOD(const std::string &name,ISvcLocator *pSvcLocator, std::string inputName, std::string sdoName ) : - AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + AthAlgorithm(name,pSvcLocator) { m_inputContainerName = inputName; m_sdoContainerName = sdoName; @@ -46,7 +37,7 @@ public: } StatusCode initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_inputContainerName.initialize()); ATH_CHECK(m_sdoContainerName.initialize()); m_trackMeasVal=m_trackMeasVal.key()+"_TrackMeasVal"; @@ -54,8 +45,6 @@ public: return StatusCode::SUCCESS; } - StatusCode finalize() { return StatusCode::SUCCESS; } - // overload this function to add detector specific information virtual void addPRD_TechnologyInformation( xAOD::TrackMeasurementValidation&, const typename PRDCOL::IDENTIFIABLE::base_value_type& ) const { } @@ -94,7 +83,7 @@ public: xprd->setLocalPositionError(errx,errxy,erry); Amg::Vector3D gpos = prd->globalPosition(); xprd->setGlobalPosition(gpos.x(),gpos.y(),gpos.z()); - ATH_MSG_DEBUG( " PRD: " << m_idHelper->toString(prd->identify()) << " global position: r " << gpos.perp() << " z " << gpos.z() ); + ATH_MSG_DEBUG( " PRD: " << m_idHelperSvc->toString(prd->identify()) << " global position: r " << gpos.perp() << " z " << gpos.z() ); const typename SDOCOL::mapped_type* sdo = 0; if( sdoCollection ){ @@ -158,7 +147,7 @@ protected: SG::ReadHandleKey<PRDCOL> m_inputContainerName{this,"InputContainerName","InputContainer","Input PRD Container"}; SG::ReadHandleKey<SDOCOL> m_sdoContainerName{this,"SdoContainerName","SDOContainer","Input SDO Container"}; SG::WriteHandleKey<xAOD::TrackMeasurementValidationContainer> m_trackMeasVal; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/RPC_PrepDataToxAOD.cxx b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/RPC_PrepDataToxAOD.cxx index 19cbd77731bdef96af75a2c315351ce5d8a8c3f3..029ab103896c8c407a5e74af6882bdaaefd62aaf 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/RPC_PrepDataToxAOD.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/RPC_PrepDataToxAOD.cxx @@ -1,19 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// RPC_PrepDataToxAOD.cxx -// Implementation file for class RPC_PrepDataToxAOD -/////////////////////////////////////////////////////////////////// - #include "RPC_PrepDataToxAOD.h" + #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "TrkEventPrimitives/ResidualPull.h" #include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" #include "xAODTracking/TrackMeasurementValidationAuxContainer.h" // Constructor with parameters: @@ -23,7 +18,6 @@ RPC_PrepDataToxAOD::RPC_PrepDataToxAOD(const std::string &name, ISvcLocator *pSv m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"), m_inversePropagationSpeed(0.0048) { - } StatusCode RPC_PrepDataToxAOD::initialize() @@ -58,7 +52,7 @@ void RPC_PrepDataToxAOD::addPRD_TechnologyInformation( xAOD::TrackMeasurementVal xprd.auxdata<int>("triggerInfo") = prd.triggerInfo(); xprd.auxdata<int>("ambiguityFlag") = prd.ambiguityFlag(); xprd.auxdata<unsigned int>("collectionHash") = prd.collectionHash(); - xprd.auxdata<uint16_t>("measPhi") = m_idHelper->measuresPhi(prd.identify()); + xprd.auxdata<uint16_t>("measPhi") = m_idHelperSvc->measuresPhi(prd.identify()); xprd.auxdata<uint16_t>("muonClusterSize") = (uint16_t)prd.rdoList().size(); } @@ -71,7 +65,7 @@ void RPC_PrepDataToxAOD::addSDO_TechnologyInformation( xAOD::TrackMeasurementVal Amg::Vector3D gpos = sdo->globalPosition(); if( gpos.mag() > 1000 ){ double distToReadout = 0.; - if( m_idHelper->measuresPhi(prd.identify()) ) { + if( m_idHelperSvc->measuresPhi(prd.identify()) ) { distToReadout = prd.detectorElement()->distanceToPhiReadout(gpos); }else{ distToReadout = prd.detectorElement()->distanceToEtaReadout(gpos); diff --git a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/TGC_PrepDataToxAOD.cxx b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/TGC_PrepDataToxAOD.cxx index 54b888249a35ee4bcb96f653c63957db61c898c0..dec0fd76bccfb0ac510d46a1d88292585d239806 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/TGC_PrepDataToxAOD.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrepRawDataToxAOD/src/TGC_PrepDataToxAOD.cxx @@ -1,28 +1,22 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_PrepDataToxAOD.cxx -// Implementation file for class TGC_PrepDataToxAOD -/////////////////////////////////////////////////////////////////// - #include "TGC_PrepDataToxAOD.h" -#include <bitset> + #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "TrkEventPrimitives/ResidualPull.h" #include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -// Constructor with parameters: +#include <bitset> + TGC_PrepDataToxAOD::TGC_PrepDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator) : MuonPrepDataToxAOD(name,pSvcLocator,"TGC_MeasurementsAllBCs","TGC_SDO"), m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") { - } // Execute method: @@ -54,9 +48,9 @@ StatusCode TGC_PrepDataToxAOD::initialize() void TGC_PrepDataToxAOD::addPRD_TechnologyInformation( xAOD::TrackMeasurementValidation& xprd, const Muon::TgcPrepData& prd ) const { xprd.auxdata<uint16_t>("bctag") = prd.getBcBitMap(); - xprd.auxdata<uint16_t>("measPhi") = m_idHelper->measuresPhi(prd.identify()); + xprd.auxdata<uint16_t>("measPhi") = m_idHelperSvc->measuresPhi(prd.identify()); xprd.auxdata<uint16_t>("muonClusterSize") = (uint16_t)prd.rdoList().size(); - ATH_MSG_DEBUG(m_idHelper->toString(prd.identify()) << "bctag " + ATH_MSG_DEBUG(m_idHelperSvc->toString(prd.identify()) << "bctag " << ((prd.getBcBitMap()&Muon::TgcPrepData::BCBIT_PREVIOUS)==Muon::TgcPrepData::BCBIT_PREVIOUS) << " " << ((prd.getBcBitMap()&Muon::TgcPrepData::BCBIT_CURRENT)==Muon::TgcPrepData::BCBIT_CURRENT) << " " << ((prd.getBcBitMap()&Muon::TgcPrepData::BCBIT_NEXT)==Muon::TgcPrepData::BCBIT_NEXT) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt index cd633c83144f7a8e16c6bab7fca24cd06fa9e600..94c184d1168efea2a9712f7dacfeb53af4f919bf 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt @@ -8,13 +8,15 @@ atlas_subdir( MuonRPC_CnvTools ) # External dependencies: find_package( tdaq-common COMPONENTS eformat_write DataWriter ) +atlas_add_library( MuonRPC_CnvToolsLib + INTERFACE + PUBLIC_HEADERS MuonRPC_CnvTools + LINK_LIBRARIES GaudiKernel ByteStreamData ) + # Component(s) in the package: atlas_add_component( MuonRPC_CnvTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamData ByteStreamData_test GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonTrigCoinData TrkSurfaces TrigT1RPChardwareLib RPChardware RPC_CondCablingLib RPCcablingInterfaceLib MuonCnvToolInterfacesLib xAODEventInfo ) - -# Install files from the package: -atlas_install_headers( MuonRPC_CnvTools ) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} MuonRPC_CnvToolsLib ByteStreamData_test GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonTrigCoinData TrkSurfaces TrigT1RPChardwareLib RPC_CondCablingLib RPCcablingInterfaceLib MuonCnvToolInterfacesLib xAODEventInfo ) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDO_Decoder.h index aa815f86beb3e999a4fea6c4470ae3d9a95e702d..be19deda17c03dbba5ede7d2aa36252dcb581b57 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/MuonRPC_CnvTools/IRPC_RDO_Decoder.h @@ -1,14 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONRPC_CNVTOOL_IRPC_RDO_Decoder_H #define MUONRPC_CNVTOOL_IRPC_RDO_Decoder_H #include "GaudiKernel/IAlgTool.h" + class Identifier; class RpcDigit; class RpcFiredChannel; +class RpcCablingCondData; static const InterfaceID IID_IRPC_RDO_Decoder("Muon::IRPC_RDO_Decoder", 1, 0); @@ -23,14 +25,14 @@ public: static const InterfaceID& interfaceID( ) { return IID_IRPC_RDO_Decoder; }; - virtual std::vector<RpcDigit*>* getDigit(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId) const = 0; + virtual std::vector<RpcDigit*>* getDigit(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, const RpcCablingCondData* rpcCab) const = 0; - virtual std::vector<Identifier>* getOfflineData(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId, double& time) const = 0; + virtual std::vector<Identifier>* getOfflineData(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, double& time, const RpcCablingCondData* rpcCab) const = 0; }; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx index 2db7ab6a12164e585dd30c6cb49718c33cd0954f..39357a2032f3780dba844ac004939ce99f193e92 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx @@ -20,7 +20,7 @@ Muon::RpcRDO_Decoder::RpcRDO_Decoder StatusCode Muon::RpcRDO_Decoder::initialize() { ATH_CHECK(AthAlgTool::initialize()); - ATH_MSG_DEBUG ("initialize"); + ATH_MSG_DEBUG ("initialize"); // get RPC cablingSvc const IRPCcablingServerSvc* RpcCabGet = 0; @@ -42,15 +42,14 @@ StatusCode Muon::RpcRDO_Decoder::initialize() } ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_rpcReadKey.initialize()); return StatusCode::SUCCESS; } -std::vector<RpcDigit*>* Muon::RpcRDO_Decoder::getDigit(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId) const +std::vector<RpcDigit*>* Muon::RpcRDO_Decoder::getDigit(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, const RpcCablingCondData* /*rpcCab*/) const { std::vector<RpcDigit*>* rpcDigitVec = new std::vector<RpcDigit*>; @@ -91,9 +90,9 @@ std::vector<RpcDigit*>* Muon::RpcRDO_Decoder::getDigit(const RpcFiredChannel * f } -std::vector<Identifier>* Muon::RpcRDO_Decoder::getOfflineData(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId, double& time) const +std::vector<Identifier>* Muon::RpcRDO_Decoder::getOfflineData(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, double& time, const RpcCablingCondData* /*rpcCab*/) const { std::vector<Identifier>* rpcIdVec = new std::vector<Identifier>; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h index 882e6531d107e64e27746d54b073a3915410576f..06cd36828334827d5b59b4c4f14702d773e8789d 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h @@ -9,7 +9,6 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "RPC_CondCabling/RpcCablingCondData.h" -#include "StoreGate/ReadCondHandleKey.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <inttypes.h> @@ -31,18 +30,17 @@ class RpcRDO_Decoder : virtual public IRPC_RDO_Decoder, public AthAlgTool { virtual StatusCode initialize(); - virtual std::vector<RpcDigit*>* getDigit(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId) const; + virtual std::vector<RpcDigit*>* getDigit(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, const RpcCablingCondData* rpcCab) const; - virtual std::vector<Identifier>* getOfflineData(const RpcFiredChannel * fChan, - uint16_t& sectorID, uint16_t& padId, - uint16_t& cmaId, double& time) const; + virtual std::vector<Identifier>* getOfflineData(const RpcFiredChannel* fChan, + uint16_t& sectorID, uint16_t& padId, + uint16_t& cmaId, double& time, const RpcCablingCondData* rpcCab) const; private: ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - SG::ReadCondHandleKey<RpcCablingCondData> m_rpcReadKey{this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; const IRPCcablingSvc* m_cablingSvc; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx index 37410b153379def497d8ab076364a499c63328aa..fa8349ee7ce46f45eab48d33bbe033b98ce0f48f 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -16,10 +16,6 @@ Muon::RpcRdoToPrepDataTool::RpcRdoToPrepDataTool( const std::string& type, const { } -Muon::RpcRdoToPrepDataTool::~RpcRdoToPrepDataTool() -{ -} - StatusCode Muon::RpcRdoToPrepDataTool::initialize() { ATH_MSG_VERBOSE("Starting init"); @@ -28,11 +24,6 @@ StatusCode Muon::RpcRdoToPrepDataTool::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::RpcRdoToPrepDataTool::finalize() -{ - return RpcRdoToPrepDataToolCore::finalize(); -} - StatusCode Muon::RpcRdoToPrepDataTool::manageOutputContainers(bool& firstTimeInTheEvent) { SG::WriteHandle< Muon::RpcPrepDataContainer > rpcPrepDataHandle(m_rpcPrepDataContainerKey); @@ -86,3 +77,43 @@ StatusCode Muon::RpcRdoToPrepDataTool::manageOutputContainers(bool& firstTimeInT } return StatusCode::SUCCESS; } + +StatusCode Muon::RpcRdoToPrepDataTool::decode( std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& selectedIdVect ){ + ATH_MSG_DEBUG("Calling Core decode function from Legacy decode function (hash vector)"); + StatusCode status = Muon::RpcRdoToPrepDataToolCore::decode( idVect, selectedIdVect ); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing Core decode from Legacy (hash vector)"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Core decode processed in Legacy decode (hash vector)"); + + auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); + for (auto hash : prd_hashes){ + ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); + } + + // For additional information on container contents, this function can be used + // Muon::RpcRdoToPrepDataToolCore::printPrepData(); + + return StatusCode::SUCCESS; +} + +StatusCode Muon::RpcRdoToPrepDataTool::decode( const std::vector<uint32_t>& robIds ){ + ATH_MSG_DEBUG("Calling Core decode function from Legacy decode function (ROB vector)"); + StatusCode status = Muon::RpcRdoToPrepDataToolCore::decode( robIds ); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing Core decode from Legacy (ROB vector)"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Core decode processed in Legacy decode (ROB vector)"); + + auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); + for (auto hash : prd_hashes){ + ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); + } + + // For additional information on container contents, this function can be used + // Muon::RpcRdoToPrepDataToolCore::printPrepData(); + + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h index f9b49ac443e0084993f2d9e2b051b392e6adc9e5..d871817d7876042f68ca8e615aa08e0f1829bbf2 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOL_H @@ -12,9 +12,10 @@ namespace Muon { class RpcRdoToPrepDataTool : virtual public RpcRdoToPrepDataToolCore { public: RpcRdoToPrepDataTool( const std::string&, const std::string&, const IInterface* ); - virtual ~RpcRdoToPrepDataTool(); + virtual ~RpcRdoToPrepDataTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; + virtual StatusCode decode( std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& selectedIdVect ) override; + virtual StatusCode decode( const std::vector<uint32_t>& robIds ) override; protected: virtual StatusCode manageOutputContainers(bool& firstTimeInTheEvent) override; diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx index 8850dae69dd2509309af6a8258aac11bb1d2312d..c40c56a1e24eb828361b0b1a5f5cc031116c79d6 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolCore.cxx @@ -812,6 +812,9 @@ StatusCode Muon::RpcRdoToPrepDataToolCore::processPad(const RpcPad *rdoColl, RpcPrepDataCollection * collection(0); RpcCoinDataCollection * collectionTrg(0); IdentifierHash rpcHashId; + + SG::ReadCondHandle<RpcCablingCondData> cablingCondData{m_rpcReadKey, Gaudi::Hive::currentContext()}; + const RpcCablingCondData* rpcCabling{*cablingCondData}; // For each pad, loop on the coincidence matrices RpcPad::const_iterator itCM = rdoColl->begin(); @@ -903,7 +906,7 @@ StatusCode Muon::RpcRdoToPrepDataToolCore::processPad(const RpcPad *rdoColl, // here decode (get offline ids for the online indices of this hit) double time = 0.; std::vector<Identifier>* digitVec = - m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId, cmaId, time); + m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId, cmaId, time, rpcCabling); time += (double)m_timeShift; if (!digitVec) { diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx index 7f096924aca5b545daadec849443fa3e8e785934..f2787b9b84e3002e1b3ff67f7af06dff9cf4ca20 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -8,12 +8,23 @@ #include "MuonRPC_CnvTools/IRPC_RDO_Decoder.h" #include "MuonTrigCoinData/RpcCoinDataContainer.h" +//*** +// Plan with this MT code is to allow the const-cast approach to occur in Core in a single-thread manner +// and once a container local only to this thread is filled, we will take its contents and cross-check +// against the cache and insert any members not present. +// Smarter behaviour can then be implemented to prevent too much duplicate computation but due to the +// complexities of the Core decoding, this is the more reasonable approach to a first MT-safe implementation +//*** Muon::RpcRdoToPrepDataToolMT::RpcRdoToPrepDataToolMT( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool( type, name, parent ), RpcRdoToPrepDataToolCore( type, name, parent ) { + declareProperty("RpcPrdContainerCacheKey", m_prdContainerCacheKey, + "Optional external cache for the RPC PRD container"); + declareProperty("RpcCoinDataContainerCacheKey", m_coindataContainerCacheKey, + "Optional external cache for the RPC coin data container"); } Muon::RpcRdoToPrepDataToolMT::~RpcRdoToPrepDataToolMT() @@ -24,66 +35,352 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( RpcRdoToPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( SG::AllowEmpty ) ); + ATH_CHECK( m_coindataContainerCacheKey.initialize( SG::AllowEmpty ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); + return StatusCode::SUCCESS; } StatusCode Muon::RpcRdoToPrepDataToolMT::finalize() { + ATH_MSG_DEBUG("Cleaning local-thread containers"); + ATH_MSG_DEBUG("Deleting PRD container"); + delete m_rpcPrepDataContainer; + if (m_producePRDfromTriggerWords){ + ATH_MSG_DEBUG("Deleting Coin container"); + delete m_rpcCoinDataContainer; + } return RpcRdoToPrepDataToolCore::finalize(); } StatusCode Muon::RpcRdoToPrepDataToolMT::manageOutputContainers(bool& firstTimeInTheEvent) { - // MT version of this method always adds container. Caching will be added later. - SG::WriteHandle< Muon::RpcPrepDataContainer > rpcPrepDataHandle(m_rpcPrepDataContainerKey); - if(!rpcPrepDataHandle.isPresent()) { - firstTimeInTheEvent = true; - - StatusCode status = rpcPrepDataHandle.record(std::make_unique<Muon::RpcPrepDataContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max())); - - if (status.isFailure() || !rpcPrepDataHandle.isValid() ) { - ATH_MSG_FATAL("Could not record container of RPC PrepData Container at " << m_rpcPrepDataContainerKey.key()); - return status; - } else { - m_rpcPrepDataContainer = rpcPrepDataHandle.ptr(); - ATH_MSG_DEBUG("RPC PrepData Container recorded in StoreGate with key " << m_rpcPrepDataContainerKey.key() << ", " << rpcPrepDataHandle.key()); + // We will need to retrieve from cache even in different threads + SG::WriteHandle< Muon::RpcPrepDataContainer >rpcPRDHandle(m_rpcPrepDataContainerKey); + // In MT, we always want to treat this as if its the first time in the event + firstTimeInTheEvent = true; + // Clear vectors which get filled + m_decodedOfflineHashIds.clear(); + m_decodedRobIds.clear(); + + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + + if (!externalCachePRD) { + // without the cache we just record the container + StatusCode status = rpcPRDHandle.record(std::make_unique<Muon::RpcPrepDataContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max())); + if (status.isFailure() || !rpcPRDHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC PrepData Container at " << m_rpcPrepDataContainerKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container " << m_rpcPrepDataContainerKey.key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<RpcPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return StatusCode::FAILURE; } + StatusCode status = rpcPRDHandle.record(std::make_unique<Muon::RpcPrepDataContainer>(update.ptr())); + if (status.isFailure() || !rpcPRDHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " <<m_rpcPrepDataContainerKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key()); + } + // Pass the container from the handle + m_rpcPrepDataContainerFromCache = rpcPRDHandle.ptr(); - if (m_producePRDfromTriggerWords){ - /// create an empty RPC trigger hit container for filling - SG::WriteHandle< Muon::RpcCoinDataContainer > rpcCoinDataHandle(m_rpcCoinDataContainerKey); - status = rpcCoinDataHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max())); - - if (status.isFailure() || !rpcCoinDataHandle.isValid() ) { - ATH_MSG_FATAL("Could not record container of RPC TrigCoinData Container at " << m_rpcCoinDataContainerKey.key()); - return status; - } else { - m_rpcCoinDataContainer = rpcCoinDataHandle.ptr(); - ATH_MSG_DEBUG("RPC TrigCoinData Container recorded in StoreGate with key " << m_rpcCoinDataContainerKey.key()); - } - ATH_MSG_VERBOSE(" RpcCoinDataContainer created"); + // Handle coin data if being used + if (m_producePRDfromTriggerWords){ + SG::WriteHandle< Muon::RpcCoinDataContainer >rpcCoinHandle(m_rpcCoinDataContainerKey); + const bool externalCacheCoinData = !m_coindataContainerCacheKey.key().empty(); + if(!externalCacheCoinData){ + // without the cache we just record the container + StatusCode status = rpcCoinHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max())); + if (status.isFailure() || !rpcCoinHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC Coin Data Container at " << m_rpcCoinDataContainerKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container " << m_rpcCoinDataContainerKey.key()); } - m_decodedOfflineHashIds.clear(); - m_decodedRobIds.clear(); - - } - else{ - const Muon::RpcPrepDataContainer* rpcPrepDataContainer_c; - ATH_CHECK( evtStore()->retrieve (rpcPrepDataContainer_c, m_rpcPrepDataContainerKey.key()) ); - m_rpcPrepDataContainer = const_cast<Muon::RpcPrepDataContainer*> (rpcPrepDataContainer_c); - ATH_MSG_DEBUG("RPC PrepData Container is already in StoreGate "); - if (m_producePRDfromTriggerWords){ - SG::WriteHandle< Muon::RpcCoinDataContainer > rpcCoinDataHandle(m_rpcCoinDataContainerKey); - if (!rpcCoinDataHandle.isPresent()) { - ATH_MSG_FATAL("Muon::RpcPrepDataContainer found while Muon::RpcCoinDataContainer not found in Event Store"); + else { + // use the cache to get the container + SG::UpdateHandle<RpcCoinDataCollection_Cache> update(m_coindataContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_coindataContainerCacheKey.key()); + return StatusCode::FAILURE; + } + StatusCode status = rpcCoinHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(update.ptr())); + if (status.isFailure() || !rpcCoinHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC Coin Data Container using cache " + << m_coindataContainerCacheKey.key() << " - " <<m_rpcCoinDataContainerKey.key()); return StatusCode::FAILURE; } - const Muon::RpcCoinDataContainer* rpcCoinDataContainer_c; - ATH_CHECK( evtStore()->retrieve (rpcCoinDataContainer_c, m_rpcCoinDataContainerKey.key()) ); - m_rpcCoinDataContainer = const_cast<Muon::RpcCoinDataContainer*> (rpcCoinDataContainer_c); - ATH_MSG_DEBUG("RPC CoinData Container is already in StoreGate "); + ATH_MSG_DEBUG("Created container using cache for " << m_coindataContainerCacheKey.key()); } + // Pass the container from the handle + m_rpcCoinDataContainerFromCache = rpcCoinHandle.ptr(); + } + + // To prevent a memory leak, delete the pointer if it exists + if(m_rpcPrepDataContainer){ + delete m_rpcPrepDataContainer; + } + if (m_rpcCoinDataContainer){ + delete m_rpcCoinDataContainer; + } + + m_rpcPrepDataContainer = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); + if (m_producePRDfromTriggerWords){ + m_rpcCoinDataContainer = new Muon::RpcCoinDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); + } + + return StatusCode::SUCCESS; +} + +StatusCode Muon::RpcRdoToPrepDataToolMT::decode( std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& selectedIdVect ){ + ATH_MSG_DEBUG("Calling Core decode function from MT decode function (hash vector)"); + StatusCode status = Muon::RpcRdoToPrepDataToolCore::decode( idVect, selectedIdVect ); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing Core decode from MT (hash vector)"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Core decode processed in MT decode (hash vector)"); + status = transferOutputToCache(); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing container transfer from local to cache (hash vector)"); + return StatusCode::FAILURE; } return StatusCode::SUCCESS; } + +StatusCode Muon::RpcRdoToPrepDataToolMT::decode( const std::vector<uint32_t>& robIds ){ + ATH_MSG_DEBUG("Calling Core decode function from MT decode function (ROB vector)"); + StatusCode status = Muon::RpcRdoToPrepDataToolCore::decode( robIds ); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing Core decode from MT (ROB vector)"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Core decode processed in MT decode (ROB vector)"); + status = transferOutputToCache(); + if (status.isFailure()){ + ATH_MSG_FATAL("Error processing container transfer from local to cache (ROB vector)"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){ + // This function should be called at the end of the Core decode function + ATH_MSG_DEBUG("Transferring local decoding from Core to cache container inside MT"); + + // Take m_rpcPrepDataContainer and transfer contents to m_rpcPrepDataContainerFromCache + auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); + for (auto hash : prd_hashes) { + // Remove collection from local-thread container and place into unique_ptr to move to cache + std::unique_ptr<Muon::RpcPrepDataCollection> coll ( m_rpcPrepDataContainer->removeCollection(hash) ); + // Check if it is present in the cache container + bool isHashInCache = m_rpcPrepDataContainerFromCache->tryAddFromCache(hash); + if (isHashInCache) { + ATH_MSG_DEBUG("PRD hash " << hash << " exists inside cache container"); + continue; + } + // If not present, get a write lock for the hash and move collection + RpcPrepDataContainer::IDC_WriteHandle lock = m_rpcPrepDataContainerFromCache->getWriteHandle( hash ); + StatusCode status_lock = lock.addOrDelete(std::move( coll ) ); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert RpcPrepDataCollection into RpcPrepDataContainer..." ); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("PRD hash " << hash << " has been moved to cache container"); + } + + // Take m_rpcCoinDataContainer and transfer contents to m_rpcCoinDataContainerFromCache + auto coin_hashes = m_rpcCoinDataContainer->GetAllCurrentHashes(); + for (auto hash : coin_hashes) { + // Remove collection from local-thread container and place into unique_ptr to move to cache + std::unique_ptr<Muon::RpcCoinDataCollection> coll ( m_rpcCoinDataContainer->removeCollection(hash) ); + // Check if it is present in the cache container + bool isHashInCache = m_rpcCoinDataContainerFromCache->tryAddFromCache(hash); + if (isHashInCache) { + ATH_MSG_DEBUG("Coin hash " << hash << " exists inside cache container"); + continue; + } + // If not present, get a write lock for the hash and move collection + RpcCoinDataContainer::IDC_WriteHandle lock = m_rpcCoinDataContainerFromCache->getWriteHandle( hash ); + StatusCode status_lock = lock.addOrDelete(std::move( coll ) ); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert RpcCoinDataCollection into RpcCoinDataContainer..." ); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Coin hash " << hash << " has been moved to cache container"); + } + + + auto prd_hashes_cache_check = m_rpcPrepDataContainerFromCache->GetAllCurrentHashes(); + for (auto hash : prd_hashes_cache_check){ + ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); + } + + auto prd_hashes_local_check = m_rpcPrepDataContainer->GetAllCurrentHashes(); + for (auto hash : prd_hashes_local_check){ + ATH_MSG_DEBUG("Contents of LOCAL in this view : " << hash); + } + + // For additional information on the contents of the cache-based container, this function can be used + //printMT(); + + return StatusCode::SUCCESS; +} + +void Muon::RpcRdoToPrepDataToolMT::printMT() +{ + msg (MSG::INFO) << "********************************************************************************************************" << endmsg; + msg (MSG::INFO) << "***************** Listing RpcPrepData collections content **********************************************" << endmsg; + + if (m_rpcPrepDataContainerFromCache->size() <= 0)msg (MSG::INFO) << "No RpcPrepRawData collections found" << endmsg; + + int ncoll = 0; + int ict = 0; + int ictphi = 0; + int ictamb = 0; + int icteta = 0; + int icttrg = 0; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; + for (IdentifiableContainer<Muon::RpcPrepDataCollection>::const_iterator rpcColli = m_rpcPrepDataContainerFromCache->begin(); + rpcColli!=m_rpcPrepDataContainerFromCache->end(); ++rpcColli) { + + const Muon::RpcPrepDataCollection* rpcColl = *rpcColli; + + if ( rpcColl->size() > 0 ) { + msg (MSG::INFO) <<"PrepData Collection ID "<<m_idHelperSvc->rpcIdHelper().show_to_string(rpcColl->identify())<<endmsg; + RpcPrepDataCollection::const_iterator it_rpcPrepData; + int icc = 0; + int iccphi = 0; + int icceta = 0; + for (it_rpcPrepData=rpcColl->begin(); it_rpcPrepData != rpcColl->end(); it_rpcPrepData++) { + icc++; + ict++; + if (m_idHelperSvc->rpcIdHelper().measuresPhi((*it_rpcPrepData)->identify())) { + iccphi++; + ictphi++; + if ((*it_rpcPrepData)->ambiguityFlag()>1) ictamb++; + } + else { + icceta++; + icteta++; + } + msg (MSG::INFO) <<ict<<" in this coll. "<<icc<<" prepData id = " + <<m_idHelperSvc->rpcIdHelper().show_to_string((*it_rpcPrepData)->identify()) + <<" time "<<(*it_rpcPrepData)->time() + <<" ambiguityFlag "<<(*it_rpcPrepData)->ambiguityFlag()<<endmsg; + } + ncoll++; + msg (MSG::INFO) <<"*** Collection "<<ncoll<<" Summary: " + <<iccphi<<" phi hits / " + <<icceta<<" eta hits "<<endmsg; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; + } + } + msg (MSG::INFO) <<"*** Event Summary: " + <<ncoll <<" Collections / " + <<icttrg<<" trigger hits / " + <<ictphi<<" phi hits / " + <<icteta<<" eta hits "<<endmsg; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; + + msg (MSG::INFO) << "********************************************************************************************************" << endmsg; + msg (MSG::INFO) << "***************** Listing RpcCoinData collections content **********************************************" << endmsg; + + if (m_rpcCoinDataContainerFromCache->size() <= 0)msg (MSG::INFO) << "No RpcCoinData collections found" << endmsg; + + ncoll = 0; + ict = 0; + ictphi = 0; + icteta = 0; + int ictphilc = 0; + int ictphihc = 0; + int ictetalc = 0; + int ictetahc = 0; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; + for (IdentifiableContainer<Muon::RpcCoinDataCollection>::const_iterator rpcColli = m_rpcCoinDataContainerFromCache->begin(); + rpcColli!=m_rpcCoinDataContainerFromCache->end(); ++rpcColli) { + + const Muon::RpcCoinDataCollection* rpcColl = *rpcColli; + + if ( rpcColl->size() > 0 ) { + msg (MSG::INFO) <<"CoinData Collection ID "<<m_idHelperSvc->rpcIdHelper().show_to_string(rpcColl->identify())<<endmsg; + RpcCoinDataCollection::const_iterator it_rpcCoinData; + int icc = 0; + int iccphi = 0; + int icceta = 0; + int iccphilc = 0; + int iccetahc = 0; + int iccphihc = 0; + int iccetalc = 0; + + for (it_rpcCoinData=rpcColl->begin(); it_rpcCoinData != rpcColl->end(); it_rpcCoinData++) { + icc++; + ict++; + + if (m_idHelperSvc->rpcIdHelper().measuresPhi((*it_rpcCoinData)->identify())) { + + iccphi++; + ictphi++; + if ( (*it_rpcCoinData)->isLowPtCoin() ) { + iccphilc++; + ictphilc++; + } + else if ((*it_rpcCoinData)->isHighPtCoin()) { + iccphihc++; + ictphihc++; + } + } + else { + icceta++; + icteta++; + if ( (*it_rpcCoinData)->isLowPtCoin() ) { + iccetalc++; + ictetalc++; + } + else if ((*it_rpcCoinData)->isHighPtCoin()) { + iccetahc++; + ictetahc++; + } + } + msg (MSG::INFO) <<ict<<" in this coll. "<<icc<<" coinData id = " + <<m_idHelperSvc->rpcIdHelper().show_to_string((*it_rpcCoinData)->identify()) + <<" time "<<(*it_rpcCoinData)->time()<<" ijk = "<<(*it_rpcCoinData)->ijk() + <<" cm/pad/sl ids = " + <<(*it_rpcCoinData)->parentCmId()<<"/"<<(*it_rpcCoinData)->parentPadId()<<"/"<<(*it_rpcCoinData)->parentSectorId()<<"/" + <<" isLowPtCoin/HighPtCoin/LowPtInputToHighPt " + <<(*it_rpcCoinData)->isLowPtCoin() <<"/"<<(*it_rpcCoinData)->isHighPtCoin() <<"/"<<(*it_rpcCoinData)->isLowPtInputToHighPtCm() + <<endmsg; + } + ncoll++; + msg (MSG::INFO) <<"*** Collection "<<ncoll<<" Summary: " + <<iccphi<<" phi coin. hits / " + <<icceta<<" eta coin. hits \n" + <<iccphilc<<" phi lowPt / " + <<iccphihc<<" phi highPt / " + <<iccetalc<<" eta lowPt / " + <<iccetahc<<" eta highPt coincidences " + <<endmsg; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; + } + } + msg (MSG::INFO) <<"*** Event Summary: " + <<ncoll <<" Collections / " + <<ictphi<<" phi coin. hits / " + <<icteta<<" eta coin. hits \n" + <<ictphilc<<" phi lowPt / " + <<ictphihc<<" phi highPt / " + <<ictetalc<<" eta lowPt / " + <<ictetahc<<" eta highPt coincidences " + <<endmsg; + msg (MSG::INFO) <<"--------------------------------------------------------------------------------------------"<<endmsg; +} diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h index ffb2ac146bb9f077ce44966828b73e3a64950dbd..d0468b4be10c5dc6c6db26fb4426421133aa1680 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h @@ -1,11 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLMT_H #define MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLMT_H #include "RpcRdoToPrepDataToolCore.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" +#include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" + namespace Muon { @@ -15,9 +18,24 @@ public: virtual ~RpcRdoToPrepDataToolMT(); virtual StatusCode initialize() override; virtual StatusCode finalize() override; - + virtual StatusCode decode( std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& selectedIdVect ) override; + virtual StatusCode decode( const std::vector<uint32_t>& robIds ) override; + protected: virtual StatusCode manageOutputContainers(bool& firstTimeInTheEvent) override; + StatusCode transferOutputToCache(); + void printMT(); + +private: + /// This is the key for the cache for the MDT PRD containers, can be empty + SG::UpdateHandleKey<RpcPrepDataCollection_Cache> m_prdContainerCacheKey ; + SG::UpdateHandleKey<RpcCoinDataCollection_Cache> m_coindataContainerCacheKey ; + /// As this code is complex, we will store access to the cache container in the MT tool + /// and make contents available to Core code + Muon::RpcPrepDataContainer* m_rpcPrepDataContainerFromCache; + Muon::RpcCoinDataContainer* m_rpcCoinDataContainerFromCache; + + }; } diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt index 594101166b74610572aeb7d2a8cef9705a906d80..99ed098203dc6f70e18cf574f027e55516d31d8b 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt @@ -22,7 +22,7 @@ find_package( AthenaPoolUtilitiesTest ) if( ATHENAPOOLUTILITIESTEST_FOUND ) set( MUONSIMEVENTATHENAPOOL_REFERENCE_TAG - MuonSimEventAthenaPoolReference-02-00-00 ) + MuonSimEventAthenaPoolReference-02-01-00 ) run_tpcnv_legacy_test( MuonSimEventTPCnv_HITS HITS.04919495._000416 REFERENCE_TAG ${MUONSIMEVENTATHENAPOOL_REFERENCE_TAG} ) else() diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/MDT_CondCabling/MDTCablingDbTool.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/MDT_CondCabling/MDTCablingDbTool.h index 4bbc7765f4cc88526c7cca0ce02f7425f03aa301..948a1b3f20e665c2230d547d4fe0472915d905ac 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/MDT_CondCabling/MDTCablingDbTool.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/MDT_CondCabling/MDTCablingDbTool.h @@ -1,28 +1,24 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDT_CONDCABLING_MDTCABLINGDBTOOL_H #define MDT_CONDCABLING_MDTCABLINGDBTOOL_H -#include "GaudiKernel/AlgTool.h" #include "MuonCondInterface/IMDTCablingDbTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "GaudiKernel/IChronoStatSvc.h" #include "MuonCablingData/MuonMDT_CablingMap.h" #include "AthenaKernel/IIOVDbSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <string> -class Identifier; class IIOVSvc; -class IIOVDbSvc; -class StatusCode; -class MuonMDT_CablingMap; -class MDTCablingDbTool: public AthAlgTool, public IMDTCablingDbTool -{ +class MDTCablingDbTool: public AthAlgTool, public IMDTCablingDbTool { public: @@ -40,25 +36,15 @@ public: virtual std::string mapFolderName() const {return m_mapFolder;} virtual std::string mezzanineFolderName() const {return m_mezzanineFolder;} - - - - // MuonMDT_CablingMap* getMap() {return m_cablingData;} private: - - - virtual StatusCode loadParameters(IOVSVC_CALLBACK_ARGS); virtual StatusCode loadMezzanine(IOVSVC_CALLBACK_ARGS); virtual StatusCode loadMDTMap(IOVSVC_CALLBACK_ARGS); - - IIOVSvc* m_IOVSvc; IIOVDbSvc* m_IOVDbSvc; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; MuonMDT_CablingMap* m_cablingData; std::string m_DataLocation; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/src/MDTCablingDbTool.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/src/MDTCablingDbTool.cxx index d3d73c971ac7db8884cadec6f35ed7b8420aa188..7caceae679383e1244166a204a69cb762bd8898b 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/src/MDTCablingDbTool.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/MDT_CondCabling/src/MDTCablingDbTool.cxx @@ -1,34 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "MDT_CondCabling/MDTCablingDbTool.h" #include "SGTools/TransientAddress.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/MdtIdHelper.h" #include "PathResolver/PathResolver.h" +#include "MuonCondSvc/MdtStringUtils.h" +#include <map> #include <fstream> #include <string> #include <stdlib.h> -#include "MuonCablingData/MuonMDT_CablingMap.h" - -#include "MDT_CondCabling/MDTCablingDbTool.h" -#include "MuonCondInterface/IMDTCablingDbTool.h" -#include "MuonCondSvc/MdtStringUtils.h" -//#include "AthenaKernel/IIOVDbSvc.h" - - -#include <map> -#include "Identifier/Identifier.h" - //********************************************************** //* Author Monica Verducci monica.verducci@cern.ch //* @@ -37,25 +25,14 @@ //* retrieving of two tables from DB //********************************************************* - -MDTCablingDbTool::MDTCablingDbTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) -{ - +MDTCablingDbTool::MDTCablingDbTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent) { declareInterface<IMDTCablingDbTool>(this); - - m_DataLocation="keyMDT"; - - - declareProperty("MezzanineFolders", m_mezzanineFolder="/MDT/CABLING/MEZZANINE_SCHEMA"); declareProperty("MapFolders", m_mapFolder="/MDT/CABLING/MAP_SCHEMA"); } -//StatusCode MDTCablingDbTool::updateAddress(SG::TransientAddress* tad) StatusCode MDTCablingDbTool::updateAddress(StoreID::type /*storeID*/, SG::TransientAddress* tad, const EventContext& /*ctx*/) @@ -75,9 +52,9 @@ StatusCode MDTCablingDbTool::updateAddress(StoreID::type /*storeID*/, StatusCode MDTCablingDbTool::initialize() { - ATH_MSG_VERBOSE( "Initializing " ); + ATH_MSG_VERBOSE("Initializing "); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); m_IOVSvc = 0; bool CREATEIF(true); @@ -110,12 +87,10 @@ StatusCode MDTCablingDbTool::initialize() IAddressProvider* addp = this; - // tad->setProvider(addp); proxy->setProvider(addp, StoreID::DETECTOR_STORE); ATH_MSG_VERBOSE( "set address provider for CABLING Container" ); return StatusCode::SUCCESS; - } @@ -261,7 +236,7 @@ StatusCode MDTCablingDbTool::loadMDTMap(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) stationNameString = "BOL"; } if (stationNameString == "BMG") BMGchamberadded = true; - int stationIndex = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(stationNameString); + int stationIndex = m_idHelperSvc->mdtIdHelper().stationNameIndex(stationNameString); ATH_MSG_VERBOSE( "station name: " << stationNameString << " index: " << stationIndex ); // convert the subdetector id to integer @@ -319,9 +294,9 @@ StatusCode MDTCablingDbTool::loadMDTMap(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) } - if(m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG") != -1 && !BMGchamberadded) { + if(m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG") != -1 && !BMGchamberadded) { ATH_MSG_WARNING( "Running a layout including BMG chambers, but missing them in cabling from conditions --> hard-coding BMG cabling." ); - int stationIndex = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG"); + int stationIndex = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG"); // BMG1A12 ---------------- mezzanine_type, stationIndex, eta, phi, multilayer, layer, tube, subdetectorId, mrod, csm, tdcId, channelId for(int i=0; i<9; i++) // ML1 diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RPCCablingDbTool.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RPCCablingDbTool.h index 9070c769eb14c38c6df658c497a31165ebf38460..b21416e4201c2f76afecd2e9bead89d0fc1e9abb 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RPCCablingDbTool.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RPCCablingDbTool.h @@ -1,24 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDTOOL_RPCCABLINGDBTOOL_H #define MUONCONDTOOL_RPCCABLINGDBTOOL_H -#include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonCondInterface/IRPCCablingDbTool.h" -#include "GaudiKernel/IChronoStatSvc.h" - #include "AthenaBaseComps/AthAlgTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/IChronoStatSvc.h" -class Identifier; +#include <string> class IIOVSvc; -class StatusCode; - class RPCCablingDbTool: public AthAlgTool, public IRPCCablingDbTool { @@ -45,18 +39,10 @@ public: virtual StatusCode loadParameters(IOVSVC_CALLBACK_ARGS); virtual StatusCode loadRPCMap(IOVSVC_CALLBACK_ARGS); virtual StatusCode loadRPCCorr(IOVSVC_CALLBACK_ARGS); - - - private: - - - + private: IIOVSvc* m_IOVSvc; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - std::string m_DataLocation; std::string m_mapFolder; @@ -71,10 +57,6 @@ public: std::string m_chrono2; std::string m_chrono3; std::string m_chrono4; - - }; - - #endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RPCCablingDbTool.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RPCCablingDbTool.cxx index 0d2dce23320bbf8cf3dde9260941fda0bbbf3dfa..2f26fc437967bf5b1b5083502237c742146b96e5 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RPCCablingDbTool.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RPCCablingDbTool.cxx @@ -1,32 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "RPC_CondCabling/RPCCablingDbTool.h" #include "SGTools/TransientAddress.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - #include "Identifier/IdentifierHash.h" - -#include "MuonIdHelpers/RpcIdHelper.h" +#include "Identifier/Identifier.h" #include "PathResolver/PathResolver.h" #include <fstream> #include <string> #include <stdlib.h> - - - -#include "RPC_CondCabling/RPCCablingDbTool.h" -#include "MuonCondInterface/IRPCCablingDbTool.h" - - #include <map> -#include "Identifier/Identifier.h" //********************************************************** //* Author Monica Verducci monica.verducci@cern.ch @@ -37,95 +27,42 @@ //********************************************************* -RPCCablingDbTool::RPCCablingDbTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) -{ - +RPCCablingDbTool::RPCCablingDbTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent) { declareInterface<IRPCCablingDbTool>(this); - - m_DataLocation="keyRPC"; - declareProperty("MapConfigurationFolder", m_mapFolder="/RPC/CABLING/MAP_SCHEMA"); declareProperty("MapCorrectionFolder", m_corrFolder="/RPC/CABLING/MAP_SCHEMA_CORR"); m_map =""; m_corr=""; - } -//StatusCode RPCCablingDbTool::updateAddress(SG::TransientAddress* /*tad*/) StatusCode RPCCablingDbTool::updateAddress(StoreID::type /*storeID*/, SG::TransientAddress* /*tad*/, const EventContext& /*ctx*/) { - MsgStream log(msgSvc(), name()); - //CLID clid = tad->clID(); - //std::string key = tad->name(); - // if ( == clid && m_DataLocation == key) - //{ - // log << MSG::DEBUG << "OK " << endmsg; - // return StatusCode::SUCCESS; - //} return StatusCode::FAILURE; } - - - StatusCode RPCCablingDbTool::initialize() { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "Initializing - folders names are: conf "<<m_mapFolder <<" / corr "<<m_corrFolder<< endmsg; - - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_MSG_INFO("Initializing - folders names are: conf "<<m_mapFolder <<" / corr "<<m_corrFolder); // Get interface to IOVSvc m_IOVSvc = 0; bool CREATEIF(true); - StatusCode sc = service( "IOVSvc", m_IOVSvc, CREATEIF ); - if ( sc.isFailure() ) - { - log << MSG::ERROR << "Unable to get the IOVSvc" << endmsg; - return StatusCode::FAILURE; - } - - if(sc.isFailure()) return StatusCode::FAILURE; - - + ATH_CHECK(service( "IOVSvc", m_IOVSvc, CREATEIF)); // initialize the chrono service - sc = service("ChronoStatSvc",m_chronoSvc); - if (sc != StatusCode::SUCCESS) { - log << MSG::ERROR << "Could not find the ChronoSvc" << endmsg; - return sc; - } - - -// const DataHandle<CondAttrListCollection> MapData; -// sc=detStore()->regFcn(&IRPCCablingDbTool::loadRPCMap, -// dynamic_cast<IRPCCablingDbTool*>(this), -// MapData, m_mapFolder); - - if(sc.isFailure()) return StatusCode::FAILURE; - - - - - return StatusCode::SUCCESS; - + ATH_CHECK(service("ChronoStatSvc",m_chronoSvc)); + return StatusCode::SUCCESS; } StatusCode RPCCablingDbTool::loadParameters(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - MsgStream log(msgSvc(), name()); - +{ std::list<std::string>::const_iterator itr; for (itr=keys.begin(); itr!=keys.end(); ++itr) { - log << MSG::INFO <<"LoadParameters "<< *itr << " I="<<I<<" "<<endmsg; + ATH_MSG_INFO("LoadParameters "<< *itr << " I="<<I<<" "); if(*itr==m_mapFolder) { StatusCode sc = loadRPCMap(I,keys); if (sc.isFailure()) @@ -149,40 +86,30 @@ StatusCode RPCCablingDbTool::loadParameters(IOVSVC_CALLBACK_ARGS_P(I,keys)) StatusCode RPCCablingDbTool::loadRPCMap(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) { - MsgStream log(msgSvc(), name()); - StatusCode sc=StatusCode::SUCCESS; - log << MSG::INFO << "loadRPCMap --- Load Map from DB" << endmsg; - - const CondAttrListCollection * atrc; - log << MSG::INFO << "Try to read from folder <"<<m_mapFolder<<">"<<endmsg; + ATH_MSG_INFO("loadRPCMap --- Load Map from DB"); - sc=detStore()->retrieve(atrc,m_mapFolder); - if(sc.isFailure()) { - log << MSG::ERROR - << "could not retreive the CondAttrListCollection from DB folder " - << m_mapFolder << endmsg; - return sc; - } + const CondAttrListCollection* atrc=nullptr; + ATH_MSG_INFO("Try to read from folder <"<<m_mapFolder<<">"); - else - log<<MSG::INFO<<" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size() <<endmsg; + ATH_CHECK(detStore()->retrieve(atrc,m_mapFolder)); + ATH_MSG_INFO(" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size()); CondAttrListCollection::const_iterator itr; int ic=0; for (itr = atrc->begin(); itr != atrc->end(); ++itr) { ic++; - log << MSG::INFO << "Loop over CondAttrListCollection ic = "<<ic<<endmsg; + ATH_MSG_DEBUG("Loop over CondAttrListCollection ic = "<<ic); const coral::AttributeList& atr=itr->second; // store configuration map in private member RPCConfMap m_map = *(static_cast<const std::string*>((atr["Map"]).addressOfData())); - log << MSG::VERBOSE << "Sequence load is \n" << m_map <<endmsg; - log <<"End of Sequence load"<<endmsg; + ATH_MSG_VERBOSE("Sequence load is \n" << m_map); + ATH_MSG_VERBOSE("End of Sequence load"); } - log<< MSG::INFO<<"After Reading folder, Configuration string size is "<<m_map.size()<<endmsg; + ATH_MSG_INFO("After Reading folder, Configuration string size is "<<m_map.size()); return StatusCode::SUCCESS; @@ -191,24 +118,13 @@ StatusCode RPCCablingDbTool::loadRPCMap(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) StatusCode RPCCablingDbTool::loadRPCCorr(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) { - MsgStream log(msgSvc(), name()); - StatusCode sc=StatusCode::SUCCESS; - log << MSG::INFO << "loadRPCCorr --- Load Corrections from DB" << endmsg; + ATH_MSG_INFO("loadRPCCorr --- Load Corrections from DB"); - const CondAttrListCollection * atrc; - log << MSG::INFO << "Try to read from folder <"<<m_corrFolder<<">"<<endmsg; - - sc=detStore()->retrieve(atrc,m_corrFolder); - if(sc.isFailure()) { - log << MSG::ERROR - << "could not retreive the CondAttrListCollection from DB folder " - << m_corrFolder << endmsg; - return sc; - } - - else - log<<MSG::INFO<<" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size() <<endmsg; + const CondAttrListCollection* atrc=nullptr; + ATH_MSG_INFO("Try to read from folder <"<<m_corrFolder<<">"); + ATH_CHECK(detStore()->retrieve(atrc,m_corrFolder)); + ATH_MSG_INFO(" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size()); CondAttrListCollection::const_iterator itr; for (itr = atrc->begin(); itr != atrc->end(); ++itr) { @@ -217,13 +133,11 @@ StatusCode RPCCablingDbTool::loadRPCCorr(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) // store correction map in private member RPCCorrMap m_corr = *(static_cast<const std::string*>((atr["Map"]).addressOfData())); - log << MSG::VERBOSE << "Sequence load is \n" << m_corr <<endmsg; - log <<"End of Sequence load"<<endmsg; + ATH_MSG_VERBOSE("Sequence load is \n" << m_corr); + ATH_MSG_VERBOSE("End of Sequence load"); } - log<< MSG::INFO<<"After Reading folder, Correction string size is "<<m_corr.size()<<endmsg; - + ATH_MSG_INFO("After Reading folder, Correction string size is "<<m_corr.size()); return StatusCode::SUCCESS; - } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt index 977262af371b5e8c148d27f861721592735623ac..4588c18631af875267264e1fea66a68421cd6c6c 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt @@ -43,7 +43,7 @@ atlas_add_library( MuonCondAlgLib PUBLIC_HEADERS MuonCondAlg INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvcLib StoreGateLib MuonIdHelpersLib MuonReadoutGeometry MdtCalibSvcLib MdtCalibData MuonCalibITools MdtCalibUtils PathResolver z + LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvcLib StoreGateLib MuonIdHelpersLib MuonReadoutGeometry MdtCalibSvcLib MdtCalibData MuonCalibITools MdtCalibUtils MuonCalibToolsLib PathResolver z PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo ) atlas_add_component( MuonCondAlg diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/CMakeLists.txt index b1c9f14d84139dd13a7b873621b83cdf3a256f63..305bc7372d86d1686b1b63dc1855edca88dbfa6a 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/CMakeLists.txt @@ -27,8 +27,4 @@ atlas_add_component( MuonCondCool # Install files from the package: atlas_install_headers( MuonCondCool ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/share/makeRpcTriggerScripts.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/share/makeRpcTriggerScripts.py index 20c19b23305d7bf0645e1f0f0dda51f03b2d2ebe..2735ca73fefe6ec8a7cd4290eba0d26f138a6cff 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/share/makeRpcTriggerScripts.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/share/makeRpcTriggerScripts.py @@ -187,7 +187,6 @@ MessageSvc.OutputLevel = VERBOSE # big loop over all directories for i in range(len(EtaSXX)): - # take care of eta #------------------------------ EtaSXXi= EtaSXX[i].strip('\n') @@ -223,7 +222,7 @@ for i in range(len(EtaSXX)): for j in range(len(EtaSXXmu6)): EtaChannel+= 1 printfunc ("low pt EtaChannel= ", EtaChannel) - + EtaSXXmu6[j]=EtaSXXmu6[j].strip('\n') fileSuffix= EtaSXXmu6[j].split('_')[4] EtaName_CM6= EtaSXXmu6[j].replace('_'+fileSuffix,'') @@ -250,7 +249,6 @@ for i in range(len(EtaSXX)): #loop over phi files for j in range(len(PhiSXXmu)): - PhiChannel+= 1 printfunc ("PhiChannel= ", PhiChannel) PhiSXXmu[j]=PhiSXXmu[j].strip('\n') diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.cxx index 8d25c9a43e9c9218382cc5f071635d1f865a65a8..e700f0a38653180f0d6f2657d6746985226bd06e 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.cxx @@ -2,107 +2,73 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "CscCoolTest.h" + #include <fstream> #include <string> #include <stdlib.h> -#include <math.h> -#include "MuonIdHelpers/CscIdHelper.h" -#include "GaudiKernel/MsgStream.h" -#include "CscCoolTest.h" +#include <cmath> using namespace MuonCalib; //So we don't need to type MuonCalib:: in front of CscCondParType:: -CscCoolTest::CscCoolTest(const std::string& name, - ISvcLocator* pSvcLocator) :AthAlgorithm(name,pSvcLocator), - m_log(msgSvc(),name), - p_cscCoolStrSvc(0) -{ - +CscCoolTest::CscCoolTest(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name,pSvcLocator), + p_cscCoolStrSvc(nullptr) { declareProperty("StripHash",m_stripHash = 800); declareProperty("DoStatusTest", m_doStatusTest = false); } - -CscCoolTest::~CscCoolTest() {} - StatusCode CscCoolTest::initialize() { - m_log << MSG::DEBUG << "CscCoolTest::initialize() called" << endmsg; - - if (StatusCode::SUCCESS!=service("MuonCalib::CscCoolStrSvc",p_cscCoolStrSvc)) - { - m_log << MSG::FATAL << "Cannot get CscCoolStrSvc" << endmsg; - return StatusCode::FAILURE; - } - StoreGateSvc* detstore; - if (StatusCode::SUCCESS!=service("DetectorStore",detstore)) { - m_log << MSG::FATAL << "Detector store not found" << endmsg; - return StatusCode::FAILURE; - } - StatusCode sc = m_muonIdHelperTool.retrieve(); - if(sc.isFailure()) - { - m_log << MSG::FATAL << "Cannot retrieve MuonIdHelperTool" << endmsg; - return sc; - } - + ATH_MSG_DEBUG("CscCoolTest::initialize() called"); + ATH_CHECK(service("MuonCalib::CscCoolStrSvc",p_cscCoolStrSvc)); + StoreGateSvc* detstore=nullptr; + ATH_CHECK(service("DetectorStore",detstore)); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } StatusCode CscCoolTest::execute() { - m_log << MSG::INFO << "Starting CscCoolTest execute" << endmsg; - - float ped(0), pulseSlope(0.0), noise(0),rms(0),f001(0); + ATH_MSG_DEBUG("Starting CscCoolTest execute"); + float ped(0); + float pulseSlope(0); + float noise(0); + float rms(0); + float f001(0); //float gain, ped, runSlope, pulseSlope, peakt,width,sat1,sat2,noise,thold; - uint32_t status =0; + uint32_t status=0; StatusCode sc; - //Using the get parameter method of CscCoolStrSvc to retrieve the parameters. - m_log << MSG::INFO << "Retrieveing constants from strip with hash " << m_stripHash << endmsg; + ATH_MSG_DEBUG("Retrieveing constants from strip with hash " << m_stripHash); sc = p_cscCoolStrSvc->getParameter(ped,"ped",m_stripHash); sc = p_cscCoolStrSvc->getParameter(noise,"noise",m_stripHash); sc = p_cscCoolStrSvc->getParameter(f001,"f001",m_stripHash); sc = p_cscCoolStrSvc->getParameter(rms,"rms",m_stripHash); sc = p_cscCoolStrSvc->getParameter(pulseSlope,"pslope",m_stripHash); sc = p_cscCoolStrSvc->getParameter(status,"status",m_stripHash); - //sc = p_cscCoolStrSvc->getParameter(thold,"thold",m_stripHash); - //sc = p_cscCoolStrSvc->getParameter(peakt,"peakt",m_stripHash); - //sc = p_cscCoolStrSvc->getParameter(width,"width",m_stripHash); - //sc = p_cscCoolStrSvc->getParameter(sat1,CscCondParType::SAT1,m_stripHash); - //sc = p_cscCoolStrSvc->getParameter(sat2,CscCondParType::SAT2,m_stripHash); - - //Test depreciated version - - //sc = p_cscCoolStrSvc->getStatus(status,m_stripHash); - - if(!sc.isSuccess()) - { - m_log << MSG::FATAL << "couldn't retrieve parameter!" << endmsg; + if(!sc.isSuccess()) { + ATH_MSG_FATAL("couldn't retrieve parameter!"); return StatusCode::FAILURE; } - m_log << MSG::INFO << "***data from first retrieval method is:" + ATH_MSG_DEBUG("***data from first retrieval method is:" << "\n\tslope from pulser:\t" << pulseSlope << "\n\tpedestal:\t" << ped << "\n\tnoise:\t" << noise << "\n\trms\t" << rms << "\n\tf001\t" << f001 - << "\n\tstatus:\t" << std::hex << static_cast<unsigned int>(status) << std::dec - << endmsg; + << "\n\tstatus:\t" << std::hex << static_cast<unsigned int>(status) << std::dec); //Applying bit masks to bit-masked status - m_log << MSG:: INFO << "Status flags taken from bit-maksed status" << endmsg; - - m_log << MSG::INFO <<"noisy/stuck-bit channel: " << (status & 0x1) << endmsg; - m_log << MSG::INFO <<"dead channel: " << ((status >> 1 )& 0x1 )<< endmsg; - - + ATH_MSG_DEBUG("Status flags taken from bit-maksed status"); + ATH_MSG_DEBUG("noisy/stuck-bit channel: " << (status & 0x1)); + ATH_MSG_DEBUG("dead channel: " << ((status >> 1 )& 0x1 )); //Count how man of each bad status result we have if(m_doStatusTest){ - IdContext channelContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); const unsigned int nIds = 61440; const unsigned int expectedChamberLayer = 2; @@ -112,14 +78,13 @@ StatusCode CscCoolTest::execute() for( unsigned int idItr = 0; idItr < nIds; idItr++){ Identifier stripId; - m_muonIdHelperTool->cscIdHelper().get_id(idItr, stripId, &channelContext); - unsigned int chamLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(stripId); + m_idHelperSvc->cscIdHelper().get_id(idItr, stripId, &channelContext); + unsigned int chamLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId); if( chamLayer == expectedChamberLayer){ //skip missing layer sc = p_cscCoolStrSvc->getParameter(status,"status",idItr); - if(!sc.isSuccess()) - { - m_log << MSG::FATAL << "couldn't retrieve status for stripHash " << stripId << endmsg; + if(!sc.isSuccess()) { + ATH_MSG_FATAL("couldn't retrieve status for stripHash " << stripId); return StatusCode::FAILURE; } if(status&0x1) @@ -128,19 +93,11 @@ StatusCode CscCoolTest::execute() numDead++; }//end if chamber layer is expected chamber layer }//end loop over channels - m_log << MSG::INFO << "====Status Counts===" << endmsg; - m_log << MSG::INFO << "Num Noisy Channels:\t" << numNoisy << endmsg; - m_log << MSG::INFO << "Num Dead Channels:\t" << numDead << endmsg; - m_log << MSG::INFO << "===================="<< endmsg; + ATH_MSG_DEBUG("====Status Counts==="); + ATH_MSG_DEBUG("Num Noisy Channels:\t" << numNoisy); + ATH_MSG_DEBUG("Num Dead Channels:\t" << numDead); + ATH_MSG_DEBUG("===================="); }//end if m_doStatusTest return StatusCode::SUCCESS; } - -StatusCode CscCoolTest::finalize() -{ - return StatusCode::SUCCESS; -} - -//} // end namespace MuonCalib - diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.h index 0095f23b0c0860c4af195e7887d75c6cd0424500..ac77ce270d51121e40f48c0279b27d01368599bd 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscCoolTest.h @@ -1,22 +1,20 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDCOOL_CSCCOOLTEST_H #define MUONCONDCOOL_CSCCOOLTEST_H + /**CscCoolTest - simple algorithm to test reading out parameters from the csc cool database using the CscCoolStrSvc getParameter method. Can be used to test the auto-updating of the local cache withing CscCoolStrSvc*/ + #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" -//#include "MuonCondData/CscCalibData.h" +#include "GaudiKernel/ServiceHandle.h" + #include "MuonCondInterface/CscICoolStrSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -//namespace MuonCalib { /** @class CscCoolTest @@ -30,31 +28,21 @@ CscCoolStrSvc*/ Using an appropriate jobOptions file, this algoritm can be used to test this functionality. */ - class CscCoolTest: public AthAlgorithm { public: CscCoolTest(const std::string& name, ISvcLocator* pSvcLocator); - ~CscCoolTest(void); + ~CscCoolTest()=default; /**initialize CscCoolStrSvc*/ StatusCode initialize(void); /**prints out all the parameters from a single strip as requested in the jobOptions file*/ StatusCode execute(void); - /**does nothing*/ - StatusCode finalize(void); private: - MsgStream m_log; - MuonCalib::CscICoolStrSvc* p_cscCoolStrSvc; - - + MuonCalib::CscICoolStrSvc* p_cscCoolStrSvc; int m_stripHash; - - bool m_doStatusTest; - - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - + bool m_doStatusTest; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; //} // end namespace MuonCalib diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.cxx index cbfd8f5d0342e8cc6930d1340fe5e9592b558b06..3d86fb61088819fe7003738aacc77e102ec40076 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.cxx @@ -7,28 +7,27 @@ // author lampen@physics.arizona.edu // Update: Apr 10, 2007. No longer reads - Caleb Parnell-Lampen <lampen@physics.arizona.edu> +#include "CscReadWriteCoolStr.h" + #include "GaudiKernel/ISvcLocator.h" #include "MuonCondData/CscCondParType.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "string.h" -#include "CscReadWriteCoolStr.h" +#include "AthenaKernel/errorcheck.h" + #include <fstream> #include <bitset> #include <sstream> -#include "AthenaKernel/errorcheck.h" namespace MuonCalib { - CscReadWriteCoolStr::CscReadWriteCoolStr(const std::string& name, - ISvcLocator* pSvcLocator) :AthAlgorithm(name,pSvcLocator), - m_log(msgSvc(),name), - p_detstore(0), - m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), - m_write(false), - m_read(false), - m_ofile("output.cal"), - m_outFileType("04-00"), - m_condDataContainer(NULL) + CscReadWriteCoolStr::CscReadWriteCoolStr(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name,pSvcLocator), + p_detstore(nullptr), + m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), + m_write(false), + m_read(false), + m_ofile("output.cal"), + m_outFileType("04-00"), + m_condDataContainer(nullptr) { declareProperty("Write",m_write); declareProperty("iFiles",m_ifiles); @@ -48,24 +47,10 @@ namespace MuonCalib { StatusCode CscReadWriteCoolStr::initialize() { - m_log << MSG::DEBUG << "CscReadWriteCoolStr::initialize() called" << endmsg; - - if (StatusCode::SUCCESS!=service("DetectorStore",p_detstore)) { - m_log << MSG::FATAL << "Detector store not found" << endmsg; - return StatusCode::FAILURE; - } - if (StatusCode::SUCCESS!=m_cscCoolStrSvc.retrieve()) { - m_log << MSG::FATAL << "Cannot get CscCoolStrSvc" << endmsg; - return StatusCode::FAILURE; - } - - StatusCode sc = m_muonIdHelperTool.retrieve(); - if(sc.isFailure()) - { - m_log << MSG::FATAL << "Cannot retrieve MuonIdHelperTool" << endmsg; - return sc; - } - + ATH_MSG_DEBUG("CscReadWriteCoolStr::initialize() called"); + ATH_CHECK(service("DetectorStore",p_detstore)); + ATH_CHECK(m_cscCoolStrSvc.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -74,7 +59,7 @@ namespace MuonCalib { } StatusCode CscReadWriteCoolStr::finalize() { - m_log << MSG::INFO << "Finalizing CscReadWriteCoolStr." << endmsg; + ATH_MSG_DEBUG("Finalizing CscReadWriteCoolStr."); static int numFinal =0; if(numFinal>0) return StatusCode::SUCCESS; @@ -86,16 +71,15 @@ namespace MuonCalib { } if(m_read) { - m_log <<MSG::DEBUG<< "Creating file" << endmsg; + ATH_MSG_DEBUG("Creating file"); return makeFile(); } return StatusCode::SUCCESS; } StatusCode CscReadWriteCoolStr::readFiles() { - StatusCode sc = StatusCode::SUCCESS; - m_log <<MSG::INFO << "About to insert files" << endmsg; + ATH_MSG_DEBUG("About to insert files"); std::vector<std::string>::const_iterator fItr = m_ifiles.begin(); std::vector<std::string>::const_iterator fEnd = m_ifiles.end(); for(;fItr != fEnd; fItr++) @@ -106,17 +90,17 @@ namespace MuonCalib { if(!procInputStream(/*dynamic_cast<istream*>(ifile)*/ifile).isSuccess()) { sc = StatusCode::RECOVERABLE; - m_log << MSG::ERROR << "Failed processing " << *fItr << endmsg; + ATH_MSG_ERROR("Failed processing " << *fItr); } } else { sc = StatusCode::RECOVERABLE; - m_log << MSG::ERROR << "Failed opening " << *fItr << endmsg; + ATH_MSG_ERROR("Failed opening " << *fItr); } } - m_log <<MSG::INFO << "Finished reading files" << endmsg; + ATH_MSG_DEBUG("Finished reading files"); return sc; } @@ -149,7 +133,7 @@ namespace MuonCalib { //Prevent infinite loop if (i== 1000000 || !input.good()) { - m_log << MSG::FATAL << "Never reached end of header. Went through " << i << "words."<< endmsg; + ATH_MSG_FATAL("Never reached end of header. Went through " << i << "words."); return StatusCode::FAILURE; } } @@ -166,8 +150,7 @@ namespace MuonCalib { if( tag == "<END_FILE>") break; else if ( tag != "<NEW_PAR>"){ - m_log << MSG::ERROR << "Don't recognize tag " << tag << " in this context. " - << endmsg; + ATH_MSG_ERROR("Don't recognize tag " << tag << " in this context. "); return StatusCode::RECOVERABLE; } std::string nextWord; @@ -175,21 +158,21 @@ namespace MuonCalib { if(nextWord == "<BITS>") { input >> nBits; if(nBits > 64){ - m_log << MSG::ERROR << " bad nBits " << nBits << endmsg; + ATH_MSG_ERROR(" bad nBits " << nBits); return StatusCode::RECOVERABLE; } input >> shiftBits; std::string end_bits; input >> end_bits; - m_log << MSG::DEBUG << "We've got nbits: " << nBits - << " and a shift of " << shiftBits << endmsg; + ATH_MSG_DEBUG("We've got nbits: " << nBits + << " and a shift of " << shiftBits); if(end_bits != "<END_BITS>"){ - m_log << MSG::ERROR << "Expected <END_BITS> tag after nBits and shiftBits info" << endmsg; + ATH_MSG_ERROR("Expected <END_BITS> tag after nBits and shiftBits info"); } input >> nextWord; } else - m_log << MSG::DEBUG << "No bit settings for this parameter" << endmsg; + ATH_MSG_DEBUG("No bit settings for this parameter"); std::string parName = nextWord; @@ -203,8 +186,8 @@ namespace MuonCalib { if(!catSc.isSuccess() || !dataTypeSc.isSuccess() || !sizeSc.isSuccess()) { - m_log << MSG::ERROR << "Failed at retrieving info for " << parName - <<". Check job options to ensure you're adding it." << endmsg; + ATH_MSG_ERROR("Failed at retrieving info for " << parName + <<". Check job options to ensure you're adding it."); // failedAny = true; continue; } @@ -221,7 +204,7 @@ namespace MuonCalib { else if(dataType == "bool") CHECK( procParameter3<bool>(input, parName, cat, nBits, shiftBits) ); else - m_log << MSG::ERROR << "Don't recognize dataType " << dataType << " when reading input file " << endmsg; + ATH_MSG_ERROR("Don't recognize dataType " << dataType << " when reading input file "); }//end parameter loop } @@ -231,7 +214,7 @@ namespace MuonCalib { //fileversion 04-01 allows for ASM2 based material if(fileVersion == "04-00" || fileVersion == "04-01"){ - m_log << MSG::DEBUG << "Reading file version 4" << endmsg; + ATH_MSG_DEBUG("Reading file version 4"); //Version 04-00 attempts to be more xml like, although it is still a bit of a poor man's //xml. Items must be in a particular order, and there must be spaces between tags and //their content @@ -248,16 +231,16 @@ namespace MuonCalib { //Prevent infinite loop if (i== 1000000 || !input.good()) { - m_log << MSG::FATAL << "Never reached end of header. Went through " << i << "words."<< endmsg; + ATH_MSG_FATAL("Never reached end of header. Went through " << i << "words."); return StatusCode::FAILURE; } } - m_log << MSG::DEBUG << "About to loop after finding " << junk << endmsg; + ATH_MSG_DEBUG("About to loop after finding " << junk); //Loop over each parameter, then over each value stored in that parameter while(input.good()) { - m_log << MSG::DEBUG << " loop" <<endmsg; + ATH_MSG_DEBUG(" loop"); int nBits = 0; int shiftBits = 0; @@ -268,8 +251,7 @@ namespace MuonCalib { if( tag == "<END_FILE>") break; else if ( tag != "<PARAMETER>"){ - m_log << MSG::ERROR << "Don't recognize tag " << tag << " in this context. " - << endmsg; + ATH_MSG_ERROR("Don't recognize tag " << tag << " in this context. "); return StatusCode::RECOVERABLE; } @@ -277,8 +259,8 @@ namespace MuonCalib { input >> nextWord; std::string parName = nextWord; if(parName == "<BITS>" || parName == "<DATA>"){ - m_log << MSG::ERROR << "First entry insidet a parameter must be parameter name, not " - << parName << endmsg; + ATH_MSG_ERROR("First entry insidet a parameter must be parameter name, not " + << parName); return StatusCode::RECOVERABLE; } @@ -289,15 +271,15 @@ namespace MuonCalib { input >> shiftBits; std::string end_bits; input >> end_bits; - m_log << MSG::DEBUG << "We've got nbits: " << nBits - << " and a shift of " << shiftBits << endmsg; + ATH_MSG_DEBUG("We've got nbits: " << nBits + << " and a shift of " << shiftBits); if(end_bits != "</BITS>"){ - m_log << MSG::ERROR << "Expected </BITS> tag after nBits and shiftBits info" << endmsg; + ATH_MSG_ERROR("Expected </BITS> tag after nBits and shiftBits info"); } input >> nextWord; } else - m_log << MSG::DEBUG << "No bit settings for this parameter" << endmsg; + ATH_MSG_DEBUG("No bit settings for this parameter"); if(nextWord == "<DATA>"){ @@ -311,15 +293,15 @@ namespace MuonCalib { if(!catSc.isSuccess() || !dataTypeSc.isSuccess() || !sizeSc.isSuccess()) { - m_log << MSG::ERROR << "Failed at retrieving info for " << parName - <<". Check job options to ensure you're adding it." << endmsg; + ATH_MSG_ERROR("Failed at retrieving info for " << parName + <<". Check job options to ensure you're adding it."); // failedAny = true; continue; } //Process parameter. Need to know datatype for proper string to data conversion. //Add parameters to - m_log << MSG::INFO << "Processing data for parameter " << parName << endmsg; + ATH_MSG_DEBUG("Processing data for parameter " << parName); if(dataType == "uint32_t") CHECK( procParameter4<uint32_t>(input, parName, cat, nBits, shiftBits)); @@ -330,16 +312,16 @@ namespace MuonCalib { else if(dataType == "bool") CHECK( procParameter4<bool>(input, parName, cat, nBits, shiftBits)); else - m_log << MSG::ERROR << "Don't recognize dataType " << dataType << " when reading input file " << endmsg; + ATH_MSG_ERROR("Don't recognize dataType " << dataType << " when reading input file "); input >> nextWord; } else { - m_log << MSG::ERROR << "No data found for parameter " << parName << endmsg; + ATH_MSG_ERROR("No data found for parameter " << parName); return StatusCode::RECOVERABLE; } if(nextWord != "</PARAMETER>"){ - m_log << MSG::WARNING << "Expected parameter info to end with token " - << "</PARAMETER>" << ". Instead have " << nextWord << endmsg; + ATH_MSG_WARNING("Expected parameter info to end with token " + << "</PARAMETER>" << ". Instead have " << nextWord); } }//end parameter loop @@ -347,8 +329,8 @@ namespace MuonCalib { }//end version test if(!recognizedVersion){ - m_log << MSG::FATAL << "Didn't recognize input format version. If 04-00 make sure you've put <HEADER> (all caps) at front of file!" << endmsg; - m_log << MSG::FATAL << "Read file version as " << fileVersion << endmsg; + ATH_MSG_FATAL("Didn't recognize input format version. If 04-00 make sure you've put <HEADER> (all caps) at front of file!"); + ATH_MSG_FATAL("Read file version as " << fileVersion); return StatusCode::FAILURE; } return StatusCode::SUCCESS; @@ -357,18 +339,18 @@ namespace MuonCalib { StatusCode CscReadWriteCoolStr::writeToCool() { //Send to be added to database - m_log << MSG::INFO << "About to merge and submit data to cool" << endmsg; + ATH_MSG_DEBUG("About to merge and submit data to cool"); return m_cscCoolStrSvc->mergeAndSubmitCondDataContainer(m_condDataContainer); } StatusCode CscReadWriteCoolStr::makeFile() { - m_log << MSG::INFO << "Writing data from database to file " << m_ofile << endmsg; + ATH_MSG_DEBUG("Writing data from database to file " << m_ofile); std::ofstream outFile(m_ofile.c_str()); std::string dataType =""; - IdContext channelContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); if(m_outFileType =="04-00"){ outFile << "<HEADER>\n" << m_outFileType << "\n</HEADER>\n"; @@ -382,12 +364,12 @@ namespace MuonCalib { std::vector<std::string>::const_iterator parNameEnd = m_outParameters.end(); for(;parNameItr != parNameEnd; parNameItr++) { - m_log << MSG::DEBUG << "Storing " << *parNameItr << endmsg; + ATH_MSG_DEBUG("Storing " << *parNameItr); unsigned int numIndx = 0; if(!m_cscCoolStrSvc->getParNumHashes(*parNameItr,numIndx).isSuccess()) { - m_log << MSG::ERROR << "Failed getting num hashes for " - << *parNameItr << endmsg; + ATH_MSG_ERROR("Failed getting num hashes for " + << *parNameItr); return StatusCode::RECOVERABLE; } @@ -396,26 +378,24 @@ namespace MuonCalib { std::string cat; if(!m_cscCoolStrSvc->getParCat(*parNameItr,cat).isSuccess() ){ - m_log << MSG::ERROR << "Failed getting category for " << *parNameItr - << endmsg; + ATH_MSG_ERROR("Failed getting category for " << *parNameItr); } - m_log << MSG::DEBUG << "Category is " << cat << " and maximum index is " <<numIndx-1 - << endmsg; + ATH_MSG_DEBUG("Category is " << cat << " and maximum index is " <<numIndx-1 + ); if(m_forceChanCat) { - m_log << MSG::WARNING << *parNameItr << " of category " << cat << " is being forced to be read as category CHANNEL"<< endmsg; + ATH_MSG_WARNING(*parNameItr << " of category " << cat << " is being forced to be read as category CHANNEL"); cat = "CHANNEL"; } if(!m_cscCoolStrSvc->getParDataType(*parNameItr, dataType)){ - m_log <<MSG::ERROR << "Failed getting data type for " << *parNameItr - << endmsg; + ATH_MSG_ERROR("Failed getting data type for " << *parNameItr); return StatusCode::RECOVERABLE; } - m_log << MSG::INFO << "datatype is " << dataType << endmsg; + ATH_MSG_DEBUG("datatype is " << dataType); if(m_outFileType == "04-00" || m_outFileType == "04-01"){ outFile << "<PARAMETER>\n" << *parNameItr << "\n<DATA>\n"; if(cat == "CHANNEL"){ @@ -424,25 +404,25 @@ namespace MuonCalib { //make sure the database has this value in a way that won't //cause any errors if(!m_cscCoolStrSvc->checkIndex(*parNameItr, indxItr)) { - m_log << MSG::VERBOSE << "nothing at index " << indxItr << endmsg; + ATH_MSG_VERBOSE("nothing at index " << indxItr); continue; } Identifier chanId; - m_muonIdHelperTool->cscIdHelper().get_id((IdentifierHash)indxItr, chanId, &channelContext); - int eta = m_muonIdHelperTool->cscIdHelper().stationEta(chanId); - int phi = m_muonIdHelperTool->cscIdHelper().stationPhi(chanId); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(chanId); - int strip = m_muonIdHelperTool->cscIdHelper().strip(chanId); - int size = m_muonIdHelperTool->cscIdHelper().stationName(chanId);//1 for large, 0 for not - int layer = m_muonIdHelperTool->cscIdHelper().wireLayer(chanId); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)indxItr, chanId, &channelContext); + int eta = m_idHelperSvc->cscIdHelper().stationEta(chanId); + int phi = m_idHelperSvc->cscIdHelper().stationPhi(chanId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(chanId); + int strip = m_idHelperSvc->cscIdHelper().strip(chanId); + int size = m_idHelperSvc->cscIdHelper().stationName(chanId);//1 for large, 0 for not + int layer = m_idHelperSvc->cscIdHelper().wireLayer(chanId); int sector = (phi*2 - size + 50)*eta; std::string data = RetrieveDataAsString( *parNameItr, indxItr, dataType); if(data == "" ){ - m_log << MSG::ERROR << "Failed to retrieve data!" << endmsg; + ATH_MSG_ERROR("Failed to retrieve data!"); return StatusCode::RECOVERABLE; } @@ -479,10 +459,10 @@ namespace MuonCalib { //Retreive data for a single strip in scope, at layer Since and stripSince. All values should be same, so its fine CHECK(m_cscCoolStrSvc->getAsmScope(asmNum, measuresPhi, layerSince, layerUntil, stripSince, stripUntil)); - Identifier chanId = m_muonIdHelperTool->cscIdHelper().channelID(stationName, stationEta, stationPhi, + Identifier chanId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, layerSince, measuresPhi, stripSince); IdentifierHash hash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(chanId, hash); + m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hash); std::string data = RetrieveDataAsString(*parNameItr, (int)hash, dataType); //update file @@ -492,7 +472,7 @@ namespace MuonCalib { } else{ - m_log << MSG::FATAL << "CSC COOL parameter category \"" << cat << "\" is not supported" << endmsg; + ATH_MSG_FATAL("CSC COOL parameter category \"" << cat << "\" is not supported"); return StatusCode::FAILURE; } outFile << "</DATA>\n</PARAMETER>\n"; @@ -504,15 +484,15 @@ namespace MuonCalib { //make sure the database has this value in a way that won't //cause any errors if(!m_cscCoolStrSvc->checkIndex(*parNameItr, indxItr)) { - m_log << MSG::VERBOSE << "nothing at index " << indxItr << endmsg; + ATH_MSG_VERBOSE("nothing at index " << indxItr); continue; } std::string stringId; if(m_outFileType == "03-00"|| m_outFileType== "03-01") { if(!m_cscCoolStrSvc->indexToStringId(indxItr,cat,stringId)) { - m_log << MSG::ERROR << "Failed getting string Id from indxItr " - << indxItr << " for parameter " << *parNameItr << endmsg; + ATH_MSG_ERROR("Failed getting string Id from indxItr " + << indxItr << " for parameter " << *parNameItr); return StatusCode::RECOVERABLE; } } @@ -521,9 +501,9 @@ namespace MuonCalib { std::stringstream ss; Identifier chanId; - m_muonIdHelperTool->cscIdHelper().get_id((IdentifierHash)indxItr, chanId, &channelContext); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)indxItr, chanId, &channelContext); - ss << indxItr << " " << m_muonIdHelperTool->cscIdHelper().show_to_string(chanId); + ss << indxItr << " " << m_idHelperSvc->cscIdHelper().show_to_string(chanId); stringId = ss.str(); @@ -531,13 +511,13 @@ namespace MuonCalib { - m_log << MSG::DEBUG << "index " << indxItr << " converted to string " << stringId << endmsg; + ATH_MSG_DEBUG("index " << indxItr << " converted to string " << stringId); outFile << stringId << " "; std::string data = RetrieveDataAsString( *parNameItr, indxItr, dataType) ; if(data == ""){ - m_log << MSG::ERROR << "Failed to to retrieve data!" << endmsg; + ATH_MSG_ERROR("Failed to to retrieve data!"); return StatusCode::RECOVERABLE; } outFile << data; @@ -559,11 +539,10 @@ namespace MuonCalib { std::bitset<32> newBits(refDatum); std::bitset<32> inputBits(inputDatum); - m_log << MSG::DEBUG << "Merging bits from input " << std::hex << inputDatum << " (with offset of " << bitShift << ") and reference " << std::hex << refDatum << std::dec << endmsg; + ATH_MSG_DEBUG("Merging bits from input " << std::hex << inputDatum << " (with offset of " << bitShift << ") and reference " << std::hex << refDatum << std::dec); if(bitShift + nBits > 32) { - m_log << MSG::ERROR << "Requesting a bit beyond 32 during bit merging. Probably a bug." - << endmsg; + ATH_MSG_ERROR("Requesting a bit beyond 32 during bit merging. Probably a bug."); return StatusCode::FAILURE; } @@ -573,20 +552,20 @@ namespace MuonCalib { } newDatum = newBits.to_ulong(); - m_log << MSG::DEBUG << "Merged version is " << newDatum << endmsg; + ATH_MSG_DEBUG("Merged version is " << newDatum); return StatusCode::SUCCESS; } StatusCode CscReadWriteCoolStr::mergeBits(const int & , const int & , const int & , const int &, const int &){ - m_log << MSG::ERROR << "Tried to merge bits of an int" << endmsg; + ATH_MSG_ERROR("Tried to merge bits of an int"); return StatusCode::FAILURE; } StatusCode CscReadWriteCoolStr::mergeBits(const float & , const float & , const float & , const int &, const int &) { - m_log << MSG::ERROR << "Tried to merge bits of a float" << endmsg; + ATH_MSG_ERROR("Tried to merge bits of a float"); return StatusCode::FAILURE; } @@ -596,8 +575,8 @@ namespace MuonCalib { { uint32_t datum; if(!m_cscCoolStrSvc->getParameter(datum,coolKey,hash)){ - m_log << MSG::ERROR << "Failed to retrieve data for key " << coolKey - << " data type " << dataType << endmsg; + ATH_MSG_ERROR("Failed to retrieve data for key " << coolKey + << " data type " << dataType); } stream << datum; } @@ -605,8 +584,8 @@ namespace MuonCalib { { int datum; if(!m_cscCoolStrSvc->getParameter(datum,coolKey,hash)){ - m_log << MSG::ERROR << "Failed to retrieve data for key " << coolKey - << " data type " << dataType << endmsg; + ATH_MSG_ERROR("Failed to retrieve data for key " << coolKey + << " data type " << dataType); } else stream << datum; @@ -616,8 +595,8 @@ namespace MuonCalib { //std::cout << "Getting float datatype" << std::endl; float datum; if(!m_cscCoolStrSvc->getParameter(datum,coolKey,hash)){ - m_log << MSG::ERROR << "Failed to retrieve data for key " << coolKey - << " data type " << dataType << endmsg; + ATH_MSG_ERROR("Failed to retrieve data for key " << coolKey + << " data type " << dataType); } else stream << datum; @@ -627,15 +606,15 @@ namespace MuonCalib { //std::cout << "Getting bool datatype" << std::endl; bool datum; if(!m_cscCoolStrSvc->getParameter(datum,coolKey,hash)){ - m_log << MSG::ERROR << "Failed to retrieve data for key " << coolKey - << " data type " << dataType << endmsg; + ATH_MSG_ERROR("Failed to retrieve data for key " << coolKey + << " data type " << dataType); } else stream << datum; } else { - m_log << MSG::ERROR << "don't know datatype " << dataType << endmsg; + ATH_MSG_ERROR("don't know datatype " << dataType); } return stream.str(); diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.h index 9cdf0545615211021e1f514fd20469baca9d195c..03530eda5a151ba1dda19ced5612c949ac61be8f 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.h @@ -1,35 +1,29 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDCOOL_CSCREADWRITECOOLSTR_H #define MUONCONDCOOL_CSCREADWRITECOOLSTR_H + /** CscReadWriteCoolStrFile - simple algorithm to demonstrate reading/writing of string objects stored in COOL via CoolStrFileSvc*/ - -#include <string> -#include <fstream> -#include <istream> #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "StoreGate/DataHandle.h" #include "MuonCondData/CscCondDataCollection.h" #include "MuonCondData/CscCondDataContainer.h" - #include "MuonCondInterface/CscICoolStrSvc.h" #include "AthenaKernel/errorcheck.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include <string> +#include <fstream> +#include <istream> -class StoreGateSvc; namespace MuonCalib { - class CscICoolStrSvc; /** @class CscReadWriteCoolStr @@ -73,24 +67,17 @@ namespace MuonCalib { /**Retrieves data from cool database and adds to stream*/ std::string RetrieveDataAsString(std::string coolKey, int hash, std::string dataType); - //StatusCode getIndex(const std::string & idString, const std::string & cat,unsigned int & index ) const; - StatusCode writeToCool(); StatusCode makeFile(); private: - MsgStream m_log; StoreGateSvc* p_detstore; ServiceHandle<MuonCalib::CscICoolStrSvc> m_cscCoolStrSvc; bool m_forceChanCat; - - // properties bool m_write; std::vector<std::string> m_ifiles; - // methods - bool m_read; std::string m_ofile; std::string m_outFileType; @@ -99,10 +86,7 @@ namespace MuonCalib { CscCondDataContainer * m_condDataContainer; std::map<std::string, CscCondDataCollectionBase *> m_condDataMap; - /**CscIdHelper is used to convert from identifiers to hash ids. MuonDetector manager is a - requirement on CscIdHelper*/ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.icc b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.icc index dd8bcf05a1dcf7439477069c35daf9e6cb609ef7..6f08f86d153e187063649de2514fbb370571b643 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.icc +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondCool/src/CscReadWriteCoolStr.icc @@ -15,7 +15,6 @@ */ #include "MuonCondData/CscCondDataCollection.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "AthenaKernel/errorcheck.h" namespace MuonCalib { @@ -23,7 +22,7 @@ namespace MuonCalib { template<typename data_type> StatusCode CscReadWriteCoolStr::procParameter3(std::istream & input, const std::string & name, const std::string & cat, const int & nBits, const int & shiftBits) { - m_log << MSG::INFO << "Processing parameter " << name << " for entry to CSC COOL database. Using version 3 processing" << endmsg; + ATH_MSG_INFO("Processing parameter " << name << " for entry to CSC COOL database. Using version 3 processing"); //Retrieve collection of this parameter if we have seen it before. //Create new one if we have. @@ -70,8 +69,7 @@ namespace MuonCalib { if(!coll) { - m_log << MSG::ERROR << "Collection is NULL in procParameter! This is a bug!" - << endmsg; + ATH_MSG_ERROR("Collection is NULL in procParameter! This is a bug!"); return StatusCode::RECOVERABLE; } @@ -85,7 +83,7 @@ namespace MuonCalib { input >> std::hex >> idString >> std::dec; - m_log << MSG::VERBOSE << "storing id " << idString << endmsg; + ATH_MSG_VERBOSE("storing id " << idString); //Check if at end of this parameter if(idString == "<END_PAR>") @@ -94,22 +92,22 @@ namespace MuonCalib { unsigned int index; if(!m_cscCoolStrSvc->stringIdToIndex(idString, cat, index).isSuccess()) { - m_log << MSG::ERROR << "Failed at forming index from " << idString << endmsg; + ATH_MSG_ERROR("Failed at forming index from " << idString); return StatusCode::RECOVERABLE; } - m_log << MSG::DEBUG << "Reading index " << index << " (calculated from " << idString - << ")" << endmsg; + ATH_MSG_DEBUG("Reading index " << index << " (calculated from " << idString + << ")"); if(index >= coll->getSize()){ - m_log << MSG::ERROR << "Index " << index << " is above maximum of " - << coll->getSize() -1 << endmsg; + ATH_MSG_ERROR("Index " << index << " is above maximum of " + << coll->getSize() -1); return StatusCode::RECOVERABLE; } input >> datum; - m_log << MSG::VERBOSE << "Storing datum " << datum - << " at index " << index << endmsg; + ATH_MSG_VERBOSE("Storing datum " << datum + << " at index " << index); if(nBits >0) { data_type refDatum; @@ -127,10 +125,10 @@ namespace MuonCalib { CscCondData<data_type> * condData = new CscCondData<data_type>(datum); - if( (*coll)[index] != NULL && nBits <=0) + if( (*coll)[index] && nBits <=0) { - m_log << MSG::WARNING << "Writing to same index more than once (" << index - << ") with value of " << datum << ". Overwriting previous value." << endmsg; + ATH_MSG_WARNING("Writing to same index more than once (" << index + << ") with value of " << datum << ". Overwriting previous value."); } //Datavector will automatically delete old entry if its there @@ -143,7 +141,7 @@ namespace MuonCalib { template<typename data_type> StatusCode CscReadWriteCoolStr::procParameter4(std::istream & input, const std::string & name, const std::string & cat, const int & nBits, const int & shiftBits) { - m_log << MSG::INFO << "Processing parameter " << name << " for entry to CSC COOL database. Using version 4 processing" << endmsg; + ATH_MSG_INFO("Processing parameter " << name << " for entry to CSC COOL database. Using version 4 processing"); //Retrieve collection of this parameter if we have seen it before. //Create new one if we have. @@ -190,8 +188,7 @@ namespace MuonCalib { if(!coll) { - m_log << MSG::ERROR << "Collection is NULL in procParameter! This is a bug!" - << endmsg; + ATH_MSG_ERROR("Collection is NULL in procParameter! This is a bug!"); return StatusCode::RECOVERABLE; } @@ -211,7 +208,7 @@ namespace MuonCalib { if(cat != "CHANNEL" && cat != "ASM"){ //since we are assuming index = hash Id, we don't know what to do if we get //a parameter that isn't one value per channel - m_log << MSG::FATAL << " category " << cat << " is not yet supported for input file type 04-00" << endmsg; + ATH_MSG_FATAL(" category " << cat << " is not yet supported for input file type 04-00"); return StatusCode::FAILURE; } @@ -252,28 +249,28 @@ namespace MuonCalib { else if(direction == 'Y' || direction == 'y') measuresPhi = 1; else{ - m_log << MSG::FATAL << "Direction " << direction << " isn't valid!" << endmsg; + ATH_MSG_FATAL("Direction " << direction << " isn't valid!"); return StatusCode::FAILURE; } - m_log << MSG::DEBUG << "looking up channel id for sector " << sector << " stationName " << stationName << " stationEta " << stationEta << " stationPhi " << stationPhi << " chamberLayer " << chamberLayer << " wireLayer " << wireLayer << " measuresPhi " << measuresPhi << " channel " << channel << endmsg; + ATH_MSG_DEBUG("looking up channel id for sector " << sector << " stationName " << stationName << " stationEta " << stationEta << " stationPhi " << stationPhi << " chamberLayer " << chamberLayer << " wireLayer " << wireLayer << " measuresPhi " << measuresPhi << " channel " << channel); - Identifier chanId = m_muonIdHelperTool->cscIdHelper().channelID(stationName, stationEta, stationPhi, + Identifier chanId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, wireLayer, measuresPhi, channel); IdentifierHash hash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(chanId, hash); + m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hash); unsigned int index = (int)hash; - m_log << MSG::DEBUG << "Reading index " << index << endmsg; + ATH_MSG_DEBUG("Reading index " << index); if(index >= coll->getSize()){ - m_log << MSG::ERROR << "Index " << index << " is above maximum of " - << coll->getSize() -1 << endmsg; + ATH_MSG_ERROR("Index " << index << " is above maximum of " + << coll->getSize() -1); return StatusCode::RECOVERABLE; } - m_log << MSG::VERBOSE << "Storing datum " << datum - << " at index " << index << endmsg; + ATH_MSG_VERBOSE("Storing datum " << datum + << " at index " << index); if(nBits >0) { data_type refDatum; @@ -292,10 +289,10 @@ namespace MuonCalib { //Store value in CSC Conditions data handle //(Values stored this way rather than raw in vector to allow data_type independant vectors of CscCondDataBase) CscCondData<data_type> * condData = new CscCondData<data_type>(datum); - if( (*coll)[index] != NULL && nBits <=0) + if( (*coll)[index] && nBits <=0) { - m_log << MSG::WARNING << "Writing to same index more than once (" << index - << ") with value of " << datum << ". Overwriting previous value." << endmsg; + ATH_MSG_WARNING("Writing to same index more than once (" << index + << ") with value of " << datum << ". Overwriting previous value."); } //Datavector will automatically delete old entry if its there @@ -340,10 +337,10 @@ namespace MuonCalib { //loop through all strips this ASM covers for(int layer_i = layerSince; layer_i < layerUntil; layer_i++){ for(int strip_i = stripSince; strip_i < stripUntil ; strip_i++){ - Identifier chanId = m_muonIdHelperTool->cscIdHelper().channelID(stationName, stationEta, stationPhi, + Identifier chanId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, layer_i, measuresPhi, strip_i); IdentifierHash hash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(chanId, hash); + m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hash); //assuming hashId = index int index = hash; @@ -366,10 +363,10 @@ namespace MuonCalib { //Store value in CSC Conditions data handle //(Values stored this way rather than raw in vector to allow data_type independant vectors of CscCondDataBase) CscCondData<data_type> * condData = new CscCondData<data_type>(datum); - if( (*coll)[index] != NULL && nBits <=0) + if( (*coll)[index] && nBits <=0) { - m_log << MSG::WARNING << "Writing to same index more than once (" << index - << ") with value of " << datum << ". Overwriting previous value." << endmsg; + ATH_MSG_WARNING("Writing to same index more than once (" << index + << ") with value of " << datum << ". Overwriting previous value."); } //Datavector will automatically delete old entry if its there diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx index be55fad48f08c638b3f858b16533a73983c37d14..b6631b4fae9ffa56f0728cc2b21f19115e6ff502 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx @@ -6,6 +6,7 @@ #include "MuonIdHelpers/CscIdHelper.h" #include "AthenaKernel/getMessageSvc.h" #include "GaudiKernel/MsgStream.h" +#include <atomic> // constructor CscCondDbData::CscCondDbData() : @@ -44,8 +45,6 @@ CscCondDbData::loadParameters(const CscIdHelper* idHelper){ //prepare layer hash array int hash = 0; - MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); - for(int stationName = 0; stationName < 2; stationName++){ for(int stationEta =0; stationEta <2; stationEta++){ for(int stationPhi = 0; stationPhi <8; stationPhi++){ @@ -62,6 +61,7 @@ CscCondDbData::loadParameters(const CscIdHelper* idHelper){ ); unsigned int onlineId; if(!offlineToOnlineId(idHelper, id, onlineId).isSuccess()) { + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::WARNING << "Failed at geting online id!" << endmsg; } else { @@ -73,7 +73,6 @@ CscCondDbData::loadParameters(const CscIdHelper* idHelper){ } } } - log << MSG::INFO << "Maximum Layer hash is " << hash-1 << endmsg; // -1 because hash overshoots in loop } @@ -375,7 +374,6 @@ CscCondDbData::isGoodStation(const Identifier & Id) const{ StatusCode CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & index, const std::string & cat, std::string & idString) const { // copy-paste from CscCoolStrSvc - MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); //There is no string id for the CSC category. if(cat == "CSC") { @@ -388,6 +386,7 @@ CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & if(index == 1) idString = "1"; else { + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::INFO << "Requested index " << index << " can't be converted to a string Id for the category " << cat << endmsg; return StatusCode::RECOVERABLE; } @@ -400,6 +399,7 @@ CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & Identifier chamberId; idHelper->get_id(IdentifierHash(index), chamberId, &m_moduleContext); if(!offlineElementToOnlineId(idHelper, chamberId, onlineId).isSuccess()) { + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::INFO << "Failed converting chamber identifier to online id during stringId gen." << endmsg; return StatusCode::RECOVERABLE; } @@ -407,6 +407,7 @@ CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & else if(cat == "LAYER"){ unsigned int onlineId; if(!layerHashToOnlineId(index, onlineId)){ + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::INFO << "Failed at getting online id from layer hash during stringId gen." << endmsg; } } @@ -414,6 +415,7 @@ CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & Identifier channelId; idHelper->get_id(IdentifierHash(index), channelId, &m_channelContext); if(!offlineToOnlineId(idHelper, channelId, onlineId).isSuccess()) { + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::INFO << "Failed converting chamber identifier to online id during stringId gen." << endmsg; return StatusCode::RECOVERABLE; } @@ -532,10 +534,10 @@ CscCondDbData::onlineToOfflineIds(const CscIdHelper* idHelper, const unsigned in // CSCCool database contains still all CSCs. A clean fix would be to have a dedicated database for every layout. bool isValid = true; channelId = idHelper->channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip,true,&isValid); - static bool conversionFailPrinted = false; - MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); + static std::atomic<bool> conversionFailPrinted = false; if (!isValid) { if (!conversionFailPrinted) { + MsgStream log(Athena::getMessageSvc(),"CscCondDbData"); log << MSG::WARNING << "Failed to retrieve offline Identifier from online Identifier " << onlineId << " (station " << stationName << ", eta=" << eta << ", phi=" << phi << "). " << "This is likely due to the fact that the CSCCool database contains " diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface/MuonCondInterface/IRPCConditionsSvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface/MuonCondInterface/IRPCConditionsSvc.h index 84b3f541758f3b2161543187ffc27ebf32a116ee..d2d0efd0a519e2005ae91cffb6dcb18228297bc8 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface/MuonCondInterface/IRPCConditionsSvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface/MuonCondInterface/IRPCConditionsSvc.h @@ -1,24 +1,23 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //vitrual interface for all the Muon RPC technologies -// + #ifndef IRPCConditionsSvc_h #define IRPCConditionsSvc_h -//Gaudi Includes + #include "GaudiKernel/IInterface.h" +#include "AthenaKernel/IOVSvcDefs.h" -//STL includes #include <list> #include <string> -#include "AthenaKernel/IOVSvcDefs.h" -//forward declarations +#include <vector> +#include <map> + class Identifier; -class IdentifierHash; class StatusCode; - class IRPCConditionsSvc: virtual public IInterface{ public: virtual ~IRPCConditionsSvc(){} diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/CSCCondSummarySvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/CSCCondSummarySvc.h index 4cfeb58bc65b2badfff667516dbcee5666becf78..7774bf0f676f5ee07bc7a0a5b6b60f78fcab8c40 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/CSCCondSummarySvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/CSCCondSummarySvc.h @@ -1,53 +1,34 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_CSCCONDSUMMARYSVC_H #define MUONCONDSVC_CSCCONDSUMMARYSVC_H -//STL includes + #include <string> #include <set> - #include <vector> -//Gaudi Includes +#include "MuonCondInterface/ICSCConditionsSvc.h" #include "AthenaBaseComps/AthService.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -//local includes #include "MuonCondSvc/MuonHierarchy.h" -#include "MuonCondInterface/ICSCConditionsSvc.h" -//Gaudi includes -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ServiceHandle.h" #include "StoreGate/DataHandle.h" #include "StoreGate/StoreGateSvc.h" - -//Athena includes -#include "Identifier/Identifier.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -//forward declarations template <class TYPE> class SvcFactory; class ISvcLocator; -class IdentifierHash; -class StatusCode; - -class Identifier; -class ICSCConditionsSvc; - -class CSCCondSummarySvc: virtual public ICSCConditionsSvc, public AthService{ +class CSCCondSummarySvc: virtual public ICSCConditionsSvc, public AthService { friend class SvcFactory<CSCCondSummarySvc>; public: CSCCondSummarySvc( const std::string & name, ISvcLocator* svc); - virtual ~CSCCondSummarySvc(){} + virtual ~CSCCondSummarySvc()=default; virtual StatusCode initialize(); - virtual StatusCode finalize(); virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); static const InterfaceID & interfaceID(); @@ -73,12 +54,10 @@ public: //StringArrayProperty m_reportingServices; //!< list of services to be used ServiceHandleArray<ICSCConditionsSvc> m_reportingServices; //!< list of services to be used - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::vector<Identifier> m_emptyId; std::vector<std::string> m_empty; - const CscIdHelper * m_cscHelper; ServiceHandle<StoreGateSvc> m_detStore; bool m_noReports; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/MDTCondSummarySvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/MDTCondSummarySvc.h index 3106150fce3dddbcc3e90d15a66a71b7128dc5b7..713805f1f93bd414f847222e626aaca6ecfe4acc 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/MDTCondSummarySvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/MDTCondSummarySvc.h @@ -1,65 +1,38 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_MDTCONDSUMMARYSVC_H #define MUONCONDSVC_MDTCONDSUMMARYSVC_H -//STL includes + #include <string> #include <set> - #include <vector> -//Gaudi Includes +#include "MuonCondInterface/IMDTConditionsSvc.h" #include "AthenaBaseComps/AthService.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -//local includes #include "MuonCondSvc/MuonHierarchy.h" - -#include "MuonCondInterface/IMDTConditionsSvc.h" #include "MuonCondInterface/IMDT_DCSConditionsSvc.h" #include "MuonCondInterface/IMDT_DCSConditionsRun2Svc.h" -//Gaudi includes -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ServiceHandle.h" #include "StoreGate/DataHandle.h" #include "StoreGate/StoreGateSvc.h" - -//Athena includes -#include "Identifier/Identifier.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - - - - -//forward declarations template <class TYPE> class SvcFactory; -class ISvcLocator; -class IdentifierHash; -class StatusCode; - -class Identifier; -class IMDTConditionsSvc; -class IMDT_DCSConditionsSvc; -class IMDT_DCSConditionsRun2Svc; - class MDTCondSummarySvc: virtual public IMDTConditionsSvc, public AthService{ friend class SvcFactory<MDTCondSummarySvc>; public: MDTCondSummarySvc( const std::string & name, ISvcLocator* svc); - virtual ~MDTCondSummarySvc(){} + virtual ~MDTCondSummarySvc()=default; virtual StatusCode initialize(); - virtual StatusCode finalize(); virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); static const InterfaceID & interfaceID(); - virtual StatusCode initInfo(IOVSVC_CALLBACK_ARGS_P(I,keys)); StatusCode update_MDT(IOVSVC_CALLBACK_ARGS_P(I,keys)); @@ -85,13 +58,10 @@ private: std::vector<Identifier> m_emptyId; std::vector<std::string> m_empty; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<StoreGateSvc> m_detStore; - bool m_noReports; //compare method for the binary search diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RPCCondSummarySvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RPCCondSummarySvc.h index b37b4261c0433ad40c7ef3566a6b192bb423d909..cbcb2140ce11cef934c9b09a98bd5d1837a96aef 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RPCCondSummarySvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RPCCondSummarySvc.h @@ -1,51 +1,33 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_RPCCONDSUMMARYSVC_H #define MUONCONDSVC_RPCCONDSUMMARYSVC_H -//STL includes -#include <string> -#include <set> -#include <vector> -//Gaudi includes + +#include "MuonCondInterface/IRPCConditionsSvc.h" #include "AthenaBaseComps/AthService.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" -#include "StoreGate/StoreGateSvc.h" -//Athena includes -#include "Identifier/Identifier.h" +#include "StoreGate/DataHandle.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" - -//local includes -//#include "MuonCondInterface/IMuonConditionsSvc.h" #include "MuonCondSvc/MuonHierarchy.h" -#include "MuonCondInterface/IRPCConditionsSvc.h" #include "MuonCondInterface/IRPC_STATUSConditionsSvc.h" #include "MuonCondInterface/IRPC_DCSConditionsSvc.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include <set> //forward declarations template <class TYPE> class SvcFactory; -class ISvcLocator; -class IdentifierHash; -class StatusCode; -class IRPCConditionsSvc; -class IRPC_STATUSConditionsSvc; -class IRPC_DCSConditionsSvc; class RPCCondSummarySvc: virtual public IRPCConditionsSvc, public AthService{ friend class SvcFactory<RPCCondSummarySvc>; public: RPCCondSummarySvc( const std::string & name, ISvcLocator* svc); - virtual ~RPCCondSummarySvc(){} + virtual ~RPCCondSummarySvc()=default; virtual StatusCode initialize(); - virtual StatusCode finalize(); virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); static const InterfaceID & interfaceID(); @@ -90,8 +72,7 @@ public: private: ServiceHandleArray<IRPCConditionsSvc> m_reportingServices; //!< list of services to be used - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<StoreGateSvc> m_detStore; ServiceHandle<IRPC_STATUSConditionsSvc> m_rpc_StatusSvc ; ServiceHandle<IRPC_DCSConditionsSvc> m_rpc_DCSSvc ; @@ -99,9 +80,6 @@ private: bool m_noReports; std::vector<Identifier> m_emptyId; std::vector<std::string> m_empty; - - - //compare method for the binary search static bool Compare(const Identifier &a, const Identifier &b) {return (a>b);} diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h index 2175b433230045cadd6b4ba6428043fb6d9f90a8..632bd4496215f2a7a29656371b35fe08d1b0768c 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h @@ -4,48 +4,31 @@ #ifndef MUONCONDSVC_RPCCOOLSTRSVC_H #define MUONCONDSVC_RPCCOOLSTRSVC_H + /**RpcCoolStrSvc - Class with methods for reading and writing to cool databae*/ -#include <vector> -#include <string> -#include <fstream> +#include "MuonCondInterface/RpcICoolStrSvc.h" +#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/Service.h" -#include "GaudiKernel/MsgStream.h" -#include "StoreGate/StoreGate.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/StoreGateSvc.h" #include "StoreGate/DataHandle.h" #include "GaudiKernel/IInterface.h" -#include "AthenaBaseComps/AthService.h" - - -//Added for attribute list declarations (might not need all of these) #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" - -//Added to use RpcIdHelper #include "Identifier/Identifier.h" -//#include "MuonGeoModel/MuonDetectorManager.h" -// temporary includes to access CLOBs -//#include "CoolKernel/ExtendedAttributeListSpecification.h" -//#include "CoolKernel/PredefinedStorageHints.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -//Calib conditions data classes #include "MuonCondData/RpcCondParType.h" #include "MuonCondData/RpcCalibData.h" #include "MuonCondData/RpcOnlineDBEntry.h" #include "MuonCondData/RpcCalibDataContainer.h" -#include "MuonCondInterface/RpcICoolStrSvc.h" +#include <vector> +#include <string> +#include <fstream> -class RpcIdHelper; template <class TYPE> class SvcFactory; -namespace MuonCalib { +namespace MuonCalib { /** @class RpcCoolStrSvc @@ -64,15 +47,12 @@ namespace MuonCalib { public: RpcCoolStrSvc(const std::string& name, ISvcLocator* svc); - virtual ~RpcCoolStrSvc(); + virtual ~RpcCoolStrSvc()=default; virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface); virtual const InterfaceID& type() const; - - virtual StatusCode initialize(); - virtual StatusCode finalize(); /**putFile copies data from a calibration file to the database. @param filename The name of the file to copy from. @@ -92,36 +72,15 @@ namespace MuonCalib { virtual StatusCode makeOnlineFile(const std::string filename) const; private: - - //Private Data Members: - /**p_detstore hold a pointer to the transient data storage*/ StoreGateSvc* p_detstore; - - - /**RpcIdHelper is used to convert from identifiers to hash ids. MuonDetector manager is a - requirement on RpcIdHelper*/ - mutable std::vector<const RpcCalibDBEntry*> m_theEntries; mutable std::vector<const RpcOnlineDBEntry*> m_theOnlineEntries; - - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - - // const MuonGM::MuonDetectorManager * m_muonMgr; - - /// Conditions Attribute List collections used for getting datahandles for callback functions*/ - // const CondAttrListCollection* m_runAtrColl; - // const CondAttrListCollection* m_pulserAtrColl; - /**m_log used for sending messages*/ - mutable MsgStream m_log; /**Cool folder name*/ std::string m_folder; - bool m_debugLevel; - virtual StatusCode writeToDB() const; virtual StatusCode writeToOnlineDB() const; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/TGCCondSummarySvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/TGCCondSummarySvc.h index a383b0f4e298214e060cdc0043009ff9c9436939..e73ddccdadc3ee70d95f841404151520ef6f49d0 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/TGCCondSummarySvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/TGCCondSummarySvc.h @@ -1,72 +1,46 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_TGCCONDSUMMARYSVC_H #define MUONCONDSVC_TGCCONDSUMMARYSVC_H -//STL includes + #include <string> #include <set> - #include <vector> -//Gaudi Includes +#include "MuonCondInterface/ITGCConditionsSvc.h" #include "AthenaBaseComps/AthService.h" #include "GaudiKernel/ServiceHandle.h" -//local includes #include "MuonCondSvc/MuonHierarchy.h" -//#include "MuonCondInterface/IMuonConditionsSvc.h" -#include "MuonCondInterface/ITGCConditionsSvc.h" -//Gaudi includes -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ServiceHandle.h" #include "StoreGate/DataHandle.h" -#include "StoreGate/StoreGateSvc.h" - -//Athena includes #include "Identifier/Identifier.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" template <class TYPE> class SvcFactory; -class ISvcLocator; -class IdentifierHash; -class TgcIdHelper; -class StatusCode; - -class Identifier; -class ITGCConditionsSvc; - class TGCCondSummarySvc: virtual public ITGCConditionsSvc, public AthService{ friend class SvcFactory<TGCCondSummarySvc>; public: TGCCondSummarySvc( const std::string & name, ISvcLocator* svc); - virtual ~TGCCondSummarySvc(){} + virtual ~TGCCondSummarySvc()=default; virtual StatusCode initialize(); - virtual StatusCode finalize(); virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); static const InterfaceID & interfaceID(); virtual StatusCode initInfo(IOVSVC_CALLBACK_ARGS_P(I,keys)); StatusCode update_TGC(IOVSVC_CALLBACK_ARGS_P(I,keys)); - // virtual bool isActive(const Identifier & elementId, const MuonConditions::Hierarchy h=MuonConditions::DEFAULT); - //virtual bool isActive(const IdentifierHash & elementHash); virtual bool isGoodChamber(const Identifier & Id); - - virtual const std::vector<Identifier> &deadStationsId(); - - + private: ServiceHandleArray<ITGCConditionsSvc> m_reportingServices; //!< list of services to be used - std::vector<Identifier> m_emptyId; - const TgcIdHelper * m_pHelper; ServiceHandle<StoreGateSvc> m_detStore; bool m_noReports; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CSCCondSummarySvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CSCCondSummarySvc.cxx index a10f651560b6d3d7c9dd422c483de76dd2174410..2fdf4ff622b711b258a0c776676c6937ea3bb5f3 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CSCCondSummarySvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CSCCondSummarySvc.cxx @@ -3,24 +3,18 @@ */ #include "MuonCondSvc/CSCCondSummarySvc.h" + #include <vector> #include <list> #include <algorithm> #include <sstream> #include <iterator> -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/StatusCode.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonCondInterface/ICSCConditionsSvc.h" -#include "Identifier/Identifier.h" CSCCondSummarySvc::CSCCondSummarySvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), m_reportingServices(name), m_detStore("DetectorStore",name), - m_noReports(true){ - // m_reportingServices.push_back("CSC_DCSConditionsSvc"); + m_noReports(true) { declareProperty("ConditionsServices",m_reportingServices); declareProperty("DetStore", m_detStore); declareProperty("UseSimulation",m_usesimulation=false); @@ -29,63 +23,36 @@ CSCCondSummarySvc::CSCCondSummarySvc( const std::string& name, ISvcLocator* pSvc StatusCode CSCCondSummarySvc::initialize(){ - StatusCode sc(StatusCode::FAILURE); m_noReports = m_reportingServices.empty(); - - sc = m_detStore.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "DetectorStore service not found !" << endmsg; - return sc; - } else { - msg(MSG::INFO) << "DetectorStore service found !" << endmsg; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_detStore.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); if(m_usesimulation) { - m_reportingServices.empty(); - msg(MSG::INFO) << "Simulation setup: No Conditions Data for CSC !" << endmsg; - - } else msg(MSG::INFO) << "Data DCS Conditions CSC !" << endmsg; + ATH_MSG_DEBUG("Simulation setup: No Conditions Data for CSC !"); + } else ATH_MSG_DEBUG("Data DCS Conditions CSC !"); if (m_noReports){ - sc=StatusCode::SUCCESS; - msg(MSG::INFO)<<"No services were selected for the CSC summary"<<endmsg; + ATH_MSG_DEBUG("No services were selected for the CSC summary"); } else { - sc = m_reportingServices.retrieve(); - if ( sc.isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve " << m_reportingServices << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_reportingServices.retrieve()); ServiceHandleArray<ICSCConditionsSvc>::const_iterator pSvc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator pLastSvc= m_reportingServices.end(); for (;pSvc not_eq pLastSvc; ++pSvc){ const std::string& svcName = pSvc->name(); - msg(MSG::INFO)<<"Using "<< svcName << endmsg; + ATH_MSG_DEBUG("Using "<< svcName); if (m_detStore->regFcn(&ICSCConditionsSvc::initInfo,&**pSvc, &CSCCondSummarySvc::update_CSC,this) != StatusCode::SUCCESS){ - msg(MSG::WARNING)<<"Unable to register call back for "<<svcName<<endmsg; + ATH_MSG_WARNING("Unable to register call back for "<<svcName); } else { - msg(MSG::INFO)<<"initInfo registered for call-back for "<<svcName<<endmsg; + ATH_MSG_DEBUG("initInfo registered for call-back for "<<svcName); } } } - return sc; -} - - - -//Finalize -StatusCode -CSCCondSummarySvc::finalize(){ - msg(MSG::INFO)<<"Thank-you for using the CSCCondSummarySvc, version "<<PACKAGE_VERSION<<endmsg; - //Code return StatusCode::SUCCESS; } - StatusCode CSCCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { @@ -100,27 +67,20 @@ CSCCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) } StatusCode CSCCondSummarySvc::update_CSC(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::INFO)<<"Register Call Back for CSC System"<<endmsg; - - return StatusCode::SUCCESS; + ATH_MSG_DEBUG("Register Call Back for CSC System"); + return StatusCode::SUCCESS; } StatusCode CSCCondSummarySvc::initInfo(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::INFO)<<"Not to be called just dummy"<<endmsg; - return StatusCode::SUCCESS; + ATH_MSG_DEBUG("Not to be called just dummy"); + return StatusCode::SUCCESS; } bool CSCCondSummarySvc::isGoodWireLayer(const Identifier & Id) const{ bool result=true; // check ID - - Identifier ChamberId = m_muonIdHelperTool->cscIdHelper().elementID(Id); - - // Identifier WireLayerId = m_muonIdHelperTool->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1); - + Identifier ChamberId = m_idHelperSvc->cscIdHelper().elementID(Id); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -129,15 +89,6 @@ bool CSCCondSummarySvc::isGoodWireLayer(const Identifier & Id) const{ bool found = std::binary_search((*svc)->deadStationsId().begin(),(*svc)->deadStationsId().end(),ChamberId,Compare); if(found) result= false; } - - // if ((*svc)->deadWireLayersId().size()!=0 && result==true){ -// bool found = std::binary_search((*svc)->deadWireLayersId().begin(),(*svc)->deadWireLayersId().end(),WirelayerId,Compare); -// if(found) result= false; -// } -// else{ -// msg(MSG::INFO)<<" Dead Wirelayer from the service are not availables "<<(*svc) <<endmsg; - -// } } } @@ -145,14 +96,9 @@ bool CSCCondSummarySvc::isGoodWireLayer(const Identifier & Id) const{ return result; } - - - bool CSCCondSummarySvc::isGood(const Identifier & Id) const{ bool total_result = true; -// int counter=0; -// Identifier WirelayerId = m_muonIdHelperTool->cscIdHelper().multilayerID(Id); - Identifier ChamberId = m_muonIdHelperTool->cscIdHelper().elementID(Id); + Identifier ChamberId = m_idHelperSvc->cscIdHelper().elementID(Id); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -160,21 +106,14 @@ bool CSCCondSummarySvc::isGood(const Identifier & Id) const{ for (;svc not_eq lastSvc;++svc){ if ((*svc)->deadStationsId().size()!=0) { - msg(MSG::VERBOSE)<<" dentro chamber dropped "<<endmsg; + ATH_MSG_VERBOSE(" dentro chamber dropped "); bool found = std::binary_search( (*svc)->deadStationsId().begin(),(*svc)->deadStationsId().end(),ChamberId,Compare); if(found) total_result = false; - msg(MSG::VERBOSE)<<" Chamber Dropped by DCS or not installed at all "<<endmsg; - -// }else if ((*svc)->deadWireLayersId().size()!=0){ - -// bool found = std::binary_search( -// (*svc)->deadWireLayersId().begin(),(*svc)->deadWireLayersId().end(),WirelayerId,Compare); -// if(found) total_result= false; -// msg(MSG::VERBOSE)<<" Chamber with WireLayer Dropped "<<endmsg; - + ATH_MSG_VERBOSE(" Chamber Dropped by DCS or not installed at all "); + }else total_result = true; - msg(MSG::VERBOSE)<<"Thank-you for using the CSCCondSummarySvc, service "<<endmsg; + ATH_MSG_VERBOSE("Thank-you for using the CSCCondSummarySvc, service "); } } @@ -185,11 +124,10 @@ bool CSCCondSummarySvc::isGood(const Identifier & Id) const{ bool CSCCondSummarySvc::isGoodChamber(const Identifier & Id) const{ bool result=true; int counter =0; - //Identifier chamberId = m_muonIdHelperTool->cscIdHelper().elementID(Id); ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); for (;svc not_eq lastSvc;svc++){ - msg(MSG::INFO)<<" Dead Stations from the service , size= "<<(*svc)->deadStationsId().size()<<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service , size= "<<(*svc)->deadStationsId().size()); if ((*svc)->deadStationsId().size()!=0){ bool found = std::binary_search( @@ -198,13 +136,13 @@ bool CSCCondSummarySvc::isGoodChamber(const Identifier & Id) const{ if(found) counter++; } else{ - msg(MSG::INFO)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service are not availables "<<(*svc)); } } if (counter!=0) result = false; - msg(MSG::INFO)<<" Dead Stations from the service "<< counter <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service "<< counter); return result; @@ -216,7 +154,6 @@ bool CSCCondSummarySvc::isGoodChamber(const Identifier & Id) const{ const std::vector<Identifier>& CSCCondSummarySvc::deadStationsId() const{ - //m_emptyId.clear(); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -225,7 +162,7 @@ const std::vector<Identifier>& CSCCondSummarySvc::deadStationsId() const{ if ((*svc)->deadStationsId().size()!=0){ return (*svc)->deadStationsId(); }else{ - msg(MSG::INFO)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service are not availables "<<(*svc)); } } @@ -236,7 +173,6 @@ const std::vector<Identifier>& CSCCondSummarySvc::deadStationsId() const{ const std::vector<Identifier>& CSCCondSummarySvc::deadWireLayersId() const{ - //m_emptyId.clear(); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -245,7 +181,7 @@ const std::vector<Identifier>& CSCCondSummarySvc::deadWireLayersId() const{ if ((*svc)->deadWireLayersId().size()!=0){ return (*svc)->deadWireLayersId(); }else{ - msg(MSG::INFO)<<" Dead Wire from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Wire from the service are not availables "<<(*svc)); } } @@ -255,7 +191,6 @@ const std::vector<Identifier>& CSCCondSummarySvc::deadWireLayersId() const{ const std::vector<std::string>& CSCCondSummarySvc::deadStations() const{ - //m_emptyId.clear(); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -264,7 +199,7 @@ const std::vector<std::string>& CSCCondSummarySvc::deadStations() const{ if ((*svc)->deadStations().size()!=0){ return (*svc)->deadStations(); }else{ - msg(MSG::INFO)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service are not availables "<<(*svc)); } } @@ -275,7 +210,6 @@ const std::vector<std::string>& CSCCondSummarySvc::deadStations() const{ const std::vector<std::string>& CSCCondSummarySvc::deadWireLayers() const{ - //m_emptyId.clear(); if (not m_noReports){ ServiceHandleArray<ICSCConditionsSvc>::const_iterator svc= m_reportingServices.begin(); ServiceHandleArray<ICSCConditionsSvc>::const_iterator lastSvc= m_reportingServices.end(); @@ -284,7 +218,7 @@ const std::vector<std::string>& CSCCondSummarySvc::deadWireLayers() const{ if ((*svc)->deadWireLayers().size()!=0){ return (*svc)->deadWireLayers(); }else{ - msg(MSG::INFO)<<" Dead Wire from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Wire from the service are not availables "<<(*svc)); } } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.cxx index 0d3999864fb1f8c12bb05ff4f2321934f1c0af39..d246a5344563fdb2d5cf94a40cfd0187aa0f4226 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.cxx @@ -2,10 +2,6 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//*****************************************************************************************8 -//****************************************************************************************** -//CscCoolStrSvc.cxx -//****************************************************************************************** //Service designed to read in calibration files to the cool database. Can also read them //back out again to check. // author lampen@physics.arizona.edu @@ -18,12 +14,10 @@ #include <algorithm>//for transform #include <cctype> //for toupper #include <inttypes.h> -#include "GaudiKernel/MsgStream.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "MuonCondData/CscCondDataCollection.h" #include "MuonCondData/CscCondDataContainer.h" #include "StoreGate/DataHandle.h" @@ -32,7 +26,6 @@ namespace MuonCalib { CscCoolStrSvc::CscCoolStrSvc(const std::string& name, ISvcLocator* svc) : AthService(name,svc), p_detstore(nullptr), - m_log(msgSvc(),name), m_maxChamberHash(32), //retrieved later from cscIdHelper m_maxChanHash(61440), //retrieved later from cscIdHelper m_dbCache(0), @@ -44,8 +37,6 @@ namespace MuonCalib { m_t0PhaseCondData(nullptr), m_t0BaseCondData(nullptr), m_statusCondData(nullptr), - m_debug(false), - m_verbose(false), m_numFailedRequests(0), m_maxChamberCoolChannel(32), m_maxLayerHash(255), @@ -56,8 +47,6 @@ namespace MuonCalib { m_accBools(nullptr), m_accVoid(nullptr) { - //declare properties - declareProperty("ParNames", m_parNameVec); //Parameter name declareProperty("ParSGKeys", m_parSGKeyVec); //Storegate key for retrieval declareProperty("ParFolders",m_parFolderVec); //Not used here. Provided for access by outside algorithms, primarily for writing. @@ -102,41 +91,12 @@ namespace MuonCalib { //------------------------------------------------------------------- StatusCode CscCoolStrSvc::initialize() { - // service initialisation - m_log.setLevel(outputLevel()); //individual outputlevel not known before inialize - m_debug = (m_log.level() <= MSG::DEBUG); - m_verbose = (m_log.level() <= MSG::VERBOSE); - - m_log << MSG::INFO << "Initializing CscCoolStrSvc" <<endmsg; - - // get detector store, linked to cool database by other algorithms in your - // jobOptions file. - if (StatusCode::SUCCESS!=service("DetectorStore",p_detstore)) { - m_log << MSG::FATAL << "Detector store not found" << endmsg; - return StatusCode::FAILURE; - } - - //Setup CscIdHelper - StoreGateSvc* detStore= 0; - StatusCode sc = serviceLocator()->service("DetectorStore",detStore); - - if(sc.isSuccess()) - { - sc = m_muonIdHelperTool.retrieve(); - if(sc.isFailure()) - { - m_log << MSG::FATAL << "Cannot retrieve MuonIdHelperTool" << endmsg; - return sc; - } - } - else - { - m_log << MSG::FATAL << "DetectorStore service not found " << endmsg; - return StatusCode::FAILURE; - } + ATH_MSG_DEBUG("Initializing CscCoolStrSvc"); + ATH_CHECK(service("DetectorStore",p_detstore)); + ATH_CHECK(m_idHelperSvc.retrieve()); - m_moduleContext = m_muonIdHelperTool->cscIdHelper().module_context(); - m_channelContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + m_moduleContext = m_idHelperSvc->cscIdHelper().module_context(); + m_channelContext = m_idHelperSvc->cscIdHelper().channel_context(); m_rmsCondData = 0; m_slopeCondData = 0; @@ -161,7 +121,7 @@ namespace MuonCalib { { for(int measuresPhi = 0; measuresPhi <2; measuresPhi++) { - Identifier id = m_muonIdHelperTool->cscIdHelper().channelID( + Identifier id = m_idHelperSvc->cscIdHelper().channelID( stationName+1, (stationEta? 1:-1), stationPhi+1, @@ -172,7 +132,7 @@ namespace MuonCalib { ); unsigned int onlineId; if(!offlineToOnlineId(id, onlineId).isSuccess()) { - m_log << MSG::ERROR << "Failed at geting online id!" << endmsg; + ATH_MSG_ERROR("Failed at geting online id!"); return StatusCode::RECOVERABLE; } m_onlineChannelIdsFromLayerHash.push_back(onlineId); @@ -197,7 +157,7 @@ namespace MuonCalib { { for(int stationPhi = 0; stationPhi <8; stationPhi++) { - Identifier id = m_muonIdHelperTool->cscIdHelper().channelID( + Identifier id = m_idHelperSvc->cscIdHelper().channelID( stationName+1, (stationEta? 1:-1), stationPhi+1, @@ -208,7 +168,7 @@ namespace MuonCalib { ); unsigned int onlineId; if(!offlineToOnlineId(id, onlineId).isSuccess()) { - m_log << MSG::ERROR << "Failed at geting online id!" << endmsg; + ATH_MSG_ERROR("Failed at geting online id!"); return StatusCode::RECOVERABLE; } @@ -218,22 +178,19 @@ namespace MuonCalib { } } *(const_cast<unsigned int*>(&m_maxChamberCoolChannel)) = hash - 1; //-1 because hash overshoots in loop - //*(const_cast<unsigned int*>(&m_maxChamberHash)) = m_muonIdHelperTool->cscIdHelper().module_hash_max() - 1; - *(const_cast<unsigned int*>(&m_maxChanHash)) = m_muonIdHelperTool->cscIdHelper().channel_hash_max() - 1; + *(const_cast<unsigned int*>(&m_maxChanHash)) = m_idHelperSvc->cscIdHelper().channel_hash_max() - 1; - if(m_debug) m_log << MSG::DEBUG << "Maximum Chamber hash is " << m_maxChamberHash - << endmsg; - if(m_debug) m_log << MSG::DEBUG << "Maximum Chamber COOL Channel is " - << m_maxChamberCoolChannel << endmsg; - if(m_debug) m_log << MSG::DEBUG << "Maximum Layer hash is " << m_maxLayerHash - << endmsg; - if(m_debug) m_log << MSG::DEBUG << "Maximum Channel hash is " << m_maxChanHash - << endmsg; + if(msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("Maximum Chamber hash is " << m_maxChamberHash); + ATH_MSG_DEBUG("Maximum Chamber COOL Channel is "<< m_maxChamberCoolChannel); + ATH_MSG_DEBUG("Maximum Layer hash is " << m_maxLayerHash); + ATH_MSG_DEBUG("Maximum Channel hash is " << m_maxChanHash); + } //////////// // Loop over csc detector elements and add in the hash ids - std::vector<Identifier> modules = m_muonIdHelperTool->cscIdHelper().idVector(); + std::vector<Identifier> modules = m_idHelperSvc->cscIdHelper().idVector(); //Prepare local cache. m_dbCache = new CscCondDataContainer(); @@ -241,7 +198,7 @@ namespace MuonCalib { unsigned int numPars = m_parNameVec.size(); if(numPars == 0) { - m_log << MSG::WARNING << "No parameters requested for CscCoolStrSvc. No COOL CSC data will be available from this service." << endmsg; + ATH_MSG_WARNING("No parameters requested for CscCoolStrSvc. No COOL CSC data will be available from this service."); } //Ensure all vectors have exactly numPars @@ -251,14 +208,13 @@ namespace MuonCalib { || m_parCatVec.size() != numPars || m_parDefaultVec.size() != numPars ) { - m_log << MSG::FATAL << "Need identical number of entries in each parameter definition vector!" + ATH_MSG_FATAL("Need identical number of entries in each parameter definition vector!" << "\nParNames:\t" << m_parNameVec.size() << "\nParSGKeys:\t" << m_parSGKeyVec.size() << "\nParFolders:\t" << m_parFolderVec.size() << "\nParDataTypes:\t" << m_parDataTypeVec.size() << "\nParCats:\t" << m_parCatVec.size() - << "\nParDefault:\t" << m_parDefaultVec.size() - << endmsg; + << "\nParDefault:\t" << m_parDefaultVec.size()); return StatusCode::FAILURE; } @@ -292,7 +248,7 @@ namespace MuonCalib { if (sgKey=="CSC_PSLOPE") continue; } - if(m_debug) m_log << MSG::DEBUG << "Entering new parameter." + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Entering new parameter." << "\nName:\t" << name << "\nStoreGateKey:\t" << sgKey << "\nDataType:\t" << dataType @@ -300,17 +256,17 @@ namespace MuonCalib { << "\nDefaultVal:\t" << defaultVal << "\nSgKey:\t" << sgKey << "\nFolder:\t" << folder - << endmsg; + ); if(m_parNameMap.count(name)) { - m_log << MSG::WARNING << "Multiple parameters with name " << name - << ". This isn't allowed! Skipping extra entries." << endmsg; + ATH_MSG_WARNING("Multiple parameters with name " << name + << ". This isn't allowed! Skipping extra entries."); continue; } if(m_parSGKeyMap.count(sgKey)) { - m_log << MSG::WARNING << "Multiple parameters with storegate key " << sgKey - << ". This isn't allowed! Skipping extra entries." << endmsg; + ATH_MSG_WARNING("Multiple parameters with storegate key " << sgKey + << ". This isn't allowed! Skipping extra entries."); continue; } @@ -343,8 +299,8 @@ namespace MuonCalib { coll = new CscCondDataCollection<bool>(); } else { - m_log << MSG::WARNING << "Don't recognize requested data type " - << dataType << endmsg; + ATH_MSG_WARNING("Don't recognize requested data type " + << dataType); } //Store details of parameter for easy lookup later @@ -358,7 +314,7 @@ namespace MuonCalib { StatusCode extractStatus= initCscCondDataCollection(coll); if(!extractStatus.isSuccess()) { //noneFailed = false; - m_log << MSG::WARNING << "Failed to register " << name << ". Continuing without..." << endmsg; + ATH_MSG_WARNING("Failed to register " << name << ". Continuing without..."); continue; } @@ -381,20 +337,20 @@ namespace MuonCalib { else if( name == "t0base" ) m_t0BaseCondData = dynamic_cast<CscCondDataCollection<float>*>(coll); else if( name == m_defaultChanStatusName ) { m_statusCondData = dynamic_cast<CscCondDataCollection<uint32_t>*>(coll); - if( !m_statusCondData ) m_log << MSG::WARNING << "Wrong data type for status bit " << dataType << endmsg; - }else m_log << MSG::WARNING << "Data type not cached, a direct access should be provided " << name << endmsg; + if( !m_statusCondData ) ATH_MSG_WARNING("Wrong data type for status bit " << dataType); + }else ATH_MSG_WARNING("Data type not cached, a direct access should be provided " << name); const DataHandle<CondAttrListCollection> & dataHandle = coll->atrcHandle(); //Registering callback function. The callback funciton will now be called //whenever the parameter in question is altered. i.e. whenever it goes //into a new interval of validity. - if(m_debug) m_log << MSG::DEBUG << "Registering " << name << " with storegate key " << sgKey << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Registering " << name << " with storegate key " << sgKey); if(m_doCaching) if(StatusCode::SUCCESS != p_detstore->regFcn(&CscCoolStrSvc::callback,this, dataHandle, sgKey, true)) { - m_log << MSG::ERROR << "Failed to register parameter " << name << " with storeGate Key " << sgKey << endmsg; + ATH_MSG_ERROR("Failed to register parameter " << name << " with storeGate Key " << sgKey); } //Precaching. We shouldn't need to do this, but some rare cases it seems the callbacks are not called in time for the begining of the run. @@ -408,15 +364,6 @@ namespace MuonCalib { return StatusCode::SUCCESS; }//end initialize() - - //------------------------------------------------------------------- - StatusCode CscCoolStrSvc::finalize() - { - if(m_debug) m_log << MSG::DEBUG << "in finalize()" << endmsg; - return StatusCode::SUCCESS; - }//end finalize() - - //------------------------------------------------------------------- //Here we define the hard coded categories. We define what their indices //correspond to, as well as the cool channel range they cover. @@ -497,7 +444,7 @@ namespace MuonCalib { //Don't recognize category... else { - m_log << MSG::WARNING << "Don't recognize category " << cat << " as a parameter category. " << endmsg; + ATH_MSG_WARNING("Don't recognize category " << cat << " as a parameter category. "); } coll->reset(); //clears collection @@ -530,7 +477,7 @@ namespace MuonCalib { bool CscCoolStrSvc::getVal( float& val, const CscCondDataCollection<float>& coll, unsigned int index) const { const CscCondData<float>* condData = coll[index]; if( !condData ){ - m_log << MSG::WARNING << " No data available for hash " << index << endmsg; + ATH_MSG_WARNING(" No data available for hash " << index); return false; } val = condData->getValue(); @@ -539,7 +486,7 @@ namespace MuonCalib { bool CscCoolStrSvc::getVal( bool& val, const CscCondDataCollection<bool>& coll, unsigned int index) const { const CscCondData<bool>* condData = coll[index]; if( !condData ){ - m_log << MSG::WARNING << " No data available for hash " << index << endmsg; + ATH_MSG_WARNING(" No data available for hash " << index); return false; } val = condData->getValue(); @@ -549,7 +496,7 @@ namespace MuonCalib { bool CscCoolStrSvc::getVal(uint32_t& val, const CscCondDataCollection<uint32_t>& coll, unsigned int index) const { const CscCondData<uint32_t>* condData = coll[index]; if( !condData ){ - m_log << MSG::WARNING << " No data available for hash " << index << endmsg; + ATH_MSG_WARNING(" No data available for hash " << index); return false; } val = condData->getValue(); @@ -558,7 +505,7 @@ namespace MuonCalib { bool CscCoolStrSvc::getRMS( float& val, const unsigned int & index) const { if( !m_rmsCondData ) { - m_log << MSG::WARNING << " No RMS data available" << endmsg; + ATH_MSG_WARNING(" No RMS data available"); return false; } return getVal(val,*m_rmsCondData,index); @@ -575,35 +522,35 @@ namespace MuonCalib { } bool CscCoolStrSvc::getF001( float& val, const unsigned int & index) const { if( !m_f001CondData ) { - m_log << MSG::WARNING << " No f001 data available" << endmsg; + ATH_MSG_WARNING(" No f001 data available"); return false; } return getVal(val,*m_f001CondData,index); } bool CscCoolStrSvc::getPedestal( float& val, const unsigned int & index) const { if( !m_pedestalCondData ) { - m_log << MSG::WARNING << " No pedestal data available" << endmsg; + ATH_MSG_WARNING(" No pedestal data available"); return false; } return getVal(val,*m_pedestalCondData,index); } bool CscCoolStrSvc::getT0Base( float& val, const unsigned int & index) const { if( !m_t0BaseCondData ) { - m_log << MSG::WARNING << " No t0base data available" << endmsg; + ATH_MSG_WARNING(" No t0base data available"); return false; } return getVal(val,*m_t0BaseCondData,index); } bool CscCoolStrSvc::getT0Phase( bool& val, const unsigned int & index) const { if( !m_t0PhaseCondData ) { - m_log << MSG::WARNING << " No t0phase data available" << endmsg; + ATH_MSG_WARNING(" No t0phase data available"); return false; } return getVal(val,*m_t0PhaseCondData,index); } bool CscCoolStrSvc::getNoise( float& val, const unsigned int & index) const { if( !m_noiseCondData ) { - m_log << MSG::WARNING << " No noise data available" << endmsg; + ATH_MSG_WARNING(" No noise data available"); return false; } return getVal(val,*m_noiseCondData,index); @@ -612,7 +559,7 @@ namespace MuonCalib { //Returns the status. This is only here for backwards compatibility bool CscCoolStrSvc::getStatus(uint32_t &val, const unsigned int &index) const { if( !m_statusCondData ) { - m_log << MSG::WARNING << " No status data available" << endmsg; + ATH_MSG_WARNING(" No status data available"); return false; } return getVal(val,*m_statusCondData,index); @@ -627,8 +574,8 @@ namespace MuonCalib { sc = getParameterTemplated(data, parName,index); retData = data; - m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - << parName << endmsg; + ATH_MSG_WARNING(" The use of this function is very expensive, please use the direct call instead: parName " + << parName); return sc; } @@ -639,88 +586,84 @@ namespace MuonCalib { StatusCode sc; sc = getParameterTemplated(data, parName,index); retData = data; - m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - << parName << endmsg; + ATH_MSG_WARNING(" The use of this function is very expensive, please use the direct call instead: parName " + << parName); return sc; } StatusCode CscCoolStrSvc::getParameter(uint32_t &retData, const std::string &name, const unsigned int & index) const { //We only have uint8_t parameters, so they probably meant that... - // m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - // << parName << endmsg; StatusCode sc = getParameterTemplated(retData, name, index); if( name == m_defaultChanStatusName ) { uint32_t val = 0; if( !getStatus( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } - }else m_log << MSG::WARNING << "Data type not cached, a direct access should be provided " << name << endmsg; + }else ATH_MSG_WARNING("Data type not cached, a direct access should be provided " << name); return sc; } StatusCode CscCoolStrSvc::getParameter(int &retData, const std::string &parName, const unsigned int & index) const { - m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - << parName << endmsg; + ATH_MSG_WARNING(" The use of this function is very expensive, please use the direct call instead: parName " + << parName); return getParameterTemplated(retData, parName, index); } StatusCode CscCoolStrSvc::getParameter(float &retData, const std::string &name, const unsigned int & index) const { - // m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - // << parName << endmsg; StatusCode sc = getParameterTemplated(retData, name, index); if( name == "rms" ){ float val = 0; if( !getRMS( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } }else if( name == "pslope" ){ float val = 0; if( !getSlope( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } }else if( name == "noise" ){ float val = 0; if( !getNoise( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } }else if( name == "f001" ) { float val = 0; if( !getF001( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } }else if( name == "ped" ) { float val = 0; if( !getPedestal( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } }else if( name == "t0base" ){ float val = 0; if( !getT0Base( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } } return sc; @@ -728,15 +671,13 @@ namespace MuonCalib { StatusCode CscCoolStrSvc::getParameter(bool &retData, const std::string &name, const unsigned int & index) const { - // m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead: parName " - // << parName << endmsg; if( name == "t0phase" ) { bool val = false; if( !getT0Phase( val, index) ) { - m_log << MSG::WARNING << " Failed to retrieve data " << name << endmsg; + ATH_MSG_WARNING(" Failed to retrieve data " << name); } if( val != retData ){ - m_log << MSG::WARNING << " Bad conversion of rms " << retData << " --> " << val << " " << name << endmsg; + ATH_MSG_WARNING(" Bad conversion of rms " << retData << " --> " << val << " " << name); } } return getParameterTemplated(retData, name, index); @@ -751,8 +692,6 @@ namespace MuonCalib { StatusCode sc; sc = getParameter(theStatus, m_defaultChanStatusName, stripID); status = static_cast<uint8_t>(theStatus); - // m_log << MSG::WARNING << " The use of this function is very expensive, please use the direct call instead " - // << endmsg; return sc; } @@ -769,8 +708,8 @@ namespace MuonCalib { data=atr["Data"].data<std::string>(); } else { - m_log << MSG::DEBUG << "Couldn't find a requested COOL channel number." - << coolChannel << endmsg; + ATH_MSG_DEBUG("Couldn't find a requested COOL channel number." + << coolChannel); return StatusCode::RECOVERABLE; } return StatusCode::SUCCESS; @@ -781,17 +720,14 @@ namespace MuonCalib { /** Merge and then write to cool database*/ StatusCode CscCoolStrSvc::mergeAndSubmitCondDataContainer(const CscCondDataContainer * newCont) { - m_log <<MSG::INFO - << "Merging provided csc conditions data into the COOL data string for writing to database." - << endmsg; + ATH_MSG_DEBUG("Merging provided csc conditions data into the COOL data string for writing to database."); //CscCondDataContainer mergedContainer CscCondDataContainer::const_iterator newItr = newCont->begin(); CscCondDataContainer::const_iterator endItr = newCont->end(); for(; newItr != endItr ; newItr++) { if(!(*newItr)) { - m_log << MSG::ERROR << "Empty element in container with new data. Can't merge" - << endmsg; + ATH_MSG_ERROR("Empty element in container with new data. Can't merge"); return StatusCode::RECOVERABLE; } @@ -802,7 +738,7 @@ namespace MuonCalib { m_parNameMap.find(parName); if(refItr == m_parNameMap.end()) { - m_log << MSG::ERROR << "Parameter " << parName << " not loaded. Can't merge. Check your JobOptions." << endmsg; + ATH_MSG_ERROR("Parameter " << parName << " not loaded. Can't merge. Check your JobOptions."); } const CscCondDataCollectionBase *refColl = refItr->second; @@ -811,35 +747,34 @@ namespace MuonCalib { if(dataType != newColl->getParDataType()) { - m_log << MSG::ERROR << "When merging parameter " << refColl->getParName() + ATH_MSG_ERROR("When merging parameter " << refColl->getParName() << " found that new data has type " << newColl->getParDataType() - << " and reference has type " << dataType << ". quiting merging..." - << endmsg; + << " and reference has type " << dataType << ". quiting merging..."); return StatusCode::RECOVERABLE; } //now merge them if(dataType == "uint32_t") { if(!mergeCollections<uint32_t>(newColl, refColl).isSuccess()){ - m_log << MSG::ERROR << "Failed merging " << parName << endmsg; + ATH_MSG_ERROR("Failed merging " << parName); return StatusCode::RECOVERABLE; } } if(dataType == "int") { if(!mergeCollections<int>(newColl, refColl).isSuccess()){ - m_log << MSG::ERROR << "Failed merging " << parName << endmsg; + ATH_MSG_ERROR("Failed merging " << parName); return StatusCode::RECOVERABLE; } } if(dataType == "float") { if(!mergeCollections<float>(newColl, refColl).isSuccess()){ - m_log << MSG::ERROR << "Failed merging " << parName << endmsg; + ATH_MSG_ERROR("Failed merging " << parName); return StatusCode::RECOVERABLE; } } if(dataType == "bool") { if(!mergeCollections<bool>(newColl, refColl).isSuccess()){ - m_log << MSG::ERROR << "Failed merging " << parName << endmsg; + ATH_MSG_ERROR("Failed merging " << parName); return StatusCode::RECOVERABLE; } } @@ -856,7 +791,7 @@ namespace MuonCalib { std::list<std::string>::const_iterator keyEnd = keys.end(); for(; keyItr != keyEnd; keyItr++) { if(!cacheParameter(*keyItr).isSuccess()) { - m_log << MSG::WARNING << "Failed at caching key " << (*keyItr) << endmsg; + ATH_MSG_WARNING("Failed at caching key " << (*keyItr)); } } return StatusCode::SUCCESS; @@ -867,14 +802,14 @@ namespace MuonCalib { //Extracts parameter from database, reads it into the database mirror; StatusCode CscCoolStrSvc::cacheParameter(const std::string & parKey) { - if(m_debug) m_log << MSG::DEBUG << "Caching parameter " << parKey << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Caching parameter " << parKey); ///*****// std::map<std::string, CscCondDataCollectionBase*>::iterator collItr = m_parSGKeyMap.find(parKey); if(collItr == m_parSGKeyMap.end()) { - m_log << MSG::ERROR << "Failed caching " << parKey - << ". It doens't seem to be registered." << endmsg; + ATH_MSG_ERROR("Failed caching " << parKey + << ". It doens't seem to be registered."); return StatusCode::RECOVERABLE; } @@ -895,26 +830,26 @@ namespace MuonCalib { for(unsigned int coolItr=1; coolItr <= numCoolChannels; coolItr++) { - if(m_debug) m_log << MSG::DEBUG << "Attempting to retrieve cool channel " - << coolItr << " with key " << parKey << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Attempting to retrieve cool channel " + << coolItr << " with key " << parKey); //retrieve datastring from db std::string dataStr; if (StatusCode::SUCCESS != getCoolChannelString(atrc, coolItr, dataStr)) { - if(m_debug) m_log << MSG::DEBUG << "Couldn't find cool channel " << coolItr << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Couldn't find cool channel " << coolItr); continue; } numCoolChannelsFound = numCoolChannelsFound + 1; - if(m_debug) m_log << MSG::VERBOSE << "For cool channel " << coolItr << ", String is \n[" << dataStr << "]" << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_VERBOSE("For cool channel " << coolItr << ", String is \n[" << dataStr << "]"); //now decode string into numeric parameters. std::istringstream ss(dataStr); if(!ss.good()) { - m_log << MSG::WARNING << "Failed forming stringstream during caching of " << coll->getParName() << endmsg; + ATH_MSG_WARNING("Failed forming stringstream during caching of " << coll->getParName()); continue; } @@ -932,11 +867,11 @@ namespace MuonCalib { }//end cool channel loop if(!numCoolChannelsFound) { - m_log << MSG::ERROR << "Found no COOL channels!" << endmsg; + ATH_MSG_ERROR("Found no COOL channels!"); return StatusCode::RECOVERABLE; } if(numCoolChannelsFound < numCoolChannels) { - m_log << MSG::WARNING << "Only could retrieve " << numCoolChannelsFound << " out of " << numCoolChannels << " cool channels. This should never happen for a normal dataset, and could be a serious problem." << endmsg; + ATH_MSG_WARNING("Only could retrieve " << numCoolChannelsFound << " out of " << numCoolChannels << " cool channels. This should never happen for a normal dataset, and could be a serious problem."); } return StatusCode::SUCCESS; @@ -945,9 +880,9 @@ namespace MuonCalib { //------------------------------------------------------------------- StatusCode CscCoolStrSvc::cache(std::istringstream& ss, CscCondDataCollectionBase* const coll) { - if(m_debug) m_log << MSG::DEBUG << "Caching " << coll->getParName() + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Caching " << coll->getParName() << " (category " << coll->getParCat() << "). Database string is version 2" - << endmsg; + ); unsigned int numUpdated = 0; std::string indexStr,valueStr; @@ -979,15 +914,14 @@ namespace MuonCalib { unsigned int index = 0; if(cat != "CSC") { if(!stringIdToIndex(str, cat, index).isSuccess()) { - m_log << MSG::ERROR << "Failed converting string Id to index" - << endmsg; + ATH_MSG_ERROR("Failed converting string Id to index"); return StatusCode::RECOVERABLE; } ss >> str; } - if(m_verbose) m_log << MSG::VERBOSE << "[cache version 2 (CHANNEL) ] Recording " - << str << " at index " << index << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("[cache version 2 (CHANNEL) ] Recording " + << str << " at index " << index); if (index==UINT_MAX) continue; if (index>=numEntries) continue; @@ -995,15 +929,15 @@ namespace MuonCalib { //Now str has a value in it. We pass it to the collection. std::istringstream valueSS(str); if(!coll->recordFromSS(valueSS, index).isSuccess()) { - m_log << MSG::WARNING << "Failed caching to index " << index << " for parameter" + ATH_MSG_WARNING("Failed caching to index " << index << " for parameter" << coll->getParName() << ". Likely tried to recache to same index twice." - << " Likely a bug when the data was orginally put in COOL." << endmsg; + << " Likely a bug when the data was orginally put in COOL."); } - if(m_debug) numUpdated++; + if(msgLvl(MSG::DEBUG)) numUpdated++; if (cnt==(numEntries-1)) { - m_log << MSG::ERROR << "Something wrong with <END_DATA>" - << " in COOL tag in cacheVersion2" << endmsg; + ATH_MSG_ERROR("Something wrong with <END_DATA>" + << " in COOL tag in cacheVersion2"); return StatusCode::RECOVERABLE; } } // for cnt @@ -1034,7 +968,7 @@ namespace MuonCalib { { ss >> asmIDstr; /* asm cool tag id string which is ASM[#:1-5]_[StationEtaString:AorC][stationPhi:1-8]_[stationName:50-51] xxx 3 x 5 6 x x9 */ - if(m_verbose) m_log << MSG::VERBOSE << "ASM ID String: " << asmIDstr << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("ASM ID String: " << asmIDstr); if ( asmIDstr == "<END_DATA>" ) break; asmNum = atoi(asmIDstr.substr(3,1).c_str()); @@ -1042,7 +976,7 @@ namespace MuonCalib { if ( asmIDstr[5] == 'A' ) stationEta = 1; else if( asmIDstr[5] == 'C') stationEta = -1; else{ - m_log << MSG::FATAL << "Bad ASMID String in CSC COOL database \"" << asmIDstr << "\" (wheel " << asmIDstr[5] << " doesn't exist" << endmsg; + ATH_MSG_FATAL("Bad ASMID String in CSC COOL database \"" << asmIDstr << "\" (wheel " << asmIDstr[5] << " doesn't exist"); return StatusCode::FAILURE; } @@ -1051,14 +985,14 @@ namespace MuonCalib { stationName = atoi(asmIDstr.substr(8,2).c_str()); if(stationPhi < 1 || stationPhi > 8 || stationName <50 || stationName > 51){ - m_log << MSG::FATAL << "Bad ASMID String in CSC COOL database: \"" << asmIDstr << "\""<< endmsg; + ATH_MSG_FATAL("Bad ASMID String in CSC COOL database: \"" << asmIDstr << "\""); - m_log << MSG::FATAL << "Read station phi: " << stationPhi << ", stationName " << stationName << endmsg; + ATH_MSG_FATAL("Read station phi: " << stationPhi << ", stationName " << stationName); return StatusCode::FAILURE; } if ( !getAsmScope(asmNum, measuresPhi, layerSince, layerUntil, stripSince, stripUntil) ) - { m_log << MSG::FATAL << "Failure of getAsmScope in cacheVersion2." << endmsg; + { ATH_MSG_FATAL("Failure of getAsmScope in cacheVersion2."); return StatusCode::FAILURE; } @@ -1072,7 +1006,7 @@ namespace MuonCalib { // This is currently required to be checked when running with layouts which do not contain all CSCs anymore, since the // CSCCool database contains still all CSCs. A clean fix would be to have a dedicated database for every layout. bool isValid = true; - chanId = m_muonIdHelperTool->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, iLayer, measuresPhi, iStrip, true, &isValid); + chanId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, iLayer, measuresPhi, iStrip, true, &isValid); static bool conversionFailPrinted = false; if (!isValid) { if (!conversionFailPrinted) { @@ -1083,12 +1017,12 @@ namespace MuonCalib { } continue; } - if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(chanId, hashIdentifier)) { + if (m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hashIdentifier)) { ATH_MSG_WARNING("Failed to retrieve channel hash for identifier " << chanId.get_compact()); } index = (int)hashIdentifier; - if ( m_verbose ) m_log << MSG::VERBOSE << "(ASM) Recording " + if ( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE("(ASM) Recording " << valueStr << " at index " << index << "\nstationName " << stationName <<"\nstationEta " << stationEta @@ -1097,7 +1031,7 @@ namespace MuonCalib { << "\niLayer " << iLayer << "\nmeasuresPhi " << measuresPhi << "\niStrip " << iStrip - << endmsg; + ); if (index==UINT_MAX) continue; if (index>=numEntries) continue; @@ -1105,20 +1039,20 @@ namespace MuonCalib { //Now valueStr has a value in it. We pass it to the collection. std::istringstream valueSS(valueStr); if ( !coll->recordFromSS(valueSS, index).isSuccess() ) - { m_log << MSG::WARNING << "Failed caching to index " << index + { ATH_MSG_WARNING("Failed caching to index " << index << " for parameter " << coll->getParName() << " (data string version 2)." << " Likely tried to recache to same index twice." - << " Likely a bug when the data was orginally put in COOL." << endmsg; + << " Likely a bug when the data was orginally put in COOL."); } - if ( m_debug ) numUpdated++; + if ( msgLvl(MSG::DEBUG) ) numUpdated++; if ( cnt==(numEntries-1) ) - { m_log << MSG::ERROR << "Something wrong with <END_DATA> in" - << " COOL tag in cacheVersion2" << endmsg; + { ATH_MSG_ERROR("Something wrong with <END_DATA> in" + << " COOL tag in cacheVersion2"); return StatusCode::RECOVERABLE; } } } } } // cat=="ASM" - if ( m_debug ) m_log << MSG::DEBUG << "Number updated is " << numUpdated << endmsg; + if ( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("Number updated is " << numUpdated); return StatusCode::SUCCESS; } // end cacheVersion2 @@ -1126,19 +1060,19 @@ namespace MuonCalib { //------------------------------------------------------------------- int CscCoolStrSvc::swapChamberLayerReturnHash(const Identifier & id) const { - int stationName = m_muonIdHelperTool->cscIdHelper().stationName(id); - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(id); - int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(id); - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(id) == 1 ? 2 : 1; //Swap chamber layer - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); - int wireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(id); - int strip = m_muonIdHelperTool->cscIdHelper().strip(id); - Identifier newId = m_muonIdHelperTool->cscIdHelper().channelID(stationName, stationEta, stationPhi, + int stationName = m_idHelperSvc->cscIdHelper().stationName(id); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(id) == 1 ? 2 : 1; //Swap chamber layer + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(id); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id); + int strip = m_idHelperSvc->cscIdHelper().strip(id); + Identifier newId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, chamberLayer, wireLayer, measuresPhi, strip); IdentifierHash hash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(newId, hash); - m_log << MSG::INFO << "swap chamber layer " << m_muonIdHelperTool->cscIdHelper().show_to_string(id) - << " to " << m_muonIdHelperTool->cscIdHelper().show_to_string(newId) << " (" << hash << ")" << endmsg; + m_idHelperSvc->cscIdHelper().get_channel_hash(newId, hash); + ATH_MSG_DEBUG("swap chamber layer " << m_idHelperSvc->cscIdHelper().show_to_string(id) + << " to " << m_idHelperSvc->cscIdHelper().show_to_string(newId) << " (" << hash << ")"); return (int)hash; } @@ -1150,20 +1084,20 @@ namespace MuonCalib { //Phi,wireLayer,and strip all are offset by one between the two schemes. //Also, station name is 50 or 51 in Identifiers, but only 0 or 1 in //the online id. - int stationName ((m_muonIdHelperTool->cscIdHelper().stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 - int phi = (m_muonIdHelperTool->cscIdHelper().stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 - int eta = ((m_muonIdHelperTool->cscIdHelper().stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 - int chamLay = (m_muonIdHelperTool->cscIdHelper().chamberLayer(id)-1) &0x1; // 0000 0000 1000 0000 0000 - int wireLay = (m_muonIdHelperTool->cscIdHelper().wireLayer(id)-1) &0x3; // 0000 0000 0110 0000 0000 - int measuresPhi = (m_muonIdHelperTool->cscIdHelper().measuresPhi(id) &0x1); // 0000 0000 0001 0000 0000 + int stationName ((m_idHelperSvc->cscIdHelper().stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 + int phi = (m_idHelperSvc->cscIdHelper().stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 + int eta = ((m_idHelperSvc->cscIdHelper().stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 + int chamLay = (m_idHelperSvc->cscIdHelper().chamberLayer(id)-1) &0x1; // 0000 0000 1000 0000 0000 + int wireLay = (m_idHelperSvc->cscIdHelper().wireLayer(id)-1) &0x3; // 0000 0000 0110 0000 0000 + int measuresPhi = (m_idHelperSvc->cscIdHelper().measuresPhi(id) &0x1); // 0000 0000 0001 0000 0000 int strip; // 0000 0000 0000 1111 1111 //Online and offline phi ids are flipped on A wheel if(m_onlineOfflinePhiFlip && measuresPhi && eta == 1){ - strip = (48 - (m_muonIdHelperTool->cscIdHelper().strip(id))) & 0xff; + strip = (48 - (m_idHelperSvc->cscIdHelper().strip(id))) & 0xff; } else { - strip = (m_muonIdHelperTool->cscIdHelper().strip(id)-1) & 0xff; + strip = (m_idHelperSvc->cscIdHelper().strip(id)-1) & 0xff; } @@ -1182,13 +1116,13 @@ namespace MuonCalib { StatusCode CscCoolStrSvc::offlineToAsmId(const Identifier & id, std::string & AsmId, unsigned int & iChamber, unsigned int & iASM) const { - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(id); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id); std::string stationEtaString = (stationEta == 1 ? "A":"C"); - int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(id); - int stationName = m_muonIdHelperTool->cscIdHelper().stationName(id); - int wireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(id); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); - int strip = m_muonIdHelperTool->cscIdHelper().strip(id); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id); + int stationName = m_idHelperSvc->cscIdHelper().stationName(id); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(id); + int strip = m_idHelperSvc->cscIdHelper().strip(id); iChamber = getChamberCoolChannel(id) - 1; //0-31 @@ -1218,9 +1152,9 @@ namespace MuonCalib { //Phi,wireLayer,and strip all are offset by one between the two schemes. //Also, station name is 50 or 51 in Identifiers, but only 0 or 1 in //the online id. - int stationName ((m_muonIdHelperTool->cscIdHelper().stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 - int phi = (m_muonIdHelperTool->cscIdHelper().stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 - int eta = ((m_muonIdHelperTool->cscIdHelper().stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 + int stationName ((m_idHelperSvc->cscIdHelper().stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 + int phi = (m_idHelperSvc->cscIdHelper().stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 + int eta = ((m_idHelperSvc->cscIdHelper().stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 int chamLay = 1; // 0000 0000 1000 0000 0000 int wireLay = 0; // 0000 0000 0110 0000 0000 int measuresPhi = 0; // 0000 0000 0001 0000 0000 @@ -1256,12 +1190,12 @@ namespace MuonCalib { strip = ((onlineId)&0xff) +1; } - elementId = m_muonIdHelperTool->cscIdHelper().elementID(stationName,eta,phi); + elementId = m_idHelperSvc->cscIdHelper().elementID(stationName,eta,phi); // The following call of channelID with check=true ensures that the identifier is checked to be physically valid. // This is currently required to be checked when running with layouts which do not contain all CSCs anymore, since the // CSCCool database contains still all CSCs. A clean fix would be to have a dedicated database for every layout. bool isValid = true; - channelId = m_muonIdHelperTool->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip,true,&isValid); + channelId = m_idHelperSvc->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip,true,&isValid); static bool conversionFailPrinted = false; if (!isValid) { if (!conversionFailPrinted) { @@ -1284,7 +1218,7 @@ namespace MuonCalib { int phi = ((onlineId >> 13)&0x7)+1; int eta = ((((onlineId >> 12)&0x1) == 1) ? 1:-1); - elementId = m_muonIdHelperTool->cscIdHelper().elementID(stationName,eta,phi); + elementId = m_idHelperSvc->cscIdHelper().elementID(stationName,eta,phi); return StatusCode::SUCCESS; } @@ -1309,7 +1243,7 @@ namespace MuonCalib { strip = ((onlineId)&0xff) +1; } - chanId = m_muonIdHelperTool->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); + chanId = m_idHelperSvc->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); return StatusCode::SUCCESS; } @@ -1318,16 +1252,16 @@ namespace MuonCalib { //----------------------------------------------------------------------------------- unsigned int CscCoolStrSvc::getLayerHash( const Identifier & id) const { - unsigned int stationName = m_muonIdHelperTool->cscIdHelper().stationName(id); - if(m_muonIdHelperTool->cscIdHelper().stationName(id) >= 50 ) stationName = stationName - 50; + unsigned int stationName = m_idHelperSvc->cscIdHelper().stationName(id); + if(m_idHelperSvc->cscIdHelper().stationName(id) >= 50 ) stationName = stationName - 50; else { ATH_MSG_ERROR("stationName: " << stationName << " is not CSC - emergency stop."); throw std::runtime_error(Form("File: %s, Line: %d\nCscCoolStrSvc::getLayerHash() - given identifier is no CSC identifier", __FILE__, __LINE__)); } - unsigned int stationEta = (m_muonIdHelperTool->cscIdHelper().stationEta(id) == 1 ? 1 :0); - unsigned int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(id) -1; - unsigned int wireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(id) -1; - unsigned int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); + unsigned int stationEta = (m_idHelperSvc->cscIdHelper().stationEta(id) == 1 ? 1 :0); + unsigned int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id) -1; + unsigned int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id) -1; + unsigned int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(id); return m_layerHashes[stationName][stationEta][stationPhi][wireLayer][measuresPhi]; } @@ -1337,19 +1271,18 @@ namespace MuonCalib { unsigned int CscCoolStrSvc::getChamberCoolChannel( const Identifier & id) const { - unsigned int stationName = m_muonIdHelperTool->cscIdHelper().stationName(id) -50; - unsigned int eta = (m_muonIdHelperTool->cscIdHelper().stationEta(id) == 1 ? 1 : 0); - unsigned int phi = m_muonIdHelperTool->cscIdHelper().stationPhi(id) -1; + unsigned int stationName = m_idHelperSvc->cscIdHelper().stationName(id) -50; + unsigned int eta = (m_idHelperSvc->cscIdHelper().stationEta(id) == 1 ? 1 : 0); + unsigned int phi = m_idHelperSvc->cscIdHelper().stationPhi(id) -1; if(stationName > 1 || phi > 7 || eta > 1 ) { - m_log <<MSG::ERROR << "when creating chamber cool channel, inputs were:\nstationName: " + ATH_MSG_ERROR("when creating chamber cool channel, inputs were:\nstationName: " << stationName << "\nPhi: " << phi - << "\neta: " << eta - << endmsg; + << "\neta: " << eta); return 1; } @@ -1385,8 +1318,8 @@ namespace MuonCalib { StatusCode CscCoolStrSvc::layerHashToOnlineId(const unsigned int & layerHash, unsigned int & onlineId) const { if(layerHash > m_onlineChannelIdsFromLayerHash.size()) { - m_log << MSG::ERROR << "Tried to lookup online id from layer hash " - << layerHash <<". Max is " << m_onlineChannelIdsFromLayerHash.size()<< endmsg; + ATH_MSG_ERROR("Tried to lookup online id from layer hash " + << layerHash <<". Max is " << m_onlineChannelIdsFromLayerHash.size()); return StatusCode::SUCCESS; } onlineId = m_onlineChannelIdsFromLayerHash[layerHash]; @@ -1404,8 +1337,8 @@ namespace MuonCalib { chamCoolChan = m_chamberCoolChannels[stationName][eta][phi]; if(chamCoolChan < 1 || chamCoolChan > 32) { - m_log << MSG::ERROR << "created chamber cool channel is " - << chamCoolChan << endmsg; + ATH_MSG_ERROR("created chamber cool channel is " + << chamCoolChan); return StatusCode::RECOVERABLE; } return StatusCode::SUCCESS; @@ -1416,8 +1349,8 @@ namespace MuonCalib { if(chamCoolChan > m_onlineChannelIdsFromChamberCoolChannel.size() || chamCoolChan ==0 ) { - m_log << "Requested online ID for chamber Cool Channel " << chamCoolChan - <<"which can't be more than " << m_onlineChannelIdsFromChamberCoolChannel.size(); + ATH_MSG_ERROR("Requested online ID for chamber Cool Channel " << chamCoolChan + <<"which can't be more than " << m_onlineChannelIdsFromChamberCoolChannel.size()); } onlineId = m_onlineChannelIdsFromChamberCoolChannel[chamCoolChan-1]; return StatusCode::SUCCESS; @@ -1484,8 +1417,8 @@ namespace MuonCalib { index = 0; else { - m_log << MSG::ERROR << "Unknown idString of " << idString - << " asked for ENDCAP cateogry." << endmsg; + ATH_MSG_ERROR("Unknown idString of " << idString + << " asked for ENDCAP cateogry."); return StatusCode::RECOVERABLE; } @@ -1507,7 +1440,7 @@ namespace MuonCalib { if(cat == "CHAMBER") { IdentifierHash chamberHash; - m_muonIdHelperTool->cscIdHelper().get_geo_module_hash(chamberId,chamberHash); + m_idHelperSvc->cscIdHelper().get_geo_module_hash(chamberId,chamberHash); index = (unsigned int)chamberHash; } else if(cat == "LAYER") @@ -1517,7 +1450,7 @@ namespace MuonCalib { else if(cat == "CHANNEL") { IdentifierHash chanHash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, chanHash); + m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, chanHash); index = (unsigned int)chanHash; } @@ -1539,8 +1472,8 @@ namespace MuonCalib { if(index == 1) idString = "1"; else { - m_log << MSG::ERROR << "Requested index " << index - << " can't be converted to a string Id for the category " << cat << endmsg; + ATH_MSG_ERROR("Requested index " << index + << " can't be converted to a string Id for the category " << cat); return StatusCode::RECOVERABLE; } } @@ -1552,11 +1485,9 @@ namespace MuonCalib { { Identifier chamberId; - m_muonIdHelperTool->cscIdHelper().get_id(IdentifierHash(index), chamberId, &m_moduleContext); + m_idHelperSvc->cscIdHelper().get_id(IdentifierHash(index), chamberId, &m_moduleContext); if(!offlineElementToOnlineId(chamberId, onlineId).isSuccess()) { - m_log << MSG::ERROR - << "Failed converting chamber identifier to online id during stringId gen. " - << endmsg; + ATH_MSG_ERROR("Failed converting chamber identifier to online id during stringId gen. "); return StatusCode::RECOVERABLE; } } @@ -1564,19 +1495,15 @@ namespace MuonCalib { { unsigned int onlineId; if(!layerHashToOnlineId(index, onlineId)){ - m_log <<MSG::ERROR - << "Failed at getting online id from layer hash during stringId gen" - << endmsg; + ATH_MSG_ERROR("Failed at getting online id from layer hash during stringId gen"); } } else if(cat == "CHANNEL") { Identifier channelId; - m_muonIdHelperTool->cscIdHelper().get_id(IdentifierHash(index), channelId, &m_channelContext); + m_idHelperSvc->cscIdHelper().get_id(IdentifierHash(index), channelId, &m_channelContext); if(!offlineToOnlineId(channelId, onlineId).isSuccess()) { - m_log << MSG::ERROR - << "Failed converting chamber identifier to online id during stringId gen. " - << endmsg; + ATH_MSG_ERROR("Failed converting chamber identifier to online id during stringId gen. "); return StatusCode::RECOVERABLE; } } @@ -1634,7 +1561,7 @@ namespace MuonCalib { measuresPhi = 1; } else{ - m_log << MSG::FATAL << "ASM number \"" << asmNum << "\" is invalid. It needs to end in a number from 1-5." << endmsg; + ATH_MSG_FATAL("ASM number \"" << asmNum << "\" is invalid. It needs to end in a number from 1-5."); return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.h index 1c783e74271088e873c17627f46aacca12dd8ce1..494469bf69a23a69fcaeff0c54409b7a48a405d5 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.h @@ -1,37 +1,29 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_CSCCOOLSTRSVC_H #define MUONCONDSVC_CSCCOOLSTRSVC_H -/**CscCoolStrSvc - Class with methods for reading and writing to cool databae*/ -#include <vector> -#include <string> -#include <sstream> -#include <fstream> -#include "GaudiKernel/Service.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/StoreGate.h" +#include "MuonCondInterface/CscICoolStrSvc.h" #include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/ServiceHandle.h" -//Added for attribute list declarations (might not need all of these) #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" - -//Added to use CscIdHelper -#include "Identifier/Identifier.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -//Calib conditions data classes +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCondData/CscCondDataContainer.h" #include "MuonCondData/CscCondDataCollection.h" -#include "MuonCondInterface/CscICoolStrSvc.h" - template <class TYPE> class SvcFactory; +#include <vector> +#include <string> +#include <sstream> +#include <fstream> + +template <class TYPE> class SvcFactory; + namespace MuonCalib { /** @@ -55,9 +47,7 @@ namespace MuonCalib { virtual const InterfaceID& type() const; - virtual StatusCode initialize(); - virtual StatusCode finalize(); /**mergeAndSubmitCondDataContainer merges the data in newCont with what is currently cached from COOL. Then, it submits the new merged data for entry to cool (as of this writing the final write is done @@ -180,18 +170,7 @@ namespace MuonCalib { /**p_detstore hold a pointer to the transient data storage*/ StoreGateSvc* p_detstore; - /**m_log used for sending messages*/ - mutable MsgStream m_log; - - /**CscIdHelper is used to convert from identifiers to hash ids. MuonDetector manager is a - requirement on CscIdHelper*/ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - // const MuonGM::MuonDetectorManager * m_muonMgr; - - /// Conditions Attribute List collections used for getting datahandles for callback functions*/ - // const CondAttrListCollection* m_runAtrColl; - // const CondAttrListCollection* m_pulserAtrColl; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //maximum channel and chamber hashes (num of each -1). These are set //with a const_cast from the id helper @@ -217,7 +196,6 @@ namespace MuonCalib { /**Flags*/ bool m_preCache; - bool m_debug, m_verbose; mutable int m_numFailedRequests; int m_maxFailedRequests; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.icc b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.icc index 941c78b8bc53db0ec4b5e9bfbf9407ad2899bb82..99cb5e94308e9de20c28f99a1a7edd8e85757259 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.icc +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/CscCoolStrSvc.icc @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - namespace MuonCalib { //Retrieve a requested parameter by strip hashID from the local cache for the client. //Only reason for this template is so we don't have to retype same code for every @@ -20,28 +19,27 @@ namespace MuonCalib { { if(parName == "t0phase" || parName == "t0base"){ static bool firstTime = true; - if(firstTime) m_log << MSG::WARNING << "Attempted to request t0 parameters (t0phase or t0base) from CscCoolStrSvc. These are not yet implemented but will be in the near future. You can probably ignore this WARNING." << std::endl; + if(firstTime) ATH_MSG_WARNING("Attempted to request t0 parameters (t0phase or t0base) from CscCoolStrSvc. These are not yet implemented but will be in the near future. You can probably ignore this WARNING."); firstTime = false; return StatusCode::RECOVERABLE; } - m_log << MSG::ERROR << "There is no parameter loaded with name " << parName << ". Check spelling, or ensure you had it added in your jobOptions." << endmsg; + ATH_MSG_ERROR("There is no parameter loaded with name " << parName << ". Check spelling, or ensure you had it added in your jobOptions."); return StatusCode::RECOVERABLE; } CscCondDataCollection<data_type> * coll = dynamic_cast<CscCondDataCollection<data_type> *>( itr->second); if(!coll){ - m_log << MSG::ERROR << "Failed to cast datatype properly for parameter \"" << parName << "\"" << endmsg; + ATH_MSG_ERROR("Failed to cast datatype properly for parameter \"" << parName << "\""); return StatusCode::RECOVERABLE; } if(index > coll->size() -1) { - m_log << MSG::ERROR - << "Requested index " << (coll->getParCat() == "CHANNEL" ? " (channel hash) ":"") << index + ATH_MSG_ERROR("Requested index " << (coll->getParCat() == "CHANNEL" ? " (channel hash) ":"") << index << " is too large for " << parName <<". The requested parameter (" << coll->getParName() << ") is of the \"" << coll->getParCat() << "\" category, which has a defined maximum value of " << (coll->getSize()-1) - << ". This is likely an error upstream of CscCoolStrSvc creating an invalid identifier or hash id." << endmsg; + << ". This is likely an error upstream of CscCoolStrSvc creating an invalid identifier or hash id."); retData = coll->getParDefault(); return StatusCode::RECOVERABLE; } @@ -55,21 +53,19 @@ namespace MuonCalib { //If we are looking at invalid chamber layer (1), check corresponding channel in chamber layer 2 Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id(index,id,&m_channelContext); - if(m_muonIdHelperTool->cscIdHelper().chamberLayer(id) == 1) + m_idHelperSvc->cscIdHelper().get_id(index,id,&m_channelContext); + if(m_idHelperSvc->cscIdHelper().chamberLayer(id) == 1) { int newHash = swapChamberLayerReturnHash(id); condData = coll->at(newHash); if(condData) { if(m_numFailedRequests < m_maxFailedRequests) - m_log << MSG::WARNING << "Invalid chamber layer requested when retrieveing " + ATH_MSG_WARNING("Invalid chamber layer requested when retrieveing " << parName - << ". Tried corresponding channel in valid chamber layer and found good data." - << endmsg; + << ". Tried corresponding channel in valid chamber layer and found good data."); if(m_numFailedRequests++ == m_maxFailedRequests) - m_log << MSG::WARNING << "Reached maximum number of problematic requests to CscCoolStrSvc. No further warnings will be printed." - << endmsg; + ATH_MSG_WARNING("Reached maximum number of problematic requests to CscCoolStrSvc. No further warnings will be printed."); } } }//end if "CHANNEL" category @@ -81,9 +77,9 @@ namespace MuonCalib { //Return a default value retData = coll->getParDefault(); if(m_numFailedRequests < m_maxFailedRequests) { - m_log << MSG::WARNING << "Requested index " << index << " has no data cached for parameter " << parName << ". Either its not valid (such as a hash Id for a chamber never installed) or there was a problem caching the database to memory. Returning default value of " << retData << endmsg; + ATH_MSG_WARNING("Requested index " << index << " has no data cached for parameter " << parName << ". Either its not valid (such as a hash Id for a chamber never installed) or there was a problem caching the database to memory. Returning default value of " << retData); } - if(m_numFailedRequests++ == m_maxFailedRequests) m_log << MSG::WARNING << "Reached maximum number of failed requests to CscCoolStrSvc. No further warnings will be printed." << endmsg; + if(m_numFailedRequests++ == m_maxFailedRequests) ATH_MSG_WARNING("Reached maximum number of failed requests to CscCoolStrSvc. No further warnings will be printed."); } else { @@ -104,17 +100,17 @@ namespace MuonCalib { template <typename data_type> StatusCode CscCoolStrSvc::mergeCollections(const CscCondDataCollectionBase * & newCollBase, const CscCondDataCollectionBase * & refCollBase) { - if(m_debug) m_log << MSG::DEBUG << "Merging collections for parameter " << newCollBase->getParName() << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Merging collections for parameter " << newCollBase->getParName()); const CscCondDataCollection<data_type> * newColl = dynamic_cast<const CscCondDataCollection<data_type>*>(newCollBase); if(!newColl){ - m_log << MSG::ERROR << "Failed to cast datatype properly for newColl in mergeCollections. Maybe a configuration problem in CSCCondDB.py?" << endmsg; + ATH_MSG_ERROR("Failed to cast datatype properly for newColl in mergeCollections. Maybe a configuration problem in CSCCondDB.py?"); return StatusCode::RECOVERABLE; } const CscCondDataCollection<data_type> * refColl = dynamic_cast<const CscCondDataCollection<data_type>*>(refCollBase); if(!refColl){ - m_log << MSG::ERROR << "Failed to cast datatype properly for refColl in mergeCollections. Maybe a configuration problem in CSCCondDB.py?" << endmsg; + ATH_MSG_ERROR("Failed to cast datatype properly for refColl in mergeCollections. Maybe a configuration problem in CSCCondDB.py?"); return StatusCode::RECOVERABLE; } @@ -124,8 +120,8 @@ namespace MuonCalib { unsigned int numEntries = newColl->size(); if(numEntries != newColl->size() ) { - m_log << MSG::ERROR << "New collection has " << newColl->size() - << " entries. Reference has " << refColl->size() << "." << endmsg; + ATH_MSG_ERROR("New collection has " << newColl->size() + << " entries. Reference has " << refColl->size() << "."); return StatusCode::RECOVERABLE; } @@ -134,8 +130,8 @@ namespace MuonCalib { //getChamberCoolChannel const unsigned int maxCoolChan = refColl->getNumCoolChan(); //cool channels start at 1 - if(m_verbose) m_log << MSG::VERBOSE << "Maximum cool channel for this parameter is " - << maxCoolChan << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Maximum cool channel for this parameter is " + << maxCoolChan); //strVec is a vector of the strings we'll store in the database. The indices of the //vector are the cool channel -1. @@ -173,8 +169,8 @@ namespace MuonCalib { else if(refDatum && m_doMerge) mergeDatum = refDatum; - if(m_verbose) m_log << MSG::VERBOSE << "Merged index: " << index - << " with pointer at ref " << mergeDatum << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Merged index: " << index + << " with pointer at ref " << mergeDatum); //Only put data if there is data available for it! if(mergeDatum) { @@ -208,8 +204,8 @@ namespace MuonCalib { unsigned int onlineId; if(!coolChamberChannelToOnlineId(index+1, onlineId ).isSuccess()){ - m_log << MSG::ERROR << "Failed to retrieve online Id for chamber during merge." - << endmsg; + ATH_MSG_ERROR("Failed to retrieve online Id for chamber during merge." + ); } ss << " " << std::hex << onlineId << " " << std::dec << mergeDatum->getValue(); @@ -220,53 +216,53 @@ namespace MuonCalib { unsigned int onlineId; if(!(layerHashToOnlineId(index, onlineId).isSuccess())) { - m_log << MSG::ERROR << "Failed at gettin layer hash" << endmsg; + ATH_MSG_ERROR("Failed at gettin layer hash"); return StatusCode::RECOVERABLE; } ss << " " << std::hex << onlineId << " " << std::dec << mergeDatum->getValue(); if(!onlineIdToCoolChamberChannel(onlineId, coolChan)) { - m_log << MSG::ERROR << "Failed at getting cool chamber channel from online Id " << std::hex << onlineId << std::dec << endmsg; + ATH_MSG_ERROR("Failed at getting cool chamber channel from online Id " << std::hex << onlineId << std::dec); return StatusCode::RECOVERABLE; } } else if (cat == "CHANNEL") { Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id((IdentifierHash)index,id, &m_channelContext); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)index,id, &m_channelContext); unsigned int onlineId; if(!offlineToOnlineId(id, onlineId).isSuccess()) { - m_log << MSG::ERROR << "Failed at geting online id!" << endmsg; + ATH_MSG_ERROR("Failed at geting online id!"); return StatusCode::RECOVERABLE; } ss << " " << std::hex << onlineId << " " << std::dec << mergeDatum->getValue(); if(!onlineIdToCoolChamberChannel(onlineId, coolChan)) { - m_log << MSG::ERROR << "Failed at getting cool chamber channel from online Id " - << std::hex << onlineId << std::dec << endmsg; + ATH_MSG_ERROR("Failed at getting cool chamber channel from online Id " + << std::hex << onlineId << std::dec); return StatusCode::RECOVERABLE; } - if(m_verbose) m_log << MSG::VERBOSE << "Storing into COOL channel " - << coolChan << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Storing into COOL channel " + << coolChan); } else if (cat == "ASM") { Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id((IdentifierHash)index,id, &m_channelContext); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)index,id, &m_channelContext); unsigned int iChamber; unsigned int iASM; std::string AsmId; if(!offlineToAsmId(id, AsmId, iChamber, iASM).isSuccess()) - { m_log << MSG::ERROR << "Failed at geting ASM id!" << endmsg; + { ATH_MSG_ERROR("Failed at geting ASM id!"); return StatusCode::RECOVERABLE; } unsigned int onlineId; if(!offlineToOnlineId(id, onlineId).isSuccess()) - { m_log << MSG::ERROR << "Failed at geting online id!" << endmsg; + { ATH_MSG_ERROR("Failed at geting online id!"); return StatusCode::RECOVERABLE; } @@ -274,19 +270,19 @@ namespace MuonCalib { { ss << " " << AsmId << " " << mergeDatum->getValue(); CoolAsmValsFilled[iChamber][iASM-1] = true; if ( !onlineIdToCoolChamberChannel(onlineId, coolChan) ) - { m_log << MSG::ERROR << "Failed at getting cool chamber channel from online Id " - << std::hex << onlineId << std::dec << endmsg; + { ATH_MSG_ERROR("Failed at getting cool chamber channel from online Id " + << std::hex << onlineId << std::dec); return StatusCode::RECOVERABLE; } - if(m_verbose) m_log << MSG::VERBOSE << "Storing into COOL channel " - << coolChan << endmsg; + if(msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Storing into COOL channel " + << coolChan); } }//end if cat==asm if ( (coolChan==0) && !(cat=="ASM") ) { - m_log << MSG::ERROR << "Cool chan of 0 reqeusted for update. This is likely a bug." - << endmsg; + ATH_MSG_ERROR("Cool chan of 0 reqeusted for update. This is likely a bug." + ); return StatusCode::RECOVERABLE; } @@ -302,16 +298,16 @@ namespace MuonCalib { ///Store a CondAttrListCollection in TDS std::string folder = refColl->getParFolder(); CondAttrListCollection* atrc=0; - m_log << MSG::INFO << "Putting data for parameter " << parName - << " into database folder " << folder << endmsg; + ATH_MSG_DEBUG("Putting data for parameter " << parName + << " into database folder " << folder ); if (!p_detstore->contains<CondAttrListCollection>(folder)) { - m_log << MSG::DEBUG << "Creating new CondAttrListCollection for folder " - << folder << endmsg; + ATH_MSG_DEBUG("Creating new CondAttrListCollection for folder " + << folder); CondAttrListCollection* atrc=new CondAttrListCollection(true); if (StatusCode::SUCCESS!=p_detstore->record(atrc,folder)) { //create new collection record in TDS - m_log << MSG::ERROR << "Could not create CondAttrListCollection " - << folder << endmsg; + ATH_MSG_ERROR("Could not create CondAttrListCollection " + << folder); return StatusCode::RECOVERABLE; } } @@ -319,20 +315,20 @@ namespace MuonCalib { //Retrieve pointer to collection in TDS //do const cast here so we can add to already exisiting collections const CondAttrListCollection* catrc=0; - if(m_debug) m_log << MSG::DEBUG << "Attempting to retrieve collection (const)" << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Attempting to retrieve collection (const)"); if (StatusCode::SUCCESS!=p_detstore->retrieve(catrc,folder)) { - m_log << MSG::ERROR << "Could not retrieve CondAttrListCollection " - << folder << endmsg; + ATH_MSG_ERROR("Could not retrieve CondAttrListCollection " + << folder); return StatusCode::RECOVERABLE; } - if(m_debug) m_log << MSG::DEBUG << "Retrieved. Casting away constness." << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Retrieved. Casting away constness."); atrc=const_cast<CondAttrListCollection*>(catrc); if (atrc==0) { - m_log << MSG::ERROR << "Could not retrieve non-const pointer to atrc" - << endmsg; + ATH_MSG_ERROR("Could not retrieve non-const pointer to atrc" + ); return StatusCode::RECOVERABLE; } - if(m_debug) m_log << MSG::DEBUG << "Casted away." << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Casted away."); //AthenaAttributeList holds info for a single COOL channel @@ -392,9 +388,7 @@ namespace MuonCalib { { unsigned int onlineId; if(!coolChamberChannelToOnlineId(coolChan, onlineId).isSuccess()) { - m_log << MSG::ERROR - << "Failed to retrieve online Id using chamber channel during final write to db." - << endmsg; + ATH_MSG_ERROR("Failed to retrieve online Id using chamber channel during final write to db."); return StatusCode::SUCCESS; } identifier = onlineId; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MDTCondSummarySvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MDTCondSummarySvc.cxx index da4ef7527eed2c125913efe9641e7d6870f5644e..d706daf97c3ff7cd58c02f814422ad5aff2e298b 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MDTCondSummarySvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MDTCondSummarySvc.cxx @@ -3,24 +3,16 @@ */ #include "MuonCondSvc/MDTCondSummarySvc.h" + #include <vector> #include <list> #include <algorithm> #include <sstream> -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/StatusCode.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonCondInterface/IMDTConditionsSvc.h" -#include "Identifier/Identifier.h" - -MDTCondSummarySvc::MDTCondSummarySvc( const std::string& name, ISvcLocator* pSvcLocator ) : + +MDTCondSummarySvc::MDTCondSummarySvc( const std::string& name, ISvcLocator* pSvcLocator) : AthService(name, pSvcLocator), m_reportingServices(name), - m_detStore("DetectorStore",name),m_noReports(true){ - // default services - // m_reportingServices.push_back("MDT_DCSConditionsSvc"); - + m_detStore("DetectorStore",name),m_noReports(true) { declareProperty("ConditionsServices",m_reportingServices); declareProperty("DetStore", m_detStore); } @@ -28,63 +20,30 @@ MDTCondSummarySvc::MDTCondSummarySvc( const std::string& name, ISvcLocator* pSvc StatusCode MDTCondSummarySvc::initialize(){ - StatusCode sc(StatusCode::FAILURE); m_noReports = m_reportingServices.empty(); + ATH_CHECK(m_detStore.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); - sc = m_detStore.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "DetectorStore service not found !" << endmsg; - return sc; - } else { - msg(MSG::INFO) << "DetectorStore service found !" << endmsg; - } - - sc = m_muonIdHelperTool.retrieve(); - if (sc.isFailure()) - { - msg(MSG::FATAL) << " Cannot retrieve MuonIdHelperTool " << endmsg; - return StatusCode::FAILURE; - } - - if (m_noReports){ - sc=StatusCode::SUCCESS; - msg(MSG::INFO)<<"No services were selected for the MDT summary"<<endmsg; + ATH_MSG_DEBUG("No services were selected for the MDT summary"); } else { - sc = m_reportingServices.retrieve(); - if ( sc.isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve " << m_reportingServices << endmsg; - return StatusCode::FAILURE; - } - + ATH_CHECK(m_reportingServices.retrieve()); ServiceHandleArray<IMDTConditionsSvc>::const_iterator pSvc= m_reportingServices.begin(); ServiceHandleArray<IMDTConditionsSvc>::const_iterator pLastSvc= m_reportingServices.end(); for (;pSvc not_eq pLastSvc; ++pSvc){ const std::string& svcName = pSvc->name(); - msg(MSG::INFO)<<"Using "<< svcName << endmsg; + ATH_MSG_DEBUG("Using "<< svcName); if (m_detStore->regFcn(&IMDTConditionsSvc::initInfo,&**pSvc, &MDTCondSummarySvc::update_MDT,this) != StatusCode::SUCCESS){ - msg(MSG::WARNING)<<"Unable to register call back for "<<svcName<<endmsg; + ATH_MSG_WARNING("Unable to register call back for "<<svcName); } else { - msg(MSG::INFO)<<"initInfo registered for call-back for "<<svcName<<endmsg; + ATH_MSG_DEBUG("initInfo registered for call-back for "<<svcName); } } } - - return sc; -} - - - -//Finalize -StatusCode -MDTCondSummarySvc::finalize(){ - msg(MSG::INFO)<<"Thank-you for using the MDTCondSummarySvc, version "<<PACKAGE_VERSION<<endmsg; - //Code return StatusCode::SUCCESS; } - StatusCode MDTCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { @@ -100,26 +59,20 @@ MDTCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) StatusCode MDTCondSummarySvc::update_MDT(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::DEBUG)<<"Register Call Back for MDT System"<<endmsg; - + ATH_MSG_DEBUG("Register Call Back for MDT System"); return StatusCode::SUCCESS; } StatusCode MDTCondSummarySvc::initInfo(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::INFO)<<"Not to be called just dummy"<<endmsg; + ATH_MSG_DEBUG("Not to be called just dummy"); return StatusCode::SUCCESS; } - - - bool MDTCondSummarySvc::isGoodMultiLayer(const Identifier & Id) const{ bool result=true; // check ID - Identifier MultilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(Id); - Identifier ChamberId = m_muonIdHelperTool->mdtIdHelper().elementID(Id); + Identifier MultilayerId = m_idHelperSvc->mdtIdHelper().multilayerID(Id); + Identifier ChamberId = m_idHelperSvc->mdtIdHelper().elementID(Id); if (not m_noReports){ ServiceHandleArray<IMDTConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IMDTConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); @@ -133,7 +86,7 @@ bool MDTCondSummarySvc::isGoodMultiLayer(const Identifier & Id) const{ bool found = std::binary_search((*svc)->deadMultiLayersId().begin(),(*svc)->deadMultiLayersId().end(),MultilayerId,Compare); if(found) result= false; }else{ - msg(MSG::DEBUG)<<" Dead Multilayer from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_DEBUG(" Dead Multilayer from the service are not availables "<<(*svc)); } } @@ -148,8 +101,8 @@ bool MDTCondSummarySvc::isGoodMultiLayer(const Identifier & Id) const{ bool MDTCondSummarySvc::isGoodChannel(const Identifier & Id) const{ bool result=true; Identifier TubeId = Id; - Identifier MultilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(Id); - Identifier ChamberId = m_muonIdHelperTool->mdtIdHelper().elementID(Id); + Identifier MultilayerId = m_idHelperSvc->mdtIdHelper().multilayerID(Id); + Identifier ChamberId = m_idHelperSvc->mdtIdHelper().elementID(Id); if (not m_noReports){ ServiceHandleArray<IMDTConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IMDTConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); @@ -159,14 +112,14 @@ bool MDTCondSummarySvc::isGoodChannel(const Identifier & Id) const{ bool found = std::binary_search((*svc)->deadStationsId().begin(),(*svc)->deadStationsId().end(),ChamberId,Compare); if(found) result= false; - msg(MSG::DEBUG)<<" Chamber Dropped by DCS or not installed at all "<<endmsg; + ATH_MSG_DEBUG(" Chamber Dropped by DCS or not installed at all"); } if ((*svc)->deadMultiLayersId().size()!=0 && result==true){ bool found = std::binary_search((*svc)->deadMultiLayersId().begin(),(*svc)->deadMultiLayersId().end(),MultilayerId,Compare); if(found) result= false; - msg(MSG::DEBUG)<<" MultiLayer Dropped by DCS or not installed at all "<<endmsg; + ATH_MSG_DEBUG(" MultiLayer Dropped by DCS or not installed at all"); } if ((*svc)->deadTubesId().size()!=0 && result==true){ @@ -175,7 +128,7 @@ bool MDTCondSummarySvc::isGoodChannel(const Identifier & Id) const{ }else{ - msg(MSG::DEBUG)<<" Dead Channel from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Channel from the service are not availables "<<(*svc)); result=true; } } @@ -186,8 +139,8 @@ bool MDTCondSummarySvc::isGoodChannel(const Identifier & Id) const{ bool MDTCondSummarySvc::isGood(const Identifier & Id) const{ bool total_result = true; // int counter=0; - Identifier MultilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(Id); - Identifier ChamberId = m_muonIdHelperTool->mdtIdHelper().elementID(Id); + Identifier MultilayerId = m_idHelperSvc->mdtIdHelper().multilayerID(Id); + Identifier ChamberId = m_idHelperSvc->mdtIdHelper().elementID(Id); if (not m_noReports){ ServiceHandleArray<IMDTConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IMDTConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); @@ -198,23 +151,16 @@ bool MDTCondSummarySvc::isGood(const Identifier & Id) const{ bool found = std::binary_search( (*svc)->deadStationsId().begin(),(*svc)->deadStationsId().end(),ChamberId,Compare); if(found) total_result = false; - msg(MSG::VERBOSE)<<" Chamber Dropped by DCS or not installed at all "<<endmsg; + ATH_MSG_WARNING(" Chamber Dropped by DCS or not installed at all"); }else if ((*svc)->deadMultiLayersId().size()!=0){ bool found = std::binary_search( (*svc)->deadMultiLayersId().begin(),(*svc)->deadMultiLayersId().end(),MultilayerId,Compare); if(found) total_result= false; - - //} else if ((*svc)->deadTubesId().size()!=0){ - //int size = (*svc)->deadTubesId().size(); - //bool found = std::binary_search( - // (*svc)->List_Chambers_with_deadTube().begin(),(*svc)->List_Chambers_with_deadTube().end(),ChamberId,Compare); - //if(found) total_result= false; - //msg(MSG::INFO)<<" Chamber with Tubes dead "<<endmsg; - + }else total_result = true; - msg(MSG::VERBOSE)<<"Thank-you for using the MDTCondSummarySvc, service "<<endmsg; + ATH_MSG_VERBOSE("Thank-you for using the MDTCondSummarySvc, service"); } } @@ -224,11 +170,10 @@ bool MDTCondSummarySvc::isGood(const Identifier & Id) const{ bool MDTCondSummarySvc::isGoodChamber(const Identifier & Id) const{ bool result=true; int counter =0; - // Identifier chamberId = m_muonIdHelperTool->mdtIdHelper().elementID(Id); ServiceHandleArray<IMDTConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IMDTConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;svc++){ - msg(MSG::VERBOSE)<<" Dead Stations from the service , size= "<<(*svc)->deadStationsId().size()<<endmsg; + ATH_MSG_VERBOSE(" Dead Stations from the service , size= "<<(*svc)->deadStationsId().size()); if ((*svc)->deadStationsId().size()!=0){ bool found = std::binary_search( @@ -237,13 +182,13 @@ bool MDTCondSummarySvc::isGoodChamber(const Identifier & Id) const{ if(found) counter++; } else{ - msg(MSG::DEBUG)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_DEBUG(" Dead Stations from the service are not availables "<<(*svc)); } } if (counter!=0) result = false; - msg(MSG::VERBOSE)<<" Dead Stations from the service "<< counter <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service "<< counter); return result; @@ -261,7 +206,7 @@ const std::vector<std::string>& MDTCondSummarySvc::deadStations() const{ if ((*svc)->deadStations().size()!=0){ return (*svc)->deadStations(); }else{ - msg(MSG::VERBOSE)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service are not availables "<<(*svc)); } } @@ -281,7 +226,7 @@ const std::vector<std::string>& MDTCondSummarySvc::deadTubes() const{ return (*svc)->deadTubes(); }else{ - msg(MSG::VERBOSE)<<" Dead Tubes from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Tubes from the service are not availables "<<(*svc)); } } } @@ -298,7 +243,7 @@ const std::vector<std::string>& MDTCondSummarySvc::deadMultiLayers() const{ if ((*svc)->deadMultiLayers().size()!=0){ return (*svc)->deadMultiLayers(); }else { - msg(MSG::VERBOSE)<<" Dead Stations MDTConditionsSummarySvc "<<endmsg; + ATH_MSG_WARNING(" Dead Stations MDTConditionsSummarySvc "); } } @@ -318,7 +263,7 @@ const std::vector<Identifier>& MDTCondSummarySvc::deadStationsId() const{ if ((*svc)->deadStationsId().size()!=0){ return (*svc)->deadStationsId(); }else{ - msg(MSG::VERBOSE)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Stations from the service are not availables "<<(*svc)); } } @@ -336,7 +281,7 @@ const std::vector<Identifier>& MDTCondSummarySvc::deadTubesId() const{ if ((*svc)->deadTubesId().size()!=0){ return (*svc)->deadTubesId(); } else{ - msg(MSG::VERBOSE)<<" Dead Tubes from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Tubes from the service are not availables "<<(*svc)); } } } @@ -353,7 +298,7 @@ const std::vector<Identifier>& MDTCondSummarySvc::deadMultiLayersId() const{ if ((*svc)->deadMultiLayersId().size()!=0){ return (*svc)->deadMultiLayersId(); }else{ - msg(MSG::VERBOSE)<<" Dead ML from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead ML from the service are not availables "<<(*svc)); } } @@ -371,7 +316,7 @@ const std::vector<Identifier>& MDTCondSummarySvc::deadLayersId() const{ if ((*svc)->deadLayersId().size()!=0){ return (*svc)->deadLayersId(); }else{ - msg(MSG::VERBOSE)<<" Dead LAYERS from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead LAYERS from the service are not availables "<<(*svc)); } } @@ -389,7 +334,7 @@ const std::vector<Identifier>& MDTCondSummarySvc::List_Chambers_with_deadTube() if ((*svc)->List_Chambers_with_deadTube().size()!=0){ return (*svc)->List_Chambers_with_deadTube(); }else{ - msg(MSG::VERBOSE)<<" Dead Tube Chambers from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_WARNING(" Dead Tube Chambers from the service are not availables "<<(*svc)); } } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RPCCondSummarySvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RPCCondSummarySvc.cxx index 663117a3980c8e9e5310d1eb8d9cbc4e7b151a03..af101c556dc588aa7b039d214422ec3de3daabf0 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RPCCondSummarySvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RPCCondSummarySvc.cxx @@ -2,17 +2,12 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/ISvcLocator.h" +#include "MuonCondSvc/RPCCondSummarySvc.h" + #include <vector> #include <list> #include <algorithm> #include <sstream> -#include "GaudiKernel/StatusCode.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonCondInterface/IRPCConditionsSvc.h" -#include "MuonCondSvc/RPCCondSummarySvc.h" -#include "Identifier/Identifier.h" RPCCondSummarySvc::RPCCondSummarySvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), @@ -22,7 +17,6 @@ RPCCondSummarySvc::RPCCondSummarySvc( const std::string& name, ISvcLocator* pSvc m_rpc_DCSSvc("RPC_DCSConditionsSvc",name), m_noReports(true){ m_reportingServices.push_back("RPC_STATUSConditionsSvc"); - //m_reportingServices.push_back("RPC_DCSConditionsSvc"); declareProperty("ConditionsServices",m_reportingServices); declareProperty("UseSimulation",m_usesimulation=false); } @@ -30,71 +24,35 @@ RPCCondSummarySvc::RPCCondSummarySvc( const std::string& name, ISvcLocator* pSvc //Initialize StatusCode RPCCondSummarySvc::initialize(){ - StatusCode sc(StatusCode::SUCCESS); - // - msg(MSG::INFO)<<"*************Initialize"<<endmsg; m_noReports = m_reportingServices.empty(); - - - StoreGateSvc * detStore; - StatusCode status = service("DetectorStore",detStore); - if (status.isFailure()) { - msg(MSG::FATAL) << "DetectorStore service not found !" << endmsg; - } else { - msg(MSG::INFO) << "DetectorStore service found !" << endmsg; - - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK(m_detStore.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); if(m_usesimulation){ - msg(MSG::INFO) << "Load RPC_DCSService by hand for simulation maps !" << endmsg; - StatusCode sc(StatusCode::SUCCESS); - - if (StatusCode::SUCCESS not_eq sc) { - msg(MSG::ERROR)<<"Could not retrieve the summary service"<<endmsg; - } - sc = m_rpc_StatusSvc.retrieve(); + ATH_MSG_DEBUG("Load RPC_DCSService by hand for simulation maps !"); + ATH_CHECK(m_rpc_StatusSvc.retrieve()); } - if (m_noReports){ - sc=StatusCode::SUCCESS; - msg(MSG::INFO)<<"No services were selected for the RPC summary"<<endmsg; + ATH_MSG_DEBUG("No services were selected for the RPC summary"); } else { - sc = m_reportingServices.retrieve(); - if ( sc.isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve " << m_reportingServices << endmsg; - return StatusCode::FAILURE; - } - + ATH_CHECK(m_reportingServices.retrieve()); + ServiceHandleArray<IRPCConditionsSvc>::const_iterator pSvc= m_reportingServices.begin(); ServiceHandleArray<IRPCConditionsSvc>::const_iterator pLastSvc= m_reportingServices.end(); for (;pSvc not_eq pLastSvc; ++pSvc){ const std::string& svcName = pSvc->name(); - msg(MSG::INFO)<<"Using "<< svcName << endmsg; + ATH_MSG_DEBUG("Using "<< svcName); if (m_detStore->regFcn(&IRPCConditionsSvc::initInfo,&**pSvc, &RPCCondSummarySvc::update_RPC,this) != StatusCode::SUCCESS){ - msg(MSG::WARNING)<<"Unable to register call back for "<<svcName<<endmsg; + ATH_MSG_WARNING("Unable to register call back for "<<svcName); } else { - msg(MSG::INFO)<<"initInfo registered for call-back for "<<svcName<<endmsg; - //std::cout << " initInfo registered for call-back for"<< svcName << std::endl; + ATH_MSG_DEBUG("initInfo registered for call-back for "<<svcName); } } - } - - - return sc; -} - -//Finalize -StatusCode -RPCCondSummarySvc::finalize(){ - StatusCode sc(StatusCode::SUCCESS); - //Code - return sc; + } + return StatusCode::SUCCESS; } StatusCode @@ -112,15 +70,13 @@ RPCCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) StatusCode RPCCondSummarySvc::update_RPC(IOVSVC_CALLBACK_ARGS){ - msg(MSG::INFO)<<"Register Call Back for RPC System"<<endmsg; - - return StatusCode::SUCCESS; + ATH_MSG_DEBUG("Register Call Back for RPC System"); + return StatusCode::SUCCESS; } StatusCode RPCCondSummarySvc::initInfo(IOVSVC_CALLBACK_ARGS){ - msg(MSG::INFO)<<"Not to be called just dummy"<<endmsg; - - return StatusCode::SUCCESS; + ATH_MSG_DEBUG("Not to be called just dummy"); + return StatusCode::SUCCESS; } @@ -129,23 +85,23 @@ bool RPCCondSummarySvc::isGoodPanel(const Identifier & Id) const{ bool result=true; int counter =0; - Identifier PanelId = m_muonIdHelperTool->rpcIdHelper().panelID(Id); + Identifier PanelId = m_idHelperSvc->rpcIdHelper().panelID(Id); //Identifier PanelId = Id; ServiceHandleArray<IRPCConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;svc++){ - msg(MSG::INFO)<<" Eff Panels from the service , size= "<<(*svc)->EffPanelId().size()<<endmsg; + ATH_MSG_DEBUG(" Eff Panels from the service, size= "<<(*svc)->EffPanelId().size()); if ((*svc)->EffPanelId().size()!=0){ bool found = std::binary_search((*svc)->EffPanelId().begin(),(*svc)->EffPanelId().end(),PanelId,Compare); if(found) counter++; } else{ - msg(MSG::INFO)<<" Eff Panels from the service are not available "<<(*svc) <<endmsg; + ATH_MSG_DEBUG(" Eff Panels from the service are not available "<<(*svc)); } } if (counter!=0) result = false; - msg(MSG::INFO)<<" Eff. Panels from the service "<< counter <<endmsg; + ATH_MSG_DEBUG(" Eff. Panels from the service "<< counter); return result; @@ -155,7 +111,7 @@ bool RPCCondSummarySvc::isGoodStrip(const Identifier & Id) const{ bool result=true; Identifier StripId = Id; - Identifier PanelId = m_muonIdHelperTool->rpcIdHelper().panelID(Id); + Identifier PanelId = m_idHelperSvc->rpcIdHelper().panelID(Id); ServiceHandleArray<IRPCConditionsSvc>::const_iterator svc(m_reportingServices.begin()); ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); if (not m_noReports){ @@ -168,7 +124,7 @@ bool RPCCondSummarySvc::isGoodStrip(const Identifier & Id) const{ bool found = std::binary_search((*svc)->EffStripId().begin(),(*svc)->EffStripId().end(),StripId,Compare); if(found) result= false; }else{ - msg(MSG::INFO)<<" Dead Multilayer from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_DEBUG(" Dead Multilayer from the service are not availables "<<(*svc)); } } } @@ -183,9 +139,9 @@ const std::vector<Identifier>& RPCCondSummarySvc::EffPanelId() const{ ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->EffPanelId().size()) return (*svc)->EffPanelId(); - else msg(MSG::DEBUG)<<" Eff Panel from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG(" Eff Panel from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" Efficiency per Panel RPC RPCConditionsSummarySvc "<<endmsg; + ATH_MSG_DEBUG(" Efficiency per Panel RPC RPCConditionsSummarySvc "); } return m_emptyId; @@ -201,9 +157,9 @@ const std::vector<Identifier>& RPCCondSummarySvc::EffStripId() const{ for (;svc not_eq lastSvc;++svc){ if((*svc)->EffStripId().size()) return (*svc)->EffStripId(); - else msg(MSG::DEBUG)<<" Eff Strip from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG(" Eff Strip from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" Efficiency per Strip RPC RPCConditionsSummarySvc "<<endmsg; + ATH_MSG_DEBUG(" Efficiency per Strip RPC RPCConditionsSummarySvc "); } return m_emptyId; @@ -216,9 +172,9 @@ const std::vector<Identifier>& RPCCondSummarySvc::deadPanelId() const{ ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->deadPanelId().size())return (*svc)->deadPanelId(); - else msg(MSG::DEBUG)<<" DeadPanel from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG(" DeadPanel from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" dead panel RPC RPCConditionsSummarySvc "<<endmsg; + ATH_MSG_DEBUG(" dead panel RPC RPCConditionsSummarySvc "); } return m_emptyId; @@ -233,9 +189,9 @@ const std::vector<Identifier>& RPCCondSummarySvc::offPanelId() const{ for (;svc not_eq lastSvc;++svc){ if((*svc)->offPanelId().size())return (*svc)->offPanelId(); - else msg(MSG::DEBUG)<<" OffPanel from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG(" OffPanel from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" off panel RPC RPCConditionsSummarySvc "<<endmsg; + ATH_MSG_DEBUG(" off panel RPC RPCConditionsSummarySvc "); } return m_emptyId; } @@ -252,11 +208,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_PanelEfficiencyMap_ for (;svc not_eq lastSvc;++svc){ //std::cout <<"Efficiency per Panel RPC RPCConditionsSummarySvc "<<(*svc)->RPC_EfficiencyMap().size() <<std::endl; if((*svc)->RPC_EfficiencyMap().size()) return (*svc)->RPC_EfficiencyMap(); - else msg(MSG::DEBUG)<<"RPC_EfficiencyMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_EfficiencyMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" Efficiency per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"Efficiency Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG(" Efficiency per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("Efficiency Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelEfficiencyMap_empty; } @@ -269,11 +224,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_GapEfficiencyMap_em ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_EfficiencyGapMap().size()) return (*svc)->RPC_EfficiencyGapMap(); - else msg(MSG::DEBUG)<<"RPC_EfficiencyGapMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_EfficiencyGapMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" GapEfficiency per RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"GapEfficiency Map per RPC "<<endmsg; - + ATH_MSG_DEBUG(" GapEfficiency per RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("GapEfficiency Map per RPC "); return s_RPCCondSummarySvc_RPC_GapEfficiencyMap_empty; } @@ -286,12 +240,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_PanelMeanClusterSiz for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_MeanClusterSizeMap().size()) return (*svc)->RPC_MeanClusterSizeMap(); - else msg(MSG::DEBUG)<<"RPC_MeanClusterSizeMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_MeanClusterSizeMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" MeanClusterSize per Panel RPC RPCConditionsSummarySvc "<<endmsg; - - msg(MSG::VERBOSE)<<"MeanClusterSize Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG(" MeanClusterSize per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("MeanClusterSize Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelMeanClusterSizeMap_empty; } @@ -304,11 +256,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_PanelFracClusterSiz for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_FracClusterSize1Map().size()) return (*svc)->RPC_FracClusterSize1Map(); - else msg(MSG::DEBUG)<<"RPC_FracClusterSize1Map from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_FracClusterSize1Map from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" FracClusterSize1 per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"FracClusterSize1 Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("FracClusterSize1 per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("FracClusterSize1 Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelFracClusterSize1Map_empty; } @@ -321,11 +272,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_PanelFracClusterSiz for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_FracClusterSize2Map().size()) return (*svc)->RPC_FracClusterSize2Map(); - else msg(MSG::DEBUG)<<"RPC_FracClusterSize2Map from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_FracClusterSize2Map from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" FracClusterSize2 per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"FracClusterSize2 Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("FracClusterSize2 per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("FracClusterSize2 Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelFracClusterSize2Map_empty; } @@ -338,11 +288,10 @@ static std::map<Identifier ,double> s_RPCCondSummarySvc_RPC_PanelFracClusterSiz for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_FracClusterSize3Map().size()) return (*svc)->RPC_FracClusterSize3Map(); - else msg(MSG::DEBUG)<<"RPC_FracClusterSize3Map from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_FracClusterSize3Map from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" FracClusterSize3 per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"FracClusterSize3 Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("FracClusterSize3 per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("FracClusterSize3 Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelFracClusterSize3Map_empty; } @@ -354,11 +303,10 @@ static std::map<Identifier ,std::string> s_RPCCondSummarySvc_RPC_PanelDeadStrip ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_DeadStripListMap().size()) return (*svc)->RPC_DeadStripListMap(); - else msg(MSG::DEBUG)<<"RPC_DeadStripListMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_DeadStripListMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" DeadStripList per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"DeadStripList Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("DeadStripList per Panel RPC RPCConditionsSummarySvc"); + ATH_MSG_DEBUG("DeadStripList Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelDeadStripListMap_empty; } @@ -371,11 +319,10 @@ static std::map<Identifier ,float> s_RPCCondSummarySvc_RPC_PanelFracDeadStripMa for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_FracDeadStripMap().size()) return (*svc)->RPC_FracDeadStripMap(); - else msg(MSG::DEBUG)<<"RPC_FracDeadStripMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_FracDeadStripMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" FracDeadStrip per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"FracDeadStrip Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("FracDeadStrip per Panel RPC RPCConditionsSummarySvc"); + ATH_MSG_DEBUG("FracDeadStrip Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelFracDeadStripMap_empty; } @@ -388,11 +335,10 @@ static std::map<Identifier ,int> s_RPCCondSummarySvc_RPC_PanelProjectedTracksMa for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_ProjectedTracksMap().size()) return (*svc)->RPC_ProjectedTracksMap(); - else msg(MSG::DEBUG)<<"RPC_ProjectedTracksMap from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_ProjectedTracksMap from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" ProjectedTracks per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"ProjectedTracks Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("ProjectedTracks per Panel RPC RPCConditionsSummarySvc"); + ATH_MSG_DEBUG("ProjectedTracks Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelProjectedTracksMap_empty; } @@ -404,11 +350,10 @@ static std::map<Identifier ,int> s_RPCCondSummarySvc_RPC_PanelDeadStripList_emp ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_DeadStripList().size()) return (*svc)->RPC_DeadStripList(); - else msg(MSG::DEBUG)<<"RPC_DeadStripList from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_DeadStripList from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<"DeadStripList per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"DeadStripList Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG("DeadStripList per Panel RPC RPCConditionsSummarySvc"); + ATH_MSG_DEBUG("DeadStripList Map per RPC panel"); return s_RPCCondSummarySvc_RPC_PanelDeadStripList_empty; } @@ -420,11 +365,10 @@ static std::map<Identifier ,std::vector<double> > s_RPCCondSummarySvc_RPC_Strip ServiceHandleArray<IRPCConditionsSvc>::const_iterator lastSvc(m_reportingServices.end()); for (;svc not_eq lastSvc;++svc){ if((*svc)->RPC_TimeMapforStrip().size()) return (*svc)->RPC_TimeMapforStrip(); - else msg(MSG::DEBUG)<<"RPC_TimeMapforStrip from the service are not availables "<<(*svc) <<endmsg; + else ATH_MSG_DEBUG("RPC_TimeMapforStrip from the service are not availables "<<(*svc)); } - msg(MSG::INFO)<<" Strip Time per Panel RPC RPCConditionsSummarySvc "<<endmsg; - msg(MSG::VERBOSE)<<"Strip Time Map per RPC panel"<<endmsg; - + ATH_MSG_DEBUG(" Strip Time per Panel RPC RPCConditionsSummarySvc "); + ATH_MSG_DEBUG("Strip Time Map per RPC panel"); return s_RPCCondSummarySvc_RPC_StripTimeMap_empty; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RpcCoolStrSvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RpcCoolStrSvc.cxx index a62ad657739e008d2f4339f84a150bcbd1bd01bd..01ecaff64126de8ce0c70d389c61db63e7d2043f 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RpcCoolStrSvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/RpcCoolStrSvc.cxx @@ -31,17 +31,13 @@ namespace MuonCalib { RpcCoolStrSvc::RpcCoolStrSvc(const std::string& name, ISvcLocator* svc) : AthService(name,svc), - p_detstore(0), - m_log(msgSvc(),name), - m_folder(""), - m_debugLevel(false) + p_detstore(nullptr), + m_folder("") { //declare properties declareProperty("Folder",m_folder); } - RpcCoolStrSvc::~RpcCoolStrSvc() {} - const InterfaceID& RpcCoolStrSvc::type() const { return RpcICoolStrSvc::interfaceID(); @@ -59,64 +55,29 @@ namespace MuonCalib { StatusCode RpcCoolStrSvc::initialize() { - // service initialisation - m_log.setLevel(outputLevel()); //individual outputlevel not known before inialize - m_debugLevel = (m_log.level() <= MSG::DEBUG); - - m_log << MSG::INFO << "Initializing RpcCoolStrSvc" <<endmsg; - - // get detector store, linked to cool database by other algorithms in your - // jobOptions file. - if (StatusCode::SUCCESS!=service("DetectorStore",p_detstore)) { - m_log << MSG::FATAL << "Detector store not found" << endmsg; - return StatusCode::FAILURE; - } - - - m_log << MSG::ERROR << "THIS CODE IS EXPERIMENTAL, NOT TO BE USED IN PRODUCTION" << endmsg; - m_log << MSG::ERROR << "THIS CODE IS EXPERIMENTAL, NOT TO BE USED IN PRODUCTION" << endmsg; - m_log << MSG::ERROR << "************** LOTS OF MEMORY LEAKS YET ***************" << endmsg; - m_log << MSG::ERROR << " USE AT YOUR OWN RISK" << endmsg; - m_log << MSG::ERROR << " USE AT YOUR OWN RISK" << endmsg; - - m_log << MSG::INFO << "using folder " << m_folder<<endmsg; - - //Setup RpcIdHelper - StoreGateSvc* detStore= 0; - StatusCode sc = serviceLocator()->service("DetectorStore",detStore); - - if(sc.isSuccess()) - { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - } - else - { - m_log << MSG::ERROR << "MuonDetDescrMgr not found in DetectorStore " << endmsg; - return sc; - } - - return StatusCode::SUCCESS; - } - - StatusCode RpcCoolStrSvc::finalize() - { - m_log << MSG::DEBUG << "in finalize()" << endmsg; + ATH_MSG_DEBUG("Initializing RpcCoolStrSvc"); + ATH_CHECK(service("DetectorStore",p_detstore)); + ATH_MSG_DEBUG("THIS CODE IS EXPERIMENTAL, NOT TO BE USED IN PRODUCTION"); + ATH_MSG_DEBUG("THIS CODE IS EXPERIMENTAL, NOT TO BE USED IN PRODUCTION"); + ATH_MSG_DEBUG("************** LOTS OF MEMORY LEAKS YET ***************"); + ATH_MSG_DEBUG(" USE AT YOUR OWN RISK"); + ATH_MSG_DEBUG(" USE AT YOUR OWN RISK"); + ATH_MSG_DEBUG("using folder " << m_folder); return StatusCode::SUCCESS; } - StatusCode RpcCoolStrSvc::putOnlineFile(const std::string filename) const { // for the time being let's keep this m_theOnlineEntries.clear(); - m_log << MSG::INFO << "Opening the online mask file " << filename << " for entry into COOL database." << endmsg; + ATH_MSG_DEBUG("Opening the online mask file " << filename << " for entry into COOL database."); //open file std::ifstream in(filename.c_str()); if(!in.is_open()) { - m_log << MSG::ERROR << "Can't open online mask file " << filename << "!" << endmsg; + ATH_MSG_ERROR("Can't open online mask file " << filename << "!"); return StatusCode::FAILURE; } @@ -138,7 +99,7 @@ namespace MuonCalib { } - m_log << MSG::DEBUG << "Finished reading file, now writing to database " << endmsg; + ATH_MSG_DEBUG("Finished reading file, now writing to database "); return writeToOnlineDB(); @@ -155,13 +116,13 @@ namespace MuonCalib { m_theEntries.clear(); - m_log << MSG::INFO << "Opening the calibration file " << filename << " for entry into COOL database." << endmsg; + ATH_MSG_DEBUG("Opening the calibration file " << filename << " for entry into COOL database."); //open file std::ifstream in(filename.c_str()); if(!in.is_open()) { - m_log << MSG::ERROR << "Can't open calibration file " << filename << "!" << endmsg; + ATH_MSG_ERROR("Can't open calibration file " << filename << "!"); return StatusCode::FAILURE; } @@ -181,7 +142,7 @@ namespace MuonCalib { } - m_log << MSG::INFO << "Finished reading file, now writing to database " << endmsg; + ATH_MSG_DEBUG("Finished reading file, now writing to database "); return writeToDB(); @@ -190,38 +151,33 @@ namespace MuonCalib { StatusCode RpcCoolStrSvc::writeToOnlineDB() const{ - CondAttrListCollection* atrc=0; + CondAttrListCollection* atrc=nullptr; if (!p_detstore->contains<CondAttrListCollection>(m_folder)) { - m_log << MSG::DEBUG << "Creating new CondAttrListCollection for folder " - << m_folder << endmsg; + ATH_MSG_DEBUG("Creating new CondAttrListCollection for folder " + << m_folder); CondAttrListCollection* atrc=new CondAttrListCollection(true); if (StatusCode::SUCCESS!=p_detstore->record(atrc,m_folder)) { - m_log << MSG::ERROR << "Could not create CondAttrListCollection " << - m_folder << endmsg; + ATH_MSG_ERROR("Could not create CondAttrListCollection " << + m_folder); return StatusCode::FAILURE; } } // do const cast here so we can add to already exisiting collections - const CondAttrListCollection* catrc=0; - m_log << MSG::DEBUG << "Attempting to retrieve collection (const)" << endmsg; - if (StatusCode::SUCCESS!=p_detstore->retrieve(catrc,m_folder)) { - m_log << MSG::ERROR << "Could not retrieve CondAttrListCollection " << - m_folder << endmsg; - return StatusCode::FAILURE; - } - + const CondAttrListCollection* catrc=nullptr; + ATH_MSG_DEBUG("Attempting to retrieve collection (const)"); + ATH_CHECK(p_detstore->retrieve(catrc,m_folder)); atrc=const_cast<CondAttrListCollection*>(catrc); - if (atrc==0) { - m_log << MSG::ERROR << "Could not retrieve non-const pointer to atrc" <<endmsg; + if (!atrc) { + ATH_MSG_ERROR("Could not retrieve non-const pointer to atrc"); return StatusCode::FAILURE; } - m_log << MSG::DEBUG << "About to create AttributeListSpecification" << endmsg; + ATH_MSG_DEBUG("About to create AttributeListSpecification"); - coral::AttributeListSpecification* aspec=0; + coral::AttributeListSpecification* aspec=nullptr; aspec=new coral::AttributeListSpecification(); aspec->extend("Mask1","string"); aspec->extend("Mask2","string"); @@ -242,7 +198,7 @@ namespace MuonCalib { CondAttrListCollection::ChanNum channum=m_theOnlineEntries[k]->getID(); - m_log << MSG::DEBUG << "About to add channel to: " << atrc << endmsg; + ATH_MSG_DEBUG("About to add channel to: " << atrc); atrc->add(channum,alist); } @@ -265,34 +221,33 @@ namespace MuonCalib { // this writes the contents of theEntries in the db - CondAttrListCollection* atrc=0; + CondAttrListCollection* atrc=nullptr; if (!p_detstore->contains<CondAttrListCollection>(m_folder)) { - m_log << MSG::DEBUG << "Creating new CondAttrListCollection for folder " - << m_folder << endmsg; + ATH_MSG_DEBUG("Creating new CondAttrListCollection for folder " + << m_folder); CondAttrListCollection* atrc=new CondAttrListCollection(true); if (StatusCode::SUCCESS!=p_detstore->record(atrc,m_folder)) { - m_log << MSG::ERROR << "Could not create CondAttrListCollection " << - m_folder << endmsg; + ATH_MSG_ERROR("Could not create CondAttrListCollection " << + m_folder); return StatusCode::FAILURE; } } // do const cast here so we can add to already exisiting collections - const CondAttrListCollection* catrc=0; - m_log << MSG::DEBUG << "Attempting to retrieve collection (const)" << endmsg; + const CondAttrListCollection* catrc=nullptr; + ATH_MSG_DEBUG("Attempting to retrieve collection (const)"); if (StatusCode::SUCCESS!=p_detstore->retrieve(catrc,m_folder)) { - m_log << MSG::ERROR << "Could not retrieve CondAttrListCollection " << - m_folder << endmsg; + ATH_MSG_ERROR("Could not retrieve CondAttrListCollection " << + m_folder); return StatusCode::FAILURE; } atrc=const_cast<CondAttrListCollection*>(catrc); - if (atrc==0) { - m_log << MSG::ERROR << "Could not retrieve non-const pointer to atrc" << - endmsg; + if (!atrc) { + ATH_MSG_ERROR("Could not retrieve non-const pointer to atrc"); return StatusCode::FAILURE; } - m_log << MSG::DEBUG << "About to create AttributeListSpecification" << endmsg; + ATH_MSG_DEBUG("About to create AttributeListSpecification"); coral::AttributeListSpecification* aspec=0; aspec=new coral::AttributeListSpecification(); @@ -324,7 +279,7 @@ namespace MuonCalib { //Changed by Caleb Lampen <lampen@physics.arizona.edu> on Aug 4, 2009. CondAttrListCollection::ChanNum channum = (m_theEntries[k]->getGapID()).get_identifier32().get_compact(); - m_log << MSG::DEBUG << "About to add channel to: " << atrc << endmsg; + ATH_MSG_DEBUG("About to add channel to: " << atrc); atrc->add(channum,alist); } @@ -342,18 +297,18 @@ namespace MuonCalib { StatusCode RpcCoolStrSvc::makeOnlineFile(const std::string fileName) const{ - m_log << MSG::INFO << "Opening online mask output file "<< fileName << " for writing." << endmsg; + ATH_MSG_DEBUG("Opening online mask output file "<< fileName << " for writing."); std::ofstream out(fileName.c_str()); if(!out.is_open()) { - m_log << MSG::ERROR << "Failed opening " << fileName << "!" << endmsg; + ATH_MSG_ERROR("Failed opening " << fileName << "!"); return StatusCode::FAILURE; } - m_log << MSG::DEBUG <<"File is open" << endmsg; + ATH_MSG_DEBUG("File is open"); const CondAttrListCollection* atrc; if (StatusCode::SUCCESS!=p_detstore->retrieve(atrc,m_folder)) { - m_log << MSG::ERROR << "can't find data for folder " << m_folder << endmsg; + ATH_MSG_ERROR("can't find data for folder " << m_folder); return StatusCode::FAILURE; } @@ -383,18 +338,18 @@ namespace MuonCalib { StatusCode RpcCoolStrSvc::makeFile(const std::string fileName) const { - m_log << MSG::INFO << "Opening calibration output file "<< fileName << " for writing." << endmsg; + ATH_MSG_DEBUG("Opening calibration output file "<< fileName << " for writing."); std::ofstream out(fileName.c_str()); if(!out.is_open()) { - m_log << MSG::ERROR << "Failed opening " << fileName << "!" << endmsg; + ATH_MSG_ERROR("Failed opening " << fileName << "!"); return StatusCode::FAILURE; } - m_log << MSG::DEBUG <<"File is open" << endmsg; + ATH_MSG_DEBUG("File is open"); const CondAttrListCollection* atrc; if (StatusCode::SUCCESS!=p_detstore->retrieve(atrc,m_folder)) { - m_log << MSG::ERROR << "can't find data for folder " << m_folder << endmsg; + ATH_MSG_ERROR("can't find data for folder " << m_folder); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/TGCCondSummarySvc.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/TGCCondSummarySvc.cxx index 7cb5e50f882364e7522b384bbb7b5c0f2a553883..55a48d2ee71b9a0dde0db1b2b045f432bb9ac726 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/TGCCondSummarySvc.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/TGCCondSummarySvc.cxx @@ -3,26 +3,19 @@ */ #include "MuonCondSvc/TGCCondSummarySvc.h" + #include <vector> #include <list> #include <algorithm> #include <sstream> #include <iterator> -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/StatusCode.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonCondInterface/ITGCConditionsSvc.h" -#include "Identifier/Identifier.h" // Constructor TGCCondSummarySvc::TGCCondSummarySvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), m_reportingServices(name), - m_pHelper(0), m_detStore("DetectorStore",name), m_noReports(true){ - // m_reportingServices.push_back("MDT_TGCConditionsSvc"); has to be empty!!! declareProperty("ConditionsServices",m_reportingServices); declareProperty("DetStore", m_detStore); } @@ -30,56 +23,30 @@ TGCCondSummarySvc::TGCCondSummarySvc( const std::string& name, ISvcLocator* pSvc StatusCode TGCCondSummarySvc::initialize(){ - StatusCode sc(StatusCode::FAILURE); m_noReports = m_reportingServices.empty(); - - sc = m_detStore.retrieve(); - if (sc.isFailure()) { - msg(MSG::FATAL) << "DetectorStore service not found !" << endmsg; - return sc; - } else { - msg(MSG::INFO) << "DetectorStore service found !" << endmsg; - } - - + ATH_CHECK(m_detStore.retrieve()); if (m_noReports){ - sc=StatusCode::SUCCESS; - msg(MSG::INFO)<<"No services were selected for the TGC summary"<<endmsg; + ATH_MSG_DEBUG("No services were selected for the TGC summary"); } else { - sc = m_reportingServices.retrieve(); - if ( sc.isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve " << m_reportingServices << endmsg; - return StatusCode::FAILURE; - } - + ATH_CHECK(m_reportingServices.retrieve()); + ServiceHandleArray<ITGCConditionsSvc>::const_iterator pSvc= m_reportingServices.begin(); ServiceHandleArray<ITGCConditionsSvc>::const_iterator pLastSvc= m_reportingServices.end(); for (;pSvc not_eq pLastSvc; ++pSvc){ const std::string& svcName = pSvc->name(); - msg(MSG::INFO)<<"Using "<< svcName << endmsg; + ATH_MSG_DEBUG("Using "<< svcName); if (m_detStore->regFcn(&ITGCConditionsSvc::initInfo,&**pSvc, &TGCCondSummarySvc::update_TGC,this) != StatusCode::SUCCESS){ - msg(MSG::WARNING)<<"Unable to register call back for "<<svcName<<endmsg; + ATH_MSG_WARNING("Unable to register call back for "<<svcName); } else { - msg(MSG::INFO)<<"initInfo registered for call-back for "<<svcName<<endmsg; + ATH_MSG_DEBUG("initInfo registered for call-back for "<<svcName); } } } - return sc; -} - - - -//Finalize -StatusCode -TGCCondSummarySvc::finalize(){ - msg(MSG::INFO)<<"Thank-you for using the TGCCondSummarySvc, version "<<PACKAGE_VERSION<<endmsg; - //Code return StatusCode::SUCCESS; } - StatusCode TGCCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { @@ -94,15 +61,12 @@ TGCCondSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) } StatusCode TGCCondSummarySvc::update_TGC(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::INFO)<<"Register Call Back for TGC System"<<endmsg; - + ATH_MSG_DEBUG("Register Call Back for TGC System"); return StatusCode::SUCCESS; } StatusCode TGCCondSummarySvc::initInfo(IOVSVC_CALLBACK_ARGS){ - - msg(MSG::INFO)<<"Not to be called just dummy"<<endmsg; + ATH_MSG_DEBUG("Not to be called just dummy"); return StatusCode::SUCCESS; } @@ -121,8 +85,7 @@ bool TGCCondSummarySvc::isGoodChamber(const Identifier & Id){ (*svc)->deadStationsId().begin(),(*svc)->deadStationsId().end(),Id,Compare); if(found) counter++; }else{ - msg(MSG::INFO)<<" Dead Stations from the service are not available "<<(*svc) <<endmsg; - + ATH_MSG_DEBUG(" Dead Stations from the service are not available "<<(*svc)); } } } @@ -132,12 +95,6 @@ bool TGCCondSummarySvc::isGoodChamber(const Identifier & Id){ } - - - - - - const std::vector<Identifier>& TGCCondSummarySvc::deadStationsId(){ m_emptyId.clear(); if (not m_noReports){ @@ -147,10 +104,9 @@ const std::vector<Identifier>& TGCCondSummarySvc::deadStationsId(){ if ((*svc)->deadStationsId().size()!=0){ return (*svc)->deadStationsId(); }else{ - msg(MSG::INFO)<<" Dead Stations from the service are not availables "<<(*svc) <<endmsg; + ATH_MSG_DEBUG(" Dead Stations from the service are not availables "<<(*svc)); } } - } return m_emptyId; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py index ac91b5b93a75494c0eb1ecfd0492026b40486678..8d6a5498f445250c329fcf677e11995ac2e70f30 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py @@ -138,31 +138,26 @@ if what=="tgc": from AthenaCommon.CfgGetter import getPublicTool -from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool -MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool") -ToolSvc += MuonIdHelperTool -#MuonIdHelperTool.OutputLevel = DEBUG - ## MDT if what=="mdt": from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg - alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + alg = MdtCondDbAlg("MdtCondDbAlg") if run=="dataR1": alg.useRun1SetPoints = False ## CSC if what=="csc": from MuonCondAlg.MuonCondAlgConf import CscCondDbAlg - alg = CscCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + alg = CscCondDbAlg("CscCondDbAlg") ## RPC if what=="rpc": from MuonCondAlg.MuonCondAlgConf import RpcCondDbAlg - alg = RpcCondDbAlg("RpcCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + alg = RpcCondDbAlg("RpcCondDbAlg") ## TGC if what=="tgc": from MuonCondAlg.MuonCondAlgConf import TgcCondDbAlg - alg = TgcCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + alg = TgcCondDbAlg("CscCondDbAlg") ## append to sequence if run=="mc": diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py index f92ef1d0eeac97d36786fe4e438a8214bd30d3f2..32aef9e824a9a8d8995963fdd48aa6ed8c9574de 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py @@ -102,16 +102,8 @@ conddb.addFolder("CSC_OFL", "/CSC/T0PHASE", className='CondAttrListCollection'); ## NEW Data Base Algorithms ##-------------------------------------------------------------- -from AthenaCommon.CfgGetter import getPublicTool - -from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool -MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool") -ToolSvc += MuonIdHelperTool -#MuonIdHelperTool.OutputLevel = DEBUG - - from MuonCondAlg.MuonCondAlgConf import CscCondDbAlg -alg = CscCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) +alg = CscCondDbAlg("CscCondDbAlg") if "mc" in run: alg.isData = False diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py index a6c7f2ba772c3d60e0b661345d2418833a0e527e..f8a4887a3681e6804c5f0774a8f39d765acef266 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration run = "mc" ## "mc" or "dataR1" or "dataR2" @@ -104,16 +104,8 @@ elif run=="dataR2": ## NEW Data Base Algorithms ##-------------------------------------------------------------- -from AthenaCommon.CfgGetter import getPublicTool - -from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool -MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool") -ToolSvc += MuonIdHelperTool -#MuonIdHelperTool.OutputLevel = DEBUG - - from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg -alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) +alg = MdtCondDbAlg("MdtCondDbAlg") if "mc" in run: alg.isData = False diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/CSC_DCSConditionsTool.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/CSC_DCSConditionsTool.h index ed42423f7e8c761312b86a2f09ecbf884e5f0276..e52c66af89ed8bd1abf769f69f7fbd30982fac4d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/CSC_DCSConditionsTool.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/CSC_DCSConditionsTool.h @@ -1,20 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDTOOL_CSC_DCSCONDITIONSTOOL_H #define MUONCONDTOOL_CSC_DCSCONDITIONSTOOL_H -#include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonCondInterface/ICSC_DCSConditionsTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + #include "GaudiKernel/IChronoStatSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class IIOVSvc; -class StatusCode; class CSC_DCSConditionsTool: public AthAlgTool, virtual public ICSC_DCSConditionsTool { @@ -67,7 +65,7 @@ public: std::map<Identifier, int> m_CSC_LayerMap; std::map<Identifier, int> m_CSC_LayerMap_test; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::vector<int> m_wireLayer; std::vector<Identifier> m_cachedDeadStationsId; @@ -79,13 +77,10 @@ public: //private comparison function for Identifier sorting static bool compareId(Identifier x,Identifier y) { return (x > y); } - - std::string m_DataLocation; - - std::string m_dropchamberFolder; - std::string m_hvFolder; - std::string m_chamberFolder; - + std::string m_DataLocation; + std::string m_dropchamberFolder; + std::string m_hvFolder; + std::string m_chamberFolder; std::stringstream m_CSCChamDrop; IChronoStatSvc* m_chronoSvc; @@ -94,10 +89,7 @@ public: std::string m_chrono2; std::string m_chrono3; std::string m_chrono4; - - MsgStream m_log; - bool m_debug; - bool m_verbose; + }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/TGC_STATUSConditionsTool.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/TGC_STATUSConditionsTool.h index 968766eb63d2b33d5a722717ab49d0ce0c87fa16..05781f7d0cdfe54fbd8e45917054285a1398670d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/TGC_STATUSConditionsTool.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/MuonCondTool/TGC_STATUSConditionsTool.h @@ -1,20 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDTOOL_TGC_STATUSCONDITIONSTOOL_H #define MUONCONDTOOL_TGC_STATUSCONDITIONSTOOL_H -#include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/IChronoStatSvc.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonCondInterface/ITGC_STATUSConditionsTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "GaudiKernel/IChronoStatSvc.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class IIOVSvc; -class StatusCode; class TGC_STATUSConditionsTool: public AthAlgTool, virtual public ITGC_STATUSConditionsTool { @@ -37,32 +35,24 @@ public: virtual StatusCode loadTgcDqStatus(IOVSVC_CALLBACK_ARGS); virtual std::string FolderName() const {return m_FolderName;} - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; virtual const std::vector<Identifier>& deadStationsId(){ return m_cachedDeadStationsId;} IIOVSvc* m_IOVSvc; - std::vector<Identifier> m_cachedDeadStationsId; - std::string m_tgcDqFolder; - std::string m_tgcDqStatusDataLocation; - std::string m_FolderName; + std::string m_tgcDqFolder; + std::string m_tgcDqStatusDataLocation; + std::string m_FolderName; - - IChronoStatSvc* m_chronoSvc; std::string m_chrono1; std::string m_chrono2; std::string m_chrono3; std::string m_chrono4; - MsgStream m_log; - bool m_debug; - bool m_verbose; }; - - #endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/CSC_DCSConditionsTool.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/CSC_DCSConditionsTool.cxx index befc3c67606f34509c7a208ea29f5235393b12a9..b77663f0408f4ea8f55a3b6c78f94e72ebe7a40e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/CSC_DCSConditionsTool.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/CSC_DCSConditionsTool.cxx @@ -1,25 +1,23 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "MuonCondTool/CSC_DCSConditionsTool.h" #include "SGTools/TransientAddress.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - #include "PathResolver/PathResolver.h" +#include "MuonCondSvc/MdtStringUtils.h" + #include <fstream> #include <string> #include <algorithm> #include <stdio.h> #include <map> -#include "MuonCondTool/CSC_DCSConditionsTool.h" -#include "MuonCondSvc/MdtStringUtils.h" - //********************************************************** //* Author Monica Verducci monica.verducci@cern.ch //* @@ -27,159 +25,77 @@ //* retrieving of tables from DB //********************************************************* - -CSC_DCSConditionsTool::CSC_DCSConditionsTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_IOVSvc(0), - m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_chronoSvc(0), - m_log( msgSvc(), name ), - m_debug(true), - m_verbose(false) -{ - +CSC_DCSConditionsTool::CSC_DCSConditionsTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent), + m_IOVSvc(nullptr), + m_chronoSvc(nullptr) { declareInterface< ICSC_DCSConditionsTool >(this); - - m_DataLocation="keyCSCDCS"; declareProperty("HVFolder", m_hvFolder="/CSC/DCS/LAYERSTATE"); declareProperty("ChamberFolder", m_chamberFolder="/CSC/DCS/ENABLEDCHAMBERS"); } - -//StatusCode CSC_DCSConditionsTool::updateAddress(SG::TransientAddress* /*tad*/) StatusCode CSC_DCSConditionsTool::updateAddress(StoreID::type /*storeID*/, SG::TransientAddress* /*tad*/, - const EventContext& /*ctx*/) -{ + const EventContext& /*ctx*/) { return StatusCode::FAILURE; } - - - -StatusCode CSC_DCSConditionsTool::initialize() -{ - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - - m_log << MSG::INFO << "Initializing - folders names are: ChamberDropped "<<m_chamberFolder << " Hv " << m_hvFolder<< endmsg; - +StatusCode CSC_DCSConditionsTool::initialize() { + ATH_MSG_INFO("Initializing - folders names are: ChamberDropped "<<m_chamberFolder << " Hv " << m_hvFolder); // Get interface to IOVSvc - m_IOVSvc = 0; bool CREATEIF(true); - StatusCode sc = service( "IOVSvc", m_IOVSvc, CREATEIF ); - if ( sc.isFailure() ) - { - m_log << MSG::ERROR << "Unable to get the IOVSvc" << endmsg; - return StatusCode::FAILURE; - } - - if(sc.isFailure()) return StatusCode::FAILURE; - - - + ATH_CHECK(service( "IOVSvc", m_IOVSvc, CREATEIF)); // initialize the chrono service - sc = service("ChronoStatSvc",m_chronoSvc); - if (sc != StatusCode::SUCCESS) { - m_log << MSG::ERROR << "Could not find the ChronoSvc" << endmsg; - return sc; - } - - - - if(sc.isFailure()) return StatusCode::FAILURE; - - return m_muonIdHelperTool.retrieve(); + ATH_CHECK(service("ChronoStatSvc",m_chronoSvc)); + ATH_CHECK(m_idHelperSvc.retrieve()); + return StatusCode::SUCCESS; } - -StatusCode CSC_DCSConditionsTool::loadParameters(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - +StatusCode CSC_DCSConditionsTool::loadParameters(IOVSVC_CALLBACK_ARGS_P(I,keys)) { std::list<std::string>::const_iterator itr; for (itr=keys.begin(); itr!=keys.end(); ++itr) { - m_log << MSG::INFO <<"LoadParameters "<< *itr << " I="<<I<<" "<<endmsg; + ATH_MSG_INFO("LoadParameters "<< *itr << " I="<<I<<" "); if (*itr==m_hvFolder) { - StatusCode sc = loadHV(I,keys); - if (sc.isFailure()) - { - return sc; - } + ATH_CHECK(loadHV(I,keys)); }else if(*itr==m_chamberFolder) { - StatusCode sc = loadchamber(I,keys); - if (sc.isFailure()) - { - return sc; - } + ATH_CHECK(loadchamber(I,keys)); } - } - - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } - - -StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - - StatusCode sc=StatusCode::SUCCESS; - m_log << MSG::INFO << "Load HV from DCS DB" << endmsg; - const CondAttrListCollection * atrc; - m_log << MSG::INFO << "Try to read from folder <"<<m_hvFolder<<">"<<endmsg; - +StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) { + ATH_MSG_INFO("Load HV from DCS DB"); + const CondAttrListCollection* atrc=nullptr; + ATH_MSG_INFO("Try to read from folder <"<<m_hvFolder<<">"); // Print out callback information - if( m_debug ) m_log << MSG::DEBUG << "Level " << I << " Keys: "; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Level " << I << " Keys: "); std::list<std::string>::const_iterator keyIt = keys.begin(); - for (; keyIt != keys.end(); ++ keyIt) if( m_debug ) m_log << MSG::DEBUG << *keyIt << " "; - if( m_debug ) m_log << MSG::DEBUG << endmsg; - + for (; keyIt != keys.end(); ++ keyIt) if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(*keyIt << " "); - sc=detStore()->retrieve(atrc,m_hvFolder); - - if(sc.isFailure()) { - m_log << MSG::ERROR - << "could not retreive the CondAttrListCollection from DB folder " - << m_hvFolder << endmsg; - return sc; - } - - else - m_log<<MSG::INFO<<" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size() <<endmsg; + ATH_CHECK(detStore()->retrieve(atrc,m_hvFolder)); + ATH_MSG_INFO("CondAttrListCollection from DB folder have been obtained with size "<< atrc->size()); CondAttrListCollection::const_iterator itr; Identifier ChamberId; - unsigned int layer_index=0; - unsigned int chan_index=0; - //Identifier name_control; - + unsigned int layer_index=0; + unsigned int chan_index=0; std::map<Identifier,int>::const_iterator it; std::pair<std::map<Identifier,int>::const_iterator,bool> ret; int hv_state, lv_state, hv_setpoint0, hv_setpoint1; for (itr = atrc->begin(); itr != atrc->end(); ++itr){ - if( m_debug ) m_log<<MSG::DEBUG<<"index "<<chan_index<< " chanNum :" <<atrc->chanNum(chan_index)<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("index "<<chan_index<< " chanNum :" <<atrc->chanNum(chan_index)); unsigned int chanNum=atrc->chanNum(chan_index); std::string csc_chan_name=atrc->chanName(chanNum); itr=atrc-> chanAttrListPair(chanNum); const coral::AttributeList& atr=itr->second; - if( m_debug ) m_log<<MSG::DEBUG<<" CondAttrListCollection ChanNum : "<<chanNum<<" AttributeList size : " << atr.size()<< " Channel Name = "<< csc_chan_name <<endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" CondAttrListCollection ChanNum : "<<chanNum<<" AttributeList size : " << atr.size()<< " Channel Name = "<< csc_chan_name); - //if(atr.size()==1){ if(atr.size()){ hv_state=*(static_cast<const int*>((atr["HVState"]).addressOfData())); @@ -192,12 +108,11 @@ StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) std::string delimiter = "_"; std::vector<std::string> tokens; MuonCalib::MdtStringUtils::tokenize(csc_chan_name,tokens,delimiter); - // if( m_debug ) m_log<<MSG::DEBUG<<" CondAttrListCollection ChanNum : "<<chanNum<<" ChanName : " << atrc->chanName(chanNum) << " tokens[0] "<<tokens[0] <<endmsg; for (unsigned int i=0; i<tokens.size(); i++) { if(tokens[i]!="0"){ - if( m_debug ) m_log << MSG::DEBUG << "Sequence for name string load is \n" << tokens[i]<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Sequence for name string load is \n" << tokens[i]); } } @@ -206,7 +121,7 @@ StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) if((hv_state!=1 or lv_state!=1 or hv_setpoint0 <1000 or hv_setpoint1 <1000) && tokens.size()!=0){ - if( m_debug ) m_log << MSG::DEBUG << "NOT 0 HV : " << hv_state << " ChamberName : "<<tokens[0] << "wirelayer" << tokens[1]<<endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("NOT 0 HV : " << hv_state << " ChamberName : "<<tokens[0] << "wirelayer" << tokens[1]); int eta=0; int phi=0; //std::string chamber_name; std::string layer = tokens[1]; @@ -231,22 +146,20 @@ StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) if (sector_side == "13" || sector_side == "14") phi=7; if (sector_side == "15" || sector_side == "16") phi=8; - ChamberId = m_muonIdHelperTool->cscIdHelper().elementID(chamber_name, eta, phi); - Identifier WireLayerId = m_muonIdHelperTool->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1); - if( m_debug ) m_log<<MSG::DEBUG<< "chamber Name = " <<chamber_name<< endmsg; + ChamberId = m_idHelperSvc->cscIdHelper().elementID(chamber_name, eta, phi); + Identifier WireLayerId = m_idHelperSvc->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1); + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("chamber Name = " <<chamber_name); std::string WireLayerstring = chamber_name+"_"+eta_side+"_"+sector_side+"_"+layer; m_cachedDeadWireLayers.push_back(WireLayerstring); - if( m_debug ) m_log<<MSG::DEBUG<< "Layers Off = " <<WireLayerstring<< endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Layers Off = " <<WireLayerstring); m_cachedDeadWireLayersId.push_back(WireLayerId); - - //m_CSC_LayerMap.insert(std::make_pair(ChamberId,wirelayer)); - //ret= m_CSC_LayerMap.insert(std::make_pair(ChamberId,wirelayer)); - //if (ret.second==false) + if(m_CSC_LayerMap.count(ChamberId)) { - if( m_debug ) m_log<<MSG::DEBUG<< "element 'ChamberId' already existed"; - //if( m_debug ) m_log<<MSG::DEBUG<< " with a value of " << ret.first->second << endmsg; - if( m_debug ) m_log<<MSG::DEBUG<< " with a value of " << m_CSC_LayerMap[ChamberId] << endmsg; + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("element 'ChamberId' already existed"); + ATH_MSG_DEBUG(" with a value of " << m_CSC_LayerMap[ChamberId]); + } layer_index++; } m_CSC_LayerMap[ChamberId]=wirelayer; @@ -258,56 +171,32 @@ StatusCode CSC_DCSConditionsTool::loadHV(IOVSVC_CALLBACK_ARGS_P(I,keys)) if(layer_index==3) { m_cachedDeadStations.push_back(ChamberId); - if( m_debug ) m_log << MSG::DEBUG << "layers " << layer_index << " ChamberId : "<<ChamberId <<endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("layers " << layer_index << " ChamberId : "<<ChamberId); layer_index=0; } chan_index++; } - - - - return StatusCode::SUCCESS; - - } - - +} -StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - StatusCode sc=StatusCode::SUCCESS; - m_log << MSG::INFO << "Load chamber from DCS DB" << endmsg; +StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) { + ATH_MSG_INFO("Load chamber from DCS DB"); // Print out callback information - if( m_debug ) m_log << MSG::DEBUG << "Level " << I << " Keys: "; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Level " << I << " Keys: "); std::list<std::string>::const_iterator keyIt = keys.begin(); - for (; keyIt != keys.end(); ++ keyIt) if( m_debug ) m_log << MSG::DEBUG << *keyIt << " "; - if( m_debug ) m_log << MSG::DEBUG << endmsg; - + for (; keyIt != keys.end(); ++ keyIt) if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(*keyIt << " "); - const CondAttrListCollection * atrc; - m_log << MSG::INFO << "Try to read from folder <"<<m_chamberFolder<<">"<<endmsg; + const CondAttrListCollection* atrc=nullptr; + ATH_MSG_INFO("Try to read from folder <"<<m_chamberFolder<<">"); - sc=detStore()->retrieve(atrc,m_chamberFolder); - - if(sc.isFailure()) { - m_log << MSG::ERROR - << "could not retreive the CondAttrListCollection from DB folder " - << m_chamberFolder << endmsg; - return sc; - } - - else - m_log<<MSG::INFO<<" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size() <<endmsg; + ATH_CHECK(detStore()->retrieve(atrc,m_chamberFolder)); + ATH_MSG_INFO(" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size()); CondAttrListCollection::const_iterator itr; Identifier ChamberId; @@ -321,7 +210,7 @@ StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) for (itr = atrc->begin(); itr != atrc->end(); ++itr){ const coral::AttributeList& atr=itr->second; - if( m_debug ) m_log<<MSG::DEBUG<<"AttributeList size : " << atr.size() <<endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("AttributeList size : " << atr.size()); std::string chamber_enabled=*(static_cast<const std::string*>((atr["enabledChambers"]).addressOfData())); @@ -342,10 +231,9 @@ StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) for(unsigned int count=0; count<chamber_good.size(); count++){ if (binary_search (chamber_v.begin(), chamber_v.end(),chamber_good[count])){ - if( m_debug ) m_log<<MSG::DEBUG<< "found chamber good!\n" - <<chamber_v[count] <<endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("found chamber good!\n" <<chamber_v[count]); }else { - if( m_debug ) m_log<<MSG::DEBUG << " not found = " << chamber_good[count] << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" not found = " << chamber_good[count]); m_cachedDeadStationsStr.push_back(chamber_good[count]); } @@ -372,7 +260,7 @@ StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) if (sector_side == "02" || sector_side == "04" || sector_side == "06"|| sector_side == "08" || sector_side == "10"|| sector_side == "12"|| sector_side == "14"|| sector_side == "16") chamber_name = "CSS"; - Identifier ChamberId = m_muonIdHelperTool->cscIdHelper().elementID(chamber_name, eta, phi); + Identifier ChamberId = m_idHelperSvc->cscIdHelper().elementID(chamber_name, eta, phi); m_cachedDeadStationsId_chamber.push_back(ChamberId); @@ -380,21 +268,13 @@ StatusCode CSC_DCSConditionsTool::loadchamber(IOVSVC_CALLBACK_ARGS_P(I,keys)) //merge deadStationsId with deadWireStationsId, then sort the vector elements and //finally remove duplicates - - if( m_verbose ) m_log << MSG::VERBOSE << "Now merging the DeadStationsId with DeadWireStationsId" << endmsg; + if (msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Now merging the DeadStationsId with DeadWireStationsId"); m_cachedDeadStationsId.insert( m_cachedDeadStationsId.end(), m_cachedDeadStationsId_chamber.begin(),m_cachedDeadStationsId_chamber.end()); std::sort(m_cachedDeadStationsId.begin(),m_cachedDeadStationsId.end(),compareId); std::vector<Identifier>::const_iterator itId; itId= std::unique(m_cachedDeadStationsId.begin(),m_cachedDeadStationsId.end()); m_cachedDeadStationsId.resize(itId -m_cachedDeadStationsId.begin()); - - - - return StatusCode::SUCCESS; - - - } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/TGC_STATUSConditionsTool.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/TGC_STATUSConditionsTool.cxx index e178e5cd6475928499cbb253b8ac21634424916d..6a5ee852fd4e887570232c282aeb309ef82c4fbe 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/TGC_STATUSConditionsTool.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool/src/TGC_STATUSConditionsTool.cxx @@ -1,182 +1,87 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "MuonCondTool/TGC_STATUSConditionsTool.h" #include "SGTools/TransientAddress.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - #include "PathResolver/PathResolver.h" +#include "GeoModelInterfaces/IGeoModelSvc.h" + #include <fstream> #include <string> #include <stdio.h> #include <map> -#include "MuonCondTool/TGC_STATUSConditionsTool.h" -#include "MuonCondInterface/ITGC_STATUSConditionsTool.h" - -#include "GeoModelInterfaces/IGeoModelSvc.h" - - - -TGC_STATUSConditionsTool::TGC_STATUSConditionsTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_IOVSvc(0), - m_chronoSvc(0), - m_log( msgSvc(), name ), - m_debug(false), - m_verbose(false) -{ +TGC_STATUSConditionsTool::TGC_STATUSConditionsTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent), + m_IOVSvc(nullptr), + m_chronoSvc(nullptr) { declareInterface< ITGC_STATUSConditionsTool >(this); - m_tgcDqStatusDataLocation="TgcDqStatusKey"; - declareProperty("TgcDqFolder",m_FolderName="TGC/1/DetectorStatus"); - } - - -//StatusCode TGC_STATUSConditionsTool::updateAddress(SG::TransientAddress* tad) StatusCode TGC_STATUSConditionsTool::updateAddress(StoreID::type /*storeID*/, SG::TransientAddress* tad, - const EventContext& /*ctx*/) -{ - - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - // CLID clid = tad->clID(); + const EventContext& /*ctx*/) { std::string key = tad->name(); - return StatusCode::FAILURE; } - - - -StatusCode TGC_STATUSConditionsTool::initialize() -{ - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - m_log << MSG::INFO << "Initializing - folders names are: Chamber Status "<<m_FolderName << endmsg; - +StatusCode TGC_STATUSConditionsTool::initialize() { + ATH_MSG_INFO("Initializing - folders names are: Chamber Status "<<m_FolderName); // Get interface to IOVSvc - m_IOVSvc = 0; bool CREATEIF(true); - StatusCode sc = service( "IOVSvc", m_IOVSvc, CREATEIF ); - if ( sc.isFailure() ) - { - m_log << MSG::ERROR << "Unable to get the IOVSvc" << endmsg; - return StatusCode::FAILURE; - } - - if(sc.isFailure()) return StatusCode::FAILURE; - - - + ATH_CHECK(service( "IOVSvc", m_IOVSvc, CREATEIF)); // initialize the chrono service - sc = service("ChronoStatSvc",m_chronoSvc); - if (sc != StatusCode::SUCCESS) { - m_log << MSG::ERROR << "Could not find the ChronoSvc" << endmsg; - return sc; - } - if(sc.isFailure()) return StatusCode::FAILURE; - - return m_muonIdHelperTool.retrieve(); - + ATH_CHECK(service("ChronoStatSvc",m_chronoSvc)); + ATH_CHECK(m_idHelperSvc.retrieve()); + return StatusCode::SUCCESS; } -StatusCode TGC_STATUSConditionsTool::loadParameterStatus(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; +StatusCode TGC_STATUSConditionsTool::loadParameterStatus(IOVSVC_CALLBACK_ARGS_P(I,keys)) { std::list<std::string>::const_iterator itr; for (itr=keys.begin(); itr!=keys.end(); ++itr) { - m_log << MSG::INFO <<"LoadParameters "<< *itr << " I="<<I<<" "<<endmsg; + ATH_MSG_INFO("LoadParameters "<< *itr << " I="<<I<<" "); if(*itr==m_FolderName) { - StatusCode sc =loadTgcDqStatus(I,keys); - if (sc.isFailure()) - { - return sc; - } + ATH_CHECK(loadTgcDqStatus(I,keys)); } - } - return StatusCode::SUCCESS; } - - - - - -StatusCode TGC_STATUSConditionsTool::loadTgcDqStatus(IOVSVC_CALLBACK_ARGS_P(I,keys)) -{ - m_log.setLevel(msgLevel()); - m_debug = m_log.level() <= MSG::DEBUG; - m_verbose = m_log.level() <= MSG::VERBOSE; - - StatusCode sc=StatusCode::SUCCESS; - m_log << MSG::INFO << "Load Tgc Status flags from DB" << endmsg; - +StatusCode TGC_STATUSConditionsTool::loadTgcDqStatus(IOVSVC_CALLBACK_ARGS_P(I,keys)) { + ATH_MSG_INFO("Load Tgc Status flags from DB"); // Print out callback information - if( m_debug ) m_log << MSG::DEBUG << "Level " << I << " Keys: "; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Level " << I << " Keys: "); std::list<std::string>::const_iterator keyIt = keys.begin(); - for (; keyIt != keys.end(); ++ keyIt) if( m_debug ) m_log << MSG::DEBUG << *keyIt << " "; - if( m_debug ) m_log << MSG::DEBUG << endmsg; + for (; keyIt != keys.end(); ++ keyIt) if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(*keyIt << " "); - const CondAttrListCollection * atrc = nullptr; - m_log << MSG::INFO << "Try to read from folder <"<< m_FolderName <<">"<<endmsg; + const CondAttrListCollection* atrc = nullptr; + ATH_MSG_INFO("Try to read from folder <"<< m_FolderName <<">"); + + ATH_CHECK(detStore()->retrieve(atrc,m_FolderName)); + ATH_MSG_INFO("CondAttrListCollection from DB folder have been obtained with size "<< atrc->size()); - sc=detStore()->retrieve(atrc,m_FolderName); - if(sc.isFailure()) { - m_log << MSG::ERROR - << "could not retreive the CondAttrListCollection from DB folder " - << m_FolderName << endmsg; - return sc; - } - - else - m_log<<MSG::INFO<<" CondAttrListCollection from DB folder have been obtained with size "<< atrc->size() <<endmsg; - - CondAttrListCollection::const_iterator itr; for (itr = atrc->begin(); itr != atrc->end(); ++itr) { const coral::AttributeList& atr=itr->second; int detector_status; detector_status=*(static_cast<const int*>((atr["detector_status"]).addressOfData())); - if( m_debug ) m_log << MSG::DEBUG << "TGC detector status is " << detector_status << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("TGC detector status is " << detector_status); if (detector_status!=0){ int channum=itr->first; - Identifier chamberId = m_muonIdHelperTool->tgcIdHelper().elementID(Identifier(channum)); - //m_cachedDeadStationsId.push_back(Identifier(channum)); + Identifier chamberId = m_idHelperSvc->tgcIdHelper().elementID(Identifier(channum)); m_cachedDeadStationsId.push_back(chamberId); } - } - - - if( m_debug ) m_log << MSG::VERBOSE << "Collection CondAttrListCollection CLID " - << atrc->clID() << endmsg; - - - - return sc; - + } + if (msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("Collection CondAttrListCollection CLID " << atrc->clID()); + return StatusCode::SUCCESS; } - - - diff --git a/MuonSpectrometer/MuonConfig/python/MuonRIO_OnTrackCreatorConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRIO_OnTrackCreatorConfig.py index 0ca39524f08d921501b691f5bf77e225ce22afe3..82f4236a395edc14092ad63e65aaed74e418544e 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRIO_OnTrackCreatorConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRIO_OnTrackCreatorConfig.py @@ -97,8 +97,6 @@ def MuonClusterOnTrackCreatorCfg(flags,name="MuonClusterOnTrackCreator", **kwarg # scale TGC eta hit errors as long as TGC eta are not well aligned kwargs.setdefault("DoFixedErrorTgcEta", True) kwargs.setdefault("FixedErrorTgcEta", 15.) - - # TODO Fixme - the cxx class retrieves public MuonIdHelperTool ... should be private / service. muon_cluster_rot_creator = Muon__MuonClusterOnTrackCreator(name, **kwargs) result.addPublicTool(muon_cluster_rot_creator, primary=True) diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py index 76b4edd7c4d4d1c2bf861a3170ed2a6d05124b4c..7d5dca30640f6ccb106e064327f36a393a30e701 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py @@ -63,7 +63,11 @@ def RpcRDODecodeCfg(flags, forTrigger=False): RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataToolMT(name = "RpcRdoToRpcPrepDataTool") if flags.Common.isOnline: RpcRdoToRpcPrepDataTool.ReadKey = "" ## cond data not needed online - + + if forTrigger: + RpcRdoToRpcPrepDataTool.RpcPrdContainerCacheKey = MuonPrdCacheNames.RpcCache + RpcRdoToRpcPrepDataTool.RpcCoinDataContainerCacheKey = MuonPrdCacheNames.RpcCoinCache + # Get the RDO -> PRD alorithm RpcRdoToRpcPrepData=CompFactory.RpcRdoToRpcPrepData RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name = "RpcRdoToRpcPrepData", @@ -76,7 +80,6 @@ def RpcRDODecodeCfg(flags, forTrigger=False): from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection RpcRdoToRpcPrepData.RoIs = mapThresholdToL1RoICollection("MU") - acc.addEventAlgo(RpcRdoToRpcPrepData) return acc @@ -134,8 +137,9 @@ def MdtRDODecodeCfg(flags, forTrigger=False): DecodingTool = MdtRdoToMdtPrepDataTool, PrintPrepData = False ) # add RegSelTool - from RegionSelector.RegSelToolConfig import makeRegSelTool_MDT - MdtRdoToMdtPrepData.RegSel_MDT = makeRegSelTool_MDT() + # Comented out since this needs to be replaced by new config for region selector + #from RegionSelector.RegSelToolConfig import makeRegSelTool_MDT + #MdtRdoToMdtPrepData.RegSel_MDT = makeRegSelTool_MDT() if forTrigger: # Set the algorithm to RoI mode @@ -143,9 +147,10 @@ def MdtRDODecodeCfg(flags, forTrigger=False): from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection MdtRdoToMdtPrepData.RoIs = mapThresholdToL1RoICollection("MU") - #acc.addEventAlgo(MdtRdoToMdtPrepData) #commented to pass test_trig_data_newJO_build.py after using makeRegSelTool_MDT + acc.addEventAlgo(MdtRdoToMdtPrepData) return acc + def CscRDODecodeCfg(flags, forTrigger=False): acc = ComponentAccumulator() diff --git a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py index 3f7d08d8082fca6ce1170a2540cc7700fecb44a9..e71a50940ac785381b36db6c33c3ebfc5e31e61e 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py @@ -84,11 +84,7 @@ def MuonSegmentMomentumFromFieldCfg(flags, name="MuonSegmentMomentumFromField", return result def MuonTrackSummaryHelperToolCfg(flags, name="MuonTrackSummaryHelperTool", **kwargs): - # m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - # m_edmHelperTool("Muon::MuonEDMHelperSvc/MuonEDMHelperSvc"), - # m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"), - # m_slExtrapolator("Trk::Extrapolator/MuonStraightLineExtrapolator"), - + result = ComponentAccumulator() acc = TrackingGeometrySvcCfg(flags) @@ -156,7 +152,6 @@ def MuonAmbiProcessorCfg(flags, name="MuonAmbiProcessor", **kwargs): def MuonTrackCleanerCfg(flags, name="MuonTrackCleaner", **kwargs): Muon__MuonTrackCleaner=CompFactory.Muon.MuonTrackCleaner from MuonConfig.MuonRIO_OnTrackCreatorConfig import MdtDriftCircleOnTrackCreatorCfg, TriggerChamberClusterOnTrackCreatorCfg - # declareProperty("IdHelper",m_idHelper); # declareProperty("Helper",m_edmHelperSvc); # declareProperty("Printer",m_printer); # declareProperty("MdtRotCreator", m_mdtRotCreator ); diff --git a/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py b/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py index 5725b1e04a5d46373e907c7ddd851071d3010914..ae0d620c7a202362e9ae1d52fa9b02d56893a6bf 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py @@ -59,7 +59,7 @@ if __name__=="__main__": itemsToRecord += ["TrackCollection#MuonSpectrometerTracks"] SetupMuonStandaloneOutput(cfg, ConfigFlags, itemsToRecord) - cfg.printConfig(withDetails = True, summariseProps = True) + cfg.printConfig(withDetails = True) f=open("MuonReconstruction.pkl","wb") cfg.store(f) diff --git a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py index c22e71be43e84f5684dd2795394696c86ad4e1a1..ebde1a086a84cb3dc9956211d56c289520c4dda2 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py @@ -102,7 +102,6 @@ def MuonSegmentFittingToolCfg(flags, **kwargs): # declareProperty("SLFitter", m_slTrackFitter); # declareProperty("CurvedFitter", m_curvedTrackFitter); # declareProperty("TrackCleaner", m_trackCleaner); - # declareProperty("IdHelper", m_idHelperTool); # declareProperty("UpdatePrecisionCoordinate", m_updatePrecisionCoordinate = false ); result=ComponentAccumulator() # FIXME! Add this. @@ -143,7 +142,6 @@ def DCMathSegmentMakerCfg(flags, **kwargs): # ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtCreatorT0; //<! mdt rio ontrack creator # ToolHandle<IMuonClusterOnTrackCreator> m_clusterCreator; //<! cluster rio ontrack creator # ToolHandle<IMuonCompetingClustersOnTrackCreator> m_compClusterCreator; //<! competing clusters rio ontrack creator - # ToolHandle<MuonIdHelperTool> m_idHelperTool; //<! Id helper tool # ToolHandle<MuonEDMPrinterTool> m_printer; //<! printer helper tool # ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc; //<! printer helper tool # ToolHandle<IMdtSegmentFinder> m_segmentFinder; //<! segment finder tool MdtSegmentFinder @@ -255,7 +253,7 @@ def MuonPatternSegmentMakerCfg(flags, **kwargs): # Taken from https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py#L49 # Tool has the following subtools: - # DCMathSegmentMaker, MdtDriftCircleOnTrackCreator, MuonClusterOnTrackCreator, MuonEDMPrinterTool, MuonIdHelperTool + # DCMathSegmentMaker, MdtDriftCircleOnTrackCreator, MuonClusterOnTrackCreator, MuonEDMPrinterTool result=ComponentAccumulator() if "MdtCreator" not in kwargs: @@ -281,7 +279,7 @@ def MuonPatternSegmentMakerCfg(flags, **kwargs): result.merge(acc) # Other dependencies: - # EDM printer tool, MuonIdHelperTool + # EDM printer tool acc = DCMathSegmentMakerCfg(flags,name="DCMathSegmentMaker") segment_maker = acc.getPrimary() @@ -528,14 +526,12 @@ def MuonClusterSegmentFinderToolCfg(flags, **kwargs): #m_slTrackFitter("Trk::GlobalChi2Fitter/MCTBSLFitter"), #m_ambiTool("Trk::SimpleAmbiguityProcessorTool/MuonAmbiProcessor"), #m_trackToSegmentTool("Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"), - #m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), #m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), #m_edmHelperSvc("Muon::MuonEDMHelperSvc/MuonEDMHelperSvc"), #m_trackCleaner("Muon::MuonTrackCleaner/MuonTrackCleaner") { #declareProperty("SLFitter", m_slTrackFitter); #declareProperty("SegmentAmbiguityTool",m_ambiTool); #declareProperty("TrackToSegmentTool", m_trackToSegmentTool); - #declareProperty("IdHelper", m_idHelperTool); #declareProperty("TrackCleaner", m_trackCleaner); result=ComponentAccumulator() @@ -562,7 +558,6 @@ def MuonClusterSegmentFinderToolCfg(flags, **kwargs): def MuonClusterSegmentFinderCfg(flags, **kwargs): #declareProperty("MuonClusterizationTool", m_clusterTool); - #declareProperty("MuonIdHelperTool",m_idHelper ); #declareProperty("MuonEDMPrinterTool",m_printer ); #declareProperty("MuonPRDSelectionTool", m_muonPRDSelectionTool ); #declareProperty("MdtSegmentMaker",m_segmentMaker); diff --git a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py index 5b9fd569662189f20e8463494c4e79c494171585..65666dadbd4d5226b87b30d64fa2dcb1b65bffb7 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py @@ -146,8 +146,6 @@ def MooTrackBuilderCfg(flags, name="MooTrackBuilderTemplate", **kwargs): kwargs.setdefault("ChamberHoleRecoveryTool", hole_recovery_tool) # FIXME? Remove duplicate from cxx? acc = MagneticFieldSvcCfg(flags) - magfieldsvc = acc.getPrimary() - kwargs.setdefault( "MagFieldSvc", magfieldsvc ) result.merge(acc) acc = MuonTrackToSegmentToolCfg(flags) @@ -207,7 +205,7 @@ def MooCandidateMatchingToolCfg(flags, name="MooCandidateMatchingTool", doSegmen result = ComponentAccumulator() - # Won't explicitly configure MuonIdHelperTool, MuonEDMHelperSvc, MuonEDMPrinterTool + # Won't explicitly configure MuonEDMHelperSvc, MuonEDMPrinterTool acc = MuonExtrapolatorCfg(flags, name="MuonStraightLineExtrapolator") slextrap = acc.getPrimary() diff --git a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref index bc6b15f7cab90d90e36813932dd08f028fb60e82..63e58724484de115a7faaab557f8398346d03cde 100644 --- a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref +++ b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest.ref @@ -1,23 +1,549 @@ +Flag Name : Value +Beam.BunchSpacing : 25 +Beam.Energy : [function] +Beam.NumberOfCollisions : [function] +Beam.Type : [function] +Beam.estimatedLuminosity : [function] +Common.Project : 'Athena' +Common.bunchCrossingSource : [function] +Common.doExpressProcessing : False +Common.isOnline : False +Common.useOnlineLumi : [function] +Concurrency.NumConcurrentEvents : 0 +Concurrency.NumProcs : 0 +Concurrency.NumThreads : 0 +Exec.DebugStage : '' +Exec.MaxEvents : -1 +Exec.OutputLevel : 3 +Exec.SkipEvents : 0 +GeoModel.Align.Dynamic : [function] +GeoModel.AtlasVersion : 'ATLAS-R2-2016-01-00-01' +GeoModel.IBLLayout : [function] +GeoModel.Layout : 'atlas' +GeoModel.Run : [function] +GeoModel.StripGeoType : [function] +GeoModel.Type : [function] +IOVDb.DatabaseInstance : [function] +IOVDb.GlobalTag : 'CONDBR2-BLKPA-2018-13' +Input.Collections : [function] +Input.Files : ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1'] +Input.Format : [function] +Input.ProjectName : [function] +Input.RunNumber : [function] +Input.SecondaryCollections : [function] +Input.SecondaryFiles : [] +Input.isMC : [function] +Output.AODFileName : '' +Output.ESDFileName : '' +Output.EVNTFileName : '' +Output.HISTFileName : '' +Output.HITSFileName : '' +Output.RDOFileName : '' +Output.RDO_SGNLFileName : '' +Output.doESD : [function] +Output.doWriteAOD : [function] +Output.doWriteBS : False +Output.doWriteESD : [function] +Output.doWriteRDO : [function] +Output.doWriteRDO_SGNL : [function] +Random.Engine : 'dSFMT' +Scheduler.CheckDependencies : True +Scheduler.ShowControlFlow : True +Scheduler.ShowDataDeps : True +Scheduler.ShowDataFlow : True +TrackingGeometry.MagneticFileMode : 6 +TrackingGeometry.MaterialSource : 'COOL' +Flag categories that can be loaded dynamically +Category : Generator name : Defined in +BField : __bfield : AthenaConfiguration/AllConfigFlags.py +BTagging : __btagging : AthenaConfiguration/AllConfigFlags.py +Calo : __calo : AthenaConfiguration/AllConfigFlags.py +DQ : __dq : AthenaConfiguration/AllConfigFlags.py +Detector : __detector : AthenaConfiguration/AllConfigFlags.py +Digitization : __digitization : AthenaConfiguration/AllConfigFlags.py +Egamma : __egamma : AthenaConfiguration/AllConfigFlags.py +InDet : __indet : AthenaConfiguration/AllConfigFlags.py +LAr : __lar : AthenaConfiguration/AllConfigFlags.py +Muon : __muon : AthenaConfiguration/AllConfigFlags.py +MuonCombined : __muoncombined : AthenaConfiguration/AllConfigFlags.py +Overlay : __overlay : AthenaConfiguration/AllConfigFlags.py +PF : __pflow : AthenaConfiguration/AllConfigFlags.py +Sim : __simulation : AthenaConfiguration/AllConfigFlags.py +Tile : __tile : AthenaConfiguration/AllConfigFlags.py +Trigger : __trigger : AthenaConfiguration/AllConfigFlags.py +Py:Athena INFO About to setup Raw data decoding +Py:Athena INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [muonconfig/5f5ea9b] -- built on [2020-06-03T1254] +Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1 +Py:MetaReader INFO Current mode used: peeker +Py:MetaReader INFO Current filenames: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1'] +Py:ConfigurableDb INFO Read module info for 5533 configurables from 5 genConfDb files +Py:ConfigurableDb INFO No duplicates have been found: that's good ! +EventInfoMgtInit: Got release version Athena-22.0.15 +Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 +Py:Athena INFO Print Config +Py:ComponentAccumulator INFO Event Inputs +Py:ComponentAccumulator INFO Event Algorithm Sequences +Py:ComponentAccumulator INFO Top sequence 0 +Py:ComponentAccumulator INFO \__ AthAlgSeq (seq: SEQ AND) +Py:ComponentAccumulator INFO \__ RpcRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ TgcRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ MdtRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ CscRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ RpcRdoToRpcPrepData (alg) +Py:ComponentAccumulator INFO \__ TgcRdoToTgcPrepData (alg) +Py:ComponentAccumulator INFO \__ MdtRdoToMdtPrepData (alg) +Py:ComponentAccumulator INFO \__ CscRdoToCscPrepData (alg) +Py:ComponentAccumulator INFO \__ CscThresholdClusterBuilder (alg) +Py:ComponentAccumulator INFO Condition Algorithms +Py:ComponentAccumulator INFO \__ CondInputLoader (cond alg) +Py:ComponentAccumulator INFO \__ MuonAlignmentCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ MuonDetectorCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ RpcCablingCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ MuonMDT_CablingAlg (cond alg) +Py:ComponentAccumulator INFO \__ AtlasFieldMapCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ AtlasFieldCacheCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ RpcCondDbAlg (cond alg) +Py:ComponentAccumulator INFO \__ MdtCalibDbAlg (cond alg) +Py:ComponentAccumulator INFO \__ CscCondDbAlg (cond alg) +Py:ComponentAccumulator INFO Services +Py:ComponentAccumulator INFO ['EventSelector', 'ByteStreamInputSvc', 'EventPersistencySvc', 'ByteStreamCnvSvc', 'ROBDataProviderSvc', 'ByteStreamAddressProviderSvc', 'MetaDataStore', 'InputMetaDataStore', 'MetaDataSvc', 'ProxyProviderSvc', 'GeoModelSvc', 'DetDescrCnvSvc', 'TagInfoMgr', 'IOVDbSvc', 'PoolSvc', 'CondSvc', 'DBReplicaSvc', 'AthenaPoolCnvSvc', 'MuonIdHelperSvc', 'RPCcablingServerSvc', 'MuonRPC_CablingSvc', 'LVL1TGC::TGCRecRoiSvc', 'TGCcablingServerSvc', 'MuonMDT_CablingSvc', 'AtlasFieldSvc', 'CSCcablingSvc'] +Py:ComponentAccumulator INFO Public Tools +Py:ComponentAccumulator INFO [ +Py:ComponentAccumulator INFO IOVDbMetaDataTool/IOVDbMetaDataTool, +Py:ComponentAccumulator INFO ByteStreamMetadataTool/ByteStreamMetadataTool, +Py:ComponentAccumulator INFO RPCCablingDbTool/RPCCablingDbTool, +Py:ComponentAccumulator INFO Muon::RPC_RawDataProviderToolMT/RPC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO Muon::TGC_RawDataProviderToolMT/TGC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO MDTCablingDbTool/MDTCablingDbTool, +Py:ComponentAccumulator INFO Muon::MDT_RawDataProviderToolMT/MDT_RawDataProviderToolMT, +Py:ComponentAccumulator INFO Muon::CSC_RawDataProviderToolMT/CSC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO ] +Py:ComponentAccumulator INFO Private Tools +Py:ComponentAccumulator INFO [ +Py:ComponentAccumulator INFO ] +Py:ComponentAccumulator INFO TheApp properties +Py:ComponentAccumulator INFO EvtSel : EventSelector +Py:Athena INFO Save Config + +JOs reading stage finished, launching CARunner from pickle file + +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus703.cern.ch on Wed Jun 3 15:26:14 2020 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +PublicTool IOVDbMetaDataTool +PublicTool ByteStreamMetadataTool +PublicTool RPCCablingDbTool +PublicTool RPC_RawDataProviderToolMT +PublicTool TGC_RawDataProviderToolMT +PublicTool MDTCablingDbTool +PublicTool MDT_RawDataProviderToolMT +PublicTool CSC_RawDataProviderToolMT +CoreDumpSvc INFO install f-a-t-a-l handler... (flag = 438) +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) +ClassIDSvc INFO getRegistryEntries: read 3838 CLIDRegistry entries for module ALL +MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 +AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 +PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] +PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled +PoolSvc INFO Frontier compression level set to 5 +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-06-02T2139/Athena/22.0.15/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 10 servers found for host lxplus703.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO COOL SQLite replicas will be excluded if matching pattern /DBRelease/ +PoolSvc INFO Successfully setup replica sorting algorithm +PoolSvc INFO Setting up APR FileCatalog and Streams +PoolSvc INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml +PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_comcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_comcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml +DbSession INFO Open DbSession +Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] +ToolSvc.ByteStr... INFO Initializing ToolSvc.ByteStreamMetadataTool - package version ByteStreamCnvSvc-00-00-00 +MetaDataSvc INFO Found MetaDataTools = PublicToolHandleArray(['IOVDbMetaDataTool/IOVDbMetaDataTool','ByteStreamMetadataTool/ByteStreamMetadataTool']) +ByteStreamAddre... INFO Initializing ByteStreamAddressProviderSvc - package version ByteStreamCnvSvcBase-00-00-00 +ByteStreamAddre... INFO initialized +ByteStreamAddre... INFO -- Will fill Store with id = 0 +IOVDbSvc INFO Opened read transaction for POOL PersistencySvc +IOVDbSvc INFO Only 5 POOL conditions files will be open at once +IOVDbSvc INFO Cache alignment will be done in 3 slices +IOVDbSvc INFO Global tag: CONDBR2-BLKPA-2018-13 set from joboptions +IOVDbFolder INFO Inputfile tag override disabled for /GLOBAL/BField/Maps +IOVDbSvc INFO Initialised with 10 connections and 29 folders +IOVDbSvc INFO Service IOVDbSvc initialised successfully +ClassIDSvc INFO getRegistryEntries: read 2674 CLIDRegistry entries for module ALL +IOVDbSvc INFO Opening COOL connection for COOLOFL_MUONALIGN/CONDBR2 +IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" +IOVSvc.IOVSvcTool INFO IOVRanges will be checked at every Event +IOVDbSvc INFO Opening COOL connection for COOLONL_RPC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_MUONALIGN/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_TGC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_RPC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_TGC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_RPC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_RPC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Added taginfo remove for /CSC/FTHOLD +IOVDbSvc INFO Added taginfo remove for /CSC/NOISE +IOVDbSvc INFO Added taginfo remove for /CSC/PED +IOVDbSvc INFO Added taginfo remove for /CSC/PSLOPE +IOVDbSvc INFO Added taginfo remove for /CSC/RMS +IOVDbSvc INFO Added taginfo remove for /CSC/STAT +IOVDbSvc INFO Added taginfo remove for /CSC/T0BASE +IOVDbSvc INFO Added taginfo remove for /CSC/T0PHASE +IOVDbSvc INFO Added taginfo remove for /EXT/DCS/MAGNETS/SENSORDATA +IOVDbSvc INFO Added taginfo remove for /GLOBAL/BField/Maps +IOVDbSvc INFO Added taginfo remove for /MDT/CABLING/MAP_SCHEMA +IOVDbSvc INFO Added taginfo remove for /MDT/CABLING/MEZZANINE_SCHEMA +IOVDbSvc INFO Added taginfo remove for /MDT/RTBLOB +IOVDbSvc INFO Added taginfo remove for /MDT/T0BLOB +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/CSC/ILINES +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ASBUILTPARAMS +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/BARREL +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ENDCAP/SIDEA +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ENDCAP/SIDEC +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/TGC/SIDEA +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/TGC/SIDEC +IOVDbSvc INFO Added taginfo remove for /RPC/CABLING/MAP_SCHEMA +IOVDbSvc INFO Added taginfo remove for /RPC/CABLING/MAP_SCHEMA_CORR +IOVDbSvc INFO Added taginfo remove for /RPC/DCS/DeadRopanels +IOVDbSvc INFO Added taginfo remove for /RPC/DCS/OffRopanels +IOVDbSvc INFO Added taginfo remove for /RPC/DQMF/ELEMENT_STATUS +IOVDbSvc INFO Added taginfo remove for /RPC/TRIGGER/CM_THR_ETA +IOVDbSvc INFO Added taginfo remove for /RPC/TRIGGER/CM_THR_PHI +IOVDbSvc INFO Added taginfo remove for /TGC/CABLING/MAP_SCHEMA +GeoModelSvc INFO Explicitly initializing DetDescrCnvSvc +DetDescrCnvSvc INFO initializing +DetDescrCnvSvc INFO Found DetectorStore service +DetDescrCnvSvc INFO filling proxies for detector managers +DetDescrCnvSvc INFO filling address for CaloTTMgr with CLID 117659265 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloMgr with CLID 4548337 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloSuperCellMgr with CLID 241807251 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloIdManager with CLID 125856940 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArIdManager with CLID 79554919 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for IdDict with CLID 2411 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for AtlasID with CLID 164875623 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for PixelID with CLID 2516 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for SCT_ID with CLID 2517 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TRT_ID with CLID 2518 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for SiliconID with CLID 129452393 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArEM_ID with CLID 163583365 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArEM_SuperCell_ID with CLID 99488227 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHEC_ID with CLID 3870484 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHEC_SuperCell_ID with CLID 254277678 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArFCAL_ID with CLID 45738051 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArFCAL_SuperCell_ID with CLID 12829437 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArMiniFCAL_ID with CLID 79264204 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArOnlineID with CLID 158698068 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TTOnlineID with CLID 38321944 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArOnline_SuperCellID with CLID 115600394 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHVLineID with CLID 27863673 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArElectrodeID with CLID 80757351 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileID with CLID 2901 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for Tile_SuperCell_ID with CLID 49557789 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileHWID with CLID 2902 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileTBID with CLID 2903 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for MDTIDHELPER with CLID 4170 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CSCIDHELPER with CLID 4171 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for RPCIDHELPER with CLID 4172 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TGCIDHELPER with CLID 4173 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloLVL1_ID with CLID 108133391 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloCell_ID with CLID 123500438 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloCell_SuperCell_ID with CLID 128365736 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloDM_ID with CLID 167756483 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for ZdcID with CLID 190591643 and storage type 68 to detector store +GeoModelSvc.Muo... INFO Initializing ... +GeoModelSvc::RD...WARNING Getting PixTBMatComponents with default tag +GeoModelSvc::RD...WARNING Getting PixTBMaterials with default tag +GeoModelSvc::RD...WARNING Getting InDetMatComponents with default tag +GeoModelSvc::RD...WARNING Getting InDetMaterials with default tag +MuonGeoModel INFO MuonDetectorFactory - constructor MuonSystem OuterRadius 13000 Length 22030 +GeoModelSvc.Muo... INFO create MuonDetectorTool - package version = MuonGeoModel-00-00-00 +GeoModelSvc.Muo... INFO (from GeoModelSvc) AtlasVersion = <ATLAS-R2-2016-01-00-01> MuonVersion = <> +GeoModelSvc.Muo... INFO Keys for Muon Switches are (key) ATLAS-R2-2016-01-00-01 (node) ATLAS +GeoModelSvc.Muo... INFO (from GeoModelSvc) in AtlasVersion = <ATLAS-R2-2016-01-00-01> default MuonVersion is <MuonSpectrometer-R.08.01> +GeoModelSvc.Muo... INFO Properties have been set as follows: +GeoModelSvc.Muo... INFO LayoutName R +GeoModelSvc.Muo... INFO IncludeCutouts 0 +GeoModelSvc.Muo... INFO IncludeCutoutsBog 0 +GeoModelSvc.Muo... INFO IncludeCtbBis 0 +GeoModelSvc.Muo... INFO ControlAlines 111111 +GeoModelSvc.Muo... INFO MinimalGeoFlag 0 +GeoModelSvc.Muo... INFO EnableCscIntAlignment 1 +GeoModelSvc.Muo... INFO EnableCscIntAlignmentFromGM 0 +GeoModelSvc.Muo... INFO ControlCscIntAlines 111111 +GeoModelSvc.Muo... INFO EnableMdtDeformations 1 +GeoModelSvc.Muo... INFO EnableMdtAsBuiltParameters 1 +MuGM:MuonFactory INFO MuonLayout set to <R.08.01> = Development version for DC3 - infrastructures +MuGM:MuonFactory INFO BOG cutouts are activated 1 , all other cutouts are disabled 1 +MuGM:MuonFactory INFO Manager created for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuonGeoModel.MYSQL INFO GeometryVersion set to <R.08.01> +MuGM:MuonFactory INFO Mysql helper class created here for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuGM:MuonFactory INFO MDTIDHELPER retrieved from DetStore +EventPersistenc... INFO Added successfully Conversion service:ByteStreamCnvSvc +EventPersistenc... INFO Added successfully Conversion service:DetDescrCnvSvc +MDT_IDDetDescrCnv INFO in createObj: creating a MdtIdHelper object in the detector store +IdDictDetDescrCnv INFO in initialize +IdDictDetDescrCnv INFO in createObj: creating a IdDictManager object in the detector store +IdDictDetDescrCnv INFO IdDictName: IdDictParser/ATLAS_IDS.xml +IdDictDetDescrCnv INFO Reading InnerDetector IdDict file InDetIdDictFiles/IdDictInnerDetector_IBL3D25-03.xml +IdDictDetDescrCnv INFO Reading LArCalorimeter IdDict file IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml +IdDictDetDescrCnv INFO Reading TileCalorimeter IdDict file IdDictParser/IdDictTileCalorimeter.xml +IdDictDetDescrCnv INFO Reading Calorimeter IdDict file IdDictParser/IdDictCalorimeter_L1Onl.xml +IdDictDetDescrCnv INFO Reading MuonSpectrometer IdDict file IdDictParser/IdDictMuonSpectrometer_R.03.xml +IdDictDetDescrCnv INFO Reading ForwardDetectors IdDict file IdDictParser/IdDictForwardDetectors_2010.xml +IdDictDetDescrCnv INFO Found id dicts: +IdDictDetDescrCnv INFO Using dictionary tag: null +IdDictDetDescrCnv INFO Dictionary ATLAS version default DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary Calorimeter version default DetDescr tag CaloIdentifier-LVL1-02 file IdDictParser/IdDictCalorimeter_L1Onl.xml +IdDictDetDescrCnv INFO Dictionary ForwardDetectors version default DetDescr tag ForDetIdentifier-01 file IdDictParser/IdDictForwardDetectors_2010.xml +IdDictDetDescrCnv INFO Dictionary InnerDetector version IBL-DBM DetDescr tag InDetIdentifier-IBL3D25-02 file InDetIdDictFiles/IdDictInnerDetector_IBL3D25-03.xml +IdDictDetDescrCnv INFO Dictionary LArCalorimeter version fullAtlas DetDescr tag LArIdentifier-DC3-05-Comm file IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml +IdDictDetDescrCnv INFO Dictionary LArElectrode version fullAtlas DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary LArHighVoltage version fullAtlas DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary MuonSpectrometer version R.03 DetDescr tag MuonIdentifier-08 file IdDictParser/IdDictMuonSpectrometer_R.03.xml +IdDictDetDescrCnv INFO Dictionary TileCalorimeter version fullAtlasAndTestBeam DetDescr tag TileIdentifier-00 file IdDictParser/IdDictTileCalorimeter.xml +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +MdtIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +MdtIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 241 +MdtIdHelper INFO MultiRange built successfully to tube: MultiRange size is 241 +MdtIdHelper INFO Initializing MDT hash indices ... +MdtIdHelper INFO The element hash max is 1188 +MdtIdHelper INFO The detector element hash max is 2328 +MdtIdHelper INFO Initializing MDT hash indices for finding neighbors ... +MuGM:MuonFactory INFO RPCIDHELPER retrieved from DetStore +RPC_IDDetDescrCnv INFO in createObj: creating a RpcIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +RpcIdHelper INFO MultiRange built successfully to doubletR: MultiRange size is 241 +RpcIdHelper INFO MultiRange built successfully to detectorElement: DetectorElement MultiRange size is 241 +RpcIdHelper INFO MultiRange built successfully to rpcStrip: MultiRange size is 241 +RpcIdHelper INFO Initializing RPC hash indices ... +RpcIdHelper INFO The element hash max is 600 +RpcIdHelper INFO The detector element hash max is 1122 +RpcIdHelper INFO Initializing RPC hash indices for finding neighbors ... +MuGM:MuonFactory INFO TGCIDHELPER retrieved from DetStore +TGC_IDDetDescrCnv INFO in createObj: creating a TgcIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +TgcIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +TgcIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 210 +TgcIdHelper INFO MultiRange built successfully to channel: MultiRange size is 241 +TgcIdHelper INFO Initializing TGC hash indices ... +TgcIdHelper INFO The element hash max is 1578 +TgcIdHelper INFO The detector element hash max is 1578 +TgcIdHelper INFO Initializing TGC hash indices for finding neighbors ... +MuGM:MuonFactory INFO CSCIDHELPER retrieved from DetStore +CSC_IDDetDescrCnv INFO in createObj: creating a CcscIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +CscIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +CscIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 237 +CscIdHelper INFO MultiRange built successfully to cscStrip: MultiRange size is 241 +CscIdHelper INFO Initializing CSC hash indices ... +CscIdHelper INFO The element hash max is 32 +CscIdHelper INFO The detector element hash max is 64 +CscIdHelper INFO The channel hash max is 61440 +CscIdHelper INFO Initializing CSC hash indices for finding neighbors ... +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 ************************ +MuGM:MuonFactory INFO *** Start building the Muon Geometry Tree ********************** +MuGM:RDBReadAtlas INFO Start retriving dbObjects with tag = <ATLAS-R2-2016-01-00-01> node <ATLAS> +RDBAccessSvc WARNING Could not get the tag for XtomoData node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO After getQuery XtomoData +In DblQ00Xtomo(data) +No XtomoData table in the MuonDD Database +MuGM:RDBReadAtlas INFO After new DblQ00Xtomo +MuGM:RDBReadAtlas INFO After m_dhxtomo.data() +MuGM:RDBReadAtlas INFO No Ascii aszt input found: looking for A-lines in ORACLE +MuGM:RDBReadAtlas INFO ASZT table found in Oracle +MuGM:RDBReadAtlas INFO ASZT size is 32 +MuGM:RDBReadAtlas INFO No Ascii iacsc input found: looking for A-lines in ORACLE +RDBAccessSvc WARNING Could not get the tag for ISZT node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO No ISZT table in Oracle +MuGM:RDBReadAtlas INFO Access granted for all dbObjects needed by muon detectors +MuonGeoModel.MYSQL INFO LayoutName (from DBAM) set to <R.08> -- relevant for CTB2004 +MuGM:ProcStations INFO Processing Stations and Components +MuGM:ProcStations INFO Processing Stations and Components DONE +MuGM:ProcTechnol.s INFO nMDT 13 nCSC 2 nTGC 22 nRPC 25 +MuGM:ProcTechnol.s INFO nDED 2 nSUP 4 nSPA 2 +MuGM:ProcTechnol.s INFO nCHV 7 nCRO 7 nCMI 6 nLBI 6 +MuGM:ProcPosition INFO *** N. of stations positioned in the setup 234 +MuGM:ProcPosition INFO *** N. of stations described in mysql 234 +MuGM:ProcPosition INFO *** N. of types 32 size of jtypvec 32 +MuGM:ProcPosition INFO *** : 234 kinds of stations (type*sub_type) +MuGM:ProcPosition INFO *** : 1758 physical stations in space - according to the MuonDD DataBase +MuGM:ProcCutouts INFO Processing Cutouts for geometry layout R.08 +MuGM:ProcCutouts INFO Processing Cutouts DONE +MuGM:RDBReadAtlas INFO ProcessTGCreadout - version 7 wirespacing 1.8 +MuGM:RDBReadAtlas INFO Intermediate Objects built from primary numbers +MuGM:MuonFactory INFO theMaterialManager retrieven successfully from the DetStore +MuGM:MuonFactory INFO MuonSystem description from OracleTag=<ATLAS-R2-2016-01-00-01> and node=<ATLAS> +MuGM:MuonFactory INFO TreeTop added to the Manager +MuGM:MuonFactory INFO Muon Layout R.08.01 +MuGM:MuonFactory INFO Fine Clash Fixing disabled: (should be ON/OFF for Simulation/Reconstruction) +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 **************************** +MuGM:MuonFactory INFO *** The Muon Chamber Geometry Tree is built with +MuGM:MuonFactory INFO *** 1758 child volumes +MuGM:MuonFactory INFO *** 1839 independent elements and +MuGM:MuonFactory INFO *** 11473 elements cloned or shared +MuGM:MuonFactory INFO *** 234 kinds of stations +MuGM:MuonFactory INFO *** 1758 stations with alignable transforms +MuGM:MuonFactory INFO *** 148 stations are described as Assemblies +MuGM:MuonFactory INFO *** 1758 MuonStations +MuGM:MuonFactory INFO *** 2324 MDT Readout Elements 1186 MDT Detector Elements +MuGM:MuonFactory INFO *** 32 CSC Readout Elements 32 CSC Detector Elements +MuGM:MuonFactory INFO *** 1122 RPC Readout Elements 600 RPC Detector Elements +MuGM:MuonFactory INFO *** 1578 TGC Readout Elements 1578 TGC Detector Elements +MuGM:MuonFactory INFO ******************************************************************** +MuGM:MuonFactory INFO *** Inert Material built according to DB switches and config. ****** +MuGM:MuonFactory INFO *** The Muon Geometry Tree has 1758 child vol.s in total ******** +MuGM:MuonFactory INFO ******************************************************************** + +MGM::MuonDetect... INFO Init A/B Line Containers - done - size is respectively 1758/0 +MGM::MuonDetect... INFO Init of CSC I-Lines will be done via Conditions DB +MGM::MuonDetect... INFO Init I-Line Container - done - size is respectively 128 +MGM::MuonDetect... INFO I-Line for CSC wire layers loaded (Csc Internal Alignment) +MGM::MuonDetect... INFO According to configuration they WILL be used +MGM::MuonDetect... INFO Filling cache +GeoModelSvc INFO GeoModelSvc.MuonDetectorTool SZ= 228572Kb Time = 1.66S +ClassIDSvc INFO getRegistryEntries: read 3099 CLIDRegistry entries for module ALL +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 +ClassIDSvc INFO getRegistryEntries: read 839 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 422 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 305 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 291 CLIDRegistry entries for module ALL +CondInputLoader INFO Initializing CondInputLoader... +CondInputLoader INFO Adding base classes: + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/FTHOLD' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/NOISE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PED' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PSLOPE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/RMS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/STAT' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/DeadRopanels' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/OffRopanels' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' ) -> +CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/FTHOLD' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/NOISE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PED' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PSLOPE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/RMS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/STAT' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/DeadRopanels' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/OffRopanels' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' ) +MuonAlignmentCo... INFO Initilalizing +MuonAlignmentCo... INFO In initialize ---- # of folders registered is 7 +MuonAlignmentCo... INFO geometry version from the MuonDetectorManager = R.08.01 +MuonDetectorCon... INFO Initializing ... +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 +ClassIDSvc INFO getRegistryEntries: read 7927 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1043 CLIDRegistry entries for module ALL RpcRawDataProvider INFO RpcRawDataProvider::initialize RpcRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 2156 CLIDRegistry entries for module ALL +ROBDataProviderSvc INFO Initializing ROBDataProviderSvc - package version ByteStreamCnvSvcBase-00-00-00 +ROBDataProviderSvc INFO ---> Filter out empty ROB fragments = 'filterEmptyROB':False +ROBDataProviderSvc INFO ---> Filter out specific ROBs by Status Code: # ROBs = 0 +ROBDataProviderSvc INFO ---> Filter out Sub Detector ROBs by Status Code: # Sub Detectors = 0 RpcRawDataProvi... INFO initialize() successful in RpcRawDataProvider.RPC_RawDataProviderToolMT TgcRawDataProvider INFO TgcRawDataProvider::initialize TgcRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 1223 CLIDRegistry entries for module ALL TgcRawDataProvi... INFO initialize() successful in TgcRawDataProvider.TGC_RawDataProviderToolMT.TgcROD_Decoder +MuonTGC_CablingSvc INFO for 1/12 sector initialize +ToolSvc.TGCCabl... INFO initialize +ToolSvc.TGCCabl... INFO readTGCMap from text +ToolSvc.TGCCabl... INFO readTGCMap found file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-06-02T2139/Athena/22.0.15/InstallArea/x86_64-centos7-gcc8-opt/share/ASD2PP_diff_12_ONL.db +ToolSvc.TGCCabl... INFO giveASD2PP_DIFF_12 (m_ASD2PP_DIFF_12 is not NULL) TgcRawDataProvi... INFO initialize() successful in TgcRawDataProvider.TGC_RawDataProviderToolMT MdtRawDataProvider INFO MdtRawDataProvider::initialize MdtRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 1376 CLIDRegistry entries for module ALL MdtRawDataProvi... INFO Retrieved service ServiceHandle('ROBDataProviderSvc') MdtRawDataProvi... INFO Processing configuration for layouts with BME chambers. MdtRawDataProvi... INFO Processing configuration for layouts with BMG chambers. MdtRawDataProvi... INFO Retrieved tool Decoder = PrivateToolHandle('MdtROD_Decoder/MdtROD_Decoder') MdtRawDataProvi... INFO initialize() successful in MdtRawDataProvider.MDT_RawDataProviderToolMT +ClassIDSvc INFO getRegistryEntries: read 1048 CLIDRegistry entries for module ALL CscRawDataProvi... INFO Retrieved service ServiceHandle('ROBDataProviderSvc') CscRawDataProvi... INFO Retrieved tool Decoder = PrivateToolHandle('Muon::CscROD_Decoder/CscROD_Decoder') CscRawDataProvi... INFO The Muon Geometry version is R.08.01 CscRawDataProvi... INFO initialize() successful in CscRawDataProvider.CSC_RawDataProviderToolMT +ClassIDSvc INFO getRegistryEntries: read 53 CLIDRegistry entries for module ALL +RpcRdoToRpcPrep... INFO package version = MuonRPC_CnvTools-00-00-00 RpcRdoToRpcPrep... INFO properties are -RpcRdoToRpcPrep... INFO processingData 0 RpcRdoToRpcPrep... INFO produceRpcCoinDatafromTriggerWords 1 RpcRdoToRpcPrep... INFO reduceCablingOverlap 1 RpcRdoToRpcPrep... INFO solvePhiAmbiguities 1 @@ -25,11 +551,504 @@ RpcRdoToRpcPrep... INFO timeShift -12.5 RpcRdoToRpcPrep... INFO etaphi_coincidenceTime 20 RpcRdoToRpcPrep... INFO overlap_timeTolerance 10 RpcRdoToRpcPrep... INFO Correct prd time from cool db 0 +MuonRPC_CablingSvc INFO Initializing MuonRPC_CablingSvc - package version MuonRPC_Cabling-00-00-00 +ToolSvc.RPCCabl... INFO Initializing - folders names are: conf /RPC/CABLING/MAP_SCHEMA / corr /RPC/CABLING/MAP_SCHEMA_CORR +MuonRPC_CablingSvc INFO RPCCablingDbTool retrieved with handle TheRpcCablingDbTool = PublicToolHandle('RPCCablingDbTool/RPCCablingDbTool') +MuonRPC_CablingSvc INFO Register call-back against 2 folders listed below +MuonRPC_CablingSvc INFO Folder n. 1 </RPC/CABLING/MAP_SCHEMA> found in the DetStore +ClassIDSvc INFO getRegistryEntries: read 239 CLIDRegistry entries for module ALL +MuonRPC_CablingSvc INFO initMappingModel registered for call-back against folder </RPC/CABLING/MAP_SCHEMA> +MuonRPC_CablingSvc INFO Folder n. 2 </RPC/CABLING/MAP_SCHEMA_CORR> found in the DetStore +MuonRPC_CablingSvc INFO initMappingModel registered for call-back against folder </RPC/CABLING/MAP_SCHEMA_CORR> +MuonRPC_CablingSvc INFO RPCTriggerDbTool retrieved with statusCode = SUCCESS pointer = TheRpcTriggerDbTool = PublicToolHandle('RPCTriggerDbTool') +MuonRPC_CablingSvc INFO Register call-back against 2 folders listed below +MuonRPC_CablingSvc INFO Folder n. 1 </RPC/TRIGGER/CM_THR_ETA> found in the DetStore +MuonRPC_CablingSvc INFO initTrigRoadsModel registered for call-back against folder </RPC/TRIGGER/CM_THR_ETA> +MuonRPC_CablingSvc INFO Folder n. 2 </RPC/TRIGGER/CM_THR_PHI> found in the DetStore +MuonRPC_CablingSvc INFO initTrigRoadsModel registered for call-back against folder </RPC/TRIGGER/CM_THR_PHI> RpcRdoToRpcPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::RpcRdoToPrepDataToolMT/RpcRdoToRpcPrepDataTool') TgcRdoToTgcPrep... INFO initialize() successful in TgcRdoToTgcPrepData.TgcRdoToTgcPrepDataTool TgcRdoToTgcPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::TgcRdoToPrepDataToolMT/TgcRdoToTgcPrepDataTool') +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BMG chambers. +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BME chambers. +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BMG chambers. +MdtRdoToMdtPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::MdtRdoToPrepDataToolMT/MdtRdoToMdtPrepDataTool') +ClassIDSvc INFO getRegistryEntries: read 166 CLIDRegistry entries for module ALL +MdtRdoToMdtPrep...WARNING Lookup table will not be initialised MdtRdoToMdtPrepData.RegSelTool_MDT key 'ConditionStore+Tool_Not_Initalised' CscRdoToCscPrep... INFO The Geometry version is MuonSpectrometer-R.08.01 +ClassIDSvc INFO getRegistryEntries: read 114 CLIDRegistry entries for module ALL CscRdoToCscPrep... INFO Retrieved CscRdoToCscPrepDataTool = PrivateToolHandle('Muon::CscRdoToCscPrepDataToolMT/CscRdoToCscPrepDataTool') +EventSelector WARNING InputCollections not properly set, checking EventStorageInputSvc properties +EventSelector INFO reinitialization... +ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL +EventSelector INFO Retrieved InputCollections from InputSvc +ByteStreamInputSvc INFO Initializing ByteStreamInputSvc - package version ByteStreamCnvSvc-00-00-00 +EventSelector INFO reinitialization... +AthenaEventLoopMgr INFO Setup EventSelector service EventSelector +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr SUCCESS ****************************** Algorithm Sequence **************************** +ApplicationMgr SUCCESS AthSequencer/AthMasterSeq +ApplicationMgr SUCCESS AthSequencer/AthAlgEvtSeq +ApplicationMgr SUCCESS AthSequencer/AthBeginSeq +ApplicationMgr SUCCESS AthIncFirerAlg/BeginIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg1 +ApplicationMgr SUCCESS AthSequencer/AthAllAlgSeq +ApplicationMgr SUCCESS AthSequencer/AthCondSeq +ApplicationMgr SUCCESS CondInputLoader/CondInputLoader +ApplicationMgr SUCCESS MuonAlignmentCondAlg/MuonAlignmentCondAlg +ApplicationMgr SUCCESS MuonDetectorCondAlg/MuonDetectorCondAlg +ApplicationMgr SUCCESS RpcCablingCondAlg/RpcCablingCondAlg +ApplicationMgr SUCCESS MuonMDT_CablingAlg/MuonMDT_CablingAlg +ApplicationMgr SUCCESS MagField::AtlasFieldMapCondAlg/AtlasFieldMapCondAlg +ApplicationMgr SUCCESS MagField::AtlasFieldCacheCondAlg/AtlasFieldCacheCondAlg +ApplicationMgr SUCCESS RpcCondDbAlg/RpcCondDbAlg +ApplicationMgr SUCCESS MdtCalibDbAlg/MdtCalibDbAlg +ApplicationMgr SUCCESS CscCondDbAlg/CscCondDbAlg +ApplicationMgr SUCCESS AthSequencer/AthAlgSeq +ApplicationMgr SUCCESS Muon::RpcRawDataProvider/RpcRawDataProvider +ApplicationMgr SUCCESS Muon::TgcRawDataProvider/TgcRawDataProvider +ApplicationMgr SUCCESS Muon::MdtRawDataProvider/MdtRawDataProvider +ApplicationMgr SUCCESS Muon::CscRawDataProvider/CscRawDataProvider +ApplicationMgr SUCCESS RpcRdoToRpcPrepData/RpcRdoToRpcPrepData +ApplicationMgr SUCCESS TgcRdoToTgcPrepData/TgcRdoToTgcPrepData +ApplicationMgr SUCCESS MdtRdoToMdtPrepData/MdtRdoToMdtPrepData +ApplicationMgr SUCCESS CscRdoToCscPrepData/CscRdoToCscPrepData +ApplicationMgr SUCCESS CscThresholdClusterBuilder/CscThresholdClusterBuilder +ApplicationMgr SUCCESS AthSequencer/AthEndSeq +ApplicationMgr SUCCESS AthIncFirerAlg/EndIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg2 +ApplicationMgr SUCCESS AthSequencer/AthOutSeq +ApplicationMgr SUCCESS AthSequencer/AthRegSeq +ApplicationMgr SUCCESS ****************************************************************************** +ByteStreamInputSvc INFO Picked valid file: /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1 +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/FTHOLD' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/NOISE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/PED' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/PSLOPE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/RMS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/STAT' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/T0BASE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/T0PHASE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/GLOBAL/BField/Maps' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/RTBLOB' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/T0BLOB' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/CSC/ILINES' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/BARREL' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/TGC/SIDEA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/TGC/SIDEC' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DCS/DeadRopanels' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DCS/OffRopanels' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' +ApplicationMgr INFO Application Manager Started successfully +EventInfoByteSt... INFO IsSimulation : 0 +EventInfoByteSt... INFO IsTestbeam : 0 +EventInfoByteSt... INFO IsCalibration : 0 +AthenaEventLoopMgr INFO ===>>> start of run 327265 <<<=== +EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr +IOVDbSvc INFO Opening COOL connection for COOLONL_RPC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCCablingMapSchema_2016_2017_01 for folder /RPC/CABLING/MAP_SCHEMA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCCablingMapSchemaCorr_2016_2017_01 for folder /RPC/CABLING/MAP_SCHEMA_CORR +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCTriggerCMThrEta_RUN1-RUN2-HI-02 for folder /RPC/TRIGGER/CM_THR_ETA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCTriggerCMThrPhi_RUN1-RUN2-HI-02 for folder /RPC/TRIGGER/CM_THR_PHI +IOVDbSvc INFO Disconnecting from COOLONL_RPC/CONDBR2 +EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc +MuonRPC_CablingSvc INFO initMappingModel has been called +MuonRPC_CablingSvc INFO ToolHandle in initMappingModel - <TheRpcCablingDbTool = PublicToolHandle('RPCCablingDbTool/RPCCablingDbTool')> +MuonRPC_CablingSvc INFO Retrieving cabling singleton; to create an empty one or to get the existing one +RPCcabling INFO CablingRPC---singleton constructor ---- this must be executed just once +RPCcabling INFO CablingRPC---The singleton will fill the maps from the COOL streams +RPCcabling INFO CablingRPC---InitMaps from COOL cannot be executed NOW: empty string +RPCcabling INFO CablingRPC---The singleton is created here +RPCcabling INFO CablingRPC--- cacheCleared: s_status = 0 +MuonRPC_CablingSvc INFO Cabling singleton cache has been cleared +MuonRPC_CablingSvc INFO Trigger roads will be loaded from COOL +ToolSvc.RPCCabl... INFO LoadParameters /RPC/CABLING/MAP_SCHEMA I=2 +ToolSvc.RPCCabl... INFO loadRPCMap --- Load Map from DB +ToolSvc.RPCCabl... INFO Try to read from folder </RPC/CABLING/MAP_SCHEMA> +ToolSvc.RPCCabl... INFO CondAttrListCollection from DB folder have been obtained with size 1 +ToolSvc.RPCCabl... INFO After Reading folder, Configuration string size is 222202 +ToolSvc.RPCCabl... INFO LoadParameters /RPC/CABLING/MAP_SCHEMA_CORR I=2 +ToolSvc.RPCCabl... INFO loadRPCCorr --- Load Corrections from DB +ToolSvc.RPCCabl... INFO Try to read from folder </RPC/CABLING/MAP_SCHEMA_CORR> +ToolSvc.RPCCabl... INFO CondAttrListCollection from DB folder have been obtained with size 1 +ToolSvc.RPCCabl... INFO After Reading folder, Correction string size is 29369 +MuonRPC_CablingSvc INFO InitMappingModel: Trigger roads not yet loaded from COOL - postpone cabling initialization +MuonRPC_CablingSvc INFO initTrigRoadsModel has been called +MuonRPC_CablingSvc INFO Trigger roads will be loaded from COOL +MuonRPC_CablingSvc INFO Retrieve the pointer to the cabling singleton +RPCcabling INFO CablingRPC--- cacheCleared: s_status = 0 +MuonRPC_CablingSvc INFO Cabling singleton cache has been cleared +ToolSvc.RPCTrig... INFO LoadParameters /RPC/TRIGGER/CM_THR_ETA I=2 +ToolSvc.RPCTrig... INFO LoadParameters /RPC/TRIGGER/CM_THR_PHI I=2 +MuonRPC_CablingSvc INFO ======== RPC Trigger Roads from COOL - Header infos ======== +MuonRPC_CablingSvc INFO +RPC LVL1 Configuration 10.6 with roads from Feb 2012 +L1 THRESHOLDS: MU4 MU6 MU10 MU11 MU15 MU20 +Road version: "road_files_120209" +CMA th0 th1 th2 +eta low-pt mu4 mu6 mu10 +phi low-pt mu4 mu6 mu10 +eta high-pt mu11 mu15 mu20 +phi high-pt mu11 mu15 mu15 + + +RPCcabling INFO CablingRPC---InitMaps from COOL: going to read configuration +RPCcabling INFO CablingRPC--->> RPC cabling map from COOL << +RPCcabling INFO CablingRPC--- ReadConf: map has size 222202 +RPCcabling INFO CablingRPC--- ReadConf: map n. of lines read is 924 +RPCcabling INFO CablingRPC--- ReadConf: version is 5.0 Atlas R_07_03_RUN2ver104 +RPCcabling INFO CablingRPC--- buildRDOmap +RPCcabling INFO CablingRPC---InitMaps from COOL: going to read corrections to configuration +RPCcabling INFO CablingRPC--->> RPC cabling corrections from COOL << +RPCcabling INFO CablingRPC--- ReadCorr: CorrMap has size 29369 +RPCcabling INFO CablingRPC--- ReadConf: CorrMap n. of lines read is 743 +RPCcabling INFO CablingRPC---InitMaps from COOL - maps have been parsed +MuonRPC_CablingSvc INFO InitTrigRoadsModel: RPC cabling model is loaded! +Level-1 configuration database version 5.0 Atlas R_07_03_RUN2ver104 read. +Contains 26 Trigger Sector Types: +negative sectors 0 - 15 ==> 18 2 24 3 19 2 24 4 20 2 24 1 18 5 25 6 +negative sectors 16 - 31 ==> 21 13 26 6 21 7 16 8 14 7 16 6 21 13 26 1 +positive sectors 32 - 47 ==> 9 24 2 22 9 24 2 23 10 24 2 18 1 25 5 18 +positive sectors 48 - 63 ==> 1 26 13 21 6 17 12 15 11 17 12 21 6 26 13 22 + +MuonRPC_CablingSvc INFO buildOfflineOnlineMap +MuonRPC_CablingSvc INFO Applying FeetPadThresholds : 0,2,5 +MuonRPC_CablingSvc INFO MuonRPC_CablingSvc initialized succesfully +AthenaEventLoopMgr INFO ===>>> start processing event #186525031, run #327265 0 events processed so far <<<=== +IOVDbSvc INFO Opening COOL connection for COOLOFL_CSC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscFthold-RUN2-BLK-UPD1-007-00 for folder /CSC/FTHOLD +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscNoise-RUN2-BLK-UPD1-007-00 for folder /CSC/NOISE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscPed-RUN2-BLK-UPD1-007-00 for folder /CSC/PED +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscPslope-RUN2-BLK-UPD1-000-00 for folder /CSC/PSLOPE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscRms-RUN2-BLK-UPD1-003-00 for folder /CSC/RMS +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscStat-RUN2-BLK-UPD1-008-00 for folder /CSC/STAT +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscT0base-RUN2-BLK-UPD1-001-00 for folder /CSC/T0BASE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscT0phase-RUN2-BLK-UPD2-001-00 for folder /CSC/T0PHASE +IOVDbSvc INFO Disconnecting from COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_GLOBAL/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps +IOVDbSvc INFO Disconnecting from COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_MDT/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTCablingMapSchema_BMG_01 for folder /MDT/CABLING/MAP_SCHEMA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTCablingMezzanineSchema_M5-RUN2 for folder /MDT/CABLING/MEZZANINE_SCHEMA +IOVDbSvc INFO Disconnecting from COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MDT/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTRT-RUN2-UPD4-21 for folder /MDT/RTBLOB +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTT0-RUN2-UPD4-21 for folder /MDT/T0BLOB +IOVDbSvc INFO Disconnecting from COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MUONALIGN/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignCscIlines-UPD1-02 for folder /MUONALIGN/CSC/ILINES +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMdtAsbuiltparams-RUN2-BA_ONLY-UPD4-00 for folder /MUONALIGN/MDT/ASBUILTPARAMS +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTBarrelAlign-RUN2-BA_ROLLING_11-BLKP-UPD4-00 for folder /MUONALIGN/MDT/BARREL +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTEndCapAAlign-RUN2-ECA_ROLLING_2015_03_01-UPD4-02 for folder /MUONALIGN/MDT/ENDCAP/SIDEA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTEndCapCAlign-RUN2-ECC_ROLLING_2015_03_01-UPD4-02 for folder /MUONALIGN/MDT/ENDCAP/SIDEC +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignTGCEndCapAAlign-RUN2-TGCA_ROLLING_2011_01-ES1-UPD1-03 for folder /MUONALIGN/TGC/SIDEA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignTGCEndCapCAlign-RUN2-TGCC_ROLLING_2011_01-ES1-UPD1-03 for folder /MUONALIGN/TGC/SIDEC +IOVDbSvc INFO Disconnecting from COOLOFL_MUONALIGN/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_RPC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCDQMFElementStatus_Run1_UPD4-RUN2-01 for folder /RPC/DQMF/ELEMENT_STATUS +IOVDbSvc INFO Disconnecting from COOLOFL_RPC/CONDBR2 +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/CSC/ILINES> +MuonAlignmentCo... INFO Size of CSC/ILINES CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) readCscILinesCdo->size()= 1 +MuonAlignmentCo... INFO Range of CSC/ILINES input is {[0,0,t:1425168000] - [t:4294967294.854775807]} +MGM::MuonDetect... INFO temporary CSC I-line container with size = 128 +MGM::MuonDetect... INFO # of CSC I-lines read from the ILineMapContainer in StoreGate is 128 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 128 +MGM::MuonDetect... INFO # of entries in the CSC I-lines historical container is 128 +MuonAlignmentCo... INFO recorded new CscInternalAlignmentMapContainer with range {[0,0,t:1425168000] - [t:4294967294.854775807]} into Conditions Store +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ASBUILTPARAMS> +MuonAlignmentCo... INFO Size of MDT/ASBUILTPARAMS CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) ->size()= 1 +MuonAlignmentCo... INFO Range of MDT/ASBUILTPARAMS input is {[0,0,t:0] - [t:4294967294.854775807]} +MGM::MuonDetect... INFO temporary As-Built container with size = 628 +MGM::MuonDetect... INFO # of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is 628 +MGM::MuonDetect... INFO # of deltaTransforms updated according to As-Built is 628 +MGM::MuonDetect... INFO # of entries in the MdtAsBuilt historical container is 628 +MuonAlignmentCo... INFO recorded new MdtAsBuiltMapContainer with range {[0,0,t:0] - [t:4294967294.854775807]} into Conditions Store +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/BARREL> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/BARREL CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/BARREL input is, ALines: {[0,0,t:1497851700] - [t:1498737300]} BLines: {[0,0,t:1497851700] - [t:1498737300]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/BARREL have IoV = 195569 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/BARREL> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEA> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/ENDCAP/SIDEA CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/ENDCAP/SIDEA input is, ALines: {[0,0,t:1497891240] - [t:1497898380]} BLines: {[0,0,t:1497891240] - [t:1497898380]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/ENDCAP/SIDEA have IoV = 195588 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEA> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEC> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/ENDCAP/SIDEC CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/ENDCAP/SIDEC input is, ALines: {[0,0,t:1497892260] - [t:1497899460]} BLines: {[0,0,t:1497892260] - [t:1497899460]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/ENDCAP/SIDEC have IoV = 195599 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEC> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/TGC/SIDEA> +MuonAlignmentCo... INFO No BLines decoding will be attempted for folder named /MUONALIGN/TGC/SIDEA +MuonAlignmentCo... INFO Size of /MUONALIGN/TGC/SIDEA CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/TGC/SIDEA input is, ALines: {[0,0,t:0] - [t:4294967294.854775807]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/TGC/SIDEA have IoV = 82360 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/TGC/SIDEA> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/TGC/SIDEC> +MuonAlignmentCo... INFO No BLines decoding will be attempted for folder named /MUONALIGN/TGC/SIDEC +MuonAlignmentCo... INFO Size of /MUONALIGN/TGC/SIDEC CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/TGC/SIDEC input is, ALines: {[0,0,t:0] - [t:4294967294.854775807]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/TGC/SIDEC have IoV = 82359 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/TGC/SIDEC> loaded +MGM::MuonDetect... INFO temporary A-line container with size = 2694 +MGM::MuonDetect... INFO # of A-lines read from the ALineMapContainer in StoreGate is 2694 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 2694 +MGM::MuonDetect... INFO # of entries in the A-lines historical container is 2814 +MuonAlignmentCo... INFO recorded new ALineMapContainer with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +MGM::MuonDetect... INFO In updateDeformations() +MGM::MuonDetect... INFO temporary B-line container with size = 1206 +MGM::MuonDetect... INFO # of B-lines read from the ALineMapContainer in StoreGate is 1206 +MGM::MuonDetect... INFO # of deform-Transforms updated according to B-lines is 1174 +MGM::MuonDetect... INFO # of entries in the B-lines historical container is 1174 +MuonAlignmentCo... INFO recorded new BLineMapContainer with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +MuonGeoModel INFO MuonDetectorFactory - constructor MuonSystem OuterRadius 13000 Length 22030 +MuonDetectorCon... INFO create MuonDetectorTool - package version = MuonGeoModel-00-00-00 +MuonDetectorCon... INFO (from GeoModelSvc) AtlasVersion = <ATLAS-R2-2016-01-00-01> MuonVersion = <> +MuonDetectorCon... INFO Keys for Muon Switches are (key) ATLAS-R2-2016-01-00-01 (node) ATLAS +MuonDetectorCon... INFO (from GeoModelSvc) in AtlasVersion = <ATLAS-R2-2016-01-00-01> default MuonVersion is <MuonSpectrometer-R.08.01> +MuonDetectorCon... INFO Properties have been set as follows: +MuonDetectorCon... INFO LayoutName R +MuonDetectorCon... INFO IncludeCutouts 0 +MuonDetectorCon... INFO IncludeCutoutsBog 0 +MuonDetectorCon... INFO IncludeCtbBis 0 +MuonDetectorCon... INFO ControlAlines 111111 +MuonDetectorCon... INFO MinimalGeoFlag 0 +MuonDetectorCon... INFO EnableCscIntAlignment 1 +MuonDetectorCon... INFO EnableCscIntAlignmentFromGM 0 +MuonDetectorCon... INFO ControlCscIntAlines 111111 +MuonDetectorCon... INFO EnableMdtDeformations 1 +MuonDetectorCon... INFO EnableMdtAsBuiltParameters 1 +MuGM:MuonFactory INFO MuonLayout set to <R.08.01> = Development version for DC3 - infrastructures +MuGM:MuonFactory INFO BOG cutouts are activated 1 , all other cutouts are disabled 1 +MuGM:MuonFactory INFO Manager created for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuonGeoModel.MYSQL INFO GeometryVersion set to <R.08.01> +MuGM:MuonFactory INFO Mysql helper class created here for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuGM:MuonFactory INFO MDTIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO RPCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO TGCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO CSCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 ************************ +MuGM:MuonFactory INFO *** Start building the Muon Geometry Tree ********************** +MuGM:RDBReadAtlas INFO Start retriving dbObjects with tag = <ATLAS-R2-2016-01-00-01> node <ATLAS> +RDBAccessSvc WARNING Could not get the tag for XtomoData node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO After getQuery XtomoData +In DblQ00Xtomo(data) +No XtomoData table in the MuonDD Database +MuGM:RDBReadAtlas INFO After new DblQ00Xtomo +MuGM:RDBReadAtlas INFO After m_dhxtomo.data() +MuGM:RDBReadAtlas INFO No Ascii aszt input found: looking for A-lines in ORACLE +MuGM:RDBReadAtlas INFO ASZT table found in Oracle +MuGM:RDBReadAtlas INFO ASZT size is 32 +MuGM:RDBReadAtlas INFO No Ascii iacsc input found: looking for A-lines in ORACLE +RDBAccessSvc WARNING Could not get the tag for ISZT node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO No ISZT table in Oracle +MuGM:RDBReadAtlas INFO Access granted for all dbObjects needed by muon detectors +MuonGeoModel.MYSQL INFO LayoutName (from DBAM) set to <R.08> -- relevant for CTB2004 +MuGM:ProcStations INFO Processing Stations and Components +MuGM:ProcStations INFO Processing Stations and Components DONE +MuGM:ProcTechnol.s INFO nMDT 26 nCSC 4 nTGC 44 nRPC 50 +MuGM:ProcTechnol.s INFO nDED 4 nSUP 8 nSPA 4 +MuGM:ProcTechnol.s INFO nCHV 14 nCRO 14 nCMI 12 nLBI 12 +MuGM:ProcPosition INFO *** N. of stations positioned in the setup 234 +MuGM:ProcPosition INFO *** N. of stations described in mysql 234 +MuGM:ProcPosition INFO *** N. of types 32 size of jtypvec 32 +MuGM:ProcPosition INFO *** : 234 kinds of stations (type*sub_type) +MuGM:ProcPosition INFO *** : 1758 physical stations in space - according to the MuonDD DataBase +MuGM:ProcCutouts INFO Processing Cutouts for geometry layout R.08 +MuGM:ProcCutouts INFO Processing Cutouts DONE +MuGM:RDBReadAtlas INFO ProcessTGCreadout - version 7 wirespacing 1.8 +MuGM:RDBReadAtlas INFO Intermediate Objects built from primary numbers +MuGM:MuonFactory INFO theMaterialManager retrieven successfully from the DetStore +MuGM:MuonFactory INFO MuonSystem description from OracleTag=<ATLAS-R2-2016-01-00-01> and node=<ATLAS> +MuGM:MuonFactory INFO TreeTop added to the Manager +MuGM:MuonFactory INFO Muon Layout R.08.01 +MuGM:MuonFactory INFO Fine Clash Fixing disabled: (should be ON/OFF for Simulation/Reconstruction) +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 **************************** +MuGM:MuonFactory INFO *** The Muon Chamber Geometry Tree is built with +MuGM:MuonFactory INFO *** 1758 child volumes +MuGM:MuonFactory INFO *** 1839 independent elements and +MuGM:MuonFactory INFO *** 11473 elements cloned or shared +MuGM:MuonFactory INFO *** 234 kinds of stations +MuGM:MuonFactory INFO *** 1758 stations with alignable transforms +MuGM:MuonFactory INFO *** 148 stations are described as Assemblies +MuGM:MuonFactory INFO *** 1758 MuonStations +MuGM:MuonFactory INFO *** 2324 MDT Readout Elements 1186 MDT Detector Elements +MuGM:MuonFactory INFO *** 32 CSC Readout Elements 32 CSC Detector Elements +MuGM:MuonFactory INFO *** 1122 RPC Readout Elements 600 RPC Detector Elements +MuGM:MuonFactory INFO *** 1578 TGC Readout Elements 1578 TGC Detector Elements +MuGM:MuonFactory INFO ******************************************************************** +MuGM:MuonFactory INFO *** Inert Material built according to DB switches and config. ****** +MuGM:MuonFactory INFO *** The Muon Geometry Tree has 1758 child vol.s in total ******** +MuGM:MuonFactory INFO ******************************************************************** + +MGM::MuonDetect... INFO Init A/B Line Containers - done - size is respectively 1758/0 +MGM::MuonDetect... INFO Init of CSC I-Lines will be done via Conditions DB +MGM::MuonDetect... INFO Init I-Line Container - done - size is respectively 128 +MGM::MuonDetect... INFO I-Line for CSC wire layers loaded (Csc Internal Alignment) +MGM::MuonDetect... INFO According to configuration they WILL be used +MGM::MuonDetect... INFO Filling cache +MGM::MuonDetect... INFO temporary CSC I-line container with size = 128 +MGM::MuonDetect... INFO # of CSC I-lines read from the ILineMapContainer in StoreGate is 128 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 128 +MGM::MuonDetect... INFO # of entries in the CSC I-lines historical container is 128 +MGM::MuonDetect... INFO temporary As-Built container with size = 628 +MGM::MuonDetect... INFO # of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is 628 +MGM::MuonDetect... INFO # of deltaTransforms updated according to As-Built is 628 +MGM::MuonDetect... INFO # of entries in the MdtAsBuilt historical container is 628 +MGM::MuonDetect... INFO temporary A-line container with size = 2694 +MGM::MuonDetect... INFO # of A-lines read from the ALineMapContainer in StoreGate is 2694 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 2694 +MGM::MuonDetect... INFO # of entries in the A-lines historical container is 2814 +MGM::MuonDetect... INFO In updateDeformations() +MGM::MuonDetect... INFO temporary B-line container with size = 1206 +MGM::MuonDetect... INFO # of B-lines read from the ALineMapContainer in StoreGate is 1206 +MGM::MuonDetect... INFO # of deform-Transforms updated according to B-lines is 1174 +MGM::MuonDetect... INFO # of entries in the B-lines historical container is 1174 +MuonDetectorCon... INFO recorded new MuonDetectorManager with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +RpcCablingCondAlg INFO maps configuration have been parsed +RpcCablingCondAlg INFO recorded new RpcCablingCondData with range {[315000,l:0] - [999999,l:0]} +MuonMDT_CablingAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) readCdoMez->size()= 24 +MuonMDT_CablingAlg INFO Range of input is {[0,l:0] - [INVALID]} +MuonMDT_CablingAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) readCdoMap->size()= 2312 +MuonMDT_CablingAlg INFO Range of input is {[327264,l:4294640031] - [327265,l:4294640030]} +MuonMDT_CablingAlg INFO recorded new MuonMDT_CablingMap with range {[327264,t:0,l:4294640031] - [327265,l:4294640030]} into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:1497895317.371000000] - [t:1497898549.609000000]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7729.99 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20399.9 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20397.7 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7729.99 toroid 20399.9 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7729.99,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20399.9,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 +MdtCalibDbAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) readCdoRt->size()= 1186 +MdtCalibDbAlg INFO Range of input is {[327265,l:0] - [327342,l:0]} +MdtCalibDbAlg INFO MdtCalibDbAlg::loadRt Read 1188RTs from COOL +MdtCalibDbAlg INFO recorded new MdtRtRelationCollection with range {[327265,l:0] - [327342,l:0]} into Conditions Store +MdtCalibDbAlg INFO recorded new MdtCorFuncSetCollection with range {[327265,l:0] - [327342,l:0]} into Conditions Store +MdtCalibDbAlg INFO Ignoring nonexistant station in calibration DB: MuonSpectrometer BML -6 stationPhi 7 MDT multiLayer 1 tubeLayer 1 tube 1 +MdtCalibDbAlg INFO Ignoring nonexistant station in calibration DB: MuonSpectrometer BML stationEta 6 stationPhi 7 MDT multiLayer 1 tubeLayer 1 tube 1 +MdtCalibDbAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) readCdoTube->size()= 1186 +MdtCalibDbAlg INFO Range of input is {[319000,l:0] - [INVALID]} +MdtCalibDbAlg INFO recorded new MdtTubeCalibContainerCollection with range {[319000,l:0] - [INVALID]} into Conditions Store +CscCondDbData INFO Maximum Layer hash is 255 +AthenaEventLoopMgr INFO ===>>> done processing event #186525031, run #327265 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186524665, run #327265 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186524665, run #327265 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186542447, run #327265 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186542447, run #327265 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186543405, run #327265 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186543405, run #327265 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186548387, run #327265 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186548387, run #327265 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186515186, run #327265 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186515186, run #327265 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186556019, run #327265 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186556019, run #327265 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186542866, run #327265 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186542866, run #327265 8 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186537901, run #327265 8 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186537901, run #327265 9 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186517811, run #327265 9 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186517811, run #327265 10 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186534221, run #327265 10 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186534221, run #327265 11 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186540986, run #327265 11 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186540986, run #327265 12 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186535104, run #327265 12 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186535104, run #327265 13 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186539903, run #327265 13 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186539903, run #327265 14 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186552713, run #327265 14 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186552713, run #327265 15 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186524730, run #327265 15 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186524730, run #327265 16 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186547632, run #327265 16 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186547632, run #327265 17 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186555621, run #327265 17 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186555621, run #327265 18 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186568452, run #327265 18 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186568452, run #327265 19 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186580451, run #327265 19 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186580451, run #327265 20 events processed so far <<<=== +Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] +ApplicationMgr INFO Application Manager Stopped successfully +IncidentProcAlg1 INFO Finalize +CondInputLoader INFO Finalizing CondInputLoader... +AtlasFieldMapCo... INFO in finalize +AtlasFieldCache... INFO in finalize +IncidentProcAlg2 INFO Finalize +IOVDbFolder INFO Folder /CSC/FTHOLD (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/322656 (( 0.07 ))s +IOVDbFolder INFO Folder /CSC/NOISE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/350062 (( 0.03 ))s +IOVDbFolder INFO Folder /CSC/PED (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/411187 (( 0.04 ))s +IOVDbFolder INFO Folder /CSC/PSLOPE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/353376 (( 0.04 ))s +IOVDbFolder INFO Folder /CSC/RMS (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/411395 (( 0.05 ))s +IOVDbFolder INFO Folder /CSC/STAT (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/230496 (( 0.10 ))s +IOVDbFolder INFO Folder /CSC/T0BASE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/314380 (( 0.08 ))s +IOVDbFolder INFO Folder /CSC/T0PHASE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/3136 (( 0.07 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 0.04 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.08 ))s +IOVDbFolder INFO Folder /MDT/CABLING/MAP_SCHEMA (AttrListColl) db-read 1/1 objs/chan/bytes 2312/2437/216520 (( 0.20 ))s +IOVDbFolder INFO Folder /MDT/CABLING/MEZZANINE_SCHEMA (AttrListColl) db-read 1/1 objs/chan/bytes 24/24/288 (( 0.07 ))s +IOVDbFolder INFO Folder /MDT/RTBLOB (AttrListColl) db-read 1/1 objs/chan/bytes 2372/1186/2251209 (( 0.16 ))s +IOVDbFolder INFO Folder /MDT/T0BLOB (AttrListColl) db-read 1/1 objs/chan/bytes 1186/1186/1374284 (( 0.18 ))s +IOVDbFolder INFO Folder /MUONALIGN/CSC/ILINES (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/10814 (( 0.10 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ASBUILTPARAMS (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/128992 (( 0.09 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/BARREL (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/140293 (( 0.08 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ENDCAP/SIDEA (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/65494 (( 0.06 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ENDCAP/SIDEC (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/65497 (( 0.05 ))s +IOVDbFolder INFO Folder /MUONALIGN/TGC/SIDEA (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/165643 (( 0.05 ))s +IOVDbFolder INFO Folder /MUONALIGN/TGC/SIDEC (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/165643 (( 0.07 ))s +IOVDbFolder INFO Folder /RPC/CABLING/MAP_SCHEMA (AttrListColl) db-read 1/2 objs/chan/bytes 1/1/222235 (( 0.16 ))s +IOVDbFolder INFO Folder /RPC/CABLING/MAP_SCHEMA_CORR (AttrListColl) db-read 1/2 objs/chan/bytes 1/1/29402 (( 0.17 ))s +IOVDbFolder INFO Folder /RPC/DCS/DeadRopanels (AttrListColl) db-read 1/1 objs/chan/bytes 32/48/6200 (( 0.00 ))s +IOVDbFolder INFO Folder /RPC/DCS/OffRopanels (AttrListColl) db-read 1/1 objs/chan/bytes 4/48/16 (( 0.00 ))s +IOVDbFolder INFO Folder /RPC/DQMF/ELEMENT_STATUS (AttrListColl) db-read 1/1 objs/chan/bytes 8320/8320/6180700 (( 0.46 ))s +IOVDbFolder INFO Folder /RPC/TRIGGER/CM_THR_ETA (AttrListColl) db-read 1/2 objs/chan/bytes 1613/1613/7562651 (( 0.40 ))s +IOVDbFolder INFO Folder /RPC/TRIGGER/CM_THR_PHI (AttrListColl) db-read 1/2 objs/chan/bytes 1612/1612/8096306 (( 0.26 ))s +IOVDbFolder INFO Folder /TGC/CABLING/MAP_SCHEMA (AttrListColl) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s +IOVDbSvc INFO bytes in (( 3.17 ))s +IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=CONDBR2 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s +IOVDbSvc INFO Connection COOLOFL_MUONALIGN/CONDBR2 : nConnect: 2 nFolders: 7 ReadTime: (( 0.51 ))s +IOVDbSvc INFO Connection COOLONL_RPC/CONDBR2 : nConnect: 2 nFolders: 4 ReadTime: (( 0.99 ))s +IOVDbSvc INFO Connection COOLONL_TGC/CONDBR2 : nConnect: 1 nFolders: 1 ReadTime: (( 0.00 ))s +IOVDbSvc INFO Connection COOLONL_MDT/CONDBR2 : nConnect: 2 nFolders: 2 ReadTime: (( 0.27 ))s +IOVDbSvc INFO Connection COOLONL_GLOBAL/CONDBR2 : nConnect: 2 nFolders: 1 ReadTime: (( 0.08 ))s +IOVDbSvc INFO Connection COOLOFL_DCS/CONDBR2 : nConnect: 2 nFolders: 3 ReadTime: (( 0.05 ))s +IOVDbSvc INFO Connection COOLOFL_RPC/CONDBR2 : nConnect: 2 nFolders: 1 ReadTime: (( 0.46 ))s +IOVDbSvc INFO Connection COOLOFL_MDT/CONDBR2 : nConnect: 2 nFolders: 2 ReadTime: (( 0.34 ))s +IOVDbSvc INFO Connection COOLOFL_CSC/CONDBR2 : nConnect: 2 nFolders: 8 ReadTime: (( 0.48 ))s +ToolSvc INFO Removing all tools created by ToolSvc +TgcRdoToTgcPrep... INFO finalize(): input RDOs->output PRDs [Hit: 6807->6807, Tracklet: 28->28, TrackletEIFI: 692->692, HiPt: 4031->4031, SL: 3->3] MdtRawDataProvi... INFO Fraction of fills that use the cache = 0 TgcRawDataProvi... INFO Fraction of fills that use the cache = 0 RpcROD_Decoder:... INFO ============ FINAL RPC DATA FORMAT STAT. =========== @@ -47,3 +1066,15 @@ RpcROD_Decoder:... INFO SL Footer Errors.............0 RpcROD_Decoder:... INFO RX Footer Errors.............0 RpcROD_Decoder:... INFO CRC8 check Failures..........0 RpcROD_Decoder:... INFO ==================================================== +ToolSvc.ByteStr... INFO in finalize() +ToolSvc.TGCCabl... INFO finalize +IdDictDetDescrCnv INFO in finalize +*****Chrono***** INFO **************************************************************************************************** +*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) +*****Chrono***** INFO **************************************************************************************************** +cObj_ALL INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 32 +ChronoStatSvc INFO Time User : Tot= 28.9 [s] #= 1 +*****Chrono***** INFO **************************************************************************************************** +ChronoStatSvc.f... INFO Service finalized successfully +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully diff --git a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref index bc6b15f7cab90d90e36813932dd08f028fb60e82..7c9acb32d89deb5e31a064f341e1a5c0f0d0cda0 100644 --- a/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref +++ b/MuonSpectrometer/MuonConfig/share/MuonDataDecodeTest_Cache.ref @@ -1,23 +1,550 @@ +Flag Name : Value +Beam.BunchSpacing : 25 +Beam.Energy : [function] +Beam.NumberOfCollisions : [function] +Beam.Type : [function] +Beam.estimatedLuminosity : [function] +Common.Project : 'Athena' +Common.bunchCrossingSource : [function] +Common.doExpressProcessing : False +Common.isOnline : False +Common.useOnlineLumi : [function] +Concurrency.NumConcurrentEvents : 0 +Concurrency.NumProcs : 0 +Concurrency.NumThreads : 0 +Exec.DebugStage : '' +Exec.MaxEvents : -1 +Exec.OutputLevel : 3 +Exec.SkipEvents : 0 +GeoModel.Align.Dynamic : [function] +GeoModel.AtlasVersion : 'ATLAS-R2-2016-01-00-01' +GeoModel.IBLLayout : [function] +GeoModel.Layout : 'atlas' +GeoModel.Run : [function] +GeoModel.StripGeoType : [function] +GeoModel.Type : [function] +IOVDb.DatabaseInstance : [function] +IOVDb.GlobalTag : 'CONDBR2-BLKPA-2018-13' +Input.Collections : [function] +Input.Files : ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1'] +Input.Format : [function] +Input.ProjectName : [function] +Input.RunNumber : [function] +Input.SecondaryCollections : [function] +Input.SecondaryFiles : [] +Input.isMC : [function] +Output.AODFileName : '' +Output.ESDFileName : '' +Output.EVNTFileName : '' +Output.HISTFileName : '' +Output.HITSFileName : '' +Output.RDOFileName : '' +Output.RDO_SGNLFileName : '' +Output.doESD : [function] +Output.doWriteAOD : [function] +Output.doWriteBS : False +Output.doWriteESD : [function] +Output.doWriteRDO : [function] +Output.doWriteRDO_SGNL : [function] +Random.Engine : 'dSFMT' +Scheduler.CheckDependencies : True +Scheduler.ShowControlFlow : True +Scheduler.ShowDataDeps : True +Scheduler.ShowDataFlow : True +TrackingGeometry.MagneticFileMode : 6 +TrackingGeometry.MaterialSource : 'COOL' +Flag categories that can be loaded dynamically +Category : Generator name : Defined in +BField : __bfield : AthenaConfiguration/AllConfigFlags.py +BTagging : __btagging : AthenaConfiguration/AllConfigFlags.py +Calo : __calo : AthenaConfiguration/AllConfigFlags.py +DQ : __dq : AthenaConfiguration/AllConfigFlags.py +Detector : __detector : AthenaConfiguration/AllConfigFlags.py +Digitization : __digitization : AthenaConfiguration/AllConfigFlags.py +Egamma : __egamma : AthenaConfiguration/AllConfigFlags.py +InDet : __indet : AthenaConfiguration/AllConfigFlags.py +LAr : __lar : AthenaConfiguration/AllConfigFlags.py +Muon : __muon : AthenaConfiguration/AllConfigFlags.py +MuonCombined : __muoncombined : AthenaConfiguration/AllConfigFlags.py +Overlay : __overlay : AthenaConfiguration/AllConfigFlags.py +PF : __pflow : AthenaConfiguration/AllConfigFlags.py +Sim : __simulation : AthenaConfiguration/AllConfigFlags.py +Tile : __tile : AthenaConfiguration/AllConfigFlags.py +Trigger : __trigger : AthenaConfiguration/AllConfigFlags.py +Py:Athena INFO About to setup Raw data decoding +Py:Athena INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [muonconfig/5f5ea9b] -- built on [2020-06-03T1254] +Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1 +Py:MetaReader INFO Current mode used: peeker +Py:MetaReader INFO Current filenames: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1'] +Py:ConfigurableDb INFO Read module info for 5533 configurables from 5 genConfDb files +Py:ConfigurableDb INFO No duplicates have been found: that's good ! +EventInfoMgtInit: Got release version Athena-22.0.15 +Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 +Py:Athena INFO Print Config +Py:ComponentAccumulator INFO Event Inputs +Py:ComponentAccumulator INFO Event Algorithm Sequences +Py:ComponentAccumulator INFO Top sequence 0 +Py:ComponentAccumulator INFO \__ AthAlgSeq (seq: SEQ AND) +Py:ComponentAccumulator INFO \__ MuonCacheCreator (alg) +Py:ComponentAccumulator INFO \__ RpcRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ TgcRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ MdtRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ CscRawDataProvider (alg) +Py:ComponentAccumulator INFO \__ RpcRdoToRpcPrepData (alg) +Py:ComponentAccumulator INFO \__ TgcRdoToTgcPrepData (alg) +Py:ComponentAccumulator INFO \__ MdtRdoToMdtPrepData (alg) +Py:ComponentAccumulator INFO \__ CscRdoToCscPrepData (alg) +Py:ComponentAccumulator INFO \__ CscThresholdClusterBuilder (alg) +Py:ComponentAccumulator INFO Condition Algorithms +Py:ComponentAccumulator INFO \__ CondInputLoader (cond alg) +Py:ComponentAccumulator INFO \__ MuonAlignmentCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ MuonDetectorCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ RpcCablingCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ MuonMDT_CablingAlg (cond alg) +Py:ComponentAccumulator INFO \__ AtlasFieldMapCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ AtlasFieldCacheCondAlg (cond alg) +Py:ComponentAccumulator INFO \__ RpcCondDbAlg (cond alg) +Py:ComponentAccumulator INFO \__ MdtCalibDbAlg (cond alg) +Py:ComponentAccumulator INFO \__ CscCondDbAlg (cond alg) +Py:ComponentAccumulator INFO Services +Py:ComponentAccumulator INFO ['EventSelector', 'ByteStreamInputSvc', 'EventPersistencySvc', 'ByteStreamCnvSvc', 'ROBDataProviderSvc', 'ByteStreamAddressProviderSvc', 'MetaDataStore', 'InputMetaDataStore', 'MetaDataSvc', 'ProxyProviderSvc', 'GeoModelSvc', 'DetDescrCnvSvc', 'TagInfoMgr', 'IOVDbSvc', 'PoolSvc', 'CondSvc', 'DBReplicaSvc', 'AthenaPoolCnvSvc', 'MuonIdHelperSvc', 'RPCcablingServerSvc', 'MuonRPC_CablingSvc', 'LVL1TGC::TGCRecRoiSvc', 'TGCcablingServerSvc', 'MuonMDT_CablingSvc', 'AtlasFieldSvc', 'CSCcablingSvc'] +Py:ComponentAccumulator INFO Public Tools +Py:ComponentAccumulator INFO [ +Py:ComponentAccumulator INFO IOVDbMetaDataTool/IOVDbMetaDataTool, +Py:ComponentAccumulator INFO ByteStreamMetadataTool/ByteStreamMetadataTool, +Py:ComponentAccumulator INFO RPCCablingDbTool/RPCCablingDbTool, +Py:ComponentAccumulator INFO Muon::RPC_RawDataProviderToolMT/RPC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO Muon::TGC_RawDataProviderToolMT/TGC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO MDTCablingDbTool/MDTCablingDbTool, +Py:ComponentAccumulator INFO Muon::MDT_RawDataProviderToolMT/MDT_RawDataProviderToolMT, +Py:ComponentAccumulator INFO Muon::CSC_RawDataProviderToolMT/CSC_RawDataProviderToolMT, +Py:ComponentAccumulator INFO ] +Py:ComponentAccumulator INFO Private Tools +Py:ComponentAccumulator INFO [ +Py:ComponentAccumulator INFO ] +Py:ComponentAccumulator INFO TheApp properties +Py:ComponentAccumulator INFO EvtSel : EventSelector +Py:Athena INFO Save Config + +JOs reading stage finished, launching CARunner from pickle file + +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus703.cern.ch on Wed Jun 3 15:26:14 2020 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +PublicTool IOVDbMetaDataTool +PublicTool ByteStreamMetadataTool +PublicTool RPCCablingDbTool +PublicTool RPC_RawDataProviderToolMT +PublicTool TGC_RawDataProviderToolMT +PublicTool MDTCablingDbTool +PublicTool MDT_RawDataProviderToolMT +PublicTool CSC_RawDataProviderToolMT +CoreDumpSvc INFO install f-a-t-a-l handler... (flag = 438) +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) +ClassIDSvc INFO getRegistryEntries: read 3838 CLIDRegistry entries for module ALL +MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 +AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 +PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] +PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled +PoolSvc INFO Frontier compression level set to 5 +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-06-02T2139/Athena/22.0.15/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 10 servers found for host lxplus703.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO COOL SQLite replicas will be excluded if matching pattern /DBRelease/ +PoolSvc INFO Successfully setup replica sorting algorithm +PoolSvc INFO Setting up APR FileCatalog and Streams +PoolSvc INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml +PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_comcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_comcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml +DbSession INFO Open DbSession +Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] +ToolSvc.ByteStr... INFO Initializing ToolSvc.ByteStreamMetadataTool - package version ByteStreamCnvSvc-00-00-00 +MetaDataSvc INFO Found MetaDataTools = PublicToolHandleArray(['IOVDbMetaDataTool/IOVDbMetaDataTool','ByteStreamMetadataTool/ByteStreamMetadataTool']) +ByteStreamAddre... INFO Initializing ByteStreamAddressProviderSvc - package version ByteStreamCnvSvcBase-00-00-00 +ByteStreamAddre... INFO initialized +ByteStreamAddre... INFO -- Will fill Store with id = 0 +IOVDbSvc INFO Opened read transaction for POOL PersistencySvc +IOVDbSvc INFO Only 5 POOL conditions files will be open at once +IOVDbSvc INFO Cache alignment will be done in 3 slices +IOVDbSvc INFO Global tag: CONDBR2-BLKPA-2018-13 set from joboptions +IOVDbFolder INFO Inputfile tag override disabled for /GLOBAL/BField/Maps +IOVDbSvc INFO Initialised with 10 connections and 29 folders +IOVDbSvc INFO Service IOVDbSvc initialised successfully +ClassIDSvc INFO getRegistryEntries: read 2674 CLIDRegistry entries for module ALL +IOVDbSvc INFO Opening COOL connection for COOLOFL_MUONALIGN/CONDBR2 +IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" +IOVSvc.IOVSvcTool INFO IOVRanges will be checked at every Event +IOVDbSvc INFO Opening COOL connection for COOLONL_RPC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_MUONALIGN/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_TGC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_RPC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_TGC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_RPC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_RPC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Added taginfo remove for /CSC/FTHOLD +IOVDbSvc INFO Added taginfo remove for /CSC/NOISE +IOVDbSvc INFO Added taginfo remove for /CSC/PED +IOVDbSvc INFO Added taginfo remove for /CSC/PSLOPE +IOVDbSvc INFO Added taginfo remove for /CSC/RMS +IOVDbSvc INFO Added taginfo remove for /CSC/STAT +IOVDbSvc INFO Added taginfo remove for /CSC/T0BASE +IOVDbSvc INFO Added taginfo remove for /CSC/T0PHASE +IOVDbSvc INFO Added taginfo remove for /EXT/DCS/MAGNETS/SENSORDATA +IOVDbSvc INFO Added taginfo remove for /GLOBAL/BField/Maps +IOVDbSvc INFO Added taginfo remove for /MDT/CABLING/MAP_SCHEMA +IOVDbSvc INFO Added taginfo remove for /MDT/CABLING/MEZZANINE_SCHEMA +IOVDbSvc INFO Added taginfo remove for /MDT/RTBLOB +IOVDbSvc INFO Added taginfo remove for /MDT/T0BLOB +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/CSC/ILINES +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ASBUILTPARAMS +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/BARREL +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ENDCAP/SIDEA +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/MDT/ENDCAP/SIDEC +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/TGC/SIDEA +IOVDbSvc INFO Added taginfo remove for /MUONALIGN/TGC/SIDEC +IOVDbSvc INFO Added taginfo remove for /RPC/CABLING/MAP_SCHEMA +IOVDbSvc INFO Added taginfo remove for /RPC/CABLING/MAP_SCHEMA_CORR +IOVDbSvc INFO Added taginfo remove for /RPC/DCS/DeadRopanels +IOVDbSvc INFO Added taginfo remove for /RPC/DCS/OffRopanels +IOVDbSvc INFO Added taginfo remove for /RPC/DQMF/ELEMENT_STATUS +IOVDbSvc INFO Added taginfo remove for /RPC/TRIGGER/CM_THR_ETA +IOVDbSvc INFO Added taginfo remove for /RPC/TRIGGER/CM_THR_PHI +IOVDbSvc INFO Added taginfo remove for /TGC/CABLING/MAP_SCHEMA +GeoModelSvc INFO Explicitly initializing DetDescrCnvSvc +DetDescrCnvSvc INFO initializing +DetDescrCnvSvc INFO Found DetectorStore service +DetDescrCnvSvc INFO filling proxies for detector managers +DetDescrCnvSvc INFO filling address for CaloTTMgr with CLID 117659265 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloMgr with CLID 4548337 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloSuperCellMgr with CLID 241807251 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloIdManager with CLID 125856940 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArIdManager with CLID 79554919 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for IdDict with CLID 2411 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for AtlasID with CLID 164875623 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for PixelID with CLID 2516 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for SCT_ID with CLID 2517 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TRT_ID with CLID 2518 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for SiliconID with CLID 129452393 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArEM_ID with CLID 163583365 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArEM_SuperCell_ID with CLID 99488227 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHEC_ID with CLID 3870484 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHEC_SuperCell_ID with CLID 254277678 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArFCAL_ID with CLID 45738051 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArFCAL_SuperCell_ID with CLID 12829437 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArMiniFCAL_ID with CLID 79264204 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArOnlineID with CLID 158698068 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TTOnlineID with CLID 38321944 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArOnline_SuperCellID with CLID 115600394 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArHVLineID with CLID 27863673 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for LArElectrodeID with CLID 80757351 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileID with CLID 2901 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for Tile_SuperCell_ID with CLID 49557789 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileHWID with CLID 2902 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TileTBID with CLID 2903 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for MDTIDHELPER with CLID 4170 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CSCIDHELPER with CLID 4171 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for RPCIDHELPER with CLID 4172 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for TGCIDHELPER with CLID 4173 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloLVL1_ID with CLID 108133391 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloCell_ID with CLID 123500438 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloCell_SuperCell_ID with CLID 128365736 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for CaloDM_ID with CLID 167756483 and storage type 68 to detector store +DetDescrCnvSvc INFO filling address for ZdcID with CLID 190591643 and storage type 68 to detector store +GeoModelSvc.Muo... INFO Initializing ... +GeoModelSvc::RD...WARNING Getting PixTBMatComponents with default tag +GeoModelSvc::RD...WARNING Getting PixTBMaterials with default tag +GeoModelSvc::RD...WARNING Getting InDetMatComponents with default tag +GeoModelSvc::RD...WARNING Getting InDetMaterials with default tag +MuonGeoModel INFO MuonDetectorFactory - constructor MuonSystem OuterRadius 13000 Length 22030 +GeoModelSvc.Muo... INFO create MuonDetectorTool - package version = MuonGeoModel-00-00-00 +GeoModelSvc.Muo... INFO (from GeoModelSvc) AtlasVersion = <ATLAS-R2-2016-01-00-01> MuonVersion = <> +GeoModelSvc.Muo... INFO Keys for Muon Switches are (key) ATLAS-R2-2016-01-00-01 (node) ATLAS +GeoModelSvc.Muo... INFO (from GeoModelSvc) in AtlasVersion = <ATLAS-R2-2016-01-00-01> default MuonVersion is <MuonSpectrometer-R.08.01> +GeoModelSvc.Muo... INFO Properties have been set as follows: +GeoModelSvc.Muo... INFO LayoutName R +GeoModelSvc.Muo... INFO IncludeCutouts 0 +GeoModelSvc.Muo... INFO IncludeCutoutsBog 0 +GeoModelSvc.Muo... INFO IncludeCtbBis 0 +GeoModelSvc.Muo... INFO ControlAlines 111111 +GeoModelSvc.Muo... INFO MinimalGeoFlag 0 +GeoModelSvc.Muo... INFO EnableCscIntAlignment 1 +GeoModelSvc.Muo... INFO EnableCscIntAlignmentFromGM 0 +GeoModelSvc.Muo... INFO ControlCscIntAlines 111111 +GeoModelSvc.Muo... INFO EnableMdtDeformations 1 +GeoModelSvc.Muo... INFO EnableMdtAsBuiltParameters 1 +MuGM:MuonFactory INFO MuonLayout set to <R.08.01> = Development version for DC3 - infrastructures +MuGM:MuonFactory INFO BOG cutouts are activated 1 , all other cutouts are disabled 1 +MuGM:MuonFactory INFO Manager created for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuonGeoModel.MYSQL INFO GeometryVersion set to <R.08.01> +MuGM:MuonFactory INFO Mysql helper class created here for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuGM:MuonFactory INFO MDTIDHELPER retrieved from DetStore +EventPersistenc... INFO Added successfully Conversion service:ByteStreamCnvSvc +EventPersistenc... INFO Added successfully Conversion service:DetDescrCnvSvc +MDT_IDDetDescrCnv INFO in createObj: creating a MdtIdHelper object in the detector store +IdDictDetDescrCnv INFO in initialize +IdDictDetDescrCnv INFO in createObj: creating a IdDictManager object in the detector store +IdDictDetDescrCnv INFO IdDictName: IdDictParser/ATLAS_IDS.xml +IdDictDetDescrCnv INFO Reading InnerDetector IdDict file InDetIdDictFiles/IdDictInnerDetector_IBL3D25-03.xml +IdDictDetDescrCnv INFO Reading LArCalorimeter IdDict file IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml +IdDictDetDescrCnv INFO Reading TileCalorimeter IdDict file IdDictParser/IdDictTileCalorimeter.xml +IdDictDetDescrCnv INFO Reading Calorimeter IdDict file IdDictParser/IdDictCalorimeter_L1Onl.xml +IdDictDetDescrCnv INFO Reading MuonSpectrometer IdDict file IdDictParser/IdDictMuonSpectrometer_R.03.xml +IdDictDetDescrCnv INFO Reading ForwardDetectors IdDict file IdDictParser/IdDictForwardDetectors_2010.xml +IdDictDetDescrCnv INFO Found id dicts: +IdDictDetDescrCnv INFO Using dictionary tag: null +IdDictDetDescrCnv INFO Dictionary ATLAS version default DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary Calorimeter version default DetDescr tag CaloIdentifier-LVL1-02 file IdDictParser/IdDictCalorimeter_L1Onl.xml +IdDictDetDescrCnv INFO Dictionary ForwardDetectors version default DetDescr tag ForDetIdentifier-01 file IdDictParser/IdDictForwardDetectors_2010.xml +IdDictDetDescrCnv INFO Dictionary InnerDetector version IBL-DBM DetDescr tag InDetIdentifier-IBL3D25-02 file InDetIdDictFiles/IdDictInnerDetector_IBL3D25-03.xml +IdDictDetDescrCnv INFO Dictionary LArCalorimeter version fullAtlas DetDescr tag LArIdentifier-DC3-05-Comm file IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml +IdDictDetDescrCnv INFO Dictionary LArElectrode version fullAtlas DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary LArHighVoltage version fullAtlas DetDescr tag (using default) file +IdDictDetDescrCnv INFO Dictionary MuonSpectrometer version R.03 DetDescr tag MuonIdentifier-08 file IdDictParser/IdDictMuonSpectrometer_R.03.xml +IdDictDetDescrCnv INFO Dictionary TileCalorimeter version fullAtlasAndTestBeam DetDescr tag TileIdentifier-00 file IdDictParser/IdDictTileCalorimeter.xml +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +MdtIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +MdtIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 241 +MdtIdHelper INFO MultiRange built successfully to tube: MultiRange size is 241 +MdtIdHelper INFO Initializing MDT hash indices ... +MdtIdHelper INFO The element hash max is 1188 +MdtIdHelper INFO The detector element hash max is 2328 +MdtIdHelper INFO Initializing MDT hash indices for finding neighbors ... +MuGM:MuonFactory INFO RPCIDHELPER retrieved from DetStore +RPC_IDDetDescrCnv INFO in createObj: creating a RpcIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +RpcIdHelper INFO MultiRange built successfully to doubletR: MultiRange size is 241 +RpcIdHelper INFO MultiRange built successfully to detectorElement: DetectorElement MultiRange size is 241 +RpcIdHelper INFO MultiRange built successfully to rpcStrip: MultiRange size is 241 +RpcIdHelper INFO Initializing RPC hash indices ... +RpcIdHelper INFO The element hash max is 600 +RpcIdHelper INFO The detector element hash max is 1122 +RpcIdHelper INFO Initializing RPC hash indices for finding neighbors ... +MuGM:MuonFactory INFO TGCIDHELPER retrieved from DetStore +TGC_IDDetDescrCnv INFO in createObj: creating a TgcIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +TgcIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +TgcIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 210 +TgcIdHelper INFO MultiRange built successfully to channel: MultiRange size is 241 +TgcIdHelper INFO Initializing TGC hash indices ... +TgcIdHelper INFO The element hash max is 1578 +TgcIdHelper INFO The detector element hash max is 1578 +TgcIdHelper INFO Initializing TGC hash indices for finding neighbors ... +MuGM:MuonFactory INFO CSCIDHELPER retrieved from DetStore +CSC_IDDetDescrCnv INFO in createObj: creating a CcscIdHelper object in the detector store +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find mm region index: group, region size 0 0 +AtlasDetectorIDHelper::initialize_from_dictionary - Warning: unable to find stgc region index: group, region size 0 0 +AtlasDetectorID::initLevelsFromDict - there are no sTGC entries in the dictionary! +AtlasDetectorID::initLevelsFromDict - there are no MM entries in the dictionary! + AtlasDetectorID::initialize_from_dictionary - OK +CscIdHelper INFO MultiRange built successfully to Technology: MultiRange size is 210 +CscIdHelper INFO MultiRange built successfully to detector element: Multilayer MultiRange size is 237 +CscIdHelper INFO MultiRange built successfully to cscStrip: MultiRange size is 241 +CscIdHelper INFO Initializing CSC hash indices ... +CscIdHelper INFO The element hash max is 32 +CscIdHelper INFO The detector element hash max is 64 +CscIdHelper INFO The channel hash max is 61440 +CscIdHelper INFO Initializing CSC hash indices for finding neighbors ... +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 ************************ +MuGM:MuonFactory INFO *** Start building the Muon Geometry Tree ********************** +MuGM:RDBReadAtlas INFO Start retriving dbObjects with tag = <ATLAS-R2-2016-01-00-01> node <ATLAS> +RDBAccessSvc WARNING Could not get the tag for XtomoData node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO After getQuery XtomoData +In DblQ00Xtomo(data) +No XtomoData table in the MuonDD Database +MuGM:RDBReadAtlas INFO After new DblQ00Xtomo +MuGM:RDBReadAtlas INFO After m_dhxtomo.data() +MuGM:RDBReadAtlas INFO No Ascii aszt input found: looking for A-lines in ORACLE +MuGM:RDBReadAtlas INFO ASZT table found in Oracle +MuGM:RDBReadAtlas INFO ASZT size is 32 +MuGM:RDBReadAtlas INFO No Ascii iacsc input found: looking for A-lines in ORACLE +RDBAccessSvc WARNING Could not get the tag for ISZT node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO No ISZT table in Oracle +MuGM:RDBReadAtlas INFO Access granted for all dbObjects needed by muon detectors +MuonGeoModel.MYSQL INFO LayoutName (from DBAM) set to <R.08> -- relevant for CTB2004 +MuGM:ProcStations INFO Processing Stations and Components +MuGM:ProcStations INFO Processing Stations and Components DONE +MuGM:ProcTechnol.s INFO nMDT 13 nCSC 2 nTGC 22 nRPC 25 +MuGM:ProcTechnol.s INFO nDED 2 nSUP 4 nSPA 2 +MuGM:ProcTechnol.s INFO nCHV 7 nCRO 7 nCMI 6 nLBI 6 +MuGM:ProcPosition INFO *** N. of stations positioned in the setup 234 +MuGM:ProcPosition INFO *** N. of stations described in mysql 234 +MuGM:ProcPosition INFO *** N. of types 32 size of jtypvec 32 +MuGM:ProcPosition INFO *** : 234 kinds of stations (type*sub_type) +MuGM:ProcPosition INFO *** : 1758 physical stations in space - according to the MuonDD DataBase +MuGM:ProcCutouts INFO Processing Cutouts for geometry layout R.08 +MuGM:ProcCutouts INFO Processing Cutouts DONE +MuGM:RDBReadAtlas INFO ProcessTGCreadout - version 7 wirespacing 1.8 +MuGM:RDBReadAtlas INFO Intermediate Objects built from primary numbers +MuGM:MuonFactory INFO theMaterialManager retrieven successfully from the DetStore +MuGM:MuonFactory INFO MuonSystem description from OracleTag=<ATLAS-R2-2016-01-00-01> and node=<ATLAS> +MuGM:MuonFactory INFO TreeTop added to the Manager +MuGM:MuonFactory INFO Muon Layout R.08.01 +MuGM:MuonFactory INFO Fine Clash Fixing disabled: (should be ON/OFF for Simulation/Reconstruction) +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 **************************** +MuGM:MuonFactory INFO *** The Muon Chamber Geometry Tree is built with +MuGM:MuonFactory INFO *** 1758 child volumes +MuGM:MuonFactory INFO *** 1839 independent elements and +MuGM:MuonFactory INFO *** 11473 elements cloned or shared +MuGM:MuonFactory INFO *** 234 kinds of stations +MuGM:MuonFactory INFO *** 1758 stations with alignable transforms +MuGM:MuonFactory INFO *** 148 stations are described as Assemblies +MuGM:MuonFactory INFO *** 1758 MuonStations +MuGM:MuonFactory INFO *** 2324 MDT Readout Elements 1186 MDT Detector Elements +MuGM:MuonFactory INFO *** 32 CSC Readout Elements 32 CSC Detector Elements +MuGM:MuonFactory INFO *** 1122 RPC Readout Elements 600 RPC Detector Elements +MuGM:MuonFactory INFO *** 1578 TGC Readout Elements 1578 TGC Detector Elements +MuGM:MuonFactory INFO ******************************************************************** +MuGM:MuonFactory INFO *** Inert Material built according to DB switches and config. ****** +MuGM:MuonFactory INFO *** The Muon Geometry Tree has 1758 child vol.s in total ******** +MuGM:MuonFactory INFO ******************************************************************** + +MGM::MuonDetect... INFO Init A/B Line Containers - done - size is respectively 1758/0 +MGM::MuonDetect... INFO Init of CSC I-Lines will be done via Conditions DB +MGM::MuonDetect... INFO Init I-Line Container - done - size is respectively 128 +MGM::MuonDetect... INFO I-Line for CSC wire layers loaded (Csc Internal Alignment) +MGM::MuonDetect... INFO According to configuration they WILL be used +MGM::MuonDetect... INFO Filling cache +GeoModelSvc INFO GeoModelSvc.MuonDetectorTool SZ= 228440Kb Time = 1.65S +ClassIDSvc INFO getRegistryEntries: read 3099 CLIDRegistry entries for module ALL +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 +ClassIDSvc INFO getRegistryEntries: read 839 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 422 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 305 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 291 CLIDRegistry entries for module ALL +CondInputLoader INFO Initializing CondInputLoader... +CondInputLoader INFO Adding base classes: + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/FTHOLD' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/NOISE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PED' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PSLOPE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/RMS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/STAT' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/DeadRopanels' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/OffRopanels' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' ) -> +CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/FTHOLD' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/NOISE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PED' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/PSLOPE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/RMS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/STAT' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/DeadRopanels' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DCS/OffRopanels' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' ) +MuonAlignmentCo... INFO Initilalizing +MuonAlignmentCo... INFO In initialize ---- # of folders registered is 7 +MuonAlignmentCo... INFO geometry version from the MuonDetectorManager = R.08.01 +MuonDetectorCon... INFO Initializing ... +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 +ClassIDSvc INFO getRegistryEntries: read 7927 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1043 CLIDRegistry entries for module ALL RpcRawDataProvider INFO RpcRawDataProvider::initialize RpcRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 2156 CLIDRegistry entries for module ALL +ROBDataProviderSvc INFO Initializing ROBDataProviderSvc - package version ByteStreamCnvSvcBase-00-00-00 +ROBDataProviderSvc INFO ---> Filter out empty ROB fragments = 'filterEmptyROB':False +ROBDataProviderSvc INFO ---> Filter out specific ROBs by Status Code: # ROBs = 0 +ROBDataProviderSvc INFO ---> Filter out Sub Detector ROBs by Status Code: # Sub Detectors = 0 RpcRawDataProvi... INFO initialize() successful in RpcRawDataProvider.RPC_RawDataProviderToolMT TgcRawDataProvider INFO TgcRawDataProvider::initialize TgcRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 1223 CLIDRegistry entries for module ALL TgcRawDataProvi... INFO initialize() successful in TgcRawDataProvider.TGC_RawDataProviderToolMT.TgcROD_Decoder +MuonTGC_CablingSvc INFO for 1/12 sector initialize +ToolSvc.TGCCabl... INFO initialize +ToolSvc.TGCCabl... INFO readTGCMap from text +ToolSvc.TGCCabl... INFO readTGCMap found file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-06-02T2139/Athena/22.0.15/InstallArea/x86_64-centos7-gcc8-opt/share/ASD2PP_diff_12_ONL.db +ToolSvc.TGCCabl... INFO giveASD2PP_DIFF_12 (m_ASD2PP_DIFF_12 is not NULL) TgcRawDataProvi... INFO initialize() successful in TgcRawDataProvider.TGC_RawDataProviderToolMT MdtRawDataProvider INFO MdtRawDataProvider::initialize MdtRawDataProvider INFO 'DoSeededDecoding':False +ClassIDSvc INFO getRegistryEntries: read 1376 CLIDRegistry entries for module ALL MdtRawDataProvi... INFO Retrieved service ServiceHandle('ROBDataProviderSvc') MdtRawDataProvi... INFO Processing configuration for layouts with BME chambers. MdtRawDataProvi... INFO Processing configuration for layouts with BMG chambers. MdtRawDataProvi... INFO Retrieved tool Decoder = PrivateToolHandle('MdtROD_Decoder/MdtROD_Decoder') MdtRawDataProvi... INFO initialize() successful in MdtRawDataProvider.MDT_RawDataProviderToolMT +ClassIDSvc INFO getRegistryEntries: read 1048 CLIDRegistry entries for module ALL CscRawDataProvi... INFO Retrieved service ServiceHandle('ROBDataProviderSvc') CscRawDataProvi... INFO Retrieved tool Decoder = PrivateToolHandle('Muon::CscROD_Decoder/CscROD_Decoder') CscRawDataProvi... INFO The Muon Geometry version is R.08.01 CscRawDataProvi... INFO initialize() successful in CscRawDataProvider.CSC_RawDataProviderToolMT +ClassIDSvc INFO getRegistryEntries: read 53 CLIDRegistry entries for module ALL +RpcRdoToRpcPrep... INFO package version = MuonRPC_CnvTools-00-00-00 RpcRdoToRpcPrep... INFO properties are -RpcRdoToRpcPrep... INFO processingData 0 RpcRdoToRpcPrep... INFO produceRpcCoinDatafromTriggerWords 1 RpcRdoToRpcPrep... INFO reduceCablingOverlap 1 RpcRdoToRpcPrep... INFO solvePhiAmbiguities 1 @@ -25,11 +552,505 @@ RpcRdoToRpcPrep... INFO timeShift -12.5 RpcRdoToRpcPrep... INFO etaphi_coincidenceTime 20 RpcRdoToRpcPrep... INFO overlap_timeTolerance 10 RpcRdoToRpcPrep... INFO Correct prd time from cool db 0 +MuonRPC_CablingSvc INFO Initializing MuonRPC_CablingSvc - package version MuonRPC_Cabling-00-00-00 +ToolSvc.RPCCabl... INFO Initializing - folders names are: conf /RPC/CABLING/MAP_SCHEMA / corr /RPC/CABLING/MAP_SCHEMA_CORR +MuonRPC_CablingSvc INFO RPCCablingDbTool retrieved with handle TheRpcCablingDbTool = PublicToolHandle('RPCCablingDbTool/RPCCablingDbTool') +MuonRPC_CablingSvc INFO Register call-back against 2 folders listed below +MuonRPC_CablingSvc INFO Folder n. 1 </RPC/CABLING/MAP_SCHEMA> found in the DetStore +ClassIDSvc INFO getRegistryEntries: read 239 CLIDRegistry entries for module ALL +MuonRPC_CablingSvc INFO initMappingModel registered for call-back against folder </RPC/CABLING/MAP_SCHEMA> +MuonRPC_CablingSvc INFO Folder n. 2 </RPC/CABLING/MAP_SCHEMA_CORR> found in the DetStore +MuonRPC_CablingSvc INFO initMappingModel registered for call-back against folder </RPC/CABLING/MAP_SCHEMA_CORR> +MuonRPC_CablingSvc INFO RPCTriggerDbTool retrieved with statusCode = SUCCESS pointer = TheRpcTriggerDbTool = PublicToolHandle('RPCTriggerDbTool') +MuonRPC_CablingSvc INFO Register call-back against 2 folders listed below +MuonRPC_CablingSvc INFO Folder n. 1 </RPC/TRIGGER/CM_THR_ETA> found in the DetStore +MuonRPC_CablingSvc INFO initTrigRoadsModel registered for call-back against folder </RPC/TRIGGER/CM_THR_ETA> +MuonRPC_CablingSvc INFO Folder n. 2 </RPC/TRIGGER/CM_THR_PHI> found in the DetStore +MuonRPC_CablingSvc INFO initTrigRoadsModel registered for call-back against folder </RPC/TRIGGER/CM_THR_PHI> RpcRdoToRpcPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::RpcRdoToPrepDataToolMT/RpcRdoToRpcPrepDataTool') TgcRdoToTgcPrep... INFO initialize() successful in TgcRdoToTgcPrepData.TgcRdoToTgcPrepDataTool TgcRdoToTgcPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::TgcRdoToPrepDataToolMT/TgcRdoToTgcPrepDataTool') +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BMG chambers. +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BME chambers. +MdtRdoToMdtPrep... INFO Processing configuration for layouts with BMG chambers. +MdtRdoToMdtPrep... INFO Retrieved DecodingTool = PrivateToolHandle('Muon::MdtRdoToPrepDataToolMT/MdtRdoToMdtPrepDataTool') +ClassIDSvc INFO getRegistryEntries: read 166 CLIDRegistry entries for module ALL +MdtRdoToMdtPrep...WARNING Lookup table will not be initialised MdtRdoToMdtPrepData.RegSelTool_MDT key 'ConditionStore+Tool_Not_Initalised' CscRdoToCscPrep... INFO The Geometry version is MuonSpectrometer-R.08.01 +ClassIDSvc INFO getRegistryEntries: read 114 CLIDRegistry entries for module ALL CscRdoToCscPrep... INFO Retrieved CscRdoToCscPrepDataTool = PrivateToolHandle('Muon::CscRdoToCscPrepDataToolMT/CscRdoToCscPrepDataTool') +EventSelector WARNING InputCollections not properly set, checking EventStorageInputSvc properties +EventSelector INFO reinitialization... +ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL +EventSelector INFO Retrieved InputCollections from InputSvc +ByteStreamInputSvc INFO Initializing ByteStreamInputSvc - package version ByteStreamCnvSvc-00-00-00 +EventSelector INFO reinitialization... +AthenaEventLoopMgr INFO Setup EventSelector service EventSelector +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr SUCCESS ****************************** Algorithm Sequence **************************** +ApplicationMgr SUCCESS AthSequencer/AthMasterSeq +ApplicationMgr SUCCESS AthSequencer/AthAlgEvtSeq +ApplicationMgr SUCCESS AthSequencer/AthBeginSeq +ApplicationMgr SUCCESS AthIncFirerAlg/BeginIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg1 +ApplicationMgr SUCCESS AthSequencer/AthAllAlgSeq +ApplicationMgr SUCCESS AthSequencer/AthCondSeq +ApplicationMgr SUCCESS CondInputLoader/CondInputLoader +ApplicationMgr SUCCESS MuonAlignmentCondAlg/MuonAlignmentCondAlg +ApplicationMgr SUCCESS MuonDetectorCondAlg/MuonDetectorCondAlg +ApplicationMgr SUCCESS RpcCablingCondAlg/RpcCablingCondAlg +ApplicationMgr SUCCESS MuonMDT_CablingAlg/MuonMDT_CablingAlg +ApplicationMgr SUCCESS MagField::AtlasFieldMapCondAlg/AtlasFieldMapCondAlg +ApplicationMgr SUCCESS MagField::AtlasFieldCacheCondAlg/AtlasFieldCacheCondAlg +ApplicationMgr SUCCESS RpcCondDbAlg/RpcCondDbAlg +ApplicationMgr SUCCESS MdtCalibDbAlg/MdtCalibDbAlg +ApplicationMgr SUCCESS CscCondDbAlg/CscCondDbAlg +ApplicationMgr SUCCESS AthSequencer/AthAlgSeq +ApplicationMgr SUCCESS MuonCacheCreator/MuonCacheCreator +ApplicationMgr SUCCESS Muon::RpcRawDataProvider/RpcRawDataProvider +ApplicationMgr SUCCESS Muon::TgcRawDataProvider/TgcRawDataProvider +ApplicationMgr SUCCESS Muon::MdtRawDataProvider/MdtRawDataProvider +ApplicationMgr SUCCESS Muon::CscRawDataProvider/CscRawDataProvider +ApplicationMgr SUCCESS RpcRdoToRpcPrepData/RpcRdoToRpcPrepData +ApplicationMgr SUCCESS TgcRdoToTgcPrepData/TgcRdoToTgcPrepData +ApplicationMgr SUCCESS MdtRdoToMdtPrepData/MdtRdoToMdtPrepData +ApplicationMgr SUCCESS CscRdoToCscPrepData/CscRdoToCscPrepData +ApplicationMgr SUCCESS CscThresholdClusterBuilder/CscThresholdClusterBuilder +ApplicationMgr SUCCESS AthSequencer/AthEndSeq +ApplicationMgr SUCCESS AthIncFirerAlg/EndIncFiringAlg +ApplicationMgr SUCCESS IncidentProcAlg/IncidentProcAlg2 +ApplicationMgr SUCCESS AthSequencer/AthOutSeq +ApplicationMgr SUCCESS AthSequencer/AthRegSeq +ApplicationMgr SUCCESS ****************************************************************************** +ByteStreamInputSvc INFO Picked valid file: /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1 +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/FTHOLD' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/NOISE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/PED' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/PSLOPE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/RMS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/STAT' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/T0BASE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/CSC/T0PHASE' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/GLOBAL/BField/Maps' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/RTBLOB' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MDT/T0BLOB' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/CSC/ILINES' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/BARREL' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/TGC/SIDEA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/MUONALIGN/TGC/SIDEC' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/CABLING/MAP_SCHEMA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/CABLING/MAP_SCHEMA_CORR' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DCS/DeadRopanels' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DCS/OffRopanels' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/DQMF/ELEMENT_STATUS' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/TRIGGER/CM_THR_ETA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/RPC/TRIGGER/CM_THR_PHI' +ApplicationMgr INFO Application Manager Started successfully +EventInfoByteSt... INFO IsSimulation : 0 +EventInfoByteSt... INFO IsTestbeam : 0 +EventInfoByteSt... INFO IsCalibration : 0 +AthenaEventLoopMgr INFO ===>>> start of run 327265 <<<=== +EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr +IOVDbSvc INFO Opening COOL connection for COOLONL_RPC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCCablingMapSchema_2016_2017_01 for folder /RPC/CABLING/MAP_SCHEMA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCCablingMapSchemaCorr_2016_2017_01 for folder /RPC/CABLING/MAP_SCHEMA_CORR +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCTriggerCMThrEta_RUN1-RUN2-HI-02 for folder /RPC/TRIGGER/CM_THR_ETA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCTriggerCMThrPhi_RUN1-RUN2-HI-02 for folder /RPC/TRIGGER/CM_THR_PHI +IOVDbSvc INFO Disconnecting from COOLONL_RPC/CONDBR2 +EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc +MuonRPC_CablingSvc INFO initMappingModel has been called +MuonRPC_CablingSvc INFO ToolHandle in initMappingModel - <TheRpcCablingDbTool = PublicToolHandle('RPCCablingDbTool/RPCCablingDbTool')> +MuonRPC_CablingSvc INFO Retrieving cabling singleton; to create an empty one or to get the existing one +RPCcabling INFO CablingRPC---singleton constructor ---- this must be executed just once +RPCcabling INFO CablingRPC---The singleton will fill the maps from the COOL streams +RPCcabling INFO CablingRPC---InitMaps from COOL cannot be executed NOW: empty string +RPCcabling INFO CablingRPC---The singleton is created here +RPCcabling INFO CablingRPC--- cacheCleared: s_status = 0 +MuonRPC_CablingSvc INFO Cabling singleton cache has been cleared +MuonRPC_CablingSvc INFO Trigger roads will be loaded from COOL +ToolSvc.RPCCabl... INFO LoadParameters /RPC/CABLING/MAP_SCHEMA I=2 +ToolSvc.RPCCabl... INFO loadRPCMap --- Load Map from DB +ToolSvc.RPCCabl... INFO Try to read from folder </RPC/CABLING/MAP_SCHEMA> +ToolSvc.RPCCabl... INFO CondAttrListCollection from DB folder have been obtained with size 1 +ToolSvc.RPCCabl... INFO After Reading folder, Configuration string size is 222202 +ToolSvc.RPCCabl... INFO LoadParameters /RPC/CABLING/MAP_SCHEMA_CORR I=2 +ToolSvc.RPCCabl... INFO loadRPCCorr --- Load Corrections from DB +ToolSvc.RPCCabl... INFO Try to read from folder </RPC/CABLING/MAP_SCHEMA_CORR> +ToolSvc.RPCCabl... INFO CondAttrListCollection from DB folder have been obtained with size 1 +ToolSvc.RPCCabl... INFO After Reading folder, Correction string size is 29369 +MuonRPC_CablingSvc INFO InitMappingModel: Trigger roads not yet loaded from COOL - postpone cabling initialization +MuonRPC_CablingSvc INFO initTrigRoadsModel has been called +MuonRPC_CablingSvc INFO Trigger roads will be loaded from COOL +MuonRPC_CablingSvc INFO Retrieve the pointer to the cabling singleton +RPCcabling INFO CablingRPC--- cacheCleared: s_status = 0 +MuonRPC_CablingSvc INFO Cabling singleton cache has been cleared +ToolSvc.RPCTrig... INFO LoadParameters /RPC/TRIGGER/CM_THR_ETA I=2 +ToolSvc.RPCTrig... INFO LoadParameters /RPC/TRIGGER/CM_THR_PHI I=2 +MuonRPC_CablingSvc INFO ======== RPC Trigger Roads from COOL - Header infos ======== +MuonRPC_CablingSvc INFO +RPC LVL1 Configuration 10.6 with roads from Feb 2012 +L1 THRESHOLDS: MU4 MU6 MU10 MU11 MU15 MU20 +Road version: "road_files_120209" +CMA th0 th1 th2 +eta low-pt mu4 mu6 mu10 +phi low-pt mu4 mu6 mu10 +eta high-pt mu11 mu15 mu20 +phi high-pt mu11 mu15 mu15 + + +RPCcabling INFO CablingRPC---InitMaps from COOL: going to read configuration +RPCcabling INFO CablingRPC--->> RPC cabling map from COOL << +RPCcabling INFO CablingRPC--- ReadConf: map has size 222202 +RPCcabling INFO CablingRPC--- ReadConf: map n. of lines read is 924 +RPCcabling INFO CablingRPC--- ReadConf: version is 5.0 Atlas R_07_03_RUN2ver104 +RPCcabling INFO CablingRPC--- buildRDOmap +RPCcabling INFO CablingRPC---InitMaps from COOL: going to read corrections to configuration +RPCcabling INFO CablingRPC--->> RPC cabling corrections from COOL << +RPCcabling INFO CablingRPC--- ReadCorr: CorrMap has size 29369 +RPCcabling INFO CablingRPC--- ReadConf: CorrMap n. of lines read is 743 +RPCcabling INFO CablingRPC---InitMaps from COOL - maps have been parsed +MuonRPC_CablingSvc INFO InitTrigRoadsModel: RPC cabling model is loaded! +Level-1 configuration database version 5.0 Atlas R_07_03_RUN2ver104 read. +Contains 26 Trigger Sector Types: +negative sectors 0 - 15 ==> 18 2 24 3 19 2 24 4 20 2 24 1 18 5 25 6 +negative sectors 16 - 31 ==> 21 13 26 6 21 7 16 8 14 7 16 6 21 13 26 1 +positive sectors 32 - 47 ==> 9 24 2 22 9 24 2 23 10 24 2 18 1 25 5 18 +positive sectors 48 - 63 ==> 1 26 13 21 6 17 12 15 11 17 12 21 6 26 13 22 + +MuonRPC_CablingSvc INFO buildOfflineOnlineMap +MuonRPC_CablingSvc INFO Applying FeetPadThresholds : 0,2,5 +MuonRPC_CablingSvc INFO MuonRPC_CablingSvc initialized succesfully +AthenaEventLoopMgr INFO ===>>> start processing event #186525031, run #327265 0 events processed so far <<<=== +IOVDbSvc INFO Opening COOL connection for COOLOFL_CSC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscFthold-RUN2-BLK-UPD1-007-00 for folder /CSC/FTHOLD +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscNoise-RUN2-BLK-UPD1-007-00 for folder /CSC/NOISE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscPed-RUN2-BLK-UPD1-007-00 for folder /CSC/PED +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscPslope-RUN2-BLK-UPD1-000-00 for folder /CSC/PSLOPE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscRms-RUN2-BLK-UPD1-003-00 for folder /CSC/RMS +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscStat-RUN2-BLK-UPD1-008-00 for folder /CSC/STAT +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscT0base-RUN2-BLK-UPD1-001-00 for folder /CSC/T0BASE +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to CscT0phase-RUN2-BLK-UPD2-001-00 for folder /CSC/T0PHASE +IOVDbSvc INFO Disconnecting from COOLOFL_CSC/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Disconnecting from COOLOFL_DCS/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_GLOBAL/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps +IOVDbSvc INFO Disconnecting from COOLONL_GLOBAL/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLONL_MDT/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTCablingMapSchema_BMG_01 for folder /MDT/CABLING/MAP_SCHEMA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTCablingMezzanineSchema_M5-RUN2 for folder /MDT/CABLING/MEZZANINE_SCHEMA +IOVDbSvc INFO Disconnecting from COOLONL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MDT/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTRT-RUN2-UPD4-21 for folder /MDT/RTBLOB +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MDTT0-RUN2-UPD4-21 for folder /MDT/T0BLOB +IOVDbSvc INFO Disconnecting from COOLOFL_MDT/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_MUONALIGN/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignCscIlines-UPD1-02 for folder /MUONALIGN/CSC/ILINES +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMdtAsbuiltparams-RUN2-BA_ONLY-UPD4-00 for folder /MUONALIGN/MDT/ASBUILTPARAMS +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTBarrelAlign-RUN2-BA_ROLLING_11-BLKP-UPD4-00 for folder /MUONALIGN/MDT/BARREL +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTEndCapAAlign-RUN2-ECA_ROLLING_2015_03_01-UPD4-02 for folder /MUONALIGN/MDT/ENDCAP/SIDEA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignMDTEndCapCAlign-RUN2-ECC_ROLLING_2015_03_01-UPD4-02 for folder /MUONALIGN/MDT/ENDCAP/SIDEC +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignTGCEndCapAAlign-RUN2-TGCA_ROLLING_2011_01-ES1-UPD1-03 for folder /MUONALIGN/TGC/SIDEA +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to MuonAlignTGCEndCapCAlign-RUN2-TGCC_ROLLING_2011_01-ES1-UPD1-03 for folder /MUONALIGN/TGC/SIDEC +IOVDbSvc INFO Disconnecting from COOLOFL_MUONALIGN/CONDBR2 +IOVDbSvc INFO Opening COOL connection for COOLOFL_RPC/CONDBR2 +IOVDbFolder INFO HVS tag CONDBR2-BLKPA-2018-13 resolved to RPCDQMFElementStatus_Run1_UPD4-RUN2-01 for folder /RPC/DQMF/ELEMENT_STATUS +IOVDbSvc INFO Disconnecting from COOLOFL_RPC/CONDBR2 +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/CSC/ILINES> +MuonAlignmentCo... INFO Size of CSC/ILINES CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/CSC/ILINES' ) readCscILinesCdo->size()= 1 +MuonAlignmentCo... INFO Range of CSC/ILINES input is {[0,0,t:1425168000] - [t:4294967294.854775807]} +MGM::MuonDetect... INFO temporary CSC I-line container with size = 128 +MGM::MuonDetect... INFO # of CSC I-lines read from the ILineMapContainer in StoreGate is 128 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 128 +MGM::MuonDetect... INFO # of entries in the CSC I-lines historical container is 128 +MuonAlignmentCo... INFO recorded new CscInternalAlignmentMapContainer with range {[0,0,t:1425168000] - [t:4294967294.854775807]} into Conditions Store +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ASBUILTPARAMS> +MuonAlignmentCo... INFO Size of MDT/ASBUILTPARAMS CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ASBUILTPARAMS' ) ->size()= 1 +MuonAlignmentCo... INFO Range of MDT/ASBUILTPARAMS input is {[0,0,t:0] - [t:4294967294.854775807]} +MGM::MuonDetect... INFO temporary As-Built container with size = 628 +MGM::MuonDetect... INFO # of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is 628 +MGM::MuonDetect... INFO # of deltaTransforms updated according to As-Built is 628 +MGM::MuonDetect... INFO # of entries in the MdtAsBuilt historical container is 628 +MuonAlignmentCo... INFO recorded new MdtAsBuiltMapContainer with range {[0,0,t:0] - [t:4294967294.854775807]} into Conditions Store +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/BARREL> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/BARREL CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/BARREL' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/BARREL input is, ALines: {[0,0,t:1497851700] - [t:1498737300]} BLines: {[0,0,t:1497851700] - [t:1498737300]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/BARREL have IoV = 195569 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/BARREL> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEA> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/ENDCAP/SIDEA CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEA' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/ENDCAP/SIDEA input is, ALines: {[0,0,t:1497891240] - [t:1497898380]} BLines: {[0,0,t:1497891240] - [t:1497898380]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/ENDCAP/SIDEA have IoV = 195588 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEA> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEC> +MuonAlignmentCo... INFO Size of /MUONALIGN/MDT/ENDCAP/SIDEC CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/MDT/ENDCAP/SIDEC' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/MDT/ENDCAP/SIDEC input is, ALines: {[0,0,t:1497892260] - [t:1497899460]} BLines: {[0,0,t:1497892260] - [t:1497899460]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/MDT/ENDCAP/SIDEC have IoV = 195599 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/MDT/ENDCAP/SIDEC> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/TGC/SIDEA> +MuonAlignmentCo... INFO No BLines decoding will be attempted for folder named /MUONALIGN/TGC/SIDEA +MuonAlignmentCo... INFO Size of /MUONALIGN/TGC/SIDEA CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEA' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/TGC/SIDEA input is, ALines: {[0,0,t:0] - [t:4294967294.854775807]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/TGC/SIDEA have IoV = 82360 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/TGC/SIDEA> loaded +MuonAlignmentCo... INFO Load alignment parameters from DB folder </MUONALIGN/TGC/SIDEC> +MuonAlignmentCo... INFO No BLines decoding will be attempted for folder named /MUONALIGN/TGC/SIDEC +MuonAlignmentCo... INFO Size of /MUONALIGN/TGC/SIDEC CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MUONALIGN/TGC/SIDEC' ) readCdo->size()= 1 +MuonAlignmentCo... INFO Range of /MUONALIGN/TGC/SIDEC input is, ALines: {[0,0,t:0] - [t:4294967294.854775807]} +MuonAlignmentCo... INFO Data read from folder /MUONALIGN/TGC/SIDEC have IoV = 82359 +MuonAlignmentCo... INFO A- and B-Lines parameters from DB folder </MUONALIGN/TGC/SIDEC> loaded +MGM::MuonDetect... INFO temporary A-line container with size = 2694 +MGM::MuonDetect... INFO # of A-lines read from the ALineMapContainer in StoreGate is 2694 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 2694 +MGM::MuonDetect... INFO # of entries in the A-lines historical container is 2814 +MuonAlignmentCo... INFO recorded new ALineMapContainer with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +MGM::MuonDetect... INFO In updateDeformations() +MGM::MuonDetect... INFO temporary B-line container with size = 1206 +MGM::MuonDetect... INFO # of B-lines read from the ALineMapContainer in StoreGate is 1206 +MGM::MuonDetect... INFO # of deform-Transforms updated according to B-lines is 1174 +MGM::MuonDetect... INFO # of entries in the B-lines historical container is 1174 +MuonAlignmentCo... INFO recorded new BLineMapContainer with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +MuonGeoModel INFO MuonDetectorFactory - constructor MuonSystem OuterRadius 13000 Length 22030 +MuonDetectorCon... INFO create MuonDetectorTool - package version = MuonGeoModel-00-00-00 +MuonDetectorCon... INFO (from GeoModelSvc) AtlasVersion = <ATLAS-R2-2016-01-00-01> MuonVersion = <> +MuonDetectorCon... INFO Keys for Muon Switches are (key) ATLAS-R2-2016-01-00-01 (node) ATLAS +MuonDetectorCon... INFO (from GeoModelSvc) in AtlasVersion = <ATLAS-R2-2016-01-00-01> default MuonVersion is <MuonSpectrometer-R.08.01> +MuonDetectorCon... INFO Properties have been set as follows: +MuonDetectorCon... INFO LayoutName R +MuonDetectorCon... INFO IncludeCutouts 0 +MuonDetectorCon... INFO IncludeCutoutsBog 0 +MuonDetectorCon... INFO IncludeCtbBis 0 +MuonDetectorCon... INFO ControlAlines 111111 +MuonDetectorCon... INFO MinimalGeoFlag 0 +MuonDetectorCon... INFO EnableCscIntAlignment 1 +MuonDetectorCon... INFO EnableCscIntAlignmentFromGM 0 +MuonDetectorCon... INFO ControlCscIntAlines 111111 +MuonDetectorCon... INFO EnableMdtDeformations 1 +MuonDetectorCon... INFO EnableMdtAsBuiltParameters 1 +MuGM:MuonFactory INFO MuonLayout set to <R.08.01> = Development version for DC3 - infrastructures +MuGM:MuonFactory INFO BOG cutouts are activated 1 , all other cutouts are disabled 1 +MuGM:MuonFactory INFO Manager created for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuonGeoModel.MYSQL INFO GeometryVersion set to <R.08.01> +MuGM:MuonFactory INFO Mysql helper class created here for geometry version R.08.01 from DB MuonVersion <MuonSpectrometer-R.08.01> +MuGM:MuonFactory INFO MDTIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO RPCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO TGCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO CSCIDHELPER retrieved from DetStore +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 ************************ +MuGM:MuonFactory INFO *** Start building the Muon Geometry Tree ********************** +MuGM:RDBReadAtlas INFO Start retriving dbObjects with tag = <ATLAS-R2-2016-01-00-01> node <ATLAS> +RDBAccessSvc WARNING Could not get the tag for XtomoData node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO After getQuery XtomoData +In DblQ00Xtomo(data) +No XtomoData table in the MuonDD Database +MuGM:RDBReadAtlas INFO After new DblQ00Xtomo +MuGM:RDBReadAtlas INFO After m_dhxtomo.data() +MuGM:RDBReadAtlas INFO No Ascii aszt input found: looking for A-lines in ORACLE +MuGM:RDBReadAtlas INFO ASZT table found in Oracle +MuGM:RDBReadAtlas INFO ASZT size is 32 +MuGM:RDBReadAtlas INFO No Ascii iacsc input found: looking for A-lines in ORACLE +RDBAccessSvc WARNING Could not get the tag for ISZT node. Returning 0 pointer to IRDBQuery +MuGM:RDBReadAtlas INFO No ISZT table in Oracle +MuGM:RDBReadAtlas INFO Access granted for all dbObjects needed by muon detectors +MuonGeoModel.MYSQL INFO LayoutName (from DBAM) set to <R.08> -- relevant for CTB2004 +MuGM:ProcStations INFO Processing Stations and Components +MuGM:ProcStations INFO Processing Stations and Components DONE +MuGM:ProcTechnol.s INFO nMDT 26 nCSC 4 nTGC 44 nRPC 50 +MuGM:ProcTechnol.s INFO nDED 4 nSUP 8 nSPA 4 +MuGM:ProcTechnol.s INFO nCHV 14 nCRO 14 nCMI 12 nLBI 12 +MuGM:ProcPosition INFO *** N. of stations positioned in the setup 234 +MuGM:ProcPosition INFO *** N. of stations described in mysql 234 +MuGM:ProcPosition INFO *** N. of types 32 size of jtypvec 32 +MuGM:ProcPosition INFO *** : 234 kinds of stations (type*sub_type) +MuGM:ProcPosition INFO *** : 1758 physical stations in space - according to the MuonDD DataBase +MuGM:ProcCutouts INFO Processing Cutouts for geometry layout R.08 +MuGM:ProcCutouts INFO Processing Cutouts DONE +MuGM:RDBReadAtlas INFO ProcessTGCreadout - version 7 wirespacing 1.8 +MuGM:RDBReadAtlas INFO Intermediate Objects built from primary numbers +MuGM:MuonFactory INFO theMaterialManager retrieven successfully from the DetStore +MuGM:MuonFactory INFO MuonSystem description from OracleTag=<ATLAS-R2-2016-01-00-01> and node=<ATLAS> +MuGM:MuonFactory INFO TreeTop added to the Manager +MuGM:MuonFactory INFO Muon Layout R.08.01 +MuGM:MuonFactory INFO Fine Clash Fixing disabled: (should be ON/OFF for Simulation/Reconstruction) +MuGM:MuonFactory INFO **************** MuonDetectorFactory001 **************************** +MuGM:MuonFactory INFO *** The Muon Chamber Geometry Tree is built with +MuGM:MuonFactory INFO *** 1758 child volumes +MuGM:MuonFactory INFO *** 1839 independent elements and +MuGM:MuonFactory INFO *** 11473 elements cloned or shared +MuGM:MuonFactory INFO *** 234 kinds of stations +MuGM:MuonFactory INFO *** 1758 stations with alignable transforms +MuGM:MuonFactory INFO *** 148 stations are described as Assemblies +MuGM:MuonFactory INFO *** 1758 MuonStations +MuGM:MuonFactory INFO *** 2324 MDT Readout Elements 1186 MDT Detector Elements +MuGM:MuonFactory INFO *** 32 CSC Readout Elements 32 CSC Detector Elements +MuGM:MuonFactory INFO *** 1122 RPC Readout Elements 600 RPC Detector Elements +MuGM:MuonFactory INFO *** 1578 TGC Readout Elements 1578 TGC Detector Elements +MuGM:MuonFactory INFO ******************************************************************** +MuGM:MuonFactory INFO *** Inert Material built according to DB switches and config. ****** +MuGM:MuonFactory INFO *** The Muon Geometry Tree has 1758 child vol.s in total ******** +MuGM:MuonFactory INFO ******************************************************************** + +MGM::MuonDetect... INFO Init A/B Line Containers - done - size is respectively 1758/0 +MGM::MuonDetect... INFO Init of CSC I-Lines will be done via Conditions DB +MGM::MuonDetect... INFO Init I-Line Container - done - size is respectively 128 +MGM::MuonDetect... INFO I-Line for CSC wire layers loaded (Csc Internal Alignment) +MGM::MuonDetect... INFO According to configuration they WILL be used +MGM::MuonDetect... INFO Filling cache +MGM::MuonDetect... INFO temporary CSC I-line container with size = 128 +MGM::MuonDetect... INFO # of CSC I-lines read from the ILineMapContainer in StoreGate is 128 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 128 +MGM::MuonDetect... INFO # of entries in the CSC I-lines historical container is 128 +MGM::MuonDetect... INFO temporary As-Built container with size = 628 +MGM::MuonDetect... INFO # of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is 628 +MGM::MuonDetect... INFO # of deltaTransforms updated according to As-Built is 628 +MGM::MuonDetect... INFO # of entries in the MdtAsBuilt historical container is 628 +MGM::MuonDetect... INFO temporary A-line container with size = 2694 +MGM::MuonDetect... INFO # of A-lines read from the ALineMapContainer in StoreGate is 2694 +MGM::MuonDetect... INFO # of deltaTransforms updated according to A-lines is 2694 +MGM::MuonDetect... INFO # of entries in the A-lines historical container is 2814 +MGM::MuonDetect... INFO In updateDeformations() +MGM::MuonDetect... INFO temporary B-line container with size = 1206 +MGM::MuonDetect... INFO # of B-lines read from the ALineMapContainer in StoreGate is 1206 +MGM::MuonDetect... INFO # of deform-Transforms updated according to B-lines is 1174 +MGM::MuonDetect... INFO # of entries in the B-lines historical container is 1174 +MuonDetectorCon... INFO recorded new MuonDetectorManager with range {[0,0,t:1497892260,l:0] - [t:1497898380]} into Conditions Store +RpcCablingCondAlg INFO maps configuration have been parsed +RpcCablingCondAlg INFO recorded new RpcCablingCondData with range {[315000,l:0] - [999999,l:0]} +MuonMDT_CablingAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MEZZANINE_SCHEMA' ) readCdoMez->size()= 24 +MuonMDT_CablingAlg INFO Range of input is {[0,l:0] - [INVALID]} +MuonMDT_CablingAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/CABLING/MAP_SCHEMA' ) readCdoMap->size()= 2312 +MuonMDT_CablingAlg INFO Range of input is {[327264,l:4294640031] - [327265,l:4294640030]} +MuonMDT_CablingAlg INFO recorded new MuonMDT_CablingMap with range {[327264,t:0,l:4294640031] - [327265,l:4294640030]} into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:1497895317.371000000] - [t:1497898549.609000000]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7729.99 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20399.9 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20397.7 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7729.99 toroid 20399.9 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7729.99,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20399.9,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 +MdtCalibDbAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/RTBLOB' ) readCdoRt->size()= 1186 +MdtCalibDbAlg INFO Range of input is {[327265,l:0] - [327342,l:0]} +MdtCalibDbAlg INFO MdtCalibDbAlg::loadRt Read 1188RTs from COOL +MdtCalibDbAlg INFO recorded new MdtRtRelationCollection with range {[327265,l:0] - [327342,l:0]} into Conditions Store +MdtCalibDbAlg INFO recorded new MdtCorFuncSetCollection with range {[327265,l:0] - [327342,l:0]} into Conditions Store +MdtCalibDbAlg INFO Ignoring nonexistant station in calibration DB: MuonSpectrometer BML -6 stationPhi 7 MDT multiLayer 1 tubeLayer 1 tube 1 +MdtCalibDbAlg INFO Ignoring nonexistant station in calibration DB: MuonSpectrometer BML stationEta 6 stationPhi 7 MDT multiLayer 1 tubeLayer 1 tube 1 +MdtCalibDbAlg INFO Size of CondAttrListCollection ( 'CondAttrListCollection' , 'ConditionStore+/MDT/T0BLOB' ) readCdoTube->size()= 1186 +MdtCalibDbAlg INFO Range of input is {[319000,l:0] - [INVALID]} +MdtCalibDbAlg INFO recorded new MdtTubeCalibContainerCollection with range {[319000,l:0] - [INVALID]} into Conditions Store +CscCondDbData INFO Maximum Layer hash is 255 +AthenaEventLoopMgr INFO ===>>> done processing event #186525031, run #327265 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186524665, run #327265 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186524665, run #327265 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186542447, run #327265 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186542447, run #327265 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186543405, run #327265 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186543405, run #327265 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186548387, run #327265 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186548387, run #327265 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186515186, run #327265 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186515186, run #327265 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186556019, run #327265 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186556019, run #327265 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186542866, run #327265 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186542866, run #327265 8 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186537901, run #327265 8 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186537901, run #327265 9 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186517811, run #327265 9 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186517811, run #327265 10 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186534221, run #327265 10 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186534221, run #327265 11 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186540986, run #327265 11 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186540986, run #327265 12 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186535104, run #327265 12 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186535104, run #327265 13 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186539903, run #327265 13 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186539903, run #327265 14 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186552713, run #327265 14 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186552713, run #327265 15 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186524730, run #327265 15 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186524730, run #327265 16 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186547632, run #327265 16 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186547632, run #327265 17 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186555621, run #327265 17 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186555621, run #327265 18 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186568452, run #327265 18 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186568452, run #327265 19 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #186580451, run #327265 19 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #186580451, run #327265 20 events processed so far <<<=== +Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] +ApplicationMgr INFO Application Manager Stopped successfully +IncidentProcAlg1 INFO Finalize +CondInputLoader INFO Finalizing CondInputLoader... +AtlasFieldMapCo... INFO in finalize +AtlasFieldCache... INFO in finalize +IncidentProcAlg2 INFO Finalize +IOVDbFolder INFO Folder /CSC/FTHOLD (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/322656 (( 0.11 ))s +IOVDbFolder INFO Folder /CSC/NOISE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/350062 (( 0.09 ))s +IOVDbFolder INFO Folder /CSC/PED (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/411187 (( 0.08 ))s +IOVDbFolder INFO Folder /CSC/PSLOPE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/353376 (( 0.10 ))s +IOVDbFolder INFO Folder /CSC/RMS (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/411395 (( 0.10 ))s +IOVDbFolder INFO Folder /CSC/STAT (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/230496 (( 0.06 ))s +IOVDbFolder INFO Folder /CSC/T0BASE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/314380 (( 0.03 ))s +IOVDbFolder INFO Folder /CSC/T0PHASE (AttrListColl) db-read 1/1 objs/chan/bytes 32/32/3136 (( 0.02 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 0.02 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.06 ))s +IOVDbFolder INFO Folder /MDT/CABLING/MAP_SCHEMA (AttrListColl) db-read 1/1 objs/chan/bytes 2312/2437/216520 (( 0.28 ))s +IOVDbFolder INFO Folder /MDT/CABLING/MEZZANINE_SCHEMA (AttrListColl) db-read 1/1 objs/chan/bytes 24/24/288 (( 0.05 ))s +IOVDbFolder INFO Folder /MDT/RTBLOB (AttrListColl) db-read 1/1 objs/chan/bytes 2372/1186/2251209 (( 0.30 ))s +IOVDbFolder INFO Folder /MDT/T0BLOB (AttrListColl) db-read 1/1 objs/chan/bytes 1186/1186/1374284 (( 0.20 ))s +IOVDbFolder INFO Folder /MUONALIGN/CSC/ILINES (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/10814 (( 0.04 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ASBUILTPARAMS (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/128992 (( 0.05 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/BARREL (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/140293 (( 0.09 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ENDCAP/SIDEA (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/65494 (( 0.06 ))s +IOVDbFolder INFO Folder /MUONALIGN/MDT/ENDCAP/SIDEC (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/65497 (( 0.08 ))s +IOVDbFolder INFO Folder /MUONALIGN/TGC/SIDEA (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/165643 (( 0.07 ))s +IOVDbFolder INFO Folder /MUONALIGN/TGC/SIDEC (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/165643 (( 0.04 ))s +IOVDbFolder INFO Folder /RPC/CABLING/MAP_SCHEMA (AttrListColl) db-read 1/2 objs/chan/bytes 1/1/222235 (( 0.22 ))s +IOVDbFolder INFO Folder /RPC/CABLING/MAP_SCHEMA_CORR (AttrListColl) db-read 1/2 objs/chan/bytes 1/1/29402 (( 0.07 ))s +IOVDbFolder INFO Folder /RPC/DCS/DeadRopanels (AttrListColl) db-read 1/1 objs/chan/bytes 32/48/6200 (( 0.01 ))s +IOVDbFolder INFO Folder /RPC/DCS/OffRopanels (AttrListColl) db-read 1/1 objs/chan/bytes 4/48/16 (( 0.00 ))s +IOVDbFolder INFO Folder /RPC/DQMF/ELEMENT_STATUS (AttrListColl) db-read 1/1 objs/chan/bytes 8320/8320/6180700 (( 0.37 ))s +IOVDbFolder INFO Folder /RPC/TRIGGER/CM_THR_ETA (AttrListColl) db-read 1/2 objs/chan/bytes 1613/1613/7562651 (( 0.51 ))s +IOVDbFolder INFO Folder /RPC/TRIGGER/CM_THR_PHI (AttrListColl) db-read 1/2 objs/chan/bytes 1612/1612/8096306 (( 0.17 ))s +IOVDbFolder INFO Folder /TGC/CABLING/MAP_SCHEMA (AttrListColl) db-read 0/0 objs/chan/bytes 0/1/0 (( 0.00 ))s +IOVDbSvc INFO bytes in (( 3.28 ))s +IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=CONDBR2 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s +IOVDbSvc INFO Connection COOLOFL_MUONALIGN/CONDBR2 : nConnect: 2 nFolders: 7 ReadTime: (( 0.43 ))s +IOVDbSvc INFO Connection COOLONL_RPC/CONDBR2 : nConnect: 2 nFolders: 4 ReadTime: (( 0.96 ))s +IOVDbSvc INFO Connection COOLONL_TGC/CONDBR2 : nConnect: 1 nFolders: 1 ReadTime: (( 0.00 ))s +IOVDbSvc INFO Connection COOLONL_MDT/CONDBR2 : nConnect: 2 nFolders: 2 ReadTime: (( 0.33 ))s +IOVDbSvc INFO Connection COOLONL_GLOBAL/CONDBR2 : nConnect: 2 nFolders: 1 ReadTime: (( 0.06 ))s +IOVDbSvc INFO Connection COOLOFL_DCS/CONDBR2 : nConnect: 2 nFolders: 3 ReadTime: (( 0.03 ))s +IOVDbSvc INFO Connection COOLOFL_RPC/CONDBR2 : nConnect: 2 nFolders: 1 ReadTime: (( 0.37 ))s +IOVDbSvc INFO Connection COOLOFL_MDT/CONDBR2 : nConnect: 2 nFolders: 2 ReadTime: (( 0.50 ))s +IOVDbSvc INFO Connection COOLOFL_CSC/CONDBR2 : nConnect: 2 nFolders: 8 ReadTime: (( 0.59 ))s +ToolSvc INFO Removing all tools created by ToolSvc +TgcRdoToTgcPrep... INFO finalize(): input RDOs->output PRDs [Hit: 6807->6807, Tracklet: 28->28, TrackletEIFI: 692->692, HiPt: 4031->4031, SL: 3->3] MdtRawDataProvi... INFO Fraction of fills that use the cache = 0 TgcRawDataProvi... INFO Fraction of fills that use the cache = 0 RpcROD_Decoder:... INFO ============ FINAL RPC DATA FORMAT STAT. =========== @@ -47,3 +1068,15 @@ RpcROD_Decoder:... INFO SL Footer Errors.............0 RpcROD_Decoder:... INFO RX Footer Errors.............0 RpcROD_Decoder:... INFO CRC8 check Failures..........0 RpcROD_Decoder:... INFO ==================================================== +ToolSvc.ByteStr... INFO in finalize() +ToolSvc.TGCCabl... INFO finalize +IdDictDetDescrCnv INFO in finalize +*****Chrono***** INFO **************************************************************************************************** +*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) +*****Chrono***** INFO **************************************************************************************************** +cObj_ALL INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 32 +ChronoStatSvc INFO Time User : Tot= 29 [s] #= 1 +*****Chrono***** INFO **************************************************************************************************** +ChronoStatSvc.f... INFO Service finalized successfully +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt index d0763d78764c9d7f03bc69fa368606c4d0e81084..a6ecb61e6508b94f22aef4370d9becf032fc4942 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt @@ -53,6 +53,7 @@ atlas_add_library( MuonReadoutGeometry if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/src/MdtReadoutElement.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/src/MuonStation.cxx PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" COMPILE_DEFINITIONS "FLATTEN" ) diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx index d72c2255ee041dac7080cfd57ee6a4471ef8d741..49671680b31a8854e49699fa3daec80a85db1f28 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx @@ -882,6 +882,14 @@ const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, } +#if defined(FLATTEN) && defined(__GNUC__) +// We compile this package with optimization, even in debug builds; otherwise, +// the heavy use of Eigen makes it too slow. However, from here we may call +// to out-of-line Eigen code that is linked from other DSOs; in that case, +// it would not be optimized. Avoid this by forcing all Eigen code +// to be inlined here if possible. +__attribute__ ((flatten)) +#endif Amg::Transform3D MdtReadoutElement::deformedTransform (int multilayer, int tubelayer, int tube) const { @@ -1181,6 +1189,14 @@ MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos, // Function to apply AsBuilt parameter correction to wire center and end position // For definitions of AsBuilt parameters see Florian Bauer's talk: // http://atlas-muon-align.web.cern.ch/atlas-muon-align/endplug/asbuilt.pdf +#if defined(FLATTEN) && defined(__GNUC__) +// We compile this package with optimization, even in debug builds; otherwise, +// the heavy use of Eigen makes it too slow. However, from here we may call +// to out-of-line Eigen code that is linked from other DSOs; in that case, +// it would not be optimized. Avoid this by forcing all Eigen code +// to be inlined here if possible. +__attribute__ ((flatten)) +#endif void MdtReadoutElement::wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, int multilayer, int tubelayer, int tube) const { const MdtAsBuiltPar* params = parentMuonStation()->getMdtAsBuiltParams(); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx index c9151534357b9a89513562a758ca8fa7cfb3106d..58d1431c8e008b1cd1fba9efa6e6a882a38676f8 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx @@ -526,6 +526,14 @@ void MuonStation::fillBLineCache() } +#if defined(FLATTEN) && defined(__GNUC__) +// We compile this package with optimization, even in debug builds; otherwise, +// the heavy use of Eigen makes it too slow. However, from here we may call +// to out-of-line Eigen code that is linked from other DSOs; in that case, +// it would not be optimized. Avoid this by forcing all Eigen code +// to be inlined here if possible. +__attribute__ ((flatten)) +#endif double MuonStation::RsizeMdtStation() const { if (getStationName().substr(0,1)=="T" || getStationName().substr(0,1)=="C") return 0.; // TGC and CSC stations diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h index bf1250237555e600a866a90f7ef860c364955488..a4ddbadd6c5a8704229a1004239ec6258573fe90 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h @@ -1,28 +1,25 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H #define MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H +#include "PileUpTools/PileUpToolBase.h" + +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "AthenaKernel/IAthRNGSvc.h" #include "CLHEP/Random/RandomEngine.h" -//#include "AthenaBaseComps/AthAlgTool.h" #include "CSC_Digitization/CSC_Digitizer.h" #include "MuonDigitContainer/CscDigitContainer.h" #include "MuonSimEvent/CSCSimHit.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "HitManagement/TimedHitCollection.h" #include "CscCalibTools/ICscCalibTool.h" - #include "MuonSimEvent/CSCSimHitCollection.h" #include "MuonSimData/CscSimDataCollection.h" - -#include "PileUpTools/PileUpToolBase.h" - #include "PileUpTools/PileUpMergeSvc.h" // Author: Ketevi A. Assamagan @@ -90,14 +87,11 @@ private: std::string m_inputObjectName{""}; SG::WriteHandleKey<CscSimDataCollection> m_cscSimDataCollectionWriteHandleKey{this,"CSCSimDataCollectionOutputName","CSC_SDO","WriteHandleKey for Output CscSimDataCollection"}; SG::WriteHandleKey<CscDigitContainer> m_cscDigitContainerKey{this,"OutputObjectName","CSC_DIGITS","CSC digit container object"}; - //SG::WriteHandle<CscDigitContainer> m_container; - //SG::WriteHandle<CscSimDataCollection> m_CSCSimDataCollectionWriteHandle; - const MuonGM::MuonDetectorManager * m_geoMgr{nullptr}; - CSC_Digitizer * m_cscDigitizer{nullptr}; + const MuonGM::MuonDetectorManager* m_geoMgr{nullptr}; + CSC_Digitizer* m_cscDigitizer{nullptr}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; Gaudi::Property<double> m_pedestal{this, "pedestal",0.0, ""}; Gaudi::Property<bool> m_maskBadChannel{this, "maskBadChannels", true, ""}; @@ -120,7 +114,6 @@ private: ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""}; // Pile up service ServiceHandle <IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; // Random number service - }; #endif // MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx index 2504cfe9c99f1b3c7e94c06707f7d00a2f981ff1..a1ae38121639d613c2dddf2aa2aa53b81dbdf9fe 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx @@ -2,36 +2,27 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Author: Ketevi A. Assamagan -// BNL, October 27 2003 -// Digitization algorithm for the CSC hits #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "AtlasHepMC/GenParticle.h" #include "GeneratorObjects/HepMcParticleLink.h" - #include "StoreGate/StoreGate.h" #include "StoreGate/StoreGateSvc.h" #include "StoreGate/DataHandle.h" - #include "CSC_Digitization/CscDigitizationTool.h" - #include "AthenaKernel/RNGWrapper.h" #include "CLHEP/Random/RandFlat.h" using namespace MuonGM; -CscDigitizationTool::CscDigitizationTool(const std::string& type,const std::string& name,const IInterface* pIID) - : PileUpToolBase(type, name, pIID) - { - } - +CscDigitizationTool::CscDigitizationTool(const std::string& type,const std::string& name,const IInterface* pIID) : + PileUpToolBase(type, name, pIID) { +} CscDigitizationTool::~CscDigitizationTool() { delete m_cscDigitizer; } - StatusCode CscDigitizationTool::initialize() { ATH_MSG_DEBUG ( "Initialized Properties :" ); @@ -66,7 +57,7 @@ StatusCode CscDigitizationTool::initialize() { /** CSC calibratin tool for the Condtiions Data base access */ ATH_CHECK(m_pcalib.retrieve()); - ICscCalibTool * cscCalibTool = &*(m_pcalib); + ICscCalibTool* cscCalibTool = &*(m_pcalib); //initialize the CSC digitizer CscHitIdHelper * cscHitHelper = CscHitIdHelper::GetHelper(); @@ -81,7 +72,7 @@ StatusCode CscDigitizationTool::initialize() { ATH_CHECK(m_cscDigitizer->initialize()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); m_cscDigitizer->setWindow(m_timeWindowLowerOffset, m_timeWindowUpperOffset); @@ -100,14 +91,6 @@ StatusCode CscDigitizationTool::initialize() { ATH_CHECK(m_cscDigitContainerKey.initialize()); ATH_CHECK(m_cscSimDataCollectionWriteHandleKey.initialize()); - ATH_MSG_DEBUG("WP Current MSG Level FATAL ? " << msgLvl(MSG::FATAL) ); - ATH_MSG_DEBUG("WP Current MSG Level ERROR ? " << msgLvl(MSG::ERROR) ); - ATH_MSG_DEBUG("WP Current MSG Level WARNING ? " << msgLvl(MSG::WARNING) ); - ATH_MSG_DEBUG("WP Current MSG Level INFO ? " << msgLvl(MSG::INFO) ); - ATH_MSG_DEBUG("WP Current MSG Level DEBUG ? " << msgLvl(MSG::DEBUG) ); - ATH_MSG_DEBUG("WP Current MSG Level VERBOSE ? " << msgLvl(MSG::VERBOSE) ); - - return StatusCode::SUCCESS; } @@ -130,7 +113,7 @@ StatusCode CscDigitizationTool::processAllSubEvents(const EventContext& ctx) { //create and record CscDigitContainer in SG SG::WriteHandle<CscDigitContainer> cscDigits(m_cscDigitContainerKey, ctx); - ATH_CHECK(cscDigits.record(std::make_unique<CscDigitContainer>(m_muonIdHelperTool->cscIdHelper().module_hash_max()))); + ATH_CHECK(cscDigits.record(std::make_unique<CscDigitContainer>(m_idHelperSvc->cscIdHelper().module_hash_max()))); ATH_MSG_DEBUG("recorded CscDigitContainer with name "<<cscDigits.key()); if (m_isPileUp) return StatusCode::SUCCESS; @@ -140,7 +123,6 @@ StatusCode CscDigitizationTool::processAllSubEvents(const EventContext& ctx) { ATH_CHECK(cscSimData.record(std::make_unique<CscSimDataCollection>())); //merging of the hit collection in getNextEvent method - if (0 == m_thpcCSC ) { StatusCode sc = getNextEvent(ctx); if (StatusCode::FAILURE == sc) { @@ -270,8 +252,8 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, CscDigitCollection * collection = 0; - IdContext context = m_muonIdHelperTool->cscIdHelper().channel_context(); - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext context = m_idHelperSvc->cscIdHelper().channel_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); Identifier prevId; @@ -281,14 +263,14 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, for (; cscMap != cscMapEnd; ++cscMap) { Identifier digitId; IdentifierHash hashId = (*cscMap).first; - if (m_muonIdHelperTool->cscIdHelper().get_id( hashId, digitId, &context ) ) { + if (m_idHelperSvc->cscIdHelper().get_id( hashId, digitId, &context ) ) { ATH_MSG_ERROR ( "cannot get CSC channel identifier from hash " << hashId ); return StatusCode::FAILURE; } - Identifier elementId = m_muonIdHelperTool->cscIdHelper().parentID(digitId); + Identifier elementId = m_idHelperSvc->cscIdHelper().parentID(digitId); IdentifierHash coll_hash; - if (m_muonIdHelperTool->cscIdHelper().get_hash(elementId, coll_hash, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(elementId, coll_hash, &cscContext)) { ATH_MSG_ERROR ( "Unable to get CSC hash id from CSC Digit collection " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -300,19 +282,11 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, // get the charge double stripCharge = 0.0; double driftTime = 0.0; - //if (stripCharge < m_noiseLevel) continue; - - const std::vector<float> samples = (*cscMap).second; - // csc_newmap::iterator ii= data_SampleMapOddPhase.find(hashId); - // const std::vector<float> samplesOddPhase = (*ii).second; - - // if (msgLvl(MSG::DEBUG)) { unsigned int samplingPhase =0; double samplingTime = m_pcalib->getSamplingTime(); m_pcalib->findCharge(samplingTime, samplingPhase, samples, stripCharge, driftTime); - // } driftTime += m_pcalib->getLatency(); /** mask this readout channel if it is a dead channel or a hot channel */ @@ -321,13 +295,13 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, driftTime = 2*m_timeWindowUpperOffset; } - int zsec = m_muonIdHelperTool->cscIdHelper().stationEta(digitId); - int phisec = m_muonIdHelperTool->cscIdHelper().stationPhi(digitId); - int istation = m_muonIdHelperTool->cscIdHelper().stationName(digitId) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(digitId); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(digitId); + int istation = m_idHelperSvc->cscIdHelper().stationName(digitId) - 49; - int wlay = m_muonIdHelperTool->cscIdHelper().wireLayer(digitId); - int measphi = m_muonIdHelperTool->cscIdHelper().measuresPhi(digitId); - int istrip = m_muonIdHelperTool->cscIdHelper().strip(digitId); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(digitId); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(digitId); + int istrip = m_idHelperSvc->cscIdHelper().strip(digitId); int sector = zsec*(2*phisec-istation+1); @@ -338,24 +312,16 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, } // fill the digit collections in StoreGate - // CscDigit * newDigit = new CscDigit(digitId, int(stripCharge+1) ); // Now, we pass driftTime as well as stripCharge. // SimHIT time should be added to distinguish prompt muons from secondary.... 11/19/2009 WP - - // CscDigit * newDigit = new CscDigit(digitId, samples); - // CscDigit * newDigitOddPhase = new CscDigit(digitId, samplesOddPhase); - ATH_MSG_DEBUG ( "NEWDigit sec:measphi:wlay:istr:chg:t(w/latency) " - << m_muonIdHelperTool->cscIdHelper().show_to_string(digitId,&context) + << m_idHelperSvc->cscIdHelper().show_to_string(digitId,&context) << " hash:eleId = " << hashId << " " << elementId << " " << prevId << " " << sector << " " << measphi << " " << wlay << " " << istrip << " " << int(stripCharge+1) << " " << float(driftTime) << " phase=" << phaseToSet << " samps: " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] - // << " sampsOddPh: " << samplesOddPhase[0] << " " << samplesOddPhase[1] << " " - // << samplesOddPhase[2] << " " << samplesOddPhase[3] - // << " " << (newDigit->sampleCharges()).size() ); if (prevId != elementId) { @@ -365,23 +331,17 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, if (phaseToSet) newCollection->set_samplingPhase(); - // const std::vector<float> samplesToPut - // = (phaseToSet) ? samplesOddPhase : samples ; - CscDigit * newDigit = new CscDigit(digitId, samples); newCollection->push_back(newDigit); if ( cscDigits->addCollection(newCollection, coll_hash).isFailure() ) - ATH_MSG_ERROR ( "Couldn't record CscDigitCollection with key=" << coll_hash - << " in StoreGate!" ); + ATH_MSG_ERROR( "Couldn't record CscDigitCollection with key=" << coll_hash << " in StoreGate!"); collection = newCollection; } else { CscDigitCollection * existingCollection = const_cast<CscDigitCollection*>( it_coll ); if (phaseToSet) existingCollection->set_samplingPhase(); - // const std::vector<float> samplesToPut - // = (existingCollection->samplingPhase()) ? samplesOddPhase : samples ; CscDigit * newDigit = new CscDigit(digitId, samples); @@ -397,8 +357,6 @@ FillCollectionWithNewDigitEDM(csc_newmap& data_SampleMap, } if (phaseToSet) collection->set_samplingPhase(); - // const std::vector<float> samplesToPut - // = (collection->samplingPhase()) ? samplesOddPhase : samples ; CscDigit * newDigit = new CscDigit(digitId, samples); @@ -413,8 +371,8 @@ StatusCode CscDigitizationTool:: FillCollectionWithOldDigitEDM(csc_map& data_map, std::map<IdentifierHash,deposits>& myDeposits,CscDigitContainer* cscDigits,CscSimDataCollection* cscSimData) { CscDigitCollection * collection = 0; - IdContext context = m_muonIdHelperTool->cscIdHelper().channel_context(); - IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + IdContext context = m_idHelperSvc->cscIdHelper().channel_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); Identifier prevId; csc_map::const_iterator cscMap = data_map.begin(); @@ -422,39 +380,33 @@ FillCollectionWithOldDigitEDM(csc_map& data_map, std::map<IdentifierHash,deposit for (; cscMap != cscMapEnd; ++cscMap) { Identifier digitId; IdentifierHash hashId = (*cscMap).first; - if (m_muonIdHelperTool->cscIdHelper().get_id( hashId, digitId, &context ) ) { + if (m_idHelperSvc->cscIdHelper().get_id( hashId, digitId, &context ) ) { ATH_MSG_ERROR ( "cannot get CSC channel identifier from hash " << hashId ); return StatusCode::FAILURE; } // get the charge double stripCharge = 0.0; - //double gaus = CLHEP::RandGaussZiggurat::shoot(rndmEngine,0.0,1.0); - - //if (stripCharge < m_noiseLevel) continue; stripCharge = ((*cscMap).second).second + m_pedestal; // + m_noiseLevel*gaus; double driftTime =((*cscMap).second).first; // SimHIT time is added yet 12/03/2009 - // stripCharge = ((*cscMap).second).stripCharge + m_pedestal; // + m_noiseLevel*gaus; v2 - // double driftTime =((*cscMap).second).driftTime0; // for version2 v2 - /** mask this readout channel if it is a dead channel or a hot channel */ if ( !m_pcalib->isGood( hashId ) && m_maskBadChannel ) { stripCharge = 0.0; driftTime = 2*m_timeWindowUpperOffset; } - ATH_MSG_VERBOSE ( "CSC Digit Id = " << m_muonIdHelperTool->cscIdHelper().show_to_string(digitId,&context) + ATH_MSG_VERBOSE ( "CSC Digit Id = " << m_idHelperSvc->cscIdHelper().show_to_string(digitId,&context) << " hash = " << hashId << " charge = " << int (stripCharge+1) ); - int zsec = m_muonIdHelperTool->cscIdHelper().stationEta(digitId); - int phisec = m_muonIdHelperTool->cscIdHelper().stationPhi(digitId); - int istation = m_muonIdHelperTool->cscIdHelper().stationName(digitId) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(digitId); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(digitId); + int istation = m_idHelperSvc->cscIdHelper().stationName(digitId) - 49; - int wlay = m_muonIdHelperTool->cscIdHelper().wireLayer(digitId); - int measphi = m_muonIdHelperTool->cscIdHelper().measuresPhi(digitId); - int istrip = m_muonIdHelperTool->cscIdHelper().strip(digitId); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(digitId); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(digitId); + int istrip = m_idHelperSvc->cscIdHelper().strip(digitId); int sector = zsec*(2*phisec-istation+1); @@ -465,11 +417,10 @@ FillCollectionWithOldDigitEDM(csc_map& data_map, std::map<IdentifierHash,deposit } // fill the digit collections in StoreGate - // CscDigit * newDigit = new CscDigit(digitId, int(stripCharge+1) ); // Now, we pass driftTime as well as stripCharge. // SimHIT time should be added to distinguish prompt muons from secondary.... 11/19/2009 WP CscDigit * newDigit = new CscDigit(digitId, int(stripCharge+1), float(driftTime) ); - Identifier elementId = m_muonIdHelperTool->cscIdHelper().parentID(digitId); + Identifier elementId = m_idHelperSvc->cscIdHelper().parentID(digitId); ATH_MSG_DEBUG ( "CSC Digit sector:measphi:wlay:istrip:charge " << sector << " " @@ -478,7 +429,7 @@ FillCollectionWithOldDigitEDM(csc_map& data_map, std::map<IdentifierHash,deposit IdentifierHash coll_hash; - if (m_muonIdHelperTool->cscIdHelper().get_hash(elementId, coll_hash, &cscContext)) { + if (m_idHelperSvc->cscIdHelper().get_hash(elementId, coll_hash, &cscContext)) { ATH_MSG_ERROR ( "Unable to get CSC hash id from CSC Digit collection " << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index() @@ -623,7 +574,7 @@ StatusCode CscDigitizationTool::mergeEvent(const EventContext& ctx) { //create and record CscDigitContainer in SG SG::WriteHandle<CscDigitContainer> cscDigits(m_cscDigitContainerKey, ctx); - ATH_CHECK(cscDigits.record(std::make_unique<CscDigitContainer>(m_muonIdHelperTool->cscIdHelper().module_hash_max()))); + ATH_CHECK(cscDigits.record(std::make_unique<CscDigitContainer>(m_idHelperSvc->cscIdHelper().module_hash_max()))); ATH_MSG_DEBUG("recorded CscDigitContainer with name "<<cscDigits.key()); // create and record the SDO container in StoreGate diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitizationTool.h b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitizationTool.h index 21374d43b74864d1e2995871b4f66215e3fa2a12..7f81668030166f963b476362b91069210c6d0932 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_DigitizationTool.h @@ -61,6 +61,7 @@ #include "xAODEventInfo/EventAuxInfo.h"// SubEventIterator #include "NSWCalibTools/INSWCalibSmearingTool.h" +#include "NSWCalibTools/INSWCalibTool.h" #include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MagFieldElements/AtlasFieldCache.h" @@ -178,14 +179,15 @@ class MM_DigitizationTool : virtual public IMuonDigitizationTool, public PileUpT // StripsResponse stuff... MM_StripsResponseSimulation *m_StripsResponseSimulation; + float m_qThreshold; - float m_transverseDiffusionSigma; - float m_longitudinalDiffusionSigma; float m_driftGapWidth; float m_driftVelocity; float m_crossTalk1; float m_crossTalk2; + float m_avalancheGain; + // ElectronicsResponse stuff... MM_ElectronicsResponseSimulation *m_ElectronicsResponseSimulation; float m_peakTime; // VMM setting @@ -231,6 +233,8 @@ class MM_DigitizationTool : virtual public IMuonDigitizationTool, public PileUpT bool m_doSmearing; ToolHandle<Muon::INSWCalibSmearingTool> m_smearingTool; + ToolHandle<Muon::INSWCalibTool> m_calibrationTool; + }; #endif // MM_DigitizationTool diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h index aacdb0d6f7be61e69b65cbc5398711205b464e6e..2163d38de5da6b96d52a064fdf64ae9dc1300aa5 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/MM_Digitization/MM_StripsResponseSimulation.h @@ -80,10 +80,18 @@ public : inline void setCrossTalk2 (float val) { m_crossTalk2 = val; }; inline void setDriftGapWidth (float val) {m_driftGapWidth = val;}; inline void setAvalancheGain(float val) {m_avalancheGain = val;} + inline void setInteractionDensityMean(float val) {m_interactionDensityMean = val;} + inline void setInteractionDensitySigma(float val) {m_interactionDensitySigma = val;} + inline void setLorentzAngleFunction(TF1* f) {m_lorentzAngleFunction = f;} float getQThreshold () const { return m_qThreshold; }; float getDriftGapWidth () const { return m_driftGapWidth; }; float getDriftVelocity () const { return m_driftVelocity; }; + float getInteractionDensityMean () const { return m_interactionDensityMean;} + float getInteractionDensitySigma () const { return m_interactionDensitySigma;} + float getLongitudinalDiffusionSigma () const { return m_longitudinalDiffusionSigma;} + float getTransversDiffusionSigma () const { return m_transverseDiffusionSigma;} + TF1* getLorentzAngleFunction () const { return m_lorentzAngleFunction;} std::vector <float> getTStripElectronicsAbThr() const { return m_tStripElectronicsAbThr;}; std::vector <float> getQStripElectronics() const { return m_qStripElectronics;}; diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx index 630bd3fc6e5a1c32f0eff1383dab087db7ee5956..f0cc707c63e0f7e53bdb9ee27be82cff146578b3 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx @@ -119,11 +119,10 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str // Strip Response m_StripsResponseSimulation(0), m_qThreshold(0), // Strips Charge Threshold - m_transverseDiffusionSigma(0), // Transverse Diffusion - m_longitudinalDiffusionSigma(0), // Longitudinal Diffusion - m_driftVelocity(0), // Drift Velocity m_crossTalk1(0), // Cross talk with nearest strip m_crossTalk2(0), // Cross talk with 2nd nearest strip + + m_avalancheGain(0), // Electronics Response m_ElectronicsResponseSimulation(0), @@ -154,7 +153,7 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str m_n_hitIncomingAngle(-99999999.), m_n_StrRespTrg_Time(-99999999.), m_n_hitIncomingAngleRads(-99999999.), - m_n_hitKineticEnergy(-99999999.), + m_n_hitKineticEnergy(-99999999.), m_n_hitDepositEnergy(-99999999.), m_exitcode(0), @@ -164,7 +163,8 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str m_globalHitTime(-99999999.), m_eventTime(-99999999.), m_doSmearing(false), - m_smearingTool("Muon::NSWCalibSmearingTool/MMCalibSmearingTool",this) + m_smearingTool("Muon::NSWCalibSmearingTool/MMCalibSmearingTool",this), + m_calibrationTool("Muon::NSWCalibTool/NSWCalibTool",this) { declareInterface<IMuonDigitizationTool>(this); @@ -194,13 +194,15 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str // Constants vars for the MM_StripsResponseSimulation class // qThreshold=2e, we accept a good strip if the charge is >=2e + + //Three gas mixture mode, Ar/CO2=93/7, Ar/CO2=80/20, Ar/CO2/Iso=93/5/2 + //each mode have different transverseDiffusionSigma/longitudinalDiffusionSigma/driftVelocity/avalancheGain/interactionDensityMean/interactionDensitySigma/lorentzAngle declareProperty("qThreshold", m_qThreshold = 0.001); // Charge Threshold - declareProperty("TransverseDiffusionSigma", m_transverseDiffusionSigma = 0.360/10.); // Diffusion Constants for electron propagation - declareProperty("LongitudinalDiffusionSigma", m_longitudinalDiffusionSigma = 0.190/10.); declareProperty("DriftGapWidth", m_driftGapWidth = 5.168); // Drift Gap Width of 5.04 mm + 0.128 mm (the amplification gap) - declareProperty("DriftVelocity", m_driftVelocity = 0.047); // Drift velocity in [mm/ns] declareProperty("crossTalk1", m_crossTalk1 = 0.1); // Strip Cross Talk with Nearest Neighbor declareProperty("crossTalk2", m_crossTalk2 = 0.03); // Strip Cross Talk with 2nd Nearest Neighbor + + declareProperty("AvalancheGain", m_avalancheGain = 8.0e3); //avalanche Gain for rach gas mixture declareProperty("vmmReadoutMode", m_vmmReadoutMode = "peak" ); // For readout (DAQ) path. Can be "peak" or "threshold" declareProperty("vmmARTMode", m_vmmARTMode = "threshold" ); // For ART (trigger) path. Can be "peak" or "threshold" @@ -214,6 +216,8 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str declareProperty("doSmearing", m_doSmearing=false); // set the usage or not of the smearing tool for realistic detector performance declareProperty("SmearingTool",m_smearingTool); + + declareProperty("CalibrationTool", m_calibrationTool); } @@ -223,23 +227,6 @@ MM_DigitizationTool::MM_DigitizationTool(const std::string& type, const std::str StatusCode MM_DigitizationTool::initialize() { ATH_MSG_DEBUG ("MM_DigitizationTool:: in initialize()") ; - ATH_MSG_DEBUG ( "Configuration MM_DigitizationTool " ); - ATH_MSG_DEBUG ( "RndmSvc " << m_rndmSvc ); - ATH_MSG_DEBUG ( "RndmEngine " << m_rndmEngineName ); - ATH_MSG_DEBUG ( "MCStore " << m_storeGateService ); - ATH_MSG_DEBUG ( "DigitizationTool " << m_digitTool ); - ATH_MSG_DEBUG ( "InputObjectName " << m_inputObjectName ); - ATH_MSG_DEBUG ( "OutputObjectName " << m_outputDigitCollectionKey.key()); - ATH_MSG_DEBUG ( "OutputSDOName " << m_outputSDO_CollectionKey.key()); - ATH_MSG_DEBUG ( "UseTimeWindow " << m_useTimeWindow ); - ATH_MSG_DEBUG ( "CheckSimHits " << m_checkMMSimHits ); - ATH_MSG_DEBUG ( "Threshold " << m_qThreshold ); - ATH_MSG_DEBUG ( "DiffusSigma " << m_transverseDiffusionSigma ); - ATH_MSG_DEBUG ( "LogitundinalDiffusSigma" << m_longitudinalDiffusionSigma ); - ATH_MSG_DEBUG ( "DriftVelocity " << m_driftVelocity ); - ATH_MSG_DEBUG ( "crossTalk1 " << m_crossTalk1 ); - ATH_MSG_DEBUG ( "crossTalk2 " << m_crossTalk2 ); - ATH_MSG_DEBUG ( "EnergyThreshold " << m_energyThreshold ); // Initialize transient event store ATH_CHECK(m_storeGateService.retrieve()); @@ -269,6 +256,7 @@ StatusCode MM_DigitizationTool::initialize() { return StatusCode::FAILURE; } + //initialize the output WriteHandleKeys if(m_outputDigitCollectionKey.key()=="") { ATH_MSG_FATAL("Property OutputObjectName not set !"); @@ -279,6 +267,7 @@ StatusCode MM_DigitizationTool::initialize() { ATH_MSG_DEBUG("Output Digits: '"<<m_outputDigitCollectionKey.key()<<"'"); ATH_CHECK(m_fieldCondObjInputKey.initialize()); + ATH_CHECK(m_calibrationTool.retrieve()); //simulation identifier helper m_muonHelper = MicromegasHitIdHelper::GetHelper(); @@ -324,12 +313,25 @@ StatusCode MM_DigitizationTool::initialize() { // StripsResponseSimulation Creation m_StripsResponseSimulation = new MM_StripsResponseSimulation(); m_StripsResponseSimulation->setQThreshold(m_qThreshold); - m_StripsResponseSimulation->setTransverseDiffusionSigma(m_transverseDiffusionSigma); - m_StripsResponseSimulation->setLongitudinalDiffusionSigma(m_longitudinalDiffusionSigma); m_StripsResponseSimulation->setDriftGapWidth(m_driftGapWidth); - m_StripsResponseSimulation->setDriftVelocity(m_driftVelocity); m_StripsResponseSimulation->setCrossTalk1(m_crossTalk1); m_StripsResponseSimulation->setCrossTalk2(m_crossTalk2); + + // get gas properties from calibration tool + float longDiff, transDiff, vDrift, interactionDensityMean, interactionDensitySigma; + TF1* lorentzAngleFunction; + + ATH_CHECK(m_calibrationTool->mmGasProperties(vDrift, longDiff, transDiff, interactionDensityMean, interactionDensitySigma, lorentzAngleFunction)); + + m_driftVelocity = vDrift; + + m_StripsResponseSimulation->setTransverseDiffusionSigma(transDiff); + m_StripsResponseSimulation->setLongitudinalDiffusionSigma(longDiff); + m_StripsResponseSimulation->setDriftVelocity(vDrift); + m_StripsResponseSimulation->setAvalancheGain(m_avalancheGain); + m_StripsResponseSimulation->setInteractionDensityMean(interactionDensityMean); + m_StripsResponseSimulation->setInteractionDensitySigma(interactionDensitySigma); + m_StripsResponseSimulation->setLorentzAngleFunction(lorentzAngleFunction); m_StripsResponseSimulation->initialize(); // ElectronicsResponseSimulation Creation @@ -369,6 +371,30 @@ StatusCode MM_DigitizationTool::initialize() { } + + ATH_MSG_DEBUG ( "Configuration MM_DigitizationTool " ); + ATH_MSG_DEBUG ( "RndmSvc " << m_rndmSvc ); + ATH_MSG_DEBUG ( "RndmEngine " << m_rndmEngineName ); + ATH_MSG_DEBUG ( "MCStore " << m_storeGateService ); + ATH_MSG_DEBUG ( "DigitizationTool " << m_digitTool ); + ATH_MSG_DEBUG ( "InputObjectName " << m_inputObjectName ); + ATH_MSG_DEBUG ( "OutputObjectName " << m_outputDigitCollectionKey.key()); + ATH_MSG_DEBUG ( "OutputSDOName " << m_outputSDO_CollectionKey.key()); + ATH_MSG_DEBUG ( "UseTimeWindow " << m_useTimeWindow ); + ATH_MSG_DEBUG ( "CheckSimHits " << m_checkMMSimHits ); + ATH_MSG_DEBUG ( "Threshold " << m_qThreshold ); + ATH_MSG_DEBUG ( "TransverseDiffusSigma " << m_StripsResponseSimulation->getTransversDiffusionSigma() ); + ATH_MSG_DEBUG ( "LogitundinalDiffusSigma" << m_StripsResponseSimulation->getLongitudinalDiffusionSigma() ); + ATH_MSG_DEBUG ( "Interaction density mean: " << m_StripsResponseSimulation->getInteractionDensityMean() ); + ATH_MSG_DEBUG ( "Interaction density sigma: " << m_StripsResponseSimulation->getInteractionDensitySigma() ); + ATH_MSG_DEBUG ( "DriftVelocity stripResponse: " << m_StripsResponseSimulation->getDriftVelocity() ); + ATH_MSG_DEBUG ( "LorentzAngleFunktion stripResponse: " << m_StripsResponseSimulation->getLorentzAngleFunction()->GetName() ); + ATH_MSG_DEBUG ( "DriftVelocity " << m_driftVelocity ); + ATH_MSG_DEBUG ( "crossTalk1 " << m_crossTalk1 ); + ATH_MSG_DEBUG ( "crossTalk2 " << m_crossTalk2 ); + ATH_MSG_DEBUG ( "EnergyThreshold " << m_energyThreshold ); + + return StatusCode::SUCCESS; } /*******************************************************************************/ @@ -633,7 +659,7 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) { // see what are the members of MMSimHit // convert sim id helper to offline id - MM_SimIdToOfflineId simToOffline(m_idHelperSvc->mmIdHelper()); + MM_SimIdToOfflineId simToOffline(&m_idHelperSvc->mmIdHelper()); //get the hit Identifier and info int simId=hit.MMId(); diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx index 381917cf66840c0347af091165abcaed030c23ec..1448f771682b47f68766f6b5167e9ba494513087 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_StripsResponseSimulation.cxx @@ -38,10 +38,10 @@ MM_StripsResponseSimulation::MM_StripsResponseSimulation(): m_driftVelocity(0), // 0.047 // Other variables - m_avalancheGain(8.0e3), + m_avalancheGain(0), m_maxPrimaryIons(300), - m_interactionDensityMean( 16.15 / 5. ), // 16.15 interactions per 5 mm traversed - m_interactionDensitySigma( 4.04 / 5. ), // Spread in this number. + m_interactionDensityMean(0), // 16.15 interactions per 5 mm traversed + m_interactionDensitySigma(0), // Spread in this number. // Function Pointers m_polyaFunction(0), @@ -107,10 +107,6 @@ void MM_StripsResponseSimulation::initFunctions() m_polyaFunction->SetParameter(1, m_avalancheGain ); // mean gain m_polyaFunction->SetParameter(2, 104.9); // constant - // Functional form fit to agree with Garfield simulations. Fit and parameters from G. Iakovidis - m_lorentzAngleFunction = new TF1("lorentzAngleFunction","[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x",0,2); - m_lorentzAngleFunction->SetParameters(0,58.87, -2.983, -10.62, 2.818); - m_longitudinalDiffusionFunction = new TF1("longdiff","gaus", -5., 5.); m_transverseDiffusionFunction = new TF1("transdiff", "1.*TMath::Exp(-TMath::Power(x,2.)/(2.*[0]*[0])) + 0.001*TMath::Exp(-TMath::Power(x,2)/(2.*[1]*[1]))", -1., 1.); diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx index c88b35e26eb884e49e9820f54229c89f4fde24ff..5dc51f9b854c4ff768d8f7cebf3a96397f7a4df4 100644 --- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx +++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx @@ -1,23 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//Gaudi - Core -#include "StoreGate/StoreGateSvc.h" +#include "MM_FastDigitizer.h" -//Inputs +#include "StoreGate/StoreGateSvc.h" #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/MuonSimData.h" - -//Outputs #include "MuonPrepRawData/MMPrepDataContainer.h" #include "MuonPrepRawData/MMPrepData.h" - -#include "MM_FastDigitizer.h" #include "MuonSimEvent/MM_SimIdToOfflineId.h" #include "MuonSimEvent/MMSimHitCollection.h" #include "MuonSimEvent/MicromegasHitIdHelper.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MMReadoutElement.h" #include "MuonIdHelpers/MmIdHelper.h" @@ -25,38 +19,77 @@ #include "MuonAGDDDescription/MMDetectorDescription.h" #include "MuonAGDDDescription/MMDetectorHelper.h" -#include "Identifier/Identifier.h" -#include "TH1.h" -#include "TTree.h" -#include "TFile.h" - -//Random Numbers -#include "AthenaKernel/IAtRndmGenSvc.h" -#include "CLHEP/Random/RandGauss.h" - - -#include <string> #include <sstream> #include <iostream> #include <fstream> +#include "TTree.h" +#include "TFile.h" + using namespace Muon; /*******************************************************************************/ - MM_FastDigitizer::MM_FastDigitizer(const std::string& name, ISvcLocator* pSvcLocator) -: AthAlgorithm(name, pSvcLocator) , m_activeStore(NULL) , m_detManager(NULL) , m_idHelper(NULL) - , m_file(NULL) , m_ntuple(NULL) , m_dlx(0.) , m_dly(0.) , m_dlz(0.) - , m_sulx(0.) , m_suly(0.) , m_tsulx(0.) , m_tsuly(0.) , m_tsulz(0.) , m_stsulx(0.) , m_stsuly(0.) , m_stsulz(0.) - , m_ang(0.) , m_shift(0.) , m_suresx(0.) , m_suresy(0.) , m_err(0.) , m_res(0.) - , m_pull(0.) , m_is(0) , m_seta(0) , m_sphi(0) , m_sml(0) , m_sl(0) , m_ss(0) , m_ieta(0) , m_iphi(0) , m_iml(0) , m_il(0) - , m_ich(0) , m_istr(0) , m_exitcode(0) , m_mode(0) , m_pdg(0) , m_trkid(0) , m_gpx(0.) , m_gpy(0.) , m_gpz(0.) - , m_gpr(0.) , m_gpp(0.) , m_dgpx(0.) , m_dgpy(0.) , m_dgpz(0.), m_dgpr(0.) , m_dgpp(0.) , m_tofCorrection(0.) - , m_bunchTime(0.) , m_globalHitTime(0.) , m_e(0.) , m_edep(0.) , m_surfcentx(0.) , m_surfcenty(0.) , m_surfcentz(0.) - , m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool" ) - , m_muonClusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator") - , m_rndmSvc("AtRndmGenSvc", name ) - , m_rndmEngine(0) - , m_inputObjectName("MicromegasSensitiveDetector") - , m_sdoName("MMfast_SDO") +MM_FastDigitizer::MM_FastDigitizer(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator), + m_activeStore(nullptr), + m_detManager(nullptr), + m_file(nullptr), + m_ntuple(nullptr), + m_dlx(0.), + m_dly(0.), + m_dlz(0.), + m_sulx(0.), + m_suly(0.), + m_tsulx(0.), + m_tsuly(0.), + m_tsulz(0.), + m_stsulx(0.), + m_stsuly(0.), + m_stsulz(0.), + m_ang(0.), + m_shift(0.), + m_suresx(0.), + m_suresy(0.), + m_err(0.), + m_res(0.), + m_pull(0.), + m_is(0), + m_seta(0), + m_sphi(0), + m_sml(0), + m_sl(0), + m_ss(0), + m_ieta(0), + m_iphi(0), + m_iml(0), + m_il(0), + m_ich(0), + m_istr(0), + m_exitcode(0), + m_mode(0), + m_pdg(0), + m_trkid(0), + m_gpx(0.), + m_gpy(0.), + m_gpz(0.), + m_gpr(0.), + m_gpp(0.), + m_dgpx(0.), + m_dgpy(0.), + m_dgpz(0.), + m_dgpr(0.), + m_dgpp(0.), + m_tofCorrection(0.), + m_bunchTime(0.), + m_globalHitTime(0.), + m_e(0.), + m_edep(0.), + m_surfcentx(0.), + m_surfcenty(0.), + m_surfcentz(0.), + m_muonClusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), + m_rndmSvc("AtRndmGenSvc", name ), + m_rndmEngine(0),m_inputObjectName("MicromegasSensitiveDetector"), + m_sdoName("MMfast_SDO") { declareProperty("InputObjectName", m_inputObjectName = "MicromegasSensitiveDetector", "name of the input object"); declareProperty("RndmEngine", m_rndmEngineName, "Random engine name"); @@ -69,47 +102,20 @@ using namespace Muon; declareProperty("MicroTPC", m_microTPC = true, "Turn on microTPC mode" ); } /*******************************************************************************/ -MM_FastDigitizer::~MM_FastDigitizer() { -} -/*******************************************************************************/ StatusCode MM_FastDigitizer::initialize() { - StatusCode status(StatusCode::SUCCESS); - // initialize transient event store ATH_MSG_DEBUG ( "Retrieved StoreGateSvc." ); - - ATH_CHECK( service("ActiveStoreSvc", m_activeStore) ); - ATH_CHECK( m_muonClusterCreator.retrieve() ); - ATH_CHECK( m_sdoName.initialize() ); - + ATH_CHECK(service("ActiveStoreSvc", m_activeStore)); + ATH_CHECK(m_muonClusterCreator.retrieve()); + ATH_CHECK(m_sdoName.initialize()); // initialize transient detector store and MuonGeoModel OR MuonDetDescrManager - StoreGateSvc* detStore=0; - m_detManager=0; - status = serviceLocator()->service("DetectorStore", detStore); - if (status.isSuccess()) { - if(detStore->contains<MuonGM::MuonDetectorManager>( "Muon" )){ - - status = detStore->retrieve(m_detManager); - if (status.isFailure()) { - ATH_MSG_FATAL ( "Could not retrieve MuonGeoModelDetectorManager!" ); - return status; - } - else { - ATH_MSG_DEBUG ( "Retrieved MuonGeoModelDetectorManager from StoreGate" ); - //initialize the MmIdHelper - m_idHelper = m_detManager->mmIdHelper(); - if(!m_idHelper) return status; - ATH_MSG_DEBUG ( "Retrieved MmIdHelper " << m_idHelper ); - } - } + StoreGateSvc* detStore=nullptr; + ATH_CHECK(serviceLocator()->service("DetectorStore", detStore)); + if(detStore->contains<MuonGM::MuonDetectorManager>("Muon")) { + ATH_CHECK(detStore->retrieve(m_detManager)); + ATH_MSG_DEBUG ( "Retrieved MuonGeoModelDetectorManager from StoreGate" ); } - else { - ATH_MSG_FATAL ( "Could not retrieve DetectorStore!" ); - return status; - } - - ATH_CHECK( m_idHelperTool.retrieve() ); - + ATH_CHECK(m_idHelperSvc.retrieve()); // check the input object name if (m_inputObjectName=="") { ATH_MSG_FATAL ( "Property InputObjectName not set !" ); @@ -188,15 +194,11 @@ StatusCode MM_FastDigitizer::initialize() { } /*******************************************************************************/ StatusCode MM_FastDigitizer::execute() { - - - - // Create and record the SDO container in StoreGate SG::WriteHandle<MuonSimDataCollection> h_sdoContainer(m_sdoName); ATH_CHECK( h_sdoContainer.record ( std::make_unique<MuonSimDataCollection>() ) ); - MMPrepDataContainer* prdContainer = new MMPrepDataContainer(m_idHelper->module_hash_max()); + MMPrepDataContainer* prdContainer = new MMPrepDataContainer(m_idHelperSvc->mmIdHelper().module_hash_max()); std::string key = "MM_Measurements"; ATH_MSG_DEBUG(" Done! Total number of MM chambers with PRDS: " << prdContainer->numberOfCollections() << " key " << key); ATH_CHECK( evtStore()->record(prdContainer,key) ); @@ -206,18 +208,15 @@ StatusCode MM_FastDigitizer::execute() { return StatusCode::SUCCESS; } // as the MMPrepDataContainer only allows const accesss, need a local vector as well. - std::vector<MMPrepDataCollection*> localMMVec(m_idHelper->module_hash_max()); + std::vector<MMPrepDataCollection*> localMMVec(m_idHelperSvc->mmIdHelper().module_hash_max()); const DataHandle< MMSimHitCollection > collGMSH; - if ( evtStore()->retrieve( collGMSH,m_inputObjectName ).isFailure()) { - ATH_MSG_WARNING("No MM hits found in SG"); - return StatusCode::FAILURE; - } + ATH_CHECK(evtStore()->retrieve( collGMSH,m_inputObjectName )); ATH_MSG_DEBUG( "Retrieved " << collGMSH->size() << " MM hits!"); // Get the MicroMegas Id hit helper - MM_SimIdToOfflineId simToOffline(*m_idHelper); + MM_SimIdToOfflineId simToOffline(&m_idHelperSvc->mmIdHelper()); std::map<Identifier,int> hitsPerChannel; int nhits = 0; @@ -254,34 +253,33 @@ StatusCode MM_FastDigitizer::execute() { Identifier layid = simToOffline.convert(simId); // sanity checks - if( !m_idHelper->is_mm(layid) ){ - ATH_MSG_WARNING("MM id is not a mm id! " << m_idHelperTool->toString(layid)); + if( !m_idHelperSvc->isMM(layid) ){ + ATH_MSG_WARNING("MM id is not a mm id! " << m_idHelperSvc->toString(layid)); } - if( !m_idHelper->is_muon(layid) ){ - ATH_MSG_WARNING("MM id is not a muon id! " << m_idHelperTool->toString(layid)); + if( !m_idHelperSvc->isMuon(layid) ){ + ATH_MSG_WARNING("MM id is not a muon id! " << m_idHelperSvc->toString(layid)); } - if( m_idHelper->is_mdt(layid)||m_idHelper->is_rpc(layid)||m_idHelper->is_tgc(layid)||m_idHelper->is_csc(layid)||m_idHelper->is_stgc(layid) ){ - ATH_MSG_WARNING("MM id has wrong technology type! " << m_idHelper->is_mdt(layid) << " " << m_idHelper->is_rpc(layid) - << " " << m_idHelper->is_tgc(layid) << " " << m_idHelper->is_csc(layid) << " " << m_idHelper->is_stgc(layid) ); + if( m_idHelperSvc->isMdt(layid)||m_idHelperSvc->isRpc(layid)||m_idHelperSvc->isTgc(layid)||m_idHelperSvc->isCsc(layid)||m_idHelperSvc->issTgc(layid) ){ + ATH_MSG_WARNING("MM id has wrong technology type!"); } // remove hits in masked multiplet - if( m_maskMultiplet == m_idHelperTool->stgcIdHelper().multilayer(layid) ) continue; + if( m_maskMultiplet == m_idHelperSvc->stgcIdHelper().multilayer(layid) ) continue; // get readout element const MuonGM::MMReadoutElement* detEl = m_detManager->getMMReadoutElement(layid); if( !detEl ){ - ATH_MSG_WARNING("Failed to retrieve detector element for: " << m_idHelperTool->toString(layid) ); + ATH_MSG_WARNING("Failed to retrieve detector element for: " << m_idHelperSvc->toString(layid) ); continue; } // collections stored per readout element IdentifierHash hash; - m_idHelper->get_module_hash(layid, hash); + m_idHelperSvc->mmIdHelper().get_module_hash(layid, hash); MuonPrepDataCollection<Muon::MMPrepData>* col = localMMVec[hash]; if( !col ){ col = new MMPrepDataCollection(hash); - col->setIdentifier(m_idHelper->channelID(m_idHelper->parentID(layid), m_idHelper->multilayer(layid),1,1) ); + col->setIdentifier(m_idHelperSvc->mmIdHelper().channelID(m_idHelperSvc->mmIdHelper().parentID(layid), m_idHelperSvc->mmIdHelper().multilayer(layid),1,1) ); if( prdContainer->addCollection(col,hash).isFailure() ){ ATH_MSG_WARNING("Failed to add collection with hash " << (int)hash ); delete col;col=0; @@ -308,29 +306,26 @@ StatusCode MM_FastDigitizer::execute() { Amg::Vector3D slpos = surf.transform().inverse()*hpos; // Get MM_READOUT from MMDetectorDescription - char side = ((int)m_idHelper->stationEta(layid)) < 0 ? 'C' : 'A'; - char sector_l = ((std::string)m_idHelper->stationNameString(m_idHelper->stationName(layid))).substr(2,1)=="L" ? 'L' : 'S'; + char side = ((int)m_idHelperSvc->mmIdHelper().stationEta(layid)) < 0 ? 'C' : 'A'; + char sector_l = ((std::string)m_idHelperSvc->mmIdHelper().stationNameString(m_idHelperSvc->mmIdHelper().stationName(layid))).substr(2,1)=="L" ? 'L' : 'S'; MMDetectorHelper aHelper; - MMDetectorDescription* mm = aHelper.Get_MMDetector(sector_l, abs((int)m_idHelper->stationEta(layid)), (int)m_idHelper->stationPhi(layid), (int)m_idHelper->multilayer(layid), side); + MMDetectorDescription* mm = aHelper.Get_MMDetector(sector_l, abs((int)m_idHelperSvc->mmIdHelper().stationEta(layid)), (int)m_idHelperSvc->mmIdHelper().stationPhi(layid), (int)m_idHelperSvc->mmIdHelper().multilayer(layid), side); MMReadoutParameters roParam = mm->GetReadoutParameters(); Amg::Vector3D ldir = surf.transform().inverse().linear()*Amg::Vector3D(hit.globalDirection().x(), hit.globalDirection().y(), hit.globalDirection().z()); Amg::Vector3D ldirTime; // the stereo angle vector stores the angles in rad. the vector indices are 0,1,2,3 which map to layers 1,2,3,4 - if ( std::abs( (roParam.stereoAngle).at(m_idHelper->gasGap(layid)-1) ) > 0. ) + if ( std::abs( (roParam.stereoAngle).at(m_idHelperSvc->mmIdHelper().gasGap(layid)-1) ) > 0. ) ldirTime = ldir; else ldirTime = surf.transform().inverse().linear()*Amg::Vector3D(hit.globalDirection().x(), hit.globalDirection().y(), -hit.globalDirection().z()); double scale;//, scaletop; -// double gasgap = 5.; if (m_microTPC) scale = 0; else scale = -slpos.z()/ldir.z(); -// scaletop = (gasgap+slpos.z())/ldir.z(); Amg::Vector3D hitOnSurface = slpos + scale*ldir; -// Amg::Vector3D hitOnTopSurface = slpos + scaletop*ldir; Amg::Vector3D hitOnSurfaceGlobal = surf.transform()*hitOnSurface; // account for time offset @@ -371,7 +366,7 @@ StatusCode MM_FastDigitizer::execute() { Amg::Vector3D repos = detEl->globalPosition(); MicromegasHitIdHelper* hitHelper = MicromegasHitIdHelper::GetHelper(); - std::string stName = m_idHelper->stationNameString(m_idHelper->stationName(layid)); + std::string stName = m_idHelperSvc->mmIdHelper().stationNameString(m_idHelperSvc->mmIdHelper().stationName(layid)); int isSmall = stName[2] == 'S'; m_dlx = lpos.x(); m_dly = lpos.y(); @@ -396,10 +391,10 @@ StatusCode MM_FastDigitizer::execute() { m_sml = hitHelper->GetMultiLayer(simId); m_sl = hitHelper->GetLayer(simId); m_ss = hitHelper->GetSide(simId); - m_ieta = m_idHelper->stationEta(layid); - m_iphi = m_idHelper->stationPhi(layid); - m_iml = m_idHelper->multilayer(layid); - m_il = m_idHelper->gasGap(layid); + m_ieta = m_idHelperSvc->mmIdHelper().stationEta(layid); + m_iphi = m_idHelperSvc->mmIdHelper().stationPhi(layid); + m_iml = m_idHelperSvc->mmIdHelper().multilayer(layid); + m_il = m_idHelperSvc->mmIdHelper().gasGap(layid); m_ich = -99999; m_istr = -99999; m_exitcode = 0; @@ -441,7 +436,7 @@ StatusCode MM_FastDigitizer::execute() { //int LastStripNumber = detEl->stripNumber(posOnTopSurf, layid); if( stripNumber == -1 ){ - ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperTool->toString(layid) ); + ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperSvc->toString(layid) ); ATH_MSG_WARNING(" pos " << posOnSurf << " z " << slpos.z() ); m_exitcode = 2; m_ntuple->Fill(); @@ -450,8 +445,8 @@ StatusCode MM_FastDigitizer::execute() { // Recalculate the Identifier using the strip number // here need to use parent ID to avoid creating corrupted identifiers - Identifier parentID = m_idHelper->parentID(layid); - Identifier id = m_idHelper->channelID(parentID, m_idHelper->multilayer(layid), m_idHelper->gasGap(layid),stripNumber,m_checkIds); + Identifier parentID = m_idHelperSvc->mmIdHelper().parentID(layid); + Identifier id = m_idHelperSvc->mmIdHelper().channelID(parentID, m_idHelperSvc->mmIdHelper().multilayer(layid), m_idHelperSvc->mmIdHelper().gasGap(layid),stripNumber,m_checkIds); // only one hit per channel int& counts = hitsPerChannel[id]; @@ -461,7 +456,7 @@ StatusCode MM_FastDigitizer::execute() { if( stripNumber >= detEl->numberOfStrips(layid) ){ - ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperTool->toString(layid) ); + ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperSvc->toString(layid) ); ATH_MSG_WARNING(" pos " << posOnSurf << " z " << slpos.z() ); m_exitcode = 3; m_ntuple->Fill(); @@ -470,10 +465,10 @@ StatusCode MM_FastDigitizer::execute() { // Recalculate the Identifier using the strip number // here need to use parent ID to avoid creating corrupted identifiers - id = m_idHelper->channelID(parentID, m_idHelper->multilayer(layid), m_idHelper->gasGap(layid),stripNumber,m_checkIds); + id = m_idHelperSvc->mmIdHelper().channelID(parentID, m_idHelperSvc->mmIdHelper().multilayer(layid), m_idHelperSvc->mmIdHelper().gasGap(layid),stripNumber,m_checkIds); - if( stripNumber != m_idHelper->channel(id) ) { - ATH_MSG_WARNING(" bad stripNumber: in " << stripNumber << " from id " << m_idHelper->channel(id)); + if( stripNumber != m_idHelperSvc->mmIdHelper().channel(id) ) { + ATH_MSG_WARNING(" bad stripNumber: in " << stripNumber << " from id " << m_idHelperSvc->mmIdHelper().channel(id)); m_exitcode = 4; continue; } @@ -485,7 +480,7 @@ StatusCode MM_FastDigitizer::execute() { ATH_MSG_VERBOSE(" Calculated truth hitOnSurfaceGlobal: r " << hitOnSurfaceGlobal.perp() << " phi " << hitOnSurfaceGlobal.phi() << " z " << hitOnSurfaceGlobal.z()); ATH_MSG_VERBOSE(" detEl: r " << repos.perp() << " phi " << repos.phi() << " z " << repos.z()); ATH_MSG_VERBOSE(" Surface center: r " << surf.center().perp() << " phi " << surf.center().phi() << " z " << surf.center().z()); - ATH_MSG_DEBUG(" hit: " << m_idHelperTool->toString(id) << " hitx " << posOnSurf.x() << " hitOnSurface.x() " << hitOnSurface.x() << " residual " << posOnSurf.x() - hitOnSurface.x() + ATH_MSG_DEBUG(" hit: " << m_idHelperSvc->toString(id) << " hitx " << posOnSurf.x() << " hitOnSurface.x() " << hitOnSurface.x() << " residual " << posOnSurf.x() - hitOnSurface.x() << " pull " << (posOnSurf.x() - hitOnSurface.x())/resolution ); Amg::Vector3D CurrentHitInDriftGap = slpos; // emulating micro track in the drift volume for microTPC @@ -510,7 +505,7 @@ StatusCode MM_FastDigitizer::execute() { ATH_MSG_VERBOSE(" Prd: r " << prd->globalPosition().perp() << " phi " << prd->globalPosition().phi() << " z " << prd->globalPosition().z()); } else { for (int loop_direction = -1; loop_direction <=1; loop_direction+=2) { - Amg::Vector3D stepInDriftGap = loop_direction * ldir * (roParam.stripPitch/std::cos(roParam.stereoAngle.at(m_idHelper->gasGap(layid)-1) ))/abs(ldir.x()); + Amg::Vector3D stepInDriftGap = loop_direction * ldir * (roParam.stripPitch/std::cos(roParam.stereoAngle.at(m_idHelperSvc->mmIdHelper().gasGap(layid)-1) ))/abs(ldir.x()); if (loop_direction == 1) CurrentHitInDriftGap = slpos + stepInDriftGap; while (std::abs(CurrentHitInDriftGap.z()) <= roParam.gasThickness) { std::unique_ptr<Amg::MatrixX> cov = std::make_unique<Amg::MatrixX>(1,1); @@ -525,8 +520,8 @@ StatusCode MM_FastDigitizer::execute() { CurrentHitInDriftGap += stepInDriftGap; continue; } - id = m_idHelper->channelID(parentID, m_idHelper->multilayer(layid), m_idHelper->gasGap(layid),stripNumber,m_checkIds); - if( stripNumber != m_idHelper->channel(id) ) { + id = m_idHelperSvc->mmIdHelper().channelID(parentID, m_idHelperSvc->mmIdHelper().multilayer(layid), m_idHelperSvc->mmIdHelper().gasGap(layid),stripNumber,m_checkIds); + if( stripNumber != m_idHelperSvc->mmIdHelper().channel(id) ) { CurrentHitInDriftGap += stepInDriftGap; continue; } @@ -557,29 +552,18 @@ StatusCode MM_FastDigitizer::execute() { m_err = resolution; - m_ich = m_idHelper->channel(id); + m_ich = m_idHelperSvc->mmIdHelper().channel(id); m_istr = stripNumber; - -// const MuonClusterOnTrack* rot = m_muonClusterCreator->createRIO_OnTrack( *prd, hit.globalPosition() ); -// if( rot ){ -// m_res = rot->localParameters().get(Trk::locX)-hitOnSurface.x(); -// m_pull = m_res/rot->localErrorMatrix().error(Trk::locX); -// delete rot; -// } - m_ntuple->Fill(); - // OLD CODE ENDS HERE - } - if( msgLvl(MSG::DEBUG) ){ + if (msgLvl(MSG::DEBUG)) { std::map<Identifier,int>::const_iterator hit = hitsPerChannel.begin(); std::map<Identifier,int>::const_iterator hit_end = hitsPerChannel.end(); - msg(MSG::DEBUG) << " number of channels with hit " << hitsPerChannel.size() << " nhits " << nhits << std::endl; + ATH_MSG_DEBUG(" number of channels with hit " << hitsPerChannel.size() << " nhits " << nhits); for( ;hit!=hit_end;++hit ){ - msg(MSG::DEBUG) << " " << m_idHelperTool->toString(hit->first) << " -> " << hit->second << std::endl; + ATH_MSG_DEBUG(" " << m_idHelperSvc->toString(hit->first) << " -> " << hit->second); } - msg(MSG::DEBUG) << endmsg; } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.h b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.h index 59801a2f9e5e4d4955cc7d766f76d99bcce6c757..bc09af3b4ec57b5baa8f8c2b7d55d25d7a4b7bd6 100644 --- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.h +++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.h @@ -1,28 +1,27 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONDIGITIZATION_MM_FASTDIGITIZER_H #define MUONDIGITIZATION_MM_FASTDIGITIZER_H -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "StoreGate/StoreGateSvc.h" #include "StoreGate/WriteHandleKey.h" - -//Random #include "CLHEP/Random/RandomEngine.h" #include "AthenaKernel/IAtRndmGenSvc.h" #include "CLHEP/Random/RandGauss.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include <string> + class TTree; class TFile; -class MmIdHelper; namespace MuonGM { class MuonDetectorManager; } @@ -32,8 +31,6 @@ namespace CLHEP{ class HepRandomEngine; } - -class IAtRndmGenSvc; class ActiveStoreSvc; class MuonSimDataCollection; @@ -42,7 +39,7 @@ class MM_FastDigitizer : public AthAlgorithm { public: MM_FastDigitizer(const std::string& name, ISvcLocator* pSvcLocator); - ~MM_FastDigitizer(); + ~MM_FastDigitizer()=default; StatusCode initialize(); StatusCode execute(); @@ -54,11 +51,8 @@ class MM_FastDigitizer : public AthAlgorithm { float RadsToDegrees(float Radians); private: - ActiveStoreSvc* m_activeStore; - const MuonGM::MuonDetectorManager* m_detManager; - const MmIdHelper* m_idHelper; TFile* m_file; TTree* m_ntuple; @@ -116,7 +110,7 @@ class MM_FastDigitizer : public AthAlgorithm { float m_surfcentz; protected: - ToolHandle <Muon::MuonIdHelperTool> m_idHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle <Muon::IMuonClusterOnTrackCreator> m_muonClusterCreator; ServiceHandle <IAtRndmGenSvc> m_rndmSvc; // Random number service CLHEP::HepRandomEngine *m_rndmEngine; // Random number engine used - not init in SiDigitization diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx index 5ea5204a2e0e4b36943359ecd97bf5f858f015f4..4b7f43c8c13cf0e5074697baa4da95283eb5ab7a 100644 --- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx +++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx @@ -1,58 +1,99 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "sTgcFastDigitizer.h" -#include "MuonSimEvent/sTgcSimIdToOfflineId.h" +#include "MuonSimEvent/sTgcSimIdToOfflineId.h" #include "MuonSimEvent/sTGCSimHitCollection.h" - #include "MuonSimEvent/MicromegasHitIdHelper.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/sTgcReadoutElement.h" -#include "MuonIdHelpers/sTgcIdHelper.h" - #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/MuonSimData.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "MuonPrepRawData/sTgcPrepData.h" #include "TrkEventPrimitives/LocalDirection.h" #include "TrkSurfaces/Surface.h" +#include "CLHEP/Random/RandFlat.h" +#include "PathResolver/PathResolver.h" -#include "Identifier/Identifier.h" -#include "TH1.h" #include "TTree.h" #include "TFile.h" -//Random Numbers -#include "AthenaKernel/IAtRndmGenSvc.h" -#include "CLHEP/Random/RandGauss.h" -#include "CLHEP/Random/RandFlat.h" -#include "PathResolver/PathResolver.h" - using namespace Muon; -sTgcFastDigitizer::sTgcFastDigitizer(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) , m_detManager(NULL) , m_idHelper(NULL) , m_channelTypes(0) - , m_file(NULL) , m_ntuple(NULL) , m_dlx(0.) , m_dly(0.) , m_dlz(0.) - , m_sulx(0.) , m_suly(0.) , m_tsulx(0.) , m_tsuly(0.) , m_tsulz(0.) - , m_suresx(0.) , m_suresy(0.) , m_errx(0.) , m_erry(0.) , m_res(0.) , m_pull(0.) , m_is(0) , m_seta(0) , m_sphi(0) - , m_sml(0) , m_sl(0) , m_ss(0) , m_stype(0) , m_ieta(0) , m_iphi(0) , m_iml(0) , m_il(0) , m_ich(0) , m_istr(0) , m_itype(0) - , m_ipadeta(0) , m_ipadphi(0) , m_exitcode(0) , m_mode(0) , m_pdg(0) , m_trkid(0) , m_bct(0) , m_tb(0.) , m_tj(0.) - , m_tg4(0.) , m_ttof(0.) , m_gpx(0.) , m_gpy(0.) , m_gpz(0.) , m_gpr(0.) , m_gpp(0.) , m_dgpx(0.) , m_dgpy(0.) , m_dgpz(0.) - , m_dgpr(0.) , m_dgpp(0.) , m_edep(0.) , m_as(0.) , m_at(0.) , m_surfcentx(0.) , m_surfcenty(0.) , m_surfcentz(0.) - , m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool" ) - , m_muonClusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator") - , m_rndmSvc("AtRndmGenSvc", name ) - , m_rndmEngine(0) - , m_sdoName("STGCfast_SDO") - , m_timeWindowOffsetWire(0.) - , m_timeWindowOffsetStrip(0.) - , m_timeWindowWire(24.95) // TGC 29.32; // 29.32 ns = 26 ns + 4 * 0.83 ns - , m_timeWindowStrip(24.95) // TGC 40.94; // 40.94 ns = 26 ns + 18 * 0.83 ns - , m_bunchCrossingTime(24.95) // 24.95 ns =(40.08 MHz)^(-1) +sTgcFastDigitizer::sTgcFastDigitizer(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator), + m_detManager(NULL), + m_channelTypes(0), + m_file(NULL), + m_ntuple(NULL), + m_dlx(0.), + m_dly(0.), + m_dlz(0.), + m_sulx(0.), + m_suly(0.), + m_tsulx(0.), + m_tsuly(0.), + m_tsulz(0.), + m_suresx(0.), + m_suresy(0.), + m_errx(0.), + m_erry(0.), + m_res(0.), + m_pull(0.), + m_is(0), + m_seta(0), + m_sphi(0), + m_sml(0), + m_sl(0), + m_ss(0), + m_stype(0), + m_ieta(0), + m_iphi(0), + m_iml(0), + m_il(0), + m_ich(0), + m_istr(0), + m_itype(0), + m_ipadeta(0), + m_ipadphi(0), + m_exitcode(0), + m_mode(0), + m_pdg(0), + m_trkid(0), + m_bct(0), + m_tb(0.), + m_tj(0.), + m_tg4(0.), + m_ttof(0.), + m_gpx(0.), + m_gpy(0.), + m_gpz(0.), + m_gpr(0.), + m_gpp(0.), + m_dgpx(0.), + m_dgpy(0.), + m_dgpz(0.), + m_dgpr(0.), + m_dgpp(0.), + m_edep(0.), + m_as(0.), + m_at(0.), + m_surfcentx(0.), + m_surfcenty(0.), + m_surfcentz(0.), + m_muonClusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), + m_rndmSvc("AtRndmGenSvc", name ), + m_rndmEngine(0), + m_sdoName("STGCfast_SDO"), + m_timeWindowOffsetWire(0.), + m_timeWindowOffsetStrip(0.), + m_timeWindowWire(24.95), // TGC 29.32; // 29.32 ns = 26 ns + 4 * 0.83 ns + m_timeWindowStrip(24.95), // TGC 40.94; // 40.94 ns = 26 ns + 18 * 0.83 ns + m_bunchCrossingTime(24.95) // 24.95 ns =(40.08 MHz)^(-1) { - declareProperty("IdHelperTool", m_idHelperTool); declareProperty("ClusterCreator", m_muonClusterCreator); declareProperty("ChannelTypes", m_channelTypes = 3); declareProperty("RndmEngine", m_rndmEngineName, "Random engine name"); @@ -64,23 +105,16 @@ sTgcFastDigitizer::sTgcFastDigitizer(const std::string& name, ISvcLocator* pSvcL declareProperty("MergePrds", m_mergePrds = true ); } -sTgcFastDigitizer::~sTgcFastDigitizer() { - -} - StatusCode sTgcFastDigitizer::initialize() { - - ATH_CHECK( detStore()->retrieve( m_detManager ) ); - ATH_CHECK( detStore()->retrieve( m_idHelper ) ); - + ATH_CHECK(detStore()->retrieve(m_detManager)); m_rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); if (m_rndmEngine==0) { - ATH_MSG_ERROR("Could not find RndmEngine : " << m_rndmEngineName ); + ATH_MSG_ERROR("Could not find RndmEngine : " << m_rndmEngineName); return StatusCode::FAILURE; } - ATH_CHECK( m_idHelperTool.retrieve() ); - ATH_CHECK( m_muonClusterCreator.retrieve() ); - ATH_CHECK( m_sdoName.initialize() ); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_muonClusterCreator.retrieve()); + ATH_CHECK(m_sdoName.initialize()); if( !readFileOfTimeJitter() ) return StatusCode::FAILURE; @@ -144,31 +178,26 @@ StatusCode sTgcFastDigitizer::initialize() { m_ntuple->Branch("surfcentz",&m_surfcentz); return StatusCode::SUCCESS; - } StatusCode sTgcFastDigitizer::execute() { - -// Create and record the SDO container in StoreGate + // Create and record the SDO container in StoreGate SG::WriteHandle<MuonSimDataCollection> h_sdoContainer(m_sdoName); ATH_CHECK( h_sdoContainer.record ( std::make_unique<MuonSimDataCollection>() ) ); - sTgcPrepDataContainer* prdContainer = new sTgcPrepDataContainer(m_idHelper->module_hash_max()); + sTgcPrepDataContainer* prdContainer = new sTgcPrepDataContainer(m_idHelperSvc->stgcIdHelper().module_hash_max()); // as the sTgcPrepDataContainer only allows const accesss, need a local vector as well. - std::vector<sTgcPrepDataCollection*> localsTgcVec(m_idHelper->module_hash_max()); + std::vector<sTgcPrepDataCollection*> localsTgcVec(m_idHelperSvc->stgcIdHelper().module_hash_max()); std::vector<sTgcPrepData*> sTgcprds; std::vector<int> sTgcflag; const DataHandle< sTGCSimHitCollection > collGMSH; - if ( evtStore()->retrieve( collGMSH,"sTGCSensitiveDetector").isFailure()) { - ATH_MSG_WARNING("No sTgc hits found in SG"); - return StatusCode::FAILURE; - } + ATH_CHECK(evtStore()->retrieve( collGMSH,"sTGCSensitiveDetector")); ATH_MSG_DEBUG( "Retrieved " << collGMSH->size() << " sTgc hits!"); sTgcHitIdHelper* hitHelper=sTgcHitIdHelper::GetHelper(); - sTgcSimIdToOfflineId simToOffline(*m_idHelper); + sTgcSimIdToOfflineId simToOffline(&m_idHelperSvc->stgcIdHelper()); std::map<Identifier,int> hitsPerChannel; @@ -189,18 +218,18 @@ StatusCode sTgcFastDigitizer::execute() { int simId = hit.sTGCId(); Identifier layid = simToOffline.convert(simId); ATH_MSG_VERBOSE("sTgc hit: r " << hit.globalPosition().perp() << " z " << hit.globalPosition().z() << " mclink " << hit.particleLink() - << " -- " << m_idHelperTool->toString(layid)); + << " -- " << m_idHelperSvc->toString(layid)); - std::string stName = m_idHelper->stationNameString(m_idHelper->stationName(layid)); + std::string stName = m_idHelperSvc->stgcIdHelper().stationNameString(m_idHelperSvc->stgcIdHelper().stationName(layid)); int isSmall = stName[2] == 'S'; const MuonGM::sTgcReadoutElement* detEl = m_detManager->getsTgcReadoutElement(layid); if( !detEl ){ - ATH_MSG_WARNING("Failed to retrieve detector element for: " << m_idHelperTool->toString(layid) ); + ATH_MSG_WARNING("Failed to retrieve detector element for: " << m_idHelperSvc->toString(layid) ); continue; } IdentifierHash hash; - m_idHelper->get_module_hash(layid, hash); + m_idHelperSvc->stgcIdHelper().get_module_hash(layid, hash); bool lastHit = false; if(itersTgc + 1 ==collGMSH->end()) lastHit = true; @@ -219,15 +248,15 @@ StatusCode sTgcFastDigitizer::execute() { bool merge = false; unsigned int jmerge = -1; Identifier id_prd = sTgcprds[i]->identify(); - int strip = m_idHelper->channel(id_prd); - int gasGap = m_idHelper->gasGap(id_prd); - int layer = m_idHelper->multilayer(id_prd); + int strip = m_idHelperSvc->stgcIdHelper().channel(id_prd); + int gasGap = m_idHelperSvc->stgcIdHelper().gasGap(id_prd); + int layer = m_idHelperSvc->stgcIdHelper().multilayer(id_prd); ATH_MSG_VERBOSE(" sTgcprds " << sTgcprds.size() <<" index "<< i << " strip " << strip << " gasGap " << gasGap << " layer " << layer ); for (unsigned int j=i+1; j<sTgcprds.size(); ++j){ Identifier id_prdN = sTgcprds[j]->identify(); - int stripN = m_idHelper->channel(id_prdN); - int gasGapN = m_idHelper->gasGap(id_prdN); - int layerN = m_idHelper->multilayer(id_prdN); + int stripN = m_idHelperSvc->stgcIdHelper().channel(id_prdN); + int gasGapN = m_idHelperSvc->stgcIdHelper().gasGap(id_prdN); + int layerN = m_idHelperSvc->stgcIdHelper().multilayer(id_prdN); if( gasGapN==gasGap && layerN==layer ) { ATH_MSG_VERBOSE(" next sTgcprds strip same gasGap and layer index " << j << " strip " << stripN << " gasGap " << gasGapN << " layer " << layerN ); if(abs(strip-stripN)<2) { @@ -263,10 +292,10 @@ StatusCode sTgcFastDigitizer::execute() { for (unsigned int k=0; k < nmergeStripsMax; ++k) { for (unsigned int j=jmerge; j<sTgcprds.size(); ++j){ Identifier id_prdN = sTgcprds[j]->identify(); - int stripN = m_idHelper->channel(id_prdN); + int stripN = m_idHelperSvc->stgcIdHelper().channel(id_prdN); if( abs(mergeStrips[k]-stripN) == 1 ) { - int gasGapN = m_idHelper->gasGap(id_prdN); - int layerN = m_idHelper->multilayer(id_prdN); + int gasGapN = m_idHelperSvc->stgcIdHelper().gasGap(id_prdN); + int layerN = m_idHelperSvc->stgcIdHelper().multilayer(id_prdN); if( gasGapN==gasGap && layerN==layer ) { nmerge++; rdoList.push_back(id_prdN); @@ -299,7 +328,7 @@ StatusCode sTgcFastDigitizer::execute() { Amg::MatrixX* covN = new Amg::MatrixX(1,1); covN->setIdentity(); (*covN)(0,0) = 6.*(nmerge + 1.)*covX; - ATH_MSG_VERBOSE(" make merged prepData at strip " << m_idHelper->channel(sTgcprds[j]->identify())); + ATH_MSG_VERBOSE(" make merged prepData at strip " << m_idHelperSvc->stgcIdHelper().channel(sTgcprds[j]->identify())); sTgcPrepData* prdN = new sTgcPrepData(sTgcprds[j]->identify(), hashLast, sTgcprds[j]->localPosition(), rdoList, covN, sTgcprds[j]->detectorElement(), sTgcprds[j]->getBcBitMap()); prdN->setHashAndIndex(col->identifyHash(), col->size()); @@ -315,7 +344,7 @@ StatusCode sTgcFastDigitizer::execute() { MuonPrepDataCollection<Muon::sTgcPrepData>* col = localsTgcVec[hash]; if( !col ){ col = new sTgcPrepDataCollection(hash); - col->setIdentifier(m_idHelper->channelID(m_idHelper->parentID(layid), m_idHelper->multilayer(layid),1,1,1) ); + col->setIdentifier(m_idHelperSvc->stgcIdHelper().channelID(m_idHelperSvc->stgcIdHelper().parentID(layid), m_idHelperSvc->stgcIdHelper().multilayer(layid),1,1,1) ); if( prdContainer->addCollection(col,hash).isFailure() ){ ATH_MSG_WARNING("Failed to add collection with hash " << (int)hash ); delete col;col=0; @@ -326,7 +355,7 @@ StatusCode sTgcFastDigitizer::execute() { localsTgcVec[hash] = col; } - Identifier parentId = m_idHelper->parentID(layid); + Identifier parentId = m_idHelperSvc->stgcIdHelper().parentID(layid); // SimHits without energy loss are not recorded. // not needed because of already done in sensitive detector @@ -341,14 +370,11 @@ StatusCode sTgcFastDigitizer::execute() { for( int type=ftype;type<=ltype;++type ){ // only produce wire hits for outer two stations - if( type == 2 && abs(m_idHelper->stationEta(layid)) < 3 ) continue; - - // for debugging only treat pads - //if( type != 0 ) continue; + if( type == 2 && abs(m_idHelperSvc->stgcIdHelper().stationEta(layid)) < 3 ) continue; // first create surface identifier - Identifier id = m_idHelper->channelID(parentId, m_idHelper->multilayer(layid), m_idHelper->gasGap(layid),type,1,m_checkIds); - ATH_MSG_VERBOSE("handling layer " << m_idHelperTool->toString(id) << " type " << type ); + Identifier id = m_idHelperSvc->stgcIdHelper().channelID(parentId, m_idHelperSvc->stgcIdHelper().multilayer(layid), m_idHelperSvc->stgcIdHelper().gasGap(layid),type,1,m_checkIds); + ATH_MSG_VERBOSE("handling layer " << m_idHelperSvc->toString(id) << " type " << type ); const Trk::PlaneSurface& surf = detEl->surface(id); Amg::Transform3D gToL = detEl->absTransform().inverse(); Amg::Vector3D hpos(hit.globalPosition().x(),hit.globalPosition().y(),hit.globalPosition().z()); @@ -367,19 +393,15 @@ StatusCode sTgcFastDigitizer::execute() { Trk::LocalDirection LocDirection; surf.globalToLocalDirection(GloDire, LocDirection); - float inAngle_time = 90 - fabs( LocDirection.angleXZ() / CLHEP::degree); - float inAngle_space = 90 - fabs( LocDirection.angleYZ() / CLHEP::degree); + float inAngle_time = 90 - std::abs( LocDirection.angleXZ() / CLHEP::degree); + float inAngle_space = 90 - std::abs( LocDirection.angleYZ() / CLHEP::degree); if(inAngle_time > 90) inAngle_time = inAngle_time -90.; if(inAngle_space > 90) inAngle_space = inAngle_space -90.; // bctagging -// static const float jitterInitial = 9999.; float jitter = 0;//jitterInitial; // calculated m_at central strip but also used in all the strips fired by the same hit -// if(jitter > jitterInitial-0.1) { -// jitter = timeJitter(inAngle_time); -// } //const float stripPropagationTime = 3.3*CLHEP::ns/CLHEP::m * detEl->distanceToReadout(posOnSurf_strip, elemId); // 8.5*ns/m was used until MC10. const float stripPropagationTime = 0.; // 8.5*ns/m was used until MC10. @@ -397,7 +419,6 @@ StatusCode sTgcFastDigitizer::execute() { resolution = getResolution(inAngle_time); sp = CLHEP::RandGauss::shoot(m_rndmEngine, hitOnSurface.x(), resolution); } - //ATH_MSG_DEBUG("slpos.z " << slpos.z() << ", ldir " << ldir.z() << ", scale " << scale << ", hitOnSurface.z " << hitOnSurface.z()); Amg::Vector2D posOnSurf(sp,hitOnSurface.y()); @@ -428,10 +449,10 @@ StatusCode sTgcFastDigitizer::execute() { m_sl = hitHelper->GetLayer(simId); m_ss = hitHelper->GetSide(simId); m_stype = type; - m_ieta = m_idHelper->stationEta(id); - m_iphi = m_idHelper->stationPhi(id); - m_iml = m_idHelper->multilayer(id); - m_il = m_idHelper->gasGap(id); + m_ieta = m_idHelperSvc->stgcIdHelper().stationEta(id); + m_iphi = m_idHelperSvc->stgcIdHelper().stationPhi(id); + m_iml = m_idHelperSvc->stgcIdHelper().multilayer(id); + m_il = m_idHelperSvc->stgcIdHelper().gasGap(id); m_ich = -99999; m_istr = -99999; m_itype = -99999; @@ -492,7 +513,7 @@ StatusCode sTgcFastDigitizer::execute() { int stripNumber = detEl->stripNumber(locHitPosOnSurf,id); if( stripNumber == -1 ){ - ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperTool->toString(id) + ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperSvc->toString(id) << " pos " << posOnSurf.x() << " - " << hitOnSurface.x() << " z " << slpos.z() << " type " << type ); m_exitcode = 2; m_ntuple->Fill(); @@ -500,8 +521,8 @@ StatusCode sTgcFastDigitizer::execute() { } // create channel identifier - id = m_idHelper->channelID(parentId, m_idHelper->multilayer(id), m_idHelper->gasGap(id),type,stripNumber,m_checkIds); - ATH_MSG_VERBOSE(" Unsmeared hit id " << m_idHelperTool->toString(id) ); + id = m_idHelperSvc->stgcIdHelper().channelID(parentId, m_idHelperSvc->stgcIdHelper().multilayer(id), m_idHelperSvc->stgcIdHelper().gasGap(id),type,stripNumber,m_checkIds); + ATH_MSG_VERBOSE(" Unsmeared hit id " << m_idHelperSvc->toString(id) ); int& counts = hitsPerChannel[id]; ++counts; @@ -512,7 +533,7 @@ StatusCode sTgcFastDigitizer::execute() { // recalculate using smeared position stripNumber = detEl->stripNumber(posOnSurf,id); if( stripNumber == -1 ){ - ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperTool->toString(id) + ATH_MSG_WARNING("Failed to obtain strip number " << m_idHelperSvc->toString(id) << " pos " << posOnSurf.x() << " - " << hitOnSurface.x() << " z " << slpos.z() << " type " << type ); m_exitcode = 2; m_ntuple->Fill(); @@ -520,18 +541,18 @@ StatusCode sTgcFastDigitizer::execute() { } // create channel identifier - id = m_idHelper->channelID(parentId, m_idHelper->multilayer(id), m_idHelper->gasGap(id),type,stripNumber,m_checkIds); + id = m_idHelperSvc->stgcIdHelper().channelID(parentId, m_idHelperSvc->stgcIdHelper().multilayer(id), m_idHelperSvc->stgcIdHelper().gasGap(id),type,stripNumber,m_checkIds); - if( type != m_idHelper->channelType(id) ) ATH_MSG_WARNING(" bad type: in " << type << " from id " << m_idHelper->channelType(id) - << " strip " << stripNumber << " from id " << m_idHelper->channel(id) - << " eta " << m_idHelper->stationEta(id) + if( type != m_idHelperSvc->stgcIdHelper().channelType(id) ) ATH_MSG_WARNING(" bad type: in " << type << " from id " << m_idHelperSvc->stgcIdHelper().channelType(id) + << " strip " << stripNumber << " from id " << m_idHelperSvc->stgcIdHelper().channel(id) + << " eta " << m_idHelperSvc->stgcIdHelper().stationEta(id) << " local pos " << slpos ); // assign strip position to PRD for wires and pads if( type != 1 ){ Amg::Vector2D locpos(0,0); if( !detEl->stripPosition(id,locpos ) ){ - ATH_MSG_WARNING("Failed to obtain local position for identifier " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING("Failed to obtain local position for identifier " << m_idHelperSvc->toString(id) ); m_exitcode = 3; m_ntuple->Fill(); continue; @@ -547,9 +568,9 @@ StatusCode sTgcFastDigitizer::execute() { if( type == 2 ){ const MuonGM::MuonChannelDesign* design = detEl->getDesign(id); if( !design ){ - ATH_MSG_WARNING("Failed to get design for " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING("Failed to get design for " << m_idHelperSvc->toString(id) ); }else{ - errX = fabs(design->inputPitch)/sqrt(12); + errX = std::abs(design->inputPitch)/std::sqrt(12); } }else if( type == 1 ){ errX = resolution; @@ -558,7 +579,7 @@ StatusCode sTgcFastDigitizer::execute() { const MuonGM::MuonPadDesign* design = detEl->getPadDesign(id); if( !design ){ - ATH_MSG_WARNING("Failed to get design for " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING("Failed to get design for " << m_idHelperSvc->toString(id) ); }else{ errX = design->channelWidth(posOnSurf,true)/sqrt(12); @@ -573,10 +594,6 @@ StatusCode sTgcFastDigitizer::execute() { cov->setIdentity(); (*cov)(0,0) = errX*errX; -// ATH_MSG_DEBUG(" New hit " << m_idHelperTool->toString(id) << " chtype " << type << " lpos " << posOnSurf << " from truth " -// << hitOnSurface << " error " << locErrMat->error(Trk::locX) << " m_pull " << (posOnSurf.x()-hitOnSurface.x())/locErrMat->error(Trk::locX) ); - - //sTgcPrepData* prd = new sTgcPrepData( id,hash,posOnSurf,rdoList,locErrMat,detEl); sTgcPrepData* prd = new sTgcPrepData( id,hash,posOnSurf,rdoList,cov,detEl, bctag); if(type!=1 || lastHit || !m_mergePrds) { @@ -596,12 +613,12 @@ StatusCode sTgcFastDigitizer::execute() { m_sulx = posOnSurf.x(); m_suly = posOnSurf.y(); m_errx = errX; - m_ich = m_idHelper->channel(id); + m_ich = m_idHelperSvc->stgcIdHelper().channel(id); m_istr = stripNumber; - m_itype = m_idHelper->channelType(id); + m_itype = m_idHelperSvc->stgcIdHelper().channelType(id); if( type == 0 ){ - m_ipadeta = m_idHelper->padEta(id); - m_ipadphi = m_idHelper->padPhi(id); + m_ipadeta = m_idHelperSvc->stgcIdHelper().padEta(id); + m_ipadphi = m_idHelperSvc->stgcIdHelper().padPhi(id); } ATH_MSG_VERBOSE("Global hit: r " << hit.globalPosition().perp() << " phi " << hit.globalPosition().phi() << " z " << hit.globalPosition().z()); @@ -612,14 +629,7 @@ StatusCode sTgcFastDigitizer::execute() { ATH_MSG_VERBOSE(" Prd: local posOnSurf.x() " << posOnSurf.x() << " posOnSurf.y() " << posOnSurf.y() ); - ATH_MSG_DEBUG(" hit: " << m_idHelperTool->toString(id) << " hitx " << posOnSurf.x() << " residual " << posOnSurf.x() - hitOnSurface.x() << " hitOnSurface.x() " << hitOnSurface.x() << " errorx " << m_errx << " pull " << (posOnSurf.x() - hitOnSurface.x())/m_errx); - -// const MuonClusterOnTrack* rot = m_muonClusterCreator->createRIO_OnTrack( *prd, hit.globalPosition() ); -// if( rot ){ -// m_res = rot->localParameters().get(Trk::locX)-hitOnSurface.x(); -// m_pull = m_res/rot->localErrorMatrix().error(Trk::locX); -// delete rot; -// } + ATH_MSG_DEBUG(" hit: " << m_idHelperSvc->toString(id) << " hitx " << posOnSurf.x() << " residual " << posOnSurf.x() - hitOnSurface.x() << " hitOnSurface.x() " << hitOnSurface.x() << " errorx " << m_errx << " pull " << (posOnSurf.x() - hitOnSurface.x())/m_errx); m_ntuple->Fill(); // create SDO @@ -638,11 +648,10 @@ StatusCode sTgcFastDigitizer::execute() { if( msgLvl(MSG::DEBUG) ){ std::map<Identifier,int>::const_iterator hit = hitsPerChannel.begin(); std::map<Identifier,int>::const_iterator hit_end = hitsPerChannel.end(); - msg(MSG::DEBUG) << " number of channels with hit " << hitsPerChannel.size() << " nhits " << nhits << std::endl; + ATH_MSG_DEBUG(" number of channels with hit " << hitsPerChannel.size() << " nhits " << nhits); for( ;hit!=hit_end;++hit ){ - msg(MSG::DEBUG) << " " << m_idHelperTool->toString(hit->first) << " -> " << hit->second << std::endl; + ATH_MSG_DEBUG(" " << m_idHelperSvc->toString(hit->first) << " -> " << hit->second); } - msg(MSG::DEBUG) << endmsg; } std::string key = "STGC_Measurements"; ATH_MSG_DEBUG(" Done! Total number of sTgc chambers with PRDS: " << prdContainer->numberOfCollections() << " key " << key); @@ -654,11 +663,9 @@ StatusCode sTgcFastDigitizer::execute() { } StatusCode sTgcFastDigitizer::finalize() { - //m_ntuple_SimHit->Write(); m_ntuple->Write(); m_file->Write(); m_file->Close(); - return StatusCode::SUCCESS; } @@ -668,12 +675,11 @@ double sTgcFastDigitizer::getResolution(float inAngle_space) const { // 0 degree --> 0.18mm; 10 degree --> const int NIndex = 2; - //double Reso[NIndex] = {0.18, 0.20, 0.24}; double Reso[NIndex] = {0.06, 0.30}; double Angle[NIndex] = {0., 60.}; int index = 1; - inAngle_space = fabs(inAngle_space); + inAngle_space = std::abs(inAngle_space); while(index<NIndex && inAngle_space>Angle[index]){ index++; } @@ -776,17 +782,16 @@ bool sTgcFastDigitizer::readFileOfTimeJitter() while(ifs.good()){ ifs >> angle >> bins; if (ifs.eof()) break; - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): Timejitter, angle, Number of bins, prob. dist.: " << angle << " " << bins << " "; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE("readFileOfTimeJitter(): Timejitter, angle, Number of bins, prob. dist.: " << angle << " " << bins << " "); m_vecAngle_Time.resize(i + 1); for (int j = 0; j < 41/*bins*/; j++) { ifs >> prob; m_vecAngle_Time[i].push_back(prob); if( msgLvl(MSG::VERBOSE) ){ - if( j == 0) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): "; - msg(MSG::VERBOSE) << prob << " "; + if( j == 0) ATH_MSG_VERBOSE("readFileOfTimeJitter(): "); + ATH_MSG_VERBOSE(prob << " "); } } - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << endmsg; i++; } ifs.close(); diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.h b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.h index 0b8ad55ed7452d32ef7f812c0a08ccb48419d4a8..ef8c6fa591aff5d8b15f30d6629e0fa89afe30f8 100644 --- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.h +++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.h @@ -1,33 +1,29 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONDIGITIZATION_sTgcFASTDIGITIZER_H #define MUONDIGITIZATION_sTgcFASTDIGITIZER_H -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "StoreGate/StoreGateSvc.h" #include "StoreGate/WriteHandleKey.h" - -//Random #include "CLHEP/Random/RandomEngine.h" #include "AthenaKernel/IAtRndmGenSvc.h" #include "CLHEP/Random/RandGauss.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" class TTree; class TFile; -class sTgcIdHelper; namespace MuonGM { class MuonDetectorManager; } -class IAtRndmGenSvc; -class ActiveStoreSvc; class MuonSimDataCollection; class sTgcFastDigitizer : public AthAlgorithm { @@ -35,7 +31,7 @@ class sTgcFastDigitizer : public AthAlgorithm { public: sTgcFastDigitizer(const std::string& name, ISvcLocator* pSvcLocator); - ~sTgcFastDigitizer(); + ~sTgcFastDigitizer()=default; StatusCode initialize(); StatusCode execute(); @@ -46,12 +42,10 @@ class sTgcFastDigitizer : public AthAlgorithm { private: const MuonGM::MuonDetectorManager* m_detManager; - const sTgcIdHelper* m_idHelper; int m_channelTypes; // 1 -> strips, 2 -> strips+wires, 3 -> strips/wires/pads TFile* m_file; - //TTree* m_ntuple_SimHit; TTree* m_ntuple; float m_dlx; // local position simhit in GeoModel frame float m_dly; @@ -116,12 +110,11 @@ class sTgcFastDigitizer : public AthAlgorithm { /** Reads parameters for intrinsic time response from timejitter.dat. */ - bool readFileOfTimeJitter(); - bool m_mergePrds; - + bool readFileOfTimeJitter(); + bool m_mergePrds; protected: - ToolHandle <Muon::MuonIdHelperTool> m_idHelperTool; // IdHelperTool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle <Muon::IMuonClusterOnTrackCreator> m_muonClusterCreator; ServiceHandle <IAtRndmGenSvc> m_rndmSvc; // Random number service CLHEP::HepRandomEngine *m_rndmEngine; // Random number engine used - not init in SiDigitization @@ -137,7 +130,6 @@ class sTgcFastDigitizer : public AthAlgorithm { double m_energyDepositThreshold; bool m_checkIds; std::vector<std::vector<float> > m_vecAngle_Time; - }; #endif // MUONDIGITIZATION_sTgcDIGITIZER_H diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx index 8b4b770650b452a51a307b1b643908002f2c7594..83e62ecae4c011e17d55f21736a8dad8db1006a9 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx @@ -1,23 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////////////////// -//----------------------------------------------------- -// sTgcDigitMaker.cxx -//----------------------------------------------------- -// -// Authors: Nectarios Benekos <nectarios.benekos@cern.ch> -// Jiaming Yu <jiaming.yu@cern.ch> -//////////////////////////////////////////////////////////////////////////////// - - - #include "sTGC_Digitization/sTgcDigitMaker.h" -#include <iostream> -#include <fstream> - #include "MuonDigitContainer/sTgcDigitCollection.h" #include "MuonSimEvent/sTGCSimHit.h" #include "MuonSimEvent/sTgcHitIdHelper.h" @@ -27,10 +13,8 @@ #include "MuonReadoutGeometry/sTgcReadoutElement.h" #include "TrkEventPrimitives/LocalDirection.h" #include "TrkSurfaces/Surface.h" - #include "GaudiKernel/MsgStream.h" #include "PathResolver/PathResolver.h" - #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/RandFlat.h" @@ -40,6 +24,8 @@ #include "TF1.h" #include <cmath> +#include <iostream> +#include <fstream> //--------------------------------------------------- // Constructor and Destructor @@ -133,7 +119,7 @@ sTgcDigitCollection* sTgcDigitMaker::executeDigi(const sTGCSimHit* hit, const fl if(energyDeposit==0.) return 0; ////////// convert ID for this digitizer system - sTgcSimIdToOfflineId simToOffline(*m_idHelper); + sTgcSimIdToOfflineId simToOffline(m_idHelper); int simId = hit->sTGCId(); Identifier layid = simToOffline.convert(simId); ATH_MSG_VERBOSE("sTgc hit: time " << hit->globalTime() << " position " << hit->globalPosition().x() << " " << hit->globalPosition().y() << " " << hit->globalPosition().z() << " mclink " << hit->particleLink() << " PDG ID " << hit->particleEncoding() ); diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx index 36b207538b8f12df4ebd7db8c9c43f1c63d07b56..2d3c42d5d3a61554d6f7345a93cdf24ad4a26570 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx @@ -439,7 +439,7 @@ StatusCode sTgcDigitizationTool::doDigitization(const EventContext& ctx) { else { msg(MSG::DEBUG) << "This hit came from the in time bunch." << endmsg; } - sTgcSimIdToOfflineId simToOffline(m_idHelperSvc->stgcIdHelper()); + sTgcSimIdToOfflineId simToOffline(&m_idHelperSvc->stgcIdHelper()); const int idHit = hit.sTGCId(); ATH_MSG_VERBOSE("Hit ID " << idHit ); Identifier layid = simToOffline.convert(idHit); diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h index f996f5e7e21901f0673bfff3b62b255aa81a1016..add78c6b2ff6f18f77d8a33430a8bfa74d64def9 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h @@ -29,7 +29,7 @@ public: // build the geometry virtual StatusCode create() override final; - StatusCode createFactory(MuonGM::MuonDetectorFactory001& theFactory); + StatusCode createFactory(MuonGM::MuonDetectorFactory001& theFactory) const; // Dereference tree tops and drop readout objects virtual StatusCode clear() override final; diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx index 3012ee2731ba4fd4ef1b4cb567e218c4ff4f77af..2ba1565873d0e82c5822f7f75b1ca238749c8b48 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx @@ -73,7 +73,7 @@ StatusCode MuonDetectorCondAlg::execute() // ======================= // Create the MuonDetectorManager by calling the MuonDetectorFactory001 // ======================= - MuonDetectorTool* MuDetTool = m_iGeoModelTool.get(); + const MuonDetectorTool* MuDetTool = m_iGeoModelTool.get(); MuonGM::MuonDetectorFactory001 theFactory(detStore().operator->()); if(MuDetTool->createFactory(theFactory).isFailure()){ ATH_MSG_FATAL("unable to create MuonDetectorFactory001 "); diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx index 1d090b1276595b9e8c2181bd95eb765c04f12f00..0f500c9f41172c7583a15b7c50e86a92df78788a 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx @@ -620,7 +620,7 @@ namespace MuonGM { } mst->setTransform(xf); - GeoTrf::Transform3D tsz_to_szt = GeoTrf::RotateZ3D(-90*CLHEP::deg)*GeoTrf::RotateY3D(-90*CLHEP::deg); + GeoTrf::Transform3D tsz_to_szt = GeoTrf::RotateZ3D(-90*Gaudi::Units::degree)*GeoTrf::RotateY3D(-90*Gaudi::Units::degree); mst->setNativeToAmdbLRS( Amg::EigenTransformToCLHEP(tsz_to_szt * station->native_to_tsz_frame( (*pit).second )) diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx index cd0d59d0b4d796b67f0555f2f11bce62e2b7a2f7..5e5cfb4812433f8752d4e842a53d8c1c14fc4bd6 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx @@ -155,7 +155,8 @@ MuonDetectorTool::create() GeoModelExperiment* theExpt = nullptr; ATH_CHECK( detStore()->retrieve( theExpt, "ATLAS" ) ); theExpt->addManager(theFactory.getDetectorManager()); - + + m_manager = theFactory.getDetectorManager(); } if (m_dumpMemoryBreakDown) @@ -182,7 +183,7 @@ MuonDetectorTool::create() } StatusCode -MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) +MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) const { std::ofstream geoModelStats; @@ -226,6 +227,7 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) std::string detectorNode = MuonVersion.empty() ? "ATLAS" : "MuonSpectrometer"; ATH_MSG_INFO("Keys for Muon Switches are (key) " << detectorKey << " (node) " << detectorNode ); + std::string tempLayout = m_layout; std::map<std::string,std::string> altAsciiDBMap = std::map<std::string,std::string>(); if ( MuonVersion == "CUSTOM" ) ATH_MSG_WARNING("Detector Information coming from a custom configuration !!" ); @@ -238,7 +240,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) if ((*switchSet).size()==0) return StatusCode::FAILURE; const IRDBRecord *switches = (*switchSet)[0]; - m_layout = switches->getString("LAYOUTNAME"); + // m_layout = switches->getString("LAYOUTNAME"); + tempLayout = switches->getString("LAYOUTNAME"); // m_includeInertMaterials = switches->getInt("BUILDINERTMATERIALS"); // m_minimalgeo = switches->getInt("MINIMALGEO"); if (MuonVersion == "") { @@ -262,10 +265,12 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) // GeoModelExperiment* theExpt = nullptr; ATH_CHECK( detStore()->retrieve( theExpt, "ATLAS" ) ); - - if (!m_useCscIntAlines) m_controlCscIntAlines = 0; + + int tempControlCscIntAlines= m_controlCscIntAlines; + if (!m_useCscIntAlines) tempControlCscIntAlines = 0; ATH_MSG_INFO("Properties have been set as follows: " <<endmsg - <<" LayoutName "<< m_layout.substr(0,1) <<endmsg + // <<" LayoutName "<< m_layout.substr(0,1) <<endmsg + <<" LayoutName "<< tempLayout.substr(0,1) <<endmsg <<" IncludeCutouts "<< m_includeCutouts <<endmsg <<" IncludeCutoutsBog "<< m_includeCutoutsBog <<endmsg <<" IncludeCtbBis "<< m_includeCtbBis <<endmsg @@ -273,8 +278,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) <<" MinimalGeoFlag "<< m_minimalGeoFlag <<endmsg <<" EnableCscIntAlignment "<< m_useCscIntAlines <<endmsg <<" EnableCscIntAlignmentFromGM "<< m_useCscIntAlinesFromGM ); - if (m_useCscIntAlines) ATH_MSG_INFO(" ControlCscIntAlines "<< m_controlCscIntAlines ); - else ATH_MSG_INFO(" ControlCscIntAlines reset to "<< m_controlCscIntAlines ); + if (m_useCscIntAlines) ATH_MSG_INFO(" ControlCscIntAlines "<< tempControlCscIntAlines ); + else ATH_MSG_INFO(" ControlCscIntAlines reset to "<< tempControlCscIntAlines ); ATH_MSG_INFO(" EnableMdtDeformations "<< m_enableMdtDeformations ); ATH_MSG_INFO(" EnableMdtAsBuiltParameters "<< m_enableMdtAsBuiltParameters ); @@ -326,7 +331,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) theFactory.setABLinesAsciiSideA(m_NSWABLinesAsciiSideA); theFactory.setABLinesAsciiSideC(m_NSWABLinesAsciiSideC); - theFactory.setLayout(m_layout); + // theFactory.setLayout(m_layout); + theFactory.setLayout(tempLayout); //theFactory.setIncludeInertMats(m_includeInertMaterials); //theFactory.setIdhFromCnv(m_idhfromconverters); //theFactory.setMinimalGeoFlag(m_minimalgeo); @@ -335,8 +341,8 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) theFactory.setCtbBisFlag(m_includeCtbBis); theFactory.setControlAlines(m_controlAlines); theFactory.setMinimalGeoFlag(m_minimalGeoFlag); - if (!m_useCscIntAlines) m_controlCscIntAlines = 0; - theFactory.setControlCscIntAlines(m_controlCscIntAlines); + if (!m_useCscIntAlines) tempControlCscIntAlines = 0; + theFactory.setControlCscIntAlines(tempControlCscIntAlines); theFactory.setDumpMemoryBreakDown(m_dumpMemoryBreakDown); theFactory.setCachingFlag(m_cachingFlag); theFactory.setCacheFillingFlag(m_fillCache_initTime); @@ -375,20 +381,20 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) cpu = ucpu; } // Register the MuonDetectorNode instance with the Transient Detector Store - m_manager = theFactory.getDetectorManager(); + MuonGM::MuonDetectorManager* theManager = theFactory.getDetectorManager(); //Init ABline historical container --- will write there A/B lines from ORACLE / ascii file if any - m_manager->initABlineContainers(); - if ((m_manager->initCSCInternalAlignmentMap()).isFailure()) return StatusCode::FAILURE; // does nothing other then checking the size (map is built while reading data from the primary source) + theManager->initABlineContainers(); + if ((theManager->initCSCInternalAlignmentMap()).isFailure()) return StatusCode::FAILURE; // does nothing other then checking the size (map is built while reading data from the primary source) if (m_fillCache_initTime) { - m_manager->fillCache(); + theManager->fillCache(); } else { // cache for RPC / TGC / CSC must be filled once forever - m_manager->fillRpcCache(); - m_manager->fillTgcCache(); - m_manager->fillCscCache(); + theManager->fillRpcCache(); + theManager->fillTgcCache(); + theManager->fillCscCache(); } diff --git a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonHitRelocation.h b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonHitRelocation.h index 625fcc769fd4f2573ef2940549721fde0bd7dcff..875880c81cb1dd6c85b548ca0b1c82f71250ad56 100644 --- a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonHitRelocation.h +++ b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonHitRelocation.h @@ -12,23 +12,19 @@ #include "MuonSimEvent/TgcHitIdHelper.h" #include "MuonSimEvent/CscHitIdHelper.h" #include "MuonSimEvent/sTgcHitIdHelper.h" -#include "MuonSimEvent/sTgcSimIdToOfflineId.h" -#include "MuonSimEvent/MM_SimIdToOfflineId.h" #include "MuonSimEvent/MicromegasHitIdHelper.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" // Histograms quantities related to G4 Hits in the Atlas // Detector. Used to validate GeoModel + much more. - class MuonHitRelocation: public AthAlgorithm { public: MuonHitRelocation(const std::string& name, ISvcLocator* pSvcLocator); ~MuonHitRelocation(); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); + StatusCode initialize(); + StatusCode execute(); long getIntStName(std::string stName) const; private: diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonHitRelocation.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonHitRelocation.cxx index 97e4e01a4a952be4b86900aa28da1d45a74040b7..d6c7ad5c1b7781ee1bd0ea471037e16c599cddac 100644 --- a/MuonSpectrometer/MuonGeoModelTest/src/MuonHitRelocation.cxx +++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonHitRelocation.cxx @@ -566,13 +566,6 @@ StatusCode MuonHitRelocation::execute() { //------------------------------------------------------------------------------------------------------- return StatusCode::SUCCESS; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode MuonHitRelocation::finalize() { - - ATH_MSG_INFO( "GOODBYE from MuonHitRelocation" ); - return StatusCode::SUCCESS; -} long MuonHitRelocation::getIntStName(std::string stName) const { diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h index 5045355317916dd667ae39d4f35c3169063d515a..c531fd182a88a587ef03860b5cc6d692c52f2871 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h @@ -144,6 +144,12 @@ namespace Muon { /** @brief Return stationEta for all technologies */ virtual int stationEta( const Identifier& id ) const = 0; + /** @brief Return stationName for all technologies */ + virtual int stationName( const Identifier& id ) const = 0; + + /** @brief Return stationRegion for all technologies */ + virtual int stationRegion( const Identifier& id ) const = 0; + /** @brief return sector number 1-16, odd=large, even=small */ virtual int sector( const Identifier& id ) const = 0; diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MmIdHelper.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MmIdHelper.h index fea3aa6966aa9348177fc01a116af832fe900cc2..eefe12e029c6793b7f75185201da4b12be41cfb3 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MmIdHelper.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MmIdHelper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ****************************************************************************** @@ -60,7 +60,7 @@ class MmIdHelper : public MuonIdHelper { MmIdHelper(); // Destructor - virtual ~MmIdHelper(); + virtual ~MmIdHelper()=default; ///////////// compact identifier stuff begins ////////////////////////////////////// diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h index 9f762a4de632d87fa7c64ce8973fd177e37bdeed..b399d108ece997a8b1a1fb65b09126e466a9fa1f 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h @@ -27,7 +27,7 @@ namespace Muon { MuonIdHelperSvc(const std::string& name, ISvcLocator* svc); /** @brief destructor */ - virtual ~MuonIdHelperSvc() override; + virtual ~MuonIdHelperSvc() override=default; /** @brief AlgTool initilize */ virtual StatusCode initialize() override; @@ -146,6 +146,12 @@ namespace Muon { /** @brief Return stationEta for all technologies */ virtual int stationEta( const Identifier& id ) const override; + /** @brief Return stationName for all technologies */ + virtual int stationName( const Identifier& id ) const override; + + /** @brief Return stationRegion for all technologies */ + virtual int stationRegion( const Identifier& id ) const override; + /** @brief return sector number 1-16, odd=large, even=small */ virtual int sector( const Identifier& id ) const override; diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperTool.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperTool.h deleted file mode 100644 index a5c8dc9e974592df16e7b212a5309f43df26bb4c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperTool.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUON_MUONIDHELPERTOOL_H -#define MUON_MUONIDHELPERTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" - -#include <string> - -static const InterfaceID IID_MuonIdHelperTool("Muon::MuonIdHelperTool",1,0); - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" - -class MsgStream; - -namespace Muon { - - /** - @brief Helper tool that acts as a proxy to IMuonIdHelperSvc to facilitate migration from public tool to service - - */ - class MuonIdHelperTool : public AthAlgTool { - public: - /** @brief constructor */ - MuonIdHelperTool(const std::string&,const std::string&,const IInterface*); - - /** @brief destructor */ - ~MuonIdHelperTool (); - - /** @brief AlgTool initilize */ - StatusCode initialize(); - - /** @brief AlgTool finalize */ - StatusCode finalize(); - - /** @brief access to tool interface */ - static const InterfaceID& interfaceID() { return IID_MuonIdHelperTool; } - - /** @brief print all fields to string */ - std::string toString( const Identifier& id ) const { return m_muonIdHelperSvc->toString(id); } - - /** @brief print all fields up to technology to string */ - std::string toStringTech( const Identifier& id ) const { return m_muonIdHelperSvc->toStringTech(id); } - - /** @brief print all fields up to stationName to string */ - std::string toStringStation( const Identifier& id ) const { return m_muonIdHelperSvc->toStringStation(id); } - - /** @brief print all fields up to chamber to string */ - std::string toStringChamber( const Identifier& id ) const { return m_muonIdHelperSvc->toStringChamber(id); } - - /** @brief print all fields up to detector element to string */ - std::string toStringDetEl( const Identifier& id ) const { return m_muonIdHelperSvc->toStringDetEl(id); } - - /** @brief print all fields up to gas gap to string */ - std::string toStringGasGap( const Identifier& id ) const { return m_muonIdHelperSvc->toStringGasGap(id); } - - /** @brief print chamber name to string */ - std::string chamberNameString( const Identifier& id ) const { return m_muonIdHelperSvc->chamberNameString(id); } - - /** @brief returns whether this is a Muon Identifier or not */ - bool isMuon( const Identifier& id ) const { return m_muonIdHelperSvc->isMuon(id); } - - /** @brief returns whether this is a MDT Identifier or not */ - bool isMdt( const Identifier& id ) const { return m_muonIdHelperSvc->isMdt(id); } - - /** @brief returns whether this is a MM Identifier or not */ - bool isMM( const Identifier& id ) const { return m_muonIdHelperSvc->isMM(id); } - - /** @brief returns whether this is a CSC Identifier or not */ - bool isCsc( const Identifier& id ) const { return m_muonIdHelperSvc->isCsc(id); } - - /** @brief returns whether this is a RPC Identifier or not */ - bool isRpc( const Identifier& id ) const { return m_muonIdHelperSvc->isRpc(id); } - - /** @brief returns whether this is a TGC Identifier or not */ - bool isTgc( const Identifier& id ) const { return m_muonIdHelperSvc->isTgc(id); } - - /** @brief returns whether this is a sTGC Identifier or not */ - bool issTgc( const Identifier& id ) const { return m_muonIdHelperSvc->issTgc(id); } - - /** @brief returns whether channel measures phi or not */ - bool measuresPhi( const Identifier& id ) const { return m_muonIdHelperSvc->measuresPhi(id); } - - /** @brief returns whether this is an endcap Identifier or not */ - bool isEndcap( const Identifier& id ) const { return m_muonIdHelperSvc->isEndcap(id); } - - /** @brief returns whether trigger chamber id or not */ - bool isTrigger( const Identifier& id ) const { return m_muonIdHelperSvc->isTrigger(id); } - - /** @brief returns whether this is a small chamber, always returns true for TGCs */ - bool isSmallChamber( const Identifier& id ) const { return m_muonIdHelperSvc->isSmallChamber(id); } - - /** @brief returns gas gap: gasGap for RPC + TGC, wireLayer for CSC, tube for MDT */ - int gasGap( const Identifier& id ) const { return m_muonIdHelperSvc->gasGap(id); } - - /** @brief create a chamber ID */ - Identifier chamberId( const Identifier& id) const { return m_muonIdHelperSvc->chamberId(id); } - - /** @brief create a detector element ID */ - Identifier detElId( const Identifier& id) const { return m_muonIdHelperSvc->detElId(id); } - - /** @brief create a gasGap ID (will return layer Id for MDTs) */ - Identifier gasGapId( const Identifier& id) const { return m_muonIdHelperSvc->gasGapId(id); } - - /** @brief create a layer ID, returns tube id for the MDTs */ - Identifier layerId( const Identifier& id) const { return m_muonIdHelperSvc->layerId(id); } - - /** @brief access to MdtIdHelper */ - const MdtIdHelper& mdtIdHelper() const { return m_muonIdHelperSvc->mdtIdHelper(); } - - /** @brief Test presence of MdtIdHelper */ - bool hasMdtIdHelper() const { return m_muonIdHelperSvc->hasMDT(); } - - /** @brief access to RpcIdHelper */ - const RpcIdHelper& rpcIdHelper() const { return m_muonIdHelperSvc->rpcIdHelper(); } - - /** @brief Test presence of RpcIdHelper */ - bool hasRpcIdHelper() const { return m_muonIdHelperSvc->hasRPC(); } - - /** @brief access to TgcIdHelper */ - const TgcIdHelper& tgcIdHelper() const { return m_muonIdHelperSvc->tgcIdHelper(); } - - /** @brief Test presence of TgcIdHelper */ - bool hasTgcIdHelper() const { return m_muonIdHelperSvc->hasTGC(); } - - /** @brief access to CscIdHelper */ - const CscIdHelper& cscIdHelper() const { return m_muonIdHelperSvc->cscIdHelper(); } - - /** @brief Test presence of CscIdHelper */ - bool hasCscIdHelper() const { return m_muonIdHelperSvc->hasCSC(); } - - /** @brief access to sTgcIdHelper */ - const sTgcIdHelper& stgcIdHelper() const { return m_muonIdHelperSvc->stgcIdHelper(); } - - /** @brief Test presence of sTgcIdHelper */ - bool hasSTgcIdHelper() const { return m_muonIdHelperSvc->hasSTgc(); } - - /** @brief access to CscIdHelper */ - const MmIdHelper& mmIdHelper() const { return m_muonIdHelperSvc->mmIdHelper(); } - - /** @brief Test presence of sTgcIdHelper */ - bool hasMmIdHelper() const { return m_muonIdHelperSvc->hasMM(); } - - /** @brief calculate chamber index from Identifier */ - MuonStationIndex::ChIndex chamberIndex( const Identifier& id ) const { return m_muonIdHelperSvc->chamberIndex(id); } - - /** @brief calculate station index from Identifier */ - MuonStationIndex::StIndex stationIndex( const Identifier& id ) const { return m_muonIdHelperSvc->stationIndex(id); } - - /** @brief calculate phi index from Identifier (not supported for MDT hits) */ - MuonStationIndex::PhiIndex phiIndex( const Identifier& id ) const { return m_muonIdHelperSvc->phiIndex(id); } - - /** @brief calculate detector region index from Identifier */ - MuonStationIndex::DetectorRegionIndex regionIndex( const Identifier& id ) const { return m_muonIdHelperSvc->regionIndex(id); } - - /** @brief calculate layer index from Identifier */ - MuonStationIndex::LayerIndex layerIndex( const Identifier& id ) const { return m_muonIdHelperSvc->layerIndex(id); } - - /** @brief calculate layer index from Identifier */ - MuonStationIndex::TechnologyIndex technologyIndex( const Identifier& id ) const { return m_muonIdHelperSvc->technologyIndex(id); } - - /** @brief Return stationPhi for all technologies */ - int stationPhi( const Identifier& id ) const { return m_muonIdHelperSvc->stationPhi(id); } - - /** @brief Return stationEta for all technologies */ - int stationEta( const Identifier& id ) const { return m_muonIdHelperSvc->stationEta(id); } - - /** @brief return sector number 1-16, odd=large, even=small */ - int sector( const Identifier& id ) const { return m_muonIdHelperSvc->sector(id); } - - bool hasRPC() const { return m_muonIdHelperSvc->hasRPC(); } - bool hasTGC() const { return m_muonIdHelperSvc->hasTGC(); } - bool hasMDT() const { return m_muonIdHelperSvc->hasMDT(); } - bool hasCSC() const { return m_muonIdHelperSvc->hasCSC(); } - bool hasSTgc() const { return m_muonIdHelperSvc->hasSTgc(); } - bool hasMM() const { return m_muonIdHelperSvc->hasMM(); } - - private: - ServiceHandle<Muon::IMuonIdHelperSvc> m_muonIdHelperSvc{this, "idHelper", - "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "Handle to the service providing the IMuonIdHelperSvc interface"}; - }; - -} - -#endif // MUON_IDHELPERTOOL_H diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/sTgcIdHelper.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/sTgcIdHelper.h index cb6bbf1bfc2eabebe917a1e0a0e3149bc8ad3e7a..c4ee0937ce708810589d9d6914378da4c5f9a8ef 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/sTgcIdHelper.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/sTgcIdHelper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ****************************************************************************** @@ -61,7 +61,7 @@ class sTgcIdHelper : public MuonIdHelper { sTgcIdHelper(); // Destructor - virtual ~sTgcIdHelper(); + virtual ~sTgcIdHelper()=default; ///////////// compact identifier stuff begins ////////////////////////////////////// diff --git a/MuonSpectrometer/MuonIdHelpers/src/MmIdHelper.cxx b/MuonSpectrometer/MuonIdHelpers/src/MmIdHelper.cxx index 40bacdf2545c2e4e39e30463452ed804d11c1e5c..7dc505a6a8e0390e7a444928fae4d24318c6caec 100644 --- a/MuonSpectrometer/MuonIdHelpers/src/MmIdHelper.cxx +++ b/MuonSpectrometer/MuonIdHelpers/src/MmIdHelper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -22,11 +22,6 @@ MmIdHelper::MmIdHelper() : MuonIdHelper("MmIdHelper") { m_GASGAP_INDEX = 6; } /*******************************************************************************/ -// Destructor -MmIdHelper::~MmIdHelper() { - // m_Log deleted in base class. -} -/*******************************************************************************/ // Initialize dictionary int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) { int status = 0; @@ -594,7 +589,6 @@ bool MmIdHelper::valid(const Identifier& id) const { return false; } - // int station = stationName(id); int gasG = gasGap(id); if (gasG < gasGapMin(id) || gasG > gasGapMax(id)) { (*m_Log) << MSG::WARNING diff --git a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx index 956d69879fa7cdcf8c12d81ef7aaaaace368d2e4..4eb6527c9d1fb434e74104b6fd4aa72db76be7df 100644 --- a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx +++ b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -14,10 +14,6 @@ namespace Muon { { } - - MuonIdHelperSvc::~MuonIdHelperSvc(){} - - StatusCode MuonIdHelperSvc::initialize() { ATH_CHECK( m_detStore.retrieve() ); @@ -669,6 +665,48 @@ namespace Muon { return 0; } + int MuonIdHelperSvc::stationName( const Identifier& id ) const { + if( !id.is_valid() ) { + ATH_MSG_WARNING("stationName: invalid ID"); + return 0; + } + if( isRpc(id) ) { + return m_rpcIdHelper->stationName(id); + }else if( isTgc(id) ) { + return m_tgcIdHelper->stationName(id); + }else if( isMdt(id) ){ + return m_mdtIdHelper->stationName(id); + }else if( isCsc(id) ){ + return m_cscIdHelper->stationName(id); + }else if( issTgc(id) ){ + return m_stgcIdHelper->stationName(id); + }else if( isMM(id) ){ + return m_mmIdHelper->stationName(id); + } + return 0; + } + + int MuonIdHelperSvc::stationRegion( const Identifier& id ) const { + if( !id.is_valid() ) { + ATH_MSG_WARNING("stationRegion: invalid ID"); + return 0; + } + if( isRpc(id) ) { + return m_rpcIdHelper->stationRegion(id); + }else if( isTgc(id) ) { + return m_tgcIdHelper->stationRegion(id); + }else if( isMdt(id) ){ + return m_mdtIdHelper->stationRegion(id); + }else if( isCsc(id) ){ + return m_cscIdHelper->stationRegion(id); + }else if( issTgc(id) ){ + return m_stgcIdHelper->stationRegion(id); + }else if( isMM(id) ){ + return m_mmIdHelper->stationRegion(id); + } + return 0; + } + int MuonIdHelperSvc::sector( const Identifier& id ) const { // TGC has different segmentation, return 0 for the moment if( isTgc(id) ) { diff --git a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperTool.cxx b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperTool.cxx deleted file mode 100644 index aa65ffa3a8e3877c3e23ee854fc500de6066aa88..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperTool.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonIdHelpers/MuonIdHelperTool.h" - -namespace Muon { - - MuonIdHelperTool::MuonIdHelperTool(const std::string& ty,const std::string& na,const IInterface* pa) - : AthAlgTool(ty,na,pa) - { - declareInterface<MuonIdHelperTool>(this); - } - - MuonIdHelperTool::~MuonIdHelperTool() - { - } - - - StatusCode MuonIdHelperTool::initialize() - { - ATH_CHECK(m_muonIdHelperSvc.retrieve()); - return StatusCode::SUCCESS; - } - - StatusCode MuonIdHelperTool::finalize() - { - if( AthAlgTool::finalize().isFailure() ) return StatusCode::FAILURE; - return StatusCode::SUCCESS; - } -} diff --git a/MuonSpectrometer/MuonIdHelpers/src/components/MuonIdHelpers_entries.cxx b/MuonSpectrometer/MuonIdHelpers/src/components/MuonIdHelpers_entries.cxx index fce2ba2907060d761561acb539bf58c1b09db44e..839cc80e2e19c0ba579c9e2d041ea9d019b7f4a5 100644 --- a/MuonSpectrometer/MuonIdHelpers/src/components/MuonIdHelpers_entries.cxx +++ b/MuonSpectrometer/MuonIdHelpers/src/components/MuonIdHelpers_entries.cxx @@ -1,11 +1,6 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ #include "MuonIdHelpers/MuonIdHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - - - - -using namespace Muon; - -DECLARE_COMPONENT( MuonIdHelperSvc ) -DECLARE_COMPONENT( MuonIdHelperTool ) +DECLARE_COMPONENT( Muon::MuonIdHelperSvc ) diff --git a/MuonSpectrometer/MuonIdHelpers/src/sTgcIdHelper.cxx b/MuonSpectrometer/MuonIdHelpers/src/sTgcIdHelper.cxx index 418151eaddf898548bc274ec4ec9ed6799733b84..e4e08b5ec53391625bb8a12caaad6e38e617df5d 100644 --- a/MuonSpectrometer/MuonIdHelpers/src/sTgcIdHelper.cxx +++ b/MuonSpectrometer/MuonIdHelpers/src/sTgcIdHelper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -24,11 +24,6 @@ sTgcIdHelper::sTgcIdHelper() : MuonIdHelper("sTgcIdHelper") { m_CHANNELTYPE_INDEX = 7; } /*******************************************************************************/ -// Destructor -sTgcIdHelper::~sTgcIdHelper() { - // m_Log deleted in base class. -} -/*******************************************************************************/ // Initialize dictionary int sTgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) { int status = 0; @@ -672,8 +667,7 @@ bool sTgcIdHelper::valid(const Identifier& id) const { << endmsg; return false; } - - // int station = stationName(id); + int gasG = gasGap(id); if (gasG < gasGapMin(id) || gasG > gasGapMax(id)) { (*m_Log) << MSG::WARNING diff --git a/MuonSpectrometer/MuonIdHelpers/test/muon_id_test.cxx b/MuonSpectrometer/MuonIdHelpers/test/muon_id_test.cxx index 8e1b0d3ad2628cb772c033fa4cf0225e82a7da40..faafa5e26d1d730e38f5cc0702c16641a7c2b7af 100644 --- a/MuonSpectrometer/MuonIdHelpers/test/muon_id_test.cxx +++ b/MuonSpectrometer/MuonIdHelpers/test/muon_id_test.cxx @@ -1,15 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifdef ROOTCORE - -int main() { return 0; } - -#else - #include "IdDictParser/IdDictParser.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/CscIdHelper.h" +#include "MuonIdHelpers/MdtIdHelper.h" +#include "MuonIdHelpers/MmIdHelper.h" +#include "MuonIdHelpers/RpcIdHelper.h" +#include "MuonIdHelpers/sTgcIdHelper.h" +#include "MuonIdHelpers/TgcIdHelper.h" #include "GaudiKernel/System.h" #include <iostream> @@ -182,5 +181,3 @@ int main () return 0; } - -#endif // ROOTCORE diff --git a/MuonSpectrometer/MuonOverlay/CscOverlay/CscOverlay/CscOverlay.h b/MuonSpectrometer/MuonOverlay/CscOverlay/CscOverlay/CscOverlay.h index 7012d0fdfefcdfed2f71df86136933bec3f3d526..2788cf0e3d431010c9c404be7c033b39553e6aba 100644 --- a/MuonSpectrometer/MuonOverlay/CscOverlay/CscOverlay/CscOverlay.h +++ b/MuonSpectrometer/MuonOverlay/CscOverlay/CscOverlay/CscOverlay.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Overlaying RDOs from two different events for InDet subdetectors. @@ -11,25 +11,20 @@ #ifndef CSCOVERLAY_CSCOVERLAY_H #define CSCOVERLAY_CSCOVERLAY_H - -#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" #include "MuonRDO/CscRawDataContainer.h" - #include "CscCalibTools/ICscCalibTool.h" #include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" - #include "AthenaKernel/IAthRNGSvc.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <vector> #include <string> #include <map> -class CscIdHelper; - namespace CLHEP { class HepRandomEngine; } @@ -94,8 +89,7 @@ private: SG::WriteHandleKey<CscRawDataContainer> m_outputKey{this,"OutputKey","CSCRDO",""}; Gaudi::Property<bool> m_isDataOverlay{this, "isDataOverlay", false, ""}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<ICscCalibTool> m_cscCalibTool{this, "CalibTool", "CscCalibTool", ""}; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool{this, "CscRdoDecoderTool", "Muon::CscRDO_Decoder", ""}; diff --git a/MuonSpectrometer/MuonOverlay/CscOverlay/src/CscOverlay.cxx b/MuonSpectrometer/MuonOverlay/CscOverlay/src/CscOverlay.cxx index 65f99441a7705599d4bb818500762d8226f5470f..74304be5f72f1cb05f4e52cd398fcccb5f31f82f 100644 --- a/MuonSpectrometer/MuonOverlay/CscOverlay/src/CscOverlay.cxx +++ b/MuonSpectrometer/MuonOverlay/CscOverlay/src/CscOverlay.cxx @@ -1,14 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscOverlay/CscOverlay.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" - -#include "MuonIdHelpers/CscIdHelper.h" - #include "AthenaKernel/RNGWrapper.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/RandGauss.h" @@ -19,18 +16,13 @@ namespace { //================================================================ CscOverlay::CscOverlay(const std::string &name, ISvcLocator *pSvcLocator) : - AthReentrantAlgorithm(name, pSvcLocator) -{ + AthReentrantAlgorithm(name, pSvcLocator) { } //================================================================ -StatusCode CscOverlay::initialize() -{ +StatusCode CscOverlay::initialize() { ATH_MSG_DEBUG("CscOverlay initialized"); - - /** access to the CSC Identifier helper */ - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_MSG_DEBUG(" Found the MuonIdHelperTool. "); + ATH_CHECK(m_idHelperSvc.retrieve()); /** CSC calibratin tool for the Condtiions Data base access */ ATH_CHECK(m_cscCalibTool.retrieve()); @@ -202,7 +194,7 @@ StatusCode CscOverlay::overlayContainer(const CscRawDataContainer *bkgContainer, bool good = true; for (uint16_t j = 0; j < width; ++j) { const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(rdo.get(), j); - if (!m_muonIdHelperTool->cscIdHelper().valid(channelId)) { + if (!m_idHelperSvc->cscIdHelper().valid(channelId)) { ATH_MSG_WARNING("Invalid CSC Identifier! - skipping " << channelId); good = false; break; @@ -388,7 +380,7 @@ void CscOverlay::mergeCollections(const CscRawDataCollection *bkgCollection, int stationName = ( ( address & 0x00010000) >> 16 ) + 50; int stationEta = ( ((address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1; int stationPhi = ( ( address & 0x0000E000) >> 13 ) + 1; - Identifier me= m_muonIdHelperTool->cscIdHelper().elementID(stationName,stationEta,stationPhi); + Identifier me= m_idHelperSvc->cscIdHelper().elementID(stationName,stationEta,stationPhi); ATH_MSG_VERBOSE("stationName,Eta,Phi="<<stationName<<","<<stationEta<<","<<stationPhi<<" - me="<<me); bool good=true; for (unsigned int j=0; j<datum->width(); ++j) { @@ -406,10 +398,10 @@ void CscOverlay::mergeCollections(const CscRawDataCollection *bkgCollection, } } insertedstrips.insert(strip);//for checks - Identifier mechan= m_muonIdHelperTool->cscIdHelper().channelID(me,chamberLayer,wireLayer,measuresPhi,strip); + Identifier mechan= m_idHelperSvc->cscIdHelper().channelID(me,chamberLayer,wireLayer,measuresPhi,strip); ATH_MSG_VERBOSE("mechan="<<mechan); const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(datum, j); - if(!(m_muonIdHelperTool->cscIdHelper().valid(channelId))) { + if(!(m_idHelperSvc->cscIdHelper().valid(channelId))) { ATH_MSG_WARNING("Invalid CSC Identifier in merge! - skipping " << channelId ); good=false; } @@ -453,15 +445,12 @@ uint32_t CscOverlay::stripData ( const std::vector<const CscRawData*>& data, ATH_MSG_DEBUG("stripData<>() begin: gasLayer="<<gasLayer<<" spuID="<<spuID<<" isdata="<<isdata); samples.clear(); - IdContext context = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext context = m_idHelperSvc->cscIdHelper().channel_context(); uint32_t maxInt = 2147483640; uint32_t address = maxInt; hash = maxInt; - //int max = 192; - //if ( spuID == 4 || spuID == 9 ) max = 48; - /** loop over the data in the SPU */ std::vector<const CscRawData*>::const_iterator idata = data.begin(); std::vector<const CscRawData*>::const_iterator edata = data.end(); @@ -471,9 +460,9 @@ uint32_t CscOverlay::stripData ( const std::vector<const CscRawData*>& data, /** find the strip Identifier given the strip hash ID */ Identifier stripId; - m_muonIdHelperTool->cscIdHelper().get_id(hashOffset, stripId, &context); - unsigned int strip = static_cast<unsigned int> ( m_muonIdHelperTool->cscIdHelper().strip( stripId ) ); - int layer = m_muonIdHelperTool->cscIdHelper().wireLayer( stripId ); + m_idHelperSvc->cscIdHelper().get_id(hashOffset, stripId, &context); + unsigned int strip = static_cast<unsigned int> ( m_idHelperSvc->cscIdHelper().strip( stripId ) ); + int layer = m_idHelperSvc->cscIdHelper().wireLayer( stripId ); uint16_t width = datum->width(); /** create the map only layer by layer diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/CMakeLists.txt index b4c0254a9a419a3117b7eec85cfae8269ff23c61..6c2627437da3be7660338401915ec1f7ed625ff6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/CMakeLists.txt @@ -28,7 +28,7 @@ atlas_add_library( CscClusterizationLib src/*.cxx PUBLIC_HEADERS CscClusterization PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES GaudiKernel MuonPrepRawData MuonIdHelpersLib + LINK_LIBRARIES GaudiKernel MuonPrepRawData MuonIdHelpersLib CscCalibToolsLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps EventPrimitives MuonReadoutGeometry MuonRIO_OnTrack TrkSurfaces TrkEventPrimitives TrkRIO_OnTrack ) atlas_add_component( CscClusterization diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx index 6f769bee7270fca34a622ae13fe482fe0e00fb85..96c23ee9dea415066dec32c745a94aff9cb1b823 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx @@ -1,15 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// CalibCscStripFitter.cxx - #include "CalibCscStripFitter.h" -#include "CscCalibTools/ICscCalibTool.h" #include "MuonPrepRawData/CscStripPrepData.h" -#include "cmath" -using std::string; +#include <cmath> + using Muon::CscStripPrepData; typedef ICscStripFitter::Result Result; @@ -17,11 +14,9 @@ typedef ICscStripFitter::ChargeList ChargeList; //********************************************************************** -CalibCscStripFitter:: -CalibCscStripFitter(string type, string aname, const IInterface* parent) - : AthAlgTool(type, aname, parent),m_noiseOption(rms), +CalibCscStripFitter::CalibCscStripFitter(std::string type, std::string aname, const IInterface* parent) : + AthAlgTool(type, aname, parent),m_noiseOption(rms), m_cscCalibTool("CscCalibTool/CscCalibTool", this) { - declareInterface<ICscStripFitter>(this); declareProperty("timeError", m_terr =5.0); declareProperty("failTimeError", m_terr_fail =50.0); @@ -30,17 +25,10 @@ CalibCscStripFitter(string type, string aname, const IInterface* parent) declareProperty("noiseOption", m_noiseOptionStr="f001"); declareProperty("doCorrection", m_doCorrection=true); declareProperty("chargeErrorScaler", m_chargeErrorScaler = 1.0); - - // declareProperty("chargeError", m_qerr =5500.0); - // declareProperty("failChargeError", m_qerr_fail =5000.0); set as 4300 by multiply scaler to noise.. } //********************************************************************** -CalibCscStripFitter::~CalibCscStripFitter() { } - -//********************************************************************** - StatusCode CalibCscStripFitter::initialize() { ATH_MSG_DEBUG ( "Initializing " << name() ); @@ -78,13 +66,6 @@ StatusCode CalibCscStripFitter::initialize() { //********************************************************************** -StatusCode CalibCscStripFitter::finalize() { - ATH_MSG_VERBOSE ( "Finalizing " << name() ); - return StatusCode::SUCCESS; -} - -//********************************************************************** - Result CalibCscStripFitter::fit(const ChargeList& chgs, double period, bool samplingPhase, Identifier& stripId) const { diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h index 8a9a5b5db26fe18f058f5405e778a9cdfc68cadc..43b98f99270bd520278e1375af821859835d1f73 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// CalibCscStripFitter.h - #ifndef CalibCscStripFitter_H #define CalibCscStripFitter_H @@ -12,18 +10,16 @@ // // Strip fitter using the parabolic fit fron the CSC calibration tool. -#include <vector> +#include "CscClusterization/ICscStripFitter.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "CscClusterization/ICscStripFitter.h" -class ICscCalibTool; -class CscIdHelper; -namespace Muon { - class CscStripPrepData; -} +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "CscCalibTools/ICscCalibTool.h" +#include <vector> +#include <string> class CalibCscStripFitter : virtual public ICscStripFitter, public AthAlgTool { @@ -32,20 +28,14 @@ public: // Ctors and dtor. rms = 0, sigma, f001 }; - // Constructor. CalibCscStripFitter(std::string, std::string, const IInterface*); - // Destructor. - ~CalibCscStripFitter(); + ~CalibCscStripFitter()=default; public: // AlgTool methods - // Initialization. StatusCode initialize(); - // Finalization. - StatusCode finalize(); - public: // Interface methods // Tell compiler not to hide other fit methods. @@ -72,10 +62,8 @@ private: // data std::string m_noiseOptionStr; NoiseOption m_noiseOption; - // Pointer to MuonIdHelperSvc. ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - // Calibration tool. ToolHandle<ICscCalibTool> m_cscCalibTool; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.cxx index 399b31ed0aabd09acf93205d41751b86010da498..eeb86a61ad77eb47adfa7a6b59837e1d542cf8b2 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.cxx @@ -1,22 +1,17 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// CscSplitClusterFitter.cxx #include "CscSplitClusterFitter.h" -#include "CscClusterization/ICscClusterFitter.h" + #include "MuonPrepRawData/CscClusterStatus.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/CscIdHelper.h" #include <sstream> #include <iomanip> -using std::string; -using std::vector; using Muon::CscClusterStatus; using Muon::CscPrepData; using Muon::CscStripPrepData; @@ -29,38 +24,10 @@ typedef std::vector<Result> Results; enum CscStation { UNKNOWN_STATION, CSS, CSL }; enum CscPlane { CSS_ETA, CSL_ETA, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; -#if 0 -namespace { - string splane(CscPlane plane) { - switch(plane) { - case CSS_ETA: return "CSS eta"; - case CSL_ETA: return "CSL eta"; - case CSS_PHI: return "CSS phi"; - case CSL_PHI: return "CSL phi"; - case UNKNOWN_PLANE: return "no such plane"; - } - return "no such plane"; - } - - CscPlane findPlane(int station, bool measphi){ - if ( station == 1 ) { - if ( measphi ) return CSS_PHI; - else return CSS_ETA; - } else if ( station == 2 ) { - if ( measphi ) return CSL_PHI; - else return CSL_ETA; - } - return UNKNOWN_PLANE; - } -} -#endif - - //****************************************************************************** -CscSplitClusterFitter:: -CscSplitClusterFitter(string type, string aname, const IInterface* parent) -: AthAlgTool(type, aname, parent), +CscSplitClusterFitter::CscSplitClusterFitter(std::string type, std::string aname, const IInterface* parent) : + AthAlgTool(type, aname, parent), m_pfitter_def("SimpleCscClusterFitter/SimpleCscClusterFitter"), m_pfitter_prec("QratCscClusterFitter/QratCscClusterFitter") { @@ -73,15 +40,10 @@ CscSplitClusterFitter(string type, string aname, const IInterface* parent) //********************************************************************** -CscSplitClusterFitter::~CscSplitClusterFitter() { } - -//********************************************************************** - StatusCode CscSplitClusterFitter::initialize() { + ATH_MSG_DEBUG ("Initalizing " << name()); - ATH_MSG_DEBUG ( "Initalizing " << name() ); - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); // Retrieve the default cluster fitting tool. if ( m_pfitter_def.retrieve().isFailure() ) { @@ -117,19 +79,14 @@ Results CscSplitClusterFitter::fit(const StripFitList& sfits) const { // Use the first strip to extract the layer parameters. const CscStripPrepData* pstrip = sfits[0].strip; Identifier idStrip0 = pstrip->identify(); - bool measphi = m_muonIdHelperTool->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); - // double pitch = pro->cathodeReadoutPitch(0, measphi); - // unsigned int maxstrip = pro->maxNumberOfStrips(measphi); - // unsigned int strip0 = m_muonIdHelperTool->cscIdHelper().strip(idStrip0) - 1; - // unsigned int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL - // CscPlane plane = findPlane(station, measphi); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); // Display input strips. ATH_MSG_DEBUG ( "CscStrip fittter input has " << nstrip << " strips" ); for (unsigned int istrip=0; istrip<nstrip; ++istrip ) { Identifier id = sfits[istrip].strip->identify(); - ATH_MSG_VERBOSE ( " " << istrip << " " << m_muonIdHelperTool->cscIdHelper().strip(id) << " " << sfits[istrip].charge ); + ATH_MSG_VERBOSE ( " " << istrip << " " << m_idHelperSvc->cscIdHelper().strip(id) << " " << sfits[istrip].charge ); } // Find the peak strip and valley strip // Loop over strips @@ -386,14 +343,6 @@ Results CscSplitClusterFitter::fit(const StripFitList& sfits, double) const { return fit(sfits); } -//********************************************************************** - -StatusCode CscSplitClusterFitter::finalize(){ - - ATH_MSG_VERBOSE ( "Goodbye" ); - return StatusCode::SUCCESS; -} - //********************************************************************** double CscSplitClusterFitter::getCorrectedError(const CscPrepData* /*pclu*/, double /*slope*/) const { return 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.h index 4e28732a0b831cff924b65a101e82ba783a2e926..16906ed8390ea8ff3887f3122bc1043c2bf1215c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscSplitClusterFitter.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// CscSplitClusterFitter.h - #ifndef CscSplitClusterFitter_H #define CscSplitClusterFitter_H @@ -12,38 +10,29 @@ // // Tool to fit a CSC cluster using adjacent charge ratios. +#include "CscClusterization/ICscClusterFitter.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "CscClusterization/ICscClusterFitter.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/CscClusterStatus.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" namespace Muon { class CscPrepData; } -namespace MuonGM { - class MuonDetectorManager; -} - class CscSplitClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { public: - // Constructor. CscSplitClusterFitter(std::string, std::string, const IInterface*); - // Destructor. - ~CscSplitClusterFitter(); + ~CscSplitClusterFitter()=default; - // Initialization. StatusCode initialize(); - // Finalization. - StatusCode finalize(); - // Inherited methods. - // using ICscClusterFitter::fit; Results fit(const StripFitList& sfits) const; Results fit(const StripFitList& sfits, double dposdz) const; double getCorrectedError(const Muon::CscPrepData* pclu, double slope) const; @@ -56,8 +45,8 @@ private: // Maximum charge ratio between peak strip and valley strip float m_max_qratio; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + // Cluster fitters. ToolHandle<ICscClusterFitter> m_pfitter_def; ToolHandle<ICscClusterFitter> m_pfitter_prec; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx index 3b84320ca1abdeea02cc549f3e6727de6bc7a415..2c7272b261d8741c7a9ef7d3bfd28e1cbdc21873 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx @@ -1,29 +1,22 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/** @file ParabolaCscClusterFitter.cxx -@author Michael Schernau */ #include "ParabolaCscClusterFitter.h" -#include "CscClusterization/ICscClusterFitter.h" + #include "MuonPrepRawData/CscClusterStatus.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/CscIdHelper.h" - #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/LocalDirection.h" - #include "EventPrimitives/EventPrimitives.h" #include "EventPrimitives/EventPrimitivesHelpers.h" #include <sstream> #include <iomanip> -using std::string; -using std::vector; using Muon::CscClusterStatus; using Muon::CscStripPrepData; using Muon::CscPrepData; @@ -33,9 +26,8 @@ typedef ICscClusterFitter::DataNames DataNames; typedef ICscClusterFitter::Result Result; typedef std::vector<Result> Results; - namespace { - string splane(CscPlane plane) { + std::string splane(CscPlane plane) { switch(plane) { case CSS_ETA: return "CSS eta"; case CSL_ETA: return "CSL eta"; @@ -58,8 +50,6 @@ namespace { } } - - /** Correct the raw parabola interpolation, based on CSCPlane. The correction function takes the output of the parabola method, the peak position, and returns a position that is closer to the @@ -101,7 +91,7 @@ double ParabolaCscClusterFitter::ParabolaCorrection(CscPlane &plane, double &raw } } // end switch - return a * atan (b * raw) + c * raw; + return a * std::atan (b * raw) + c * raw; } @@ -109,9 +99,9 @@ double ParabolaCscClusterFitter::ParabolaCorrection(CscPlane &plane, double &raw //************************************************************************* -ParabolaCscClusterFitter:: -ParabolaCscClusterFitter(string type, string aname, const IInterface* parent) -: AthAlgTool(type, aname, parent), m_detMgr(nullptr) { +ParabolaCscClusterFitter::ParabolaCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : + AthAlgTool(type, aname, parent), + m_detMgr(nullptr) { declareInterface<ICscClusterFitter>(this); m_max_width.push_back(5); // CSS eta m_max_width.push_back(5); // CSL eta @@ -126,23 +116,13 @@ ParabolaCscClusterFitter(string type, string aname, const IInterface* parent) declareProperty("multi", m_multi=3.1); // threshold multiplier for cluster peak finding } -//********************************************************************** -ParabolaCscClusterFitter::~ParabolaCscClusterFitter() { } - - - //********************************************************************** StatusCode ParabolaCscClusterFitter::initialize() { ATH_MSG_VERBOSE ( "Initalizing " << name() ); - // retrieve MuonDetectorManager - if ( detStore()->retrieve(m_detMgr,"Muon").isFailure() ) { - ATH_MSG_FATAL ( "Could not find the MuonGeoModel Manager! " ); - return StatusCode::FAILURE; - } - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK(detStore()->retrieve(m_detMgr,"Muon")); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_MSG_DEBUG ( "Properties for " << name() << ":" ); ATH_MSG_DEBUG ( " tan(theta) error coeff: " << m_error_tantheta ); @@ -154,8 +134,6 @@ StatusCode ParabolaCscClusterFitter::initialize() { return StatusCode::SUCCESS; } - - /** data names for ntuple output in csc_cluster tree */ const DataNames& ParabolaCscClusterFitter::dataNames() const { static DataNames dnames; @@ -209,11 +187,11 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta Identifier idStrip0 = pstrip->identify(); const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); // const CscReadoutElement* pro = pstrip->detectorElement(); fixed by Woochun - bool measphi = m_muonIdHelperTool->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); unsigned int maxstrip = pro->maxNumberOfStrips(measphi); - unsigned int strip0 = m_muonIdHelperTool->cscIdHelper().strip(idStrip0) - 1; - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + unsigned int strip0 = m_idHelperSvc->cscIdHelper().strip(idStrip0) - 1; + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL CscPlane plane = findPlane(station, measphi); if ( plane == UNKNOWN_PLANE ) { ATH_MSG_WARNING ( "Invalid CSC plane: station=" << station << "; measphi=" << measphi ); @@ -227,7 +205,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta for ( unsigned int istrip=0; istrip<nstrip; ++istrip ) { Identifier id = sfits[istrip].strip->identify(); if (sfits[istrip].charge>=20000) ++nstrip_threshold; - ATH_MSG_VERBOSE ( " index: " << istrip << " chn:" << m_muonIdHelperTool->cscIdHelper().strip(id) << " amp:" << (int)(sfits[istrip].charge/1000) << " ke." ); + ATH_MSG_VERBOSE ( " index: " << istrip << " chn:" << m_idHelperSvc->cscIdHelper().strip(id) << " amp:" << (int)(sfits[istrip].charge/1000) << " ke." ); } // Find the highest peak and count all peaks above threshold. @@ -243,7 +221,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta float qnext = sfits[istrip+1].charge; double thr = m_multi * sfits[istrip].dcharge / 10; // correct noise*10 Identifier id = sfits[istrip].strip->identify(); - ATH_MSG_VERBOSE ( " index: " << istrip << " chn:" << m_muonIdHelperTool->cscIdHelper().strip(id) << " amp:" << (int)(sfits[istrip].charge/1000) << " ke, thr: " << (int)(thr/1000) << " ke " << ((qthis>thr)?"signal":"noise") << sfits[istrip].dcharge/1000); + ATH_MSG_VERBOSE ( " index: " << istrip << " chn:" << m_idHelperSvc->cscIdHelper().strip(id) << " amp:" << (int)(sfits[istrip].charge/1000) << " ke, thr: " << (int)(thr/1000) << " ke " << ((qthis>thr)?"signal":"noise") << sfits[istrip].dcharge/1000); charge_clu += qthis; // Peak if the adjacent strips have less charge. @@ -332,7 +310,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta //pos = cog; // error calculation: S/N = charge sum / ave charge error. - double dpos = (dqA+dqB+dqC)/3 /(qA+qB+qC) * pitch * sqrt(2.0); // pos error + double dpos = (dqA+dqB+dqC)/3 /(qA+qB+qC) * pitch * std::sqrt(2.0); // pos error dpos = 0.08; // 80 micron error if ( measphi ) dpos = 2.5; // worse phi resolution of ~2.5 mm //dpos = 200;//*= 2; /** todo Tune this to correct chi 2 of segments */ @@ -363,7 +341,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta // Set return values. Result res(0, Muon::CscStatusUnspoiled); // status 0??? res.position = pitch*(savg + 0.5 - 0.5*maxstrip); - res.dposition = sqrt(dpos*dpos + dpostht*dpostht); // pos. error estimate + res.dposition = std::sqrt(dpos*dpos + dpostht*dpostht); // pos. error estimate res.strip = istrip_peak; // strip number in this cluster res.fstrip = 0; res.lstrip = nstrip-1; // cluster width @@ -403,7 +381,7 @@ double ParabolaCscClusterFitter::getCorrectedError(const CscPrepData* pclu, doub double dpos = Amg::error(pclu->localCovariance(),ierr); Identifier idStrip0 = pclu->identify(); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL // Calculate the angle of incidence. double tantht = 0.0; if ( station == 1 ) { @@ -416,7 +394,7 @@ double ParabolaCscClusterFitter::getCorrectedError(const CscPrepData* pclu, doub double new_dpostht = m_error_tantheta*std::abs(slope); - double newError = sqrt(dpos*dpos + double newError = std::sqrt(dpos*dpos - old_dpostht*old_dpostht + new_dpostht*new_dpostht); @@ -446,7 +424,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits) const { // Fetch the chamber type. const CscStripPrepData* pstrip = sfits[0].strip; Identifier idStrip0 = pstrip->identify(); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL // Calculate the angle of incidence. double tantht = 0.0; double pos = res.position; @@ -458,13 +436,7 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits) const { // Correct the error using this angle. double dpostht = m_error_tantheta*std::abs(tantht); double dpos = res.dposition; - - // std::cout << "QratCluFitter:: as followed Position error:: dpos=" << dpos - // << " dpostht=" << dpostht << " new="; - - res.dposition = sqrt(dpos*dpos + dpostht*dpostht); - // std::cout << res.dposition << " at tantheta=" << tantht << " angle=" - // << atan(tantht)*180/acos(-1.0)<< std::endl; + res.dposition = std::sqrt(dpos*dpos + dpostht*dpostht); // Return the updated result. new_results.push_back(res); @@ -472,11 +444,3 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits) const { return new_results; } - - - -//********************************************************************** -StatusCode ParabolaCscClusterFitter::finalize(){ - return StatusCode::SUCCESS; -} - diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h index c7e0cebba2cbb5c54908fbfdd34f55f667e9f068..2831cf1eda4d3a68b8a2de3fdec791cd12417721 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @file ParabolaCscClusterFitter.h @@ -12,12 +12,11 @@ May 2009 #ifndef ParabolaCscClusterFitter_H #define ParabolaCscClusterFitter_H - -#include "AthenaBaseComps/AthAlgTool.h" #include "CscClusterization/ICscClusterFitter.h" -#include "MuonPrepRawData/CscClusterStatus.h" -#include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { class CscPrepData; @@ -26,13 +25,9 @@ namespace MuonGM { class MuonDetectorManager; } - enum CscStation { UNKNOWN_STATION, CSS, CSL }; enum CscPlane { CSS_ETA, CSL_ETA, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; - - - class ParabolaCscClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { public: @@ -44,15 +39,10 @@ public: */ ParabolaCscClusterFitter(std::string type, std::string aname, const IInterface* parent); - /** Destructor. */ - ~ParabolaCscClusterFitter(); + ~ParabolaCscClusterFitter()=default; - /** Initialization. */ StatusCode initialize(); - /** Finalization. */ - StatusCode finalize(); - /** Correction of raw parabola positions. @param plane The csc plane enum for small or large chamber, X or Y plane @param raw The raw value of the parabola peak positon @@ -90,8 +80,8 @@ private: double m_multi; const MuonGM::MuonDetectorManager* m_detMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx index 45fe05285639784a155cb026a681baf538becbda..fa3e9750b5ef5c50269d85e352f363061da4492b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx @@ -1,18 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// QratCscClusterFitter.cxx #include "QratCscClusterFitter.h" -#include "CscClusterization/ICscClusterFitter.h" -#include "CscClusterization/ICscAlignmentTool.h" + #include "MuonPrepRawData/CscClusterStatus.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/CscIdHelper.h" - #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/LocalDirection.h" #include "EventPrimitives/EventPrimitives.h" @@ -21,8 +17,6 @@ #include <sstream> #include <iomanip> -using std::string; -using std::vector; using Muon::CscClusterStatus; using Muon::CscStripPrepData; using Muon::CscPrepData; @@ -36,7 +30,7 @@ enum CscStation { UNKNOWN_STATION, CSS, CSL }; enum CscPlane { CSS_ETA, CSL_ETA, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; namespace { - string splane(CscPlane plane) { + std::string splane(CscPlane plane) { switch(plane) { case CSS_ETA: return "CSS eta"; case CSL_ETA: return "CSL eta"; @@ -62,7 +56,7 @@ namespace { //****************************************************************************** int qrat_correction(CscPlane plane, double qrat, double& cor, double& dcordqrat) { - vector<double> pfac; + std::vector<double> pfac; if ( plane == CSS_ETA ) { if ( qrat < 0.095 ) return 1; if ( qrat > 1.01 ) return 1; @@ -127,7 +121,7 @@ int qrat_correction(CscPlane plane, double qrat, double& cor, double& dcordqrat) // cor = output correction // dcordqrat = derivative of cor w.r.t. qrat -int qrat_interpolation(double qrmin, const vector<double>& corvals, +int qrat_interpolation(double qrmin, const std::vector<double>& corvals, double qrat, double& cor, double& dcordqrat) { int nbin = corvals.size(); if ( ! nbin ) return 1; @@ -215,9 +209,8 @@ int qrat_atanh(const double a, const double b, double c, const double x0, //**************************************************************************** -QratCscClusterFitter:: -QratCscClusterFitter(string type, string aname, const IInterface* parent) - : AthAlgTool(type, aname, parent), +QratCscClusterFitter::QratCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : + AthAlgTool(type, aname, parent), m_detMgr(nullptr), m_alignmentTool("CscAlignmentTool/CscAlignmentTool", this) { @@ -266,21 +259,12 @@ QratCscClusterFitter(string type, string aname, const IInterface* parent) //********************************************************************** -QratCscClusterFitter::~QratCscClusterFitter() { } - -//********************************************************************** - StatusCode QratCscClusterFitter::initialize() { ATH_MSG_VERBOSE ( "Initalizing " << name() ); - // retrieve MuonDetectorManager - if ( detStore()->retrieve(m_detMgr,"Muon").isFailure() ) { - ATH_MSG_FATAL ( "Could not find the MuonGeoModel Manager! " ); - return StatusCode::FAILURE; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(detStore()->retrieve(m_detMgr,"Muon")); + ATH_CHECK(m_idHelperSvc.retrieve()); if ( m_alignmentTool.retrieve().isFailure() ) { ATH_MSG_WARNING ( name() << ": unable to retrieve cluster fitter " << m_alignmentTool ); @@ -391,17 +375,11 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits, double tantheta) co Identifier idStrip0 = pstrip->identify(); const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); - bool measphi = m_muonIdHelperTool->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); unsigned int maxstrip = pro->maxNumberOfStrips(measphi); - unsigned int strip0 = m_muonIdHelperTool->cscIdHelper().strip(idStrip0) - 1; - - // int zsec = m_muonIdHelperTool->cscIdHelper().stationEta(idStrip0); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL - // int phisec = m_muonIdHelperTool->cscIdHelper().stationPhi(idStrip0); - - // int sector = zsec*(2*phisec - station + 1); - // int wlay = m_muonIdHelperTool->cscIdHelper().wireLayer(idStrip0); + unsigned int strip0 = m_idHelperSvc->cscIdHelper().strip(idStrip0) - 1; + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL CscPlane plane = findPlane(station, measphi); if ( plane == UNKNOWN_PLANE ) { @@ -412,12 +390,10 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits, double tantheta) co // Display input strips. ATH_MSG_VERBOSE ( "QRAT fittter input has " << nstrip << " strips" ); - // unsigned int nstrip_threshold =0; for ( unsigned int istrip=0; istrip<nstrip; ++istrip ) { Identifier id = sfits[istrip].strip->identify(); - // if (sfits[istrip].charge>=20000) ++nstrip_threshold; - ATH_MSG_VERBOSE ( " " << station << " : " << measphi << " " << m_muonIdHelperTool->cscIdHelper().wireLayer(id) - << " " << istrip << " " << m_muonIdHelperTool->cscIdHelper().strip(id) + ATH_MSG_VERBOSE ( " " << station << " : " << measphi << " " << m_idHelperSvc->cscIdHelper().wireLayer(id) + << " " << istrip << " " << m_idHelperSvc->cscIdHelper().strip(id) << " " << sfits[istrip].charge ); } @@ -518,8 +494,8 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits, double tantheta) co double savg = istrip_peak; // Calculate QRAT correction to strip position. - string posopt = m_posopt_eta; - string erropt = m_erropt_eta; + std::string posopt = m_posopt_eta; + std::string erropt = m_erropt_eta; double dpos = 0.0; if ( measphi ) { posopt = m_posopt_phi; @@ -546,7 +522,7 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits, double tantheta) co stat2 = qrat_correction(plane, qrat2, scor2, dscordqrat2); } else if ( posopt == "TABLE" ) { double qrmin = 0.0; - const vector<double>* pcor = 0; + const std::vector<double>* pcor = 0; if ( plane == CSS_ETA ) { qrmin = m_qratmin_css_eta; pcor = &m_qratcor_css_eta; @@ -753,7 +729,7 @@ double QratCscClusterFitter::getCorrectedError(const CscPrepData* pclu, double s double dpos = Amg::error(pclu->localCovariance(),ierr); Identifier idStrip0 = pclu->identify(); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL // Calculate the angle of incidence. double tantht = 0.0; if ( station == 1 ) { @@ -798,7 +774,7 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits) const { // Fetch the chamber type. const CscStripPrepData* pstrip = sfits[0].strip; Identifier idStrip0 = pstrip->identify(); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL // Calculate the angle of incidence. double tantht = 0.0; double pos = res.position; @@ -811,12 +787,7 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits) const { double dpostht = m_error_tantheta*std::abs(tantht); double dpos = res.dposition; - // std::cout << "QratCluFitter:: as followed Position error:: dpos=" << dpos - // << " dpostht=" << dpostht << " new="; - res.dposition = sqrt(dpos*dpos + dpostht*dpostht); - // std::cout << res.dposition << " at tantheta=" << tantht << " angle=" - // << atan(tantht)*180/acos(-1.0)<< std::endl; // Return the updated result. new_results.push_back(res); @@ -824,13 +795,3 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits) const { return new_results; } - -//********************************************************************** - -StatusCode QratCscClusterFitter::finalize(){ - - ATH_MSG_VERBOSE ( "Goodbye" ); - return StatusCode::SUCCESS; -} - -//********************************************************************** diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h index e1d0032064e6de166ff84591fb656f57241c3ce2..4108bed62de018139f70ee94172e8726b2271932 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// QratCscClusterFitter.h - #ifndef QratCscClusterFitter_H #define QratCscClusterFitter_H @@ -12,11 +10,14 @@ // // Tool to fit a CSC cluster using adjacent charge ratios. -#include "AthenaBaseComps/AthAlgTool.h" #include "CscClusterization/ICscClusterFitter.h" -#include "MuonPrepRawData/CscClusterStatus.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonPrepRawData/CscClusterStatus.h" +#include "CscClusterization/ICscAlignmentTool.h" namespace Muon { class CscPrepData; @@ -25,23 +26,16 @@ namespace MuonGM { class MuonDetectorManager; } -class ICscAlignmentTool; class QratCscClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { public: - // Constructor. QratCscClusterFitter(std::string, std::string, const IInterface*); - // Destructor. - ~QratCscClusterFitter(); + ~QratCscClusterFitter()=default; - // Initialization. StatusCode initialize(); - // Finalization. - StatusCode finalize(); - // Inherited methods. const DataNames& dataNames() const; using ICscClusterFitter::fit; @@ -84,9 +78,9 @@ private: double m_dposmin; // MS: minimum position error in mm const MuonGM::MuonDetectorManager* m_detMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - ToolHandle<ICscAlignmentTool> m_alignmentTool; - + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + ToolHandle<ICscAlignmentTool> m_alignmentTool; }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx index ee6e21c6e48835bc0b1116ba4526e13e5719d2ed..2a1688d539432412369bee81843cc93cc4a11ed6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx @@ -1,22 +1,18 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// SimpleCscClusterFitter.cxx #include "SimpleCscClusterFitter.h" -#include "CscClusterization/ICscClusterFitter.h" -#include "CscClusterization/ICscAlignmentTool.h" + #include "MuonPrepRawData/CscClusterStatus.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/CscIdHelper.h" + #include <sstream> #include <iomanip> -using std::string; -using std::vector; using Muon::CscClusterStatus; using Muon::CscPrepData; using Muon::CscStripPrepData; @@ -28,57 +24,10 @@ typedef std::vector<Result> Results; enum CscStation { UNKNOWN_STATION, CSS, CSL }; enum CscPlane { CSS_R, CSL_R, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; -#if 0 -namespace { - string splane(CscPlane plane) { - switch(plane) { - case CSS_R: return "CSS r"; - case CSL_R: return "CSL r"; - case CSS_PHI: return "CSS phi"; - case CSL_PHI: return "CSL phi"; - case UNKNOWN_PLANE: return "no such plane"; - } - return "no such plane"; - } - - CscStation findStation(double pitch){ - CscStation station = UNKNOWN_STATION; - if ( pitch > 5.5 && pitch < 5.6 ) { - station = CSS; - } else if ( pitch > 5.3 && pitch < 5.4 ) { - station = CSL; - } else if ( pitch > 12.0 && pitch < 14.0 ) { - station = CSS; - } else if ( pitch > 20.0 && pitch < 22.0 ) { - station = CSL; - } - return station; - } - - CscPlane findPlane(double pitch){ - CscPlane plane = UNKNOWN_PLANE; - if ( pitch > 5.5 && pitch < 5.6 ) { - plane = CSS_R; - } else if ( pitch > 5.3 && pitch < 5.4 ) { - plane = CSL_R; - } else if ( pitch > 12.0 && pitch < 14.0 ) { - plane = CSS_PHI; - } else if ( pitch > 20.0 && pitch < 22.0 ) { - plane = CSL_PHI; - } - return plane; - } -} -#endif - -//********************************************************************** -// Member functions. -//********************************************************************** - -SimpleCscClusterFitter:: -SimpleCscClusterFitter(string type, string aname, const IInterface* parent) - : AthAlgTool(type, aname, parent), m_detMgr(nullptr) - , m_alignmentTool("CscAlignmentTool/CscAlignmentTool", this) +SimpleCscClusterFitter::SimpleCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : + AthAlgTool(type, aname, parent), + m_detMgr(nullptr), + m_alignmentTool("CscAlignmentTool/CscAlignmentTool", this) { declareInterface<ICscClusterFitter>(this); declareProperty("position_option", m_option = "MEAN", @@ -94,10 +43,6 @@ SimpleCscClusterFitter(string type, string aname, const IInterface* parent) //********************************************************************** -SimpleCscClusterFitter::~SimpleCscClusterFitter() { } - -//********************************************************************** - StatusCode SimpleCscClusterFitter::initialize() { ATH_MSG_VERBOSE ( "Initializing " << name() ); @@ -106,13 +51,8 @@ StatusCode SimpleCscClusterFitter::initialize() { ATH_MSG_DEBUG ( " Position option: " << m_option ); ATH_MSG_DEBUG ( " Intrinsic width: " << m_intrinsic_cluster_width << " mm" ); - // Retrieve muon geometry. - if ( detStore()->retrieve(m_detMgr,"Muon").isFailure() ) { - ATH_MSG_FATAL ( "Could not find the MuonGeoModel Manager! " ); - return StatusCode::FAILURE; - } - // Fetch ID helper. - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(detStore()->retrieve(m_detMgr,"Muon")); + ATH_CHECK(m_idHelperSvc.retrieve()); if ( m_alignmentTool.retrieve().isFailure() ) { ATH_MSG_WARNING ( name() << ": unable to retrieve cluster fitter " << m_alignmentTool ); @@ -154,22 +94,21 @@ Results SimpleCscClusterFitter::fit(const StripFitList& sfits) const { } Identifier idStrip0 = pstrip->identify(); const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); - bool measphi = m_muonIdHelperTool->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); int maxstrip = pro->maxNumberOfStrips(measphi); - int strip0 = m_muonIdHelperTool->cscIdHelper().strip(idStrip0) - 1; + int strip0 = m_idHelperSvc->cscIdHelper().strip(idStrip0) - 1; - int zsec = m_muonIdHelperTool->cscIdHelper().stationEta(idStrip0); - int station = m_muonIdHelperTool->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL - int phisec = m_muonIdHelperTool->cscIdHelper().stationPhi(idStrip0); + int zsec = m_idHelperSvc->cscIdHelper().stationEta(idStrip0); + int station = m_idHelperSvc->cscIdHelper().stationName(idStrip0) - 49; // 1=CSS, 2=CSL + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(idStrip0); int sector = zsec*(2*phisec - station + 1); - int wlay = m_muonIdHelperTool->cscIdHelper().wireLayer(idStrip0); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(idStrip0); // In SimpleCscClusterFitter istrip_peak = strip0; int peak_count = 0; // # peaks in the cluster bool edge = strip0 == 0; // is cluster on the edge of the chamber? - // int istrip_peak = strip0; // Strip with the most charge and initialized as the first strip idx. int stripidx =0; // actual strip position [0-191] or [0-47] int countstrip =0; // counting strip in for loop double qsum=0; // charge sum of strips in cluster @@ -384,13 +323,6 @@ Results SimpleCscClusterFitter::fit(const StripFitList& sfits, double) const { return fit(sfits); } -//********************************************************************** - -StatusCode SimpleCscClusterFitter::finalize(){ - ATH_MSG_VERBOSE ( "Finalizing " << name() ); - return StatusCode::SUCCESS; -} - //********************************************************************** double SimpleCscClusterFitter::getCorrectedError(const CscPrepData* /*pclu*/, double /*slope*/) const { return 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h index 45c9b156131ab3cb9def34c62a9d5b55693d9da6..c78f77eae9ffbf4b5ef5ad789bcb3bee1085fe0a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h @@ -1,9 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// SimpleCscClusterFitter.h - #ifndef SimpleCscClusterFitter_H #define SimpleCscClusterFitter_H @@ -12,11 +10,14 @@ // // Tool to select muons for physics analysis. -#include "AthenaBaseComps/AthAlgTool.h" #include "CscClusterization/ICscClusterFitter.h" -#include "MuonPrepRawData/CscClusterStatus.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonPrepRawData/CscClusterStatus.h" +#include "CscClusterization/ICscAlignmentTool.h" namespace Muon { class CscPrepData; @@ -25,23 +26,16 @@ namespace MuonGM { class MuonDetectorManager; } -class ICscAlignmentTool; class SimpleCscClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { public: - // Constructor. SimpleCscClusterFitter(std::string, std::string, const IInterface*); - // Destructor. - ~SimpleCscClusterFitter(); + ~SimpleCscClusterFitter()=default; - // Initialization. StatusCode initialize(); - // Finalization. - StatusCode finalize(); - // Inherited methods. using ICscClusterFitter::fit; Results fit(const StripFitList& sfits) const; @@ -57,8 +51,9 @@ private: double m_defaultErrorScaler_phi; const MuonGM::MuonDetectorManager* m_detMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - ToolHandle<ICscAlignmentTool> m_alignmentTool; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + ToolHandle<ICscAlignmentTool> m_alignmentTool; }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.cxx index fc6e5503e22db7d470177b27d4e2fa3ee4c84ff3..a6403b5e64afebc28e77f68f521caa8de0d0616f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.cxx @@ -1,51 +1,33 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonClusterizationAlg.h" -#include "MuonClusterization/IMuonClusterizationTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" + #include "MuonPrepRawData/MuonPrepDataContainer.h" using namespace Muon; -MuonClusterizationAlg::MuonClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name,pSvcLocator) - , m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") - , m_clusterTool("Muon::MuonClusterizationTool/MuonClusterizationTool") +MuonClusterizationAlg::MuonClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name,pSvcLocator), + m_clusterTool("Muon::MuonClusterizationTool/MuonClusterizationTool") { declareProperty("TgcPrepDataContainer", m_tgcPrdLocationInput = "TGC_Measurements"); declareProperty("TgcPrepDataContainerOutput", m_tgcPrdLocationOutput = "TGC_Clusters"); declareProperty("RpcPrepDataContainer", m_rpcPrdLocationInput = "RPC_Measurements"); declareProperty("RpcPrepDataContainerOutput", m_rpcPrdLocationOutput = "RPC_Clusters"); - declareProperty("IdHelperTool", m_idHelper); declareProperty("ClusterTool", m_clusterTool); } -MuonClusterizationAlg::~MuonClusterizationAlg() -{ - -} - StatusCode MuonClusterizationAlg::initialize() { - if( AthAlgorithm::initialize().isFailure() ) return StatusCode::FAILURE; - - if (m_idHelper.retrieve().isFailure()){ - msg(MSG::ERROR) <<"Could not get " << m_idHelper <<endmsg; - return StatusCode::FAILURE; - } - if (m_clusterTool.retrieve().isFailure()){ - msg(MSG::ERROR) <<"Could not get " << m_clusterTool <<endmsg; - return StatusCode::FAILURE; - } - + ATH_CHECK(m_clusterTool.retrieve()); return StatusCode::SUCCESS; } StatusCode MuonClusterizationAlg::execute() { - const TgcPrepDataContainer* tgcContainer = 0; + const TgcPrepDataContainer* tgcContainer = nullptr; if (evtStore()->retrieve(tgcContainer,m_tgcPrdLocationInput).isFailure() ) { ATH_MSG_WARNING("Could not find TgcPrepDataContainer at " << m_tgcPrdLocationInput); return StatusCode::RECOVERABLE; @@ -57,13 +39,11 @@ StatusCode MuonClusterizationAlg::execute() return StatusCode::RECOVERABLE; } - - const RpcPrepDataContainer* rpcContainer = 0; + const RpcPrepDataContainer* rpcContainer = nullptr; if (evtStore()->retrieve(rpcContainer,m_rpcPrdLocationInput).isFailure() ) { ATH_MSG_WARNING("Could not find RpcPrepDataContainer at " << m_rpcPrdLocationInput); return StatusCode::RECOVERABLE; } - const RpcPrepDataContainer* rpcContainerCluster = m_clusterTool->cluster(*rpcContainer); if (evtStore()->record(rpcContainerCluster,m_rpcPrdLocationOutput).isFailure() ) { @@ -71,11 +51,5 @@ StatusCode MuonClusterizationAlg::execute() return StatusCode::RECOVERABLE; } - return StatusCode::SUCCESS; -} // execute - -StatusCode MuonClusterizationAlg::finalize() -{ - if( AthAlgorithm::finalize().isFailure() ) return StatusCode::FAILURE; return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.h index 0aeca6f57bbcb57b94d599bab880bbbfe1f2a4ff..2694f57cf90d495400614d0283772973fceb9588 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationAlg.h @@ -1,19 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCLUSTERIZATIONALG_H #define MUONCLUSTERIZATIONALG_H -#include <string> - #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonClusterization/IMuonClusterizationTool.h" -namespace Muon { - class MuonIdHelperTool; - class IMuonClusterizationTool; -} +#include <string> class MuonClusterizationAlg : public AthAlgorithm { @@ -21,11 +17,10 @@ class MuonClusterizationAlg : public AthAlgorithm MuonClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator); public: - virtual ~MuonClusterizationAlg(); + virtual ~MuonClusterizationAlg()=default; virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); private: @@ -35,9 +30,7 @@ class MuonClusterizationAlg : public AthAlgorithm std::string m_rpcPrdLocationInput; //!< Location of input RpcPrepData std::string m_rpcPrdLocationOutput; //!< Location of output RpcPrepData - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; //!< id helper Tool ToolHandle<Muon::IMuonClusterizationTool> m_clusterTool; //!< clustering Tool - }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.cxx index 012b9ddcecd6e7dc5181f056f1e83c02c5c47596..87ee50f62fae1fdf0907b0dc9265642801b14d13 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.cxx @@ -1,40 +1,28 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonClusterizationTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" + #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" namespace Muon { - MuonClusterizationTool::MuonClusterizationTool(const std::string& t,const std::string& n, const IInterface* p ) - : AthAlgTool(t,n,p) - , m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") - , m_tgcClustering(0) - , m_rpcClustering(0) + MuonClusterizationTool::MuonClusterizationTool(const std::string& t,const std::string& n, const IInterface* p) : + AthAlgTool(t,n,p), + m_tgcClustering(nullptr), + m_rpcClustering(nullptr) { declareInterface<IMuonClusterizationTool>(this); declareProperty("CombineGasGaps", m_combineGasGaps = true); } - MuonClusterizationTool::~MuonClusterizationTool() - { - } - StatusCode MuonClusterizationTool::initialize() { - if( AthAlgTool::initialize().isFailure() ) return StatusCode::FAILURE; - - if (m_idHelper.retrieve().isFailure()){ - msg(MSG::ERROR) <<"Could not get " << m_idHelper <<endmsg; - return StatusCode::FAILURE; - } - - m_tgcClustering = new HitClusteringObj(m_idHelper->tgcIdHelper()); - m_rpcClustering = new HitClusteringObj(m_idHelper->rpcIdHelper()); - //m_rpcClustering->debug = true; + ATH_CHECK(m_idHelperSvc.retrieve()); + m_tgcClustering = new HitClusteringObj(m_idHelperSvc->tgcIdHelper()); + m_rpcClustering = new HitClusteringObj(m_idHelperSvc->rpcIdHelper()); m_rpcClustering->combinedGasGaps = m_combineGasGaps; m_tgcClustering->combinedGasGaps = m_combineGasGaps; return StatusCode::SUCCESS; @@ -42,16 +30,14 @@ namespace Muon { StatusCode MuonClusterizationTool::finalize() { - if( AthAlgTool::finalize().isFailure() ) return StatusCode::FAILURE; delete m_tgcClustering; delete m_rpcClustering; - return StatusCode::SUCCESS; } TgcPrepDataContainer* MuonClusterizationTool::cluster( const TgcPrepDataContainer& prdContainer ) const { - TgcPrepDataContainer* clusteredContainer = new TgcPrepDataContainer(m_idHelper->tgcIdHelper().module_hash_max()); + TgcPrepDataContainer* clusteredContainer = new TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()); // loop over Tgc collections in container TgcPrepDataContainer::const_iterator cit = prdContainer.begin(); TgcPrepDataContainer::const_iterator cit_end = prdContainer.end(); @@ -68,7 +54,7 @@ namespace Muon { if( col.empty() ) return 0; TgcPrepDataCollection* collection = new TgcPrepDataCollection(col.identifyHash()); collection->setIdentifier(col.identify()); - ATH_MSG_INFO("Performing clustering in " << m_idHelper->toString(col.identify()) ); + ATH_MSG_INFO("Performing clustering in " << m_idHelperSvc->toString(col.identify()) ); std::vector<const MuonCluster*> prds; prds.insert(prds.end(),col.begin(),col.end()); m_tgcClustering->cluster( prds ); @@ -111,7 +97,7 @@ namespace Muon { RpcPrepDataContainer* MuonClusterizationTool::cluster( const RpcPrepDataContainer& prdContainer ) const { - RpcPrepDataContainer* clusteredContainer = new RpcPrepDataContainer(m_idHelper->rpcIdHelper().module_hash_max()); + RpcPrepDataContainer* clusteredContainer = new RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); // loop over Rpc collections in container RpcPrepDataContainer::const_iterator cit = prdContainer.begin(); RpcPrepDataContainer::const_iterator cit_end = prdContainer.end(); @@ -128,7 +114,7 @@ namespace Muon { if( col.empty() ) return 0; RpcPrepDataCollection* collection = new RpcPrepDataCollection(col.identifyHash()); collection->setIdentifier(col.identify()); - ATH_MSG_INFO("Performing clustering in " << m_idHelper->toString(col.identify()) ); + ATH_MSG_INFO("Performing clustering in " << m_idHelperSvc->toString(col.identify()) ); std::vector<const MuonCluster*> prds; prds.insert(prds.end(),col.begin(),col.end()); m_rpcClustering->cluster( prds ); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.h index d073c266cc44cfb26996bb841081811d29d5be5a..f4981d7611c755b4957e38e47f556c12ea144f75 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonClusterization/src/MuonClusterizationTool.h @@ -1,30 +1,29 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCLUSTERIZATIONTOOL_H #define MUONCLUSTERIZATIONTOOL_H -#include <string> +#include "MuonClusterization/IMuonClusterizationTool.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonClusterization/HitClustering.h" #include "MuonClusterization/RpcHitClustering.h" -#include "MuonClusterization/IMuonClusterizationTool.h" -namespace Muon { - class MuonIdHelperTool; -} +#include <string> namespace Muon{ class MuonClusterizationTool : virtual public IMuonClusterizationTool, public AthAlgTool { public: - MuonClusterizationTool(const std::string& t,const std::string& n, const IInterface* p ); - virtual ~MuonClusterizationTool(); + MuonClusterizationTool(const std::string& t, const std::string& n, const IInterface* p); + virtual ~MuonClusterizationTool()=default; virtual StatusCode initialize(); virtual StatusCode finalize(); @@ -39,7 +38,7 @@ namespace Muon{ void addClusters( const std::vector<Muon::ClusterObj>& clusters, Muon::TgcPrepDataCollection* collection ) const ; void addClusters( const std::vector<Muon::ClusterObj>& clusters, Muon::RpcPrepDataCollection* collection ) const; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; //!< id helper Tool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; Muon::HitClusteringObj* m_tgcClustering; Muon::HitClusteringObj* m_rpcClustering; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h index 4afec932b45b66e55ef543991ca04193a6f9d6dc..a4f97d203734c0c621d4749785eb171e56dbc1ad 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h @@ -1,16 +1,15 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTGMeasAssocAlg.h, (c) ATLAS Detector Softwareop -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGMEASASSOCALG_MUONTGMEASASSOCALG_H #define MUONTGMEASASSOCALG_MUONTGMEASASSOCALG_H -// Base class #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "StoreGate/ReadCondHandleKey.h" #include "TrkTrack/Track.h" #include "TrkExInterfaces/IExtrapolator.h" @@ -18,9 +17,6 @@ #include "TrkSurfaces/CylinderSurface.h" #include "TrkPrepRawData/PrepRawData.h" #include "TrkSegment/SegmentCollection.h" -#include <fstream> - -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" @@ -29,10 +25,10 @@ #include "MuonTGRecTools/IMuonTGMeasTool.h" #include "MuonTGRecTools/MuonTGHits.h" #include "MuonTGRecTools/MuonTGSegments.h" - -// Amg #include "GeoPrimitives/GeoPrimitives.h" +#include <fstream> + namespace Muon{ /** @class MuonTGMeasAssocAlg @@ -54,15 +50,12 @@ public: typedef std::pair<const Trk::Layer*,std::vector<const Muon::CscPrepData*>*> PairOfLayerCscPrd; typedef std::pair<const Trk::Layer*,std::vector<const Muon::TgcPrepData*>*> PairOfLayerTgcPrd; - /** Constructor with parameters */ MuonTGMeasAssocAlg(const std::string &name,ISvcLocator *pSvcLocator); - /** Destructor */ - ~MuonTGMeasAssocAlg(); + ~MuonTGMeasAssocAlg()=default; StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); StatusCode retrieveMeasurements(const MuonGM::MuonDetectorManager* MuonDetMgr); StatusCode storeMeasurements(); @@ -99,8 +92,7 @@ private: ToolHandle<Muon::IMuonTGMeasTool> m_muonTgTool; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", "MuonDetectorManager", diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx index ec6a13a4eb0ae7f816a4dc95cdf22f26213afc74..cf383eb45366df9a1ab8550fb128b12c9e8a4db5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx @@ -1,17 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTGMeasAssocAlg.cxx -// Implementation file for class MuonTGMeasAssocAlg -/////////////////////////////////////////////////////////////////// -// S.Todorova -/////////////////////////////////////////////////////////////////// - #include "MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h" -// Gaudi includes #include "StoreGate/StoreGate.h" #include "GaudiKernel/ListItem.h" #include "StoreGate/StoreGateSvc.h" @@ -23,8 +15,6 @@ #include "TrkGeometry/Layer.h" #include "TrkGeometry/TrackingVolume.h" #include "TrkGeometry/TrackingGeometry.h" -#include <vector> - #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" @@ -32,11 +22,11 @@ #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MuonStation.h" #include "MuonSegment/MuonSegment.h" - -//Amg #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/CLHEPtoEigenConverter.h" +#include <vector> + // Constructor with parameters: Muon::MuonTGMeasAssocAlg::MuonTGMeasAssocAlg(const std::string &name, ISvcLocator *pSvcLocator ) : AthAlgorithm(name,pSvcLocator), @@ -90,45 +80,22 @@ Muon::MuonTGMeasAssocAlg::MuonTGMeasAssocAlg(const std::string &name, ISvcLocato declareProperty("AllowGeometricalAssociation", m_allowGeomAssoc); } -// Destructor -Muon::MuonTGMeasAssocAlg::~MuonTGMeasAssocAlg(){} - // Initialize method: StatusCode Muon::MuonTGMeasAssocAlg::initialize() { - // Get the messaging service, print where you are - ATH_MSG_INFO("MuonTGMeasAssocAlg::initialize()"); + ATH_MSG_DEBUG("MuonTGMeasAssocAlg::initialize()"); ATH_CHECK(m_DetectorManagerKey.initialize()); - StatusCode sc; - // Get an Identifier helper object - sc=service("ActiveStoreSvc",m_activeStore); - if (sc.isFailure()) { - ATH_MSG_FATAL("ActiveStore service not found !"); - return StatusCode::FAILURE; - } + ATH_CHECK(service("ActiveStoreSvc",m_activeStore)); + ATH_CHECK(m_idHelperSvc.retrieve()); - sc = m_muonIdHelperTool.retrieve(); - if (sc.isFailure()) - { - ATH_MSG_ERROR("Cannot retrieve MuonIdHelperTool"); - return sc; - } - // get muonTG tool - sc = m_muonTgTool.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR("Could not find MuonTGMeasurementTool"); - } - + ATH_CHECK(m_muonTgTool.retrieve()); // get extrapolator - sc = m_extrapolator.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR("Could not find extrapolator"); - } + ATH_CHECK(m_extrapolator.retrieve()); // initialize misalignment if (m_misAlign) { @@ -143,10 +110,10 @@ StatusCode Muon::MuonTGMeasAssocAlg::initialize() if (!misalign.good()) break; Identifier id(0); if (station>=0) { - id = m_muonIdHelperTool->mdtIdHelper().elementID(station,eta,phi); - if (!m_muonIdHelperTool->mdtIdHelper().valid(id)) id = m_muonIdHelperTool->rpcIdHelper().elementID(station,eta,phi,1); - if (!m_muonIdHelperTool->rpcIdHelper().valid(id)) id = m_muonIdHelperTool->tgcIdHelper().elementID(station,eta,phi); - if (!m_muonIdHelperTool->tgcIdHelper().valid(id)) id = m_muonIdHelperTool->cscIdHelper().elementID(station,eta,phi); + id = m_idHelperSvc->mdtIdHelper().elementID(station,eta,phi); + if (!m_idHelperSvc->mdtIdHelper().valid(id)) id = m_idHelperSvc->rpcIdHelper().elementID(station,eta,phi,1); + if (!m_idHelperSvc->rpcIdHelper().valid(id)) id = m_idHelperSvc->tgcIdHelper().elementID(station,eta,phi); + if (!m_idHelperSvc->tgcIdHelper().valid(id)) id = m_idHelperSvc->cscIdHelper().elementID(station,eta,phi); } Amg::Translation3D shift(x,y,z); Amg::Transform3D transf = shift * Amg::RotationMatrix3D::Identity(); @@ -178,13 +145,8 @@ StatusCode Muon::MuonTGMeasAssocAlg::execute() if (!m_trackingGeometry) { - sc = detStore()->retrieve(m_trackingGeometry, m_trackingGeometryName); - if (sc.isFailure()) { - ATH_MSG_FATAL("Could not find tool "<< m_trackingGeometryName<<". Exiting."); - return sc; - } else { - ATH_MSG_INFO("tracking geometry Svc \""<<m_trackingGeometryName<<"\" booked "); - } + ATH_CHECK(detStore()->retrieve(m_trackingGeometry, m_trackingGeometryName)); + ATH_MSG_DEBUG("tracking geometry Svc \""<<m_trackingGeometryName<<"\" booked "); } // create station map if not done already ; misalign stations if required if (!m_stationMap.size()) { @@ -217,15 +179,6 @@ StatusCode Muon::MuonTGMeasAssocAlg::execute() return StatusCode::SUCCESS; } -// Finalize method: -StatusCode Muon::MuonTGMeasAssocAlg::finalize() -{ - // Get the messaging service, print where you are - ATH_MSG_INFO("MuonTGMeasAssocAlg::finalize()"); - //delete m_tpMinFinder; - return StatusCode::SUCCESS; -} - StatusCode Muon::MuonTGMeasAssocAlg::storeMeasurements() { // Get the messaging service, print where you are ATH_MSG_DEBUG("MuonTGMeasAssocAlg::storeMeasurements()"); @@ -436,16 +389,16 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { if ( rots.size() > 0 ) { Identifier id = rots[0]->identify(); Amg::Vector3D pos(0., 0., 0.); - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) { + if (m_idHelperSvc->isMdt(id)) { const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id); pos = mdtROE->tubePos(id); - } else if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(id)) { + } else if ( m_idHelperSvc->isRpc(id)) { const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); pos = rpcROE->stripPos(id); - } else if ( m_muonIdHelperTool->mdtIdHelper().is_csc(id)) { + } else if ( m_idHelperSvc->isCsc(id)) { const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); pos = cscROE->stripPos(id); - } else if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(id)) { + } else if ( m_idHelperSvc->isTgc(id)) { const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); pos = tgcROE->channelPos(id); } @@ -550,12 +503,12 @@ Muon::MuonTGMeasAssocAlg::createMdtHitCollectionLayers(const MuonGM::MuonDetecto if (!layer) { ATH_MSG_ERROR( "MuonTGMeasAssocAlg::No layer associated with this MDT hit! (digit = " << dig_id << ")" ); - ATH_MSG_ERROR( "station name,eta,phi" << m_muonIdHelperTool->mdtIdHelper().stationName(dig_id) << "," - << m_muonIdHelperTool->mdtIdHelper().stationEta(dig_id) << "," - << m_muonIdHelperTool->mdtIdHelper().stationPhi(dig_id) ); - ATH_MSG_ERROR( "multilayer,layer,tube:" << m_muonIdHelperTool->mdtIdHelper().multilayer(dig_id) << "," << - m_muonIdHelperTool->mdtIdHelper().tubeLayer(dig_id) <<"," << - m_muonIdHelperTool->mdtIdHelper().tube(dig_id) ); + ATH_MSG_ERROR( "station name,eta,phi" << m_idHelperSvc->mdtIdHelper().stationName(dig_id) << "," + << m_idHelperSvc->mdtIdHelper().stationEta(dig_id) << "," + << m_idHelperSvc->mdtIdHelper().stationPhi(dig_id) ); + ATH_MSG_ERROR( "multilayer,layer,tube:" << m_idHelperSvc->mdtIdHelper().multilayer(dig_id) << "," << + m_idHelperSvc->mdtIdHelper().tubeLayer(dig_id) <<"," << + m_idHelperSvc->mdtIdHelper().tube(dig_id) ); continue; } @@ -574,9 +527,7 @@ Muon::MuonTGMeasAssocAlg::createMdtHitCollectionLayers(const MuonGM::MuonDetecto //Add the hit to the layer, order hits by tube number std::vector<const Trk::PrepRawData*>::iterator piter = (*itr)->second->begin(); while ( piter !=(*itr)->second->end() - && m_muonIdHelperTool->mdtIdHelper().tube(dig_id)> m_muonIdHelperTool->mdtIdHelper().tube((*piter)->identify()) ) piter++; - //(*itr)->second->push_back(new Muon::MdtPrepData(*(*mdtPrd))); - //(*itr)->second->insert(piter,new Muon::MdtPrepData(*(*mdtPrd))); + && m_idHelperSvc->mdtIdHelper().tube(dig_id)> m_idHelperSvc->mdtIdHelper().tube((*piter)->identify()) ) piter++; (*itr)->second->insert(piter,*mdtPrd); } } @@ -639,14 +590,14 @@ Muon::MuonTGMeasAssocAlg::createRpcHitCollectionLayers(const MuonGM::MuonDetecto if (!layer) { ATH_MSG_ERROR( " No layer associated with this RPC hit! (digit = " << dig_id << ")" ); - ATH_MSG_ERROR( "station name,eta,phi" << m_muonIdHelperTool->rpcIdHelper().stationName(dig_id) << "," - << m_muonIdHelperTool->rpcIdHelper().stationEta(dig_id) << "," - << m_muonIdHelperTool->rpcIdHelper().stationPhi(dig_id) ); - ATH_MSG_ERROR( "doubletR,doubletZ,doubletPhi,gasGap:"<<m_muonIdHelperTool->rpcIdHelper().doubletR(dig_id)<<","<< - m_muonIdHelperTool->rpcIdHelper().doubletZ(dig_id)<<","<< - m_muonIdHelperTool->rpcIdHelper().doubletPhi(dig_id) << ","<< - m_muonIdHelperTool->rpcIdHelper().gasGap(dig_id)); - ATH_MSG_ERROR( "measuresPhi:"<<m_muonIdHelperTool->rpcIdHelper().measuresPhi(dig_id)); + ATH_MSG_ERROR( "station name,eta,phi" << m_idHelperSvc->rpcIdHelper().stationName(dig_id) << "," + << m_idHelperSvc->rpcIdHelper().stationEta(dig_id) << "," + << m_idHelperSvc->rpcIdHelper().stationPhi(dig_id) ); + ATH_MSG_ERROR( "doubletR,doubletZ,doubletPhi,gasGap:"<<m_idHelperSvc->rpcIdHelper().doubletR(dig_id)<<","<< + m_idHelperSvc->rpcIdHelper().doubletZ(dig_id)<<","<< + m_idHelperSvc->rpcIdHelper().doubletPhi(dig_id) << ","<< + m_idHelperSvc->rpcIdHelper().gasGap(dig_id)); + ATH_MSG_ERROR( "measuresPhi:"<<m_idHelperSvc->rpcIdHelper().measuresPhi(dig_id)); continue; } @@ -737,12 +688,12 @@ Muon::MuonTGMeasAssocAlg::createCscHitCollectionLayers(const MuonGM::MuonDetecto if (!layer) { ATH_MSG_ERROR( " No layer associated with this CSC hit! (digit = " << dig_id << ")" ); - ATH_MSG_ERROR( "station name,eta,phi" << m_muonIdHelperTool->cscIdHelper().stationName(dig_id) << "," - << m_muonIdHelperTool->cscIdHelper().stationEta(dig_id) << "," - << m_muonIdHelperTool->cscIdHelper().stationPhi(dig_id) ); - ATH_MSG_ERROR( "chamberLayer,wireLayer,measuresPhi:" << m_muonIdHelperTool->cscIdHelper().chamberLayer(dig_id)<<","<< - m_muonIdHelperTool->cscIdHelper().wireLayer(dig_id)<<","<< - m_muonIdHelperTool->cscIdHelper().measuresPhi(dig_id)); + ATH_MSG_ERROR( "station name,eta,phi" << m_idHelperSvc->cscIdHelper().stationName(dig_id) << "," + << m_idHelperSvc->cscIdHelper().stationEta(dig_id) << "," + << m_idHelperSvc->cscIdHelper().stationPhi(dig_id) ); + ATH_MSG_ERROR( "chamberLayer,wireLayer,measuresPhi:" << m_idHelperSvc->cscIdHelper().chamberLayer(dig_id)<<","<< + m_idHelperSvc->cscIdHelper().wireLayer(dig_id)<<","<< + m_idHelperSvc->cscIdHelper().measuresPhi(dig_id)); continue; } @@ -834,11 +785,11 @@ Muon::MuonTGMeasAssocAlg::createTgcHitCollectionLayers(const MuonGM::MuonDetecto if (!layer) { ATH_MSG_ERROR( " No layer associated with this TGC hit! (digit = " << dig_id << ")" ); - ATH_MSG_ERROR( "station name,eta,phi" << m_muonIdHelperTool->tgcIdHelper().stationName(dig_id) << "," - << m_muonIdHelperTool->tgcIdHelper().stationEta(dig_id) << "," - << m_muonIdHelperTool->tgcIdHelper().stationPhi(dig_id) ); - ATH_MSG_ERROR( "gasGap,isStrip:" << m_muonIdHelperTool->tgcIdHelper().gasGap(dig_id)<<","<< - m_muonIdHelperTool->tgcIdHelper().isStrip(dig_id)); + ATH_MSG_ERROR( "station name,eta,phi" << m_idHelperSvc->tgcIdHelper().stationName(dig_id) << "," + << m_idHelperSvc->tgcIdHelper().stationEta(dig_id) << "," + << m_idHelperSvc->tgcIdHelper().stationPhi(dig_id) ); + ATH_MSG_ERROR( "gasGap,isStrip:" << m_idHelperSvc->tgcIdHelper().gasGap(dig_id)<<","<< + m_idHelperSvc->tgcIdHelper().isStrip(dig_id)); continue; } @@ -909,9 +860,9 @@ void Muon::MuonTGMeasAssocAlg::createStationMap(const Trk::TrackingVolume* vol, if ( (*dter)->layerRepresentation() && (*dter)->layerRepresentation()->layerType()>0 ) { Identifier id((*dter)->layerRepresentation()->layerType()); const MuonGM::MuonStation* mStation = 0; - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) mStation = MuonDetMgr->getMdtReadoutElement(id)->parentMuonStation(); - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) mStation = MuonDetMgr->getRpcReadoutElement(id)->parentMuonStation(); - if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) { + if (m_idHelperSvc->isMdt(id)) mStation = MuonDetMgr->getMdtReadoutElement(id)->parentMuonStation(); + if (m_idHelperSvc->isRpc(id)) mStation = MuonDetMgr->getRpcReadoutElement(id)->parentMuonStation(); + if (m_idHelperSvc->isTgc(id)) { if ( !MuonDetMgr->getTgcReadoutElement(id) ) { // tgc readout element not found, get any active layer to recover const Trk::Layer* lay = associatedLayer((*dter)->trackingVolume(),Identifier(0)); if (lay) mStation = MuonDetMgr->getTgcReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); @@ -919,7 +870,7 @@ void Muon::MuonTGMeasAssocAlg::createStationMap(const Trk::TrackingVolume* vol, mStation = MuonDetMgr->getTgcReadoutElement(id)->parentMuonStation(); } } - if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { + if (m_idHelperSvc->isCsc(id)) { if ( !MuonDetMgr->getCscReadoutElement(id) ) { const Trk::Layer* lay = associatedLayer((*dter)->trackingVolume(),Identifier(0)); if (lay) mStation = MuonDetMgr->getCscReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); @@ -985,7 +936,7 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifie if (!station) { ATH_MSG_WARNING("no associated TG station found for hit id:"<< id << ","<< techn); if (techn==2 && m_allowGeomAssoc) { - ATH_MSG_WARNING(m_muonIdHelperTool->tgcIdHelper().stationName(id)<<","<<m_muonIdHelperTool->tgcIdHelper().stationEta(id)<< ","<<m_muonIdHelperTool->tgcIdHelper().stationPhi(id)); + ATH_MSG_WARNING(m_idHelperSvc->tgcIdHelper().stationName(id)<<","<<m_idHelperSvc->tgcIdHelper().stationEta(id)<< ","<<m_idHelperSvc->tgcIdHelper().stationPhi(id)); //Get the TgcReadoutElement and the tube position from it const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); @@ -993,8 +944,8 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifie std::vector<const Trk::DetachedTrackingVolume*>* detVols = m_trackingGeometry->lowestDetachedTrackingVolumes(pos); for (unsigned int i = 0;i<detVols->size();i++) { Identifier sId((*detVols)[i]->layerRepresentation()->layerType()); - ATH_MSG_INFO("geom assoc with station:"<< (*detVols)[i]<<","<<(*detVols)[i]->name()<<","<<(*detVols)[i]->layerRepresentation()->layerType() <<":"<< m_muonIdHelperTool->tgcIdHelper().stationName(sId)<<","<<m_muonIdHelperTool->tgcIdHelper().stationEta(sId) - <<","<<m_muonIdHelperTool->tgcIdHelper().stationPhi(sId) ); + ATH_MSG_INFO("geom assoc with station:"<< (*detVols)[i]<<","<<(*detVols)[i]->name()<<","<<(*detVols)[i]->layerRepresentation()->layerType() <<":"<< m_idHelperSvc->tgcIdHelper().stationName(sId)<<","<<m_idHelperSvc->tgcIdHelper().stationEta(sId) + <<","<<m_idHelperSvc->tgcIdHelper().stationPhi(sId) ); ATH_MSG_INFO("updating station map"); m_stationMap[stId]=std::pair<const MuonGM::MuonStation*,const Trk::DetachedTrackingVolume*>(mStation,(*detVols)[i]); } @@ -1023,14 +974,14 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(const Trk::TrackingV Identifier idLay( (*iLay)->layerType() ); if (!id.get_identifier32().get_compact() && idLay.get_identifier32().get_compact()) return (*iLay); if (!idLay.get_identifier32().get_compact()) continue; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id) && - m_muonIdHelperTool->mdtIdHelper().multilayer(idLay)==m_muonIdHelperTool->mdtIdHelper().multilayer(id) && - m_muonIdHelperTool->mdtIdHelper().tubeLayer(idLay)==m_muonIdHelperTool->mdtIdHelper().tubeLayer(id) ) return (*iLay); - if ( m_muonIdHelperTool->tgcIdHelper().is_tgc(id) && - m_muonIdHelperTool->tgcIdHelper().gasGap(idLay)==m_muonIdHelperTool->tgcIdHelper().gasGap(id) ) return (*iLay); - if ( m_muonIdHelperTool->cscIdHelper().is_csc(id) && - m_muonIdHelperTool->cscIdHelper().chamberLayer(idLay)==m_muonIdHelperTool->cscIdHelper().chamberLayer(id) && - m_muonIdHelperTool->cscIdHelper().wireLayer(idLay)==m_muonIdHelperTool->cscIdHelper().wireLayer(id) ) return (*iLay); + if ( m_idHelperSvc->isMdt(id) && + m_idHelperSvc->mdtIdHelper().multilayer(idLay)==m_idHelperSvc->mdtIdHelper().multilayer(id) && + m_idHelperSvc->mdtIdHelper().tubeLayer(idLay)==m_idHelperSvc->mdtIdHelper().tubeLayer(id) ) return (*iLay); + if ( m_idHelperSvc->isTgc(id) && + m_idHelperSvc->tgcIdHelper().gasGap(idLay)==m_idHelperSvc->tgcIdHelper().gasGap(id) ) return (*iLay); + if ( m_idHelperSvc->isCsc(id) && + m_idHelperSvc->cscIdHelper().chamberLayer(idLay)==m_idHelperSvc->cscIdHelper().chamberLayer(id) && + m_idHelperSvc->cscIdHelper().wireLayer(idLay)==m_idHelperSvc->cscIdHelper().wireLayer(id) ) return (*iLay); } return layer; } @@ -1041,11 +992,10 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(const Trk::TrackingV for ( ; iLay!=confLays->end(); iLay++ ) { Identifier idLay( (*iLay)->layerType() ); if (!id.get_identifier32().get_compact() && idLay.get_identifier32().get_compact()) return (*iLay); - if ( idLay.get_identifier32().get_compact()>0 && m_muonIdHelperTool->rpcIdHelper().is_rpc(id) && - m_muonIdHelperTool->rpcIdHelper().doubletR(idLay) == m_muonIdHelperTool->rpcIdHelper().doubletR(id) && - m_muonIdHelperTool->rpcIdHelper().doubletZ(idLay) == m_muonIdHelperTool->rpcIdHelper().doubletZ(id) && - //&& m_muonIdHelperTool->rpcIdHelper().doubletPhi(idLay) == m_muonIdHelperTool->rpcIdHelper().doubletPhi(id) && - m_muonIdHelperTool->rpcIdHelper().gasGap(idLay) == m_muonIdHelperTool->rpcIdHelper().gasGap(id) ) return (*iLay); + if ( idLay.get_identifier32().get_compact()>0 && m_idHelperSvc->isRpc(id) && + m_idHelperSvc->rpcIdHelper().doubletR(idLay) == m_idHelperSvc->rpcIdHelper().doubletR(id) && + m_idHelperSvc->rpcIdHelper().doubletZ(idLay) == m_idHelperSvc->rpcIdHelper().doubletZ(id) && + m_idHelperSvc->rpcIdHelper().gasGap(idLay) == m_idHelperSvc->rpcIdHelper().gasGap(id) ) return (*iLay); } return layer; } @@ -1064,32 +1014,32 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(const Trk::TrackingV Identifier Muon::MuonTGMeasAssocAlg::getStationId( Identifier id ) const { Identifier stId(0); - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) stId = m_muonIdHelperTool->mdtIdHelper().elementID(m_muonIdHelperTool->mdtIdHelper().stationName(id), - m_muonIdHelperTool->mdtIdHelper().stationEta(id), - m_muonIdHelperTool->mdtIdHelper().stationPhi(id)); + if ( m_idHelperSvc->isMdt(id)) stId = m_idHelperSvc->mdtIdHelper().elementID(m_idHelperSvc->mdtIdHelper().stationName(id), + m_idHelperSvc->mdtIdHelper().stationEta(id), + m_idHelperSvc->mdtIdHelper().stationPhi(id)); // BML station is an exception - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id) && m_muonIdHelperTool->mdtIdHelper().stationName(id)==2) - stId = m_muonIdHelperTool->rpcIdHelper().elementID(m_muonIdHelperTool->mdtIdHelper().stationName(id), - m_muonIdHelperTool->mdtIdHelper().stationEta(id), - m_muonIdHelperTool->mdtIdHelper().stationPhi(id),1); + if (m_idHelperSvc->isMdt(id) && m_idHelperSvc->mdtIdHelper().stationName(id)==2) + stId = m_idHelperSvc->rpcIdHelper().elementID(m_idHelperSvc->mdtIdHelper().stationName(id), + m_idHelperSvc->mdtIdHelper().stationEta(id), + m_idHelperSvc->mdtIdHelper().stationPhi(id),1); - if ( m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) stId = m_muonIdHelperTool->rpcIdHelper().elementID(m_muonIdHelperTool->rpcIdHelper().stationName(id), - m_muonIdHelperTool->rpcIdHelper().stationEta(id), - m_muonIdHelperTool->rpcIdHelper().stationPhi(id),1); + if ( m_idHelperSvc->isRpc(id)) stId = m_idHelperSvc->rpcIdHelper().elementID(m_idHelperSvc->rpcIdHelper().stationName(id), + m_idHelperSvc->rpcIdHelper().stationEta(id), + m_idHelperSvc->rpcIdHelper().stationPhi(id),1); // rpc not allways relevant - if ( m_muonIdHelperTool->rpcIdHelper().is_rpc(id) && m_stationMap.size() && !(m_stationMap)[stId].second ) { - stId = m_muonIdHelperTool->mdtIdHelper().elementID(m_muonIdHelperTool->mdtIdHelper().stationName(id), - m_muonIdHelperTool->mdtIdHelper().stationEta(id), - m_muonIdHelperTool->mdtIdHelper().stationPhi(id) ); + if ( m_idHelperSvc->isRpc(id) && m_stationMap.size() && !(m_stationMap)[stId].second ) { + stId = m_idHelperSvc->mdtIdHelper().elementID(m_idHelperSvc->mdtIdHelper().stationName(id), + m_idHelperSvc->mdtIdHelper().stationEta(id), + m_idHelperSvc->mdtIdHelper().stationPhi(id) ); } - if ( m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) stId = m_muonIdHelperTool->tgcIdHelper().elementID(m_muonIdHelperTool->tgcIdHelper().stationName(id), - m_muonIdHelperTool->tgcIdHelper().stationEta(id), - m_muonIdHelperTool->tgcIdHelper().stationPhi(id)); - if ( m_muonIdHelperTool->cscIdHelper().is_csc(id)) stId = m_muonIdHelperTool->cscIdHelper().elementID(m_muonIdHelperTool->cscIdHelper().stationName(id), - m_muonIdHelperTool->cscIdHelper().stationEta(id), - m_muonIdHelperTool->cscIdHelper().stationPhi(id)); + if ( m_idHelperSvc->isTgc(id)) stId = m_idHelperSvc->tgcIdHelper().elementID(m_idHelperSvc->tgcIdHelper().stationName(id), + m_idHelperSvc->tgcIdHelper().stationEta(id), + m_idHelperSvc->tgcIdHelper().stationPhi(id)); + if ( m_idHelperSvc->isCsc(id)) stId = m_idHelperSvc->cscIdHelper().elementID(m_idHelperSvc->cscIdHelper().stationName(id), + m_idHelperSvc->cscIdHelper().stationEta(id), + m_idHelperSvc->cscIdHelper().stationPhi(id)); return stId; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h index 40f18e38daaa543def2bec3367e6da023504329e..5539c325754ad3d1d70b17812f92fda348567a41 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/STgcClusterization/src/SimpleSTgcClusterBuilderTool.h @@ -1,23 +1,19 @@ /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ + #ifndef SimpleSTgcClusterBuilderTool_h #define SimpleSTgcClusterBuilderTool_h -#include "GaudiKernel/ServiceHandle.h" #include "STgcClusterization/ISTgcClusterBuilderTool.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <vector> +#include <string> #include <set> -namespace MuonGM -{ - class MuonDetectorManager; -} - - // // Simple clusterization tool for STgc // diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/MuonCombinePatternTools/MuonCombinePatternTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/MuonCombinePatternTools/MuonCombinePatternTool.h index bf4bd75e589a7c2083fb38029624857045375a18..e8f7b764ccd613f09147a3e66ba1a3f2e0c640a4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/MuonCombinePatternTools/MuonCombinePatternTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/MuonCombinePatternTools/MuonCombinePatternTool.h @@ -5,20 +5,15 @@ #ifndef MUONCOMBINEPATTERNTOOLS_MUONCOMBINEPATTERNTOOL_H #define MUONCOMBINEPATTERNTOOLS_MUONCOMBINEPATTERNTOOL_H -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonRecToolInterfaces/IMuonCombinePatternTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonHoughPatternEvent/MuonHoughMathUtils.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include <cmath> -namespace MuonGM { - class MuonDetectorManager; -} - - class MuonCombinePatternTool : public AthAlgTool, virtual public Muon::IMuonCombinePatternTool { private: @@ -37,15 +32,10 @@ class MuonCombinePatternTool : public AthAlgTool, virtual public Muon::IMuonComb typedef IdChMap::iterator IdChIt; public: - /** constructor */ MuonCombinePatternTool(const std::string& type, const std::string& name, const IInterface* parent); - /** destructor */ - virtual ~MuonCombinePatternTool(){}; + virtual ~MuonCombinePatternTool()=default; - /** to initiate private members */ virtual StatusCode initialize(); - /** to delete private members */ - virtual StatusCode finalize(); /** Combines phi and eta pattern collection into a new combined pattern collection */ virtual const MuonPrdPatternCollection* combineEtaPhiPatterns(const MuonPrdPatternCollection* phiPatternCollection, const MuonPrdPatternCollection* etaPatternCollection, @@ -149,8 +139,7 @@ class MuonCombinePatternTool : public AthAlgTool, virtual public Muon::IMuonComb unsigned int m_maxSizePhiPatternLoose; unsigned int m_maxSizeEtaPatternLoose; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/src/MuonCombinePatternTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/src/MuonCombinePatternTool.cxx index 85dc21b120950c7542884ce1263e69482302038b..0ecb92f499a981766968b9dcb589452ae1d2e9c5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/src/MuonCombinePatternTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonCombinePatternTools/src/MuonCombinePatternTool.cxx @@ -4,23 +4,12 @@ #include "MuonCombinePatternTools/MuonCombinePatternTool.h" - #include "CxxUtils/sincos.h" - #include "TrkSurfaces/Surface.h" // should not be included - #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" - #include "MuonPattern/MuonPatternChamberIntersect.h" - #include "MuonHoughPatternEvent/MuonHoughPattern.h" - #include "TrkParameters/TrackParameters.h" #include <iterator> @@ -31,18 +20,17 @@ double rotatePhi( double phi, double rotationFraction ) { return phi + rotationFraction*M_PI; } -MuonCombinePatternTool::MuonCombinePatternTool(const std::string& type, const std::string& name, const IInterface* parent): -AthAlgTool(type,name,parent), -m_maximum_xydistance(3500), -m_maximum_rzdistance(1500), -m_use_cosmics(false), -m_splitpatterns(true), -m_nodiscarding(true), -m_bestphimatch(false), -m_flipdirectionforcosmics(false) +MuonCombinePatternTool::MuonCombinePatternTool(const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type,name,parent), + m_maximum_xydistance(3500), + m_maximum_rzdistance(1500), + m_use_cosmics(false), + m_splitpatterns(true), + m_nodiscarding(true), + m_bestphimatch(false), + m_flipdirectionforcosmics(false) { declareInterface< IMuonCombinePatternTool >(this); - declareProperty("UseCosmics",m_use_cosmics); declareProperty("SplitPatterns",m_splitpatterns); declareProperty("NoDiscarding",m_nodiscarding); @@ -55,28 +43,15 @@ m_flipdirectionforcosmics(false) StatusCode MuonCombinePatternTool::initialize() { - ATH_MSG_DEBUG("MuonCombinePatternTool::initialize"); - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_MSG_DEBUG(" Retrieved MuonIdHelperTool"); - + ATH_CHECK(m_idHelperSvc.retrieve()); if (m_use_cosmics == false) { m_splitpatterns = false; } if (m_use_cosmics == true) { m_bestphimatch = true; } - ATH_MSG_DEBUG(" UseCosmics: " << m_use_cosmics << " Split Patterns: " << m_splitpatterns << " NoDiscarding: " << m_nodiscarding << " BestPhiMatch: " << m_bestphimatch ); - - return StatusCode::SUCCESS; - -} - -StatusCode MuonCombinePatternTool::finalize() -{ - ATH_MSG_DEBUG("MuonCombinePatternTool::finalize"); return StatusCode::SUCCESS; } @@ -225,7 +200,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co const double hitz=globalposhit.z(); double radius_hit = std::sqrt(hitx*hitx+hity*hity); double dotprodradius = sctheta.apply(radius_hit,hitz); // (radius_hit) * sctheta.sn + hitz * sctheta.cs; - ATH_MSG_VERBOSE("combine hit: " << m_muonIdHelperTool->toString(prd->identify()) << " dotprod: " << dotprodradius); + ATH_MSG_VERBOSE("combine hit: " << m_idHelperSvc->toString(prd->identify()) << " dotprod: " << dotprodradius); if (dotprodradius >=0 || m_use_cosmics == true) // should be on { double residu_distance_mm = 1000000.; @@ -250,7 +225,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co average_distance += distancetoline; if( useTightAssociation ){ - Identifier chId = m_muonIdHelperTool->chamberId(prd->identify()); + Identifier chId = m_idHelperSvc->chamberId(prd->identify()); std::map<Identifier, ChamberInfo >::iterator chPos = infoPerChamber.find(chId); ChamberInfo* chInfo = 0; if( chPos != infoPerChamber.end() ){ @@ -263,7 +238,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co if( hitphi < chInfo->phiMin ) chInfo->phiMin = hitphi; if( hitphi > chInfo->phiMax ) chInfo->phiMax = hitphi; - Muon::MuonStationIndex::StIndex stIndex = m_muonIdHelperTool->stationIndex(prd->identify()); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(prd->identify()); std::map<Muon::MuonStationIndex::StIndex, ChamberInfo >::iterator stPos = infoPerStation.find(stIndex); if( stPos != infoPerStation.end() ){ chInfo = &stPos->second; @@ -278,7 +253,6 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co } } } // dotprodradius - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg; } // size muonpattern if ( nhits_in_average > 0 ) average_distance /= nhits_in_average; @@ -311,7 +285,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co bool hit_passed = false; double etadistancetoline = std::abs(m_muonHoughMathUtils.distanceToLine(etahitx,etahity,r0,phi)); - ATH_MSG_VERBOSE("combine: " << m_muonIdHelperTool->toString(prd->identify()) << " distance xy " << etadistancetoline); + ATH_MSG_VERBOSE("combine: " << m_idHelperSvc->toString(prd->identify()) << " distance xy " << etadistancetoline); if (m_use_cosmics == true) { // phi cone does not work for cosmics since hits might be close to position of pattern @@ -333,7 +307,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co ATH_MSG_VERBOSE(" accepted"); if( useTightAssociation ){ - Identifier chId = m_muonIdHelperTool->chamberId(prd->identify()); + Identifier chId = m_idHelperSvc->chamberId(prd->identify()); std::map<Identifier, ChamberInfo >::iterator chPos = infoPerChamber.find(chId); ChamberInfo* chInfo = 0; if( chPos != infoPerChamber.end() ){ @@ -342,9 +316,9 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co chInfo = &infoPerChamber[chId]; } ++chInfo->neta; - if( m_muonIdHelperTool->isMdt(prd->identify()) ){ + if( m_idHelperSvc->isMdt(prd->identify()) ){ - Muon::MuonStationIndex::StIndex stIndex = m_muonIdHelperTool->stationIndex(prd->identify()); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(prd->identify()); ChamberInfo& stInfo = infoPerStation[stIndex]; const MuonGM::MdtReadoutElement* mdtDetEl = dynamic_cast<const MuonGM::MdtReadoutElement*>(prd->detectorElement()); @@ -352,13 +326,13 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co const Identifier& id = prd->identify(); const Trk::Surface& surf = mdtDetEl->surface(id); - int layer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); double halfLength = 0.5*mdtDetEl->getWireLength(layer,tube); Amg::Vector2D lpLeft(0,-halfLength); const Amg::Vector3D* gposLeft = surf.localToGlobal(lpLeft); if( !gposLeft ){ - ATH_MSG_WARNING(" Failed calculation left phi for "<< m_muonIdHelperTool->toString(id) ); + ATH_MSG_WARNING(" Failed calculation left phi for "<< m_idHelperSvc->toString(id) ); continue; } double phiLeft = gposLeft->phi(); @@ -367,7 +341,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co Amg::Vector2D lpRight(0,halfLength); const Amg::Vector3D* gposRight = surf.localToGlobal(lpRight); if( !gposRight ){ - ATH_MSG_WARNING(" Failed calculation right phi for "<< m_muonIdHelperTool->toString(id) ); + ATH_MSG_WARNING(" Failed calculation right phi for "<< m_idHelperSvc->toString(id) ); continue; } double phiRight = gposRight->phi(); @@ -477,7 +451,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co ATH_MSG_DEBUG(" phi range (" << std::setprecision(3) << std::setw(4) << stInfo.phiMin << "," << std::setw(4) << stInfo.phiMax << ") "); } ATH_MSG_DEBUG(" pat range (" << std::setprecision(3) << std::setw(4) << phiMinPat << "," << std::setw(4) << phiMaxPat << ") " - << m_muonIdHelperTool->toString(prd->identify())); + << m_idHelperSvc->toString(prd->identify())); if( mdtDetEl->hasCutouts() ) { ATH_MSG_DEBUG(" hasCutOuts "); } ATH_MSG_DEBUG(" ATL " << mdtDetEl->getActiveTubeLength(layer,tube) << " WL " << mdtDetEl->getWireLength(layer,tube) @@ -498,9 +472,8 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co std::map<Identifier, ChamberInfo>::iterator chit = infoPerChamber.begin(); std::map<Identifier, ChamberInfo>::iterator chit_end = infoPerChamber.end(); std::map<int,ChamberInfo> hitsPerSector; - //std::set<MuonStationIndex::PhiIndex> for( ;chit!=chit_end;++chit ){ - if( myDebug ) { ATH_MSG_DEBUG(" " << std::setw(32) << m_muonIdHelperTool->toStringChamber(chit->first) + if( myDebug ) { ATH_MSG_DEBUG(" " << std::setw(32) << m_idHelperSvc->toStringChamber(chit->first) << " eta hits " << chit->second.neta << " phi hits " << chit->second.nphi << " ninside " << chit->second.ninside @@ -509,16 +482,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co << " noutside " << chit->second.noutsidePat); } if( chit->second.neta > 0 && chit->second.nphi ) ++netaPhiPairs; -// if( (m_muonIdHelperTool->isMdt(chit->first) || m_muonIdHelperTool->isRpc(chit->first) || m_muonIdHelperTool->isCsc(chit->first)) ){ -// int sector = m_muonIdHelperTool->sector(chit->first); -// ChamberInfo& info = hitsPerSector[sector]; -// info.neta += chit->second.neta; -// info.nphi += chit->second.nphi; -// info.ninside += chit->second.ninside; -// info.noutside += chit->second.noutside; -// info.ninsidePat += chit->second.ninsidePat; -// info.noutsidePat += chit->second.noutsidePat; -// } + } if( myDebug ) { ATH_MSG_DEBUG(" eta/phi pattern hit overlap " << netaPhiPairs); @@ -572,12 +536,12 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co for (unsigned int etahitid=0; etahitid < etapattern->numberOfContainedPrds(); etahitid++) { const Trk::PrepRawData* prd = etapattern->prd(etahitid); const Identifier& id = prd->identify(); - Identifier chId = m_muonIdHelperTool->chamberId(id); + Identifier chId = m_idHelperSvc->chamberId(id); std::map<Identifier, ChamberInfo >::iterator chPos = infoPerChamber.find(chId); if( chPos == infoPerChamber.end() ) continue; - if( m_muonIdHelperTool->isMdt(id) ) { + if( m_idHelperSvc->isMdt(id) ) { if( chPos->second.ninside == 0 && chPos->second.noutside > 0 ) continue; if( chPos->second.ninsidePat == 0 && chPos->second.noutsidePat > 0 ) continue; }else{ @@ -588,7 +552,7 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co for (unsigned int phihitid=0; phihitid < phipattern->numberOfContainedPrds(); phihitid++) { const Trk::PrepRawData* prd = phipattern->prd(phihitid); const Identifier& id = prd->identify(); - Identifier chId = m_muonIdHelperTool->chamberId(id); + Identifier chId = m_idHelperSvc->chamberId(id); std::map<Identifier, ChamberInfo >::iterator chPos = infoPerChamber.find(chId); if( chPos == infoPerChamber.end() ) continue; @@ -692,14 +656,14 @@ const MuonPrdPatternCollection* MuonCombinePatternTool::combineEtaPhiPatterns(co } if (ismatched == false ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "NO COMBINED Candidate FOUND eta " << etalevel << " phi " << phibest; - if (m_use_cosmics==false) msg(MSG::DEBUG) << "dotprodbest: " << dotprodbest; - msg(MSG::DEBUG) << "writing out eta pattern (no cleanup)" << endmsg; + ATH_MSG_DEBUG("NO COMBINED Candidate FOUND eta " << etalevel << " phi " << phibest); + if (m_use_cosmics==false) ATH_MSG_DEBUG("dotprodbest: " << dotprodbest); + ATH_MSG_DEBUG("writing out eta pattern (no cleanup)"); } Muon::MuonPrdPattern* phi_dummy = 0; candidates.push_back(std::make_pair(etapattern,phi_dummy)); }else{ - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Candidate was associated to a phi pattern " << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Candidate was associated to a phi pattern "); } } // size rtheta level @@ -835,7 +799,7 @@ Muon::MuonPrdPattern* MuonCombinePatternTool::makeCombinedPattern(const Muon::Mu ATH_MSG_DEBUG("Combined Track size: " << combinedpattern->numberOfContainedPrds() ); if (m_use_cosmics == true) { - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No Cleaning for Cosmics!" << endmsg; + if (msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE("No Cleaning for Cosmics!"); if (msgLvl(MSG::VERBOSE)) {printPattern(combinedpattern);} return combinedpattern; @@ -1004,11 +968,11 @@ std::vector <std::pair<Muon::MuonPrdPattern*, Muon::MuonPrdPattern*> > MuonCombi splitPatterns.push_back(std::make_pair(phipattern2,etapattern2)); if ( msgLvl(MSG::DEBUG) ) { - msg(MSG::DEBUG) << " split pattern theta: " << theta << " phi: " << phi << endmsg; - msg(MSG::VERBOSE) << " split pattern1 theta: " << etapattern1->globalDirection().theta() << " phi: " << etapattern1->globalDirection().phi() << endmsg; - msg(MSG::VERBOSE) << " split pattern2 theta: " << etapattern2->globalDirection().theta() << " phi: " << etapattern2->globalDirection().phi() << endmsg; + ATH_MSG_DEBUG(" split pattern theta: " << theta << " phi: " << phi); + ATH_MSG_DEBUG(" split pattern1 theta: " << etapattern1->globalDirection().theta() << " phi: " << etapattern1->globalDirection().phi()); + ATH_MSG_DEBUG(" split pattern2 theta: " << etapattern2->globalDirection().theta() << " phi: " << etapattern2->globalDirection().phi()); std::vector<double> splitpoint = m_muonHoughMathUtils.shortestPointOfLineToOrigin(globalpos.x(),globalpos.y(),globalpos.z(),phi,theta); - msg(MSG::DEBUG) << " splitpoint, x: " << splitpoint[0] << " y: " << splitpoint[1] << " z: " << splitpoint[2] << endmsg; + ATH_MSG_DEBUG(" splitpoint, x: " << splitpoint[0] << " y: " << splitpoint[1] << " z: " << splitpoint[2]); } double d_x = scphi.cs*sctheta.sn; @@ -1050,9 +1014,9 @@ std::vector <std::pair<Muon::MuonPrdPattern*, Muon::MuonPrdPattern*> > MuonCombi if ( msgLvl(MSG::DEBUG) ) { if (phipattern) { - msg(MSG::DEBUG) << "Final size, phi: " << phipattern1->numberOfContainedPrds() << " " << phipattern2->numberOfContainedPrds() << endmsg; + ATH_MSG_DEBUG("Final size, phi: " << phipattern1->numberOfContainedPrds() << " " << phipattern2->numberOfContainedPrds()); } - msg(MSG::DEBUG) << "Final size, eta: " << etapattern1->numberOfContainedPrds() << " " << etapattern2->numberOfContainedPrds() << endmsg; + ATH_MSG_DEBUG("Final size, eta: " << etapattern1->numberOfContainedPrds() << " " << etapattern2->numberOfContainedPrds()); } return splitPatterns; @@ -1155,9 +1119,9 @@ Muon::MuonPrdPattern* MuonCombinePatternTool::cleanupCombinedPattern(Muon::MuonP else { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Hit discarded: " << hitid << " dis xy " << distance_xy << " dis rz " << distance_rz << endmsg; - msg(MSG::DEBUG) << "Hit info: " << endmsg; - m_muonIdHelperTool->mdtIdHelper().print(prd->identify()); + ATH_MSG_DEBUG("Hit discarded: " << hitid << " dis xy " << distance_xy << " dis rz " << distance_rz); + ATH_MSG_DEBUG("Hit info: "); + m_idHelperSvc->mdtIdHelper().print(prd->identify()); } } } @@ -1365,7 +1329,7 @@ double* MuonCombinePatternTool::updateParametersForCosmics(const Muon::MuonPrdPa ATH_MSG_DEBUG("old parameters: r0: " << old_pars[0] << " phi: " << old_pars[1] << " rz0: " << old_pars[2] << " theta: " << old_pars[3] ); if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "phisize: " << phisize << " etasize: " << etasize << endmsg; + ATH_MSG_VERBOSE("phisize: " << phisize << " etasize: " << etasize); for (unsigned int i=0; i<phisize; i++) { const Trk::PrepRawData* prd = phipattern->prd(i); @@ -1373,9 +1337,9 @@ double* MuonCombinePatternTool::updateParametersForCosmics(const Muon::MuonPrdPa double hitx = globalposhit.x(); double hity = globalposhit.y(); double distance = m_muonHoughMathUtils.signedDistanceToLine(hitx,hity,r0,phi); - msg(MSG::VERBOSE) << "distance to updated parameters in xy: " << distance << endmsg; + ATH_MSG_VERBOSE("distance to updated parameters in xy: " << distance); distance = m_muonHoughMathUtils.signedDistanceToLine(hitx,hity,old_pars[0],old_pars[1]); - msg(MSG::VERBOSE) << "old distance phi hit: " << distance << endmsg; + ATH_MSG_VERBOSE("old distance phi hit: " << distance); } for (unsigned int i=0; i<etasize; i++) { @@ -1384,9 +1348,9 @@ double* MuonCombinePatternTool::updateParametersForCosmics(const Muon::MuonPrdPa double hitx = globalposhit.x(); double hity = globalposhit.y(); double distance = m_muonHoughMathUtils.signedDistanceToLine(hitx,hity,r0,phi); - msg(MSG::VERBOSE) << "distance to updated parameters in xy: " << distance << endmsg; + ATH_MSG_VERBOSE("distance to updated parameters in xy: " << distance); distance = m_muonHoughMathUtils.signedDistanceToLine(hitx,hity,old_pars[0],old_pars[1]); - msg(MSG::VERBOSE) << "old distance eta hit: " << distance << endmsg; + ATH_MSG_VERBOSE("old distance eta hit: " << distance); } for (unsigned int i=0; i<etasize; i++) { @@ -1395,9 +1359,9 @@ double* MuonCombinePatternTool::updateParametersForCosmics(const Muon::MuonPrdPa double hitz = globalposhit.z(); double perp = scphi.apply(globalposhit.y(),globalposhit.x()); //globalposhit.x()*scphi.cs + globalposhit.y()*scphi.sn; double distance = m_muonHoughMathUtils.signedDistanceToLine(hitz,perp,rz0,theta); - msg(MSG::VERBOSE) << "distance to updated parameters in Rz: " << distance << endmsg; + ATH_MSG_VERBOSE("distance to updated parameters in Rz: " << distance); distance = m_muonHoughMathUtils.signedDistanceToLine(hitz,perp,old_pars[2],old_pars[3]); - msg(MSG::VERBOSE) << "old distance: " << distance << endmsg; + ATH_MSG_VERBOSE("old distance: " << distance); } } @@ -1446,9 +1410,6 @@ std::pair<double,double> MuonCombinePatternTool::calculateR0Phi(const Muon::Muon sum_etay += globalposhit.y(); } -// const double av_etax = sum_etax / (etasize > 0 ? etasize : 1); -// const double av_etay = sum_etay / (etasize > 0 ? etasize : 1); - for (unsigned int i=0; i<phisize; i++) { const Trk::PrepRawData* prd = phipattern->prd(i); @@ -1457,16 +1418,11 @@ std::pair<double,double> MuonCombinePatternTool::calculateR0Phi(const Muon::Muon sum_phiy += globalposhit.y(); } -// const double av_phix = sum_phix / (phisize > 0 ? phisize : 1); -// const double av_phiy = sum_phiy / (phisize > 0 ? phisize : 1); - const double av_x = (eta_error_inv2*sum_etax + phi_error_inv2*sum_phix) / (eta_error_inv2*etasize + phi_error_inv2*phisize); const double av_y = (eta_error_inv2*sum_etay + phi_error_inv2*sum_phiy) / (eta_error_inv2*etasize + phi_error_inv2*phisize); if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << " av_x: " << av_x << " av_y: " << av_y << endmsg; -// msg(MSG::VERBOSE) << " av_etax: " << av_etax << " av_etay: " << av_etay << endmsg; -// msg(MSG::VERBOSE) << " av_phix: " << av_phix << " av_phiy: " << av_phiy << endmsg; + ATH_MSG_VERBOSE(" av_x: " << av_x << " av_y: " << av_y); } // calculate weighted sum: @@ -1674,14 +1630,14 @@ MuonPatternCombinationCollection* MuonCombinePatternTool::makePatternCombination const Trk::PrepRawData* prd = (*pit)->prd(i); Identifier channelId = prd->identify(); Identifier moduleId; - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(channelId)) - {moduleId = m_muonIdHelperTool->mdtIdHelper().elementID(channelId);} - else if (m_muonIdHelperTool->cscIdHelper().is_csc(channelId)) - {moduleId = m_muonIdHelperTool->cscIdHelper().elementID(channelId);} - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(channelId)) - {moduleId = m_muonIdHelperTool->tgcIdHelper().elementID(channelId);} - else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(channelId)) - {moduleId = m_muonIdHelperTool->rpcIdHelper().elementID(channelId);} + if (m_idHelperSvc->isMdt(channelId)) + {moduleId = m_idHelperSvc->mdtIdHelper().elementID(channelId);} + else if (m_idHelperSvc->isCsc(channelId)) + {moduleId = m_idHelperSvc->cscIdHelper().elementID(channelId);} + else if (m_idHelperSvc->isTgc(channelId)) + {moduleId = m_idHelperSvc->tgcIdHelper().elementID(channelId);} + else if (m_idHelperSvc->isRpc(channelId)) + {moduleId = m_idHelperSvc->rpcIdHelper().elementID(channelId);} else {ATH_MSG_ERROR("prd is not a muonhit?!");} chit = chamberMap.find(moduleId); @@ -1820,14 +1776,14 @@ bool MuonCombinePatternTool::subset(std::pair<std::set<const Trk::PrepRawData*,M void MuonCombinePatternTool::printPattern(const Muon::MuonPrdPattern* muonpattern)const { if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "Printout of Pattern: " << endmsg; + ATH_MSG_VERBOSE("Printout of Pattern: "); const Amg::Vector3D& pos = muonpattern->globalPosition(); const Amg::Vector3D& dir = muonpattern->globalDirection(); - msg(MSG::VERBOSE) << "pos: x: " << pos.x() << " y: " << pos.y() << " z: " << pos.z() << endmsg; - msg(MSG::VERBOSE) << "dir: x: " << dir.x() << " y: " << dir.y() << " z: " << dir.z() << endmsg; - msg(MSG::VERBOSE) << "phi: " << dir.phi() << " theta: " << dir.theta() << " rz0: " << pos.z()*std::sin(dir.theta()) << endmsg; + ATH_MSG_VERBOSE("pos: x: " << pos.x() << " y: " << pos.y() << " z: " << pos.z()); + ATH_MSG_VERBOSE("dir: x: " << dir.x() << " y: " << dir.y() << " z: " << dir.z()); + ATH_MSG_VERBOSE("phi: " << dir.phi() << " theta: " << dir.theta() << " rz0: " << pos.z()*std::sin(dir.theta())); for (unsigned int k=0; k<muonpattern->numberOfContainedPrds(); k++) { const Trk::PrepRawData* prd = muonpattern->prd(k); @@ -1835,16 +1791,16 @@ void MuonCombinePatternTool::printPattern(const Muon::MuonPrdPattern* muonpatter if (mdtprd) { const Trk::Surface& surface = mdtprd->detectorElement()->surface(mdtprd->identify()); const Amg::Vector3D& gpos = surface.center(); - msg(MSG::VERBOSE) << "mdt " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z() << endmsg; + ATH_MSG_VERBOSE("mdt " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z()); } else if (!mdtprd){ const Muon::MuonCluster* muoncluster = dynamic_cast <const Muon::MuonCluster*>(prd); if (muoncluster) { const Amg::Vector3D& gpos = muoncluster->globalPosition(); - msg(MSG::VERBOSE) << "cluster " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z() << endmsg; + ATH_MSG_VERBOSE("cluster " << k << " x: " << gpos.x() << " y: " << gpos.y() << " z: " << gpos.z()); } if(!muoncluster) { - msg(MSG::VERBOSE) << "no muon prd? " << endmsg; + ATH_MSG_VERBOSE("no muon prd? "); } } } @@ -1881,10 +1837,10 @@ Muon::MuonPrdPattern* MuonCombinePatternTool::cleanPhiPattern(const Muon::MuonPr const unsigned int size = phipattern->numberOfContainedPrds(); if ( msgLvl(MSG::DEBUG) ) { - msg(MSG::DEBUG) << "Start Phi hits cleaning with " << size << " hits " << " theta " << theta << endmsg; + ATH_MSG_DEBUG("Start Phi hits cleaning with " << size << " hits " << " theta " << theta); const Amg::Vector3D& oldpos = phipattern->globalPosition(); double r0 = m_muonHoughMathUtils.signedDistanceOfLineToOrigin2D(oldpos.x(),oldpos.y(),olddir.phi()); - msg(MSG::DEBUG) << "Start Phi: " << olddir.phi() << " r0: " << r0 << endmsg; + ATH_MSG_DEBUG("Start Phi: " << olddir.phi() << " r0: " << r0); } // need internal class to be able to remove hits fast @@ -2012,7 +1968,7 @@ void MuonCombinePatternTool::addCandidate(const Muon::MuonPrdPattern* etapattern // print associated pattern: if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "Associated Pattern: " << endmsg; + ATH_MSG_VERBOSE("Associated Pattern: "); printPattern(assphipattern); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/IMuonHoughPatternTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/IMuonHoughPatternTool.h index 4514ef6066ccb53a19c2ed0581d727e838018793..33e03d81ab97a1324543a6e92abac584b6664063 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/IMuonHoughPatternTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/IMuonHoughPatternTool.h @@ -2,25 +2,21 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#ifndef MUONHOUGHPATTERNTOOLS_IMUONHOUGHPATTERNTOOL_H +#define MUONHOUGHPATTERNTOOLS_IMUONHOUGHPATTERNTOOL_H + #include "GaudiKernel/IAlgTool.h" #include "MuonPattern/MuonPatternCollection.h" - -/** Must declare this, with name of interface*/ -static const InterfaceID IID_IMuonHoughPatternTool("IMuonHoughPatternTool", 1, 0); +#include "MuonHoughPatternEvent/MuonHoughPatternCollection.h" class MuonHoughHitContainer; -namespace Muon { - - class MuonPrdPattern;} - class IMuonHoughPatternTool : virtual public IAlgTool { public: /** @todo should be rethought and possibly using the Moore Interface */ - /** Declared here, and defined below*/ - static const InterfaceID& interfaceID(); + DeclareInterfaceID(IMuonHoughPatternTool, 1, 0); /** Builds Patterns */ virtual void makePatterns(const MuonHoughHitContainer* hitcontainer, MuonHoughPatternContainerShip& houghpatterns) const = 0; @@ -35,7 +31,4 @@ class IMuonHoughPatternTool : virtual public IAlgTool virtual void reset(MuonHoughPatternContainerShip& houghpattern) const =0; }; -inline const InterfaceID& IMuonHoughPatternTool::interfaceID() -{ - return IID_IMuonHoughPatternTool; -} +#endif //MUONHOUGHPATTERNTOOLS_IMUONHOUGHPATTERNTOOL_H diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h index ba5655a6c090b04ca4bc2fd9654a5fd47c4ccfba..8b17ae295ee4260120ae1b43891c105d8703a9fa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h @@ -5,31 +5,29 @@ #ifndef MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNFINDERTOOL_H #define MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNFINDERTOOL_H -#include <iostream> -#include <vector> - #include "MuonRecToolInterfaces/IMuonHoughPatternFinderTool.h" -#include "MuonRecToolInterfaces/IMuonCombinePatternTool.h" - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonHoughPatternTools/IMuonHoughPatternTool.h" +#include "MuonRecToolInterfaces/IMuonCombinePatternTool.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" + #include "MuonSegment/MuonSegmentCombinationCollection.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/MuonPatternCollection.h" #include "TrkDriftCircleMath/DriftCircle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include <iostream> +#include <vector> +#include <string> class TH1F; class TFile; class MuonHoughHitContainer; -class IMuonHoughPatternTool; - -namespace Muon { - class MuonEDMPrinterTool; -} namespace Muon { @@ -119,8 +117,7 @@ namespace Muon { ToolHandle <IMuonHoughPatternTool> m_muonHoughPatternTool{this,"muonHoughPatternTool","MuonHoughPatternTool"}; //!< Pointer to concrete tool ToolHandle <Muon::IMuonCombinePatternTool> m_muonCombinePatternTool{this,"muonCombinePatternTool","MuonCombinePatternTool"}; //!< Pointer to concrete tool - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; //!< Pointer to concrete tool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** ToolHandle for EDM printing of segments */ ToolHandle<Muon::MuonEDMPrinterTool> m_printer{this,"printerTool","Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h index d2d16feaed4bedd7fb45a65586da5289c440a2ac..15000f24a1f6a22d87308ac0b49f82b4aee7b948 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h @@ -5,11 +5,9 @@ #ifndef MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H #define MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H -#include "MuonHoughPatternEvent/MuonHoughMathUtils.h" -#include "MuonHoughPatternEvent/MuonHoughPatternCollection.h" #include "MuonHoughPatternTools/IMuonHoughPatternTool.h" - #include "AthenaBaseComps/AthAlgTool.h" +#include "MuonHoughPatternEvent/MuonHoughMathUtils.h" class MuonHoughTransformSteering; class MuonHoughTransformer; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index 24b0a8f20e5b2aa4f31d0d71081dc29b71945eee..d21150f2f498d75a7f8268ed9ae5d7b9b3c127e7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -3,43 +3,27 @@ */ #include "MuonHoughPatternTools/MuonHoughPatternFinderTool.h" -#include "MuonHoughPatternTools/MuonHoughPatternTool.h" #include "MuonHoughPatternEvent/MuonHoughHitContainer.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" - #include "TrkSurfaces/Surface.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - #include "MuonPrepRawData/MdtDriftCircleStatus.h" #include "MuonSegment/MuonSegmentCombination.h" // for csc's #include "MuonSegment/MuonSegment.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" - #include "TrkDriftCircleMath/DriftCircle.h" #include "TrkDriftCircleMath/MatchDCWithLine.h" #include "TrkDriftCircleMath/TangentToCircles.h" - #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitivesHelpers.h" -#include "GaudiKernel/IToolSvc.h" - #include "TH1F.h" #include "TFile.h" #include <map> #include <set> -#include <vector> using namespace TrkDriftCircleMath; @@ -70,8 +54,8 @@ namespace Muon { ATH_CHECK( m_muonHoughPatternTool.retrieve() ); ATH_MSG_VERBOSE ("found Service muonHoughPatternTool: " << m_muonHoughPatternTool); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_MSG_DEBUG ("Retrieved " << m_muonIdHelperTool); + ATH_CHECK( m_idHelperSvc.retrieve() ); + ATH_MSG_DEBUG ("Retrieved " << m_idHelperSvc); ATH_CHECK( m_printer.retrieve() ); ATH_MSG_DEBUG ("Retrieved " << m_printer); @@ -125,9 +109,8 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo // summary if (m_summary==true || this->msgLvl(MSG::DEBUG)) { - if( patCombiCol->empty() ) msg() << MSG::DEBUG << " summarizing output: Combined pattern combination empty" << endmsg; - else msg() << MSG::DEBUG << " summarizing Combined pattern combination output: " << std::endl - << m_printer->print( *patCombiCol ) << endmsg; + if( patCombiCol->empty() ) ATH_MSG_DEBUG(" summarizing output: Combined pattern combination empty"); + else ATH_MSG_DEBUG(" summarizing Combined pattern combination output: " << m_printer->print( *patCombiCol )); } // clean up tool for next call @@ -172,10 +155,10 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo MuonPrdPatternCollection* etapatterns = m_muonHoughPatternTool->getEtaMuonPatterns(houghpattern); if (m_summary==true || this->msgLvl(MSG::DEBUG)) { - if( phipatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Phi pattern combination empty" << endmsg; - else msg() << MSG::DEBUG << " summarizing Phi pattern combination input: " << std::endl << m_printer->print( *phipatterns ) << endmsg; - if( etapatterns->empty() ) msg() << MSG::DEBUG << " summarizing input: Eta pattern combination empty" << endmsg; - else msg() << MSG::DEBUG << " summarizing Eta pattern combination input: " << std::endl << m_printer->print( *etapatterns ) << endmsg; + if( phipatterns->empty() ) ATH_MSG_DEBUG(" summarizing input: Phi pattern combination empty"); + else ATH_MSG_DEBUG(" summarizing Phi pattern combination input: " << std::endl << m_printer->print( *phipatterns )); + if( etapatterns->empty() ) ATH_MSG_DEBUG(" summarizing input: Eta pattern combination empty"); + else ATH_MSG_DEBUG(" summarizing Eta pattern combination input: " << std::endl << m_printer->print( *etapatterns )); } ATH_MSG_DEBUG ("writePatterns"); @@ -278,14 +261,14 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo csc_prds.push_back(prd); Identifier id = prd->identify(); - bool channel_type = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); + bool channel_type = m_idHelperSvc->cscIdHelper().measuresPhi(id); csc_pair = csc_set.insert(id); if (csc_pair.second == false) { ATH_MSG_DEBUG (" CSC hit was already added, weight set to 0"); layer_ids.push_back(0); } else { - const int layer_id = 1000*m_muonIdHelperTool->cscIdHelper().stationEta(id) + 100*m_muonIdHelperTool->cscIdHelper().stationPhi(id) + 10*m_muonIdHelperTool->cscIdHelper().chamberLayer(id) + 2*m_muonIdHelperTool->cscIdHelper().wireLayer(id) + channel_type; + const int layer_id = 1000*m_idHelperSvc->cscIdHelper().stationEta(id) + 100*m_idHelperSvc->cscIdHelper().stationPhi(id) + 10*m_idHelperSvc->cscIdHelper().chamberLayer(id) + 2*m_idHelperSvc->cscIdHelper().wireLayer(id) + channel_type; ATH_MSG_DEBUG ("csc layer_id: " << layer_id); ++number_of_hits_per_layer[layer_id]; layer_ids.push_back(layer_id); @@ -322,7 +305,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo double hity=globalpos.y(); double hitz=globalpos.z(); - bool channel_type = m_muonIdHelperTool->cscIdHelper().measuresPhi(csc_rots[i]->identify()); + bool channel_type = m_idHelperSvc->cscIdHelper().measuresPhi(csc_rots[i]->identify()); double weight = 0.; if (layer_ids[i] != 0) { // not yet added @@ -452,14 +435,14 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo if (m_hit_reweights) // reweight hits, according to Peter's new algorithm { - std::vector <double> strips(2*m_muonIdHelperTool->rpcIdHelper().stripMax()+2); // filled strips, to determine whether it was no noise rpc hit (confirmation of ((neighbouring) layer)) + std::vector <double> strips(2*m_idHelperSvc->rpcIdHelper().stripMax()+2); // filled strips, to determine whether it was no noise rpc hit (confirmation of ((neighbouring) layer)) for( ; cit!=cit_end;++cit ) { const Muon::RpcPrepData* prd = *cit; - const bool channel_type = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd->identify()); + const bool channel_type = m_idHelperSvc->rpcIdHelper().measuresPhi(prd->identify()); const Identifier id = prd->identify(); - int strip = m_muonIdHelperTool->rpcIdHelper().strip(id); // strip between 1 and 99!! - if (channel_type == true) {strip += m_muonIdHelperTool->rpcIdHelper().stripMax();} + int strip = m_idHelperSvc->rpcIdHelper().strip(id); // strip between 1 and 99!! + if (channel_type == true) {strip += m_idHelperSvc->rpcIdHelper().stripMax();} strips[strip]+=1.; strips[strip+1]+=0.5; strips[strip-1]+=0.5; @@ -469,16 +452,16 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo { const Muon::RpcPrepData* prd = *cit; Identifier id = prd->identify(); - const bool channel_type = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd->identify()); - int strip = m_muonIdHelperTool->rpcIdHelper().strip(id); // strip between 1 and 99!! - if (channel_type == true) {strip += m_muonIdHelperTool->rpcIdHelper().stripMax();} + const bool channel_type = m_idHelperSvc->rpcIdHelper().measuresPhi(prd->identify()); + int strip = m_idHelperSvc->rpcIdHelper().strip(id); // strip between 1 and 99!! + if (channel_type == true) {strip += m_idHelperSvc->rpcIdHelper().stripMax();} if (strips[strip] > 1) { - const int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(id); - const int doubletPhi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(id); - const int doubletZ = m_muonIdHelperTool->rpcIdHelper().doubletZ(id); - const int gasGap = m_muonIdHelperTool->rpcIdHelper().gasGap(id); + const int doubletR = m_idHelperSvc->rpcIdHelper().doubletR(id); + const int doubletPhi = m_idHelperSvc->rpcIdHelper().doubletPhi(id); + const int doubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(id); + const int gasGap = m_idHelperSvc->rpcIdHelper().gasGap(id); int layer_number = (gasGap - 1) * 12 + (doubletR-1) * 6 + (doubletPhi -1) * 3 + (doubletZ -1); // layer_number ranges from 0..35 if (channel_type) layer_number = layer_number + 36; @@ -510,13 +493,13 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo const double hity=globalpos.y(); const double hitz=globalpos.z(); - const bool channel_type = m_muonIdHelperTool->rpcIdHelper().measuresPhi(id); + const bool channel_type = m_idHelperSvc->rpcIdHelper().measuresPhi(id); // gasgapmap if (channel_type == true) // phi hit { - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it==gasgapphimap.end()){ // gasgapid not yet in map std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> hitset; @@ -542,10 +525,10 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo } else { - const int doubletZ = m_muonIdHelperTool->rpcIdHelper().doubletZ(id); - const int doubletPhi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(id); - const int doubletR = m_muonIdHelperTool->rpcIdHelper().doubletR(id); - const int gasGap = m_muonIdHelperTool->rpcIdHelper().gasGap(id); + const int doubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(id); + const int doubletPhi = m_idHelperSvc->rpcIdHelper().doubletPhi(id); + const int doubletR = m_idHelperSvc->rpcIdHelper().doubletR(id); + const int gasGap = m_idHelperSvc->rpcIdHelper().gasGap(id); int layer_number = (gasGap - 1) * 12 + (doubletR-1) * 6 + (doubletPhi -1) * 3 + (doubletZ -1); // layer_number ranges from 0..35 if (channel_type) layer_number = layer_number + 36; @@ -582,9 +565,9 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo for( ; cit!=cit_end;++cit ){ const Muon::RpcPrepData* prd = *cit; const Identifier id = prd->identify(); - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) == false) { // eta hit + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id) == false) { // eta hit - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it!=gasgapphimap.end()) { @@ -606,14 +589,14 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo if (m_hit_reweights) { - std::vector <double> channels(2*m_muonIdHelperTool->tgcIdHelper().channelMax()+2); // filled strips, to determine whether it was no noise rpc hit (confirmation of ((neighbouring) layer)) + std::vector <double> channels(2*m_idHelperSvc->tgcIdHelper().channelMax()+2); // filled strips, to determine whether it was no noise rpc hit (confirmation of ((neighbouring) layer)) for( ; cit!=cit_end;++cit ) { const Muon::TgcPrepData* prd = *cit; Identifier id = prd->identify(); - bool channel_type = m_muonIdHelperTool->tgcIdHelper().isStrip(id); // like measuresPhi() - int channel = m_muonIdHelperTool->tgcIdHelper().channel(id); // between 1 and 135! - if (channel_type==true) {channel+=m_muonIdHelperTool->tgcIdHelper().channelMax();} + bool channel_type = m_idHelperSvc->tgcIdHelper().isStrip(id); // like measuresPhi() + int channel = m_idHelperSvc->tgcIdHelper().channel(id); // between 1 and 135! + if (channel_type==true) {channel+=m_idHelperSvc->tgcIdHelper().channelMax();} channels[channel]+=1.; channels[channel+1]+=0.55; channels[channel-1]+=0.55; @@ -623,13 +606,13 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo { const Muon::TgcPrepData* prd = *cit; const Identifier id = prd->identify(); - const bool channel_type = m_muonIdHelperTool->tgcIdHelper().isStrip(id); // like measuresPhi() - int channel = m_muonIdHelperTool->tgcIdHelper().channel(id); // between 1 and 135! - if (channel_type==true) {channel+=m_muonIdHelperTool->tgcIdHelper().channelMax();} + const bool channel_type = m_idHelperSvc->tgcIdHelper().isStrip(id); // like measuresPhi() + int channel = m_idHelperSvc->tgcIdHelper().channel(id); // between 1 and 135! + if (channel_type==true) {channel+=m_idHelperSvc->tgcIdHelper().channelMax();} if (channels[channel]>1) { - const int gasgap = m_muonIdHelperTool->tgcIdHelper().gasGap(id); + const int gasgap = m_idHelperSvc->tgcIdHelper().gasGap(id); int layer_number = (gasgap-1); // layer_number ranges from 0..5 if (channel_type==true) {layer_number = layer_number + 3;} @@ -657,7 +640,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo double hity=globalpos.y(); double hitz=globalpos.z(); - bool channel_type = m_muonIdHelperTool->tgcIdHelper().isStrip(id); // like measuresPhi() + bool channel_type = m_idHelperSvc->tgcIdHelper().isStrip(id); // like measuresPhi() int big_number = 250000; @@ -669,7 +652,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo { if (channel_type == true) // phi hit { - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it==gasgapphimap.end()){ // gasgapid not yet in map std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> hitset; @@ -693,7 +676,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo } else { - const int gasgap = m_muonIdHelperTool->tgcIdHelper().gasGap(id); + const int gasgap = m_idHelperSvc->tgcIdHelper().gasGap(id); int layer_number = (gasgap-1); // layer_number ranges from 0..1/2 if (channel_type==true) layer_number = layer_number + 3 ; double number_of_hits = (double) number_of_hits_per_layer[layer_number]; @@ -726,9 +709,9 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo for( ; cit!=cit_end;++cit ){ const Muon::TgcPrepData* prd = *cit; const Identifier id = prd->identify(); - if (m_muonIdHelperTool->tgcIdHelper().isStrip(id) == false) { // eta hit + if (m_idHelperSvc->tgcIdHelper().isStrip(id) == false) { // eta hit - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it!=gasgapphimap.end()) { @@ -823,7 +806,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo layers.reserve(size); prd.reserve(size); - std::vector <double> tubecount(m_muonIdHelperTool->mdtIdHelper().tubeMax()+2); + std::vector <double> tubecount(m_idHelperSvc->mdtIdHelper().tubeMax()+2); Muon::MdtPrepDataCollection::const_iterator cit = cit_begin; for( ; cit!=cit_end;++cit ) // first @@ -846,7 +829,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo errradius.push_back(Amg::error(mdt->localCovariance(),0)); weights.push_back(1.); prob.push_back(1.); - const int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + const int tube = m_idHelperSvc->mdtIdHelper().tube(id); tubes.push_back(tube); onsegment.push_back(0); psi.push_back(0.); @@ -854,12 +837,12 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo tr_confirmation.push_back(0); ids.push_back(id); - const int multi_layer = m_muonIdHelperTool->mdtIdHelper().multilayer(id); - const int tube_layer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); + const int multi_layer = m_idHelperSvc->mdtIdHelper().multilayer(id); + const int tube_layer = m_idHelperSvc->mdtIdHelper().tubeLayer(id); multilayer.push_back(multi_layer); tubelayer.push_back(tube_layer); - int layer_number = (multi_layer-1)*m_muonIdHelperTool->mdtIdHelper().tubeLayerMax() + (tube_layer-1); // layer_number ranges from 0..5/7 + int layer_number = (multi_layer-1)*m_idHelperSvc->mdtIdHelper().tubeLayerMax() + (tube_layer-1); // layer_number ranges from 0..5/7 layers.push_back(layer_number); tubecount[tube]+=1.; @@ -920,7 +903,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo std::map <int, int>::iterator map_it=number_of_hits_per_layer.begin(); for (; map_it!=number_of_hits_per_layer.end(); ++map_it) { - if ((*map_it).first >= m_muonIdHelperTool->mdtIdHelper().tubeLayerMax()) {ml1++;} + if ((*map_it).first >= m_idHelperSvc->mdtIdHelper().tubeLayerMax()) {ml1++;} else { ml2++;} } @@ -939,7 +922,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo return; } - bool barrel = m_muonIdHelperTool->mdtIdHelper().isBarrel(ids[0]); + bool barrel = m_idHelperSvc->mdtIdHelper().isBarrel(ids[0]); DCVec dcs; dcs.reserve(prdsize); @@ -1160,11 +1143,11 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo const Muon::CscPrepData* prd = (*cit); Identifier id = prd->identify(); - bool channel_type = m_muonIdHelperTool->cscIdHelper().measuresPhi(prd->identify()); + bool channel_type = m_idHelperSvc->cscIdHelper().measuresPhi(prd->identify()); - const int chamber_layer = m_muonIdHelperTool->cscIdHelper().chamberLayer(id); - const int chamber_layer_max = m_muonIdHelperTool->cscIdHelper().chamberLayerMax(id); - const int wire_layer = m_muonIdHelperTool->cscIdHelper().wireLayer(id); + const int chamber_layer = m_idHelperSvc->cscIdHelper().chamberLayer(id); + const int chamber_layer_max = m_idHelperSvc->cscIdHelper().chamberLayerMax(id); + const int wire_layer = m_idHelperSvc->cscIdHelper().wireLayer(id); int layer_number = (chamber_layer-1) + chamber_layer_max *(wire_layer -1); // layer_number ranges from 0..7 if (channel_type) layer_number = layer_number + 8 ; @@ -1189,11 +1172,11 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo double hity=globalpos.y(); double hitz=globalpos.z(); - bool channel_type = m_muonIdHelperTool->cscIdHelper().measuresPhi(id); + bool channel_type = m_idHelperSvc->cscIdHelper().measuresPhi(id); if (channel_type == true) // phi hit { - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it==gasgapphimap.end()){ // gasgapid not yet in map std::set<const Trk::PrepRawData*,Muon::IdentifierPrdLess> hitset; @@ -1210,9 +1193,9 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo double weight = 1.; if (m_hit_reweights) { - const int chamber_layer = m_muonIdHelperTool->cscIdHelper().chamberLayer(id); - const int chamber_layer_max = m_muonIdHelperTool->cscIdHelper().chamberLayerMax(id); - const int wire_layer = m_muonIdHelperTool->cscIdHelper().wireLayer(id); + const int chamber_layer = m_idHelperSvc->cscIdHelper().chamberLayer(id); + const int chamber_layer_max = m_idHelperSvc->cscIdHelper().chamberLayerMax(id); + const int wire_layer = m_idHelperSvc->cscIdHelper().wireLayer(id); int layer_number = (chamber_layer-1) + chamber_layer_max *(wire_layer -1); // layer_number ranges from 0..7 if (channel_type) layer_number = layer_number + 8 ; double weight_factor_csc = 1.; @@ -1237,9 +1220,9 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo for( ; cit!=cit_end;++cit ){ const Muon::CscPrepData* prd = *cit; const Identifier id = prd->identify(); - if (m_muonIdHelperTool->cscIdHelper().measuresPhi(id) == false) { // eta hit + if (m_idHelperSvc->cscIdHelper().measuresPhi(id) == false) { // eta hit - const Identifier gasGapId = m_muonIdHelperTool->gasGapId(id); + const Identifier gasGapId = m_idHelperSvc->gasGapId(id); gg_it = gasgapphimap.find(gasGapId); if (gg_it!=gasgapphimap.end()) { @@ -1256,7 +1239,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo // // called once per rpc collection/station - std::string st = m_muonIdHelperTool->rpcIdHelper().stationNameString(m_muonIdHelperTool->rpcIdHelper().stationName(rpcid)); + std::string st = m_idHelperSvc->rpcIdHelper().stationNameString(m_idHelperSvc->rpcIdHelper().stationName(rpcid)); ATH_MSG_VERBOSE ("updateRpcMdtStationMap" << st); if (st[0] != 'B') return; // no rpc for endcap chambers @@ -1267,8 +1250,8 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo addToStationMap(rpcmdtstationmap,it,stationcode,hit_begin,hit_end); - int idphi = m_muonIdHelperTool->rpcIdHelper().stationPhi(rpcid); - int ideta = m_muonIdHelperTool->rpcIdHelper().stationEta(rpcid); + int idphi = m_idHelperSvc->rpcIdHelper().stationPhi(rpcid); + int ideta = m_idHelperSvc->rpcIdHelper().stationEta(rpcid); int idphi1 = idphi - 1; if (idphi1 == 0) idphi1 = 8; @@ -1291,7 +1274,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo else return; // store Neighbouring station codes - int stationNameMDT = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station); + int stationNameMDT = m_idHelperSvc->mdtIdHelper().stationNameIndex(station); stationcode = stationCode(stationNameMDT,idphi1,ideta); addToStationMap(rpcmdtstationmap,it,stationcode,hit_begin,hit_end); @@ -1309,7 +1292,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo } else return; - stationNameMDT = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station); + stationNameMDT = m_idHelperSvc->mdtIdHelper().stationNameIndex(station); stationcode = stationCode(stationNameMDT,idphi,ideta); addToStationMap(rpcmdtstationmap,it,stationcode,hit_begin,hit_end); } @@ -1320,7 +1303,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo // tgcmdtstationmap is updated // // called once per tgc collection/station - std::string st = m_muonIdHelperTool->tgcIdHelper().stationNameString(m_muonIdHelperTool->tgcIdHelper().stationName(tgcid)); + std::string st = m_idHelperSvc->tgcIdHelper().stationNameString(m_idHelperSvc->tgcIdHelper().stationName(tgcid)); if (st[0] != 'T') return; std::vector <int> T31(5); T31[0] = 2; T31[1] = 3; T31[2] = 3; T31[3] = 4; T31[4] = 4; @@ -1336,8 +1319,8 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo if (st[2]=='F') modphiTGC = 24; if (st[1]=='4') modphiTGC = 24; - int idphi = m_muonIdHelperTool->tgcIdHelper().stationPhi(tgcid); - int ideta = m_muonIdHelperTool->tgcIdHelper().stationEta(tgcid); + int idphi = m_idHelperSvc->tgcIdHelper().stationPhi(tgcid); + int ideta = m_idHelperSvc->tgcIdHelper().stationEta(tgcid); int index = abs(ideta)-1; int idphi1MDT = 1 + int (8.*(idphi+1)/modphiTGC); int idphi2MDT = 1 + int (8.*(idphi-1)/modphiTGC); @@ -1376,8 +1359,8 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo station1 = "EIL"; station2 = "EIS"; } - int stationNameMDT1 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station1); - int stationNameMDT2 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station2); + int stationNameMDT1 = m_idHelperSvc->mdtIdHelper().stationNameIndex(station1); + int stationNameMDT2 = m_idHelperSvc->mdtIdHelper().stationNameIndex(station2); int stationcode = stationCode(tgcid); @@ -1414,8 +1397,8 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo station2 = "EOL"; } else return; - stationNameMDT1 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station1); - stationNameMDT2 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(station2); + stationNameMDT1 = m_idHelperSvc->mdtIdHelper().stationNameIndex(station1); + stationNameMDT2 = m_idHelperSvc->mdtIdHelper().stationNameIndex(station2); stationcode = stationCode(stationNameMDT1,idphi1MDT,ideta1MDT); addToStationMap(tgcmdtstationmap,it,stationcode,hit_begin,hit_end); @@ -1444,7 +1427,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo int MuonHoughPatternFinderTool::stationCode(Identifier id)const { - return 10000000*m_muonIdHelperTool->mdtIdHelper().stationName(id) + 100000*m_muonIdHelperTool->mdtIdHelper().stationPhi(id) + 1000*(m_muonIdHelperTool->mdtIdHelper().stationEta(id)+10); + return 10000000*m_idHelperSvc->mdtIdHelper().stationName(id) + 100000*m_idHelperSvc->mdtIdHelper().stationPhi(id) + 1000*(m_idHelperSvc->mdtIdHelper().stationEta(id)+10); } int MuonHoughPatternFinderTool::stationCode(int stationname,int phi,int eta)const diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx index 1c580aeaed8980ccbc195f64d6d4f80f736fcc3c..3af1848b5ddbfe1c5aa5e25810e6c6e3db8d0a77 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx @@ -53,7 +53,7 @@ StatusCode MuonLayerHoughAlg::execute() }else{ ATH_MSG_DEBUG("Recorded MuonPatternCombinationCollection at MuonLayerHoughCombis: size " << Handle->size()); if( m_printSummary || msgLvl(MSG::DEBUG) ){ - msg() << msg().level() << "Number of MuonPatternCombinations " << Handle->size() << std::endl << m_printer->print(*Handle) << endmsg; + ATH_MSG_DEBUG("Number of MuonPatternCombinations " << Handle->size() << std::endl << m_printer->print(*Handle)); } } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index 96392fc3ce72e70b5fe40309ef3c4b94fae019a3..9f17409e5b8579d3e965b928d9a4766aaa55d3d5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -2261,14 +2261,14 @@ namespace Muon { } - if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " Printing collections per sector, number of technologies " << m_ntechnologies; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" Printing collections per sector, number of technologies " << m_ntechnologies); for( int sector = 1; sector<=16; ++sector ){ MuonStationIndex::DetectorRegionIndex currentRegion = MuonStationIndex::DetectorRegionUnknown; - if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " sector " << sector; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" sector " << sector); TechnologyRegionHashVec& vec = m_collectionsPerSector[sector-1].technologyRegionHashVecs; for( unsigned int hash = 0; hash < nsectorHashMax; ++hash ){ std::pair<MuonStationIndex::DetectorRegionIndex,MuonStationIndex::LayerIndex> regionLayer = MuonStationIndex::decomposeSectorLayerHash(hash); - if( msgLvl(MSG::DEBUG) ) if( regionLayer.first != currentRegion ) msg(MSG::DEBUG) << std::endl << " " << MuonStationIndex::regionName(regionLayer.first); + if( msgLvl(MSG::DEBUG) ) if( regionLayer.first != currentRegion ) ATH_MSG_DEBUG(" " << MuonStationIndex::regionName(regionLayer.first)); bool first = true; currentRegion = regionLayer.first; for( unsigned int tech=0; tech<m_ntechnologies;++tech ){ @@ -2276,18 +2276,16 @@ namespace Muon { if( !vec[tech][hash].empty() ) { if( msgLvl(MSG::DEBUG) ) { if( first ) { - msg(MSG::DEBUG) << " " << std::setw(7) << MuonStationIndex::layerName(regionLayer.second); + ATH_MSG_DEBUG(" " << std::setw(7) << MuonStationIndex::layerName(regionLayer.second)); first = false; } - msg(MSG::DEBUG) << " " << std::setw(4) << MuonStationIndex::technologyName(static_cast<MuonStationIndex::TechnologyIndex>(tech)) - << " " << std::setw(4) << vec[tech][hash].size(); + ATH_MSG_DEBUG(" " << std::setw(4) << MuonStationIndex::technologyName(static_cast<MuonStationIndex::TechnologyIndex>(tech)) + << " " << std::setw(4) << vec[tech][hash].size()); } } } } - if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << std::endl; } - if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << endmsg; } void MuonLayerHoughTool::printTruthSummary( std::set<Identifier>& truth, std::set<Identifier>& found ) const { diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator.h index d38a26e93023da9c4965f569a741ebefc281b591..49dbee3c469e2f7e2b921cf787eaa6200e086e88 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator.h @@ -1,46 +1,33 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// Header file for class MdtOnTrackTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Interface for MuonDriftCircleOnTrack production -// (for MDT technology) -/////////////////////////////////////////////////////////////////// -// Version 1.0 18/07/2004 -/////////////////////////////////////////////////////////////////// - #ifndef MUON_MDTDRIFTCIRCLEONTRACKCREATOR_H #define MUON_MDTDRIFTCIRCLEONTRACKCREATOR_H +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "GaudiKernel/PhysicalConstants.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/MuonDriftCircleErrorStrategy.h" - +#include "MdtCalibSvc/MdtCalibrationTool.h" +#include "MdtCalibSvc/MdtCalibrationDbTool.h" #include "TrkEventPrimitives/LocalParameters.h" #include "TrkSpaceTimePoint/SpaceTimePoint.h" + #include <bitset> #include <string> -class Identifier; -class MdtIdHelper; -class MdtCalibrationTool; -class MdtCalibrationDbTool; class MdtCalibrationSvcSettings; class MdtCalibrationSvcInput; -class MsgStream; namespace Muon { class MdtPrepData; - class MuonIdHelperTool; /**Interface for the reconstruction to MDT calibration and alignment corrections. It should be used by reconstruction and pattern recognition to create Muon::MdtDriftCircleOnTrack (s). @@ -83,9 +70,9 @@ namespace Muon { public: MdtDriftCircleOnTrackCreator(const std::string&,const std::string&,const IInterface*); - virtual ~MdtDriftCircleOnTrackCreator (); + virtual ~MdtDriftCircleOnTrackCreator()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); + virtual StatusCode finalize(); /** @brief Calibrate a MdtPrepData object. The result is stored in a new MdtDriftCircleOnTrack object. Included calibrations: @@ -201,18 +188,16 @@ namespace Muon { double muonErrorStrategy(const MuonDriftCircleErrorStrategy* myStrategy, double sigmaR, const Identifier& id) const; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<MdtCalibrationTool> m_mdtCalibrationTool; ToolHandle<MdtCalibrationDbTool> m_mdtCalibrationDbTool; // Configuration variables bool m_doMdt; //!< Process MDT ROTs int m_timeCorrectionType; //!< Defined in TimingMode enum. - //bool m_scaleErrorManually; //!< if set to true errors will be scaled with 'FixedErrorScale' + FixedError bool m_discardMaskedHits; //!< if set to true, do not create ROTs for masked hits // Constants for use during calculations - double m_invSpeed; //!< Inverse speed of light (used in default tof correction: timing mode=0) double m_fixedError; //!< Error used when m_doFixed error =true or m_scaleErrorManually = true double m_globalToLocalTolerance; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.cxx index 80ea9c3d0e76e38da12b702993d21a1ffc547ccf..920f18c813d5af5159c4c6f5c1b69bf20906d97e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.cxx @@ -1,18 +1,12 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "MuonIdHelpers/MuonIdHelperTool.h" - -#include "Identifier/Identifier.h" - -///////////////////////////////////////////////////////// #include "AdjustableT0Map.h" -AdjustableT0Map::AdjustableT0Map(const Muon::MuonIdHelperTool* muonIdHelperTool) +AdjustableT0Map::AdjustableT0Map(const MdtIdHelper* idHelp) { - - m_muonIdHelperTool = muonIdHelperTool; + m_mdtIdHelper = idHelp; m_DefaultTShift = 0. ; @@ -29,13 +23,8 @@ AdjustableT0Map::AdjustableT0Map(const Muon::MuonIdHelperTool* muonIdHelperTool) m_stationNameRANGE = m_stationNameMAX - m_stationNameMIN + 1 ; m_Disabled = 0 ; - } -AdjustableT0Map::~AdjustableT0Map(){} - - - void AdjustableT0Map::SetDefaultTShift( double TShift ){ m_DefaultTShift = TShift ; } void AdjustableT0Map::ResetSetTShift(double Tshift){ @@ -43,8 +32,6 @@ void AdjustableT0Map::ResetSetTShift(double Tshift){ m_IdentStaTimeShiftMap.clear(); } - - void AdjustableT0Map::DumpT0Shift(){ std::cout << "m_DefaultTShift " << m_DefaultTShift << std::endl; @@ -73,7 +60,7 @@ void AdjustableT0Map::DumpT0Shift( int IdentSta ) { std::cout << " IdentSta " << IdentSta << " stationName " << stationName - << " " << m_muonIdHelperTool->mdtIdHelper().stationNameString(stationName) + << " " << m_mdtIdHelper->stationNameString(stationName) << " stationPhi " << stationPhi << " stationEta " << stationEta << " time " << GetT0Shift(IdentSta) @@ -140,10 +127,10 @@ void AdjustableT0Map::GetData(int Irank, int& stationName, int& stationEta, int& int AdjustableT0Map::GetIdentSta( const Identifier& id) const{ - return GetIdentSta( m_muonIdHelperTool->mdtIdHelper().stationName(id) , m_muonIdHelperTool->mdtIdHelper().stationEta(id) , m_muonIdHelperTool->mdtIdHelper().stationPhi(id) ) ; + return GetIdentSta( m_mdtIdHelper->stationName(id) , m_mdtIdHelper->stationEta(id) , m_mdtIdHelper->stationPhi(id) ) ; } int AdjustableT0Map::GetIdentSta( std::string stationNameString, int stationEta, int stationPhi ) const{ - return GetIdentSta( m_muonIdHelperTool->mdtIdHelper().stationNameIndex(stationNameString), stationEta, stationPhi ) ; + return GetIdentSta( m_mdtIdHelper->stationNameIndex(stationNameString), stationEta, stationPhi ) ; } int AdjustableT0Map::GetIdentSta( int stationName, int stationEta, int stationPhi) const{ int ToBeReturned = diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.h index 84e12b246a0521dc993b174530c953b363504f66..c8c9978640ed1ca9c8287733c0347558a8fb7716 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/AdjustableT0Map.h @@ -1,13 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AdjustableT0Map_H #define AdjustableT0Map_H -namespace Muon { - class MuonIdHelpertool; -} +#include "MuonIdHelpers/MdtIdHelper.h" +#include "Identifier/Identifier.h" ///////////////////////////////////////////////////////////////////////////// @@ -22,8 +21,8 @@ namespace Muon { class AdjustableT0Map { public: - AdjustableT0Map(const Muon::MuonIdHelperTool* muonIdHelperTool); - ~AdjustableT0Map() ; + AdjustableT0Map(const MdtIdHelper* idHelp); + ~AdjustableT0Map()=default; public: /////////////////////////////////// @@ -69,7 +68,7 @@ private: double m_DefaultTShift; - const Muon::MuonIdHelperTool* m_muonIdHelperTool ; //!< IdHelper + const MdtIdHelper* m_mdtIdHelper; int m_stationEtaMIN ; int m_stationPhiMIN ; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/MdtDriftCircleOnTrackCreator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/MdtDriftCircleOnTrackCreator.cxx index 8f6442088e5cc15d720463d995c397d616e9dd25..41a88c2c7a2aaf1a1e6bf80a63fb2f0ad12c1ad8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/MdtDriftCircleOnTrackCreator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MdtDriftCircleOnTrackCreator/src/MdtDriftCircleOnTrackCreator.cxx @@ -1,23 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////////////////////////////// -// Implementation file for class MdtDriftCircleOnTrackCreator -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// AlgTool used for MdtDriftCircleOnTrack object production -/////////////////////////////////////////////////////////////////// -// Version 1.0 18/07/2004 -/////////////////////////////////////////////////////////////////// - #include "MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MdtCalibSvc/MdtCalibrationTool.h" -#include "MdtCalibSvc/MdtCalibrationDbTool.h" #include "MdtCalibSvc/MdtCalibrationSvcSettings.h" #include "MdtCalibSvc/MdtCalibrationSvcInput.h" #include "MdtCalibData/MdtRtRelation.h" @@ -25,28 +11,23 @@ #include "MdtCalibData/IRtRelation.h" #include "MdtCalibData/IRtResolution.h" #include "MdtCalibData/TrRelation.h" - #include "MuonCalibEvent/MdtCalibHit.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" - #include "MuonPrepRawData/MdtPrepData.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/MuonDriftCircleErrorStrategy.h" - #include "EventPrimitives/EventPrimitivesHelpers.h" #include "TrkParameters/TrackParameters.h" #include "TrkSurfaces/StraightLineSurface.h" #include "TrkDistortedSurfaces/DistortedSurface.h" -#include "Identifier/IdentifierHash.h" + #include <boost/assign/std/vector.hpp> -Muon::MdtDriftCircleOnTrackCreator::MdtDriftCircleOnTrackCreator(const std::string& ty,const std::string& na,const IInterface* pa) - : AthAlgTool(ty,na,pa), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), +Muon::MdtDriftCircleOnTrackCreator::MdtDriftCircleOnTrackCreator(const std::string& ty,const std::string& na,const IInterface* pa) : + AthAlgTool(ty,na,pa), m_mdtCalibrationTool("MdtCalibrationTool", this), m_mdtCalibrationDbTool("MdtCalibrationDbTool", this), - m_invSpeed(1./299.792458), - m_mdtCalibSvcSettings( 0 ), + m_mdtCalibSvcSettings(nullptr), m_errorStrategy(Muon::MuonDriftCircleErrorStrategyInput()) { // create calibration service settings @@ -95,10 +76,6 @@ Muon::MdtDriftCircleOnTrackCreator::MdtDriftCircleOnTrackCreator(const std::stri declareProperty("CalibrationDbTool",m_mdtCalibrationDbTool); } - -Muon::MdtDriftCircleOnTrackCreator::~MdtDriftCircleOnTrackCreator(){} - - StatusCode Muon::MdtDriftCircleOnTrackCreator::initialize() { @@ -130,31 +107,30 @@ StatusCode Muon::MdtDriftCircleOnTrackCreator::initialize() // By default use one of the real strategies - don't default to unknown! m_errorStrategy.setStrategy(MuonDriftCircleErrorStrategy::Muon); } - msg(MSG::INFO) << "Constructed default MuonDriftCircleErrorStrategy: "; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::BroadError ) ) msg(MSG::INFO) << " Broad"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ScaledError ) ) msg(MSG::INFO) << " Scaled"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::FixedError ) ) msg(MSG::INFO) << " Fixed"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ParameterisedErrors ) ) msg(MSG::INFO) << " Parm"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::StationError ) ) msg(MSG::INFO) << " Station"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ErrorAtPredictedPosition ) ) msg(MSG::INFO) << " ErrAtPos"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::T0Refit ) ) msg(MSG::INFO) << " T0"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::WireSagGeomCorrection ) ) msg(MSG::INFO) << " WireG"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::TofCorrection ) ) msg(MSG::INFO) << " TOF"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::PropCorrection ) ) msg(MSG::INFO) << " Prop"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::TempCorrection ) ) msg(MSG::INFO) << " Temp"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::MagFieldCorrection ) ) msg(MSG::INFO) << " Mag"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::WireSagTimeCorrection ) ) msg(MSG::INFO) << " WireT"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::SlewCorrection ) ) msg(MSG::INFO) << " Slew"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::BackgroundCorrection ) ) msg(MSG::INFO) << " Back"; - if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::Segment ) ) msg(MSG::INFO) << " Seg"; - msg(MSG::INFO) << endmsg; + ATH_MSG_INFO("Constructed default MuonDriftCircleErrorStrategy: "); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::BroadError ) ) ATH_MSG_INFO(" Broad"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ScaledError ) ) ATH_MSG_INFO(" Scaled"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::FixedError ) ) ATH_MSG_INFO(" Fixed"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ParameterisedErrors ) ) ATH_MSG_INFO(" Parm"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::StationError ) ) ATH_MSG_INFO(" Station"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::ErrorAtPredictedPosition ) ) ATH_MSG_INFO(" ErrAtPos"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::T0Refit ) ) ATH_MSG_INFO(" T0"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::WireSagGeomCorrection ) ) ATH_MSG_INFO(" WireG"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::TofCorrection ) ) ATH_MSG_INFO(" TOF"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::PropCorrection ) ) ATH_MSG_INFO(" Prop"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::TempCorrection ) ) ATH_MSG_INFO(" Temp"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::MagFieldCorrection ) ) ATH_MSG_INFO(" Mag"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::WireSagTimeCorrection ) ) ATH_MSG_INFO(" WireT"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::SlewCorrection ) ) ATH_MSG_INFO(" Slew"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::BackgroundCorrection ) ) ATH_MSG_INFO(" Back"); + if( m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::Segment ) ) ATH_MSG_INFO(" Seg"); if( !m_isMC && m_looseErrors ) ATH_MSG_INFO( "Using Data Loose error tuning"); if( !m_isMC && !m_looseErrors ) ATH_MSG_INFO( "Using Data Tight error tuning"); if( m_isMC ) ATH_MSG_INFO( "Using MC error tuning"); ATH_MSG_VERBOSE( "A correction is made if set to true: do_MDT = " << m_doMdt ); - ATH_CHECK( m_idHelper.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); if( m_timeCorrectionType == COSMICS_TOF ){ if( !m_errorStrategy.creationParameter(MuonDriftCircleErrorStrategy::TofCorrection) ){ @@ -192,7 +168,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::createRIO_OnTra // check whether the MdtPrepData is not a masked hit if( m_discardMaskedHits && mdtPrd.status() == Muon::MdtStatusMasked ){ ATH_MSG_VERBOSE( "Unable to calibrate Masked hit, returning zero: channel " - << m_idHelper->toString(iD) ); + << m_idHelperSvc->toString(iD) ); return 0; } @@ -317,7 +293,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::createRIO_OnTra ATH_MSG_DEBUG( "MDT ROT: radius = " << rot->localParameters().get(Trk::driftRadius) << " error = " << Amg::error(rot->localCovariance(),Trk::locR) << " error = " << calibOutput.locErr - << " ,channel " << m_idHelper->toString(iD) ); + << " ,channel " << m_idHelperSvc->toString(iD) ); return rot; } @@ -384,7 +360,7 @@ Muon::MdtDriftCircleOnTrackCreator::getLocalMeasurement(const MdtPrepData& DC, switch (m_timeCorrectionType){ case ATLTIME: // normal time of flight corrections assuming IP + light speed - inputData.tof = gpos.mag()*m_invSpeed; + inputData.tof = gpos.mag()*m_inverseSpeedOfLight; ATH_MSG_VERBOSE( " running in ATLTIME mode, tof: " << inputData.tof ); break; case NO_CORRECTIONS: @@ -441,7 +417,7 @@ Muon::MdtDriftCircleOnTrackCreator::getLocalMeasurement(const MdtPrepData& DC, // Handle the errors here. Begin by getting the first part of the resolution term if (!m_doMdt){ - sigmaR = sqrt(DC.localCovariance()(0,0)); + sigmaR = std::sqrt(DC.localCovariance()(0,0)); } else if( myStrategy->creationParameter(MuonDriftCircleErrorStrategy::ParameterisedErrors) ){ if ( myStrategy->strategy()==MuonDriftCircleErrorStrategy::Moore ){ sigmaR = parametrisedSigma(errRadius); @@ -452,9 +428,9 @@ Muon::MdtDriftCircleOnTrackCreator::getLocalMeasurement(const MdtPrepData& DC, } }else{ // Use calib service errors. - if(calibHit) sigmaR =sqrt(calibHit->sigma2DriftRadius()); + if(calibHit) sigmaR =std::sqrt(calibHit->sigma2DriftRadius()); } - ATH_MSG_DEBUG("Tube : " << m_idHelper->toString(DC.identify()) << " SigmaR = "<<sigmaR); + ATH_MSG_DEBUG("Tube : " << m_idHelperSvc->toString(DC.identify()) << " SigmaR = "<<sigmaR); double sigmaR2=0.0; // Handle the errors scaling / addition of fixed terms if ( myStrategy->strategy()==MuonDriftCircleErrorStrategy::Moore ) { @@ -516,7 +492,7 @@ double Muon::MdtDriftCircleOnTrackCreator::getErrorFromRt(const Muon::MdtDriftCi MuonCalib::MdtFullCalibData data = m_mdtCalibrationDbTool->getCalibration( detEl->collectionHash(), detEl->detectorElementHash() ); const MuonCalib::MdtRtRelation* rtRelation = data.rtRelation; if( !rtRelation ){ - ATH_MSG_WARNING("no calibration found for tube " << m_idHelper->toString(DCT.identify())); + ATH_MSG_WARNING("no calibration found for tube " << m_idHelperSvc->toString(DCT.identify())); return 0; //FIXME!!! } @@ -525,12 +501,12 @@ double Muon::MdtDriftCircleOnTrackCreator::getErrorFromRt(const Muon::MdtDriftCi if( t < rtRelation->rt()->tLower() ) t = rtRelation->rt()->tLower(); else if( t > rtRelation->rt()->tUpper() ) t = rtRelation->rt()->tUpper(); }else{ - ATH_MSG_WARNING("no rt found for tube " << m_idHelper->toString(DCT.identify())); + ATH_MSG_WARNING("no rt found for tube " << m_idHelperSvc->toString(DCT.identify())); return 0;//FIXME!!! } if( !rtRelation->rtRes() ){ - ATH_MSG_WARNING("no rtRes found for tube " << m_idHelper->toString(DCT.identify()) ); + ATH_MSG_WARNING("no rtRes found for tube " << m_idHelperSvc->toString(DCT.identify()) ); return 0;//FIXME!!! } @@ -550,7 +526,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateError( const MuonGM::MdtReadoutElement* detEl = DCT.detectorElement(); if( !detEl ){ - ATH_MSG_WARNING("MdtDriftCircleOnTrack without MdtReadoutElement " << m_idHelper->toString(DCT.identify())); + ATH_MSG_WARNING("MdtDriftCircleOnTrack without MdtReadoutElement " << m_idHelperSvc->toString(DCT.identify())); return 0; } @@ -559,7 +535,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateError( if( myStrategy->creationParameter( MuonDriftCircleErrorStrategy::BroadError ) && !myStrategy->creationParameter( MuonDriftCircleErrorStrategy::ScaledError ) && !myStrategy->creationParameter( MuonDriftCircleErrorStrategy::FixedError )){ - sigmaR = detEl->innerTubeRadius()/sqrt(3.0); // Tube hit + sigmaR = detEl->innerTubeRadius()/std::sqrt(3.0); // Tube hit } else { if( myStrategy->creationParameter(MuonDriftCircleErrorStrategy::ErrorAtPredictedPosition) ) ATH_MSG_WARNING("updateError: ErrorAtPredictedPosition is not yet supported!"); @@ -575,7 +551,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateError( }else{ sigmaR = getErrorFromRt(DCT); if( sigmaR < 0.0001 || sigmaR*sigmaR < 0.0001 ){ - ATH_MSG_WARNING( "Bad obtained from calibration service: error " << m_idHelper->toString(DCT.identify()) << " reso " << sigmaR << " sigma2 " << sigmaR*sigmaR + ATH_MSG_WARNING( "Bad obtained from calibration service: error " << m_idHelperSvc->toString(DCT.identify()) << " reso " << sigmaR << " sigma2 " << sigmaR*sigmaR << " drift time " << t << " original " << DCT.driftTime() ); return 0; } @@ -596,7 +572,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateError( rot->setErrorStrategy(myStrategy); - ATH_MSG_VERBOSE("updated error for " << m_idHelper->toString(DCT.identify()) << " new error " << Amg::error(rot->localCovariance(),Trk::locR) + ATH_MSG_VERBOSE("updated error for " << m_idHelperSvc->toString(DCT.identify()) << " new error " << Amg::error(rot->localCovariance(),Trk::locR) << " old error " << Amg::error(DCT.localCovariance(),Trk::locR) ); // return result @@ -621,7 +597,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateErrorExte sigmaRT = getErrorFromRt(DCT); if( sigmaRT < 0.0001 || sigmaRT*sigmaRT < 0.0001 ){ - ATH_MSG_WARNING( "Bad obtained from calibration service: error " << m_idHelper->toString(detElId) << " reso " << sigmaRT << " sigma2 " << sigmaRT*sigmaRT + ATH_MSG_WARNING( "Bad obtained from calibration service: error " << m_idHelperSvc->toString(detElId) << " reso " << sigmaRT << " sigma2 " << sigmaRT*sigmaRT << " drift time " << t << " original " << DCT.driftTime() << " => Only external error is applied (if any)!" ); sigmaRT=0.; if(!errorlist) { @@ -637,7 +613,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateErrorExte if( errorlist->find(DCT.identify()) != errorlist->end() ) sigmaEXT = errorlist->find(DCT.identify())->second; else { - ATH_MSG_DEBUG("There is no external error stored in the map for " << m_idHelper->toString(detElId) << ". Applying only error from RT."); + ATH_MSG_DEBUG("There is no external error stored in the map for " << m_idHelperSvc->toString(detElId) << ". Applying only error from RT."); sigmaEXT = 0.; } } @@ -645,7 +621,7 @@ Muon::MdtDriftCircleOnTrack* Muon::MdtDriftCircleOnTrackCreator::updateErrorExte Muon::MdtDriftCircleOnTrack* rot = DCT.clone(); rot->m_localCovariance(0,0) = sigmaRT*sigmaRT + sigmaEXT*sigmaEXT; - ATH_MSG_DEBUG("updated error for " << m_idHelper->toString(DCT.identify()) << " new error " << Amg::error(rot->localCovariance(),Trk::locR) + ATH_MSG_DEBUG("updated error for " << m_idHelperSvc->toString(DCT.identify()) << " new error " << Amg::error(rot->localCovariance(),Trk::locR) << " old error " << Amg::error(DCT.localCovariance(),Trk::locR) << " with RT error " << sigmaRT << " and external error " << sigmaEXT ); return rot; @@ -655,7 +631,7 @@ Muon::MdtDriftCircleStatus Muon::MdtDriftCircleOnTrackCreator::driftCircleStatus { const MuonGM::MdtReadoutElement* detEl = DCT.detectorElement(); if( !detEl ){ - ATH_MSG_WARNING("MdtDriftCircleOnTrack without MdtReadoutElement " << m_idHelper->toString(DCT.identify())); + ATH_MSG_WARNING("MdtDriftCircleOnTrack without MdtReadoutElement " << m_idHelperSvc->toString(DCT.identify())); return Muon::MdtStatusUnDefined; } @@ -663,7 +639,7 @@ Muon::MdtDriftCircleStatus Muon::MdtDriftCircleOnTrackCreator::driftCircleStatus MuonCalib::MdtFullCalibData data = m_mdtCalibrationDbTool->getCalibration( detEl->collectionHash(), detEl->detectorElementHash() ); const MuonCalib::MdtRtRelation* rtRelation = data.rtRelation; if( !rtRelation ){ - ATH_MSG_WARNING("no calibration found for tube " << m_idHelper->toString(DCT.identify())); + ATH_MSG_WARNING("no calibration found for tube " << m_idHelperSvc->toString(DCT.identify())); return Muon::MdtStatusUnDefined; } @@ -677,7 +653,7 @@ double Muon::MdtDriftCircleOnTrackCreator::timeOfFlight(const Amg::Vector3D& pos } double Muon::MdtDriftCircleOnTrackCreator::parametrisedSigma( double r ) const { - return 0.23*exp(-fabs(r)/6.06)+0.0362; + return 0.23*std::exp(-std::abs(r)/6.06)+0.0362; } double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategy(const MuonDriftCircleErrorStrategy* myStrategy, @@ -717,19 +693,19 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyMC(const MuonDriftC } // Don't know how to handle other cases - error? } else { // Track - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(id); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); if( myStrategy->creationParameter( MuonDriftCircleErrorStrategy::StationError ) ){ if( stIndex == MuonStationIndex::BE ){ ATH_MSG_VERBOSE(" track error BEE "); return 1.44*sigmaR2 + 1.44; // 1.2* + 1.2 mm }else if( stIndex == MuonStationIndex::EE ){ ATH_MSG_VERBOSE(" track error EE "); - if( !m_isMC && m_idHelper->stationEta(id) < 0 ) return 1.44*sigmaR2 + 0.16; // 1.2* + 0.4 mm + if( !m_isMC && m_idHelperSvc->stationEta(id) < 0 ) return 1.44*sigmaR2 + 0.16; // 1.2* + 0.4 mm return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm - }else if( stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIS && - abs(m_idHelper->stationEta(id)) > 6 ){ + }else if( stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIS && + std::abs(m_idHelperSvc->stationEta(id)) > 6 ){ ATH_MSG_VERBOSE(" track error BIS78 "); - if( abs(m_idHelper->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm + if( std::abs(m_idHelperSvc->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm else return 4*sigmaR2 + 25; // 2* + 5. mm } ATH_MSG_VERBOSE(" track station error "); @@ -753,8 +729,8 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyMC(const MuonDriftC }else{ // use slightly smaller errors for the barrel double fixedTerm = (stIndex == MuonStationIndex::BI||stIndex == MuonStationIndex::BM||stIndex == MuonStationIndex::BO) ? 0.014 : 0.04; - if( m_doIndividualChamberReweights && stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIL && - m_idHelper->stationEta(id) == 1 && m_idHelper->sector(id) == 13 && m_idHelper->mdtIdHelper().multilayer(id) == 1 ){ + if( m_doIndividualChamberReweights && stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIL && + m_idHelperSvc->stationEta(id) == 1 && m_idHelperSvc->sector(id) == 13 && m_idHelperSvc->mdtIdHelper().multilayer(id) == 1 ){ fixedTerm = 1; ATH_MSG_VERBOSE(" track error Scaled: BIL1A13, first multi layer "); }else{ @@ -797,7 +773,7 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyLoose(const MuonDri } // Don't know how to handle other cases - error? } else { // Track - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(id); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); if( myStrategy->creationParameter( MuonDriftCircleErrorStrategy::StationError ) ){ if( stIndex == MuonStationIndex::BE ){ ATH_MSG_VERBOSE(" track error BEE "); @@ -805,17 +781,17 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyLoose(const MuonDri }else if( stIndex == MuonStationIndex::EE ){ ATH_MSG_VERBOSE(" track error EE "); return 1.44*sigmaR2 + 0.04; // 1.2* + 0.2 mm - }else if( stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIS && - abs(m_idHelper->stationEta(id)) > 6 ){ + }else if( stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIS && + std::abs(m_idHelperSvc->stationEta(id)) > 6 ){ ATH_MSG_VERBOSE(" track error BIS78 "); - if( abs(m_idHelper->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm + if( std::abs(m_idHelperSvc->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm else return 4*sigmaR2 + 25; // 2* + 5. mm - }else if( stIndex == MuonStationIndex::BM && m_idHelper->stationPhi(id) == 7 && - (m_idHelper->mdtIdHelper()).stationName(id) == 53 ){ + }else if( stIndex == MuonStationIndex::BM && m_idHelperSvc->stationPhi(id) == 7 && + (m_idHelperSvc->mdtIdHelper()).stationName(id) == 53 ){ ATH_MSG_VERBOSE(" track error BME "); return 1.44*sigmaR2 + 0.25; // 1.2* + 0.5 mm - }else if( stIndex == MuonStationIndex::BO && m_idHelper->chamberIndex(id) == MuonStationIndex::BOL && - abs(m_idHelper->stationEta(id)) == 7 && m_idHelper->stationPhi(id) == 7 ){ + }else if( stIndex == MuonStationIndex::BO && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BOL && + std::abs(m_idHelperSvc->stationEta(id)) == 7 && m_idHelperSvc->stationPhi(id) == 7 ){ ATH_MSG_VERBOSE(" track error BOE "); return 1.44*sigmaR2 + 0.25; // 1.2* + 0.5 mm } @@ -840,8 +816,8 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyLoose(const MuonDri }else{ // use slightly smaller errors for the barrel double fixedTerm = (stIndex == MuonStationIndex::BI||stIndex == MuonStationIndex::BM||stIndex == MuonStationIndex::BO) ? 0.015 : 0.015; - if( m_doIndividualChamberReweights && stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIL && - m_idHelper->stationEta(id) == 1 && m_idHelper->sector(id) == 13 && m_idHelper->mdtIdHelper().multilayer(id) == 1 ){ + if( m_doIndividualChamberReweights && stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIL && + m_idHelperSvc->stationEta(id) == 1 && m_idHelperSvc->sector(id) == 13 && m_idHelperSvc->mdtIdHelper().multilayer(id) == 1 ){ fixedTerm = 1; ATH_MSG_VERBOSE(" track error Scaled: BIL1A13, first multi layer "); }else{ @@ -885,30 +861,30 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyTight(const MuonDri } // Don't know how to handle other cases - error? } else { // Track - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(id); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); if( myStrategy->creationParameter( MuonDriftCircleErrorStrategy::StationError ) ){ if( stIndex == MuonStationIndex::BE ){ ATH_MSG_VERBOSE(" track error BEE "); return 1.44*sigmaR2 + 0.04; // 1.2* + 0.2 mm }else if( stIndex == MuonStationIndex::EE ){ ATH_MSG_VERBOSE(" track error EE "); - if( m_idHelper->isSmallChamber(id) ) return 1.21*sigmaR2 + 0.01; // 1.1* + 0.1 mm + if( m_idHelperSvc->isSmallChamber(id) ) return 1.21*sigmaR2 + 0.01; // 1.1* + 0.1 mm else return 1.21*sigmaR2 + 0.01; // 1.1* + 0.1 mm - }else if( stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIS && - abs(m_idHelper->stationEta(id)) > 6 ){ + }else if( stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIS && + std::abs(m_idHelperSvc->stationEta(id)) > 6 ){ ATH_MSG_VERBOSE(" track error BIS78 "); - if( abs(m_idHelper->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm + if( std::abs(m_idHelperSvc->stationEta(id)) == 7 ) return 1.44*sigmaR2 + 1.; // 1.2* + 1. mm else return 4*sigmaR2 + 1.; // 2* + 1. mm - }else if( stIndex == MuonStationIndex::BM && m_idHelper->stationPhi(id) == 7 && - (m_idHelper->mdtIdHelper()).stationName(id) == 53 ){ + }else if( stIndex == MuonStationIndex::BM && m_idHelperSvc->stationPhi(id) == 7 && + (m_idHelperSvc->mdtIdHelper()).stationName(id) == 53 ){ ATH_MSG_VERBOSE(" track error BME "); return 1.21*sigmaR2 + 0.25; // 1.1* + 0.5 mm - }else if( stIndex == MuonStationIndex::BO && m_idHelper->chamberIndex(id) == MuonStationIndex::BOL && - abs(m_idHelper->stationEta(id)) == 7 && m_idHelper->stationPhi(id) == 7 ){ + }else if( stIndex == MuonStationIndex::BO && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BOL && + std::abs(m_idHelperSvc->stationEta(id)) == 7 && m_idHelperSvc->stationPhi(id) == 7 ){ ATH_MSG_VERBOSE(" track error BOE "); return 1.21*sigmaR2 + 0.25; // 1.1* + 0.5 mm - }else if( stIndex == MuonStationIndex::EE && m_idHelper->chamberIndex(id) == MuonStationIndex::EEL && - m_idHelper->stationEta(id) < 0 && m_idHelper->stationPhi(id) == 3 ){ + }else if( stIndex == MuonStationIndex::EE && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::EEL && + m_idHelperSvc->stationEta(id) < 0 && m_idHelperSvc->stationPhi(id) == 3 ){ ATH_MSG_VERBOSE(" track error EEL1C05 "); return 1.21*sigmaR2 + 25.; // 1.1* + 5 mm } @@ -935,7 +911,7 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyTight(const MuonDri // use slightly smaller errors for the barrel // double fixedTerm = 0.01; - bool isSmall = m_idHelper->isSmallChamber(id); + bool isSmall = m_idHelperSvc->isSmallChamber(id); if( stIndex == MuonStationIndex::BI||stIndex == MuonStationIndex::BM||stIndex == MuonStationIndex::BO) { if( isSmall ) fixedTerm = 0.01; else fixedTerm = 0.01; @@ -944,8 +920,8 @@ double Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyTight(const MuonDri else fixedTerm = 0.01; } if( m_doIndividualChamberReweights ){ - if( stIndex == MuonStationIndex::BI && m_idHelper->chamberIndex(id) == MuonStationIndex::BIL && - m_idHelper->stationEta(id) == 1 && m_idHelper->sector(id) == 13 && m_idHelper->mdtIdHelper().multilayer(id) == 1 ){ + if( stIndex == MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIL && + m_idHelperSvc->stationEta(id) == 1 && m_idHelperSvc->sector(id) == 13 && m_idHelperSvc->mdtIdHelper().multilayer(id) == 1 ){ fixedTerm = 1; ATH_MSG_VERBOSE(" track error Scaled: BIL1A13, first multi layer "); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.cxx index 4839e34ee1c58560e2ad9fabd60f7e630b521dd1..dc25697c5c4ff3cb1b38e32f83ff7bea848a00b7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.cxx @@ -1,57 +1,39 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////////// -// AlgTool used for trigger chamber MuonClusterOnTrack object creation -// -// (c) ATLAS muon software -/////////////////////////////////////////////////////////////////////// - #include "TriggerChamberClusterOnTrackCreator.h" + #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "TrkEventPrimitives/LocalParameters.h" #include "TrkPrepRawData/PrepRawData.h" #include "TrkSurfaces/PlaneSurface.h" #include "TrkSurfaces/RectangleBounds.h" #include "TrkSurfaces/RotatedTrapezoidBounds.h" #include "TrkSurfaces/TrapezoidBounds.h" + #include <functional> namespace Muon { -TriggerChamberClusterOnTrackCreator::TriggerChamberClusterOnTrackCreator ( - const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool (type, name, parent), - m_clusterCreator ("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), - m_chooseBroadestCluster (true) +TriggerChamberClusterOnTrackCreator::TriggerChamberClusterOnTrackCreator(const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent), + m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), + m_chooseBroadestCluster(true) { declareInterface<Muon::IMuonCompetingClustersOnTrackCreator>(this); declareProperty("ClusterCreator", m_clusterCreator); declareProperty("ChooseBroadestCluster", m_chooseBroadestCluster); - } -TriggerChamberClusterOnTrackCreator::~TriggerChamberClusterOnTrackCreator() -{} - StatusCode TriggerChamberClusterOnTrackCreator::initialize() { - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( m_clusterCreator.retrieve() ); - return StatusCode::SUCCESS; -} - -StatusCode -TriggerChamberClusterOnTrackCreator::finalize() -{ + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_clusterCreator.retrieve()); return StatusCode::SUCCESS; } @@ -69,31 +51,24 @@ TriggerChamberClusterOnTrackCreator::createBroadCluster(const std::list<const Tr } const Trk::TrkDetElementBase* detectorElement = (**prds.begin()).detectorElement(); - Identifier channelId = (**prds.begin()).identify(); - auto helper = std::reference_wrapper<const MuonIdHelper>(m_muonIdHelperTool->rpcIdHelper()); - bool isRpc = helper.get().is_rpc(channelId); - if (! isRpc) - { - if (m_muonIdHelperTool->tgcIdHelper().is_tgc(channelId)) - { - helper = std::reference_wrapper<const MuonIdHelper>(m_muonIdHelperTool->tgcIdHelper()); - } - else - { - ATH_MSG_WARNING("fails: PRD must be from rpc or tgc "); - return 0; - } + Identifier channelId = (**prds.begin()).identify(); + bool isRpc = m_idHelperSvc->isRpc(channelId); + if (!isRpc) { + if (!m_idHelperSvc->isTgc(channelId)) { + ATH_MSG_WARNING("fails: PRD must be from rpc or tgc "); + return nullptr; + } } - bool measuresPhi = isRpc && m_muonIdHelperTool->rpcIdHelper().measuresPhi(channelId); - if (! isRpc) measuresPhi = m_muonIdHelperTool->tgcIdHelper().isStrip(channelId); + bool measuresPhi = isRpc && m_idHelperSvc->rpcIdHelper().measuresPhi(channelId); + if (!isRpc) measuresPhi = m_idHelperSvc->tgcIdHelper().isStrip(channelId); for (std::list<const Trk::PrepRawData*>::const_iterator p = prds.begin(); p != prds.end(); ++p) { channelId = (**p).identify(); - if ((isRpc && m_muonIdHelperTool->rpcIdHelper().measuresPhi(channelId) != measuresPhi) - || (! isRpc && m_muonIdHelperTool->tgcIdHelper().isStrip(channelId) != measuresPhi)) + if ((isRpc && m_idHelperSvc->rpcIdHelper().measuresPhi(channelId) != measuresPhi) + || (! isRpc && m_idHelperSvc->tgcIdHelper().isStrip(channelId) != measuresPhi)) { ATH_MSG_WARNING("fails: PRDs must measure same coordinate "); return 0; @@ -221,16 +196,16 @@ TriggerChamberClusterOnTrackCreator::makeClustersBySurface( int channel = 0; int gasGap = 0; Identifier channelId = (**p).identify(); - bool isRpc = m_muonIdHelperTool->rpcIdHelper().is_rpc(channelId); + bool isRpc = m_idHelperSvc->isRpc(channelId); if (isRpc) { - gasGap = m_muonIdHelperTool->rpcIdHelper().gasGap(channelId); - channel = m_muonIdHelperTool->rpcIdHelper().strip(channelId); + gasGap = m_idHelperSvc->rpcIdHelper().gasGap(channelId); + channel = m_idHelperSvc->rpcIdHelper().strip(channelId); } else { - gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(channelId); - channel = m_muonIdHelperTool->tgcIdHelper().channel(channelId); + gasGap = m_idHelperSvc->tgcIdHelper().gasGap(channelId); + channel = m_idHelperSvc->tgcIdHelper().channel(channelId); } int channelMax = channel; int channelMin = channel; @@ -244,16 +219,16 @@ TriggerChamberClusterOnTrackCreator::makeClustersBySurface( ++q, ++s) { channelId = (**q).identify(); - if (( isRpc && m_muonIdHelperTool->rpcIdHelper().gasGap(channelId) != gasGap) - || (! isRpc && m_muonIdHelperTool->tgcIdHelper().gasGap(channelId) != gasGap)) continue; + if (( isRpc && m_idHelperSvc->rpcIdHelper().gasGap(channelId) != gasGap) + || (! isRpc && m_idHelperSvc->tgcIdHelper().gasGap(channelId) != gasGap)) continue; usedPrd.push_back(*q); if (isRpc) { - channel = m_muonIdHelperTool->rpcIdHelper().strip(channelId); + channel = m_idHelperSvc->rpcIdHelper().strip(channelId); } else { - channel = m_muonIdHelperTool->tgcIdHelper().channel(channelId); + channel = m_idHelperSvc->tgcIdHelper().channel(channelId); } if (channel > channelMax) { @@ -285,35 +260,35 @@ TriggerChamberClusterOnTrackCreator::makeClustersBySurface( ++q, --size) { Identifier channelId = (**q).identify(); - bool isRpc = m_muonIdHelperTool->rpcIdHelper().is_rpc(channelId); + bool isRpc = m_idHelperSvc->isRpc(channelId); if (isRpc) { - int stationIndex = m_muonIdHelperTool->rpcIdHelper().stationName(channelId); + int stationIndex = m_idHelperSvc->rpcIdHelper().stationName(channelId); ATH_MSG_VERBOSE(" rpc " << std::setiosflags(std::ios::fixed) << " localPosition " << std::setw(8) << std::setprecision(1) << (**q).localPosition()[Trk::locX] << std::setw(8) << std::setprecision(1) << (**q).localPosition()[Trk::locY] << " doublet z/phi" - << std::setw(2) << m_muonIdHelperTool->rpcIdHelper().doubletZ(channelId) - << std::setw(2) << m_muonIdHelperTool->rpcIdHelper().doubletPhi(channelId) - << " gasGap" << std::setw(2) << m_muonIdHelperTool->rpcIdHelper().gasGap(channelId) - << " strip" << std::setw(3) << m_muonIdHelperTool->rpcIdHelper().strip(channelId) - << " station " << m_muonIdHelperTool->rpcIdHelper().stationNameString(stationIndex) - << " " << m_muonIdHelperTool->rpcIdHelper().show_to_string(channelId) ); + << std::setw(2) << m_idHelperSvc->rpcIdHelper().doubletZ(channelId) + << std::setw(2) << m_idHelperSvc->rpcIdHelper().doubletPhi(channelId) + << " gasGap" << std::setw(2) << m_idHelperSvc->rpcIdHelper().gasGap(channelId) + << " strip" << std::setw(3) << m_idHelperSvc->rpcIdHelper().strip(channelId) + << " station " << m_idHelperSvc->rpcIdHelper().stationNameString(stationIndex) + << " " << m_idHelperSvc->rpcIdHelper().show_to_string(channelId) ); } else { - int stationIndex = m_muonIdHelperTool->tgcIdHelper().stationName(channelId); + int stationIndex = m_idHelperSvc->tgcIdHelper().stationName(channelId); ATH_MSG_VERBOSE(" tgc " << std::setiosflags(std::ios::fixed) << " localPosition " << std::setw(8) << std::setprecision(1) << (**q).localPosition()[Trk::locX] << std::setw(8) << std::setprecision(1) << (**q).localPosition()[Trk::locY] - << " gasGap" << std::setw(2) << m_muonIdHelperTool->tgcIdHelper().gasGap(channelId) - << " channel" << std::setw(3) << m_muonIdHelperTool->tgcIdHelper().channel(channelId) - << " station " << m_muonIdHelperTool->tgcIdHelper().stationNameString(stationIndex) - << " " << m_muonIdHelperTool->tgcIdHelper().show_to_string(channelId) ); + << " gasGap" << std::setw(2) << m_idHelperSvc->tgcIdHelper().gasGap(channelId) + << " channel" << std::setw(3) << m_idHelperSvc->tgcIdHelper().channel(channelId) + << " station " << m_idHelperSvc->tgcIdHelper().stationNameString(stationIndex) + << " " << m_idHelperSvc->tgcIdHelper().show_to_string(channelId) ); } if (size == 0) { @@ -344,7 +319,7 @@ TriggerChamberClusterOnTrackCreator::makeOverallParameters( Amg::MatrixX covariance = (**r).localCovariance(); parameters = new Trk::LocalParameters((**r).localParameters()); Identifier channelId = (**r).identify(); - bool isRpc = m_muonIdHelperTool->rpcIdHelper().is_rpc(channelId); + bool isRpc = m_idHelperSvc->isRpc(channelId); int pair = 1; for (++r; @@ -414,21 +389,19 @@ TriggerChamberClusterOnTrackCreator::makeOverallParameters( // debug if ( msgLvl(MSG::DEBUG) ) { - msg(MSG::DEBUG) << shape << " width " << width - << " localParameters " << (*parameters)[Trk::locX]; - if (covariance.cols() > 1) msg(MSG::DEBUG) << " " << (*parameters)[Trk::locY]; - msg(MSG::DEBUG) << " covariance " << sqrt(covariance(Trk::locX,Trk::locX)); - if (covariance.cols() > 1) msg(MSG::DEBUG) << " " << sqrt(covariance(Trk::locY,Trk::locY)); - msg(MSG::DEBUG) << " channel range (cluster) "; + ATH_MSG_DEBUG(shape << " width " << width << " localParameters " << (*parameters)[Trk::locX]); + if (covariance.cols() > 1) ATH_MSG_DEBUG(" " << (*parameters)[Trk::locY]); + ATH_MSG_DEBUG(" covariance " << std::sqrt(covariance(Trk::locX,Trk::locX))); + if (covariance.cols() > 1) ATH_MSG_DEBUG(" " << std::sqrt(covariance(Trk::locY,Trk::locY))); + ATH_MSG_DEBUG(" channel range (cluster) "); pair = 2; for (std::list<int>::iterator i = limitingChannels.begin(); i != limitingChannels.end(); ++i, ++pair) { - msg(MSG::DEBUG) << *i << " "; - if (pair%2) msg(MSG::DEBUG) << "(" << pair/2 << ") "; + ATH_MSG_DEBUG( *i << " "); + if (pair%2) ATH_MSG_DEBUG("(" << pair/2 << ") "); } - msg(MSG::DEBUG) << endmsg; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.h index c15447d7e8f8f96e6f4be0c0c4e42adac0f7c7ca..ed4fad76c5c7558cc8bec2a657a1bde59f7ab307 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonCompetingClustersOnTrackCreator/src/TriggerChamberClusterOnTrackCreator.h @@ -1,29 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -///////////////////////////////////////////////////////////////////// -// Header file for class TriggerChamberClusterOnTrackCreator -// -// (c) ATLAS muon software -///////////////////////////////////////////////////////////////////// - #ifndef MUON_TRIGGERCHAMBERCLUSTERONTRACKCREATOR_H #define MUON_TRIGGERCHAMBERCLUSTERONTRACKCREATOR_H -#include <list> -#include <vector> +#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -class Identifier; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" + +#include <list> +#include <vector> +#include <string> -namespace MuonGM -{ - class MuonDetectorManager; -} namespace Track { class LocalParameters; @@ -31,24 +24,19 @@ namespace Track } namespace Muon { - class IMuonClusterOnTrackCreator; class MuonClusterOnTrack; /** @brief Tool to cluster several trigger measurements in different gas-gaps of the same detector module */ -class TriggerChamberClusterOnTrackCreator: public AthAlgTool, - virtual public IMuonCompetingClustersOnTrackCreator +class TriggerChamberClusterOnTrackCreator: public AthAlgTool, virtual public IMuonCompetingClustersOnTrackCreator { public: - TriggerChamberClusterOnTrackCreator (const std::string& type, - const std::string& name, - const IInterface* parent); - virtual ~TriggerChamberClusterOnTrackCreator (void); // destructor + TriggerChamberClusterOnTrackCreator(const std::string& type, const std::string& name, const IInterface* parent); + virtual ~TriggerChamberClusterOnTrackCreator()=default; - StatusCode initialize(); - StatusCode finalize (); + StatusCode initialize(); /** method for the creation of a single Trk::CompetingRIOsOnTrack: @@ -79,9 +67,8 @@ public: private: - // helpers, managers, tools - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + ToolHandle<Muon::IMuonClusterOnTrackCreator> m_clusterCreator; // configuration diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPattern.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPattern.h index ac4e1359d1db23f14e3363a9ea5d3c4795d2b654..b6302e490e94ee5ae69c68ac7b2294a668636721 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPattern.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPattern.h @@ -1,20 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// MuonPattern.h -// Header file for class MuonPattern -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// nveldik@nikhef.nl -/////////////////////////////////////////////////////////////////// - #ifndef MUON_MUONPATTERN_H #define MUON_MUONPATTERN_H -//#include "TrkEventPrimitives/GlobalMomentum.h" -//#include "TrkEventPrimitives/GlobalPosition.h" #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" @@ -23,8 +13,6 @@ namespace Trk { } namespace Muon { - - /** @brief Basic class for patterns in the muon spectrometer consistig out of a list of Trk::PrepRawData objects. The class also provides the possibility to store a first estimate of the particle parameters @@ -68,13 +56,8 @@ namespace Muon { }; - inline const Amg::Vector3D& MuonPattern::globalPosition() const { return m_globalPosition; } - inline const Amg::Vector3D& MuonPattern::globalDirection() const { return m_globalDirection; } - - } - #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCollection.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCollection.h index c544900feab88b4dfbefe14dafc15f53de1c2454..a404de2693b9bea1f04f4e0632a7a9c61587ee6b 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCollection.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCollection.h @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONPATTERNCOLLECTION_H #define MUON_MUONPATTERNCOLLECTION_H #include "AthContainers/DataVector.h" -#include "MuonPattern/MuonPattern.h" #include "MuonPattern/MuonPrdPattern.h" #include "AthenaKernel/CLASS_DEF.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h index 54c746015796b0d1b3b53ad39b275ee7346e19f6..1e36401d870025176c4b89f1b1f204fbfc1e814f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h @@ -1,10 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONRIOONTRACK_MMCLUSTERONTRACK_H #define MUONRIOONTRACK_MMCLUSTERONTRACK_H +#include <vector> + // Base classes #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" #include "MuonPrepRawData/MMPrepData.h" @@ -47,20 +49,23 @@ namespace Muon @param[in] positionAlongStrip <b>Required</b> Used to calculate global position. */ MMClusterOnTrack( - const MMPrepData* RIO, - const Trk::LocalParameters& locpos, - const Amg::MatrixX& locerr, - double positionAlongStrip - ); + const MMPrepData* RIO, + const Trk::LocalParameters& locpos, + const Amg::MatrixX& locerr, + double positionAlongStrip, + std::vector<float> stripDriftDists = std::vector<float>(0), + std::vector<Amg::MatrixX> stripDriftDistErrors = std::vector<Amg::MatrixX>(0)); // Alternate constructor that doesn't dereference the RIO link. MMClusterOnTrack( - const ElementLinkToIDC_MM_Container& RIO, - const Trk::LocalParameters& locpos, - const Amg::MatrixX& locerr, - const Identifier& id, - const MuonGM::MMReadoutElement* detEl, - double positionAlongStrip); + const ElementLinkToIDC_MM_Container& RIO, + const Trk::LocalParameters& locpos, + const Amg::MatrixX& locerr, + const Identifier& id, + const MuonGM::MMReadoutElement* detEl, + double positionAlongStrip, + std::vector<float> stripDriftDists = std::vector<float>(0), + std::vector<Amg::MatrixX> stripDriftDistErrors = std::vector<Amg::MatrixX>(0)); /** @brief Destructor*/ virtual ~MMClusterOnTrack(); @@ -79,6 +84,9 @@ namespace Muon (i.e. a surface of a detector element) */ virtual const Trk::Surface& associatedSurface() const; + const std::vector<float> stripDriftDists() const; + const std::vector<Amg::MatrixX> stripDriftDistErrors() const; + /** @brief Dumps information about the PRD*/ virtual MsgStream& dump( MsgStream& stream) const; @@ -90,13 +98,14 @@ namespace Muon @warning Only intended for use by persistency convertors. @todo Throw exception if TrkDetElementBase isn't correct concrete type*/ virtual void setValues(const Trk::TrkDetElementBase*, const Trk::PrepRawData*); - /** PrepRawData object assoicated with this measurement*/ ElementLinkToIDC_MM_Container m_rio; /** The detector element, assoicated with this measurement*/ const MuonGM::MMReadoutElement* m_detEl; + std::vector<float> m_stripDriftDists; + std::vector<Amg::MatrixX> m_stripDriftDistErrors; }; /////////////////////////////////////////////////////////////////// @@ -131,6 +140,17 @@ namespace Muon return detectorElement()->surface(identify()); } + inline const std::vector<float> MMClusterOnTrack::stripDriftDists() const + { + return m_stripDriftDists; + } + + inline const std::vector<Amg::MatrixX> MMClusterOnTrack::stripDriftDistErrors() const + { + return m_stripDriftDistErrors; + } + + inline void MMClusterOnTrack::setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* /*rio*/) { @@ -140,6 +160,6 @@ namespace Muon assert(0!=m_detEl); } -} +} // namespace Muon #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h index 4f9576631b62e1f8b085dabfc8745260a63ebd86..af8f3e091fc1dff79b2e3f6c89d205232ffc4aa5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h @@ -162,32 +162,37 @@ public: Trk::DriftCircleStatus status() const; /** @copydoc Trk::RIO_OnTrack::clone() */ - virtual MdtDriftCircleOnTrack* clone() const ; + virtual MdtDriftCircleOnTrack* clone() const override; /** @brief Returns the PrepRawData used to create this corrected measurement */ - virtual const MdtPrepData* prepRawData() const; + virtual const MdtPrepData* prepRawData() const override; const ElementLinkToIDC_MDT_Container& prepRawDataLink() const; /** @brief Returns the hashID of the PRD collection */ virtual IdentifierHash collectionHash() const; /** @brief Returns an invalid hash @todo Remove*/ - virtual IdentifierHash idDE() const { return IdentifierHash(); } + virtual IdentifierHash idDE() const override { return IdentifierHash(); } /** @brief Returns the detector element, assoicated with the PRD of this class*/ - virtual const MuonGM::MdtReadoutElement* detectorElement() const; + virtual const MuonGM::MdtReadoutElement* detectorElement() const override; /** @brief Returns the surface on which this measurement was taken. - If hasSaggedSurface()==false, then the surface will be that of the matching Detector Element - If hasSaggedSurface()==true, then the surface will be a special surface, representing the sagged position of the wire at the coords of this measurement.*/ - virtual const Trk::Surface& associatedSurface() const; + virtual const Trk::Surface& associatedSurface() const override; /** @brief Returns the global Position. Be aware that this is calculated from the predicted position along the tube, and the drift radius. i.e. it is partly inferred from other data, and so is not a 'true' measurement.*/ - virtual const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; + + virtual bool rioType(Trk::RIO_OnTrackType::Type type) const override + { + return (type == Trk::RIO_OnTrackType::MdtDriftCircle); + } /** @brief Returns a boolean indicating if this object was created with a sagged surface (i.e. if sagging corrections have been done.) - If true, it means that this surface was created with a sagged surface, i.e. it has been corrected for wire sag. @@ -218,10 +223,10 @@ public: const MuonDriftCircleErrorStrategy& errorStrategy() const; /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; // ///////////////////////////////////////////////////////////////// // Private data: @@ -234,7 +239,7 @@ private: /**@brief Sets the DetElement and Trk::PrepRawData pointers after reading from disk. @warning Only intended for use by persistency convertors*/ virtual void setValues(const Trk::TrkDetElementBase*, - const Trk::PrepRawData*); + const Trk::PrepRawData*) override; /** @brief Uses the passed loc3Dframe to calculate and set the global coord of this hit. If there is a sagged wire defined, this will be used for the transformation, otherwise the detector element surface is used*/ diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MuonClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MuonClusterOnTrack.h index 827831c7d7b3020a2039441bfe223d962e2565e1..b8bfcd10208c6120abf508d250767d8b029b39f7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MuonClusterOnTrack.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MuonClusterOnTrack.h @@ -59,13 +59,13 @@ namespace Muon { virtual ~MuonClusterOnTrack(); /** @brief Clone this ROT */ - virtual MuonClusterOnTrack* clone()const=0 ; + virtual MuonClusterOnTrack* clone() const override = 0; /** @brief Returns the Trk::PrepRawData - is a MuonCluster in this scope*/ - virtual const MuonCluster* prepRawData() const = 0; + virtual const MuonCluster* prepRawData() const override = 0; /** @brief Returns global position */ - virtual const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; virtual double positionAlongStrip() const { return m_positionAlongStrip; @@ -75,17 +75,21 @@ namespace Muon { virtual IdentifierHash collectionHash() const; /** @brief Returns an invalid hash */ - virtual IdentifierHash idDE() const ; - + virtual IdentifierHash idDE() const override; + + virtual bool rioType(Trk::RIO_OnTrackType::Type type) const override + { + return (type == Trk::RIO_OnTrackType::MuonCluster); + } + /** @brief Dumps information about the PRD*/ - virtual MsgStream& dump( MsgStream& stream) const; + virtual MsgStream& dump( MsgStream& stream) const override; /** @brief Dumps information about the PRD*/ - virtual std::ostream& dump( std::ostream& stream) const; + virtual std::ostream& dump( std::ostream& stream) const override; /** @brief Returns the detector element, assoicated with the PRD of this class*/ - virtual const MuonGM::MuonClusterReadoutElement* detectorElement() const = 0; - + virtual const MuonGM::MuonClusterReadoutElement* detectorElement() const override = 0; protected: /** cache global position, the global position has to be calculated in the inheriting classes */ @@ -98,7 +102,7 @@ namespace Muon { friend class ::MuonClusterOnTrackCnv_p1; /** Used by custom convertors*/ - virtual void setValues(const Trk::TrkDetElementBase*, const Trk::PrepRawData*) = 0 ; + virtual void setValues(const Trk::TrkDetElementBase*, const Trk::PrepRawData*) override = 0 ; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/src/MMClusterOnTrack.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/src/MMClusterOnTrack.cxx index a9b342e935ce05fec825210419e99d48b8da9c50..2efb40f6dbac35733ba68568068baaf07af528fa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/src/MMClusterOnTrack.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/src/MMClusterOnTrack.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonRIO_OnTrack/MMClusterOnTrack.h" @@ -24,12 +24,16 @@ namespace Muon // Constructor with parameters MMClusterOnTrack::MMClusterOnTrack( - const MMPrepData* RIO, - const Trk::LocalParameters& locpos, - const Amg::MatrixX& locerr, - double positionAlongStrip) : + const MMPrepData* RIO, + const Trk::LocalParameters& locpos, + const Amg::MatrixX& locerr, + double positionAlongStrip, + std::vector<float> stripDriftDists, + std::vector<Amg::MatrixX> stripDriftDistErrors) : MuonClusterOnTrack(locpos, locerr, RIO->identify(), positionAlongStrip), //call base class constructor - m_detEl( RIO->detectorElement() ) + m_detEl( RIO->detectorElement() ), + m_stripDriftDists(stripDriftDists), + m_stripDriftDistErrors(stripDriftDistErrors) { //Set EL // m_rio = ElementLinkToIDC_TGC_Container("TGC_Measurements", RIO->getHashAndIndex().hashAndIndex(), RIO); @@ -37,15 +41,19 @@ namespace Muon } MMClusterOnTrack::MMClusterOnTrack( - const ElementLinkToIDC_MM_Container& RIO, - const Trk::LocalParameters& locpos, - const Amg::MatrixX& locerr, - const Identifier& id, - const MuonGM::MMReadoutElement* detEl, - double positionAlongStrip) : - MuonClusterOnTrack(locpos, locerr, id, positionAlongStrip), //call base class constructor + const ElementLinkToIDC_MM_Container& RIO, + const Trk::LocalParameters& locpos, + const Amg::MatrixX& locerr, + const Identifier& id, + const MuonGM::MMReadoutElement* detEl, + double positionAlongStrip, + std::vector<float> stripDriftDists, + std::vector<Amg::MatrixX> stripDriftDistErrors) : + MuonClusterOnTrack(locpos, locerr, id, positionAlongStrip), // call base class constructor m_rio( RIO ), - m_detEl( detEl ) + m_detEl( detEl ), + m_stripDriftDists(stripDriftDists), + m_stripDriftDistErrors(stripDriftDistErrors) { } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py index 709ab9a6f52c8dfa9bbf2337a69650b0b765c300..2d616e4f89023e1c0f953cc1675deaa7349f7113 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py @@ -63,7 +63,6 @@ addTool("MuonRecExample.MuonRecTools.MuonStraightLineExtrapolator", "MuonStraigh addTool("Trk::KalmanUpdator", "MuonMeasUpdator") addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) -addTool("Muon::MuonIdHelperTool", "MuonIdHelperTool") addTool("Muon::MuonTrackTruthTool", "MuonTrackTruthTool") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py index 3dfe8852bb83c9faba490779e2b0286bbf775840..082e184d635750fde71b092a17f552ce1d000d08 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py @@ -232,11 +232,6 @@ def MuonExtrapolator(name='MuonExtrapolator',**kwargs): return CfgMgr.Trk__Extrapolator(name,**kwargs) # end of factory function MuonExtrapolator -def MuonIdHelperTool(name="MuonIdHelperTool",**kwargs): - from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool - getService("MuonIdHelperSvc") - return Muon__MuonIdHelperTool(name,**kwargs) - def MuonIdHelperSvc(name="MuonIdHelperSvc",**kwargs): from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperSvc kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC()) @@ -251,7 +246,7 @@ def MuonStraightLineExtrapolator(name="MuonStraightLineExtrapolator",**kwargs): def MuonEDMHelperSvc(name='MuonEDMHelperSvc',**kwargs): # configure some tools that are used but are not declared as properties (they should be!) - getPublicTool("MuonIdHelperTool") + getService("MuonIdHelperSvc") getPublicTool("AtlasExtrapolator") from MuonRecHelperTools.MuonRecHelperToolsConf import Muon__MuonEDMHelperSvc @@ -265,7 +260,6 @@ class MuonEDMPrinterTool(Muon__MuonEDMPrinterTool,ConfiguredBase): def __init__(self,name='MuonEDMPrinterTool',**kwargs): self.applyUserDefaults(kwargs,name) super(MuonEDMPrinterTool,self).__init__(name,**kwargs) - kwargs.setdefault("MuonIdHelperTool", "MuonIdHelperTool") getService("MuonEDMHelperSvc") # end of class MuonEDMPrinterTool @@ -466,7 +460,6 @@ def MuonSegmentFittingTool(name='MuonSegmentFittingTool',extraFlags=None,**kwarg kwargs.setdefault("SLFitter", getPrivateTool('MCTBSLFitter') ) kwargs.setdefault("CurvedFitter", getPrivateTool('MCTBFitter') ) kwargs.setdefault("TrackCleaner", getPrivateTool('MuonTrackCleaner') ) - kwargs.setdefault("IdHelper", getPublicTool('MuonIdHelperTool') ) return CfgMgr.Muon__MuonSegmentFittingTool(name,**kwargs) if DetFlags.detdescr.Muon_on() and rec.doMuon(): diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecUtils.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecUtils.py index 1949542d5227af2a2fabc9d085c95a0d5a7b0f64..88d73cc9ff6fc6ca02abbc29423c024095a9224e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecUtils.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecUtils.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s", __name__) @@ -597,478 +597,3 @@ def uglyHackedInclude(jobOptions): setattr(__main__,"ServiceMgr",ServiceMgr) include(jobOptions) - - - -# -# Copied from PyJobTransformsCore/python/trfutil.py -# until these tools are available in AtlasCore -class StringNumberList: - """List of strings only differing by a number they contain, where the list of numbers is coded in a special syntax. - <prefix>[<list>]<postfix> where '[' and ']' are litteral characters and <list> gives a recipe for a list of - numbers to be generated (with <n> and <m> integers): - <n>,<m> (enumeration) or <n>-<m> (range including m) or any combination of those. - A python list of strings is generated where the [<list>] is replaced by the actual integers that the list represents. - The [<list>] part can also be omitted, in which case a list of one string is generated (as given). - The width of the integers is determined by the integer with the most number of digits in the [<list>], where leading 0's - are included in the count. The integers in the expanded filenames have leading 0's padded where needed.""" - - openBracket = '[' - closeBracket = ']' - - def __init__(self, codedString=None): - self.set( codedString ) - - - def set(self, codedString): - self.__codedString = codedString - self.__numbers = None - self.__prefix = None - self.__suffix = None - self.__numberList = None - self.__digits = 0 - # return self for easy chaining of commands - return self - - - def getPrefix(self,openBracket=-1): - """Get everything up to (but not including) the [. - If [ is not found, return the full string. In case of error, raise exception. - The <openBracket> argument (optional) is there for optimisation and gives - the position of the '[' in the coded string (or -1 if unknown).""" - if self.__prefix is not None: return self.__prefix - valIn = self.__codedString - if valIn is None: raise RuntimeError("No input string set") - if openBracket != -1: - assert valIn[openBracket] == StringNumberList.openBracket - bopen = openBracket - else: - bopen = valIn.find(StringNumberList.openBracket) - if bopen == -1: self.__prefix = valIn - if bopen > 0: - self.__prefix = valIn[:bopen] - else: - self.__prefix = valIn - - return self.__prefix - - - def getSuffix(self,closeBracket=-1): - """Get everything after the ]. - If ] is not found, return emptry string. In case of error, return None""" - if self.__suffix is not None: return self.__suffix - valIn = self.__codedString - if valIn is None: raise RuntimeError("No input string set") - if closeBracket != -1: - assert valIn[closeBracket] == StringNumberList.closeBracket - bclose = closeBracket - else: - bclose = valIn.find(StringNumberList.closeBracket) - if bclose == -1: self.__suffix = "" - if bclose < len(valIn) - 1: - self.__suffix = valIn[bclose+1:] - else: - self.__suffix = "" - return self.__suffix - - - def getNumbers(self,openBracket=-1,closeBracket=-1): - """Get the part in between [ and ], including the []. - If [] part is not found, return empty string. In case of error, raise exception""" - if self.__numbers is not None: return self.__numbers - valIn = self.__codedString - if valIn is None: raise RuntimeError("Input string not set") - if openBracket != -1: - assert valIn[openBracket] == StringNumberList.openBracket - bopen = openBracket - else: - bopen = valIn.find(StringNumberList.openBracket) - if closeBracket != -1: - assert valIn[closeBracket] == StringNumberList.closeBracket - bclose = closeBracket - else: - bclose = valIn.find(StringNumberList.closeBracket,bopen + 1) - - if bopen == -1 and bclose == -1: - # no brackets at all, so no numbers given - self.__numbers = "" - elif bopen == -1 and bclose != -1: - # close bracket without open bracket - raise RuntimeError("Missing %r in %r" % (StringNumberList.openBracket,valIn)) - elif bopen != -1 and bclose == -1: - # open bracket without close bracket - raise RuntimeError("Missing %r in %r" % (StringNumberList.closeBracket,valIn)) - elif bclose == bopen + 1: - self.__numbers = "" - else: - self.__numbers = valIn[bopen:bclose+1] - - return self.__numbers - - - def getNumberList(self,openBracket=-1,closeBracket=-1): - """Return a tuple of size 2, containing the list of integers in the first field and - the number of digits in the second field. The list of integers is the result of - the decoding of the numbers coded in the [] part of the input string. The number - of digits is the maximum number of digits used in the numbers in the [] part, - where leading 0's are included in the count. - If no '[]' part is found, return an tuple with an empty list. In case of error, - raises a RuntimeError exception""" - if self.__numberList is not None: return (self.__numberList,self.__digits) - nums = self.getNumbers(openBracket,closeBracket) - if nums is "": return (list(),0) - numList = [ ] - bclose = len(nums) - posB = 1 - digits = 0 - while posB <= bclose: - #always start with an digit - posE = posB - while posE < bclose and nums[posE].isdigit(): posE += 1 - # require at leaste one digit - if posE == posB: raise RuntimeError("Syntax error: require at least one digit per field in %r" % nums) - # convert to integer - digits = max(digits,posE - posB) - iNum = int(nums[posB:posE]) - charE = nums[posE] - if charE == StringNumberList.closeBracket: # last number - numList.append( iNum ) - break - elif charE == ',': # single number - numList.append( iNum ) - posB = posE + 1 - continue - elif charE == '-': # next comes end of range - posB = posE + 1 - posE = posB - while posE < bclose and nums[posE].isdigit(): posE += 1 - # require at leaste one digit - if posE == posB: raise RuntimeError("Syntax error: require at least one digit per field in %r" % nums) - # convert to integer - digits = max(digits,posE - posB) - iStop = int(nums[posB:posE]) - if iStop < iNum: raise RuntimeError("Syntax error: %r is not a number" % nums[posB:posE] ) - numList += range(iNum,iStop+1) - charE = nums[posE] - if charE == ',': - posB = posE + 1 - continue - elif charE == StringNumberList.closeBracket: - break - else: - raise RuntimeError("Syntax error: expected \',\' or \'%s\' at position %d. Found \'%s\' instead in %r" %\ - (StringNumberList.closeBracket,posE,charE,nums) ) - else: # spurious character - raise RuntimeError("Syntax error: unexptected character %r at position %d in %r" % (charE,posE,nums) ) - - self.__numberList = numList - self.__digits = digits - - return (self.__numberList,self.__digits) - - - def convertStringList(self,codedString): - return self.set(codedString).getStringList() - - - def getStringList(self): - """Convert coded string <valIn> into an expanded list. If <valIn> contains a syntax error an exception is thrown""" - openBracket = self.__codedString.find(StringNumberList.openBracket) - closeBracket = self.__codedString.find(StringNumberList.closeBracket,openBracket + 1) - numList,digits = self.getNumberList(openBracket,closeBracket) - if len(numList) == 0: return [ self.__codedString ] - - prefix = self.getPrefix(openBracket) - suffix = self.getSuffix(closeBracket) - return [ '%s%0*d%s' % (prefix,digits,i,suffix) for i in numList ] - - -# Make sure that the castor environment variables STAGE_HOST and STAGE_SVCCLASS -# are set to the required values. If the test fails, a RuntimeError exception is raised. -def assertCastorStager(required_STAGE_HOST, required_STAGE_SVCCLASS): - import os - STAGE_HOST = os.environ.get('STAGE_HOST') - STAGE_SVCCLASS = os.environ.get('STAGE_SVCCLASS') - err = "" - if STAGE_HOST is None: - err += " STAGE_HOST is not set." - elif STAGE_HOST != required_STAGE_HOST: - err += " STAGE_HOST=%r is incorrect." % STAGE_HOST - - if STAGE_SVCCLASS is None: - err += " STAGE_SVCCLASS is not set." - elif STAGE_SVCCLASS != required_STAGE_SVCCLASS: - err += " STAGE_SVCCLASS=%r is incorrect." % STAGE_SVCCLASS - - err = err.strip() - if err: - raise RuntimeError("Problem with environment variable(s): %s Correct values are (zsh syntax):\n" - "export STAGE_HOST=%s\n" - "export STAGE_SVCCLASS=%s\n" - "Please set these environment variables and run job again" % (err, required_STAGE_HOST, required_STAGE_SVCCLASS)) - print("STAGE_HOST=%s" % STAGE_HOST) - print("STAGE_SVCCLASS=%s" % STAGE_SVCCLASS) - - - - -# -# Copied from PyJobTransformsCore/python/trfutil.py -# until these tools are available in AtlasCore -class FileList: - """Comma separeted list of filenames. Each filename in the list can be coded - with the following syntax: - <prefix>[<list>]<postfix> where '[' and ']' are litteral characters and <list> - gives a recipe for a list of numbers to be generated (with <n> and <m> integers): - <n>,<m> (enumeration) or <n>-<m> (range including m) or a combination of those. - A list of filenames is generated where the [<list>] is replaced by the actual - integers that the list represents. - The [<list>] part can also be omitted, in which case a list of one filename - is generated (as given).""" - - listSep = ',' - wildCardRE = re.compile(re.escape('[]*?')) - - @staticmethod - def expandStringToList(valIn,maxFiles=-1): - """Convert a string with filenames <valIn> into python list. - In case of a syntax error in the string, raise exception - <maxFiles> is the maximum number of files kept in the list. If -1, keep all files (default)""" - # split the comma separated list (outside brackets) - sepList = [] - n = len(valIn) - i = 0 - start = 0 - while i < n: - c = valIn[i] - if c == StringNumberList.openBracket: - i = valIn.find( StringNumberList.closeBracket, i + 1 ) - if i == -1: raise RuntimeError("Missing %r in valIn" % StringNumberList.closeBracket) - elif c == FileList.listSep: - if i == n - 1 or i - start < 1: raise RuntimeError( "Unexpected %r at position %d in %s" % (FileList.listSep,i,valIn) ) - sepList.append( valIn[start:i] ) - start = i + 1 - - i += 1 - # add the last entry in the list - if start < n: sepList.append( valIn[start:] ) - all = [] - for val in sepList: - all += StringNumberList(val).getStringList() - - if maxFiles >= 0 and len(all) > maxFiles: - all = all[:maxFiles] - - return all - - @staticmethod - def expandList(listIn,maxFiles=-1): - """Expand all entries in (python) list. Can also be a string with ',' separated entries. - <maxFiles> is the maximum number of files kept in the list. If -1, keep all files (default)""" - all=[] - if type(listIn) == str: - all = FileList.expandStringToList( listIn, maxFiles ) - elif type(listIn) in (list,tuple): - all = [] - for s in listIn: - if maxFiles >= 0 and len(all) >= maxFiles: - break - all += FileList.expandStringToList(s,maxFiles) - else: - raise RuntimeError("Can not expand list of type %r" % type(listIn)) - - if maxFiles >= 0 and len(all) > maxFiles: - all = all[:maxFiles] - - return all - - @staticmethod - def expandAndReadDirs(listIn,maxFiles=-1): - """Expand all entries in (python) list. Can also be a string with ',' separated entries. - It will expand wildcards and read files in directories.""" - allIn = FileList.expandList(listIn) - allFiles = [] - for f in allIn: - ft = FileList.fileType(f) - if ft == 'd' or FileList.hasWildCard(f): - allFiles += FileList.readDirectory(f) - elif ft == 'f': # regular file - allFiles.append(f) - elif ft == 'e': # error - logMuon.warning("Skipping file/dir (can not read): %r", f) - else: - logMuon.warning("Skipping file (unknown type=%r): %r",ft,f) - - if maxFiles >= 0 and len(allFiles) >= maxFiles: - break - - if maxFiles >= 0 and len(allFiles) > maxFiles: - allFiles = allFiles[:maxFiles] - - return allFiles - - - @staticmethod - def castorPrefix(filename): - prefixes = [ "rfio:", "root://castoratlas/" ] - STAGE_HOST = os.environ.get("STAGE_HOST","castoratlas") - if STAGE_HOST != "castoratlas": - prefixes += [ "root://%s/" % STAGE_HOST ] - for prefix in prefixes: - if filename.startswith(prefix): return prefix - - return "" - - - @staticmethod - def isFileOnCastor(filename): - return filename.startswith("/castor/") or FileList.castorPrefix(filename) - - @staticmethod - def nsls(dir,opts=''): - prefixToRemove = FileList.castorPrefix(dir) - dir=dir[len(prefixToRemove):] - cmd = 'nsls '+opts+' '+dir - output = subprocess.check_output( cmd ) - # turn multiline string into list with one line per entry - output = output.split(os.linesep) - # add back prefix to filename (last column) - prefix=prefixToRemove+dir - if not prefix.endswith(os.sep): prefix += os.sep - fullList=[] - for f in output: - items = f.split() - if not items: continue - items[-1] = prefix+items[-1] - fullList.append( ' '.join(items) ) - - return fullList - - - @staticmethod - def readDirectory(dirIn): - """Return a list of regular files in directory <dirIn>. If the filename part contains a wildcard, it will be expanded.""" - logMuon.info("Reading list of files from directory %s",dirIn) - all = [] - if FileList.isFileOnCastor(dirIn): - all = FileList.nsls(dirIn) - elif FileList.hasWildCard(dirIn): # regular files - dirname,basename = os.path.split(dirIn) - if FileList.hasWildCard(dirname): - raise RuntimeError("Wildcards in directories not supported (filenames only)") - from PyUtils import path - try: - all = path.path(dirname).files(basename) - except: - logMuon.warning("Could not read files %r from directory %s", basename,dirname) - return [] - else: - from PyUtils import path - try: - all = path.path(dirIn).files() - except: - logMuon.warning("Could not read files from directory %s", dirIn) - return [] - - - # only return regular files (not directories) - return [ str(f) for f in all if not FileList.isDirectory(f) ] - - @staticmethod - def fileType(pathIn): - """Return string indicating type of file: - 'f': regular file - 'd': directory - 'e': error (not readable) - Works for local files, rfio:, /castor, root: - """ - - if pathIn.startswith("rfio:") or pathIn.startswith("root:") or pathIn.startswith("/castor/"): - output = FileList.nsls(pathIn, '-ldL') - statbits = output[0].split()[0] - typebit = statbits[0] - if typebit in '-m': # regular file or migrated to tape - return 'f' - elif typebit == 'd': # directory - return 'd' - elif typebit == 'D': # logically deleted file - return 'e' - elif typebit == 'l': # symbolic link (should not happen with -L option to nsls) - return FileList.fileType(os.path.realpath(pathIn)) # UNTESTED! May fail! - else: - logMuon.error("Don't know what to do with nsls filetype %r of file %r", typebit, pathIn) - return 'e' - else: - if not os.path.exists(pathIn): - return 'e' - elif os.path.isfile(pathIn): - return 'f' - elif os.path.isdir(pathIn): - return 'd' - elif os.path.islink(pathIn): - return FileList.fileType(os.path.realpath(pathIn)) - - # if it gets here, something is wrong! - return 'e' - - - @staticmethod - def isDirectory(pathIn): - """file system independent way of determining if pathIn is a directory. - Works for local files, rfio:, /castor""" - return FileList.fileType(pathIn) == 'd' - - - @staticmethod - def hasWildCard(pathIn): - return FileList.wildCardRE.search(pathIn) is not None - - -class DataInfo(object): - - def __init__(self,listOfFiles,type,detdescr='AUTO',condTag='',maxFiles=-1,STAGE_SVCCLASS=None,STAGE_HOST=None,**kwargs): - self.fileList = listOfFiles - self.type = type - self.detDescr = detdescr - self.condTag = condTag - self.maxFiles = maxFiles # -1 = all files - self.STAGE_SVCCLASS = STAGE_SVCCLASS - self.STAGE_HOST = STAGE_HOST - - def _getFileList(self): - # activate castor stager if set - if self.STAGE_SVCCLASS: - os.environ['STAGE_SVCCLASS'] = self.STAGE_SVCCLASS - logMuon.info("Setting STAGE_SVCCLASS=%s",os.environ['STAGE_SVCCLASS']) - - if self.STAGE_HOST: - os.environ['STAGE_HOST'] = self._STAGE_HOST - logMuon.info("Setting STAGE_HOST=%s",os.environ['STAGE_HOST']) - - if self._expandedFiles is None: - self._expandedFiles = FileList.expandAndReadDirs(self._rawFiles,self.maxFiles) - - if not self._expandedFiles and self._rawFiles: - raise RuntimeError("No expanded input files resulted from %s raw input files of %r" % (self.maxFiles,self._rawFiles) ) - - return self._expandedFiles - - def _setFileList(self,fileList): - self._rawFiles = fileList - self._expandedFiles = None - - def _getMaxFiles(self): - return self._maxFiles - - def _setMaxFiles(self,value): - if not hasattr(self,'_maxFiles') or self._maxFiles != value: - self._maxFiles = value - self._expandedFiles = None - - - - ## Expand fileList on demand only, and only once - fileList = property(_getFileList,_setFileList,None) - - ## Make sure fileList is re-expanded at next demand if maxFiles changes - maxFiles = property(_getMaxFiles,_setMaxFiles,None) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py index 6103c499c849ed2d72b43fc0052f217c28e16433..4d9c301ea0e3a4f120b2d692f7b8c482b049990a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py @@ -33,12 +33,12 @@ muonRecFlags.setDefaults() topSequence = AlgSequence() -# ESDtoAOD and AODtoTAG need a configured MuonIdHelperTool (e.g. for the RPC_ResidualPullCalculator) +# ESDtoAOD and AODtoTAG need a configured MuonIdHelperSvc (e.g. for the RPC_ResidualPullCalculator) # Since it is not automatically created by the job configuration (as for RDOtoESD), # do it here manually (hope this will be fixed with the movement to the new configuration for release 22) if rec.readESD() or rec.readAOD(): - from MuonRecExample.MuonRecTools import MuonIdHelperTool - MuonIdHelperTool() + from MuonRecExample.MuonRecTools import MuonIdHelperSvc + MuonIdHelperSvc() if muonRecFlags.doCSCs() and not MuonGeometryFlags.hasCSC(): muonRecFlags.doCSCs = False if muonRecFlags.dosTGCs() and not MuonGeometryFlags.hasSTGC(): muonRecFlags.dosTGCs = False @@ -165,7 +165,7 @@ if muonRecFlags.doStandalone(): TrackTruthName=col+"Truth", TrackParticleName = "MuonSpectrometerTrackParticles" ) - topSequence += Muon__MuonSegmentTruthAssociationAlg("MuonSegmentTruthAssociationAlg", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) + topSequence += Muon__MuonSegmentTruthAssociationAlg("MuonSegmentTruthAssociationAlg") try: from PyUtils.MetaReaderPeeker import metadata diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py index a46b760648ead587f6e53c09be74057b11206a41..f7190ce0689795dd1155c80d90ccca61b537607f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py @@ -42,11 +42,6 @@ if not 'InputRdoFile' in dir(): InputRdoFile="root://eosatlas//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/user/zhidong/14/a2/user.zhidong.12100112.EXT0._000001.RDO.pool.root" athenaCommonFlags.FilesInput = [InputRdoFile] -if not hasJobPropertyBeenSet(athenaCommonFlags.FilesInput): - athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") -# assertCastorStager("castoratlast3","atlascerngroupdisk") -# athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("rfio:/castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") - #-------------------------------------------------------------------------------- # Output #-------------------------------------------------------------------------------- diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py index 89d5d42909026e0805451992663c9acad09d7ff6..dd87fc0a31b097b18a5e762d44ddbbf16458875f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py @@ -27,11 +27,6 @@ athenaCommonFlags.FilesInput = [ "/afs/cern.ch/atlas/project/rig/referencefiles/RTTinputFiles/MC15_13TeV/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r6699_10evt.pool.root" ] -if not hasJobPropertyBeenSet(athenaCommonFlags.FilesInput): - athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") -# assertCastorStager("castoratlast3","atlascerngroupdisk") -# athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("rfio:/castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") - #-------------------------------------------------------------------------------- # Output #-------------------------------------------------------------------------------- diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.cxx index 8a38d6661a62a8551d3cef1928c8b21d9c0741d7..10943e0a5b9bfcf84da57228e7627f3468cbe1e7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.cxx @@ -1,12 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonPRD_Provider.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MuonPRD_Provider.h" + #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/TgcPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" @@ -30,16 +27,9 @@ namespace Muon { StatusCode MuonPRD_Provider::initialize() { ATH_MSG_VERBOSE("Initializing ..."); - // Set up ATLAS ID helper to be able to identify the PRD's det-subsystem - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - return StatusCode::SUCCESS; - } - - StatusCode MuonPRD_Provider::finalize() - { - ATH_MSG_VERBOSE("Initializing ..."); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; - } + } StatusCode MuonPRD_Provider::retrieveCollection() { if (m_keyMdt!="" && evtStore()->retrieve(m_mdtPrds,m_keyMdt).isFailure() ){ @@ -75,15 +65,15 @@ namespace Muon { // check validity of the Identifier - if (!ide.is_valid() || !m_muonIdHelperTool->isMuon(ide) ){ + if (!ide.is_valid() || !m_idHelperSvc->isMuon(ide) ){ ATH_MSG_VERBOSE("The identifier is not valid ! Return 0."); return 0; } ndof = 1; - if ( m_mdtPrds && m_muonIdHelperTool->isMdt(ide) ){ + if ( m_mdtPrds && m_idHelperSvc->isMdt(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->mdtIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->mdtIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); @@ -92,10 +82,10 @@ namespace Muon { return prdFromIdentifierContainer<MdtPrepData>(*m_mdtPrds,ide,ideHash); } - if ( m_cscPrds && m_muonIdHelperTool->isCsc(ide) ){ + if ( m_cscPrds && m_idHelperSvc->isCsc(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->cscIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); @@ -104,10 +94,10 @@ namespace Muon { return prdFromIdentifierContainer<CscPrepData>(*m_cscPrds,ide,ideHash); } - if ( m_tgcPrds && m_muonIdHelperTool->isTgc(ide) ){ + if ( m_tgcPrds && m_idHelperSvc->isTgc(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->tgcIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->tgcIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); @@ -116,10 +106,10 @@ namespace Muon { return prdFromIdentifierContainer<TgcPrepData>(*m_tgcPrds,ide,ideHash); } - if ( m_rpcPrds && m_muonIdHelperTool->isRpc(ide) ){ + if ( m_rpcPrds && m_idHelperSvc->isRpc(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->rpcIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->rpcIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); @@ -127,10 +117,10 @@ namespace Muon { } return prdFromIdentifierContainer<RpcPrepData>(*m_rpcPrds,ide,ideHash); } - if ( m_mmPrds && m_muonIdHelperTool->mmIdHelper().is_mm(ide) ){ + if ( m_mmPrds && m_idHelperSvc->isMM(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->mmIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->mmIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); @@ -141,10 +131,10 @@ namespace Muon { return prd; } - if ( m_stgcPrds && m_muonIdHelperTool->stgcIdHelper().is_stgc(ide) ){ + if ( m_stgcPrds && m_idHelperSvc->issTgc(ide) ){ // get the Identifier Hash IdentifierHash ideHash; - m_muonIdHelperTool->stgcIdHelper().get_module_hash(ide,ideHash); + m_idHelperSvc->stgcIdHelper().get_module_hash(ide,ideHash); if (!ideHash.is_valid()){ ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.h index beb8314421fa43b5a43a27885de4d589628b65c4..4d57a27368c48137d7ebe3333b97718b25298043 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonAssociationTools/src/MuonPRD_Provider.h @@ -1,31 +1,22 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonPRD_Provider.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUON__MUONASSOCIATIONTOOLS_MUONPRDPROVIDER_H #define MUON__MUONASSOCIATIONTOOLS_MUONPRDPROVIDER_H -// Gaudi +#include "TrkToolInterfaces/IPRD_Provider.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -// Muon includes +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonPrepRawData/MMPrepDataContainer.h" #include "MuonPrepRawData/MMPrepData.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "MuonPrepRawData/sTgcPrepData.h" -// Trk includes -#include "TrkToolInterfaces/IPRD_Provider.h" #include "TrkPrepRawData/PrepRawDataContainer.h" #include "TrkPrepRawData/PrepRawDataCollection.h" -// Identifier -#include "Identifier/Identifier.h" -#include "Identifier/IdentifierHash.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" namespace Muon { @@ -45,9 +36,6 @@ namespace Muon { /** Athena algtool's Hooks */ StatusCode initialize(); - - /** finalize */ - StatusCode finalize(); /** retrieve the PRD collection from StoreGate */ StatusCode retrieveCollection(); @@ -83,8 +71,7 @@ namespace Muon { return prd; } - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::string m_keyTgc; std::string m_keyRpc; std::string m_keyCsc; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.cxx index cf83bea88b9020333b33748d6cf6a4bb627adaf1..c538236da9db210c66bfbca7d4a6ec0a19dc8a84 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.cxx @@ -1,60 +1,29 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// RPC_ResidualPullCalculator.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "RPC_ResidualPullCalculator.h" + #include "TrkEventUtils/IdentifierExtractor.h" #include "TrkEventPrimitives/LocalParameters.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" //================ Constructor ================================================= -Muon::RPC_ResidualPullCalculator::RPC_ResidualPullCalculator(const std::string& t, - const std::string& n, - const IInterface* p ) - : - AthAlgTool(t,n,p), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") +Muon::RPC_ResidualPullCalculator::RPC_ResidualPullCalculator(const std::string& t, const std::string& n, const IInterface* p) : + AthAlgTool(t,n,p) { declareInterface<IResidualPullCalculator>(this); } -//================ Destructor ================================================= - -Muon::RPC_ResidualPullCalculator::~RPC_ResidualPullCalculator() -{} - - //================ Initialisation ================================================= StatusCode Muon::RPC_ResidualPullCalculator::initialize() { - - StatusCode sc = AlgTool::initialize(); - if (sc.isFailure()) return sc; - - sc = m_idHelper.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR (" Cannot retrieve " << m_idHelper); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_MSG_DEBUG ("initialize() successful in " << name()); return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::RPC_ResidualPullCalculator::finalize() -{ - StatusCode sc = AlgTool::finalize(); - return sc; -} - //================ calculate residuals for RPC ================================== void Muon::RPC_ResidualPullCalculator::residuals( std::vector<double> &residuals, @@ -66,7 +35,7 @@ void Muon::RPC_ResidualPullCalculator::residuals( if (!trkPar || !measurement) return; if (residuals.size()<1) residuals.resize(1); Identifier ID = Trk::IdentifierExtractor::extract(measurement); - if( ID.is_valid() && m_idHelper->isRpc(ID) ) { + if( ID.is_valid() && m_idHelperSvc->isRpc(ID) ) { if (measurement->localParameters().parameterKey() == 1) { // convention to be interpreted by TrkValTools: 2nd coordinate codes orientation of RPC @@ -94,7 +63,7 @@ const Trk::ResidualPull* Muon::RPC_ResidualPullCalculator::residualPull( if (!trkPar || !measurement) return 0; Identifier ID = Trk::IdentifierExtractor::extract(measurement); - if( ID.is_valid() && m_idHelper->isRpc(ID) ) { + if( ID.is_valid() && m_idHelperSvc->isRpc(ID) ) { // if no covariance for the track parameters is given the pull calculation is not valid const AmgSymMatrix(5)* trkCov = trkPar->covariance(); @@ -126,7 +95,7 @@ const Trk::ResidualPull* Muon::RPC_ResidualPullCalculator::residualPull( resType); // create the Trk::ResidualPull. - ATH_MSG_DEBUG ( "Calculating Pull for channel " << m_idHelper->toString(ID) << " residual " << residual[Trk::loc1] << " pull " << pull[Trk::loc1] ); + ATH_MSG_DEBUG ( "Calculating Pull for channel " << m_idHelperSvc->toString(ID) << " residual " << residual[Trk::loc1] << " pull " << pull[Trk::loc1] ); return new Trk::ResidualPull(residual, pull, pullIsValid, resType, 1); } else { diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.h index 0c4c1869d3d80c50433741666bdd3ee7392f97d6..45f78bfd11f668fe1d2c7268ad8c7af72c8a91ae 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/RPC_ResidualPullCalculator.h @@ -1,28 +1,18 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// RPC_ResidualPullCalculator.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// W. Liebig <http://consult.cern.ch/xwho/people/54608> -// muon version adapted from S. Fleischmann's SCT tool -/////////////////////////////////////////////////////////////////// - #ifndef MUONRPC_RESIDUALPULLCALCULATOR_H #define MUONRPC_RESIDUALPULLCALCULATOR_H -// interfaces -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" -// edm +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkParameters/TrackParameters.h" #include "TrkEventPrimitives/ResidualPull.h" -namespace Muon { class MuonIdHelperTool;} - namespace Muon { @@ -37,16 +27,11 @@ namespace Muon class RPC_ResidualPullCalculator : virtual public Trk::IResidualPullCalculator, public AthAlgTool { public: - //! standard AlgTool constructor RPC_ResidualPullCalculator(const std::string&,const std::string&,const IInterface*); - //! default destructor - virtual ~RPC_ResidualPullCalculator (); + virtual ~RPC_ResidualPullCalculator()=default; - //! standard Athena-Algorithm method virtual StatusCode initialize() override; - //! standard Athena-Algorithm method - virtual StatusCode finalize () override; using IResidualPullCalculator::residualPull; /** @@ -77,8 +62,7 @@ namespace Muon private: - //! MuonIdHelper - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //! internal structuring: common method to calculate the hit pull. double calcPull(const double residual, diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.cxx index 0fdbcc53d78de9e7ffbd82ea3abee08a0def92e4..3b34c82063c5fe55c9788d1355d239eb6ae23846 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.cxx @@ -1,68 +1,30 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_ResidualPullCalculator.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "TGC_ResidualPullCalculator.h" -#include "TrkRIO_OnTrack/RIO_OnTrack.h" -// muon-specific actions +#include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/TgcIdHelper.h" - -// matrix stuff for matrix transformation of tgc errors #include "EventPrimitives/EventPrimitives.h" //================ Constructor ================================================= -Muon::TGC_ResidualPullCalculator::TGC_ResidualPullCalculator(const std::string& t, - const std::string& n, - const IInterface* p ) - : - AthAlgTool(t,n,p), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") -{ +Muon::TGC_ResidualPullCalculator::TGC_ResidualPullCalculator(const std::string& t, const std::string& n, const IInterface* p) : + AthAlgTool(t,n,p) { declareInterface<IResidualPullCalculator>(this); } -//================ Destructor ================================================= - -Muon::TGC_ResidualPullCalculator::~TGC_ResidualPullCalculator() -{} - - //================ Initialisation ================================================= StatusCode Muon::TGC_ResidualPullCalculator::initialize() { - - StatusCode sc = AthAlgTool::initialize(); - if (sc.isFailure()) return sc; - - sc = m_idHelper.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR (" Cannot retrieve " << m_idHelper); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_MSG_DEBUG ("initialize() successful in " << name()); - return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::TGC_ResidualPullCalculator::finalize() -{ - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - //================ calculate residuals for TGC ================================== void Muon::TGC_ResidualPullCalculator::residuals( std::vector<double>& residuals, @@ -86,11 +48,11 @@ void Muon::TGC_ResidualPullCalculator::residuals( } Identifier ID = rot->identify(); - if( m_idHelper->isTgc(ID) ) { + if( m_idHelperSvc->isTgc(ID) ) { double sinAlpha = 0.0; - bool isStrip = m_idHelper->tgcIdHelper().isStrip(ID); + bool isStrip = m_idHelperSvc->tgcIdHelper().isStrip(ID); // calculate residual if (isStrip) { @@ -149,11 +111,11 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( if (!trkPar || !rot) { if( !trkPar ) ATH_MSG_WARNING ("No TrackParameters, cannot calculate residual/pull "); if( !rot ) ATH_MSG_WARNING ("No ROT, cannot calculate residual/pull "); - return 0; + return nullptr; } Identifier ID = rot->identify(); - if( m_idHelper->isTgc(ID) ) { + if( m_idHelperSvc->isTgc(ID) ) { // try to cast the track parameters to measured ones const AmgSymMatrix(5)* trkCov = trkPar->covariance(); @@ -161,7 +123,7 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( double sinAlpha = 0.0; - bool isStrip = m_idHelper->tgcIdHelper().isStrip(ID); + bool isStrip = m_idHelperSvc->tgcIdHelper().isStrip(ID); // calculate residual std::vector<double> residual(1); @@ -171,7 +133,7 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( if (measurement->localParameters().parameterKey() !=3) { ATH_MSG_WARNING ( "TGC ClusterOnTrack does not carry the expected " << "LocalParameters structure!"); - return 0; + return nullptr; } // get orientation angle of strip to rotate back from local frame to strip const Amg::MatrixX &covmat=measurement->localCovariance(); @@ -183,9 +145,9 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( const MuonGM::TgcReadoutElement *ele = dynamic_cast<const MuonGM::TgcReadoutElement*>(rot->detectorElement()); - if (ele == 0) { + if (!ele) { ATH_MSG_WARNING ("Could not obtain TGC detEl from TGC ROT, this is a bug!" ); - return 0; + return nullptr; } double cosAlpha = sqrt(1 - sinAlpha*sinAlpha); @@ -226,7 +188,7 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( if (measurement->localParameters().parameterKey() != 1) { ATH_MSG_WARNING ("TGC ClusterOnTrack does not carry the expected " << "LocalParameters structure!" ); - return 0; + return nullptr; } else { // convention to be interpreted by TrkValTools: 2nd coordinate codes orientation of TGC residual[Trk::loc1] = measurement->localParameters()[Trk::loc1] @@ -245,13 +207,13 @@ const Trk::ResidualPull* Muon::TGC_ResidualPullCalculator::residualPull( } } // create the Trk::ResidualPull. - ATH_MSG_VERBOSE ( "Calculating Pull for channel " << m_idHelper->toString(ID) << " residual " << residual[Trk::loc1] << " pull " << pull[Trk::loc1] ); + ATH_MSG_VERBOSE ( "Calculating Pull for channel " << m_idHelperSvc->toString(ID) << " residual " << residual[Trk::loc1] << " pull " << pull[Trk::loc1] ); return new Trk::ResidualPull(residual, pull, pullIsValid, resType, 1, sinAlpha); } else { ATH_MSG_DEBUG ( "Input problem measurement is not TGC." ); - return 0; + return nullptr; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.h index 0a2f53aa423481aecaec58e5a080b14658b0744b..568ca7e9fe227c81e10c7f5000ef2b5c4b044a90 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonResidualPullCalculators/src/TGC_ResidualPullCalculator.h @@ -1,28 +1,18 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TGC_ResidualPullCalculator.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// W. Liebig <http://consult.cern.ch/xwho/people/54608> -// muon version adapted from S. Fleischmann's SCT tool -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGC_RESIDUALPULLCALCULATOR_H #define MUONTGC_RESIDUALPULLCALCULATOR_H -// interfaces -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" -// edm +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkParameters/TrackParameters.h" #include "TrkEventPrimitives/ResidualPull.h" -namespace Muon { class MuonIdHelperTool; } - namespace Muon { @@ -41,16 +31,11 @@ namespace Muon class TGC_ResidualPullCalculator : virtual public Trk::IResidualPullCalculator, public AthAlgTool { public: - //! standard AlgTool constructor TGC_ResidualPullCalculator(const std::string&,const std::string&,const IInterface*); - //! default destructor - virtual ~TGC_ResidualPullCalculator (); + virtual ~TGC_ResidualPullCalculator()=default; - //! standard Athena-Algorithm method virtual StatusCode initialize() override; - //! standard Athena-Algorithm method - virtual StatusCode finalize () override; using IResidualPullCalculator::residualPull; /** @brief This function returns (creates!) a Trk::ResidualPull @@ -82,8 +67,7 @@ namespace Muon private: - //! MuonIdHelper - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //! internal structuring: common code for calculating hit pulls double calcPull(const double residual, diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h index 08b4a4c03456f99305c9e21dfdc77b9020adaaac..ca3b9f8847a633105b53527113f2b5f136de785a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h @@ -2,17 +2,16 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTGMeasurementTool.h, (c) ATLAS Detector Softwareop -/////////////////////////////////////////////////////////////////// - #ifndef MUONTGRECTOOLS_MUONTGMEASUREMENTTOOL_H #define MUONTGRECTOOLS_MUONTGMEASUREMENTTOOL_H -// Base class #include "MuonTGRecTools/IMuonTGMeasTool.h" - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonTGHits.h" +#include "MuonTGSegments.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkTrack/Track.h" #include "TrkExInterfaces/INavigator.h" #include "TrkExInterfaces/IExtrapolator.h" @@ -24,19 +23,15 @@ #include "TrkGeometry/TrackingGeometry.h" #include "TrkSurfaces/CylinderSurface.h" #include "TrkPrepRawData/PrepRawData.h" -#include <fstream> - -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" -#include "MuonTGHits.h" -#include "MuonTGSegments.h" - #include "GaudiKernel/ConcurrencyFlags.h" - -//Amg #include "EventPrimitives/EventPrimitives.h" +#include <fstream> +#include <vector> +#include <string> + namespace MuonGM{ class MuonDetectorManager; } @@ -50,8 +45,7 @@ namespace Muon{ @author Sarka.Todorova@cern.ch */ -class MuonTGMeasurementTool : public AthAlgTool, - virtual public IMuonTGMeasTool { +class MuonTGMeasurementTool : public AthAlgTool, virtual public IMuonTGMeasTool { public: @@ -62,8 +56,7 @@ public: /** Constructor with AlgTool parameters */ MuonTGMeasurementTool(const std::string &name, const std::string& ,const IInterface*); - /** Virtual destructor */ - virtual ~MuonTGMeasurementTool() {}; + virtual ~MuonTGMeasurementTool()=default; virtual StatusCode initialize(); virtual StatusCode finalize(); @@ -92,16 +85,16 @@ private: Gaudi::Property<std::string> m_trackingGeometryName{this,"TrackingGeometryName","AtlasTrackingGeometry"}; Gaudi::Property<std::string> m_ExtrapolatorName{this,"ExtrapolatorName"," "}; //!< Name of the Extrapolator Instance - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; const MuonGM::MuonDetectorManager* m_muonDetMgr; // -- algorithm members - mutable MuonTGHits* m_hits ATLAS_THREAD_SAFE; //Marked as thread-safe because it's disabled when running multi-threaded - mutable MuonTGSegments* m_segments ATLAS_THREAD_SAFE; //Marked as thread-safe because it's disabled when running multi-threaded + mutable MuonTGHits* m_hits ATLAS_THREAD_SAFE; //Marked as thread-safe because it's disabled when running multi-threaded + mutable MuonTGSegments* m_segments ATLAS_THREAD_SAFE; //Marked as thread-safe because it's disabled when running multi-threaded // projection matrices AmgMatrix(5,5) *m_tgcProjEta; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx index 64e0a3493fa4c6f338ecf705e9b0369aa66e4021..4a14c6c29046b4b617f53c27b2423fa88c8a7771 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx @@ -190,13 +190,13 @@ namespace Muon { // extrapolate to next layer const Trk::Surface& surface = *it->surfacePtr; if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " startPars: phi pos " << currentPars->position().phi() << " direction phi " << currentPars->momentum().phi() << " theta pos " << currentPars->position().theta() << " theta " << currentPars->momentum().theta() + ATH_MSG_VERBOSE(" startPars: phi pos " << currentPars->position().phi() << " direction phi " << currentPars->momentum().phi() << " theta pos " << currentPars->position().theta() << " theta " << currentPars->momentum().theta() << " r " << currentPars->position().perp() << " z " << currentPars->position().z() << " momentum " << currentPars->momentum().mag() - << " local " << currentPars->parameters()[Trk::locX] << " " << currentPars->parameters()[Trk::locY]; - if( currentPars->covariance() ) msg(MSG::VERBOSE) << " err " << Amg::error(*currentPars->covariance(),Trk::locX) << " " << Amg::error(*currentPars->covariance(),Trk::locY); - msg(MSG::VERBOSE) << " destination: sector " << it->sector << " " << MuonStationIndex::regionName(it->regionIndex) + << " local " << currentPars->parameters()[Trk::locX] << " " << currentPars->parameters()[Trk::locY]); + if( currentPars->covariance() ) ATH_MSG_VERBOSE(" err " << Amg::error(*currentPars->covariance(),Trk::locX) << " " << Amg::error(*currentPars->covariance(),Trk::locY)); + ATH_MSG_VERBOSE(" destination: sector " << it->sector << " " << MuonStationIndex::regionName(it->regionIndex) << " " << MuonStationIndex::layerName(it->layerIndex) - << " phi " << surface.center().phi() << " r " << surface.center().perp() << " z " << surface.center().z() << endmsg; + << " phi " << surface.center().phi() << " r " << surface.center().perp() << " z " << surface.center().z()); } const Trk::TrackParameters* exPars = m_extrapolator->extrapolate(*currentPars,surface,Trk::alongMomentum,false,Trk::muon); if( !exPars ){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx index dc35e4d218a74ce51a753f5c0fe4e84f1b28a3ee..79bf4a1412884d0493a8152e7cc8675b86d7c787 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx @@ -2,22 +2,13 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTGMeasurementTool.cxx -// Implementation file for class MuonTGMeasurementTool -/////////////////////////////////////////////////////////////////// -// S.Todorova -/////////////////////////////////////////////////////////////////// - #include "MuonTGRecTools/MuonTGMeasurementTool.h" -// Gaudi includes #include "TrkParameters/TrackParameters.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkEventPrimitives/FitQualityOnSurface.h" #include "TrkParameters/TrackParameters.h" - #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkSurfaces/DistanceSolution.h" #include "TrkGeometry/Layer.h" @@ -25,8 +16,6 @@ #include "TrkGeometry/TrackingGeometry.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrackRecord/TrackRecord.h" -#include <vector> - #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonDigitContainer/RpcDigitContainer.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" @@ -48,9 +37,8 @@ Muon::MuonTGMeasurementTool::MuonTGMeasurementTool(const std::string &type, const std::string &name, const IInterface* parent ) : AthAlgTool(type,name,parent), m_muonDetMgr(nullptr), - //m_assocMeasName("MuonTGMeasAssocAlg"), - m_hits(0), - m_segments(0) + m_hits(nullptr), + m_segments(nullptr) { declareInterface<Muon::IMuonTGMeasTool>(this); } @@ -62,7 +50,7 @@ StatusCode Muon::MuonTGMeasurementTool::initialize() // Get the messaging service, print where you are ATH_MSG_INFO("MuonTGMeasurementTool::initialize()"); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK(m_DetectorManagerKey.initialize(!m_useDSManager)); if (m_useDSManager) { ATH_CHECK( detStore()->retrieve(m_muonDetMgr) ); @@ -145,15 +133,15 @@ const std::vector<const Trk::PrepRawData*>* Muon::MuonTGMeasurementTool::getEtaP if ( meas) { for (unsigned int ih=0; ih<meas->size(); ih++) { const Identifier id = (*meas)[ih]->identify(); - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id) ) hitsOnLayer->push_back( (*meas)[ih] ); - if ( m_muonIdHelperTool->rpcIdHelper().is_rpc(id) ) { - if ( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); + if ( m_idHelperSvc->isMdt(id) ) hitsOnLayer->push_back( (*meas)[ih] ); + if ( m_idHelperSvc->isRpc(id) ) { + if ( m_idHelperSvc->rpcIdHelper().measuresPhi(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); } - if ( m_muonIdHelperTool->cscIdHelper().is_csc(id) ) { - if ( m_muonIdHelperTool->cscIdHelper().measuresPhi(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); + if ( m_idHelperSvc->isCsc(id) ) { + if ( m_idHelperSvc->cscIdHelper().measuresPhi(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); } - if ( m_muonIdHelperTool->tgcIdHelper().is_tgc(id) ) { - if ( m_muonIdHelperTool->tgcIdHelper().isStrip(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); + if ( m_idHelperSvc->isTgc(id) ) { + if ( m_idHelperSvc->tgcIdHelper().isStrip(id) == phi) hitsOnLayer->push_back( (*meas)[ih] ); } } delete meas; @@ -226,16 +214,16 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: Identifier layId(lay->layerType()); unsigned int hitType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id) ) hitType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(id) ) hitType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(id) ) hitType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(id) ) hitType = 4; + if ( m_idHelperSvc->isMdt(id) ) hitType = 1; + if ( m_idHelperSvc->isRpc(id) ) hitType = 2; + if ( m_idHelperSvc->isCsc(id) ) hitType = 3; + if ( m_idHelperSvc->isTgc(id) ) hitType = 4; unsigned int layType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(layId) ) layType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(layId) ) layType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(layId) ) layType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(layId) ) layType = 4; + if ( m_idHelperSvc->isMdt(layId) ) layType = 1; + if ( m_idHelperSvc->isRpc(layId) ) layType = 2; + if ( m_idHelperSvc->isCsc(layId) ) layType = 3; + if ( m_idHelperSvc->isTgc(layId) ) layType = 4; if ( layType != hitType ) return projPar; @@ -256,7 +244,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: return projPar; } // local position of tube - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); Amg::Vector2D locWire(0.,lay->getRef()+(tube-1)*30.035); if (fabs(lay->getRef())>10e6) { double sign = (lay->getRef()>0) ? 1.:-1.; @@ -264,13 +252,13 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: double ref0 = dec/1.e5; double ref1 = lay->getRef()-dec*1e5-0.5*(sign+1)*1e5; locWire[0]=ref0; locWire[1]=ref1; - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); - int tubeMax = m_muonIdHelperTool->mdtIdHelper().tubeMax(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); + int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id); if ( tube>6 && tubeMax-tube>5 ) locWire[0]=0.; } if (sqrt(locWire[0]*locWire[0]+locWire[1]*locWire[1])>2000.) { - ATH_MSG_WARNING( name() << " wire shift out bounds for MDT tube :" << m_muonIdHelperTool->mdtIdHelper().stationName(id) <<","<< - m_muonIdHelperTool->mdtIdHelper().stationEta(id) <<","<< m_muonIdHelperTool->mdtIdHelper().stationPhi(id) <<": abandon projection"); + ATH_MSG_WARNING( name() << " wire shift out bounds for MDT tube :" << m_idHelperSvc->mdtIdHelper().stationName(id) <<","<< + m_idHelperSvc->mdtIdHelper().stationEta(id) <<","<< m_idHelperSvc->mdtIdHelper().stationPhi(id) <<": abandon projection"); return projPar; } // direction at the layer @@ -320,18 +308,18 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: Amg::VectorX locPar = parm->parameters(); // projection matrix AmgMatrix(5,5)* pMx = 0; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) pMx = m_rpcProjPhi; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) pMx = m_rpcProjPhi; else pMx = m_rpcProjEta; // projected parameters double eta = 1.; - double sign = (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) && m_muonIdHelperTool->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; + double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; double zswap = (lay->getRef()> 10000.) ? -1. : 1.; double ref = (zswap < 0.) ? lay->getRef()-20000. : lay->getRef(); locPar[0] -= sign*ref; Amg::VectorX pPar = (*pMx) * locPar; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) pPar[0] *= eta; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) pPar[0] *= eta; else pPar[1] *= -eta; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) pPar[1] *= zswap; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) pPar[1] *= zswap; else pPar[0] *= zswap; AmgMatrix(5,5)* projEM = new AmgMatrix(5,5); @@ -346,9 +334,9 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: } if (m_alignedMode && (parm->position()-projPar->position()).mag()>0.001 ) { - ATH_MSG_DEBUG("geometrical RPC projection (layerToDetEl) for hit : " << m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) << "," << - m_muonIdHelperTool->rpcIdHelper().stationName(id) << "," << m_muonIdHelperTool->rpcIdHelper().stationEta(id) <<","<<m_muonIdHelperTool->rpcIdHelper().stationPhi(id) << "," << - m_muonIdHelperTool->rpcIdHelper().doubletPhi(id) <<"," <<m_muonIdHelperTool->rpcIdHelper().doubletR(id)<<","<< m_muonIdHelperTool->rpcIdHelper().doubletZ(id) ); + ATH_MSG_DEBUG("geometrical RPC projection (layerToDetEl) for hit : " << m_idHelperSvc->rpcIdHelper().measuresPhi(id) << "," << + m_idHelperSvc->rpcIdHelper().stationName(id) << "," << m_idHelperSvc->rpcIdHelper().stationEta(id) <<","<<m_idHelperSvc->rpcIdHelper().stationPhi(id) << "," << + m_idHelperSvc->rpcIdHelper().doubletPhi(id) <<"," <<m_idHelperSvc->rpcIdHelper().doubletR(id)<<","<< m_idHelperSvc->rpcIdHelper().doubletZ(id) ); Amg::Vector2D locPos; const Amg::Vector3D globPos = parm->position(); bool onSurface = stripSurf->globalToLocal(globPos, globPos, locPos); @@ -375,7 +363,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: const Trk::PlaneSurface* stripSurf = dynamic_cast<const Trk::PlaneSurface*> (&(cscROE->surface(id))); if (!stripSurf) return projPar; // dealing with displaced planes, possibly sligthly displaced - double diff = m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; + double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; // distance between planes (assuming parallel planes) Amg::Vector3D layNormal = lay->surfaceRepresentation().normal(); double DN = parm->momentum().dot(layNormal); @@ -400,10 +388,10 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: parProj[4]= parm->parameters()[Trk::qOverP]; // AmgMatrix(5,5)* pMx = 0; - if ( m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ) pMx = m_tgcProjPhi; + if ( m_idHelperSvc->cscIdHelper().measuresPhi(id) ) pMx = m_tgcProjPhi; else pMx = m_tgcProjEta; Amg::VectorX locPar = (*pMx)*parProj; - ATH_MSG_DEBUG("projected parameters (layer->CSC):" << m_muonIdHelperTool->cscIdHelper().measuresPhi(id) <<"," << locPar ); + ATH_MSG_DEBUG("projected parameters (layer->CSC):" << m_idHelperSvc->cscIdHelper().measuresPhi(id) <<"," << locPar ); if (parm->covariance()) { @@ -431,10 +419,10 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: if (!stripSurf) return projPar; // AmgMatrix(5,5)* pMx = 0; - if ( m_muonIdHelperTool->tgcIdHelper().isStrip(id) ) pMx = m_tgcProjPhi; + if ( m_idHelperSvc->tgcIdHelper().isStrip(id) ) pMx = m_tgcProjPhi; else pMx = m_tgcProjEta; Amg::VectorX locPar = (*pMx)*parm->parameters(); - ATH_MSG_DEBUG("projected parameters (layer->TGC):" << m_muonIdHelperTool->tgcIdHelper().isStrip(id) <<"," << locPar <<"," << stripSurf ); + ATH_MSG_DEBUG("projected parameters (layer->TGC):" << m_idHelperSvc->tgcIdHelper().isStrip(id) <<"," << locPar <<"," << stripSurf ); AmgMatrix(5,5)* projEM = 0; bool bcov = false; @@ -451,8 +439,8 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: // verify if ( m_alignedMode && (parm->position() - projPar->position()).mag() > 0.001 ) { - ATH_MSG_DEBUG("geometrical TGC projection ( layer2detEl ):" << m_muonIdHelperTool->tgcIdHelper().stationName(id) << ","<< m_muonIdHelperTool->tgcIdHelper().stationEta(id) - <<","<< m_muonIdHelperTool->tgcIdHelper().stationPhi(id) <<","<< m_muonIdHelperTool->tgcIdHelper().isStrip(id) ); + ATH_MSG_DEBUG("geometrical TGC projection ( layer2detEl ):" << m_idHelperSvc->tgcIdHelper().stationName(id) << ","<< m_idHelperSvc->tgcIdHelper().stationEta(id) + <<","<< m_idHelperSvc->tgcIdHelper().stationPhi(id) <<","<< m_idHelperSvc->tgcIdHelper().isStrip(id) ); Amg::Vector2D locPos; const Amg::Vector3D globPos = parm->position(); bool onSurface = stripSurf->globalToLocal(globPos, globPos, locPos); @@ -491,16 +479,16 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: ATH_MSG_DEBUG("MuonTGMeasurementTool::input ok"); unsigned int hitType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id) ) hitType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(id) ) hitType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(id) ) hitType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(id) ) hitType = 4; + if ( m_idHelperSvc->isMdt(id) ) hitType = 1; + if ( m_idHelperSvc->isRpc(id) ) hitType = 2; + if ( m_idHelperSvc->isCsc(id) ) hitType = 3; + if ( m_idHelperSvc->isTgc(id) ) hitType = 4; unsigned int layType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(layId) ) layType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(layId) ) layType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(layId) ) layType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(layId) ) layType = 4; + if ( m_idHelperSvc->isMdt(layId) ) layType = 1; + if ( m_idHelperSvc->isRpc(layId) ) layType = 2; + if ( m_idHelperSvc->isCsc(layId) ) layType = 3; + if ( m_idHelperSvc->isTgc(layId) ) layType = 4; if ( layType != hitType ) return projPar; @@ -511,7 +499,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: if ( hitType == 1) { // local position of the tube - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); Amg::Vector2D locWire(0.,lay->getRef()+(tube-1)*30.035); if (fabs(lay->getRef())>10e6) { double sign = (lay->getRef()>0) ? 1.:-1.; @@ -519,13 +507,13 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: double ref0 = dec/1.e5; double ref1 = lay->getRef()-dec*1e5-0.5*(sign+1)*1e5; locWire[0]=ref0; locWire[1]=ref1; - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); - int tubeMax = m_muonIdHelperTool->mdtIdHelper().tubeMax(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); + int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id); if ( tube>6 && tubeMax-tube>5 ) locWire[0]=0.; } if (sqrt(locWire[0]*locWire[0]+locWire[1]*locWire[1])>2000.) { - ATH_MSG_WARNING( name() << " wire shift out bounds for MDT tube :" << m_muonIdHelperTool->mdtIdHelper().stationName(id) <<","<< - m_muonIdHelperTool->mdtIdHelper().stationEta(id) <<","<< m_muonIdHelperTool->mdtIdHelper().stationPhi(id) <<": abandon projection"); + ATH_MSG_WARNING( name() << " wire shift out bounds for MDT tube :" << m_idHelperSvc->mdtIdHelper().stationName(id) <<","<< + m_idHelperSvc->mdtIdHelper().stationEta(id) <<","<< m_idHelperSvc->mdtIdHelper().stationPhi(id) <<": abandon projection"); return projPar; } // local position (tube) @@ -574,25 +562,25 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: // Amg::VectorX locPar = parm->parameters(); AmgMatrix(5,5)* pMx = 0; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) pMx = m_rpcProjPhi; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) pMx = m_rpcProjPhi; else pMx = m_rpcProjEta; double eta = 1.; - double sign = (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) && m_muonIdHelperTool->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; + double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; double ref = (lay->getRef()>10000.) ? lay->getRef()-20000. : lay->getRef(); double zswap = (lay->getRef()>10000.) ? -1. : 1.; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) locPar[0] *= eta; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) locPar[0] *= eta; else locPar[1] *= -eta; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) locPar[1] *= zswap; + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) locPar[1] *= zswap; else locPar[0] *= zswap; Amg::VectorX pPar = (*pMx) * locPar; pPar[0] += sign*ref; // - ATH_MSG_DEBUG("back projected parameters(RPC->layer):" << m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)<<"," << pPar ); + ATH_MSG_DEBUG("back projected parameters(RPC->layer):" << m_idHelperSvc->rpcIdHelper().measuresPhi(id)<<"," << pPar ); AmgMatrix(5,5)* projEM = new AmgMatrix(5,5); *projEM = parm->covariance()->similarityT(*pMx); @@ -602,9 +590,9 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: //delete projEM; if ( (parm->position()-projPar->position()).mag()>0.001 ) { - ATH_MSG_DEBUG("geometrical RPC projection (detElToLayer) for hit : " << m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) << "," << - m_muonIdHelperTool->rpcIdHelper().stationName(id) << "," << m_muonIdHelperTool->rpcIdHelper().stationEta(id) <<","<<m_muonIdHelperTool->rpcIdHelper().stationPhi(id) << "," << - m_muonIdHelperTool->rpcIdHelper().doubletPhi(id) <<"," <<m_muonIdHelperTool->rpcIdHelper().doubletR(id)<<","<< m_muonIdHelperTool->rpcIdHelper().doubletZ(id) ); + ATH_MSG_DEBUG("geometrical RPC projection (detElToLayer) for hit : " << m_idHelperSvc->rpcIdHelper().measuresPhi(id) << "," << + m_idHelperSvc->rpcIdHelper().stationName(id) << "," << m_idHelperSvc->rpcIdHelper().stationEta(id) <<","<<m_idHelperSvc->rpcIdHelper().stationPhi(id) << "," << + m_idHelperSvc->rpcIdHelper().doubletPhi(id) <<"," <<m_idHelperSvc->rpcIdHelper().doubletR(id)<<","<< m_idHelperSvc->rpcIdHelper().doubletZ(id) ); Amg::Vector2D locPos; const Amg::Vector3D globPos = parm->position(); bool onSurface = laySurf->globalToLocal(globPos, globPos, locPos); @@ -626,7 +614,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: const Trk::PlaneSurface* laySurf = dynamic_cast<const Trk::PlaneSurface*> (&(lay->surfaceRepresentation())); if (!laySurf) return projPar; // dealing with parallel displaced planes - double diff = m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; + double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; // Amg::Vector3D layNormal = lay->surfaceRepresentation().normal(); double DN = parm->momentum().dot(layNormal); @@ -635,7 +623,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: const Amg::Vector2D csc_shift(0.,lay->getRef()); // projection : take into account possible misalignment ; AmgMatrix(5,5)* pMx = 0; - if ( m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ) pMx = m_tgcProjPhi; + if ( m_idHelperSvc->cscIdHelper().measuresPhi(id) ) pMx = m_tgcProjPhi; else pMx = m_tgcProjEta; AmgMatrix(5,5) pMxInv = pMx->inverse(); Amg::VectorX parProj = pMxInv*parm->parameters(); @@ -645,7 +633,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: if(onSurface && locCorrLay.size()>0) { parProj[0] += locCorrLay[Trk::locX]+csc_shift[Trk::locX]; parProj[1] += locCorrLay[Trk::locY]+csc_shift[Trk::locY]; - ATH_MSG_DEBUG("back projected parameters(CSC->layer):"<<m_muonIdHelperTool->cscIdHelper().measuresPhi(id)<<"," << parProj ); + ATH_MSG_DEBUG("back projected parameters(CSC->layer):"<<m_idHelperSvc->cscIdHelper().measuresPhi(id)<<"," << parProj ); } AmgMatrix(5,5)* projEM = new AmgMatrix(5,5); *projEM = parm->covariance()->similarity(pMxInv); @@ -664,11 +652,11 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: } AmgMatrix(5,5)* pMx = 0; - if ( m_muonIdHelperTool->tgcIdHelper().isStrip(id) ) pMx = m_tgcProjPhi; + if ( m_idHelperSvc->tgcIdHelper().isStrip(id) ) pMx = m_tgcProjPhi; else pMx = m_tgcProjEta; AmgMatrix(5,5) pMxInv = pMx->inverse(); Amg::VectorX locPar = pMxInv * parm->parameters(); - ATH_MSG_DEBUG("back projected parameters(TGC->layer):" << m_muonIdHelperTool->tgcIdHelper().isStrip(id)<<"," << locPar ); + ATH_MSG_DEBUG("back projected parameters(TGC->layer):" << m_idHelperSvc->tgcIdHelper().isStrip(id)<<"," << locPar ); AmgMatrix(5,5)* projEM = new AmgMatrix(5,5); *projEM = parm->covariance()->similarity(pMxInv); @@ -678,8 +666,8 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: // verify if ( m_alignedMode && (parm->position() - projPar->position()).mag() > 0.001 ) { - ATH_MSG_DEBUG("geometrical TGC projection ( detEl2Layer ):" << m_muonIdHelperTool->tgcIdHelper().stationName(id) << ","<< m_muonIdHelperTool->tgcIdHelper().stationEta(id) - <<","<< m_muonIdHelperTool->tgcIdHelper().stationPhi(id) <<","<< m_muonIdHelperTool->tgcIdHelper().isStrip(id) ); + ATH_MSG_DEBUG("geometrical TGC projection ( detEl2Layer ):" << m_idHelperSvc->tgcIdHelper().stationName(id) << ","<< m_idHelperSvc->tgcIdHelper().stationEta(id) + <<","<< m_idHelperSvc->tgcIdHelper().stationPhi(id) <<","<< m_idHelperSvc->tgcIdHelper().isStrip(id) ); Amg::Vector2D locPos; const Amg::Vector3D globPos = parm->position(); bool onSurface = laySurf->globalToLocal(globPos, globPos, locPos); @@ -725,15 +713,15 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye ATH_MSG_DEBUG("MuonTGMeasurementTool::input ok"); unsigned int hitType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(id) ) hitType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(id) ) hitType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(id) ) hitType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(id) ) hitType = 4; + if ( m_idHelperSvc->isMdt(id) ) hitType = 1; + if ( m_idHelperSvc->isRpc(id) ) hitType = 2; + if ( m_idHelperSvc->isCsc(id) ) hitType = 3; + if ( m_idHelperSvc->isTgc(id) ) hitType = 4; if ( hitType == 1) { // local position of the tube - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); Amg::Vector2D locWire(0.,lay->getRef()+(tube-1)*30.035); if (fabs(lay->getRef())>10e6) { double sign = (lay->getRef()>0) ? 1.:-1.; @@ -741,8 +729,8 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye double ref0 = dec/1.e5; double ref1 = lay->getRef()-dec*1e5-0.5*(sign+1)*1e5; locWire[0]=ref0; locWire[1]=ref1; - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); - int tubeMax = m_muonIdHelperTool->mdtIdHelper().tubeMax(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); + int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id); if ( tube>6 && tubeMax-tube>5 ) locWire[0]=0.; } // direction at the layer @@ -774,17 +762,17 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye else if ( hitType == 2) { // - double eta = (m_muonIdHelperTool->rpcIdHelper().stationEta(id)<0) ? -1. : 1.; - double sign = (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) && m_muonIdHelperTool->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; + double eta = (m_idHelperSvc->rpcIdHelper().stationEta(id)<0) ? -1. : 1.; + double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id)==2 ) ? -1. : 1.; double locPos = rio->localParameters()[Trk::locX]; - if ( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) ) locPos *= eta; + if ( m_idHelperSvc->rpcIdHelper().measuresPhi(id) ) locPos *= eta; double ref = (lay->getRef()>10000.) ? lay->getRef()-20000. : lay->getRef(); double zswap = (lay->getRef()>10000.) ? -1. : 1.; - if ( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) ) locPos += sign*ref; + if ( m_idHelperSvc->rpcIdHelper().measuresPhi(id) ) locPos += sign*ref; else locPos *= zswap; // const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); @@ -793,7 +781,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye rdoList.push_back(id); const Muon::RpcPrepData* rpcPrd = new Muon::RpcPrepData( id , idHash, Amg::Vector2D(locPos,0.), rdoList, new Amg::MatrixX(rio->localCovariance()), rpcROE, float(0.), 0, 0); const Muon::RpcClusterOnTrack* rpcRio = 0; - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(id)) + if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) rpcRio = new Muon::RpcClusterOnTrack( rpcPrd, Trk::LocalParameters(Trk::DefinedParameter(locPos,Trk::locX)), rpcPrd->localCovariance(), parm->localPosition()[Trk::locY]); @@ -807,7 +795,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye else if ( hitType == 3) { // dealing with parallel displaced planes - double diff = m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; + double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55 ; // Amg::Vector3D layNormal = lay->surfaceRepresentation().normal(); double DN = parm->momentum().dot(layNormal); @@ -823,7 +811,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye return projRIO; } double locPos; - if (m_muonIdHelperTool->cscIdHelper().measuresPhi(id)) { + if (m_idHelperSvc->cscIdHelper().measuresPhi(id)) { locPos = rio->localParameters()[Trk::locX]+locCorrLay[Trk::locX]+csc_shift[Trk::locX]; } else { locPos = rio->localParameters()[Trk::locX]+locCorrLay[Trk::locY]+csc_shift[Trk::locY]; @@ -836,7 +824,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye Muon::CscClusterStatus status = Muon::CscStatusSimple; const Muon::CscPrepData* cscPrd = new Muon::CscPrepData( id , idHash, Amg::Vector2D(locPos,0.), rdoList, new Amg::MatrixX(rio->localCovariance()), cscROE,0,0.,status); const Muon::CscClusterOnTrack* cscRio = 0; - if (m_muonIdHelperTool->cscIdHelper().measuresPhi(id)) + if (m_idHelperSvc->cscIdHelper().measuresPhi(id)) cscRio = new Muon::CscClusterOnTrack( cscPrd, Trk::LocalParameters(Trk::DefinedParameter(locPos,Trk::locX)), cscPrd->localCovariance(), parm->localPosition()[Trk::locY],cscPrd->status()); @@ -858,7 +846,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye rdoList.push_back(id); const Muon::TgcPrepData* tgcPrd = new Muon::TgcPrepData( id , idHash,Amg::Vector2D(locPos,0.), rdoList, new Amg::MatrixX(rio->localCovariance()), tgcROE); const Muon::TgcClusterOnTrack* tgcRio = 0; - if (m_muonIdHelperTool->tgcIdHelper().isStrip(id)) { + if (m_idHelperSvc->tgcIdHelper().isStrip(id)) { Amg::Vector2D loc(locPos,parm->localPosition()[Trk::locY]); tgcRio = new Muon::TgcClusterOnTrack( tgcPrd, Trk::LocalParameters(Trk::DefinedParameter(locPos,Trk::locX)), @@ -901,10 +889,10 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay Identifier layId(lay->layerType()); unsigned int hitType = 0; - if ( m_muonIdHelperTool->mdtIdHelper().is_mdt(layId) ) hitType = 1; - if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(layId) ) hitType = 2; - if ( m_muonIdHelperTool->mdtIdHelper().is_csc(layId) ) hitType = 3; - if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(layId) ) hitType = 4; + if ( m_idHelperSvc->isMdt(layId) ) hitType = 1; + if ( m_idHelperSvc->isRpc(layId) ) hitType = 2; + if ( m_idHelperSvc->isCsc(layId) ) hitType = 3; + if ( m_idHelperSvc->isTgc(layId) ) hitType = 4; if ( hitType==0 ) { ATH_MSG_DEBUG("unknown hit technology"); @@ -933,18 +921,18 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay int itube = int( dloc/30.035 ) + 1; if (itube < 1 || itube > tMax || dloc<0.) {return nid;} // tube id - Identifier nearId = m_muonIdHelperTool->mdtIdHelper().channelID(m_muonIdHelperTool->mdtIdHelper().stationName(layId), - m_muonIdHelperTool->mdtIdHelper().stationEta(layId), - m_muonIdHelperTool->mdtIdHelper().stationPhi(layId), - m_muonIdHelperTool->mdtIdHelper().multilayer(layId), - m_muonIdHelperTool->mdtIdHelper().tubeLayer(layId), + Identifier nearId = m_idHelperSvc->mdtIdHelper().channelID(m_idHelperSvc->mdtIdHelper().stationName(layId), + m_idHelperSvc->mdtIdHelper().stationEta(layId), + m_idHelperSvc->mdtIdHelper().stationPhi(layId), + m_idHelperSvc->mdtIdHelper().multilayer(layId), + m_idHelperSvc->mdtIdHelper().tubeLayer(layId), itube); // check if position within active volume - if (fabs(locLay[Trk::locX])>0.5*mdtROE->getActiveTubeLength(m_muonIdHelperTool->mdtIdHelper().tubeLayer(layId),itube)) { + if (fabs(locLay[Trk::locX])>0.5*mdtROE->getActiveTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(layId),itube)) { return nid; } // - if (m_muonIdHelperTool->mdtIdHelper().valid(nearId)) return nearId; + if (m_idHelperSvc->mdtIdHelper().valid(nearId)) return nearId; else return nid; } @@ -956,26 +944,26 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay bool foundDoubletPhi = false; const MuonGM::RpcReadoutElement* rpcROE = 0; while (!foundDoubletPhi && doubletPhi<3) { - Identifier refPhi1 = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), - m_muonIdHelperTool->rpcIdHelper().doubletZ(layId), + Identifier refPhi1 = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), + m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 1,1); rpcROE = MuonDetMgr->getRpcReadoutElement(refPhi1); if (!rpcROE) return nid; - if (!m_muonIdHelperTool->rpcIdHelper().valid(refPhi1)) return nid; + if (!m_idHelperSvc->rpcIdHelper().valid(refPhi1)) return nid; int nStripPhi = rpcROE->Nstrips(1); - Identifier refPhiN = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), - m_muonIdHelperTool->rpcIdHelper().doubletZ(layId), + Identifier refPhiN = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), + m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 1,nStripPhi); // Amg::Vector2D loc1; @@ -996,13 +984,13 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay if (strip> 0 && strip <= nStripPhi) { // correct doublet - phiId = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), - m_muonIdHelperTool->rpcIdHelper().doubletZ(layId), + phiId = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), + m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 1,strip); foundDoubletPhi=true; @@ -1018,26 +1006,26 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay Identifier etaId(0); int doubletZ = 1; while (doubletZ<4) { - Identifier refEta1 = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), + Identifier refEta1 = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 0,1); rpcROE = MuonDetMgr->getRpcReadoutElement(refEta1); if (!rpcROE) return nid; - if (!m_muonIdHelperTool->rpcIdHelper().valid(refEta1)) return nid; + if (!m_idHelperSvc->rpcIdHelper().valid(refEta1)) return nid; int nStrips = rpcROE->Nstrips(0); - Identifier refEtaN = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), + Identifier refEtaN = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 0,nStrips); // @@ -1059,13 +1047,13 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay strip = dstrip>=0. ? int(dstrip)+1 : 0; if (strip > 0 && strip <= nStrips) { - etaId = m_muonIdHelperTool->rpcIdHelper().channelID(m_muonIdHelperTool->rpcIdHelper().stationName(layId), - m_muonIdHelperTool->rpcIdHelper().stationEta(layId), - m_muonIdHelperTool->rpcIdHelper().stationPhi(layId), - m_muonIdHelperTool->rpcIdHelper().doubletR(layId), + etaId = m_idHelperSvc->rpcIdHelper().channelID(m_idHelperSvc->rpcIdHelper().stationName(layId), + m_idHelperSvc->rpcIdHelper().stationEta(layId), + m_idHelperSvc->rpcIdHelper().stationPhi(layId), + m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi, - m_muonIdHelperTool->rpcIdHelper().gasGap(layId), + m_idHelperSvc->rpcIdHelper().gasGap(layId), 0,strip); if (measPhi) return phiId; else return etaId; @@ -1079,13 +1067,13 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay if ( hitType == 3) { // ref id - Identifier refId = m_muonIdHelperTool->cscIdHelper().channelID(m_muonIdHelperTool->cscIdHelper().stationName(layId), - m_muonIdHelperTool->cscIdHelper().stationEta(layId), - m_muonIdHelperTool->cscIdHelper().stationPhi(layId), - m_muonIdHelperTool->cscIdHelper().chamberLayer(layId), - m_muonIdHelperTool->cscIdHelper().wireLayer(layId), + Identifier refId = m_idHelperSvc->cscIdHelper().channelID(m_idHelperSvc->cscIdHelper().stationName(layId), + m_idHelperSvc->cscIdHelper().stationEta(layId), + m_idHelperSvc->cscIdHelper().stationPhi(layId), + m_idHelperSvc->cscIdHelper().chamberLayer(layId), + m_idHelperSvc->cscIdHelper().wireLayer(layId), measPhi,1); - if (!m_muonIdHelperTool->cscIdHelper().valid(refId)) return nid; + if (!m_idHelperSvc->cscIdHelper().valid(refId)) return nid; // residual in ref frame const Trk::TrackParameters* refPar = layerToDetEl(lay,parm,refId); if (!refPar) return nid; @@ -1093,14 +1081,14 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(refId); if (!cscROE) {delete refPar; return nid;} pitch = cscROE->StripPitch(measPhi); - int nStrips = m_muonIdHelperTool->cscIdHelper().stripMax(refId); + int nStrips = m_idHelperSvc->cscIdHelper().stripMax(refId); if (nStrips < 1) {delete refPar; return nid;} - Identifier refIdN = m_muonIdHelperTool->cscIdHelper().channelID(m_muonIdHelperTool->cscIdHelper().stationName(refId), - m_muonIdHelperTool->cscIdHelper().stationEta(refId), - m_muonIdHelperTool->cscIdHelper().stationPhi(refId), - m_muonIdHelperTool->cscIdHelper().chamberLayer(refId), - m_muonIdHelperTool->cscIdHelper().wireLayer(refId), + Identifier refIdN = m_idHelperSvc->cscIdHelper().channelID(m_idHelperSvc->cscIdHelper().stationName(refId), + m_idHelperSvc->cscIdHelper().stationEta(refId), + m_idHelperSvc->cscIdHelper().stationPhi(refId), + m_idHelperSvc->cscIdHelper().chamberLayer(refId), + m_idHelperSvc->cscIdHelper().wireLayer(refId), measPhi,nStrips); // Amg::Vector3D loc1 = cscROE->surface(refId).transform().inverse()*cscROE->stripPos(refId); @@ -1113,11 +1101,11 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay delete refPar; refPar=0; if ( strip>0 && strip <= nStrips ) { // strip id - Identifier nearId = m_muonIdHelperTool->cscIdHelper().channelID(m_muonIdHelperTool->cscIdHelper().stationName(layId), - m_muonIdHelperTool->cscIdHelper().stationEta(layId), - m_muonIdHelperTool->cscIdHelper().stationPhi(layId), - m_muonIdHelperTool->cscIdHelper().chamberLayer(layId), - m_muonIdHelperTool->cscIdHelper().wireLayer(layId), + Identifier nearId = m_idHelperSvc->cscIdHelper().channelID(m_idHelperSvc->cscIdHelper().stationName(layId), + m_idHelperSvc->cscIdHelper().stationEta(layId), + m_idHelperSvc->cscIdHelper().stationPhi(layId), + m_idHelperSvc->cscIdHelper().chamberLayer(layId), + m_idHelperSvc->cscIdHelper().wireLayer(layId), measPhi,strip); if (fabs(residual(parm,nearId))> 0.5*pitch ) ATH_MSG_DEBUG("nearest CSC channel residual too large: " << residual(parm,nearId) ); @@ -1126,29 +1114,29 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay } if ( hitType == 4) { // ref id - if ( measPhi && m_muonIdHelperTool->tgcIdHelper().gasGap(layId)==2 && m_muonIdHelperTool->tgcIdHelper().gasGapMax(layId)==3 ) return nid; // no phi strips here + if ( measPhi && m_idHelperSvc->tgcIdHelper().gasGap(layId)==2 && m_idHelperSvc->tgcIdHelper().gasGapMax(layId)==3 ) return nid; // no phi strips here // ref id Identifier refId = layId; - if (measPhi) refId = m_muonIdHelperTool->tgcIdHelper().channelID(m_muonIdHelperTool->tgcIdHelper().stationName(layId), - m_muonIdHelperTool->tgcIdHelper().stationEta(layId), - m_muonIdHelperTool->tgcIdHelper().stationPhi(layId), - m_muonIdHelperTool->tgcIdHelper().gasGap(layId), + if (measPhi) refId = m_idHelperSvc->tgcIdHelper().channelID(m_idHelperSvc->tgcIdHelper().stationName(layId), + m_idHelperSvc->tgcIdHelper().stationEta(layId), + m_idHelperSvc->tgcIdHelper().stationPhi(layId), + m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi,1); - if (!m_muonIdHelperTool->tgcIdHelper().valid(refId)) return nid; + if (!m_idHelperSvc->tgcIdHelper().valid(refId)) return nid; // residual in ref frame const Trk::TrackParameters* refPar = layerToDetEl(lay,parm,refId); if (!refPar) return nid; // const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(layId); if (!tgcROE) {delete refPar; return nid;} - int nStrips = m_muonIdHelperTool->tgcIdHelper().channelMax(refId); + int nStrips = m_idHelperSvc->tgcIdHelper().channelMax(refId); if ( nStrips < 1 ) {delete refPar; return nid;} - Identifier refIdN = m_muonIdHelperTool->tgcIdHelper().channelID(m_muonIdHelperTool->tgcIdHelper().stationName(layId), - m_muonIdHelperTool->tgcIdHelper().stationEta(layId), - m_muonIdHelperTool->tgcIdHelper().stationPhi(layId), - m_muonIdHelperTool->tgcIdHelper().gasGap(layId), + Identifier refIdN = m_idHelperSvc->tgcIdHelper().channelID(m_idHelperSvc->tgcIdHelper().stationName(layId), + m_idHelperSvc->tgcIdHelper().stationEta(layId), + m_idHelperSvc->tgcIdHelper().stationPhi(layId), + m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi,nStrips); // Amg::Vector2D loc1; @@ -1170,20 +1158,20 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay if ( strip > 0 && strip <= nStrips) { // check second coordinate for active volume - if (!measPhi && fabs(refPar->localPosition()[Trk::locY])>(tgcROE->WireLength(m_muonIdHelperTool->tgcIdHelper().gasGap(layId),strip)-tgcROE->frameXwidth()) ) { + if (!measPhi && fabs(refPar->localPosition()[Trk::locY])>(tgcROE->WireLength(m_idHelperSvc->tgcIdHelper().gasGap(layId),strip)-tgcROE->frameXwidth()) ) { delete refPar; return nid; } - Identifier nearId = m_muonIdHelperTool->tgcIdHelper().channelID(m_muonIdHelperTool->tgcIdHelper().stationName(layId), - m_muonIdHelperTool->tgcIdHelper().stationEta(layId), - m_muonIdHelperTool->tgcIdHelper().stationPhi(layId), - m_muonIdHelperTool->tgcIdHelper().gasGap(layId), + Identifier nearId = m_idHelperSvc->tgcIdHelper().channelID(m_idHelperSvc->tgcIdHelper().stationName(layId), + m_idHelperSvc->tgcIdHelper().stationEta(layId), + m_idHelperSvc->tgcIdHelper().stationPhi(layId), + m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi,strip); Amg::Vector3D stripposition=tgcROE->surface(nearId).transform().inverse()*tgcROE->channelPos(nearId); Amg::Vector3D localhit=tgcROE->surface(nearId).transform().inverse()*parm->position(); - int plane = m_muonIdHelperTool->tgcIdHelper().gasGap(nearId); - if (m_muonIdHelperTool->tgcIdHelper().isStrip(nearId)) pitch = tgcROE->StripPitch(plane,m_muonIdHelperTool->tgcIdHelper().channel(nearId),localhit[1]); + int plane = m_idHelperSvc->tgcIdHelper().gasGap(nearId); + if (m_idHelperSvc->tgcIdHelper().isStrip(nearId)) pitch = tgcROE->StripPitch(plane,m_idHelperSvc->tgcIdHelper().channel(nearId),localhit[1]); int last = 0; while ( fabs(stripposition[0] - localhit[0])>0.5*pitch ) { if (stripposition[0]<localhit[0]) { @@ -1194,18 +1182,18 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay else break; } if ( strip<1 || strip > nStrips) break; - nearId = m_muonIdHelperTool->tgcIdHelper().channelID(m_muonIdHelperTool->tgcIdHelper().stationName(layId), - m_muonIdHelperTool->tgcIdHelper().stationEta(layId), - m_muonIdHelperTool->tgcIdHelper().stationPhi(layId), - m_muonIdHelperTool->tgcIdHelper().gasGap(layId), + nearId = m_idHelperSvc->tgcIdHelper().channelID(m_idHelperSvc->tgcIdHelper().stationName(layId), + m_idHelperSvc->tgcIdHelper().stationEta(layId), + m_idHelperSvc->tgcIdHelper().stationPhi(layId), + m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi,strip); stripposition=tgcROE->surface(nearId).transform().inverse()*tgcROE->channelPos(nearId); localhit=tgcROE->surface(nearId).transform().inverse()*parm->position(); - if (m_muonIdHelperTool->tgcIdHelper().isStrip(nearId)) pitch = tgcROE->StripPitch(plane,m_muonIdHelperTool->tgcIdHelper().channel(nearId),localhit[1]); + if (m_idHelperSvc->tgcIdHelper().isStrip(nearId)) pitch = tgcROE->StripPitch(plane,m_idHelperSvc->tgcIdHelper().channel(nearId),localhit[1]); } delete refPar; if ( strip<1 || strip > nStrips) return nid; - if (m_muonIdHelperTool->tgcIdHelper().valid(nearId)) return nearId; + if (m_idHelperSvc->tgcIdHelper().valid(nearId)) return nearId; else return nid; } delete refPar; @@ -1238,9 +1226,9 @@ const Trk::Layer* Muon::MuonTGMeasurementTool::associatedLayer(Identifier id, Am for (unsigned int i=0;i<detTV->size();i++) { if ((*detTV)[i]->layerRepresentation() && (*detTV)[i]->layerRepresentation()->layerType()>0 ) { Identifier stId((*detTV)[i]->layerRepresentation()->layerType()); - if ( m_muonIdHelperTool->mdtIdHelper().stationName(stId) == m_muonIdHelperTool->mdtIdHelper().stationName(id) - && m_muonIdHelperTool->mdtIdHelper().stationEta(stId) == m_muonIdHelperTool->mdtIdHelper().stationEta(id) - && m_muonIdHelperTool->mdtIdHelper().stationPhi(stId) == m_muonIdHelperTool->mdtIdHelper().stationPhi(id) ) { + if ( m_idHelperSvc->mdtIdHelper().stationName(stId) == m_idHelperSvc->mdtIdHelper().stationName(id) + && m_idHelperSvc->mdtIdHelper().stationEta(stId) == m_idHelperSvc->mdtIdHelper().stationEta(id) + && m_idHelperSvc->mdtIdHelper().stationPhi(stId) == m_idHelperSvc->mdtIdHelper().stationPhi(id) ) { station = (*detTV)[i]; break; } } @@ -1302,28 +1290,28 @@ const Trk::Layer* Muon::MuonTGMeasurementTool::match(Identifier id, const Trk::L Identifier layId(lay->layerType()); - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id) && m_muonIdHelperTool->mdtIdHelper().is_mdt(layId) ) { + if (m_idHelperSvc->isMdt(id) && m_idHelperSvc->isMdt(layId) ) { - if (m_muonIdHelperTool->mdtIdHelper().multilayer(layId) == m_muonIdHelperTool->mdtIdHelper().multilayer(id) - && m_muonIdHelperTool->mdtIdHelper().tubeLayer(layId) == m_muonIdHelperTool->mdtIdHelper().tubeLayer(id) ) return lay; + if (m_idHelperSvc->mdtIdHelper().multilayer(layId) == m_idHelperSvc->mdtIdHelper().multilayer(id) + && m_idHelperSvc->mdtIdHelper().tubeLayer(layId) == m_idHelperSvc->mdtIdHelper().tubeLayer(id) ) return lay; } - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id) && m_muonIdHelperTool->rpcIdHelper().is_rpc(layId) ) { + if (m_idHelperSvc->isRpc(id) && m_idHelperSvc->isRpc(layId) ) { - if ( m_muonIdHelperTool->rpcIdHelper().doubletR(layId) == m_muonIdHelperTool->rpcIdHelper().doubletR(id) - && m_muonIdHelperTool->rpcIdHelper().doubletZ(layId) == m_muonIdHelperTool->rpcIdHelper().doubletZ(id) - && m_muonIdHelperTool->rpcIdHelper().gasGap(layId) == m_muonIdHelperTool->rpcIdHelper().gasGap(id) ) return lay; + if ( m_idHelperSvc->rpcIdHelper().doubletR(layId) == m_idHelperSvc->rpcIdHelper().doubletR(id) + && m_idHelperSvc->rpcIdHelper().doubletZ(layId) == m_idHelperSvc->rpcIdHelper().doubletZ(id) + && m_idHelperSvc->rpcIdHelper().gasGap(layId) == m_idHelperSvc->rpcIdHelper().gasGap(id) ) return lay; } - if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id) && m_muonIdHelperTool->tgcIdHelper().is_tgc(layId) ) { + if (m_idHelperSvc->isTgc(id) && m_idHelperSvc->isTgc(layId) ) { - if ( m_muonIdHelperTool->tgcIdHelper().gasGap(layId) == m_muonIdHelperTool->tgcIdHelper().gasGap(id) ) return lay; + if ( m_idHelperSvc->tgcIdHelper().gasGap(layId) == m_idHelperSvc->tgcIdHelper().gasGap(id) ) return lay; } - if (m_muonIdHelperTool->cscIdHelper().is_csc(id) && m_muonIdHelperTool->cscIdHelper().is_csc(layId) ) { + if (m_idHelperSvc->isCsc(id) && m_idHelperSvc->isCsc(layId) ) { - if ( m_muonIdHelperTool->cscIdHelper().chamberLayer(layId) == m_muonIdHelperTool->cscIdHelper().chamberLayer(id) - && m_muonIdHelperTool->cscIdHelper().wireLayer(layId) == m_muonIdHelperTool->cscIdHelper().wireLayer(id) ) return lay; + if ( m_idHelperSvc->cscIdHelper().chamberLayer(layId) == m_idHelperSvc->cscIdHelper().chamberLayer(id) + && m_idHelperSvc->cscIdHelper().wireLayer(layId) == m_idHelperSvc->cscIdHelper().wireLayer(id) ) return lay; } return mLay; @@ -1361,7 +1349,7 @@ double Muon::MuonTGMeasurementTool::residual( const Trk::Layer* layer, const Trk const Trk::TrackParameters* detElPar = layerToDetEl( layer, layPar, rio->identify() ); if (!detElPar) return res; - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(rio->identify())) { + if (m_idHelperSvc->isMdt(rio->identify())) { res = fabs( detElPar->localPosition()[Trk::locR] - rio->localParameters()[Trk::locR] ); } else { res = fabs( detElPar->localPosition()[Trk::locX] - rio->localParameters()[Trk::locX]); @@ -1387,16 +1375,16 @@ double Muon::MuonTGMeasurementTool::residual( const Trk::Layer* layer, const Trk const Trk::TrackParameters* detElPar = layerToDetEl( layer, layPar, id ); if (!detElPar) return res; - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) { + if (m_idHelperSvc->isMdt(id)) { res = detElPar->localPosition()[Trk::locR] ; - } else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) { + } else if (m_idHelperSvc->isRpc(id)) { const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); if (rpcROE) res = detElPar->localPosition()[Trk::locX] - (detElPar->associatedSurface().transform().inverse()*(rpcROE->stripPos(id)))[Trk::locX]; - } else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { + } else if (m_idHelperSvc->isCsc(id)) { const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); if (cscROE) res = detElPar->localPosition()[Trk::locX] - (detElPar->associatedSurface().transform().inverse()*(cscROE->stripPos(id)))[0]; - } else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) { - if ( m_muonIdHelperTool->tgcIdHelper().isStrip(id) && m_muonIdHelperTool->tgcIdHelper().gasGap(id)==2 && m_muonIdHelperTool->tgcIdHelper().gasGapMax(id)==3 ) { + } else if (m_idHelperSvc->isTgc(id)) { + if ( m_idHelperSvc->tgcIdHelper().isStrip(id) && m_idHelperSvc->tgcIdHelper().gasGap(id)==2 && m_idHelperSvc->tgcIdHelper().gasGapMax(id)==3 ) { delete detElPar; return res; // no phi strips here } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.cxx index 219e64fb588823d1167b80c65a5dd3f6aea9da0f..6eac0c302ad974ba569b9e39345de084bde6944d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.cxx @@ -1,28 +1,20 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RPC_TimingTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" - namespace Muon { - RPC_TimingTool::RPC_TimingTool(const std::string& t, const std::string& n, const IInterface* p): - AthAlgTool(t,n,p), m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") { + RPC_TimingTool::RPC_TimingTool(const std::string& t, const std::string& n, const IInterface* p) : + AthAlgTool(t,n,p) { declareInterface<IMuonHitTimingTool>(this); } - RPC_TimingTool::~RPC_TimingTool() {} - StatusCode RPC_TimingTool::initialize() { - ATH_CHECK( m_idHelper.retrieve() ); - return StatusCode::SUCCESS; - } - - StatusCode RPC_TimingTool::finalize() { + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -43,7 +35,7 @@ namespace Muon { const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(hit); if( !rpc ) continue; int bin = invbinwidth*(rpc->time()-minTime); - ATH_MSG_DEBUG(m_idHelper->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin ); + ATH_MSG_DEBUG(m_idHelperSvc->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin ); if( bin < 0 || bin >= (int)histogram.size() ) continue; ++histogram[bin]; } @@ -64,7 +56,7 @@ namespace Muon { const RpcClusterOnTrack* rpc = dynamic_cast<const RpcClusterOnTrack*>(hit); if( !rpc ) continue; int bin = invbinwidth*(rpc->time()-minTime); - ATH_MSG_DEBUG(m_idHelper->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin ); + ATH_MSG_DEBUG(m_idHelperSvc->toString(hit->identify()) << " time " << rpc->time() << " bin " << bin ); // select hits in the max bin or the two neighbouring ones if( bin > maxbin+1 || bin < maxbin-1 ) continue; time += rpc->time(); @@ -84,8 +76,8 @@ namespace Muon { // https://indico.cern.ch/getFile.py/access?contribId=6&resId=0&materialId=slides&confId=147791 // ... no calibration offline yet, no correction for signal propagation time) Identifier id = rpcRIO.identify(); - int measPhi = m_idHelper->measuresPhi(id); - MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(id); + int measPhi = m_idHelperSvc->measuresPhi(id); + MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); if( stIndex == MuonStationIndex::BO) { // outer layer station => high pt if (measPhi==1) return 5.10; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.h index 697787f6ef176c85b3ff9d3eaf8e084af5207d50..e4c1ebd910ea7c95a97da4537a736cda4ee72034 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTimingTools/src/RPC_TimingTool.h @@ -1,13 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RPC_TIMINGTOOL_H #define RPC_TIMINGTOOL_H -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonRecToolInterfaces/IMuonHitTimingTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" /** @class RPC_TimingTool @@ -16,24 +17,17 @@ @author MCP projects */ - namespace Muon{ class MuonClusterOnTrack; - class MuonIdHelperTool; class RPC_TimingTool : virtual public Muon::IMuonHitTimingTool, public AthAlgTool{ public: RPC_TimingTool(const std::string&, const std::string&, const IInterface*); - /** default destructor **/ - virtual ~RPC_TimingTool(); + virtual ~RPC_TimingTool()=default; - /** standard initialization method **/ virtual StatusCode initialize(); - - /** standard finalization method **/ - virtual StatusCode finalize(); /** Calculate the time offset of a given set of hits wrt to the current bunch */ TimingResult calculateTimingResult( const std::vector<const MuonClusterOnTrack*>& hits ) const; @@ -45,7 +39,7 @@ namespace Muon{ /** calculate error on the RPC time */ double getError(const Muon::MuonClusterOnTrack&) const ; - ToolHandle<MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.cxx index 959d09078113c460e58899babe3fe05bca6f7987..3db537b8e66471d8f5568c75585ddc027e0ec608 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.cxx @@ -1,14 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHitSummaryTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonSegment/MuonSegment.h" -#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include "TrkTrack/Track.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/MuonTrackSummary.h" @@ -17,51 +13,22 @@ namespace Muon { - MuonHitSummaryTool::MuonHitSummaryTool(const std::string& ty,const std::string& na,const IInterface* pa) - : AthAlgTool(ty,na,pa), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), + MuonHitSummaryTool::MuonHitSummaryTool(const std::string& ty,const std::string& na,const IInterface* pa) : + AthAlgTool(ty,na,pa), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_summaryHelperTool("Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool") { declareInterface<IMuonHitSummaryTool>(this); } - - MuonHitSummaryTool::~MuonHitSummaryTool(){} - - - StatusCode MuonHitSummaryTool::initialize() { - - if( AthAlgTool::initialize().isFailure() ) return StatusCode::FAILURE; - - if( m_idHelper.retrieve().isFailure() ) { - ATH_MSG_ERROR("could no initialize " << m_idHelper); - return StatusCode::FAILURE; - } - - if( !m_summaryHelperTool.empty() && m_summaryHelperTool.retrieve().isFailure() ) { - ATH_MSG_ERROR("could no initialize " << m_summaryHelperTool); - return StatusCode::FAILURE; - } - - if( !m_printer.empty() && m_printer.retrieve().isFailure() ) { - ATH_MSG_ERROR("could no initialize " << m_printer); - return StatusCode::FAILURE; - } - - if( m_edmHelperSvc.retrieve().isFailure() ) { - ATH_MSG_ERROR("could no initialize " << m_edmHelperSvc); - return StatusCode::FAILURE; - } - + StatusCode MuonHitSummaryTool::initialize() { + ATH_CHECK(m_idHelperSvc.retrieve()); + if(!m_summaryHelperTool.empty()) ATH_CHECK(m_summaryHelperTool.retrieve()); + if(!m_printer.empty()) ATH_CHECK(m_printer.retrieve()); + ATH_CHECK(m_edmHelperSvc.retrieve()); return StatusCode::SUCCESS; } - StatusCode MuonHitSummaryTool::finalize() { - if( AthAlgTool::finalize().isFailure() ) return StatusCode::FAILURE; - return StatusCode::SUCCESS; - } - void MuonHitSummaryTool::getMuonTrackSummary( Trk::MuonTrackSummary& muonSummary, const Trk::Track& track ) const { // check whether helper tool set @@ -78,8 +45,7 @@ namespace Muon { IMuonHitSummaryTool::CompactSummary MuonHitSummaryTool::summary( const Trk::Track& track ) const { - if( msgLvl(MSG::DEBUG) ) msg() << MSG::DEBUG << m_printer->print(track) - << std::endl << m_printer->printStations(track) << endmsg; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(m_printer->print(track) << std::endl << m_printer->printStations(track)); // check if the track already has a MuonTrackSummary, if so use it if ( track.trackSummary() && track.trackSummary()->muonTrackSummary() ) return summary(*track.trackSummary()->muonTrackSummary()); @@ -107,15 +73,15 @@ namespace Muon { std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit_end = s.chamberHitSummary().end(); for( ;chit!=chit_end;++chit ) { const Identifier& chId = chit->chamberId(); - bool isMdt = m_idHelper->isMdt(chId); - bool isCsc = m_idHelper->isCsc(chId); - bool isMM = m_idHelper->isMM(chId); - bool issTgc = m_idHelper->issTgc(chId); + bool isMdt = m_idHelperSvc->isMdt(chId); + bool isCsc = m_idHelperSvc->isCsc(chId); + bool isMM = m_idHelperSvc->isMM(chId); + bool issTgc = m_idHelperSvc->issTgc(chId); bool isEIPrec = isCsc||isMM||issTgc; // only account for sectors if chamber has eta hits if( (isMdt && chit->nhits() > 0) || ( isEIPrec && chit->netaHits() > 0) ) { - int sector = m_idHelper->sector(chId); + int sector = m_idHelperSvc->sector(chId); if( isMdt ) sectorLayerCounts[sector] += chit->nhits(); else sectorLayerCounts[sector] += chit->netaHits(); sum.sectors.insert(sector); @@ -123,14 +89,14 @@ namespace Muon { // only account for phi layers if not an MDT and has phi hits if( !isMdt && chit->nphiHits() > 0 ) { - MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(chId); + MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(chId); sum.phiLayers.insert(index); } - MuonStationIndex::StIndex index = m_idHelper->stationIndex(chId); + MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(chId); HitSummary& hitSummary = sum.stationLayers[index]; - hitSummary.isEndcap=m_idHelper->isEndcap(chId); - hitSummary.isSmall=m_idHelper->isSmallChamber(chId); + hitSummary.isEndcap=m_idHelperSvc->isEndcap(chId); + hitSummary.isSmall=m_idHelperSvc->isSmallChamber(chId); if( isMdt ){ hitSummary.nprecisionHits += chit->nhits(); hitSummary.nprecisionHoles += chit->nholes(); @@ -153,11 +119,6 @@ namespace Muon { if( !isEIPrec && chit->etaProjection().nholes > 0 && chit->etaProjection().nhits == 0 ) ++hitSummary.netaTriggerHoleLayers; if( chit->phiProjection().nholes > 0 && chit->phiProjection().nhits == 0 ) ++hitSummary.nphiHoleLayers; - -// if( chit->etaProjection().nholes > 0 || chit->phiProjection().nholes > 0 ) -// ATH_MSG_INFO("found hole in layer " << m_idHelper->toStringChamber(chId) -// << " nphi " << chit->phiProjection().nhits << " holes " << chit->phiProjection().nholes -// << " neta " << chit->etaProjection().nhits << " holes " << chit->etaProjection().nholes ); } } @@ -175,7 +136,7 @@ namespace Muon { calculateSummaryCounts(sum); - if( msgLvl(MSG::DEBUG) ) msg() << MSG::DEBUG << sum.dump() << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(sum.dump()); return sum; @@ -235,15 +196,15 @@ namespace Muon { std::vector<const Trk::MeasurementBase*>::const_iterator it_end = rioVec.end(); for( ;it!=it_end; ++it ){ Identifier id = m_edmHelperSvc->getIdentifier(**it); - if( !id.is_valid() || !m_idHelper->isMuon(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; - bool isMdt = m_idHelper->isMdt(id); - bool isCsc = m_idHelper->isCsc(id); - bool measuresPhi = m_idHelper->measuresPhi(id); + bool isMdt = m_idHelperSvc->isMdt(id); + bool isCsc = m_idHelperSvc->isCsc(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); // only account for sectors if chamber has eta hits if( isMdt || (isCsc && !measuresPhi) ) { - int sector = m_idHelper->sector(id); + int sector = m_idHelperSvc->sector(id); if( isMdt ) ++sectorLayerCounts[sector]; if( isCsc ) ++sectorLayerCounts[sector]; sum.sectors.insert(sector); @@ -251,16 +212,16 @@ namespace Muon { // only account for phi layers if not an MDT and has phi hits if( !isMdt && measuresPhi ) { - MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(id); + MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id); sum.phiLayers.insert(index); } - MuonStationIndex::StIndex index = m_idHelper->stationIndex(id); + MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(id); HitSummary& hitSummary = sum.stationLayers[index]; if( isMdt || (isCsc && !measuresPhi) ) ++hitSummary.nprecisionHits; if( !isMdt ){ - MuonStationIndex::PhiIndex pindex = m_idHelper->phiIndex(id); + MuonStationIndex::PhiIndex pindex = m_idHelperSvc->phiIndex(id); std::pair<int,int> etaPhiCount = countLayersPerStation[index][pindex]; if( measuresPhi ) ++etaPhiCount.first; else ++etaPhiCount.second; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.h index 90e562a0e2747073537c596f02e3ec3d0f346934..f140a9690c1379c937c06f25a6f1b291086f91c6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonHitSummaryTool.h @@ -1,48 +1,35 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONHITSUMMARYTOOL_H #define MUON_MUONHITSUMMARYTOOL_H +#include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" - -#include <string> +#include "GaudiKernel/ToolHandle.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" +#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -class Identifier; - -namespace Trk { - class ITrackSummaryHelperTool; -} +#include <string> namespace Muon { - - class MuonIdHelperTool; - class MuonEDMPrinterTool; - /** @brief Helper tool to extract simple counts from a Trk::Track, Trk::TrackSummary or Trk::MuonTrackSummary */ class MuonHitSummaryTool : public AthAlgTool, virtual public IMuonHitSummaryTool { public: - /** @brief constructor */ MuonHitSummaryTool(const std::string&,const std::string&,const IInterface*); - /** @brief destructor */ - virtual ~MuonHitSummaryTool (); + virtual ~MuonHitSummaryTool()=default; - /** @brief AlgTool initilize */ StatusCode initialize(); - /** @brief AlgTool finalize */ - StatusCode finalize(); - /** @brief Calculate compact summary @param track input track @return CompactSummary @@ -84,7 +71,7 @@ namespace Muon { /** helper function to calculate MuonTrackSummary from track */ void getMuonTrackSummary( Trk::MuonTrackSummary& muonSummary, const Trk::Track& track ) const; void calculateSummaryCounts( CompactSummary& sum) const; - ToolHandle<MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx index cc11e328847919239a2a22217a21feffc5b9bb6b..4482125f1b0004d124735fb0e792b1cac30d4861 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx @@ -4,8 +4,6 @@ #include "MuonTrackSummaryHelperTool.h" -#include "Identifier/Identifier.h" - #include "TrkDetElementBase/TrkDetElementBase.h" #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" @@ -17,57 +15,33 @@ #include "MuonRIO_OnTrack/MuonDriftCircleErrorStrategy.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "TrkTrackSummary/TrackSummary.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackStateOnSurface.h" #include "TrkParameters/TrackParameters.h" #include "TrkSurfaces/Surface.h" - #include "StoreGate/ReadHandle.h" -#include <vector> #include <cassert> #include <set> #include <cmath> -Muon::MuonTrackSummaryHelperTool::MuonTrackSummaryHelperTool( - const std::string& t, - const std::string& n, - const IInterface* p ) - : base_class(t,n,p) +Muon::MuonTrackSummaryHelperTool::MuonTrackSummaryHelperTool(const std::string& t, const std::string& n, const IInterface* p) : + base_class(t,n,p) { declareInterface<ITrackSummaryHelperTool>(this); } -Muon::MuonTrackSummaryHelperTool::~MuonTrackSummaryHelperTool() -{ -} - StatusCode Muon::MuonTrackSummaryHelperTool::initialize() { - ATH_CHECK(m_DetectorManagerKey.initialize()); - - if( m_calculateCloseHits && !m_extrapolator.empty() ){ - if (m_extrapolator.retrieve().isSuccess()){ - ATH_MSG_DEBUG("Retrieved " << m_extrapolator); - }else{ - ATH_MSG_ERROR("Could not get " << m_extrapolator); - return StatusCode::FAILURE; - } + if(m_calculateCloseHits && !m_extrapolator.empty()) { + ATH_CHECK(m_extrapolator.retrieve()); } else{ m_extrapolator.disable(); } - - if( m_idHelperTool.retrieve().isFailure() ){ - ATH_MSG_ERROR("Could not get " << m_idHelperTool); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_mdtKey.initialize()); - return StatusCode::SUCCESS; } @@ -83,29 +57,28 @@ void Muon::MuonTrackSummaryHelperTool::analyse( if (tsos->type(Trk::TrackStateOnSurface::Outlier)) return; //ignore outliers Identifier id = rot->identify(); - ATH_MSG_DEBUG("Processing rot: "<<m_idHelperTool->toString(id)); - if(m_idHelperTool->isRpc(id)){ - if( m_idHelperTool->rpcIdHelper().measuresPhi(id) ) increment(information[numberOfRpcPhiHits]); + ATH_MSG_DEBUG("Processing rot: "<<m_idHelperSvc->toString(id)); + if(m_idHelperSvc->isRpc(id)){ + if( m_idHelperSvc->rpcIdHelper().measuresPhi(id) ) increment(information[numberOfRpcPhiHits]); else increment(information[numberOfRpcEtaHits]); - }else if(m_idHelperTool->isCsc(id)) { - if( m_idHelperTool->cscIdHelper().measuresPhi(id) ) increment(information[numberOfCscPhiHits]); + }else if(m_idHelperSvc->isCsc(id)) { + if( m_idHelperSvc->cscIdHelper().measuresPhi(id) ) increment(information[numberOfCscPhiHits]); else { increment(information[numberOfCscEtaHits]); const CscClusterOnTrack* clus = dynamic_cast<const CscClusterOnTrack*>(rot); if (clus && ((clus->status()==Muon::CscStatusUnspoiled) || (clus->status()==Muon::CscStatusSplitUnspoiled))) increment(information[numberOfCscUnspoiltEtaHits]); } - }else if(m_idHelperTool->isTgc(id)){ - if( m_idHelperTool->tgcIdHelper().isStrip(id) ) increment(information[numberOfTgcPhiHits]); + }else if(m_idHelperSvc->isTgc(id)){ + if( m_idHelperSvc->tgcIdHelper().isStrip(id) ) increment(information[numberOfTgcPhiHits]); else increment(information[numberOfTgcEtaHits]); - }else if(m_idHelperTool->isMdt(id)){ + }else if(m_idHelperSvc->isMdt(id)){ increment(information[numberOfMdtHits]); - }else if(m_idHelperTool->issTgc(id) ){ - // strip = measuresPhi - if( m_idHelperTool->stgcIdHelper().measuresPhi(id) ) increment(information[numberOfStgcPhiHits]); + }else if(m_idHelperSvc->issTgc(id) ){ + if( m_idHelperSvc->stgcIdHelper().measuresPhi(id) ) increment(information[numberOfStgcPhiHits]); // we do not discriminate between pads or wires else increment(information[numberOfStgcEtaHits]); - }else if(m_idHelperTool->isMM(id)){ + }else if(m_idHelperSvc->isMM(id)){ increment(information[numberOfMmHits]); }else{ msg (MSG::ERROR) << "Unknown muon detector type " << endmsg; @@ -125,8 +98,8 @@ void Muon::MuonTrackSummaryHelperTool::analyse( std::set<Identifier> layIds; for (unsigned int i=0;i<crot->numberOfContainedROTs();i++){ const Trk::RIO_OnTrack* rot = &crot->rioOnTrack(i); - Identifier layId = m_idHelperTool->layerId( rot->identify() ); - ATH_MSG_DEBUG("ROT "<<i<<"\t LayerId="<<m_idHelperTool->toString(layId)); + Identifier layId = m_idHelperSvc->layerId( rot->identify() ); + ATH_MSG_DEBUG("ROT "<<i<<"\t LayerId="<<m_idHelperSvc->toString(layId)); std::pair< std::set<Identifier>::iterator, bool > pr = layIds.insert(layId); if(pr.second == true) { // layer not seen before @@ -202,21 +175,20 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track } if( pars->associatedSurface().associatedDetectorElement() ){ Identifier id = pars->associatedSurface().associatedDetectorElement()->identify(); - bool issTgc = m_idHelperTool->issTgc(id); + bool issTgc = m_idHelperSvc->issTgc(id); if(issTgc) { // get the identifier for phi or eta holes Identifier idh = pars->associatedSurface().associatedDetectorElementIdentifier(); if(idh.is_valid()) { id = idh; - // ATH_MSG_VERBOSE(" For sTGC hole use associatedDetectorElementIdentifier "); } } - if( !id.is_valid() || !m_idHelperTool->isMuon(id) ) continue; - Identifier chId = m_idHelperTool->chamberId(id); + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; + Identifier chId = m_idHelperSvc->chamberId(id); // for is summary sTGC split STGC1 and STGC2 - if(issTgc) chId = m_idHelperTool->detElId(id); + if(issTgc) chId = m_idHelperSvc->detElId(id); bool isFirst = isFirstProjection(id); - bool isMdt = m_idHelperTool->isMdt(id); + bool isMdt = m_idHelperSvc->isMdt(id); // check whether first chamber or new chamber if( !currentChamberSummary || currentChamberSummary->m_chId != chId ){ @@ -235,7 +207,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track updateHoleContent(*currentChamberSummary); } - ATH_MSG_VERBOSE(" Adding new chamber (holes) " << m_idHelperTool->toString(id) << " " << *pars); + ATH_MSG_VERBOSE(" Adding new chamber (holes) " << m_idHelperSvc->toString(id) << " " << *pars); trackSummary.m_chamberHitSummary.push_back( Trk::MuonTrackSummary::ChamberHitSummary(chId,isMdt) ); currentChamberSummary = &trackSummary.m_chamberHitSummary.back(); currentChamberPars = pars; @@ -246,7 +218,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track ++proj.nholes; } else { // sTgc holes keep track of phi and eta - if( m_idHelperTool->measuresPhi(id) ) { + if( m_idHelperSvc->measuresPhi(id) ) { ATH_MSG_VERBOSE(" counting sTGC phi hole "); Trk::MuonTrackSummary::ChamberHitSummary::Projection& proj = currentChamberSummary->m_second; ++proj.nholes; @@ -293,12 +265,12 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(meas); if( rot ){ id = rot->identify(); - if( !m_idHelperTool->isMuon(id) ) continue; + if( !m_idHelperSvc->isMuon(id) ) continue; // bound checks double tol1 = 100.; double tol2 = 2*tol1; - if( !pseudo && m_idHelperTool->isMdt(id) ) tol1 = 5.; + if( !pseudo && m_idHelperSvc->isMdt(id) ) tol1 = 5.; // we need a special bound check for MDTs so we cast to SL surface const Trk::StraightLineSurface* slSurf = dynamic_cast<const Trk::StraightLineSurface*>(&meas->associatedSurface()); if( slSurf ) { @@ -308,7 +280,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track inBounds = meas->associatedSurface().insideBounds(locPos,tol1,tol2); } - Identifier layId = m_idHelperTool->layerId( id ); + Identifier layId = m_idHelperSvc->layerId( id ); layIds.insert(layId); const MdtDriftCircleOnTrack* mdtdc = dynamic_cast<const MdtDriftCircleOnTrack*>(rot); if(mdtdc){ @@ -317,15 +289,15 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track goodLayIds.insert(layId); } } - else if(m_idHelperTool->isCsc(id)){ + else if(m_idHelperSvc->isCsc(id)){ const Muon::CscClusterOnTrack* cscClus = dynamic_cast<const Muon::CscClusterOnTrack*>(rot); if(cscClus->status()==0 || cscClus->status()==10) goodLayIds.insert(layId); } - else if(m_idHelperTool->isMM(id)) { + else if(m_idHelperSvc->isMM(id)) { // MM quality requirements to be inserted here if needed goodLayIds.insert(layId); } - else if(m_idHelperTool->issTgc(id)) { + else if(m_idHelperSvc->issTgc(id)) { // sTGC quality requirements to be inserted here if needed goodLayIds.insert(layId); } @@ -338,13 +310,13 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track id = crot->containedROTs().front()->identify(); // count layers in competing rot - std::vector<const Muon::MuonClusterOnTrack*>::const_iterator clit = crot->containedROTs().begin(); - std::vector<const Muon::MuonClusterOnTrack*>::const_iterator clit_end = crot->containedROTs().end(); - for( ;clit!=clit_end;++clit ){ + std::vector<const Muon::MuonClusterOnTrack*>::const_iterator cl_it = crot->containedROTs().begin(); + std::vector<const Muon::MuonClusterOnTrack*>::const_iterator cl_it_end = crot->containedROTs().end(); + for( ;cl_it!=cl_it_end;++cl_it ){ // get layer Identifier and insert it into set - Identifier layId = m_idHelperTool->layerId( (*clit)->identify() ); + Identifier layId = m_idHelperSvc->layerId( (*cl_it)->identify() ); layIds.insert(layId); - if(m_idHelperTool->isCsc(id)){ + if(m_idHelperSvc->isCsc(id)){ const Muon::CscClusterOnTrack* cscClus = dynamic_cast<const Muon::CscClusterOnTrack*>(rot); if(cscClus->status()==0 || cscClus->status()==10) goodLayIds.insert(layId); } @@ -354,13 +326,13 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track } } - Identifier chId = m_idHelperTool->chamberId(id); + Identifier chId = m_idHelperSvc->chamberId(id); // for is summary sTGC split STGC1 and STGC2 - bool issTgc = m_idHelperTool->issTgc(id); - if(issTgc) chId = m_idHelperTool->detElId(id); + bool issTgc = m_idHelperSvc->issTgc(id); + if(issTgc) chId = m_idHelperSvc->detElId(id); bool isFirst = isFirstProjection(id); - bool isMdt = m_idHelperTool->isMdt(id); - ATH_MSG_VERBOSE(" Adding hit " << m_idHelperTool->toString(id)); + bool isMdt = m_idHelperSvc->isMdt(id); + ATH_MSG_VERBOSE(" Adding hit " << m_idHelperSvc->toString(id)); /** check whether first chamber or new chamber */ if( !currentChamberSummary || currentChamberSummary->m_chId != chId ){ @@ -376,7 +348,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track } - ATH_MSG_VERBOSE(" Adding new chamber " << m_idHelperTool->toString(id) << " " << *pars); + ATH_MSG_VERBOSE(" Adding new chamber " << m_idHelperSvc->toString(id) << " " << *pars); trackSummary.m_chamberHitSummary.push_back( Trk::MuonTrackSummary::ChamberHitSummary(chId,isMdt) ); currentChamberSummary = &trackSummary.m_chamberHitSummary.back(); currentChamberPars = pars; @@ -390,8 +362,8 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track // MDTs: count outlier as delta electron if rDrift < rTrack < innerTubeRadius if( isMdt && pars ) { - double rDrift = fabs(meas->localParameters()[Trk::locR]); - double rTrack = fabs(pars->parameters()[Trk::locR]); + double rDrift = std::abs(meas->localParameters()[Trk::locR]); + double rTrack = std::abs(pars->parameters()[Trk::locR]); double innerRadius = MuonDetMgr->getMdtReadoutElement(id)->innerTubeRadius(); if( rTrack > rDrift && rTrack < innerRadius ) { ++proj.ndeltas; @@ -424,17 +396,13 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track } void Muon::MuonTrackSummaryHelperTool::updateHoleContent( Trk::MuonTrackSummary::ChamberHitSummary& chamberHitSummary ) const { -// ATH_MSG_DEBUG("updateHoleContent " << m_idHelperTool->toString(chamberHitSummary.chamberId()) -// << " nphi " << chamberHitSummary.phiProjection().nhits << " holes " << chamberHitSummary.phiProjection().nholes -// << " neta " << chamberHitSummary.etaProjection().nhits << " holes " << chamberHitSummary.etaProjection().nholes ); - - if( m_idHelperTool->issTgc(chamberHitSummary.chamberId()) ){ + if( m_idHelperSvc->issTgc(chamberHitSummary.chamberId()) ){ ATH_MSG_DEBUG(" holes eta " << chamberHitSummary.etaProjection().nholes << " phi " << chamberHitSummary.phiProjection().nholes ); } - if( m_idHelperTool->issTgc(chamberHitSummary.chamberId()) - || m_idHelperTool->isMM(chamberHitSummary.chamberId()) ){ + if( m_idHelperSvc->issTgc(chamberHitSummary.chamberId()) + || m_idHelperSvc->isMM(chamberHitSummary.chamberId()) ){ return; } @@ -445,14 +413,14 @@ void Muon::MuonTrackSummaryHelperTool::updateHoleContent( Trk::MuonTrackSummary: return; } - bool isCsc = m_idHelperTool->isCsc(chamberHitSummary.chamberId()); + bool isCsc = m_idHelperSvc->isCsc(chamberHitSummary.chamberId()); int neta = isCsc ? 4 : 2; int nphi = isCsc ? 4 : 2; - if( m_idHelperTool->isTgc(chamberHitSummary.chamberId()) ){ + if( m_idHelperSvc->isTgc(chamberHitSummary.chamberId()) ){ const MuonGM::TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(chamberHitSummary.chamberId()); if( !detEl ){ - ATH_MSG_WARNING(" No detector element found for " << m_idHelperTool->toStringChamber(chamberHitSummary.chamberId()) ); + ATH_MSG_WARNING(" No detector element found for " << m_idHelperSvc->toStringChamber(chamberHitSummary.chamberId()) ); return; } @@ -513,7 +481,7 @@ void Muon::MuonTrackSummaryHelperTool::calculateRoadHits(Trk::MuonTrackSummary:: } if ( !extrapolator ) return; - ATH_MSG_DEBUG("road hits for chamber "<<m_idHelperTool->toString(chamberHitSummary.chamberId())); + ATH_MSG_DEBUG("road hits for chamber "<<m_idHelperSvc->toString(chamberHitSummary.chamberId())); //currently treating MDTs only if(!chamberHitSummary.isMdt()) return; @@ -552,9 +520,9 @@ void Muon::MuonTrackSummaryHelperTool::calculateRoadHits(Trk::MuonTrackSummary:: exPars = extrapolator->extrapolateDirectly(pars,surf,Trk::anyDirection,false,Trk::muon); if( !exPars ) { if ( isStraightLine ) { - ATH_MSG_WARNING(" Straight line propagation to prd " << m_idHelperTool->toString(id) << " failed"); + ATH_MSG_WARNING(" Straight line propagation to prd " << m_idHelperSvc->toString(id) << " failed"); } else { - ATH_MSG_WARNING(" Curved track propagation to prd " << m_idHelperTool->toString(id) << " failed"); + ATH_MSG_WARNING(" Curved track propagation to prd " << m_idHelperSvc->toString(id) << " failed"); } continue; } @@ -569,20 +537,14 @@ void Muon::MuonTrackSummaryHelperTool::calculateRoadHits(Trk::MuonTrackSummary:: ATH_MSG_DEBUG(" same tube hit, not adding to close hits in road" ); }else { //add all hits within the road width (defined in job options) - if(fabs(distance) < m_roadWidth){ - ATH_MSG_VERBOSE( "Hit ID within road: " << m_idHelperTool->toString(id) << " distance " << distance << " < " << m_roadWidth ); + if(std::abs(distance) < m_roadWidth){ + ATH_MSG_VERBOSE( "Hit ID within road: " << m_idHelperSvc->toString(id) << " distance " << distance << " < " << m_roadWidth ); ++proj.ncloseHits; addedIds.insert(id); } else { - ATH_MSG_VERBOSE( "Hit ID outside road: " << m_idHelperTool->toString(id) << " distance " << distance << " >= " << m_roadWidth ); + ATH_MSG_VERBOSE( "Hit ID outside road: " << m_idHelperSvc->toString(id) << " distance " << distance << " >= " << m_roadWidth ); } } - - - /* //add all hits within the road width (defined in job options) - if(fabs(distance) < m_roadWidth) ++proj.ncloseHits; - */ - // to avoid double deleting when track is deleted, only delete //exPars when it's not the TrackParameters which was passed (pars) if(exPars != &pars) delete exPars; @@ -611,10 +573,10 @@ void Muon::MuonTrackSummaryHelperTool::calculateRoadHits(Trk::MuonTrackSummary:: } bool Muon::MuonTrackSummaryHelperTool::isFirstProjection( const Identifier& id ) const { - if( !m_idHelperTool->isMdt(id) ) { - return !m_idHelperTool->measuresPhi(id); + if( !m_idHelperSvc->isMdt(id) ) { + return !m_idHelperSvc->measuresPhi(id); } - return m_idHelperTool->mdtIdHelper().multilayer(id) == 1; + return m_idHelperSvc->mdtIdHelper().multilayer(id) == 1; } const Muon::MdtPrepDataCollection* Muon::MuonTrackSummaryHelperTool::findMdtPrdCollection( const Identifier& chId ) const { @@ -631,11 +593,11 @@ const Muon::MdtPrepDataCollection* Muon::MuonTrackSummaryHelperTool::findMdtPrdC } IdentifierHash hash_id; - m_idHelperTool->mdtIdHelper().get_module_hash(chId,hash_id ); + m_idHelperSvc->mdtIdHelper().get_module_hash(chId,hash_id ); Muon::MdtPrepDataContainer::const_iterator colIt = mdtPrdContainer->indexFind(hash_id); if( colIt == mdtPrdContainer->end() ){ - ATH_MSG_DEBUG(" MdtPrepDataCollection for: " << m_idHelperTool->toStringChamber(chId) + ATH_MSG_DEBUG(" MdtPrepDataCollection for: " << m_idHelperSvc->toStringChamber(chId) << " not found in container "); return 0; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h index 78cb549077ebe82c901c36e7a3827f0d0ca3041e..6a45faabff7f2f04209ee615a22df85ff3d3c8a7 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h @@ -1,39 +1,34 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONTRACKSUMMARYHELPERTOOL_H #define MUONTRACKSUMMARYHELPERTOOL_H #include "TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h" -// +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "TrkGeometry/TrackingGeometry.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkToolInterfaces/ITrackHoleSearchTool.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/MuonTrackSummary.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - #include "StoreGate/ReadHandleKey.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <vector> +#include <string> #include <bitset> -class Identifier; - namespace Trk { class RIO_OnTrack; class TrackStateOnSurface; class CompetingRIOsOnTrack; - class TrackSummary; } namespace MuonGM { @@ -46,7 +41,7 @@ namespace Muon { public: MuonTrackSummaryHelperTool(const std::string&,const std::string&,const IInterface*); - virtual ~MuonTrackSummaryHelperTool (); + virtual ~MuonTrackSummaryHelperTool()=default; virtual StatusCode initialize() override; @@ -109,8 +104,7 @@ private: /**increment the 'type'*/ void increment(int& type) const; - /* used to work out layer ids etc*/ - ToolHandle<MuonIdHelperTool> m_idHelperTool{"Muon::MuonIdHelperTool/MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /* used to do hits-in-road search for straight tracks */ ToolHandle<Trk::IExtrapolator> m_slExtrapolator{"Trk::Extrapolator/MuonStraightLineExtrapolator"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MuonStationIntersectSvc.h b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MuonStationIntersectSvc.h index 20e18b15f54a665e6dbec39842e63650c51c98cb..3327f1e5139f653f7e232eb5fb74584f3a12fa95 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MuonStationIntersectSvc.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MuonStationIntersectSvc.h @@ -1,19 +1,19 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONSTATIONINTERSECTSVC_H #define MUON_MUONSTATIONINTERSECTSVC_H #include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "MuonStationIntersectSvc/MuonStationIntersect.h" const InterfaceID IID_IMuonStationIntersectSvc("MuonStationIntersectSvc", 1, 0); -#include "MuonStationIntersectSvc/MuonStationIntersect.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class MuonIdHelperTool; namespace MuonGM { class MuonDetectorManager; } @@ -33,13 +33,12 @@ class MdtCondDbData; class MuonStationIntersectSvc : public AthService, virtual public IInterface{ public: MuonStationIntersectSvc(const std::string& name,ISvcLocator* sl); - virtual ~MuonStationIntersectSvc(); + virtual ~MuonStationIntersectSvc()=default; static const InterfaceID& interfaceID() { return IID_IMuonStationIntersectSvc; } virtual StatusCode queryInterface(const InterfaceID& riid,void** ppvIF); virtual StatusCode initialize(void); - virtual StatusCode finalize(void); /** @brief calculate which MDT tubes were crossed by a trajectory @param id the Identifier of the chamber @@ -61,7 +60,7 @@ class MuonStationIntersectSvc : public AthService, virtual public IInterface{ /** @brief get identifiers of chamber corresponding to this id and its neighbors */ const std::vector<Identifier> binPlusneighbours( const Identifier& id ) const; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper{this,"MuonIdHelperTool","Muon::MuonIdHelperTool/MuonIdHelperTool","MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx index ed07630d8b065b736f219eac5b20632b8cc854e4..fbc80277b7f4db6811b3543e6edd1a73515ca106 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx @@ -1,27 +1,27 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonStationIntersectSvc/MdtIntersectGeometry.h" -#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" #include "TrkDriftCircleMath/MdtChamberGeometry.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "MuonIdHelpers/MdtIdHelper.h" #include "GeoModelUtilities/GeoGetIds.h" - #include "MuonCondData/MdtCondDbData.h" namespace Muon{ - MdtIntersectGeometry::MdtIntersectGeometry( const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, - const MdtCondDbData* dbData, - MsgStream* msg) - : m_chid(chid), m_mdtGeometry(0), m_detMgr(detMgr), m_dbData(dbData) + MdtIntersectGeometry::MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg) : + m_chid(chid), + m_mdtGeometry(nullptr), + m_detMgr(detMgr), + m_dbData(dbData), + m_mdtIdHelper(nullptr) { init(msg); } @@ -62,16 +62,17 @@ namespace Muon{ MuonStationIntersect intersect; if( !m_mdtGeometry ){ - std::cout << " MdtIntersectGeometry::intersection: WARNING MdtIntersectGeometry not correctly initialized " << m_mdtIdHelper->print_to_string(m_chid) << std::endl; + MsgStream log(Athena::getMessageSvc(),"MdtIntersectGeometry"); + log<<MSG::WARNING<<"MdtIntersectGeometry::intersection() - MdtIntersectGeometry not correctly initialized "<< m_mdtIdHelper->print_to_string(m_chid)<<endmsg; return intersect; } Amg::Vector3D lpos = transform()*pos; Amg::Vector3D ldir = (transform().linear()*dir).unit(); - double dxdy = fabs(ldir.y()) > 0.001 ? ldir.x()/ldir.y() : 1000.; + double dxdy = std::abs(ldir.y()) > 0.001 ? ldir.x()/ldir.y() : 1000.; - double lineAngle = atan2(ldir.z(),ldir.y()); + double lineAngle = std::atan2(ldir.z(),ldir.y()); TrkDriftCircleMath::LocPos linePos( lpos.y(),lpos.z() ); TrkDriftCircleMath::Line line( linePos, lineAngle ); @@ -89,7 +90,7 @@ namespace Muon{ if( std::find( m_deadTubes.begin(), m_deadTubes.end(), tubeid ) != m_deadTubes.end() ) continue; } - double distWall = fabs(xint) - 0.5*tubeLength( dit->id().ml(), dit->id().lay(), dit->id().tube() ); + double distWall = std::abs(xint) - 0.5*tubeLength( dit->id().ml(), dit->id().lay(), dit->id().tube() ); intersects.push_back( MuonTubeIntersect( tubeid, dit->dr(), distWall ) ); } @@ -143,7 +144,7 @@ namespace Muon{ m_detElMl1 = 0; if( !m_detElMl0 ) { - std::cout<<"MdtIntersectGeometry::init: WARNING failed to get readout element for ML0"<<std::endl; + (*msg)<<MSG::WARNING<<"MdtIntersectGeometry::init() - failed to get readout element for ML0"<<endmsg; return; } @@ -181,7 +182,7 @@ namespace Muon{ firstIdml0 = firstIdml1; firstMlIndex = 2; }else if( !goodMl0 && !goodMl1 ) { - std::cout<<"MdtIntersectGeometry::init: WARNING neither multilayer is good"<<std::endl; + (*msg)<<MSG::WARNING<<"MdtIntersectGeometry::init() - neither multilayer is good"<<endmsg; return; } m_transform = m_detElMl0->GlobalToAmdbLRSTransform(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx index 76e3207a7aeec0786bfa6f6366dd88e905bdf510..3cf57ea24205204b259654ec836c949dfde3d9cf 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx @@ -1,30 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonStationIntersectSvc/MuonStationIntersectSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" - -#include "Identifier/Identifier.h" - -#include "StoreGate/StoreGateSvc.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include "MuonStationIntersectSvc/MuonIntersectGeometry.h" #include "MuonStationIntersectSvc/MdtIntersectGeometry.h" - #include "MuonCondData/MdtCondDbData.h" -MuonStationIntersectSvc::MuonStationIntersectSvc(const std::string& name,ISvcLocator* sl) - : AthService(name,sl) -{ -} - -MuonStationIntersectSvc::~MuonStationIntersectSvc() { +MuonStationIntersectSvc::MuonStationIntersectSvc(const std::string& name,ISvcLocator* sl) : + AthService(name,sl) { } // queryInterface @@ -42,13 +28,7 @@ StatusCode MuonStationIntersectSvc::queryInterface(const InterfaceID& riid, void StatusCode MuonStationIntersectSvc::initialize() { - ATH_CHECK(m_idHelper.retrieve()); - - return StatusCode::SUCCESS; -} - -StatusCode MuonStationIntersectSvc::finalize() { - ATH_MSG_DEBUG("MuonStationIntersectSvc::finalize"); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -64,7 +44,7 @@ const std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> > MuonStationInter for( const auto chId : chambers){ if(dbData){ if(!dbData->isGoodStation(chId)){ - ATH_MSG_VERBOSE ("chamber "<<m_idHelper->toString(chId)<<" is dead"); + ATH_MSG_VERBOSE ("chamber "<<m_idHelperSvc->toString(chId)<<" is dead"); continue; } } @@ -84,7 +64,7 @@ MuonStationIntersectSvc::tubesCrossedByTrack( const Identifier& id, std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> >::const_iterator it = stations.begin(); std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> >::const_iterator it_end = stations.end(); - ATH_MSG_DEBUG(" Calculating intersections for chamber " << m_idHelper->toString(id) + ATH_MSG_DEBUG(" Calculating intersections for chamber " << m_idHelperSvc->toString(id) << " accounting for " << stations.size()<<" stations"); Muon::MuonStationIntersect::TubeIntersects tubeIntersects; @@ -104,12 +84,12 @@ const std::vector<Identifier> MuonStationIntersectSvc::binPlusneighbours( const { std::vector<Identifier> chIds; - int stName = m_idHelper->mdtIdHelper().stationName(id); - int stPhi = m_idHelper->mdtIdHelper().stationPhi(id); - int stEta = m_idHelper->mdtIdHelper().stationEta(id); - bool isBarrel = m_idHelper->mdtIdHelper().isBarrel( id ); - int stEtaMin=m_idHelper->mdtIdHelper().stationEtaMin(id); - int stEtaMax=m_idHelper->mdtIdHelper().stationEtaMax(id); + int stName = m_idHelperSvc->mdtIdHelper().stationName(id); + int stPhi = m_idHelperSvc->mdtIdHelper().stationPhi(id); + int stEta = m_idHelperSvc->mdtIdHelper().stationEta(id); + bool isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel( id ); + int stEtaMin=m_idHelperSvc->mdtIdHelper().stationEtaMin(id); + int stEtaMax=m_idHelperSvc->mdtIdHelper().stationEtaMax(id); int chEtaLeft = stEta-1; int chEtaRight = stEta+1; @@ -120,7 +100,7 @@ const std::vector<Identifier> MuonStationIntersectSvc::binPlusneighbours( const // chamber with largest eta if( chEtaRight > stEtaMax ) chEtaRight = -999; - Muon::MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(id); + Muon::MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(id); // special treatment of EOS chambers if( chIndex == Muon::MuonStationIndex::EOS ) { @@ -139,26 +119,26 @@ const std::vector<Identifier> MuonStationIntersectSvc::binPlusneighbours( const } // no neighbours for BIS8 - if( chIndex == Muon::MuonStationIndex::BIS && abs(stEta) == 8 ){ + if( chIndex == Muon::MuonStationIndex::BIS && std::abs(stEta) == 8 ){ chEtaLeft = -999; chEtaRight = -999; } // BIS 8 never neighbour of a chamber if( chIndex == Muon::MuonStationIndex::BIS ){ - if( abs(chEtaLeft) == 8 ) chEtaLeft = -999; - if(abs(chEtaRight) == 8 ) chEtaRight = -999; + if(std::abs(chEtaLeft) == 8 ) chEtaLeft = -999; + if(std::abs(chEtaRight) == 8 ) chEtaRight = -999; } - if( chEtaLeft != -999 && m_idHelper->mdtIdHelper().validElement(m_idHelper->mdtIdHelper().elementID(stName,chEtaLeft,stPhi)) ) - chIds.push_back( m_idHelper->mdtIdHelper().elementID(stName,chEtaLeft,stPhi)); - chIds.push_back(m_idHelper->mdtIdHelper().elementID(id)); - if( chEtaRight != -999 && m_idHelper->mdtIdHelper().validElement(m_idHelper->mdtIdHelper().elementID(stName,chEtaRight,stPhi)) ) - chIds.push_back( m_idHelper->mdtIdHelper().elementID( stName,chEtaRight,stPhi ) ); + if( chEtaLeft != -999 && m_idHelperSvc->mdtIdHelper().validElement(m_idHelperSvc->mdtIdHelper().elementID(stName,chEtaLeft,stPhi)) ) + chIds.push_back( m_idHelperSvc->mdtIdHelper().elementID(stName,chEtaLeft,stPhi)); + chIds.push_back(m_idHelperSvc->mdtIdHelper().elementID(id)); + if( chEtaRight != -999 && m_idHelperSvc->mdtIdHelper().validElement(m_idHelperSvc->mdtIdHelper().elementID(stName,chEtaRight,stPhi)) ) + chIds.push_back( m_idHelperSvc->mdtIdHelper().elementID( stName,chEtaRight,stPhi ) ); - ATH_MSG_VERBOSE(" returning chambers for id " << m_idHelper->toString(id) << " ids " << chIds.size() + ATH_MSG_VERBOSE(" returning chambers for id " << m_idHelperSvc->toString(id) << " ids " << chIds.size() << " eta " << chEtaLeft << " " << stEta << " " << chEtaRight << " chambers: "); - for( unsigned int i=0;i<chIds.size();++i ) ATH_MSG_VERBOSE(m_idHelper->toString(chIds[i])); + for( unsigned int i=0;i<chIds.size();++i ) ATH_MSG_VERBOSE(m_idHelperSvc->toString(chIds[i])); return chIds; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx index 487d75cab146a8c601d9e4e38eda6e3e26eafc4a..c5153b14d580f07469596bdc0c45e140275181f0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx @@ -186,10 +186,6 @@ void Muon::MooSegmentCombinationFinder::findSegments( const std::vector<const Md } - - - if( m_doSummary || msgLvl(MSG::DEBUG) ) msg() << endmsg; - // increase counters, assume that the tools is only called once per event ++m_nevents; if( csc2dSegmentCombinations ) m_ncsc2SegmentCombinations += csc2dSegmentCombinations->size(); @@ -250,8 +246,8 @@ Muon::MooSegmentCombinationFinder::printSummary( std::string stageTag, const Muo if( !col ){ ATH_MSG_INFO("No segment combinations found "); }else{ - msg(MSG::INFO) << "Found " << col->size() << " segment combinations " << std::endl - << m_edmPrinter->print( *col ); + ATH_MSG_INFO("Found " << col->size() << " segment combinations " << std::endl + << m_edmPrinter->print( *col )); } } } @@ -263,7 +259,7 @@ Muon::MooSegmentCombinationFinder::printSummary( std::string stageTag, const Trk if( !col ){ ATH_MSG_INFO("No segments found "); }else{ - msg(MSG::INFO) << "Found " << col->size() << " segments found " << std::endl; + ATH_MSG_INFO("Found " << col->size() << " segments found "); Trk::SegmentCollection::const_iterator sit = col->begin(); Trk::SegmentCollection::const_iterator sit_end = col->end(); for( ;sit!=sit_end;++sit ){ @@ -272,7 +268,8 @@ Muon::MooSegmentCombinationFinder::printSummary( std::string stageTag, const Trk msg() << m_edmPrinter->print( *seg ) ; if( sit+1 != sit_end ) msg() << std::endl; } - } + } + msg() << endmsg; } } } @@ -349,7 +346,7 @@ Muon::MooSegmentCombinationFinder::extractSegmentCollection( const MuonSegmentCo if( !m_segmentSelector->select( *seg, ignoreHoles, quality, useEta, usePhi ) ){ if( msgLvl(MSG::VERBOSE) ) { int q = m_segmentSelector->quality(*seg,ignoreHoles,useEta,usePhi); - msg(MSG::VERBOSE) << " bad segment " << m_edmPrinter->print(*seg) << " quality " << q << endmsg; + ATH_MSG_VERBOSE(" bad segment " << m_edmPrinter->print(*seg) << " quality " << q); } ++nremovedBadSegments; continue; @@ -368,7 +365,7 @@ Muon::MooSegmentCombinationFinder::extractSegmentCollection( const MuonSegmentCo if( !m_segmentSelector->select( *seg, ignoreHoles, quality,useEta,usePhi ) ){ if( msgLvl(MSG::VERBOSE) ) { int q = m_segmentSelector->quality(*seg,ignoreHoles,useEta,usePhi); - msg(MSG::VERBOSE) << " bad segment " << m_edmPrinter->print(*seg) << " quality " << q << endmsg; + ATH_MSG_VERBOSE(" bad segment " << m_edmPrinter->print(*seg) << " quality " << q); } ++nremovedBadSegments; continue; @@ -384,8 +381,7 @@ Muon::MooSegmentCombinationFinder::extractSegmentCollection( const MuonSegmentCo RSMapIt rsit_end = segMap.end(); for( ;rsit!=rsit_end;++rsit){ - if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Working on new chamber layer with " << rsit->second->size() - << " segments" << std::endl; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("Working on new chamber layer with " << rsit->second->size() << " segments"); // sort segments according to the number of hits diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.cxx index abccc8091e2f410f6ac338b03d3041e537a3f68a..7daa8975122bb26ac6ad336c2eb48cd504a93d58 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.cxx @@ -1,16 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "NSWSectorRoadFinderAlg.h" + #include "TrkParameters/TrackParameters.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" - #include "MuonPattern/MuonPatternCombination.h" NSWSectorRoadFinderAlg::NSWSectorRoadFinderAlg(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool"), m_keysTgc("STGC_Measurements"), m_keyMM("MM_Measurements"), m_patternLocation("NSWPatternCombinations") @@ -20,17 +19,12 @@ NSWSectorRoadFinderAlg::NSWSectorRoadFinderAlg(const std::string& name, ISvcLoca declareProperty("PatternOutputLocation",m_patternLocation); } -NSWSectorRoadFinderAlg::~NSWSectorRoadFinderAlg() -{ - -} - StatusCode NSWSectorRoadFinderAlg::initialize() { - ATH_CHECK( m_idHelper.retrieve() ); - ATH_CHECK( m_keysTgc.initialize() ); - ATH_CHECK( m_keyMM.initialize() ); - ATH_CHECK( m_patternLocation.initialize() ); + ATH_CHECK(m_keysTgc.initialize()); + ATH_CHECK(m_keyMM.initialize()); + ATH_CHECK(m_patternLocation.initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -70,12 +64,3 @@ StatusCode NSWSectorRoadFinderAlg::execute() return StatusCode::SUCCESS; } // execute - - -StatusCode NSWSectorRoadFinderAlg::finalize() -{ - - return AthAlgorithm::finalize(); -} - - diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.h index 2eb74d0c6eb7b6d71e11d2b1c0fd228c6309b18a..9f35a88f1b262e6d478cdd814138ed87b6f19a55 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/NSWSectorRoadFinderAlg.h @@ -1,31 +1,30 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MOOSEGMENTFINDERS_NSWSECTORROADFINDERALG_H #define MOOSEGMENTFINDERS_NSWSECTORROADFINDERALG_H #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonPrepRawData/MMPrepDataContainer.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "MuonPrepRawData/MMPrepDataCollection.h" #include "MuonPrepRawData/sTgcPrepDataCollection.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonPattern/MuonPatternChamberIntersect.h" #include "MuonPattern/MuonPatternCombinationCollection.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class NSWSectorRoadFinderAlg : public AthAlgorithm { public: NSWSectorRoadFinderAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~NSWSectorRoadFinderAlg(); + virtual ~NSWSectorRoadFinderAlg()=default; virtual StatusCode initialize() override; virtual StatusCode execute() override; - virtual StatusCode finalize() override; private: @@ -39,26 +38,25 @@ class NSWSectorRoadFinderAlg : public AthAlgorithm for( ;it!=it_end; ++it ){ const Muon::MuonPrepDataCollection< PrdT >& col = **it; - if( m_idHelper->sector(col.identify()) != sector ) continue; + if( m_idHelperSvc->sector(col.identify()) != sector ) continue; if( col.empty() ) continue; if( ! col.front()->detectorElement() ) { ATH_MSG_WARNING("PrepData with out detector element pointer, skipping collection "); continue; } - ATH_MSG_VERBOSE(" chamber " << m_idHelper->toStringChamber(col.identify()) << " with hits " << col.size() ); + ATH_MSG_VERBOSE(" chamber " << m_idHelperSvc->toStringChamber(col.identify()) << " with hits " << col.size() ); std::vector< const Trk::PrepRawData* > rios; rios.insert(rios.end(), col.begin(), col.end()); chamberData.push_back( Muon::MuonPatternChamberIntersect( col.front()->detectorElement()->center(),col.front()->detectorElement()->normal(),rios ) ); } } - - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; /** storegate location of the MuonPrepDataContainer for all four technologies */ SG::ReadHandleKey<Muon::sTgcPrepDataContainer> m_keysTgc; SG::ReadHandleKey<Muon::MMPrepDataContainer> m_keyMM; SG::WriteHandleKey<MuonPatternCombinationCollection> m_patternLocation; - + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h index 9eec5e5e21d6d2e85135e6cc7635f19c4fcc3b02..e8bde81c391811e5c94bad303574da0926c570ef 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h @@ -1,41 +1,27 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -/////////////////////////////////////////////////////////////////// -// MuonCurvedSegmentCombiner.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONMUONCURVEDSEGMENTCOMBINER_H #define MUONMUONCURVEDSEGMENTCOMBINER_H -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/MsgStream.h" #include "MuonSegmentCombinerToolInterfaces/IMuonCurvedSegmentCombiner.h" #include "MuonSegmentMakerToolInterfaces/IMuonSegmentPairFittingTool.h" -#include "MuonEDM_AssociationObjects/MuonSegPatAssMap.h" - -#include <string> -#include <map> - +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonEDM_AssociationObjects/MuonSegPatAssMap.h" #include "MuonCurvedSegmentCombiner/MCSCSegmentInfo.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class Identifier; - -namespace MuonGM { - class MuonDetectorManager; -} +#include <string> +#include <map> +#include <set> namespace Muon { - - class MuonEDMPrinterTool; - /** @class MuonCurvedSegmentCombiner This is for the Doxygen-Documentation. @@ -52,13 +38,9 @@ namespace Muon public: MuonCurvedSegmentCombiner(const std::string&,const std::string&,const IInterface*); - /** default destructor */ - virtual ~MuonCurvedSegmentCombiner (); + virtual ~MuonCurvedSegmentCombiner()=default; - /** standard Athena-Algorithm method */ virtual StatusCode initialize(); - /** standard Athena-Algorithm method */ - virtual StatusCode finalize (); /** INSERT main method here.*/ std::unique_ptr<MuonSegmentCombinationCollection> combineSegments( const MuonSegmentCombinationCollection& mdtCombiColl, @@ -84,16 +66,11 @@ namespace Muon Muon::MCSCSegmentInfo segInfo( Muon::MuonSegment* seg ); - unsigned int missedHits( Muon::MuonSegment* segment ); - - + unsigned int missedHits( Muon::MuonSegment* segment ); private: - - // const Muon::MuonSegPatAssMap* m_assCscMap; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ToolHandle< MuonEDMPrinterTool> m_printer; bool m_debug; @@ -120,8 +97,6 @@ namespace Muon std::map<Muon::MuonSegment*, const MuonPatternCombination* > m_segAssoMap; std::set <Identifier> m_cscIdSet; - - }; } // end of namespace diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx index 59ce50dadefdece8f6d3d419e17f4dbe94fc6145..72fd9fa6ee63eaa8d4932b167fc55b7b8d33be84 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonCurvedSegmentCombiner/src/MuonCurvedSegmentCombiner.cxx @@ -1,50 +1,29 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -////////////////////////////////////////////////////////////////// -// MuonCurvedSegmentCombiner.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MuonCurvedSegmentCombiner/MuonCurvedSegmentCombiner.h" -#include <iostream> -#include <sstream> -#include <vector> - -#include "Identifier/Identifier.h" - #include "MuonSegment/MuonSegment.h" #include "MuonSegment/MuonSegmentCombination.h" #include "MuonSegment/MuonSegmentCombinationCollection.h" #include "MuonSegment/MuonSegmentQuality.h" #include "MuonPattern/MuonPatternCombination.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" - #include "TrkParameters/TrackParameters.h" - #include "TrkPrepRawData/PrepRawData.h" - #include "TrkEventPrimitives/FitQuality.h" +#include <iostream> +#include <sstream> +#include <vector> //================ Constructor ================================================= -Muon::MuonCurvedSegmentCombiner::MuonCurvedSegmentCombiner(const std::string& t, - const std::string& n, - const IInterface* p ) - : +Muon::MuonCurvedSegmentCombiner::MuonCurvedSegmentCombiner(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { @@ -57,10 +36,8 @@ Muon::MuonCurvedSegmentCombiner::MuonCurvedSegmentCombiner(const std::string& t, declareProperty("DoCosmics",m_doCosmics = false); - // ATLAS default use Csc segments // Cosmics default no do NOT use Csc segments - declareProperty( "UseCscSegments",m_useCscSegments = true ); declareProperty( "AddAll2DCscs",m_addAll2DCscs = true); @@ -79,42 +56,16 @@ Muon::MuonCurvedSegmentCombiner::MuonCurvedSegmentCombiner(const std::string& t, } -//================ Destructor ================================================= - -Muon::MuonCurvedSegmentCombiner::~MuonCurvedSegmentCombiner() - {} - - //================ Initialisation ================================================= StatusCode Muon::MuonCurvedSegmentCombiner::initialize() { - - StatusCode sc = AlgTool::initialize(); - if (sc.isFailure()) return sc; - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - sc = m_printer.retrieve(); - if (sc.isSuccess()){ - ATH_MSG_DEBUG("Retrieved " << m_printer ); - }else{ - ATH_MSG_FATAL("Could not get " << m_printer ); - return sc; - } - - ATH_MSG_INFO("initialize() successful in " << name() ); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_printer.retrieve()); + ATH_MSG_DEBUG("initialize() successful in " << name() ); return StatusCode::SUCCESS; } -//================ Finalisation ================================================= - -StatusCode Muon::MuonCurvedSegmentCombiner::finalize() -{ - StatusCode sc = AlgTool::finalize(); - return sc; -} - //============================================================================================ std::unique_ptr<MuonSegmentCombinationCollection> @@ -222,8 +173,8 @@ std::unique_ptr<MuonSegmentCombinationCollection> Muon::MuonCurvedSegmentCombine if(m_debug) std::cout << " Store Mdt segment " << si << " pointer " << segs[si].get() << " Rios " << segs[si]->numberOfContainedROTs() << std::endl; bool is_mdt=true; for (unsigned int ri=0;ri<segs[si]->numberOfContainedROTs(); ri++){ - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; - if (m_muonIdHelperTool->cscIdHelper().is_csc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} + if (m_idHelperSvc->isMdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; + if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} } if (is_mdt == false) continue; std::map<Muon::MuonSegment*, const MuonPatternCombination* >::iterator it = m_segAssoMap.find(segs[si].get()); @@ -407,8 +358,8 @@ std::unique_ptr<MuonSegmentCombinationCollection> Muon::MuonCurvedSegmentCombine if(m_debug) std::cout << " Store Mdt segment " << si << " pointer " << segs[si].get() << " Rios " << segs[si]->numberOfContainedROTs() << std::endl; bool is_mdt=true; for (unsigned int ri=0;ri<segs[si]->numberOfContainedROTs(); ri++){ - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; - if (m_muonIdHelperTool->cscIdHelper().is_csc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} + if (m_idHelperSvc->isMdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; + if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} } if (is_mdt == false)continue; @@ -433,8 +384,8 @@ std::unique_ptr<MuonSegmentCombinationCollection> Muon::MuonCurvedSegmentCombine if(m_debug) std::cout << " Store Mdt segment " << si << " pointer " << segs[si].get() << " Rios " << segs[si]->numberOfContainedROTs() << std::endl; bool is_mdt=true; for (unsigned int ri=0;ri<segs[si]->numberOfContainedROTs(); ri++){ - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; - if (m_muonIdHelperTool->cscIdHelper().is_csc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} + if (m_idHelperSvc->isMdt(segs[si]->rioOnTrack(ri)->identify()) == true) break; + if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify()) == true) {is_mdt = false; break;} } if (is_mdt == false)continue; std::map<Muon::MuonSegment*, const MuonPatternCombination* >::iterator it = m_segAssoMap.find(segs[si].get()); @@ -495,7 +446,7 @@ Muon::MuonCurvedSegmentCombiner::processCscCombinationCollection( const MuonSegm if(m_debug) std::cout << " Store Csc segment " << si << std::endl; bool is_csc = false; for (unsigned int ri=0;ri<segs[si]->numberOfContainedROTs(); ri++){ - if (m_muonIdHelperTool->cscIdHelper().is_csc(segs[si]->rioOnTrack(ri)->identify())) { + if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify())) { is_csc = true; m_cscIdSet.insert(segs[si]->rioOnTrack(ri)->identify()); if (m_debug) std::cout << " csc hits on 4d segment " << m_cscIdSet.size() << std::endl; @@ -545,7 +496,7 @@ Muon::MuonCurvedSegmentCombiner::process2DCscCombinationCollection( const MuonSe int ncsc = 0; int ncscmatched = 0; for (unsigned int ri=0;ri<segs[si]->numberOfContainedROTs(); ri++){ - if (m_muonIdHelperTool->cscIdHelper().is_csc(segs[si]->rioOnTrack(ri)->identify()) && ! m_muonIdHelperTool->cscIdHelper().measuresPhi(segs[si]->rioOnTrack(ri)->identify()) ) { + if (m_idHelperSvc->isCsc(segs[si]->rioOnTrack(ri)->identify()) && ! m_idHelperSvc->cscIdHelper().measuresPhi(segs[si]->rioOnTrack(ri)->identify()) ) { is_csc = true; ncsc++; if (m_cscIdSet.find(segs[si]->rioOnTrack(ri)->identify())!=m_cscIdSet.end()) ncscmatched++; @@ -1338,15 +1289,15 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ } if (rot) idr = rot->identify(); if (!rot) continue; - if(m_muonIdHelperTool->cscIdHelper().is_csc(idr)){ + if(m_idHelperSvc->isCsc(idr)){ id = idr; } - if(m_muonIdHelperTool->mdtIdHelper().is_mdt(idr)){ + if(m_idHelperSvc->isMdt(idr)){ const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(*mit); if( mdt ){ - int lay = m_muonIdHelperTool->mdtIdHelper().tubeLayer(mdt->identify()); - int tube = m_muonIdHelperTool->mdtIdHelper().tube(mdt->identify()); + int lay = m_idHelperSvc->mdtIdHelper().tubeLayer(mdt->identify()); + int tube = m_idHelperSvc->mdtIdHelper().tube(mdt->identify()); double tubelen = mdt->prepRawData()->detectorElement()->getActiveTubeLength(lay,tube); if( tubelen < shortestTube ){ mdtShortest = mdt; @@ -1371,15 +1322,15 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ ATH_MSG_WARNING(" shorest tube not set "); } - ATH_MSG_DEBUG(" new seg in " << m_muonIdHelperTool->mdtIdHelper().print_to_string(id)); + ATH_MSG_DEBUG(" new seg in " << m_idHelperSvc->mdtIdHelper().print_to_string(id)); // MDT or CSC segment info.nCsc = 0; info.nMissedHits = closeToChamberEdge ? 0 : missedHits(seg); - int stName = m_muonIdHelperTool->mdtIdHelper().stationName( id ); - name = m_muonIdHelperTool->mdtIdHelper().stationNameString( stName ); - int stEta = m_muonIdHelperTool->mdtIdHelper().stationEta( id ); - int stPhi = m_muonIdHelperTool->mdtIdHelper().stationPhi( id ); + int stName = m_idHelperSvc->mdtIdHelper().stationName( id ); + name = m_idHelperSvc->mdtIdHelper().stationNameString( stName ); + int stEta = m_idHelperSvc->mdtIdHelper().stationEta( id ); + int stPhi = m_idHelperSvc->mdtIdHelper().stationPhi( id ); code = stName*1000+100*stPhi+stEta; int nMult1 = 0; @@ -1396,23 +1347,23 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ if (rot) idr = rot->identify(); if (!rot) continue; - if(m_muonIdHelperTool->mdtIdHelper().is_mdt(idr)){ - if( m_muonIdHelperTool->mdtIdHelper().multilayer(idr) == 1 ) nMult1++; - if( m_muonIdHelperTool->mdtIdHelper().multilayer(idr) == 2 ) nMult2++; + if(m_idHelperSvc->isMdt(idr)){ + if( m_idHelperSvc->mdtIdHelper().multilayer(idr) == 1 ) nMult1++; + if( m_idHelperSvc->mdtIdHelper().multilayer(idr) == 2 ) nMult2++; nHots++; } int layerCode = 0; - if(m_muonIdHelperTool->rpcIdHelper().is_rpc(idr)){ - layerCode = 1000000*(m_muonIdHelperTool->rpcIdHelper().stationName(idr))+10000*(m_muonIdHelperTool->rpcIdHelper().stationPhi(idr))+ 100* ((m_muonIdHelperTool->rpcIdHelper().stationEta(idr))+10); - layerCode = layerCode + 2*((m_muonIdHelperTool->rpcIdHelper().doubletR(idr))-1)+16*((m_muonIdHelperTool->rpcIdHelper().gasGap(idr))-1); - if (m_muonIdHelperTool->rpcIdHelper().measuresPhi(idr)) layerCode += 100; + if(m_idHelperSvc->isRpc(idr)){ + layerCode = 1000000*(m_idHelperSvc->rpcIdHelper().stationName(idr))+10000*(m_idHelperSvc->rpcIdHelper().stationPhi(idr))+ 100* ((m_idHelperSvc->rpcIdHelper().stationEta(idr))+10); + layerCode = layerCode + 2*((m_idHelperSvc->rpcIdHelper().doubletR(idr))-1)+16*((m_idHelperSvc->rpcIdHelper().gasGap(idr))-1); + if (m_idHelperSvc->rpcIdHelper().measuresPhi(idr)) layerCode += 100; triggerLayers[layerCode] = 1; - ATH_MSG_DEBUG(" RPC hit phi" << m_muonIdHelperTool->rpcIdHelper().measuresPhi(idr) << " R " << m_muonIdHelperTool->rpcIdHelper().doubletR(idr) << " gas " << m_muonIdHelperTool->rpcIdHelper().gasGap(idr)); + ATH_MSG_DEBUG(" RPC hit phi" << m_idHelperSvc->rpcIdHelper().measuresPhi(idr) << " R " << m_idHelperSvc->rpcIdHelper().doubletR(idr) << " gas " << m_idHelperSvc->rpcIdHelper().gasGap(idr)); } - if (m_muonIdHelperTool->tgcIdHelper().is_tgc( idr )) { - layerCode = 1000000*(m_muonIdHelperTool->tgcIdHelper().stationName(idr))+10000*(m_muonIdHelperTool->tgcIdHelper().stationPhi(idr))+ 100* ((m_muonIdHelperTool->tgcIdHelper().stationEta(idr))+10); - layerCode = layerCode + m_muonIdHelperTool->tgcIdHelper().gasGap(idr); - if (m_muonIdHelperTool->tgcIdHelper().isStrip(idr)) layerCode += 100; + if (m_idHelperSvc->isTgc( idr )) { + layerCode = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(idr))+10000*(m_idHelperSvc->tgcIdHelper().stationPhi(idr))+ 100* ((m_idHelperSvc->tgcIdHelper().stationEta(idr))+10); + layerCode = layerCode + m_idHelperSvc->tgcIdHelper().gasGap(idr); + if (m_idHelperSvc->tgcIdHelper().isStrip(idr)) layerCode += 100; triggerLayers[layerCode] = 1; } } @@ -1466,12 +1417,12 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ info.nMult1 = nMult1; info.nMult2 = nMult2; - } else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { - ATH_MSG_DEBUG(" new seg in " << m_muonIdHelperTool->cscIdHelper().print_to_string(id)); + } else if (m_idHelperSvc->isCsc(id)) { + ATH_MSG_DEBUG(" new seg in " << m_idHelperSvc->cscIdHelper().print_to_string(id)); info.nCsc = 1; - int stName = m_muonIdHelperTool->cscIdHelper().stationName( id ); - name = m_muonIdHelperTool->cscIdHelper().stationNameString( stName ); - int steta = m_muonIdHelperTool->cscIdHelper().stationEta( id ); + int stName = m_idHelperSvc->cscIdHelper().stationName( id ); + name = m_idHelperSvc->cscIdHelper().stationNameString( stName ); + int steta = m_idHelperSvc->cscIdHelper().stationEta( id ); code = stName*1000+steta; mit = mbs.begin(); for (;mit!=mit_end;++mit) { @@ -1483,7 +1434,7 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ } if (rot) idr = rot->identify(); if (!rot) continue; - if(m_muonIdHelperTool->cscIdHelper().is_csc(idr)) { + if(m_idHelperSvc->isCsc(idr)) { nHots++; } } @@ -1512,7 +1463,6 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ patternMomentum = perigee->momentum().mag(); patternPhi = perigee->momentum().phi(); patternTheta = perigee->momentum().theta(); -// if (m_debug) std::cout << " Associated Pattern Momentum " << perigee->momentum().mag() << std::endl; } } // Count phi hits @@ -1522,14 +1472,13 @@ Muon::MuonCurvedSegmentCombiner::segInfo( Muon::MuonSegment* seg ){ for (; pit!=(*it).prepRawDataVec().end(); ++pit) { const Trk::PrepRawData* hit = *pit ; nall++; -// if (m_debug) std::cout << " Prep data on pattern " << std::endl; Identifier id = hit->identify() ; - if ( m_muonIdHelperTool->rpcIdHelper().is_rpc(id) ) { - if( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) ) nphi++; - } else if( m_muonIdHelperTool->tgcIdHelper().is_tgc(id) ) { - if( m_muonIdHelperTool->tgcIdHelper().isStrip(id) ) nphi++; - } else if( m_muonIdHelperTool->cscIdHelper().is_csc(id) ) { - if( m_muonIdHelperTool->cscIdHelper().measuresPhi(id) ) nphi++; + if ( m_idHelperSvc->isRpc(id) ) { + if( m_idHelperSvc->rpcIdHelper().measuresPhi(id) ) nphi++; + } else if( m_idHelperSvc->isTgc(id) ) { + if( m_idHelperSvc->tgcIdHelper().isStrip(id) ) nphi++; + } else if( m_idHelperSvc->isCsc(id) ) { + if( m_idHelperSvc->cscIdHelper().measuresPhi(id) ) nphi++; } } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx index 70c9370c945946f5b81e7e3dca35efd0efaefa5c..fff9b4f95a0b4ab37a7557d1f199aac7816ee9a9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx @@ -3,27 +3,23 @@ */ #include "Csc2dSegmentMaker.h" -#include <sstream> -#include <cmath> #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/CscReadoutElement.h" - #include "MuonPrepRawData/CscPrepDataContainer.h" #include "MuonPrepRawData/CscStripPrepDataContainer.h" - #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include "TrkEventPrimitives/FitQuality.h" #include "MuonSegment/MuonSegment.h" #include "MuonSegment/MuonSegmentCombinationCollection.h" - #include "TrkSegment/Segment.h" #include "TrkRoad/TrackRoad.h" #include "MuonCondInterface/ICSCConditionsSvc.h" +#include <sstream> +#include <cmath> + using Muon::CscPrepDataContainer; using Muon::CscPrepDataCollection; using Muon::CscPrepData; @@ -61,9 +57,8 @@ std::string chamber(int istation, int zsec, int phi) { //****************************************************************************** -Csc2dSegmentMaker:: -Csc2dSegmentMaker(const std::string& type, const std::string& aname, const IInterface* parent) - : AthAlgTool(type, aname, parent) +Csc2dSegmentMaker::Csc2dSegmentMaker(const std::string& type, const std::string& aname, const IInterface* parent) : + AthAlgTool(type, aname, parent) { declareInterface<ICscSegmentFinder>(this); } @@ -71,27 +66,14 @@ Csc2dSegmentMaker(const std::string& type, const std::string& aname, const IInte //****************************************************************************** StatusCode Csc2dSegmentMaker::initialize(){ - ATH_MSG_DEBUG ( "Initializing " << name() ); // Show keys. ATH_MSG_DEBUG ( " SegmentTool: " << m_segmentTool.typeAndName() ); ATH_MSG_DEBUG ( " Input cscdig key: " << m_cscdig_sg_inkey ); - ATH_CHECK(m_idHelperSvc.retrieve()); - - if ( m_segmentTool.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Unable to retrieve CscSegmentUtilTool " << m_segmentTool ); - return StatusCode::FAILURE; - } - if ( m_cscClusterOnTrackCreator.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Unable to retrieve " << m_cscClusterOnTrackCreator ); - return StatusCode::FAILURE; - } - if ( m_printer.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Unable to retrieve MuonEDMPrinterTool" << m_printer ); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_segmentTool.retrieve()); + ATH_CHECK(m_cscClusterOnTrackCreator.retrieve()); + ATH_CHECK(m_printer.retrieve()); return StatusCode::SUCCESS; } @@ -177,10 +159,8 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD for(int iStrip=0;iStrip<detEl->maxNumberOfStrips(iPhi);iStrip++){ ATH_MSG_DEBUG("get strip quality for "<<isPhi<<" layer "<<iLay<<" strip "<<iStrip); Identifier stripId=m_idHelperSvc->cscIdHelper().channelID(redName,stationEta,stationPhi,chamberLayer,iLay+1,iPhi,iStrip+1); - //ATH_MSG_DEBUG("just-constructed id corresponds to chamberLayer "<<m_idHelperSvc->cscIdHelper().chamberLayer(stripId)<<", wire layer "<<m_idHelperSvc->cscIdHelper().wireLayer(stripId)<<", strip "<<m_idHelperSvc->cscIdHelper().strip(stripId)); IdentifierHash hashID; m_idHelperSvc->cscIdHelper().get_channel_hash(stripId,hashID); - //ATH_MSG_DEBUG("get strip status with hash "<<hashID); if(!m_segmentTool->isGood(hashID)){ ATH_MSG_DEBUG("bad strip"); nbad++; @@ -270,7 +250,6 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD return pcol; } - //****************************************************************************** std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const MuonSegmentCombinationCollection& ) const @@ -278,12 +257,3 @@ std::unique_ptr<MuonSegmentCombinationCollection> Csc2dSegmentMaker::find( const return std::unique_ptr<MuonSegmentCombinationCollection>(); } - -//****************************************************************************** - -StatusCode Csc2dSegmentMaker::finalize() { - - ATH_MSG_DEBUG ( "Goodbye" ); - return StatusCode::SUCCESS; -} - diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h index 354a6047c1590bba7c4d90a3b1897888bb045cd3..ecd70880b40805a24373ea686386fc96da27bf1a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h @@ -12,43 +12,31 @@ // each chamber (with segments) and separate r and phi collections // for each combination. +#include "CscSegmentMakers/ICscSegmentFinder.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "CscSegmentMakers/ICscSegmentFinder.h" +#include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "CscSegmentMakers/ICscSegmentUtilTool.h" class Csc2dSegmentMaker : virtual public ICscSegmentFinder, public AthAlgTool { -public: // methods - - // Constructor. +public: Csc2dSegmentMaker(const std::string&, const std::string&, const IInterface*); - // Destructor. ~Csc2dSegmentMaker()=default; - // Initialization. StatusCode initialize(); - // Finalization. - StatusCode finalize(); - std::unique_ptr<MuonSegmentCombinationCollection> find( const std::vector<const Muon::CscPrepDataCollection*>& pcols) const; std::unique_ptr<MuonSegmentCombinationCollection> find( const MuonSegmentCombinationCollection& ) const; -private: // methods - +private: Muon::MuonSegmentCombination* findSegmentCombination( const Muon::CscPrepDataCollection& pcol ) const; - - -private: // data - // Output container. ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; Gaudi::Property<std::string> m_cscdig_sg_inkey{this, "scdig_sg_inkey", "CSC_Measurements"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx index bf9fc34e16a12b91862c59d43b18cdc1a2ccb98b..130c7e81aa4b1af7021e0716064af5c94b4f77f5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx @@ -1,14 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "DCMathSegmentMaker.h" -#include "GaudiKernel/MsgStream.h" #include "AthenaKernel/Timeout.h" - #include "TrkRIO_OnTrack/RIO_OnTrack.h" - #include "MuonSegment/MuonSegmentQuality.h" #include "TrkEventPrimitives/LocalDirection.h" #include "TrkEventPrimitives/DefinedParameter.h" @@ -17,16 +14,10 @@ #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/FitQuality.h" #include "TrkRoad/TrackRoad.h" - #include "TrkTrack/Track.h" - #include "TrkParameters/TrackParameters.h" - #include "TrkSurfaces/StraightLineSurface.h" #include "TrkSurfaces/PlaneSurface.h" - -#include "MuonSegmentMakerInterfaces/IDCSLFitProvider.h" - #include "TrkDriftCircleMath/SegmentFinder.h" #include "TrkDriftCircleMath/Road.h" #include "TrkDriftCircleMath/Segment.h" @@ -35,39 +26,21 @@ #include "TrkDriftCircleMath/ResidualWithSegment.h" #include "TrkDriftCircleMath/MdtStationId.h" #include "TrkDriftCircleMath/MdtMultiChamberGeometry.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMdtSegmentFinder.h" -#include "MuonRecToolInterfaces/IMuonSegmentFittingTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" - #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" #include "MuonPrepRawData/TgcPrepData.h" - #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" - -#include "MuonStationIntersectSvc/MuonStationIntersectSvc.h" #include "MuonStationIntersectSvc/MdtIntersectGeometry.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MdtIdHelper.h" - #include "EventPrimitives/EventPrimitivesHelpers.h" #include "EventPrimitives/EventPrimitivesToStringConverter.h" #include "GeoPrimitives/GeoPrimitivesToStringConverter.h" -#include <vector> #include <cassert> #include <iostream> #include <functional> @@ -81,7 +54,6 @@ namespace Muon { m_mdtCreatorT0("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", this), m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator", this), m_compClusterCreator("Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator", this), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_segmentFinder("Muon::MdtMathSegmentFinder/MdtMathSegmentFinder", this), m_segmentFitter("Muon::MuonSegmentFittingTool/MuonSegmentFittingTool", this), @@ -99,14 +71,11 @@ namespace Muon { declareProperty("MdtCreatorT0", m_mdtCreatorT0); declareProperty("MuonClusterCreator", m_clusterCreator); declareProperty("MuonCompetingClustersCreator", m_compClusterCreator); - declareProperty("IdHelper", m_idHelperTool); declareProperty("EDMPrinter", m_printer); declareProperty("MdtSegmentFinder", m_segmentFinder); declareProperty("SegmentFitter", m_segmentFitter); declareProperty("SegmentSelector", m_segmentSelectionTool); declareProperty("DCFitProvider", m_dcslFitProvider ); - - declareProperty("SinAngleCut",m_sinAngleCut = 0.2); declareProperty("DoGeometry",m_doGeometry = true); declareProperty("DoDebugSpacePoints",m_debugSpacePoints = false); @@ -129,27 +98,20 @@ namespace Muon { declareProperty("UpdatePhiUsingPhiHits",m_updatePhiUsingPhiHits = false ); declareProperty("AssumePointingPhi",m_assumePointingPhi = false ); declareProperty("Redo2DFit", m_redo2DFit = true ); - declareProperty("RpcPrepDataContainer", m_rpcKey); declareProperty("TgcPrepDataContainer", m_tgcKey); declareProperty("MdtPrepDataContainer", m_mdtKey); - - } - - DCMathSegmentMaker::~DCMathSegmentMaker() - { } StatusCode DCMathSegmentMaker::initialize() { - // retrieve MuonDetectorManager ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_intersectSvc.retrieve() ); ATH_CHECK( m_mdtCreator.retrieve() ); ATH_CHECK( m_mdtCreatorT0.retrieve() ); ATH_CHECK( m_compClusterCreator.retrieve() ); - ATH_CHECK( m_idHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_segmentFinder.retrieve() ); @@ -165,31 +127,15 @@ namespace Muon { } //initialise for data handles - - if(!m_rpcKey.initialize()){ - ATH_MSG_ERROR("Couldn't initalize RPC ReadHandleKey"); - return StatusCode::FAILURE; - } - if(!m_tgcKey.initialize()){ - ATH_MSG_ERROR("Couldn't initalize TGC ReadHandleKey"); - return StatusCode::FAILURE; - } - if(!m_mdtKey.initialize()){ - ATH_MSG_ERROR("Couldn't initalize MDT ReadHandleKey"); - return StatusCode::FAILURE; - } + ATH_CHECK(m_rpcKey.initialize()); + ATH_CHECK(m_tgcKey.initialize()); + ATH_CHECK(m_mdtKey.initialize()); if(!m_condKey.empty()) ATH_CHECK(m_condKey.initialize()); return StatusCode::SUCCESS; } - StatusCode DCMathSegmentMaker::finalize() - { - return StatusCode::SUCCESS; - } - - const MuonSegment* DCMathSegmentMaker::associateTriggerHits( const MuonSegment& seg, const std::vector<const MuonClusterOnTrack*>& clus, bool includeEtaHits ) const { @@ -210,7 +156,7 @@ namespace Muon { std::set<Identifier> chamberSet; for( std::vector<const MdtDriftCircleOnTrack*>::const_iterator it=mdts.begin();it!=mdts.end();++it){ Identifier dcid = (*it)->identify(); - Identifier elId = m_idHelperTool->mdtIdHelper().elementID( dcid ); + Identifier elId = m_idHelperSvc->mdtIdHelper().elementID( dcid ); chamberSet.insert(elId); } std::unique_ptr<TrkDriftCircleMath::MdtMultiChamberGeometry> multiGeo; @@ -247,7 +193,7 @@ namespace Muon { Identifier chid = firstRot->identify(); // endcap or barrel - bool isEndcap = m_idHelperTool->mdtIdHelper().isEndcap(chid); + bool isEndcap = m_idHelperSvc->mdtIdHelper().isEndcap(chid); // define axis of chamber in global coordinates Amg::Transform3D amdbToGlobal = seg.associatedSurface().transform(); @@ -295,13 +241,13 @@ namespace Muon { double dr = Amg::error(mdt->localCovariance(),Trk::locR); // create identifier - TrkDriftCircleMath::MdtId mdtid( m_idHelperTool->mdtIdHelper().isBarrel(id),m_idHelperTool->mdtIdHelper().multilayer(id)-1, - m_idHelperTool->mdtIdHelper().tubeLayer(id)-1, m_idHelperTool->mdtIdHelper().tube(id)-1 ); + TrkDriftCircleMath::MdtId mdtid( m_idHelperSvc->mdtIdHelper().isBarrel(id),m_idHelperSvc->mdtIdHelper().multilayer(id)-1, + m_idHelperSvc->mdtIdHelper().tubeLayer(id)-1, m_idHelperSvc->mdtIdHelper().tube(id)-1 ); // create new DriftCircle TrkDriftCircleMath::DriftCircle dc( lpos, r, dr, TrkDriftCircleMath::DriftCircle::InTime, mdtid, index, mdt ); TrkDriftCircleMath::DCOnTrack dcOnTrack(dc,1.,1.); - ATH_MSG_VERBOSE(" new MDT hit " << m_idHelperTool->toString( id ) << " x " << lpos.x() << " y " << lpos.y() ); + ATH_MSG_VERBOSE(" new MDT hit " << m_idHelperSvc->toString( id ) << " x " << lpos.x() << " y " << lpos.y() ); TubeEnds tubeEnds = localTubeEnds(*mdt,gToStation,amdbToGlobal); if( firstMdt ){ @@ -375,16 +321,16 @@ namespace Muon { continue; } const TgcPrepDataCollection& col = **colIt; - ATH_MSG_VERBOSE("Found collection: " << m_idHelperTool->toStringChamber(col.identify()) << " size " << col.size() ); + ATH_MSG_VERBOSE("Found collection: " << m_idHelperSvc->toStringChamber(col.identify()) << " size " << col.size() ); TgcPrepDataCollection::const_iterator hit = col.begin(); TgcPrepDataCollection::const_iterator hit_end = col.end(); for( ;hit!=hit_end;++hit ){ // skip phi hits - if( m_idHelperTool->measuresPhi((*hit)->identify()) ) continue; + if( m_idHelperSvc->measuresPhi((*hit)->identify()) ) continue; const MuonClusterOnTrack* clus = m_clusterCreator->createRIO_OnTrack(**hit,(*hit)->globalPosition()); if( clus ) { - ATH_MSG_VERBOSE(" adding hit: " << m_idHelperTool->toString(clus->identify()) ); + ATH_MSG_VERBOSE(" adding hit: " << m_idHelperSvc->toString(clus->identify()) ); clusters.push_back(clus); measurementsToBeDeleted.push_back(clus); } @@ -418,7 +364,7 @@ namespace Muon { RpcPrepDataCollection::const_iterator hit_end = col.end(); for( ;hit!=hit_end;++hit ){ // skip phi hits - if( m_idHelperTool->measuresPhi((*hit)->identify()) ) continue; + if( m_idHelperSvc->measuresPhi((*hit)->identify()) ) continue; const MuonClusterOnTrack* clus = m_clusterCreator->createRIO_OnTrack(**hit,(*hit)->globalPosition()); if( clus ) { clusters.push_back(clus); @@ -463,7 +409,7 @@ namespace Muon { Identifier chid = firstRot->identify(); // endcap or barrel - bool isEndcap = m_idHelperTool->mdtIdHelper().isEndcap(chid); + bool isEndcap = m_idHelperSvc->mdtIdHelper().isEndcap(chid); // global to local transformation for chamber Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform(); @@ -574,10 +520,10 @@ namespace Muon { const std::vector<const MdtDriftCircleOnTrack*>& mdts, bool hasPhiMeasurements, segmentCreationInfo& sInfo) const { - bool isEndcap = m_idHelperTool->isEndcap(chid); + bool isEndcap = m_idHelperSvc->isEndcap(chid); //find all curved segments bool isCurvedSegment(false); - MuonStationIndex::ChIndex chIndex = m_idHelperTool->chamberIndex(chid); + MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chid); //MuonStationIndex::ChIndex chIndex; if(segment.hasCurvatureParameters()) { @@ -626,13 +572,13 @@ namespace Muon { const MdtDriftCircleOnTrack* riodc = mdts[dcit->index()]; if( !riodc ) continue; - int lay = m_idHelperTool->mdtIdHelper().tubeLayer(riodc->identify()); - int tube = m_idHelperTool->mdtIdHelper().tube(riodc->identify()); + int lay = m_idHelperSvc->mdtIdHelper().tubeLayer(riodc->identify()); + int tube = m_idHelperSvc->mdtIdHelper().tube(riodc->identify()); double tubelen = 0.5*riodc->prepRawData()->detectorElement()->getActiveTubeLength(lay,tube); if( tubelen < shortestTubeLen ) shortestTubeLen = tubelen; } // if the predicted position lies outside the chamber move it back inside - if ( fabs(lxroad) > shortestTubeLen) { + if ( std::abs(lxroad) > shortestTubeLen) { ATH_MSG_DEBUG("coordinates far outside chamber! using global position of first hit "); if( lxroad < 0. ) shortestTubeLen *= -1.; lxroad = shortestTubeLen; @@ -677,9 +623,9 @@ namespace Muon { TrkDriftCircleMath::Segment result(TrkDriftCircleMath::Line(0.,0.,0.), TrkDriftCircleMath::DCOnTrackVec()); bool goodFit = defaultFitter.fit( result, line, segment.dcs(), hitSelector.selectHitsOnTrack(segment.dcs()) ); if( goodFit ){ - if( fabs(segment.line().phi() - result.line().phi()) > 0.01 || - fabs(segment.line().x0() - result.line().x0()) > 0.01 || - fabs(segment.line().y0() - result.line().y0()) > 0.01 ) { + if( std::abs(segment.line().phi() - result.line().phi()) > 0.01 || + std::abs(segment.line().x0() - result.line().x0()) > 0.01 || + std::abs(segment.line().y0() - result.line().y0()) > 0.01 ) { // update local position and global linephi = result.line().phi(); @@ -706,7 +652,7 @@ namespace Muon { // sanity checks double diff_phi = roaddir2.phi() - gdir.phi(); double diff_prec = linephi - segLocDir.angleYZ(); - if (fabs(sin(diff_phi)) > 1.e-3 || fabs(sin(diff_prec)) > 1.e-3 ) { + if (std::abs(sin(diff_phi)) > 1.e-3 || std::abs(sin(diff_prec)) > 1.e-3 ) { ATH_MSG_WARNING(" ALARM updated angles wrong: diff phi " << diff_phi << " prec " << diff_prec << " phi rdir " << roaddir2.phi() << " gdir " << gdir.phi() << " lphi " << linephi << " seg " << segLocDir.angleYZ() ); } @@ -803,15 +749,14 @@ namespace Muon { for( ;mit!=mit_end;++mit ){ const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*mit); if( rot ){ - msg(MSG::DEBUG) << m_idHelperTool->toString( rot->identify() ); + ATH_MSG_DEBUG(m_idHelperSvc->toString( rot->identify() )); const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(rot); - if( mdt ) msg() << std::setprecision(4) << " radius " << std::setw(6) << mdt->driftRadius() << " time " << std::setw(6) << mdt->driftTime(); - msg(MSG::DEBUG) << endmsg; + if( mdt ) ATH_MSG_DEBUG(std::setprecision(4) << " radius " << std::setw(6) << mdt->driftRadius() << " time " << std::setw(6) << mdt->driftTime()); continue; } const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(*mit); if( crot ){ - ATH_MSG_DEBUG(m_idHelperTool->toString( crot->rioOnTrack(0).identify() ) + ATH_MSG_DEBUG(m_idHelperSvc->toString( crot->rioOnTrack(0).identify() ) << " comp rot with hits " << crot->containedROTs().size()); continue; } @@ -859,7 +804,7 @@ namespace Muon { if(isCurvedSegment) {//curved segments if(qoverp == -99999.) { double charge = gpos.z()*tan(gdir.theta()); - charge = charge/fabs(charge); + charge = charge/std::abs(charge); //if the curved segment was not refit, then use a momentum estimate double BILALPHA(28.4366),BMLALPHA(62.8267),BMSALPHA(53.1259),BOLALPHA(29.7554); if(chIndex == MuonStationIndex::BIL) { @@ -913,11 +858,10 @@ namespace Muon { int segmentQuality = m_segmentSelectionTool->quality(*msegment); if( msgLvl(MSG::DEBUG) ) { - msg(MSG::DEBUG) << m_printer->print(*msegment) << " quality " << segmentQuality; - if( segmentQuality < 0 ) msg(MSG::DEBUG) << " BAD segment "; - if( hasFittedT0 ) msg(MSG::DEBUG) << " T0 " << fittedT0; - if( isCurvedSegment ) msg(MSG::DEBUG) << " Curved " << fittedT0; - msg(MSG::DEBUG) << endmsg; + ATH_MSG_DEBUG(m_printer->print(*msegment) << " quality " << segmentQuality); + if( segmentQuality < 0 ) ATH_MSG_DEBUG(" BAD segment "); + if( hasFittedT0 ) ATH_MSG_DEBUG(" T0 " << fittedT0); + if( isCurvedSegment ) ATH_MSG_DEBUG(" Curved " << fittedT0); } if( segmentQuality < 0 ){ delete msegment; @@ -940,13 +884,13 @@ namespace Muon { for( ; it!=it_end;++it ){ Identifier id = (*it)->identify(); - if( m_idHelperTool->mdtIdHelper().is_mdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(*it); if( !mdt ){ ATH_MSG_WARNING("failed dynamic_cast, not a MDT but hit has MDT id!!!"); } mdts.push_back(mdt); - }else if( m_idHelperTool->isTrigger(id) ){ + }else if( m_idHelperSvc->isTrigger(id) ){ const MuonClusterOnTrack* clus = dynamic_cast<const MuonClusterOnTrack*>(*it); if( !clus ){ ATH_MSG_WARNING("failed dynamic_cast, not a cluster but hit has RPC/TGC id!!!"); @@ -1043,7 +987,7 @@ namespace Muon { double phiScale = 1.; // rescale errors - int stRegion = m_idHelperTool->mdtIdHelper().stationRegion(id); + int stRegion = m_idHelperSvc->mdtIdHelper().stationRegion(id); if( stRegion == 0 ) phiScale = 2.; // inner else if( stRegion == 1 ) phiScale = 2.5; // extended else if( stRegion == 2 ) phiScale = 2.5; // middle @@ -1063,11 +1007,11 @@ namespace Muon { // simple division of MuonSpectrometer in regions using barrel/endcap seperation plus // inner/middle/outer seperation - bool isEndcap = m_idHelperTool->isEndcap(id); + bool isEndcap = m_idHelperSvc->isEndcap(id); if( isEndcap ){ - std::string stName = m_idHelperTool->mdtIdHelper().stationNameString(m_idHelperTool->mdtIdHelper().stationName(id) ); + std::string stName = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(id) ); if( stName[1] == 'I' ) return true; }else{ @@ -1095,8 +1039,8 @@ namespace Muon { ROTCit cit_end = clusters.end(); for( ;cit!=cit_end;++cit ){ Identifier id = (*cit)->identify(); - Identifier gasGapId = m_idHelperTool->gasGapId(id); - int measuresPhi = m_idHelperTool->measuresPhi(id); + Identifier gasGapId = m_idHelperSvc->gasGapId(id); + int measuresPhi = m_idHelperSvc->measuresPhi(id); if( measuresPhi ) { phiVec.push_back( createSpacePoint( gasGapId, 0, *cit ) ); @@ -1122,11 +1066,11 @@ namespace Muon { ROTCit cit_end = clusters.end(); for( ;cit!=cit_end;++cit ){ Identifier id = (*cit)->identify(); - ATH_MSG_VERBOSE(" new trigger hit " << m_idHelperTool->toString( id )); + ATH_MSG_VERBOSE(" new trigger hit " << m_idHelperSvc->toString( id )); - Identifier chId = m_idHelperTool->chamberId(id); - Identifier gasGapId = m_idHelperTool->gasGapId(id); - int measuresPhi = m_idHelperTool->measuresPhi(id); + Identifier chId = m_idHelperSvc->chamberId(id); + Identifier gasGapId = m_idHelperSvc->gasGapId(id); + int measuresPhi = m_idHelperSvc->measuresPhi(id); // eta hits first than phi hits if( !measuresPhi ) gasGapHitMap[chId][gasGapId].first.push_back(*cit); @@ -1138,7 +1082,7 @@ namespace Muon { void DCMathSegmentMaker::handleChamber( DCMathSegmentMaker::IdHitMap& gasGapHitMap ) const { - if( m_debugSpacePoints ) std::cout << " new chamber " << m_idHelperTool->toString( gasGapHitMap.begin()->first ) << std::endl; + if( m_debugSpacePoints ) std::cout << " new chamber " << m_idHelperSvc->toString( gasGapHitMap.begin()->first ) << std::endl; std::list<const Trk::PrepRawData*> prds; IdHitMapIt git = gasGapHitMap.begin(); @@ -1148,7 +1092,7 @@ namespace Muon { ROTCit hit_end = git->second.first.end(); for( ;hit!=hit_end;++hit ){ double lpos = (*hit)->localParameters()[Trk::locX]; - if( m_debugSpacePoints ) std::cout << " new eta hit " << lpos << " " << m_idHelperTool->toString( (*hit)->identify() ) << std::endl; + if( m_debugSpacePoints ) std::cout << " new eta hit " << lpos << " " << m_idHelperSvc->toString( (*hit)->identify() ) << std::endl; prds.push_back( (*hit)->prepRawData() ); } } @@ -1166,7 +1110,7 @@ namespace Muon { ROTCit hit_end = git->second.second.end(); for( ;hit!=hit_end;++hit ){ double lpos = (*hit)->localParameters()[Trk::locX]; - if( m_debugSpacePoints ) std::cout << " new phi hit " << lpos << " " << m_idHelperTool->toString( (*hit)->identify() ) << std::endl; + if( m_debugSpacePoints ) std::cout << " new phi hit " << lpos << " " << m_idHelperSvc->toString( (*hit)->identify() ) << std::endl; prds.push_back( (*hit)->prepRawData() ); } } @@ -1205,7 +1149,7 @@ namespace Muon { ClusterVec spacePoints; ClusterVec phiVec; - bool isEndcap=m_idHelperTool->isEndcap((*(gasGapHitMap.begin())).first); + bool isEndcap=m_idHelperSvc->isEndcap((*(gasGapHitMap.begin())).first); ATH_MSG_VERBOSE(" creating Space points for " << gasGapHitMap.size() << " gas gaps "); @@ -1219,7 +1163,7 @@ namespace Muon { // store Identifier of previous hit to remove duplicates Identifier prevEtaId; - if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" New gasgap " << m_idHelperTool->toString(git->first) + if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" New gasgap " << m_idHelperSvc->toString(git->first) << " neta " << git->second.first.size() << " nphi " << git->second.second.size()); @@ -1231,7 +1175,7 @@ namespace Muon { if( (*etaIt)->identify() == prevEtaId ) continue; prevEtaId = (*etaIt)->identify(); - if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" Eta hit " << m_idHelperTool->toString((*etaIt)->identify())); + if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" Eta hit " << m_idHelperSvc->toString((*etaIt)->identify())); if( isEndcap ) { @@ -1247,7 +1191,7 @@ namespace Muon { if( (*phiIt)->identify() == prevPhiId ) continue; prevPhiId = (*phiIt)->identify(); - if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" Phi hit " << m_idHelperTool->toString((*phiIt)->identify())); + if( m_debugSpacePoints ) ATH_MSG_VERBOSE(" Phi hit " << m_idHelperSvc->toString((*phiIt)->identify())); Cluster2D sp = createTgcSpacePoint( git->first, *etaIt, *phiIt ); if( sp.corrupt() ) continue; @@ -1307,7 +1251,7 @@ namespace Muon { DCMathSegmentMaker::Cluster2D DCMathSegmentMaker::createSpacePoint( const Identifier& gasGapId, const MuonClusterOnTrack* etaHit, const MuonClusterOnTrack* phiHit ) const { - bool isEndcap=m_idHelperTool->isEndcap(gasGapId); + bool isEndcap=m_idHelperSvc->isEndcap(gasGapId); double error(1.); double lpx(0.); double lpy(0.); @@ -1327,9 +1271,9 @@ namespace Muon { return createRpcSpacePoint( gasGapId,etaHit,phiVec ); } } - Identifier detElId = m_idHelperTool->detElId(gasGapId); - if( fabs(error) < 0.001 ){ - ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperTool->toString(gasGapId)); + Identifier detElId = m_idHelperSvc->detElId(gasGapId); + if( std::abs(error) < 0.001 ){ + ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperSvc->toString(gasGapId)); error = 0.; } return Cluster2D(detElId,gasGapId,Amg::Vector2D(lpx,lpy),error,etaHit,phiHit); @@ -1342,7 +1286,7 @@ namespace Muon { double error(1.); double lpx(0.); double lpy(0.); - Identifier detElId = m_idHelperTool->detElId(gasGapId); + Identifier detElId = m_idHelperSvc->detElId(gasGapId); // case one hit missing. Take position and error of the available hit if( !etaHit ){ lpx = phiHit->localParameters()[Trk::locX]; @@ -1355,8 +1299,8 @@ namespace Muon { // get orientation angle of strip to rotate back from local frame to strip // copy code from ROT creator - int stripNo = m_idHelperTool->tgcIdHelper().channel(phiHit->identify()); - int gasGap = m_idHelperTool->tgcIdHelper().gasGap(phiHit->identify()); + int stripNo = m_idHelperSvc->tgcIdHelper().channel(phiHit->identify()); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(phiHit->identify()); const MuonGM::TgcReadoutElement* detEl = dynamic_cast<const MuonGM::TgcReadoutElement*>(etaHit->detectorElement()); if (!detEl) { @@ -1378,9 +1322,8 @@ namespace Muon { lpx = etaHit->localParameters()[Trk::locX]; error = Amg::error(etaHit->localCovariance(),Trk::locX); if( error == 0. ){ - msg(MSG::WARNING) << " Unphysical error assigned for " << m_idHelperTool->toString(etaHit->identify()); - if( etaHit->prepRawData() ) msg(MSG::WARNING) << " PRD error " << Amg::error(etaHit->prepRawData()->localCovariance(),Trk::locX); - msg(MSG::WARNING) << endmsg; + ATH_MSG_WARNING(" Unphysical error assigned for " << m_idHelperSvc->toString(etaHit->identify())); + if( etaHit->prepRawData() ) ATH_MSG_WARNING(" PRD error " << Amg::error(etaHit->prepRawData()->localCovariance(),Trk::locX)); } Amg::Vector2D lspPos(0.,0.); if( etaHit->associatedSurface().globalToLocal( gposSp, gposSp,lspPos ) ){ @@ -1390,12 +1333,12 @@ namespace Muon { } if( m_debugSpacePoints ) std::cout << " TGC space point: error " << error << " stripWith " << error*sqrt(12) << std::endl - << " " << m_idHelperTool->toString( etaHit->identify() ) << std::endl - << " " << m_idHelperTool->toString( phiHit->identify() ) << std::endl; + << " " << m_idHelperSvc->toString( etaHit->identify() ) << std::endl + << " " << m_idHelperSvc->toString( phiHit->identify() ) << std::endl; } - if( fabs(error) < 0.001 ){ - ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperTool->toString(gasGapId)); + if( std::abs(error) < 0.001 ){ + ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperSvc->toString(gasGapId)); error = 1.; } return Cluster2D(detElId,gasGapId,Amg::Vector2D(lpx,lpy),error,etaHit,phiHit); @@ -1435,7 +1378,7 @@ namespace Muon { lpx = etaHit->localParameters()[Trk::locX]; error = Amg::error(etaHit->localCovariance(),Trk::locX); if( m_debugSpacePoints ) std::cout << " RPC space point: error " << error << " stripWith " << error*sqrt(12) << std::endl - << " " << m_idHelperTool->toString( etaHit->identify() ) << std::endl; + << " " << m_idHelperSvc->toString( etaHit->identify() ) << std::endl; double minPos = 1e9; double maxPos = -1e9; @@ -1456,7 +1399,7 @@ namespace Muon { lpy = phiLocPos[Trk::locY]; if( lpy < minPos ) minPos = lpy; if( lpy > maxPos ) maxPos = lpy; - if( m_debugSpacePoints ) std::cout << " " << m_idHelperTool->toString( (*pit)->identify() ) << std::endl; + if( m_debugSpacePoints ) std::cout << " " << m_idHelperSvc->toString( (*pit)->identify() ) << std::endl; cleanPhihits.push_back(*pit); } } @@ -1465,9 +1408,9 @@ namespace Muon { }else{ ATH_MSG_DEBUG(" ARRRGGG got two empty pointers!!! "); } - Identifier detElId = m_idHelperTool->detElId(gasGapId); - if( fabs(error) < 0.001 ){ - ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperTool->toString(gasGapId)); + Identifier detElId = m_idHelperSvc->detElId(gasGapId); + if( std::abs(error) < 0.001 ){ + ATH_MSG_WARNING(" Unphysical error assigned for gasgap " << m_idHelperSvc->toString(gasGapId)); error = 1.; } return Cluster2D(detElId,gasGapId,Amg::Vector2D(lpx,lpy),error,etaHit, !cleanPhihits.empty() ? cleanPhihits : phiHits ); @@ -1478,7 +1421,7 @@ namespace Muon { TrkDriftCircleMath::CLVec cls; - int chPhi = m_idHelperTool->mdtIdHelper().stationPhi(chid); + int chPhi = m_idHelperSvc->mdtIdHelper().stationPhi(chid); // loop over clusters ClusterIt cit=spVec.begin(); @@ -1490,14 +1433,14 @@ namespace Muon { const MuonClusterOnTrack* meas = cit->etaHit ? cit->etaHit : cit->phiHit; // construct cluster id Identifier id = meas->identify(); - int measuresPhi = m_idHelperTool->measuresPhi(id); - int eta = m_idHelperTool->stationEta(id); - int phi = m_idHelperTool->stationPhi(id); - int isTgc = m_idHelperTool->isTgc(id); - int name = isTgc ? m_idHelperTool->tgcIdHelper().stationName(id) : m_idHelperTool->rpcIdHelper().stationName(id); + int measuresPhi = m_idHelperSvc->measuresPhi(id); + int eta = m_idHelperSvc->stationEta(id); + int phi = m_idHelperSvc->stationPhi(id); + int isTgc = m_idHelperSvc->isTgc(id); + int name = isTgc ? m_idHelperSvc->tgcIdHelper().stationName(id) : m_idHelperSvc->rpcIdHelper().stationName(id); if( !isTgc ){ if( chPhi != phi ){ - ATH_MSG_VERBOSE(" Discarding cluster, wrong station phi " << m_idHelperTool->toString(id)); + ATH_MSG_VERBOSE(" Discarding cluster, wrong station phi " << m_idHelperSvc->toString(id)); ++index; continue; } @@ -1508,12 +1451,12 @@ namespace Muon { Amg::Vector3D locPos = gToStation*cit->globalPos; TrkDriftCircleMath::LocPos lp(locPos.y(),locPos.z()); - if( fabs(lp.y()) > m_maxAssociateClusterDistance ) { - ATH_MSG_VERBOSE(" Discarding cluster with large distance from chamber " << m_idHelperTool->toString(id)); + if( std::abs(lp.y()) > m_maxAssociateClusterDistance ) { + ATH_MSG_VERBOSE(" Discarding cluster with large distance from chamber " << m_idHelperSvc->toString(id)); ++index; continue; } - ATH_MSG_VERBOSE(" " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE(" " << m_idHelperSvc->toString(id) << " clid: " << clid.id() << " central phi " << meas->detectorElement()->center().phi() << " index " << index); double err = cit->error; TrkDriftCircleMath::Cluster cl( lp, err, clid, index ); @@ -1557,7 +1500,7 @@ namespace Muon { } Identifier id = (*it)->identify(); - Identifier elId = m_idHelperTool->mdtIdHelper().elementID( id ); + Identifier elId = m_idHelperSvc->mdtIdHelper().elementID( id ); // calculate local AMDB position @@ -1568,13 +1511,13 @@ namespace Muon { double dr = Amg::error(rot->localCovariance(),Trk::locR)*errorScale; // create identifier - TrkDriftCircleMath::MdtId mdtid( m_idHelperTool->mdtIdHelper().isBarrel(id),m_idHelperTool->mdtIdHelper().multilayer(id)-1, - m_idHelperTool->mdtIdHelper().tubeLayer(id)-1, m_idHelperTool->mdtIdHelper().tube(id)-1 ); + TrkDriftCircleMath::MdtId mdtid( m_idHelperSvc->mdtIdHelper().isBarrel(id),m_idHelperSvc->mdtIdHelper().multilayer(id)-1, + m_idHelperSvc->mdtIdHelper().tubeLayer(id)-1, m_idHelperSvc->mdtIdHelper().tube(id)-1 ); // double preciseError = dr; if( m_usePreciseError ) { - preciseError = m_preciseErrorScale*(0.23*exp(-fabs(r)/6.06)+0.0362); + preciseError = m_preciseErrorScale*(0.23*std::exp(-std::abs(r)/6.06)+0.0362); } // create new DriftCircle TrkDriftCircleMath::DriftCircle dc( lpos, r, dr, preciseError, TrkDriftCircleMath::DriftCircle::InTime, mdtid, index, rot ); @@ -1591,10 +1534,9 @@ namespace Muon { } if( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << " new MDT hit " << m_idHelperTool->toString( id ) << " x " << lpos.x() << " y " << lpos.y() - << " time " << rot->driftTime() << " r " << r << " dr " << dr << " phi range " << tubeEnds.phimin << " " << tubeEnds.phimax; - if( m_usePreciseError ) msg(MSG::VERBOSE) << " dr(2) " << preciseError << endmsg; - else msg(MSG::VERBOSE) << endmsg; + ATH_MSG_VERBOSE(" new MDT hit " << m_idHelperSvc->toString( id ) << " x " << lpos.x() << " y " << lpos.y() + << " time " << rot->driftTime() << " r " << r << " dr " << dr << " phi range " << tubeEnds.phimin << " " << tubeEnds.phimax); + if( m_usePreciseError ) ATH_MSG_VERBOSE(" dr(2) " << preciseError); } dcs.push_back( dc ); @@ -1628,11 +1570,11 @@ namespace Muon { Amg::Vector3D firstTubeMl1(0., 0., 0.); // get id - int eta = m_idHelperTool->mdtIdHelper().stationEta(chid); - int phi = m_idHelperTool->mdtIdHelper().stationPhi(chid); - int name = m_idHelperTool->mdtIdHelper().stationName(chid); - int isBarrel = m_idHelperTool->mdtIdHelper().isBarrel(chid); - int isSmallMdt = m_idHelperTool->mdtIdHelper().isSmallMdt(chid); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(chid); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(chid); + int name = m_idHelperSvc->mdtIdHelper().stationName(chid); + int isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel(chid); + int isSmallMdt = m_idHelperSvc->mdtIdHelper().isSmallMdt(chid); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi ); SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; @@ -1643,7 +1585,7 @@ namespace Muon { } // get detEL for first ml (always there) - const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement( m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,1,1 ) ); + const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,1,1 ) ); const MuonGM::MdtReadoutElement* detEl2 = 0; int ntube2 = 0; // number of multilayers in chamber @@ -1651,7 +1593,7 @@ namespace Muon { // treament of chambers with two ml if( nml == 2 ){ - Identifier firstIdml1 = m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,2,1,1 ); + Identifier firstIdml1 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,2,1,1 ); detEl2 = MuonDetMgr->getMdtReadoutElement( firstIdml1 ); firstTubeMl1 = gToStation*(detEl2->surface( firstIdml1 ).center()); ntube2 = detEl2->getNtubesperlayer(); @@ -1662,18 +1604,18 @@ namespace Muon { int ntube1 = detEl1->getNtubesperlayer(); // position first tube in ml 0 - Identifier firstIdml0 = m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,1,1 ); + Identifier firstIdml0 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,1,1 ); firstTubeMl0 = gToStation*(detEl1->surface( firstIdml0 ).center()); // position second tube in ml 0 - Identifier secondIdml0 = m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,1,2 ); + Identifier secondIdml0 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,1,2 ); Amg::Vector3D secondTubeMl0 = gToStation*(detEl1->surface( secondIdml0 ).center()); TrkDriftCircleMath::LocPos firstTube0( firstTubeMl0.y(), firstTubeMl0.z() ); TrkDriftCircleMath::LocPos firstTube1( firstTubeMl1.y(), firstTubeMl1.z() ); // position first tube ml 0 and 1 - Identifier firstIdml0lay1 = m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,2,1 ); + Identifier firstIdml0lay1 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,2,1 ); Amg::Vector3D firstTubeMl0lay1 = gToStation*(detEl1->surface( firstIdml0lay1 ).center()); @@ -1740,7 +1682,7 @@ namespace Muon { //choose which line to use (ml1 or ml2) TrkDriftCircleMath::TransformToLine toLine = toLineml1; - if(m_idHelperTool->mdtIdHelper().multilayer(riodc->identify()) == 2) toLine = toLineml2; + if(m_idHelperSvc->mdtIdHelper().multilayer(riodc->identify()) == 2) toLine = toLineml2; // calculate position of hit in line frame TrkDriftCircleMath::LocPos pointOnHit = toLine.toLine( dcit->position() ); @@ -1791,7 +1733,7 @@ namespace Muon { // update the drift radius after recalibration, keep error MdtDriftCircleOnTrack *new_drift_circle=new MdtDriftCircleOnTrack(*nonconstDC); measurementsToBeDeleted.push_back(new_drift_circle); - TrkDriftCircleMath::DriftCircle new_dc(dcit->position(), fabs(nonconstDC->driftRadius()), dcit->dr(), dcit->drPrecise(), + TrkDriftCircleMath::DriftCircle new_dc(dcit->position(), std::abs(nonconstDC->driftRadius()), dcit->dr(), dcit->drPrecise(), static_cast<TrkDriftCircleMath::DriftCircle *>(&(*dcit))->state() , dcit->id(), dcit->index(),new_drift_circle); TrkDriftCircleMath::DCOnTrack new_dc_on_track(new_dc, dcit->residual(), dcit->errorTrack()); @@ -1803,7 +1745,7 @@ namespace Muon { ATH_MSG_VERBOSE(" t0 shift " << segment.t0Shift() << " from hit " << shift << " recal " << nonconstDC->driftRadius() << " t " << nonconstDC->driftTime() << " from fit " << dcit->r() << " old " << riodc->driftRadius() << " t " << riodc->driftTime()); - if( fabs( fabs(nonconstDC->driftRadius()) - fabs(dcit->r()) ) > 0.1 && nonconstDC->driftRadius() < 19. && nonconstDC->driftRadius() > 1. ) { + if( std::abs( std::abs(nonconstDC->driftRadius()) - std::abs(dcit->r()) ) > 0.1 && nonconstDC->driftRadius() < 19. && nonconstDC->driftRadius() > 1. ) { ATH_MSG_WARNING("Detected invalid recalibration after T0 shift"); } } @@ -1830,7 +1772,7 @@ namespace Muon { id = spacePoint.phiHit->identify(); }else sout << " UNKNOWN TYPE "; sout << " residual " << std::setw(5) << std::setprecision(3) << resPull.first << " pull " << std::setw(6) << resPull.second - << " " << m_idHelperTool->toString( id ); + << " " << m_idHelperSvc->toString( id ); return sout.str(); } @@ -1857,7 +1799,7 @@ namespace Muon { struct SortClByPull { bool operator()(const std::pair<double,DCMathSegmentMaker::Cluster2D>& d1, const std::pair<double,DCMathSegmentMaker::Cluster2D>& d2 ){ - return fabs(d1.first) < fabs(d2.first); + return std::abs(d1.first) < std::abs(d2.first); } }; @@ -1870,7 +1812,7 @@ namespace Muon { typedef std::vector<ChamberData> ChamberDataVec; typedef ChamberDataVec::iterator ChamberDataIt; ChamberDataVec chamberDataVec; - bool isEndcap=m_idHelperTool->isEndcap(chid); + bool isEndcap=m_idHelperSvc->isEndcap(chid); // keep track of the number of eta/phi hits on the segment bool refit = false; @@ -1900,8 +1842,8 @@ namespace Muon { continue; } // reject TGC clusters that are not 2D - if( m_reject1DTgcSpacePoints && !spacePoint.is2D() && m_idHelperTool->isTgc(spacePoint.identify()) ) { - ATH_MSG_DEBUG(" Rejecting 1D tgc space point " << m_idHelperTool->toString(spacePoint.identify())); + if( m_reject1DTgcSpacePoints && !spacePoint.is2D() && m_idHelperSvc->isTgc(spacePoint.identify()) ) { + ATH_MSG_DEBUG(" Rejecting 1D tgc space point " << m_idHelperSvc->toString(spacePoint.identify())); continue; } if( m_assumePointingPhi && spacePoint.is2D() && !checkPhiConsistency(spacePoint.globalPos.phi(), phimin, phimax) ){ @@ -1916,7 +1858,7 @@ namespace Muon { if( chamberDataVec.empty() || chamberDataVec.back().id != spacePoint.detElId ){ detElOnSegments.insert(spacePoint.detElId); chamberDataVec.push_back( ChamberData(spacePoint.detElId) ); - MuonStationIndex::PhiIndex phiIndex = m_idHelperTool->phiIndex(spacePoint.detElId); + MuonStationIndex::PhiIndex phiIndex = m_idHelperSvc->phiIndex(spacePoint.detElId); phiIndices.insert(phiIndex); } @@ -1959,19 +1901,19 @@ namespace Muon { std::sort(git->data.begin(),git->data.end(),SortClByPull()); // select all space points with a pull that is within 1 of the best pull - double bestPull = fabs(git->data.front().first); + double bestPull = std::abs(git->data.front().first); // count number of associated clusters in gas gap unsigned int nassociatedSp = 0; - GasGapData::EntryIt clit = git->data.begin(); - while( clit != git->data.end() && fabs(clit->first) - bestPull < 1. ){ + GasGapData::EntryIt cl_it = git->data.begin(); + while( cl_it != git->data.end() && std::abs(cl_it->first) - bestPull < 1. ){ - Cluster2D& sp = clit->second; + Cluster2D& sp = cl_it->second; // calculate distance to segment double dist = distanceToSegment( segment, sp.globalPos, gToStation ); - ATH_MSG_VERBOSE(" selected space point: " << m_idHelperTool->toString( sp.identify() ) - << " pull " << fabs(clit->first) << " distance to segment " << dist << " phi " << sp.globalPos.phi()); + ATH_MSG_VERBOSE(" selected space point: " << m_idHelperSvc->toString( sp.identify() ) + << " pull " << std::abs(cl_it->first) << " distance to segment " << dist << " phi " << sp.globalPos.phi()); // here keep open the option not to create CompetingMuonClustersOnTrack if( sp.etaHit ){ @@ -2000,7 +1942,7 @@ namespace Muon { phiHits.push_back(*pit); // calculate position - double phiPos = isEndcap ? fabs( (*pit)->globalPosition().z() ) : fabs( (*pit)->globalPosition().perp() ); + double phiPos = isEndcap ? std::abs( (*pit)->globalPosition().z() ) : std::abs( (*pit)->globalPosition().perp() ); if( phiPos < posFirstPhiStation ) posFirstPhiStation = phiPos; if( phiPos > posLastPhiStation ) posLastPhiStation = phiPos; } @@ -2008,7 +1950,7 @@ namespace Muon { } } ++nassociatedSp; - ++clit; + ++cl_it; } // multiple clusters in same gas gap, don't refit if( !m_createCompetingROTsPhi && nassociatedSp > 1 ) refit = false; @@ -2026,9 +1968,9 @@ namespace Muon { ++netaPhiHits.first.first; if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " selected cluster: " << m_idHelperTool->toString( etaClusterVec.front()->identify() ) << endmsg; + ATH_MSG_VERBOSE(" selected cluster: " << m_idHelperSvc->toString( etaClusterVec.front()->identify() )); for( unsigned int i=0;i<etaCompCluster->containedROTs().size();++i){ - msg(MSG::VERBOSE) << " content: " << m_idHelperTool->toString( etaCompCluster->containedROTs()[i]->identify() ) << endmsg; + ATH_MSG_VERBOSE(" content: " << m_idHelperSvc->toString( etaCompCluster->containedROTs()[i]->identify() )); } } } @@ -2048,14 +1990,14 @@ namespace Muon { ++netaPhiHits.first.second; if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " selected cluster: " << m_idHelperTool->toString( phiClusterVec.front()->identify() ) << endmsg; + ATH_MSG_VERBOSE(" selected cluster: " << m_idHelperSvc->toString( phiClusterVec.front()->identify() )); for( unsigned int i=0;i<phiCompCluster->containedROTs().size();++i){ - msg(MSG::VERBOSE) << " content: " << m_idHelperTool->toString( phiCompCluster->containedROTs()[i]->identify() ) <<endmsg; + ATH_MSG_VERBOSE(" content: " << m_idHelperSvc->toString( phiCompCluster->containedROTs()[i]->identify() )); } } // calculate position - double phiPos = isEndcap ? fabs( phiCompCluster->globalPosition().z() ) : fabs( phiCompCluster->globalPosition().perp() ); + double phiPos = isEndcap ? std::abs( phiCompCluster->globalPosition().z() ) : std::abs( phiCompCluster->globalPosition().perp() ); if( phiPos < posFirstPhiStation ) posFirstPhiStation = phiPos; if( phiPos > posLastPhiStation ) posLastPhiStation = phiPos; } @@ -2099,7 +2041,7 @@ namespace Muon { // skip clusters in detector elements that are already associated (ok as this is only done for RPC) if( detElOnSegments.count(spit->detElId) ) continue; - MuonStationIndex::PhiIndex phiIndex = m_idHelperTool->phiIndex(spit->detElId); + MuonStationIndex::PhiIndex phiIndex = m_idHelperSvc->phiIndex(spit->detElId); // skip clusters in detector layer if( phiIndices.count(phiIndex) ) continue; @@ -2136,7 +2078,7 @@ namespace Muon { // check that detector element is not already added to segment if( detElOnSegments.count(detElId) ) continue; - MuonStationIndex::PhiIndex phiIndex = m_idHelperTool->phiIndex(detElId); + MuonStationIndex::PhiIndex phiIndex = m_idHelperSvc->phiIndex(detElId); // skip clusters in detector layer if( phiIndices.count(phiIndex) ) continue; @@ -2155,13 +2097,13 @@ namespace Muon { // perform bound check double stripLength = detEl->StripLength(1); - bool inBounds = fabs(residual) < 0.5*stripLength + 2. + segError ? true : false; + bool inBounds = std::abs(residual) < 0.5*stripLength + 2. + segError ? true : false; if( msgLvl(MSG::DEBUG) ) { - msg(MSG::DEBUG) << " Unassociated " << m_idHelperTool->toString((*cit)->phiHit->identify()) + ATH_MSG_DEBUG(" Unassociated " << m_idHelperSvc->toString((*cit)->phiHit->identify()) << " pos x " << cl.position().x() << " pos y " << cl.position().y() - << " : residual " << residual << " strip half length " << 0.5*stripLength << " segment error " << segError; - if( inBounds ) msg(MSG::DEBUG) << " inBounds" << endmsg; - else msg(MSG::DEBUG) << " outBounds" << endmsg; + << " : residual " << residual << " strip half length " << 0.5*stripLength << " segment error " << segError); + if( inBounds ) ATH_MSG_DEBUG(" inBounds"); + else ATH_MSG_DEBUG(" outBounds"); } if( inBounds ){ // can have multiple phi hits per cluster, loop over phi hits and add them @@ -2179,7 +2121,7 @@ namespace Muon { std::list<const Trk::PrepRawData*>& prds = chit->second; if( prds.empty() ) { - ATH_MSG_WARNING(" chamber without phi hits " << m_idHelperTool->toString(chit->first)); + ATH_MSG_WARNING(" chamber without phi hits " << m_idHelperSvc->toString(chit->first)); continue; } @@ -2189,9 +2131,9 @@ namespace Muon { }else{ double dist = distanceToSegment( segment, phiCompCluster->globalPosition(), gToStation ); - if( fabs(dist) > m_maxAssociateClusterDistance ){ + if( std::abs(dist) > m_maxAssociateClusterDistance ){ delete phiCompCluster; - ATH_MSG_VERBOSE(" rejected unassociated cluster: " << m_idHelperTool->toString( prds.front()->identify() ) << " distance to segment " << dist); + ATH_MSG_VERBOSE(" rejected unassociated cluster: " << m_idHelperSvc->toString( prds.front()->identify() ) << " distance to segment " << dist); continue; } rioDistVec.push_back( std::make_pair(dist,phiCompCluster) ); @@ -2199,9 +2141,9 @@ namespace Muon { ++netaPhiHits.first.second; ++addedPhiHits; if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " selected unassociated cluster: " << m_idHelperTool->toString( prds.front()->identify() ) << " distance to segment " << dist << endmsg; + ATH_MSG_VERBOSE(" selected unassociated cluster: " << m_idHelperSvc->toString( prds.front()->identify() ) << " distance to segment " << dist); for( unsigned int i=0;i<phiCompCluster->containedROTs().size();++i){ - msg(MSG::VERBOSE) << " content: " << m_idHelperTool->toString( phiCompCluster->containedROTs()[i]->identify() ) <<endmsg; + ATH_MSG_VERBOSE(" content: " << m_idHelperSvc->toString( phiCompCluster->containedROTs()[i]->identify() )); } } } @@ -2264,7 +2206,7 @@ namespace Muon { const TrkDriftCircleMath::Line& line = segment.line(); double phi = line.phi(); - if( fabs(phi) < 0.0000001 ) { + if( std::abs(phi) < 0.0000001 ) { ATH_MSG_WARNING("Unphysical phi angle " << phi); phi = 0.0000001; if( line.phi() < 0. ) phi *= -1.; @@ -2322,12 +2264,12 @@ namespace Muon { const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(rdit->second); if( mdt ) { const Identifier& id = mdt->identify(); - int layer = (m_idHelperTool->mdtIdHelper().tubeLayer(id)-1) + 4*(m_idHelperTool->mdtIdHelper().multilayer(id)-1); + int layer = (m_idHelperSvc->mdtIdHelper().tubeLayer(id)-1) + 4*(m_idHelperSvc->mdtIdHelper().multilayer(id)-1); if( firstLayer == -1 ) firstLayer = layer; else lastLayer = layer; hitsOnSegment.insert( mdt->identify() ); - chambersOnSegment.insert(m_idHelperTool->chamberId(mdt->identify())); + chambersOnSegment.insert(m_idHelperSvc->chamberId(mdt->identify())); } } @@ -2337,69 +2279,67 @@ namespace Muon { firstLayer = lastLayer; lastLayer = tmpLayer; } - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Tube layer ranges: " << firstLayer << " -- " - << lastLayer << " crossed tubes " << intersect.tubeIntersects().size() << std::endl; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" Tube layer ranges: " << firstLayer << " -- " + << lastLayer << " crossed tubes " << intersect.tubeIntersects().size()); // clear hole vector std::vector<Identifier> holeVec; for( unsigned int ii=0;ii<intersect.tubeIntersects().size();++ii ){ const MuonTubeIntersect& tint = intersect.tubeIntersects()[ii]; - if( !chambersOnSegment.count( m_idHelperTool->chamberId(tint.tubeId) ) ) { - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " chamber not on segment, not counting tube " << tint.rIntersect << " l " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; + if( !chambersOnSegment.count( m_idHelperSvc->chamberId(tint.tubeId) ) ) { + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" chamber not on segment, not counting tube " << tint.rIntersect << " l " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); continue; } const Identifier& id = tint.tubeId; - int layer = (m_idHelperTool->mdtIdHelper().tubeLayer(id)-1) + 4*(m_idHelperTool->mdtIdHelper().multilayer(id)-1); + int layer = (m_idHelperSvc->mdtIdHelper().tubeLayer(id)-1) + 4*(m_idHelperSvc->mdtIdHelper().multilayer(id)-1); bool notBetweenHits = layer < firstLayer || layer > lastLayer; double distanceCut = hasMeasuredCoordinate ? -20 : -200.; double innerRadius = MuonDetMgr->getMdtReadoutElement(id)->innerTubeRadius(); - if( notBetweenHits && ( fabs(tint.rIntersect) > innerRadius || (!m_allMdtHoles && tint.xIntersect > distanceCut) ) ) { - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " not counting tube: distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; + if( notBetweenHits && ( std::abs(tint.rIntersect) > innerRadius || (!m_allMdtHoles && tint.xIntersect > distanceCut) ) ) { + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" not counting tube: distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); }else{ // check whether there is a hit in this tube if( hitsOnSegment.count( tint.tubeId ) ) { - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " tube on segment: distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" tube on segment: distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); continue; } // check whether there is a delta electron in this tube if( m_removeDeltas ){ if( deltaVec.count( tint.tubeId ) ) { - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " removing delta, distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" removing delta, distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); continue; } const MdtPrepData* prd = findMdt(id); - if( prd && fabs(prd->localPosition()[Trk::locR]) < fabs(tint.rIntersect) ){ - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " found and removed delta, distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; + if( prd && std::abs(prd->localPosition()[Trk::locR]) < std::abs(tint.rIntersect) ){ + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" found and removed delta, distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); continue; } } if( msgLvl(MSG::VERBOSE) ) { std::string holeType = "hole "; if( outoftimeVec.count(tint.tubeId) ) holeType = "Out-of-time "; - msg(MSG::VERBOSE) << holeType << " distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect - << " " << m_idHelperTool->toString(tint.tubeId); - if( !notBetweenHits ) msg(MSG::VERBOSE) << " between hits"; - msg(MSG::VERBOSE) << std::endl; + ATH_MSG_VERBOSE(holeType << " distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect + << " " << m_idHelperSvc->toString(tint.tubeId)); + if( !notBetweenHits ) ATH_MSG_VERBOSE(" between hits"); } holeVec.push_back( tint.tubeId ); } } - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << endmsg; return holeVec; } const MdtPrepData* DCMathSegmentMaker::findMdt( const Identifier& id ) const { IdentifierHash colHash; - if( m_idHelperTool->mdtIdHelper().get_module_hash(m_idHelperTool->chamberId(id),colHash) == 0 ){ + if( m_idHelperSvc->mdtIdHelper().get_module_hash(m_idHelperSvc->chamberId(id),colHash) == 0 ){ const MdtPrepDataContainer* prdContainer = 0; SG::ReadHandle<Muon::MdtPrepDataContainer> MdtCont(m_mdtKey); if(!MdtCont.isValid()){ @@ -2441,8 +2381,8 @@ namespace Muon { ATH_MSG_WARNING(" rot not a MdtDriftCircleOnTrack "); continue; } - Identifier chId = m_idHelperTool->chamberId((*it)->identify()); - int sector = m_idHelperTool->sector(chId); + Identifier chId = m_idHelperSvc->chamberId((*it)->identify()); + int sector = m_idHelperSvc->sector(chId); if( currentSector == -1 ){ currentSector = sector; }else if( sector != currentSector ){ @@ -2470,8 +2410,8 @@ namespace Muon { double dXdZMinRight = 1e9; std::vector<HitInXZ>::iterator hit = hits.begin(); std::vector<HitInXZ>::iterator hit_end = hits.end(); - if(msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " recalculating using phi measurement " << m_idHelperTool->toString(hits.front().id) - << " pos (" << xline << "," << zline << ")" << std::endl; + if(msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" recalculating using phi measurement " << m_idHelperSvc->toString(hits.front().id) + << " pos (" << xline << "," << zline << ")"); for( ;hit!=hit_end;++hit ){ // sl extrapolation @@ -2486,42 +2426,40 @@ namespace Muon { // now calculate, if out of bounds, for which angle the situation would be ok double dz = (hit->z-zline); - if( fabs(dz) > 0.01 ) { + if( std::abs(dz) > 0.01 ) { if( locExX < hit->xmin ){ double inBoundsdXdZ = (hit->xmin-xline)/dz; - if( fabs(inBoundsdXdZ) < fabs(dXdZMinLeft) ) dXdZMinLeft = inBoundsdXdZ; + if( std::abs(inBoundsdXdZ) < std::abs(dXdZMinLeft) ) dXdZMinLeft = inBoundsdXdZ; newBoundLeft = true; } if( locExX > hit->xmax ) { double inBoundsdXdZ = (hit->xmax-xline)/dz; - if( fabs(inBoundsdXdZ) < fabs(dXdZMinRight) ) dXdZMinRight = inBoundsdXdZ; + if( std::abs(inBoundsdXdZ) < std::abs(dXdZMinRight) ) dXdZMinRight = inBoundsdXdZ; newBoundRight = true; } } } if(msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " " << std::setw(65) << m_idHelperTool->toString( hit->id ) + ATH_MSG_VERBOSE(" " << std::setw(65) << m_idHelperSvc->toString( hit->id ) << " pos (" << std::setw(6) << (int)hit->x << "," << std::setw(6) << (int)hit->z << ") ex pos " << std::setw(6) << (int)locExX << " min " << std::setw(6) << (int)hit->xmin << " max " << std::setw(6) << (int)hit->xmax - << " phimin " << std::setw(6) << hit->phimin << " phimax " << std::setw(6) << hit->phimax; - if( locExX < hit->xmin || locExX > hit->xmax ) msg(MSG::VERBOSE) << " outBounds "; - if( newBoundRight ) msg(MSG::VERBOSE) << " right " << dXdZMinRight; - if( newBoundLeft ) msg(MSG::VERBOSE) << " left " << dXdZMinLeft; - msg(MSG::VERBOSE) << std::endl; + << " phimin " << std::setw(6) << hit->phimin << " phimax " << std::setw(6) << hit->phimax); + if( locExX < hit->xmin || locExX > hit->xmax ) ATH_MSG_VERBOSE(" outBounds "); + if( newBoundRight ) ATH_MSG_VERBOSE(" right " << dXdZMinRight); + if( newBoundLeft ) ATH_MSG_VERBOSE(" left " << dXdZMinLeft); } } if(msgLvl(MSG::VERBOSE) ) { - if( fabs(dXdZMinRight) < 1e8 ) msg(MSG::VERBOSE) << " selected right bound " << dXdZMinRight; - if( fabs(dXdZMinLeft) < 1e8 ) msg(MSG::VERBOSE) << " selected left bound " << dXdZMinLeft; - msg(MSG::VERBOSE) << endmsg; + if( std::abs(dXdZMinRight) < 1e8 ) ATH_MSG_VERBOSE(" selected right bound " << dXdZMinRight); + if( std::abs(dXdZMinLeft) < 1e8 ) ATH_MSG_VERBOSE(" selected left bound " << dXdZMinLeft); } - if( fabs(dXdZMinRight) < 1e8 ) { + if( std::abs(dXdZMinRight) < 1e8 ) { result.first = true; result.second = dXdZMinRight; - }else if( fabs(dXdZMinLeft) < 1e8 ){ + }else if( std::abs(dXdZMinLeft) < 1e8 ){ result.first = true; result.second = dXdZMinLeft; } @@ -2547,12 +2485,12 @@ namespace Muon { } if( outBounds &&msgLvl(MSG::DEBUG) ){ - msg(MSG::DEBUG) << " " << std::setw(65) << m_idHelperTool->toString( hit->id ) + ATH_MSG_DEBUG(" " << std::setw(65) << m_idHelperSvc->toString( hit->id ) << " pos (" << std::setw(6) << (int)hit->x << "," << std::setw(6) << (int)hit->z << ") ex pos " << std::setw(6) << (int)locExX << " min " << std::setw(6) << (int)hit->xmin << " max " << std::setw(6) << (int)hit->xmax << " phimin " << std::setw(6) << hit->phimin << " phimax " << std::setw(6) << hit->phimax - << " outBounds, cross-check" << endmsg; + << " outBounds, cross-check"); } } return ok; @@ -2578,10 +2516,10 @@ namespace Muon { double xline = lsegPos.x(); double yline = lsegPos.y(); double zline = lsegPos.z(); - if(msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " Associated hits " << rots.size() + if(msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" Associated hits " << rots.size() << " angleXZ " << 90.*segLocDir.angleXZ()/acos(0.) << " dXdZ " << dXdZ << " seg Pos (" << xline << " " << zline << ") " - << segLocPos << std::endl; + << segLocPos); std::vector<HitInXZ> hits; hits.reserve(rots.size()); @@ -2596,8 +2534,8 @@ namespace Muon { if( !id.is_valid() ) continue; Amg::Vector3D lpos; double lxmin(0),lxmax(0),phimin(0.),phimax(0.); - bool isMdt = m_idHelperTool->isMdt(id); - bool measuresPhi = m_idHelperTool->measuresPhi(id); + bool isMdt = m_idHelperSvc->isMdt(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); if( isMdt ){ const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(*it); @@ -2638,15 +2576,15 @@ namespace Muon { phimax = phi1 < phi2 ? phi2 : phi1; }else{ - if( m_idHelperTool->isTgc(id) ){ + if( m_idHelperSvc->isTgc(id) ){ // need some special tricks for TGC phi hits as their reference plane can be rotated // with respect to the MDT frame // get orientation angle of strip to rotate back from local frame to strip // copy code from ROT creator - int stripNo = m_idHelperTool->tgcIdHelper().channel(id); - int gasGap = m_idHelperTool->tgcIdHelper().gasGap(id); + int stripNo = m_idHelperSvc->tgcIdHelper().channel(id); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id); if (!crot) { ATH_MSG_WARNING("dynamic cast failed for CompetingMuonClustersOnTrack"); continue; @@ -2681,15 +2619,15 @@ namespace Muon { // at the y intersect position of the segment double tgcdX = lposSeg_shift.x() - lposSeg.x(); double tgcdY = lposSeg_shift.y() - lposSeg.y(); - if( fabs(tgcdY) < 0.0001 ) { + if( std::abs(tgcdY) < 0.0001 ) { ATH_MSG_WARNING(" Bad TGC phi strip orientation "); continue; } double tgcExX = tgcdX/tgcdY*(segYAtHit-lposSeg.y()) + lposSeg.x(); lpos[0] = tgcExX; lpos[1] = segYAtHit; - if(msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " In seg frame: phi pos " << lposSeg << " shifted pos " << lposSeg_shift - << " intersect with segment " << lpos << std::endl; + if(msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" In seg frame: phi pos " << lposSeg << " shifted pos " << lposSeg_shift + << " intersect with segment " << lpos); } @@ -2700,7 +2638,7 @@ namespace Muon { // check whether phi is consistent with segment phi range bool phiOk = checkPhiConsistency(phimin,seg_phimin,seg_phimax); if( !phiOk ){ - if(msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " Inconsistent phi " << phimin << " range " << seg_phimin << " " << seg_phimax << std::endl; + if(msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" Inconsistent phi " << phimin << " range " << seg_phimin << " " << seg_phimax); } } } @@ -2710,7 +2648,7 @@ namespace Muon { ++nphiHits; if( !firstPhiHit ) firstPhiHit = new HitInXZ(hits.back()); else{ - double distPhiHits = fabs(firstPhiHit->z - hits.back().z); + double distPhiHits = std::abs(firstPhiHit->z - hits.back().z); if( distPhiHits > 500. ){ if( lastPhiHit ) delete lastPhiHit; lastPhiHit = new HitInXZ(hits.back()); @@ -2718,20 +2656,19 @@ namespace Muon { // not count this phi hit --nphiHits; if(msgLvl(MSG::DEBUG) ){ - msg(MSG::DEBUG) << " close phi hits, distance " << distPhiHits << std::endl; + ATH_MSG_DEBUG(" close phi hits, distance " << distPhiHits); } } } } if(msgLvl(MSG::VERBOSE) ){ double locExX = xline + dXdZ*(lpos.z()-zline); - msg(MSG::VERBOSE) << " " << std::setw(65) << m_idHelperTool->toString( id ) + ATH_MSG_VERBOSE(" " << std::setw(65) << m_idHelperSvc->toString( id ) << " pos (" << std::setw(6) << (int)lpos.x() << "," << std::setw(6) << (int)lpos.z() << ") ex pos " << std::setw(6) << (int)locExX << " min " << std::setw(6) << (int)lxmin << " max " << std::setw(6) << (int)lxmax - << " phimin " << std::setw(6) << phimin << " phimax " << std::setw(6) << phimax; - if( lpos.x() < lxmin || lpos.x() > lxmax ) msg(MSG::VERBOSE) << " outBounds"; - msg(MSG::VERBOSE) << std::endl; + << " phimin " << std::setw(6) << phimin << " phimax " << std::setw(6) << phimax); + if( lpos.x() < lxmin || lpos.x() > lxmax ) ATH_MSG_VERBOSE(" outBounds"); } } @@ -2750,12 +2687,12 @@ namespace Muon { if( m_assumePointingPhi ){ Amg::Vector3D ipLocPos = gToSegment*Amg::Vector3D(0.,0.,0.); - if(msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " IP position in local frame " << ipLocPos; + if(msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" IP position in local frame " << ipLocPos); double dz = ipLocPos.z()-zline; - if( fabs(dz) > 0.001 ){ - if(msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " hit (" << xline << "," << zline << ") IP (" << ipLocPos.x() << "," << ipLocPos.z() - << ") dXdZ " << (ipLocPos.x()-xline)/dz << " old " << dXdZ << std::endl; + if( std::abs(dz) > 0.001 ){ + if(msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" hit (" << xline << "," << zline << ") IP (" << ipLocPos.x() << "," << ipLocPos.z() + << ") dXdZ " << (ipLocPos.x()-xline)/dz << " old " << dXdZ); dXdZ = (ipLocPos.x()-xline)/dz; } } @@ -2770,7 +2707,7 @@ namespace Muon { // use phi position of the first hit xline = firstPhiHit->x; zline = firstPhiHit->z; - if( fabs(dz) > 300. ){ + if( std::abs(dz) > 300. ){ double dx = lastPhiHit->x - firstPhiHit->x; hasUpdated = true; @@ -2804,7 +2741,6 @@ namespace Muon { delete firstPhiHit; delete lastPhiHit; - if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg; return hasUpdated; } @@ -2824,7 +2760,7 @@ namespace Muon { // rescale to correctly take into account active tube length double tubeLen = (lropos-lhvpos).mag(); - double activeTubeLen = mdt.detectorElement()->getActiveTubeLength(m_idHelperTool->mdtIdHelper().tubeLayer(id),m_idHelperTool->mdtIdHelper().tube(id)); + double activeTubeLen = mdt.detectorElement()->getActiveTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(id),m_idHelperSvc->mdtIdHelper().tube(id)); double scaleFactor = activeTubeLen/tubeLen; lropos[0] = scaleFactor*lropos.x(); lhvpos[0] = scaleFactor*lhvpos.x(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h index 6eee52c3525e0a16e33a49ea1304a8c8a3c258e4..3a8a0925b13b4f37c1c0c567f46e2470662edf53 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h @@ -1,35 +1,42 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DCMATHSEGMENTMAKER_H #define DCMATHSEGMENTMAKER_H +#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentTriggerHitAssociator.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" #include "MuonSegment/MuonSegment.h" - #include "TrkDriftCircleMath/DCSLFitter.h" #include "TrkDriftCircleMath/DCSLHitSelector.h" #include "TrkDriftCircleMath/MdtChamberGeometry.h" #include "TrkDriftCircleMath/DCStatistics.h" #include "TrkDriftCircleMath/Cluster.h" #include "TrkDriftCircleMath/DriftCircle.h" - #include "TrkSurfaces/Surface.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentTriggerHitAssociator.h" #include "TrkFitterInterfaces/ITrackFitter.h" - #include "MuonCondData/MdtCondDbData.h" - #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" - #include "MuonPrepRawData/RpcPrepDataContainer.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMdtSegmentFinder.h" +#include "MuonRecToolInterfaces/IMuonSegmentFittingTool.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" +#include "MuonSegmentMakerInterfaces/IDCSLFitProvider.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonStationIntersectSvc/MuonStationIntersectSvc.h" #include <vector> #include <set> @@ -42,10 +49,8 @@ namespace Trk { } namespace TrkDriftCircleMath { - class Line; class MdtMultiChamberGeometry; class Segment; - class DCSLFitter; } namespace MuonGM { @@ -53,28 +58,9 @@ namespace MuonGM { } namespace Muon { - class IMuonCompetingClustersOnTrackCreator; - class IMdtDriftCircleOnTrackCreator; - class IMuonClusterOnTrackCreator; - class IMdtSegmentFinder; - class IMuonTrackCleaner; - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class IMuonSegmentFittingTool; - class IMuonSegmentSelectionTool; - class IDCSLFitProvider; class MdtPrepData; } -class MdtCondDbData; -class MdtIdHelper; -class RpcIdHelper; -class TgcIdHelper; -class Identifier; -class MuonStationIntersectSvc; - -class MsgStream; - namespace Muon { class MdtDriftCircleOnTrack; @@ -219,18 +205,12 @@ class MdtDriftCircleOnTrack; }; public: - /** default AlgTool constructor */ DCMathSegmentMaker(const std::string&,const std::string&,const IInterface*); - /** destructor */ - virtual ~DCMathSegmentMaker (); + virtual ~DCMathSegmentMaker()=default; - /** initialize method, method taken from bass-class AlgTool */ virtual StatusCode initialize(); - /** finialize method, method taken from bass-class AlgTool */ - virtual StatusCode finalize(); - /** find segments starting from a list of RIO_OnTrack objects, implementation of IMuonSegmentMaker interface routine. Will call: @@ -406,7 +386,7 @@ class MdtDriftCircleOnTrack; ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtCreatorT0; //<! mdt rio ontrack creator ToolHandle<IMuonClusterOnTrackCreator> m_clusterCreator; //<! cluster rio ontrack creator ToolHandle<IMuonCompetingClustersOnTrackCreator> m_compClusterCreator; //<! competing clusters rio ontrack creator - ToolHandle<MuonIdHelperTool> m_idHelperTool; //<! Id helper tool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<MuonEDMPrinterTool> m_printer; //<! printer helper tool ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.cxx index ec6e613ca15d824cb391198ccbbd307ad30d3f42..9f8d20ceac38e1a0cca3890681109dc9f5cc1dfb 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.cxx @@ -1,26 +1,20 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MdtMathSegmentFinder.h" -#include "MuonSegmentMakerInterfaces/IDCSLFitProvider.h" - #include "TrkDriftCircleMath/SegmentFinder.h" #include "TrkDriftCircleMath/Road.h" #include "TrkDriftCircleMath/DCStatistics.h" #include "TrkDriftCircleMath/DCSLFitter.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - namespace Muon { MdtMathSegmentFinder::MdtMathSegmentFinder (const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool (t, n, p), - m_dcslFitProvider("",this), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") + m_dcslFitProvider("",this) { declareInterface <IMdtSegmentFinder> (this); @@ -50,35 +44,18 @@ namespace Muon { declareProperty("ResidualCutT0Segments", m_residualCutT0Segments = 1.,"Residual cut for segments with T0 fit"); declareProperty("UseSegmentQuality", m_useSegmentQuality = false,"Use segment quality in hit dropping"); declareProperty("DCFitProvider", m_dcslFitProvider ); - declareProperty("IdHelper", m_idHelperTool ); - } - - MdtMathSegmentFinder::~MdtMathSegmentFinder() - { } StatusCode MdtMathSegmentFinder::initialize() { - - if( AthAlgTool::initialize().isFailure() ) return StatusCode::FAILURE; - - if( !m_dcslFitProvider.empty() ){ - ATH_CHECK( m_dcslFitProvider.retrieve() ); + if (!m_dcslFitProvider.empty()) { + ATH_CHECK(m_dcslFitProvider.retrieve()); ATH_MSG_INFO(" Using fitter from " << m_dcslFitProvider); } - - if( !m_idHelperTool.empty() ){ - ATH_CHECK( m_idHelperTool.retrieve() ); - } + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } - StatusCode MdtMathSegmentFinder::finalize() - { - - return AthAlgTool::finalize(); - } - const TrkDriftCircleMath::SegVec MdtMathSegmentFinder::findSegments (const TrkDriftCircleMath::DCVec& dcvec, const TrkDriftCircleMath::CLVec& clvec, const TrkDriftCircleMath::Road& road, @@ -175,7 +152,7 @@ namespace Muon { if( occupancy > m_occupancyCutOff ) aboveOccupancyCut = true; ATH_MSG_VERBOSE(" multilayer occupancy: " << occupancy - << " " << m_idHelperTool->toStringDetEl(mit->first->identify())); + << " " << m_idHelperSvc->toStringDetEl(mit->first->identify())); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.h index 5412882f4f7666e2121774655aa91acef64c08fb..2b7820310f50a432141d6dfdbbad83105883578c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MdtMathSegmentFinder.h @@ -1,42 +1,29 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DCMATHSEGMENTMAKER_MDTMATHSEGMENTFINDER_H #define DCMATHSEGMENTMAKER_MDTMATHSEGMENTFINDER_H +#include "MuonRecToolInterfaces/IMdtSegmentFinder.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonRecToolInterfaces/IMdtSegmentFinder.h" - -class MsgStream; - -namespace TrkDriftCircleMath { - class SegmentFinder; - class DCSLFitter; -} - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonSegmentMakerInterfaces/IDCSLFitProvider.h" namespace Muon { - - class MuonIdHelperTool; - class IDCSLFitProvider; - class MdtMathSegmentFinder : virtual public IMdtSegmentFinder::IMdtSegmentFinder, public AthAlgTool { public: MdtMathSegmentFinder (const std::string& t, const std::string& n, const IInterface* p); - ~MdtMathSegmentFinder(); + ~MdtMathSegmentFinder()=default; - /** initialize method, method taken from bass-class AlgTool */ virtual StatusCode initialize(); - /** finialize method, method taken from bass-class AlgTool */ - virtual StatusCode finalize(); - /** IMdtMdtMathSegmentFinder interface implementation */ virtual const TrkDriftCircleMath::SegVec findSegments ( const TrkDriftCircleMath::DCVec& dcvec, const TrkDriftCircleMath::CLVec& clvec, @@ -46,7 +33,7 @@ namespace Muon { protected: ToolHandle<IDCSLFitProvider> m_dcslFitProvider; - ToolHandle<MuonIdHelperTool> m_idHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; int m_finderDebugLevel; //<! additional debug output bool m_doDrop; //<! enable dropping of hits from segment diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx index 64e5fed900f55419b544a5b02dcd56f9ae7e7b43..40fabbd7a889ca6da9c6377e20ddf5b031ec6ccb 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx @@ -220,14 +220,13 @@ namespace Muon { } if( msgLvl(MSG::DEBUG) ){ - msg(MSG::DEBUG) << "Tracks before ambi solving " << std::endl; + ATH_MSG_DEBUG("Tracks before ambi solving "); for(TrackCollection::const_iterator it=segTrkColl->begin(); it!=segTrkColl->end(); ++it) { - msg(MSG::DEBUG) << m_printer->print(**it) << std::endl; + ATH_MSG_DEBUG(m_printer->print(**it)); const DataVector<const Trk::MeasurementBase>* measu = (*it)->measurementsOnTrack(); - if( measu ) msg(MSG::DEBUG) << m_printer->print( measu->stdcont() ) << std::endl; + if( measu ) ATH_MSG_DEBUG(m_printer->print( measu->stdcont() )); } - msg(MSG::DEBUG) << endmsg; } if( segTrkColl->empty() ){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.cxx index d3ac5e90b28e1a3cea2d480549f35747cb1047ef..c845675cdcbf519cf2aacad6225441931d2aa5b2 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.cxx @@ -1,29 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentFittingTool.h" -#include "GaudiKernel/MsgStream.h" - #include "TrkEventPrimitives/LocalDirection.h" #include "TrkEventPrimitives/DefinedParameter.h" #include "TrkEventPrimitives/LocalParameters.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/FitQuality.h" - #include "TrkTrack/Track.h" - #include "TrkParameters/TrackParameters.h" - #include "TrkSurfaces/PlaneSurface.h" - -#include "TrkFitterInterfaces/ITrackFitter.h" -#include "TrkExInterfaces/IPropagator.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" - #include "MuonSegment/MuonSegment.h" namespace Muon { @@ -34,37 +22,22 @@ namespace Muon { m_magFieldProperties(Trk::NoField), m_slTrackFitter("Trk::GlobalChi2Fitter/MCTBSLFitter", this), m_curvedTrackFitter("Trk::GlobalChi2Fitter/MCTBFitter", this), - m_trackCleaner("Muon::MuonTrackCleaner/MuonTrackCleaner", this), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") + m_trackCleaner("Muon::MuonTrackCleaner/MuonTrackCleaner", this) { declareInterface<IMuonSegmentFittingTool>(this); - declareProperty("SLPropagator", m_slPropagator); declareProperty("SLFitter", m_slTrackFitter); declareProperty("CurvedFitter", m_curvedTrackFitter); declareProperty("TrackCleaner", m_trackCleaner); - declareProperty("IdHelper", m_idHelperTool); declareProperty("UpdatePrecisionCoordinate", m_updatePrecisionCoordinate = false ); } - MuonSegmentFittingTool::~MuonSegmentFittingTool() - { - } - StatusCode MuonSegmentFittingTool::initialize() { - ATH_CHECK( m_slPropagator.retrieve() ); - ATH_CHECK( m_idHelperTool.retrieve() ); ATH_CHECK( m_slTrackFitter.retrieve() ); ATH_CHECK( m_curvedTrackFitter.retrieve() ); ATH_CHECK( m_trackCleaner.retrieve() ); - - return StatusCode::SUCCESS; - } - - StatusCode MuonSegmentFittingTool::finalize() - { return StatusCode::SUCCESS; } @@ -162,21 +135,20 @@ namespace Muon { } if( msgLvl(MSG::DEBUG) ){ - msg(MSG::DEBUG) << MSG::DEBUG << std::setprecision(5) << " chi2 " << fq->chiSquared() << " ndof " << fq->numberDoF(); + ATH_MSG_DEBUG(std::setprecision(5) << " chi2 " << fq->chiSquared() << " ndof " << fq->numberDoF()); const Trk::Perigee* pp = newtrack->perigeeParameters(); if( pp ){ - msg(MSG::DEBUG) << " pos " << std::setprecision(5) << pp->position() + ATH_MSG_DEBUG(" pos " << std::setprecision(5) << pp->position() << " phi " << pp->momentum().phi() << " theta " << pp->momentum().theta() << " q*mom " << pp->momentum().mag()*pp->charge() - << " pt " << pp->momentum().perp()<< endmsg; + << " pt " << pp->momentum().perp()); }else{ - msg(MSG::DEBUG) << " no perigee " << endmsg; + ATH_MSG_DEBUG(" no perigee "); } } return newtrack; } - void MuonSegmentFittingTool::updateSegmentParameters( const Trk::Track& track, const Trk::PlaneSurface& surf, Amg::Vector2D& segLocPos, Trk::LocalDirection& segLocDir, Amg::MatrixX& locerr ) const { diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.h index 67d099ee5109f7bb4611fecea644d497f751fd27..b35dc9b1e266b6143fa91d2d303c657635a65151 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonSegmentFittingTool.h @@ -1,38 +1,32 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSEGMENTFITTINGTOOL_H #define MUONSEGMENTFITTINGTOOL_H +#include "MuonRecToolInterfaces/IMuonSegmentFittingTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "GeoPrimitives/GeoPrimitives.h" - -#include "MuonRecToolInterfaces/IMuonSegmentFittingTool.h" #include "TrkGeometry/MagneticFieldProperties.h" - +#include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkExInterfaces/IPropagator.h" +#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" +#include <string> #include <vector> namespace Trk { class PlaneSurface; - class IPropagator; - class ITrackFitter; class LocalDirection; class MeasurementBase; } - namespace Muon { - class IMuonTrackCleaner; - class MuonIdHelperTool; class MuonSegment; } - -class MsgStream; - namespace Muon { /** @@ -43,18 +37,12 @@ namespace Muon { */ class MuonSegmentFittingTool : virtual public IMuonSegmentFittingTool, public AthAlgTool { public: - /** default AlgTool constructor */ MuonSegmentFittingTool(const std::string&,const std::string&,const IInterface*); - /** destructor */ - virtual ~MuonSegmentFittingTool (); + virtual ~MuonSegmentFittingTool()=default; - /** initialize method, method taken from bass-class AlgTool */ virtual StatusCode initialize(); - /** finialize method, method taken from bass-class AlgTool */ - virtual StatusCode finalize(); - /** fit segment parameters + hits producing a track */ Trk::Track* fit( const Amg::Vector3D& gpos, const Amg::Vector3D& gdir, const Trk::PlaneSurface& surf, const std::vector<const Trk::MeasurementBase*>& rioVec ) const; @@ -72,7 +60,6 @@ namespace Muon { ToolHandle<Trk::ITrackFitter> m_slTrackFitter; //<! fitter, always use straightline ToolHandle<Trk::ITrackFitter> m_curvedTrackFitter; //<! fitter, curved tracks ToolHandle<Muon::IMuonTrackCleaner> m_trackCleaner; - ToolHandle<MuonIdHelperTool> m_idHelperTool; //<! Id helper tool bool m_updatePrecisionCoordinate; //<! flag to select update of precision coordinate in fit }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx index cc1979ee18e5d0002b72d662972dd4b30c5cbf99..c727a2167fe1b9ec456a45502be3445213edca86 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx @@ -1,42 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonClusterSegmentFinder.h" -#include "MuonPrepRawDataProviderTools/MuonLayerHashProviderTool.h" -#include "MuonRecToolInterfaces/IMuonPRDSelectionTool.h" -// ROOT includes -#include "TTree.h" -#include "TFile.h" - -// AthExHistNtup includes #include "MuonLinearSegmentMakerUtilities/ClusterAnalysis.h" - -// EDM #include "MuonPrepRawData/MdtPrepDataCollection.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "AtlasHepMC/GenEvent.h" - -// interfaces -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "TrkFitterInterfaces/ITrackFitter.h" -#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" -#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" -#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" -#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" -#include "MuonClusterization/IMuonClusterizationTool.h" - + +#include "TTree.h" +#include "TFile.h" + namespace Muon { MuonClusterSegmentFinder::MuonClusterSegmentFinder(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_layerHashProvider("Muon::MuonLayerHashProviderTool/MuonLayerHashProviderTool", this), m_muonPRDSelectionTool("Muon::MuonPRDSelectionTool/MuonPRDSelectionTool", this), @@ -53,7 +33,6 @@ namespace Muon { declareInterface<IMuonClusterSegmentFinder>(this); declareProperty("MuonClusterizationTool", m_clusterTool); - declareProperty("MuonIdHelperTool",m_idHelper ); declareProperty("MuonEDMPrinterTool",m_printer ); declareProperty("MuonPRDSelectionTool", m_muonPRDSelectionTool ); declareProperty("MdtSegmentMaker",m_segmentMaker); @@ -65,8 +44,6 @@ namespace Muon { } - MuonClusterSegmentFinder::~MuonClusterSegmentFinder() { } - StatusCode MuonClusterSegmentFinder::finalize() { if( m_doNtuple ){ @@ -83,7 +60,7 @@ namespace Muon { StatusCode MuonClusterSegmentFinder::initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_layerHashProvider.retrieve()); ATH_CHECK(m_muonPRDSelectionTool.retrieve()); @@ -145,7 +122,7 @@ return (fabs(i.z()) < fabs(j.z()));} Trk::SegmentCollection* segColl) const { if(tgcCols){ - Muon::TgcPrepDataContainer* clusterPRD=new Muon::TgcPrepDataContainer(m_idHelper->tgcIdHelper().module_hash_max()); + Muon::TgcPrepDataContainer* clusterPRD=new Muon::TgcPrepDataContainer(m_idHelperSvc->tgcIdHelper().module_hash_max()); for(const auto tgcCol : *tgcCols){ Muon::TgcPrepDataCollection* clusteredCol = m_clusterTool->cluster(*tgcCol); if(clusteredCol) clusterPRD->addCollection(clusteredCol, tgcCol->identifyHash() ).ignore(); @@ -165,7 +142,7 @@ return (fabs(i.z()) < fabs(j.z()));} }//end if TGC if(rpcCols){ - Muon::RpcPrepDataContainer* clusterPRD=new Muon::RpcPrepDataContainer(m_idHelper->rpcIdHelper().module_hash_max()); + Muon::RpcPrepDataContainer* clusterPRD=new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); for(const auto rpcCol : *rpcCols){ Muon::RpcPrepDataCollection* clusteredCol = m_clusterTool->cluster(*rpcCol); if(clusteredCol) clusterPRD->addCollection(clusteredCol, rpcCol->identifyHash() ).ignore(); @@ -322,9 +299,8 @@ return (fabs(i.z()) < fabs(j.z()));} if( !m_edmHelperSvc->goodTrack(*segtrack,30) && vec2.size() > 4) { if(msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "bad segment fit:" ; - if (segtrack->fitQuality()) msg(MSG::DEBUG) << "with chi^2/nDoF = " << segtrack->fitQuality()->chiSquared() << "/" << segtrack->fitQuality()->numberDoF() ; - msg(MSG::DEBUG) << endmsg; + ATH_MSG_DEBUG("bad segment fit:"); + if (segtrack->fitQuality()) ATH_MSG_DEBUG("with chi^2/nDoF = " << segtrack->fitQuality()->chiSquared() << "/" << segtrack->fitQuality()->numberDoF()); } delete segtrack; segtrack = 0; @@ -336,10 +312,10 @@ return (fabs(i.z()) < fabs(j.z()));} void MuonClusterSegmentFinder::makeClusterVecs(const std::vector<const Muon::MuonClusterOnTrack*>& clustCol,candEvent* theEvent) const { for( std::vector<const Muon::MuonClusterOnTrack*>::const_iterator colIt = clustCol.begin(); colIt != clustCol.end(); ++ colIt ){ const MuonClusterOnTrack* clust = *colIt; - MuonStationIndex::PhiIndex pIndex = m_idHelper->phiIndex(clust->identify()); + MuonStationIndex::PhiIndex pIndex = m_idHelperSvc->phiIndex(clust->identify()); bool tmatch(false); int barcode(0); - if (m_idHelper->measuresPhi( clust->identify())){ + if (m_idHelperSvc->measuresPhi( clust->identify())){ theEvent->clusters().push_back(clust); ClusterSeg::Cluster* cluster = new ClusterSeg::Cluster(clust->globalPosition().x(),clust->globalPosition().y(),clust->globalPosition().z(),true,MuonStationIndex::TechnologyIndex::TGC,pIndex,tmatch,barcode); theEvent->Clust().push_back(cluster); @@ -364,8 +340,8 @@ return (fabs(i.z()) < fabs(j.z()));} tmatch = matchTruth(*truthCollectionTGC,id,barcode); } const MuonClusterOnTrack* clust = m_clusterCreator->createRIO_OnTrack( *cl, cl->globalPosition() ); - MuonStationIndex::PhiIndex pIndex = m_idHelper->phiIndex(clust->identify()); - if (m_idHelper->measuresPhi( clust->identify())){ + MuonStationIndex::PhiIndex pIndex = m_idHelperSvc->phiIndex(clust->identify()); + if (m_idHelperSvc->measuresPhi( clust->identify())){ theEvent->clusters().push_back(clust); ClusterSeg::Cluster* cluster = new ClusterSeg::Cluster(clust->globalPosition().x(),clust->globalPosition().y(),clust->globalPosition().z(),true,MuonStationIndex::TechnologyIndex::TGC,pIndex,tmatch,barcode); theEvent->Clust().push_back(cluster); @@ -391,8 +367,8 @@ return (fabs(i.z()) < fabs(j.z()));} tmatch = matchTruth(*truthCollectionRPC,id,barcode); } const MuonClusterOnTrack* clust = m_clusterCreator->createRIO_OnTrack( *cl, cl->globalPosition() ); - MuonStationIndex::PhiIndex pIndex = m_idHelper->phiIndex(clust->identify()); - if (m_idHelper->measuresPhi( clust->identify())){ + MuonStationIndex::PhiIndex pIndex = m_idHelperSvc->phiIndex(clust->identify()); + if (m_idHelperSvc->measuresPhi( clust->identify())){ theEvent->clusters().push_back(clust); ClusterSeg::Cluster* cluster = new ClusterSeg::Cluster(clust->globalPosition().x(),clust->globalPosition().y(),clust->globalPosition().z(),true,MuonStationIndex::TechnologyIndex::RPC,pIndex,tmatch,barcode); theEvent->Clust().push_back(cluster); @@ -492,8 +468,8 @@ return (fabs(i.z()) < fabs(j.z()));} const Identifier& id = MCOTs.front()->identify(); - MuonStationIndex::DetectorRegionIndex regionIndex = m_idHelper->regionIndex(id); - MuonStationIndex::LayerIndex layerIndex = m_idHelper->layerIndex(id); + MuonStationIndex::DetectorRegionIndex regionIndex = m_idHelperSvc->regionIndex(id); + MuonStationIndex::LayerIndex layerIndex = m_idHelperSvc->layerIndex(id); MuonLayerSurface::SurfacePtr surfacePtr(startPars.associatedSurface().clone()); std::shared_ptr<const Trk::TrackParameters> parsPtr(startPars.clone()); @@ -549,7 +525,7 @@ return (fabs(i.z()) < fabs(j.z()));} //ATH_MSG_WARNING("Cannot find hash " << *it << " in container at " << location); continue; } - ATH_MSG_VERBOSE(" adding " << m_idHelper->toStringChamber((*colIt)->identify()) << " size " << (*colIt)->size()); + ATH_MSG_VERBOSE(" adding " << m_idHelperSvc->toStringChamber((*colIt)->identify()) << " size " << (*colIt)->size()); // else add output.push_back(*colIt); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.h index aff872da8915dbfa44667799879836fa27965a0b..ca3ef42404f313a8c49fd56a078cafac4e4514a0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.h @@ -1,55 +1,51 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////////// -//// MuonClusterSegmentFinder.h (c) ATLAS Detector software -//// Author: N.Bernard <nathan.rogers.bernard@cern.ch> -///////////////////////////////////////////////////////////////////////// #ifndef MUON_MUONCLUSTERSEGMENTFINDER_H #define MUON_MUONCLUSTERSEGMENTFINDER_H -// STL includes -#include <string> -#include <vector> +#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" -// EDM +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" +#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" +#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" +#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h" +#include "MuonRecToolInterfaces/IMuonPRDSelectionTool.h" +#include "MuonClusterization/IMuonClusterizationTool.h" +#include "MuonPrepRawDataProviderTools/MuonLayerHashProviderTool.h" #include "MuonSegment/MuonSegment.h" #include "MuonPrepRawData/MuonCluster.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" - -// helpers #include "MuonDetDescrUtils/MuonSectorMapping.h" #include "MuonSegmentMakerUtils/MuonSegmentKey.h" #include "MuonSegmentMakerUtils/CompareMuonSegmentKeys.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - -// FrameWork includes -#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - #include "MuonPrepRawData/RpcPrepDataCollection.h" #include "MuonPrepRawData/TgcPrepDataCollection.h" #include "TrkParameters/TrackParameters.h" - #include "MuonLinearSegmentMakerUtilities/ClusterNtuple.h" +#include <string> +#include <vector> -// fwd declares class TTree; class TFile; -class PRD_MultiTruthCollection; namespace Trk { class Track; class MeasurementBase; - class ITrackFitter; - class ITrackAmbiguityProcessorTool; } namespace Muon { @@ -87,22 +83,11 @@ namespace Muon { std::vector<std::vector<const MuonClusterOnTrack*>> m_resolvedhits; }; - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class MuonLayerHashProviderTool; - class IMuonPRDSelectionTool; - class IMuonSegmentMaker; - class IMuonClusterOnTrackCreator; - class IMuonTrackToSegmentTool; - class IMuonTrackCleaner; - class IMuonSegmentOverlapRemovalTool; - class IMuonClusterizationTool; - class MuonClusterSegmentFinder : virtual public IMuonClusterSegmentFinder, public AthAlgTool{ public: /** Default AlgTool functions */ MuonClusterSegmentFinder(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonClusterSegmentFinder(); + virtual ~MuonClusterSegmentFinder()=default; StatusCode initialize(); StatusCode finalize(); @@ -124,7 +109,7 @@ namespace Muon { const PRD_MultiTruthCollection* tgcTruthColl) const; private: - ToolHandle<MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<MuonEDMPrinterTool> m_printer; ToolHandle<MuonLayerHashProviderTool> m_layerHashProvider; ToolHandle<IMuonPRDSelectionTool> m_muonPRDSelectionTool; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx index 9da892b6111c323ace9d058e8c039cbf18048bbc..a0176cd7aa7b3807b1f597716f5340006e156d98 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx @@ -1,18 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonLayerSegmentFinderTool.h" + #include "MuonPrepRawDataProviderTools/MuonPrepRawDataCollectionProviderTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" -#include "MuonRecToolInterfaces/IMuonPRDSelectionTool.h" -#include "CscSegmentMakers/ICscSegmentFinder.h" -#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h" -#include "MuonHoughPatternTools/MuonLayerHoughTool.h" #include "MuonLayerHough/MuonLayerHough.h" -#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" #include "TrkSegment/SegmentCollection.h" #include "MuonSegment/MuonSegment.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" @@ -23,7 +16,6 @@ namespace Muon { MuonLayerSegmentFinderTool::MuonLayerSegmentFinderTool(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_muonPRDSelectionTool("Muon::MuonPRDSelectionTool/MuonPRDSelectionTool"), m_segmentMaker("Muon::DCMathSegmentMaker/DCMathSegmentMaker"), @@ -36,7 +28,6 @@ namespace Muon { { declareInterface<IMuonLayerSegmentFinderTool>(this); - declareProperty("MuonIdHelperTool",m_idHelper ); declareProperty("MuonEDMPrinterTool",m_printer ); declareProperty("MuonPRDSelectionTool", m_muonPRDSelectionTool ); declareProperty("SegmentMaker",m_segmentMaker); @@ -47,20 +38,13 @@ namespace Muon { declareProperty("MuonRecoValidationTool",m_recoValidationTool); } - MuonLayerSegmentFinderTool::~MuonLayerSegmentFinderTool() { } - - StatusCode MuonLayerSegmentFinderTool::finalize() { - return StatusCode::SUCCESS; - } - StatusCode MuonLayerSegmentFinderTool::initialize() { - - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_muonPRDSelectionTool.retrieve()); ATH_CHECK(m_segmentMaker.retrieve()); - if (m_idHelper->hasCSC() && !m_csc2dSegmentFinder.empty()) ATH_CHECK(m_csc2dSegmentFinder.retrieve()); - if (m_idHelper->hasCSC() && !m_csc4dSegmentFinder.empty()) ATH_CHECK(m_csc4dSegmentFinder.retrieve()); + if (m_idHelperSvc->hasCSC() && !m_csc2dSegmentFinder.empty()) ATH_CHECK(m_csc2dSegmentFinder.retrieve()); + if (m_idHelperSvc->hasCSC() && !m_csc4dSegmentFinder.empty()) ATH_CHECK(m_csc4dSegmentFinder.retrieve()); ATH_CHECK(m_clusterSegmentFinder.retrieve()); ATH_CHECK(m_clusterSegMakerNSW.retrieve()); if( !m_recoValidationTool.empty() ) ATH_CHECK(m_recoValidationTool.retrieve()); @@ -83,10 +67,7 @@ namespace Muon { ATH_MSG_VERBOSE(" findClusterSegments " << segments.size() ); // run standard MDT/Trigger hit segment finding either from Hough or hits - // if( !m_layerHoughTool.empty() ) findMdtSegmentsFromHough(intersection,layerPrepRawData,segments); - // else findMdtSegments(intersection,layerPrepRawData,segments); findMdtSegments(intersection,layerPrepRawData,segments); - } void MuonLayerSegmentFinderTool::findMdtSegmentsFromHough( const MuonSystemExtension::Intersection& intersection, @@ -194,7 +175,7 @@ namespace Muon { for( const auto& prd : (*hit)->tgc->etaCluster.hitList ) handleCluster(*prd,clusters); }else if( (*hit)->prd ){ Identifier id = (*hit)->prd->identify(); - if( m_idHelper->isMdt(id) ) handleMdt( static_cast<const MdtPrepData&>(*(*hit)->prd),mdts); + if( m_idHelperSvc->isMdt(id) ) handleMdt( static_cast<const MdtPrepData&>(*(*hit)->prd),mdts); else handleCluster( static_cast<const MuonCluster&>(*(*hit)->prd),clusters); } } @@ -221,11 +202,11 @@ namespace Muon { // treat the case that the hit is a composite TGC hit if( (*hit)->tgc && !(*hit)->tgc->phiCluster.hitList.empty() ){ Identifier id = (*hit)->tgc->phiCluster.hitList.front()->identify(); - if( m_idHelper->layerIndex(id) != intersection.layerSurface.layerIndex ) continue; + if( m_idHelperSvc->layerIndex(id) != intersection.layerSurface.layerIndex ) continue; for( const auto& prd : (*hit)->tgc->phiCluster.hitList ) handleCluster(*prd,clusters); }else if( (*hit)->prd ){ Identifier id = (*hit)->prd->identify(); - if( m_idHelper->layerIndex(id) != intersection.layerSurface.layerIndex ) continue; + if( m_idHelperSvc->layerIndex(id) != intersection.layerSurface.layerIndex ) continue; handleCluster( static_cast<const MuonCluster&>(*(*hit)->prd),clusters); } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h index 9c5d6d514ed24ae27c4828f88f9e33b3731387e3..0dc14144425613f9d879e920911f1cc6ed8c2fc3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.h @@ -1,36 +1,35 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONLAYERSEGMENTFINDERTOOL_H #define MUON_MUONLAYERSEGMENTFINDERTOOL_H -#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinderTool.h" #include "MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h" - -#include <vector> - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecToolInterfaces/IMuonSegmentMaker.h" +#include "MuonRecToolInterfaces/IMuonPRDSelectionTool.h" +#include "CscSegmentMakers/ICscSegmentFinder.h" +#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinder.h" +#include "MuonHoughPatternTools/MuonLayerHoughTool.h" #include "MuonLayerEvent/MuonSystemExtension.h" #include "MuonDetDescrUtils/MuonSectorMapping.h" +#include "MuonSegmentMakerToolInterfaces/IMuonClusterSegmentFinderTool.h" +#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" -#include "MuonHoughPatternTools/MuonLayerHoughTool.h" +#include <string> +#include <vector> -class ICscSegmentFinder; namespace Muon { class MuonSegment; struct MuonLayerPrepRawData; class MuonLayerROTs; - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class IMuonPRDSelectionTool; - class IMuonSegmentMaker; - class IMuonClusterSegmentFinder; - class IMuonClusterSegmentFinderTool; - class IMuonRecoValidationTool; class MdtDriftCircleOnTrack; class MuonClusterOnTrack; class MuonLayerSegmentFinderTool : virtual public IMuonLayerSegmentFinderTool, public AthAlgTool { @@ -38,9 +37,8 @@ namespace Muon { /** Default AlgTool functions */ MuonLayerSegmentFinderTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonLayerSegmentFinderTool(); + virtual ~MuonLayerSegmentFinderTool()=default; StatusCode initialize(); - StatusCode finalize(); /**IMuonLayerSegmentFinderTool interface: find */ void find( const MuonSystemExtension::Intersection& intersection, std::vector< std::shared_ptr<const Muon::MuonSegment> >& segments, MuonLayerPrepRawData& layerPrepRawData ) const; @@ -71,8 +69,7 @@ namespace Muon { SG::ReadHandleKey<MuonLayerHoughTool::HoughDataPerSectorVec> m_houghDataPerSectorVecKey {this, "Key_MuonLayerHoughToolHoughDataPerSectorVec", "HoughDataPerSectorVec", "HoughDataPerSectorVec key"}; - /** tool handles */ - ToolHandle<MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<MuonEDMPrinterTool> m_printer; ToolHandle<IMuonPRDSelectionTool> m_muonPRDSelectionTool; ToolHandle<IMuonSegmentMaker> m_segmentMaker; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h index 50cf771acd462cc814900a2c852a8d1131282bdd..9e2f5470f679491e7fa23e060e113d3c4ab54277 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h @@ -1,44 +1,32 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONPATTERNCALIBRATION_H #define MUON_MUONPATTERNCALIBRATION_H -#include <string> -#include <map> -#include <vector> - +#include "MuonSegmentMakerToolInterfaces/IMuonPatternCalibration.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonSegmentMakerToolInterfaces/IMuonPatternCalibration.h" - +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" - #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/MuonPatternCombination.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" - #include "MuonIdHelpers/IMuonIdHelperSvc.h" -class MdtPrepData; +#include <string> +#include <map> +#include <vector> -namespace Trk { - class RIO_OnTrack; - class PrepRawData; -} +class MdtPrepData; namespace Muon { - class MuonPatternCombination; class MdtPrepData; class MuonClusterOnTrack; class MdtDriftCircleOnTrack; - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class IMuonPatternSegmentAssociationTool; class MuonPatternCalibration : virtual public IMuonPatternCalibration, public AthAlgTool { @@ -89,7 +77,7 @@ namespace Muon { public: MuonPatternCalibration(const std::string&, const std::string&, const IInterface*); - virtual ~MuonPatternCalibration(); + virtual ~MuonPatternCalibration()=default; virtual StatusCode initialize(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h index 343dcd0367bfc5390c80085fd7a290be5fb4be43..824fedea065dc8882a9b92abac04b6abd6f7c61a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h @@ -1,19 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ + #ifndef MUON_MUONPATTERNSEGMENTMAKER_MUONPATTERNSEGMENTMAKER_H #define MUON_MUONPATTERNSEGMENTMAKER_MUONPATTERNSEGMENTMAKER_H -#include <string> -#include <map> -#include <vector> - +#include "MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "StoreGate/StoreGateSvc.h" - -#include "MuonSegmentMakerToolInterfaces/IMuonPatternSegmentMaker.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "MuonRecToolInterfaces/IMuonSegmentMaker.h" @@ -23,35 +21,17 @@ #include "MuonPattern/MuonPatternCombinationCollection.h" #include "MuonPattern/MuonPatternCombination.h" - -#include "Identifier/Identifier.h" - -class StoreGate; -class MsgStream; +#include <string> +#include <map> +#include <vector> class MdtPrepData; -class RpcIdHelper; -class MdtIdHelper; -class CscIdHelper; -class TgcIdHelper; -class StoreGateSvc; -class Identifier; - - -namespace Trk { - class RIO_OnTrack; - class PrepRawData; -} - namespace Muon { - class MuonPatternCombination; class MdtPrepData; class MuonClusterOnTrack; class MdtDriftCircleOnTrack; class MuonSegment; - class MuonIdHelperTool; - class MuonEDMPrinterTool; class MuonPatternSegmentMaker : virtual public IMuonPatternSegmentMaker, public AthAlgTool { @@ -111,10 +91,9 @@ namespace Muon { public: MuonPatternSegmentMaker(const std::string&, const std::string&, const IInterface*); - virtual ~MuonPatternSegmentMaker(); + virtual ~MuonPatternSegmentMaker()=default; virtual StatusCode initialize(); - virtual StatusCode finalize(); void find( const MuonPatternCombination& pattern, const std::vector<const RpcPrepDataCollection*>& rpcCols, const std::vector<const TgcPrepDataCollection*>& tgcCols, Trk::SegmentCollection* segColl) const; @@ -150,7 +129,7 @@ namespace Muon { ToolHandle<IMuonClusterOnTrackCreator> m_clusterCreator; //<! pointer to muon cluster rio ontrack creator ToolHandle<MuonEDMPrinterTool> m_printer; //<! tool to print EDM objects - ToolHandle<MuonIdHelperTool> m_idHelper; //<! tool to interpret and print Identifiers + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; bool m_doNtuple; //<! write ntuple for standalone pattern finding bool m_doMultiAnalysis; //<! use neighbouring chambers during segment finding diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx index 7484369b67b37df7b80e2ad0c8282795b7c95db3..da0ea5a6456d62eb7f91727f9a68e50c155a00d5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx @@ -1,29 +1,23 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "MuonPatternSegmentMaker/MuonPatternCalibration.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include <iostream> -#include <sstream> -#include <vector> -#include <map> -#include <set> +#include "MuonPatternSegmentMaker/MuonPatternCalibration.h" #include "MuonPattern/MuonPatternChamberIntersect.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "TrkToolInterfaces/IRIO_OnTrackCreator.h" -namespace Muon { +#include <iostream> +#include <sstream> +#include <set> +namespace Muon { MuonPatternCalibration::MuonPatternCalibration(const std::string& t,const std::string& n,const IInterface* p) : AthAlgTool(t,n,p), @@ -48,23 +42,14 @@ namespace Muon { declareProperty("RemoveDoubleMdtHits",m_removeDoubleMdtHits = true); } - MuonPatternCalibration::~MuonPatternCalibration() - { - } - StatusCode MuonPatternCalibration::initialize() { - if( AthAlgTool::initialize().isFailure() ) return StatusCode::FAILURE; - ATH_MSG_VERBOSE("MuonPatternCalibration::Initializing"); - ATH_CHECK(m_mdtCreator.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_clusterCreator.retrieve()); - ATH_CHECK(m_keyRpc.initialize()); ATH_CHECK(m_keyTgc.initialize()); - return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx index dba1cb4741562cd5ca691ed57e8e50db1889a8d6..7475b3128a76dfabb82f17a56a4183770cbda953 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx @@ -1,38 +1,24 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonPatternSegmentMaker/MuonPatternSegmentMaker.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -#include <iostream> -#include <sstream> -#include <vector> -#include <map> -#include <set> -#include <utility> - #include "MuonPattern/MuonPatternChamberIntersect.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" - #include "MuonSegment/MuonSegment.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" - #include "TrkSegment/SegmentCollection.h" #include "TrkParameters/TrackParameters.h" #include "TrkToolInterfaces/IRIO_OnTrackCreator.h" +#include <iostream> +#include <sstream> +#include <set> +#include <utility> + namespace Muon { MuonPatternSegmentMaker::MuonPatternSegmentMaker(const std::string& t,const std::string& n,const IInterface* p) : @@ -40,8 +26,7 @@ namespace Muon { m_segmentMaker("Muon::DCMathSegmentMaker/DCMathSegmentMaker", this), m_mdtCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", this), m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator", this), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { declareInterface<IMuonPatternSegmentMaker>(this); @@ -58,38 +43,13 @@ namespace Muon { declareProperty("RemoveDoubleMdtHits",m_removeDoubleMdtHits = true); } - MuonPatternSegmentMaker::~MuonPatternSegmentMaker() - { - } - StatusCode MuonPatternSegmentMaker::initialize() { - - if( m_mdtCreator.retrieve().isFailure() ){ - ATH_MSG_FATAL("Could not get " << m_mdtCreator); - return StatusCode::FAILURE; - } - - if( m_printer.retrieve().isFailure() ){ - ATH_MSG_FATAL("Could not get " << m_printer); - return StatusCode::FAILURE; - } - - if( m_idHelper.retrieve().isFailure() ){ - ATH_MSG_FATAL("Could not get " << m_idHelper); - return StatusCode::FAILURE; - } - - if( m_segmentMaker.retrieve().isFailure() ){ - ATH_MSG_FATAL("Could not get " << m_segmentMaker); - return StatusCode::FAILURE; - } - - if( m_clusterCreator.retrieve().isFailure() ){ - ATH_MSG_FATAL("Could not get " << m_clusterCreator); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_mdtCreator.retrieve()); + ATH_CHECK(m_printer.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_segmentMaker.retrieve()); + ATH_CHECK(m_clusterCreator.retrieve()); return StatusCode::SUCCESS; } @@ -183,7 +143,7 @@ namespace Muon { m_segmentMaker->find(rios,segColl); } - ATH_MSG_VERBOSE(" search in " << m_idHelper->toStringChamber(mdtit->front()->identify()) << " nhits " << mdtit->size()); + ATH_MSG_VERBOSE(" search in " << m_idHelperSvc->toStringChamber(mdtit->front()->identify()) << " nhits " << mdtit->size()); if(segColl->empty()){ ATH_MSG_VERBOSE(" no segments found "); } @@ -198,21 +158,14 @@ namespace Muon { } - - StatusCode MuonPatternSegmentMaker::finalize() - { - return StatusCode::SUCCESS; - } - int MuonPatternSegmentMaker::getRegionId( const Identifier& id ) const { // simple division of MuonSpectrometer in regions using barrel/endcap seperation plus // inner/middle/outer seperation - int stIndex = (int)m_idHelper->stationIndex(id); - //int sector = m_idHelper->sector(id); - int eta = m_idHelper->stationEta( id ); + int stIndex = (int)m_idHelperSvc->stationIndex(id); + int eta = m_idHelperSvc->stationEta( id ); int regionId = stIndex; if( eta < 0 ) regionId *= -1; @@ -227,7 +180,7 @@ namespace Muon { for (; it!=pat.chamberData().end(); ++it) { std::vector< const Trk::PrepRawData* >::const_iterator pit = (*it).prepRawDataVec().begin(); for (; pit!=(*it).prepRawDataVec().end(); ++pit) { - if( m_idHelper->measuresPhi((*pit)->identify()) ) { + if( m_idHelperSvc->measuresPhi((*pit)->identify()) ) { return true; } } @@ -320,7 +273,7 @@ namespace Muon { clusterIds.insert(id); if( m_recoverTriggerHits ){ - bool measuresPhi = m_idHelper->measuresPhi(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); unsigned int colHash = clus->collectionHash(); EtaPhiHits& hitsPerChamber = etaPhiHitsPerChamber[colHash]; @@ -336,7 +289,7 @@ namespace Muon { for( ;chit!=chit_end;++chit ){ EtaPhiHits& hits = chit->second; if( (hits.neta > 0 && hits.nphi == 0) || (hits.nphi > 0 && hits.neta == 0) ){ - if( m_idHelper->isRpc(id) && !rpcCols.empty() ){ + if( m_idHelperSvc->isRpc(id) && !rpcCols.empty() ){ std::vector<const RpcPrepDataCollection*>::const_iterator rcvit=rpcCols.begin(); for( ;rcvit!=rpcCols.end();++rcvit){ if((*rcvit)->identifyHash()==chit->first){ @@ -354,7 +307,7 @@ namespace Muon { if( rcvit == rpcCols.end() ){ ATH_MSG_DEBUG(" RpcPrepDataCollection not found in container!! "); } - }else if( m_idHelper->isTgc(id) && !tgcCols.empty()){ + }else if( m_idHelperSvc->isTgc(id) && !tgcCols.empty()){ std::vector<const TgcPrepDataCollection*>::const_iterator tcvit=tgcCols.begin(); for( ;tcvit!=tgcCols.end();++tcvit){ if((*tcvit)->identifyHash()==chit->first){ @@ -385,7 +338,7 @@ namespace Muon { const Identifier& id = clus.identify(); // check whether we are measuring phi or eta - bool measuresPhi = m_idHelper->measuresPhi(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); Amg::Vector3D globalpos = clus.globalPosition(); Amg::Vector3D intersect; @@ -421,12 +374,12 @@ namespace Muon { const TgcPrepData* tgc = dynamic_cast<const TgcPrepData*>( &clus ); if( !tgc ) return; - int gasGap = m_idHelper->tgcIdHelper().gasGap(id); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(id); if( measuresPhi){ hasPointingPhiStrips = true; striplen = tgc->detectorElement()->StripLength(gasGap); }else{ - int wire = m_idHelper->tgcIdHelper().channel(id); + int wire = m_idHelperSvc->tgcIdHelper().channel(id); striplen = tgc->detectorElement()->WireLength(gasGap,wire); } } @@ -449,7 +402,7 @@ namespace Muon { if( (intersect - piOnPlane).mag() > m_dropDistance || dif.mag() > 0.5*striplen + m_dropDistance ){ ATH_MSG_VERBOSE(" >>>> extrapolated position far outside volume, dropping hit " - << m_idHelper->toString( id ) << std::endl + << m_idHelperSvc->toString( id ) << std::endl << " dist along strip " << dif.mag() << " 1/2 strip len " << 0.5*striplen << " dist measurement plane " << (intersect - piOnPlane).mag()); return; @@ -458,7 +411,7 @@ namespace Muon { Amg::Vector3D newpos = globalpos - dif*(0.5*striplen/dif.mag()); ATH_MSG_VERBOSE(" >>>> extrapolated position outside volume, shifting position " - << m_idHelper->toString( id ) << std::endl + << m_idHelperSvc->toString( id ) << std::endl << " position along strip " << dif.mag() << " 1/2 tube len " << 0.5*striplen << " dist To strip " << (intersect - piOnPlane).mag() << std::endl << " dist to newpos " << (newpos-globalpos).mag() << " pos " << newpos); @@ -508,7 +461,7 @@ namespace Muon { const Amg::Vector3D& planepostion = tubePos; // always project on plane with normal in radial direction - Amg::Vector3D planenormal = !m_idHelper->isEndcap(id) ? + Amg::Vector3D planenormal = !m_idHelperSvc->isEndcap(id) ? amdbToGlobal.linear()*Amg::Vector3D(0.,0.,1.) : amdbToGlobal.linear()*Amg::Vector3D(0.,1.,0.); double denom = patdire.dot(planenormal); @@ -521,13 +474,13 @@ namespace Muon { intersect = amdbToGlobal*Amg::Vector3D( lpiOnPlane.x(), ltubePos.y(), ltubePos.z() ); Amg::Vector3D dif = tubePos - intersect; - double tubelen = detEl->getActiveTubeLength( m_idHelper->mdtIdHelper().tubeLayer(id),m_idHelper->mdtIdHelper().tube(id) ); + double tubelen = detEl->getActiveTubeLength( m_idHelperSvc->mdtIdHelper().tubeLayer(id),m_idHelperSvc->mdtIdHelper().tube(id) ); if( dif.mag() > 0.5*tubelen ){ Amg::Vector3D newpos = tubePos - dif*(0.5*tubelen/dif.mag()); ATH_MSG_VERBOSE(" >>>> extrapolated position outside volume, shifting position " - << m_idHelper->toString( id ) << std::endl + << m_idHelperSvc->toString( id ) << std::endl << " position along strip " << dif.mag() << " 1/2 tube len " << 0.5*tubelen << " dist To Wire " << (piOnPlane-intersect).mag() << std::endl << " dist to newpos " << (newpos-tubePos).mag() << " pos " << newpos); @@ -540,40 +493,40 @@ namespace Muon { } // enter hit in map - Identifier elId = m_idHelper->mdtIdHelper().elementID( id ); + Identifier elId = m_idHelperSvc->mdtIdHelper().elementID( id ); - MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(elId); + MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(elId); int chFlag = elId.get_identifier32().get_compact(); if( m_doMultiAnalysis ){ - if( m_idHelper->isSmallChamber(id) ){ - ATH_MSG_VERBOSE(" Small chamber " << m_idHelper->toString( elId )); + if( m_idHelperSvc->isSmallChamber(id) ){ + ATH_MSG_VERBOSE(" Small chamber " << m_idHelperSvc->toString( elId )); chFlag = 0; if( chIndex == MuonStationIndex::BIS ){ - int eta = m_idHelper->stationEta(elId); + int eta = m_idHelperSvc->stationEta(elId); if( abs(eta) == 8 ) { - ATH_MSG_VERBOSE(" BIS8 chamber " << m_idHelper->toString( elId )); + ATH_MSG_VERBOSE(" BIS8 chamber " << m_idHelperSvc->toString( elId )); chFlag = 3; } } }else{ - ATH_MSG_VERBOSE(" Large chamber " << m_idHelper->toString( elId )); + ATH_MSG_VERBOSE(" Large chamber " << m_idHelperSvc->toString( elId )); chFlag = 1; if( chIndex == MuonStationIndex::BIL ){ - std::string stName = m_idHelper->chamberNameString(id); + std::string stName = m_idHelperSvc->chamberNameString(id); if( stName[2] == 'R' ){ - ATH_MSG_VERBOSE(" BIR chamber " << m_idHelper->toString( elId )); + ATH_MSG_VERBOSE(" BIR chamber " << m_idHelperSvc->toString( elId )); chFlag = 2; } } else if( chIndex == MuonStationIndex::BOL ){ - if( abs( m_idHelper->stationEta(id) ) == 7 ){ - ATH_MSG_VERBOSE(" BOE chamber " << m_idHelper->toString( elId )); + if( abs( m_idHelperSvc->stationEta(id) ) == 7 ){ + ATH_MSG_VERBOSE(" BOE chamber " << m_idHelperSvc->toString( elId )); chFlag = 4; } } } - int phi = m_idHelper->stationPhi(id); + int phi = m_idHelperSvc->stationPhi(id); chFlag += 10*phi; } @@ -630,31 +583,31 @@ namespace Muon { RegionMapCit mit = regionMap.begin(); RegionMapCit mit_end = regionMap.end(); - msg(MSG::INFO) << "Summarizing input " << std::endl; + ATH_MSG_INFO("Summarizing input "); for( ; mit!=mit_end;++mit ){ - msg(MSG::INFO) << "new region " << mit->first << " trigger " << mit->second.triggerPrds.size() - << " mdt ch " << mit->second.mdtPrdsPerChamber.size() << std::endl; + ATH_MSG_INFO("new region " << mit->first << " trigger " << mit->second.triggerPrds.size() + << " mdt ch " << mit->second.mdtPrdsPerChamber.size()); - if( !mit->second.triggerPrds.empty() ) msg(MSG::INFO) << " trigger hits " << mit->second.triggerPrds.size() << std::endl; + if( !mit->second.triggerPrds.empty() ) ATH_MSG_INFO(" trigger hits " << mit->second.triggerPrds.size()); ISPrdIt pit = mit->second.triggerPrds.begin(); ISPrdIt pit_end = mit->second.triggerPrds.end(); for( ;pit!=pit_end;++pit ){ - msg(MSG::INFO) << " " << m_printer->print(*(pit->second)) << std::endl; + ATH_MSG_INFO(" " << m_printer->print(*(pit->second))); } RegionIdMapIt idit = mit->second.mdtPrdsPerChamber.begin(); RegionIdMapIt idit_end = mit->second.mdtPrdsPerChamber.end(); for( ;idit!=idit_end;++idit ){ - msg(MSG::INFO) << " new MDT chamber with " << idit->second.size() << " hits" << std::endl; + ATH_MSG_INFO(" new MDT chamber with " << idit->second.size() << " hits"); ISPrdMdtIt mdtit = idit->second.begin(); ISPrdMdtIt mdtit_end = idit->second.end(); for( ;mdtit!=mdtit_end;++mdtit ){ const MdtPrepData* prd = mdtit->second; - msg(MSG::INFO) << " " << m_printer->print(*prd) << std::endl; + ATH_MSG_INFO(" " << m_printer->print(*prd)); } } } @@ -705,7 +658,7 @@ namespace Muon { const MdtDriftCircleOnTrack* mdt = m_mdtCreator->createRIO_OnTrack( *prd, mdtit->first, &dr ); if( !mdt ) { - ATH_MSG_VERBOSE(" Failed to calibrate " << m_idHelper->toString(prd->identify())); + ATH_MSG_VERBOSE(" Failed to calibrate " << m_idHelperSvc->toString(prd->identify())); continue; } mdtROTs.push_back( mdt ); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h index ab78154f3bc7052e52a99c0caf09f8dc7ce6b119..f3f056dc874ba3f5086d6723cce6d44c1ffe17fe 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h @@ -1,41 +1,31 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonSegmentCleaner_MuonPhiHitSelector_H #define MuonSegmentCleaner_MuonPhiHitSelector_H -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonRecToolInterfaces/IMuonHitSelector.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class Identifier; -namespace MuonGM { - class MuonDetectorManager; -} +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" namespace Trk { class PrepRawData; class RIO_OnTrack; } - class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelector { public: - /** constructor */ MuonPhiHitSelector(const std::string&,const std::string&,const IInterface*); - /** destructor */ - virtual ~MuonPhiHitSelector(); + virtual ~MuonPhiHitSelector()=default; - /** to initiate private members */ virtual StatusCode initialize(); - /** to delete private members */ - virtual StatusCode finalize(); /** @brief Selects and builds a cleaned vector of RIO fits the associatedHits and build new RIOs, if m_competingRios true then for ambiguous hits competing rios are built @@ -47,9 +37,8 @@ class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelec virtual double getPhi()const; private: + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; /** Toolhandle to CompetingRIOsOnTrackTool creator */ ToolHandle<Muon::IMuonCompetingClustersOnTrackCreator> m_competingRIOsOnTrackTool; /** Toolhandle to ClusterOnTrackTool creator */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonSegmentAmbiCleaner.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonSegmentAmbiCleaner.h index 2bc9d86e5408571c6dff00953c1a31179361f6b9..ec6b33dc2aea3c0ce948332183a3f903fe29414b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonSegmentAmbiCleaner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonSegmentAmbiCleaner.h @@ -1,44 +1,26 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonSegmentCleaner_MuonSegmentAmbiCleaner_H #define MuonSegmentCleaner_MuonSegmentAmbiCleaner_H -#include "AthenaBaseComps/AthAlgTool.h" #include "MuonRecToolInterfaces/IMuonSegmentCleaner.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class RpcIdHelper; -class MdtIdHelper; -class CscIdHelper; -class TgcIdHelper; -class Identifier; +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { class MuonSegment; } -namespace MuonGM { - class MuonDetectorManager; -} - -namespace Trk { - class RIO_OnTrack; - class PrepRawData; -} class MuonSegmentAmbiCleaner : public AthAlgTool, virtual public Muon::IMuonSegmentCleaner { public: - /** constructor */ MuonSegmentAmbiCleaner(const std::string&,const std::string&,const IInterface*); - /** destructor */ - virtual ~MuonSegmentAmbiCleaner(); + virtual ~MuonSegmentAmbiCleaner()=default; - /** to initiate private members */ virtual StatusCode initialize(); - /** to delete private members */ - virtual StatusCode finalize(); /** For one segment solve ambiguous RPC and TGC hits: different eta but same phi using the MDT extrapolated segment @@ -48,8 +30,7 @@ class MuonSegmentAmbiCleaner : public AthAlgTool, virtual public Muon::IMuonSegm private: - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** flag to print out debugging information */ bool m_debug; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx index 2f77dfb991b37a37b0ba16dac7147e69f386e302..ed416fa16fbcd03c7a21596d3f1a5bab0224aff5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx @@ -1,45 +1,37 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentCleaner/MuonPhiHitSelector.h" -#include <sstream> -#include <iostream> -#include <vector> -#include <list> -#include <ctime> -#include <Eigen/LU> #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" - #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" - #include "MuonPrepRawData/MuonCluster.h" - #include "TrkSurfaces/PlaneSurface.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkPrepRawData/PrepRawData.h" -//#include "TrkParameters/Perigee.h" - #include "CxxUtils/sincos.h" -MuonPhiHitSelector::MuonPhiHitSelector(const std::string& type,const std::string& name,const IInterface* parent):AthAlgTool(type,name,parent),m_competingRIOsOnTrackTool ("Muon::MuonCompetingClustersOnTrackCreator/MuonCompetingClustersOnTrackCreator"),m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"),m_phi(0) - //,m_cosmics(false),m_debug(false),m_summary(false) -{ +#include <sstream> +#include <iostream> +#include <vector> +#include <list> +#include <ctime> +#include <Eigen/LU> + +MuonPhiHitSelector::MuonPhiHitSelector(const std::string& type,const std::string& name,const IInterface* parent) : + AthAlgTool(type,name,parent), + m_competingRIOsOnTrackTool("Muon::MuonCompetingClustersOnTrackCreator/MuonCompetingClustersOnTrackCreator"), + m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), + m_phi(0) { declareInterface<IMuonHitSelector>(this); m_cosmics = false; @@ -59,27 +51,13 @@ MuonPhiHitSelector::MuonPhiHitSelector(const std::string& type,const std::string declareProperty("CompetingRios",m_competingRios); } -MuonPhiHitSelector::~MuonPhiHitSelector() -{ -} - StatusCode MuonPhiHitSelector::initialize() { ATH_MSG_VERBOSE(" MuonPhiHitSelector::Initializing "); - ATH_CHECK( m_competingRIOsOnTrackTool.retrieve() ); - ATH_CHECK( m_clusterCreator.retrieve() ); - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_MSG_VERBOSE("End of Initializing"); - - return StatusCode::SUCCESS; -} - -StatusCode MuonPhiHitSelector::finalize() -{ return StatusCode::SUCCESS; } @@ -120,42 +98,19 @@ std::vector<const Trk::MeasurementBase*>* MuonPhiHitSelector::select_rio( const Identifier id = prd->identify(); phiId[nphi] = id; Amg::Vector3D gHitPos = (*it)->globalPosition(); - // RPC code - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id) ) { - // const Muon::RpcClusterOnTrack* crot = dynamic_cast<const Muon::RpcClusterOnTrack*>(*it); - // if( !crot ) { - // ATH_MSG_WARNING("This is not a RpcClusterOnTrack!!! "); - // continue; - // } - // gHitPos = crot->globalPosition(); + if (m_idHelperSvc->isRpc(id) ) { phiSelect[nphi] = 1; } - - // TGC code - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) { - // const Muon::TgcClusterOnTrack* crot = dynamic_cast<const Muon::TgcClusterOnTrack*>(*it); - // if( !crot ){ - // ATH_MSG_WARNING("This is not a TgcClusterOnTrack!!! "); - // continue; - // } - // gHitPos = crot->globalPosition(); + else if (m_idHelperSvc->isTgc(id)) { phiSelect[nphi] = 2; } - // CSC code - else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { - // const Muon::CscClusterOnTrack* crot = dynamic_cast<const Muon::CscClusterOnTrack*>(*it); - // if( !crot ){ - // ATH_MSG_WARNING("This is not a CscClusterOnTrack!!! "); - // continue; - // } - // gHitPos = crot->globalPosition(); + else if (m_idHelperSvc->isCsc(id)) { phiSelect[nphi] = 3; } phiHitx[nphi] = gHitPos.x(); phiHity[nphi] = gHitPos.y(); phiHitz[nphi] = gHitPos.z(); - //double error = (*it)->localErrorMatrix().covariance().fast(1,1); const Amg::MatrixX& cov = (*it)->localCovariance(); double error = cov(0,0); @@ -200,9 +155,9 @@ std::vector<const Trk::MeasurementBase*>* MuonPhiHitSelector::select_rio( const if (phiMapId.count(id) > 0) continue; const Muon::MuonCluster* clus = dynamic_cast<const Muon::MuonCluster*>(*itu); if( !clus ) continue; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) phiSelect[nphi] = 1; - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) phiSelect[nphi] = 2; - else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) phiSelect[nphi] = 3; + if (m_idHelperSvc->isRpc(id)) phiSelect[nphi] = 1; + else if (m_idHelperSvc->isTgc(id)) phiSelect[nphi] = 2; + else if (m_idHelperSvc->isCsc(id)) phiSelect[nphi] = 3; Amg::Vector3D gHitPos = clus->globalPosition(); phiHitx[nphi] = gHitPos.x(); phiHity[nphi] = gHitPos.y(); @@ -223,32 +178,8 @@ std::vector<const Trk::MeasurementBase*>* MuonPhiHitSelector::select_rio( const // Define global track parameters (not used 27-8 JS) - // double aver_r = 0.; - // double aver_z = 0.; - // for(int i = 0; i < nphi ; ++i ) { - // if (phiSelect[i]>0) { - // aver_r += sqrt(phiHitx[i]*phiHitx[i]+phiHity[i]*phiHity[i] ); - // aver_z += phiHitz[i]; - // } - // } - // double avtheta = atan2(aver_r,aver_z); - // double sincosm_phi[2]; - // sincos(m_phi,&sincosm_phi[0],&sincosm_phi[1]); - // double sincos_avtheta[2]; - // sincos(avtheta,&sincos_avtheta[0],&sincos_avtheta[1]); - - // const Trk::GlobalMomentum globPatDir = Trk::GlobalMomentum ( pmom*sincosm_phi[1]*sincos_avtheta[0], pmom*sincosm_phi[0]*sincos_avtheta[0], pmom*sincos_avtheta[1] ); - // const Trk::GlobalPosition globPatPos = Trk::GlobalPosition (r0*sincosm_phi[0],-r0*sincosm_phi[1],0.); - - // const Trk::Perigee perigee = Trk::Perigee (globPatPos, globPatDir, 1., Trk::GlobalPosition(0.,0.,0.)); - for(int i = 0; i < nphi ; ++i ) { if (phiSelect[i]>0) { - // std::list <const Trk::PrepRawData*> prdList; - // prdList.push_back(phiPrep[i]); - // const Trk::CompetingRIOsOnTrack* rio = m_competingRIOsOnTrackTool->createBroadCluster(prdList,1.); - // if (m_debug) std::cout << " Make ONE competing rio/cluster per PrepData: number of rios " << prdList.size() << std::endl; - // if (rio) selectedHits->push_back(rio); if (phiSelect[i] == 1) { const Muon::RpcPrepData* prd = dynamic_cast <const Muon::RpcPrepData*> (phiPrep[i]); const Amg::Vector3D globalpos(phiHitx[i],phiHity[i],phiHitz[i]); @@ -430,20 +361,20 @@ void MuonPhiHitSelector::clusterPhi( const std::vector<Identifier> & id, const for(int i = 0; i < n ; ++i ) { Identifier idi = id[i]; int code = 0; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc( idi )) { - int doubZ = m_muonIdHelperTool->rpcIdHelper().doubletZ(idi); - int doubPhi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(idi); - code = 100000000*(m_muonIdHelperTool->rpcIdHelper().stationName(idi))+1000000*(m_muonIdHelperTool->rpcIdHelper().stationPhi(idi))+ 10000* ((m_muonIdHelperTool->rpcIdHelper().stationEta(idi))+1000); + if (m_idHelperSvc->isRpc( idi )) { + int doubZ = m_idHelperSvc->rpcIdHelper().doubletZ(idi); + int doubPhi = m_idHelperSvc->rpcIdHelper().doubletPhi(idi); + code = 100000000*(m_idHelperSvc->rpcIdHelper().stationName(idi))+1000000*(m_idHelperSvc->rpcIdHelper().stationPhi(idi))+ 10000* ((m_idHelperSvc->rpcIdHelper().stationEta(idi))+1000); code += 1000*(doubZ-1) + 100*(doubPhi-1); - code += 2*((m_muonIdHelperTool->rpcIdHelper().doubletR(idi))-1) + 16*((m_muonIdHelperTool->rpcIdHelper().gasGap(idi))-1) ; + code += 2*((m_idHelperSvc->rpcIdHelper().doubletR(idi))-1) + 16*((m_idHelperSvc->rpcIdHelper().gasGap(idi))-1) ; } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc( idi )) { - code = 1000000*(m_muonIdHelperTool->tgcIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->tgcIdHelper().stationPhi(idi))+ 100* ((m_muonIdHelperTool->tgcIdHelper().stationEta(idi))+10); - code = code + m_muonIdHelperTool->tgcIdHelper().gasGap(idi); + else if (m_idHelperSvc->isTgc( idi )) { + code = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(idi))+10000*(m_idHelperSvc->tgcIdHelper().stationPhi(idi))+ 100* ((m_idHelperSvc->tgcIdHelper().stationEta(idi))+10); + code = code + m_idHelperSvc->tgcIdHelper().gasGap(idi); } - else if (m_muonIdHelperTool->cscIdHelper().is_csc( idi )) { - code = 1000000*(m_muonIdHelperTool->cscIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->cscIdHelper().stationPhi(idi))+ 100* ((m_muonIdHelperTool->cscIdHelper().stationEta(idi))+10); - code = code + m_muonIdHelperTool->cscIdHelper().wireLayer(idi); + else if (m_idHelperSvc->isCsc( idi )) { + code = 1000000*(m_idHelperSvc->cscIdHelper().stationName(idi))+10000*(m_idHelperSvc->cscIdHelper().stationPhi(idi))+ 100* ((m_idHelperSvc->cscIdHelper().stationEta(idi))+10); + code = code + m_idHelperSvc->cscIdHelper().wireLayer(idi); } scode[i] = code; } @@ -499,7 +430,6 @@ void MuonPhiHitSelector::clusterPhi( const std::vector<Identifier> & id, const } clusterHits[ic]++; if (clusterHits[ic] == 1) clusterCommon2Error[ic]= 0.; - // error[i]*error[i] - error0[i]*error0[i] ; } } } @@ -549,31 +479,31 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif Identifier idi = phiId[i]; int code = 0; int rcode = 0; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc( idi )) { - code = 1000000*(m_muonIdHelperTool->rpcIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->rpcIdHelper().stationPhi(idi))+ 100* ((m_muonIdHelperTool->rpcIdHelper().stationEta(idi))+10); - code = code + 2*((m_muonIdHelperTool->rpcIdHelper().doubletR(idi))-1)+16*((m_muonIdHelperTool->rpcIdHelper().gasGap(idi))-1); - rcode = 1000000*(m_muonIdHelperTool->rpcIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->rpcIdHelper().stationPhi(idi))+ 0* ((m_muonIdHelperTool->rpcIdHelper().stationEta(idi))+10); - rcode = rcode + 2*((m_muonIdHelperTool->rpcIdHelper().doubletR(idi))-1)+16*((m_muonIdHelperTool->rpcIdHelper().gasGap(idi))-1); + if (m_idHelperSvc->isRpc( idi )) { + code = 1000000*(m_idHelperSvc->rpcIdHelper().stationName(idi))+10000*(m_idHelperSvc->rpcIdHelper().stationPhi(idi))+ 100* ((m_idHelperSvc->rpcIdHelper().stationEta(idi))+10); + code = code + 2*((m_idHelperSvc->rpcIdHelper().doubletR(idi))-1)+16*((m_idHelperSvc->rpcIdHelper().gasGap(idi))-1); + rcode = 1000000*(m_idHelperSvc->rpcIdHelper().stationName(idi))+10000*(m_idHelperSvc->rpcIdHelper().stationPhi(idi))+ 0* ((m_idHelperSvc->rpcIdHelper().stationEta(idi))+10); + rcode = rcode + 2*((m_idHelperSvc->rpcIdHelper().doubletR(idi))-1)+16*((m_idHelperSvc->rpcIdHelper().gasGap(idi))-1); } - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc( idi )) { - code = 1000000*(m_muonIdHelperTool->tgcIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->tgcIdHelper().stationPhi(idi))+ 100* ((m_muonIdHelperTool->tgcIdHelper().stationEta(idi))+10); - code = code + m_muonIdHelperTool->tgcIdHelper().gasGap(idi); - rcode = 1000000*(m_muonIdHelperTool->tgcIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->tgcIdHelper().stationPhi(idi))+ 0* ((m_muonIdHelperTool->tgcIdHelper().stationEta(idi))+10); - rcode = rcode + m_muonIdHelperTool->tgcIdHelper().gasGap(idi); + else if (m_idHelperSvc->isTgc( idi )) { + code = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(idi))+10000*(m_idHelperSvc->tgcIdHelper().stationPhi(idi))+ 100* ((m_idHelperSvc->tgcIdHelper().stationEta(idi))+10); + code = code + m_idHelperSvc->tgcIdHelper().gasGap(idi); + rcode = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(idi))+10000*(m_idHelperSvc->tgcIdHelper().stationPhi(idi))+ 0* ((m_idHelperSvc->tgcIdHelper().stationEta(idi))+10); + rcode = rcode + m_idHelperSvc->tgcIdHelper().gasGap(idi); } - else if (m_muonIdHelperTool->cscIdHelper().is_csc( idi )) { - code = 1000000*(m_muonIdHelperTool->cscIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->cscIdHelper().stationPhi(idi))+ 100* ((m_muonIdHelperTool->cscIdHelper().stationEta(idi))+10); - code = code + m_muonIdHelperTool->cscIdHelper().wireLayer(idi); - rcode = 1000000*(m_muonIdHelperTool->cscIdHelper().stationName(idi))+10000*(m_muonIdHelperTool->cscIdHelper().stationPhi(idi))+ 0* ((m_muonIdHelperTool->cscIdHelper().stationEta(idi))+10); - rcode = rcode + m_muonIdHelperTool->cscIdHelper().wireLayer(idi); + else if (m_idHelperSvc->isCsc( idi )) { + code = 1000000*(m_idHelperSvc->cscIdHelper().stationName(idi))+10000*(m_idHelperSvc->cscIdHelper().stationPhi(idi))+ 100* ((m_idHelperSvc->cscIdHelper().stationEta(idi))+10); + code = code + m_idHelperSvc->cscIdHelper().wireLayer(idi); + rcode = 1000000*(m_idHelperSvc->cscIdHelper().stationName(idi))+10000*(m_idHelperSvc->cscIdHelper().stationPhi(idi))+ 0* ((m_idHelperSvc->cscIdHelper().stationEta(idi))+10); + rcode = rcode + m_idHelperSvc->cscIdHelper().wireLayer(idi); } scode[i] = code; srcode[i] = rcode; int idet = 0; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(idi)) idet = 1; - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(idi)) idet = 2; - else if (m_muonIdHelperTool->cscIdHelper().is_csc(idi)) idet = 3; + if (m_idHelperSvc->isRpc(idi)) idet = 1; + else if (m_idHelperSvc->isTgc(idi)) idet = 2; + else if (m_idHelperSvc->isCsc(idi)) idet = 3; phiSelect[i] = idet; phiSelectKeep[i] = idet; } @@ -624,15 +554,14 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif } phiMult[i] = n; double fact = 1.; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) fact = 1.2; - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) n = 1; - else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) n = 1; + if (m_idHelperSvc->isRpc(id)) fact = 1.2; + else if (m_idHelperSvc->isTgc(id)) n = 1; + else if (m_idHelperSvc->isCsc(id)) n = 1; error0[i]=phiError[i]*sqrt(n)*fact; error[i]=phiError[i]*sqrt(n)*fact; double phiHit = atan2 ( phiHity[i], phiHitx[i] ); if (m_debug) { - // std::string st = id.stationNumberToFixedStationString(id.stationName()); std::cout << i << " Station " << int(scode[i]/1000000) << " Hit x " << phiHitx[i] << " Hit y " << phiHity[i] << " Hit z " << phiHitz[i] << " error " << phiError[i] << " phi Hit " << phiHit << std::endl; std::cout << " station " << phiSelect[i] << std::endl; std::cout << " code " << scode[i] << " multiplicity " << n << " error " << error0[i] << " quality " << quality[i] << std::endl; @@ -693,7 +622,6 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif if (m_debug) std::cout << " select " << phiSelect[i] << " quality " << quality[i] << " error " << error[i] << std::endl; } if (m_debug) std::cout << " performing outlier removal for pattern hits " << std::endl; -// fitPhiSL(pfit, phiId, phiHitx, phiHity, phiHitz, error, phiSelect, nphi, phiPull, imax, chi2, r0, phi, errorM , true); fitPhiSL(pfit, phiId, phiHitx, phiHity, phiHitz, error, phiSelect, nphi, phiPull, imax, chi2, r0, phi, errorM , false); for(int i = 0; i < nphi ; ++i ) { if(phiPatSelect[i] == 1) { @@ -789,9 +717,9 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif if ( error[i] != 0 && quality[i] > quacut) { layersRecoHit[srcode[i]]++; if (m_debug) { - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) nrpc++; - else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) ntgc++; - else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) ncsc++; + if (m_idHelperSvc->isRpc(id)) nrpc++; + else if (m_idHelperSvc->isTgc(id)) ntgc++; + else if (m_idHelperSvc->isCsc(id)) ncsc++; } nfit++; } @@ -807,13 +735,11 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif } if (chi2 < 5*(nfit+1) || fabs(phiPull[imax]) < 3.0 ) { - // && chi2max < 25 ) { if (m_debug) std::cout << " Final phi " << phi << " frac " << frac << " chi2 " << chi2 << std::endl; break; } - // quality[imax] = 0; phiSelect[imax] = 0; if (m_debug) { @@ -821,12 +747,6 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif } } - // clusterPhi(phiId, phiHitx, phiHity, phiHitz, error, phiPull, phiSelect, nphi, clusterX, clusterY, clusterZ, clusterError, clusterId, clusterHits, clusterSelect, ncl); - // double r0cl; - // std::vector<double> errorMcl(4); - // double phicl; - // fitPhiSL(pmom, clusterId, clusterX, clusterY, clusterZ, clusterError, clusterSelect, ncl, clusterPull, imax, chi2cl, r0cl, phicl, errorMcl, false); - if (m_debug) { std::cout << " Fit results phi " << phi << " chi2 " << chi2 << " ndof " << nfit << std::endl; std::cout << " Reco RPC " << nrpc << " TGC " << ntgc << " CSC " << ncsc << std::endl; @@ -845,11 +765,7 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector<Identif nshowerdrop++; if (m_debug) std::cout << " Drop shower hit i " << i << " with pull " << pull << " iterations " << niter << " power " << power << std::endl; } - if( phiSelect[i] == 0) { - // quality[i] = 0; - } else { - nacc++; - } + if( phiSelect[i] != 0) nacc++; } if(m_debug) std::cout << " phi hits " << nphi << " selected for fit " << nfit << " iqua " << iqua << " iterations " << niter << " accepted hits " << nacc << " nshower drop " << nshowerdrop << std::endl; } @@ -891,14 +807,8 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector<Identifie double ym = 0.; double dtot = 0.; double em = 0.; -// int nrpc = 0; -// int ntgc = 0; -// int ncsc = 0; for(int i = 0; i < n ; ++i ) { if ( error[i] != 0 && select[i] > 0 ) { -// if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id[i])) nrpc++; -// else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id[i])) ntgc++; -// else if (m_muonIdHelperTool->cscIdHelper().is_csc(id[i])) ncsc++; double inver2 = 1./(error[i]*error[i]); xm += hitx[i]*inver2; ym += hity[i]*inver2; @@ -1030,14 +940,11 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector<Identifie v(i,0) = 0.; for(int j = 0; j < nfit ; ++j ) { double inver2 = 1./(ef[j]*ef[j]); - // std::cout << " xf[j] " << xf [j] << " yf [j] " << yf[j] << " ef[j] " << ef[j] << std::endl; if (i == 0) v(i,0) += yf[j]*inver2; else if (i == 1) v(i,0) += yf[j]*xf[j]*inver2; else if (i > 1 && j > i-2 ) { - // std::cout << " i " << i << " xf[i-2] " << xf [i-2] << std::endl; v(i,0) += yf[j]*(lf[j]-lf[i-2])*inver2; } - // std::cout << " v[i][0] " << v[i][0] << std::endl; } } @@ -1067,11 +974,6 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector<Identifie // Beam spot if ( i == 0 && j == 2*nfit-1) model(i,j) = 1.; } - // if (m_debug) { - // for(int j = 0 ; j < 2*nfit ; ++j ) { - // std::cout << " i " << i << " j " << j << " Matrix model i j " << model[i][j] << std::endl; - // } - // } } // Covariance Inverse of Track parameters @@ -1098,12 +1000,6 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector<Identifie std::cout << " Don't trust fit result " << t(1,0) << " Keep Old result " << std::endl; } if (fabs(t(1,0))> 0.2) return; - - // if (m_debug) { - // for(int i = 0; i < nfit+1 ; ++i ) { - // std::cout << " result i " << i << " parameter t " << t(i,0) << std::endl; - // } - //} // calculate residuals and chi2 std::vector <double> resi(2*nfit); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonSegmentAmbiCleaner.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonSegmentAmbiCleaner.cxx index 5977d12d410f48b977d4e2e67b0d9b5763c1d9b9..473bd8492fa2669bc76df627b697962304a5f273 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonSegmentAmbiCleaner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonSegmentAmbiCleaner.cxx @@ -1,40 +1,31 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentCleaner/MuonSegmentAmbiCleaner.h" -#include "MuonSegment/MuonSegment.h" -#include <sstream> -#include <iostream> -#include <vector> +#include "MuonSegment/MuonSegment.h" #include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" - #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" - #include "TrkEventPrimitives/FitQuality.h" #include "TrkEventPrimitives/LocalDirection.h" #include "EventPrimitives/EventPrimitives.h" - #include "TrkSurfaces/PlaneSurface.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkPrepRawData/PrepRawData.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" +#include <sstream> +#include <iostream> +#include <vector> + MuonSegmentAmbiCleaner::MuonSegmentAmbiCleaner(const std::string& type,const std::string& name,const IInterface* parent):AthAlgTool(type,name,parent) { declareInterface<IMuonSegmentCleaner>(this); @@ -47,36 +38,21 @@ MuonSegmentAmbiCleaner::MuonSegmentAmbiCleaner(const std::string& type,const std } -MuonSegmentAmbiCleaner::~MuonSegmentAmbiCleaner() -{ -} - StatusCode MuonSegmentAmbiCleaner::initialize() { - ATH_MSG_VERBOSE(" MuonSegmentiAmbiCleaner::Initializing "); - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_MSG_VERBOSE("End of Initializing"); return StatusCode::SUCCESS; } -StatusCode MuonSegmentAmbiCleaner::finalize() -{ - return StatusCode::SUCCESS; -} - const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment* segment)const { ATH_MSG_VERBOSE(" Executing MuonSegmentAmbiCleanerTools "); - // unsigned int nRots = segment->numberOfContainedROTs(); - DataVector<const Trk::MeasurementBase>* meas_keep = new DataVector<const Trk::MeasurementBase>(); // create new surface - Trk::PlaneSurface* psf = (segment->associatedSurface()).clone(); Amg::Transform3D globalToLocal = psf->transform().inverse(); Amg::Vector3D lSegmentPos = globalToLocal*(segment->globalPosition()); @@ -148,27 +124,25 @@ const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment const Trk::PrepRawData* prd = rot->prepRawData(); Identifier id = prd->identify(); irio++; - // if (m_debug) std::cout << " Loop over RIOs " << irio << std::endl; - // idSegmentMap[id]= segment; - if( m_muonIdHelperTool->mdtIdHelper().is_mdt( rot->identify() ) ){ + if( m_idHelperSvc->isMdt( rot->identify() ) ){ meas_keep->push_back(rot->clone()); netamdt++; continue; - }else if( m_muonIdHelperTool->rpcIdHelper().is_rpc( rot->identify() ) ){ - if( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) != 1) { + }else if( m_idHelperSvc->isRpc( rot->identify() ) ){ + if( m_idHelperSvc->rpcIdHelper().measuresPhi(id) != 1) { meas_keep->push_back(rot->clone()); netarpc++; continue ; } - }else if( m_muonIdHelperTool->tgcIdHelper().is_tgc( rot->identify() ) ){ - if( m_muonIdHelperTool->tgcIdHelper().isStrip(id) != 1 ) { + }else if( m_idHelperSvc->isTgc( rot->identify() ) ){ + if( m_idHelperSvc->tgcIdHelper().isStrip(id) != 1 ) { meas_keep->push_back(rot->clone()); netatgc++; continue; } - }else if( m_muonIdHelperTool->cscIdHelper().is_csc( rot->identify() ) ){ + }else if( m_idHelperSvc->isCsc( rot->identify() ) ){ meas_keep->push_back(rot->clone()); - if( m_muonIdHelperTool->cscIdHelper().measuresPhi(id) != 1) { + if( m_idHelperSvc->cscIdHelper().measuresPhi(id) != 1) { netacsc++; } else { nphicsc++; @@ -185,12 +159,12 @@ const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment ok_phi[nphi] = 0; det_phi[nphi] = 0; dis_phi[nphi] = 10000000; - if (m_muonIdHelperTool->rpcIdHelper().is_rpc( rot->identify())) { + if (m_idHelperSvc->isRpc( rot->identify())) { nphirpc++; - int code = 1000000*(m_muonIdHelperTool->rpcIdHelper().stationName(id)); - code = code + 2*((m_muonIdHelperTool->rpcIdHelper().doubletR(id))-1)+16*((m_muonIdHelperTool->rpcIdHelper().gasGap(id))-1); + int code = 1000000*(m_idHelperSvc->rpcIdHelper().stationName(id)); + code = code + 2*((m_idHelperSvc->rpcIdHelper().doubletR(id))-1)+16*((m_idHelperSvc->rpcIdHelper().gasGap(id))-1); chambercode_phi[nphi] = code; - stripcode_phi[nphi] = m_muonIdHelperTool->rpcIdHelper().strip(id); + stripcode_phi[nphi] = m_idHelperSvc->rpcIdHelper().strip(id); ok_phi[nphi] = 1; det_phi[nphi] = 1; const Muon::RpcClusterOnTrack* rrot = dynamic_cast<const Muon::RpcClusterOnTrack*>(rot); @@ -205,18 +179,16 @@ const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment // In the barrel local z is measured double disRPC = lSegmentPos.z() - lHitPos.z() + lSegmentDir.z()*(lHitPos.y()-lSegmentPos.y())/lSegmentDir.y(); if (m_debug) { - // std::cout << " lsegment pos x " << lSegmentPos.x() << " y " << lSegmentPos.y() << " z " << lSegmentPos.z() << std::endl; - // std::cout << " lsegment dir x " << lSegmentDir.x() << " y " << lSegmentDir.y() << " z " << lSegmentDir.z() << std::endl; std::cout << " ghit pos x " << gHitPos.x() << " y " << gHitPos.y() << " z " << gHitPos.z() << std::endl; std::cout << " dis RPC " << disRPC << std::endl; } dis_phi[nphi] = disRPC; - } else if ( m_muonIdHelperTool->tgcIdHelper().is_tgc( rot->identify())) { + } else if ( m_idHelperSvc->isTgc( rot->identify())) { nphitgc++; - int code = 1000000*(m_muonIdHelperTool->tgcIdHelper().stationName(id))+100*(m_muonIdHelperTool->tgcIdHelper().stationEta(id)+10); - code = code + m_muonIdHelperTool->tgcIdHelper().gasGap(id); + int code = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(id))+100*(m_idHelperSvc->tgcIdHelper().stationEta(id)+10); + code = code + m_idHelperSvc->tgcIdHelper().gasGap(id); chambercode_phi[nphi] = code; - stripcode_phi[nphi] = m_muonIdHelperTool->tgcIdHelper().channel(id); + stripcode_phi[nphi] = m_idHelperSvc->tgcIdHelper().channel(id); ok_phi[nphi] = 1; det_phi[nphi] = 2; @@ -231,8 +203,6 @@ const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment // In the forward local y is measured double disTGC = lSegmentPos.y() - lHitPos.y() + lSegmentDir.y()*(lHitPos.z()-lSegmentPos.z())/lSegmentDir.z(); if (m_debug) { - // std::cout << " lsegment pos x " << lSegmentPos.x() << " y " << lSegmentPos.y() << " z " << lSegmentPos.z() << std::endl; - // std::cout << " lsegment dir x " << lSegmentDir.x() << " y " << lSegmentDir.y() << " z " << lSegmentDir.z() << std::endl; std::cout << " ghit pos x " << gHitPos.x() << " y " << gHitPos.y() << " z " << gHitPos.z() << std::endl; std::cout << " dis TGC " << disTGC << std::endl; } @@ -259,12 +229,12 @@ const Muon::MuonSegment* MuonSegmentAmbiCleaner::resolve(const Muon::MuonSegment Identifier id1 = id_phi[i]; Identifier id2 = id_phi[j]; if (det_phi[i] == 1 && det_phi[j] == 1 && m_debug) { - ATH_MSG_INFO(" RPC Station 1 eta " << m_muonIdHelperTool->rpcIdHelper().stationEta(id1) << " phi " << m_muonIdHelperTool->rpcIdHelper().stationPhi(id1)); - ATH_MSG_INFO(" RPC Station 2 eta " << m_muonIdHelperTool->rpcIdHelper().stationEta(id2) << " phi " << m_muonIdHelperTool->rpcIdHelper().stationPhi(id2)); + ATH_MSG_INFO(" RPC Station 1 eta " << m_idHelperSvc->rpcIdHelper().stationEta(id1) << " phi " << m_idHelperSvc->rpcIdHelper().stationPhi(id1)); + ATH_MSG_INFO(" RPC Station 2 eta " << m_idHelperSvc->rpcIdHelper().stationEta(id2) << " phi " << m_idHelperSvc->rpcIdHelper().stationPhi(id2)); } if (det_phi[i] == 2 && det_phi[j] == 2 && m_debug) { - ATH_MSG_INFO(" TGC Station 1 eta " << m_muonIdHelperTool->tgcIdHelper().stationEta(id1) << " phi " << m_muonIdHelperTool->tgcIdHelper().stationPhi(id1)); - ATH_MSG_INFO(" TGC Station 2 eta " << m_muonIdHelperTool->tgcIdHelper().stationEta(id2) << " phi " << m_muonIdHelperTool->tgcIdHelper().stationPhi(id2)); + ATH_MSG_INFO(" TGC Station 1 eta " << m_idHelperSvc->tgcIdHelper().stationEta(id1) << " phi " << m_idHelperSvc->tgcIdHelper().stationPhi(id1)); + ATH_MSG_INFO(" TGC Station 2 eta " << m_idHelperSvc->tgcIdHelper().stationEta(id2) << " phi " << m_idHelperSvc->tgcIdHelper().stationPhi(id2)); } if (m_debug) { ATH_MSG_DEBUG(" Ambiguous " << " Distance1 " << dis_phi[i] << " Distance1 " << dis_phi[j]); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx index a8f7e1cc1ec194091d44d13b1ec695e725148b1a..8225e670e024b79c1e12e90ac7d98d15dacf8616 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx @@ -1,70 +1,32 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentHitSummaryTool.h" -#include "GaudiKernel/MsgStream.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - #include "MuonSegment/MuonSegment.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonSegment/MuonSegmentQuality.h" -#include <map> - -#include "StoreGate/StoreGateSvc.h" -#include "MuonIdHelpers/MdtIdHelper.h" +#include <map> namespace Muon { - MuonSegmentHitSummaryTool::MuonSegmentHitSummaryTool(const std::string& ty,const std::string& na,const IInterface* pa) - : AthAlgTool(ty,na,pa), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") - { + MuonSegmentHitSummaryTool::MuonSegmentHitSummaryTool(const std::string& ty,const std::string& na,const IInterface* pa) : + AthAlgTool(ty,na,pa), + m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { declareInterface<IMuonSegmentHitSummaryTool>(this); - declareProperty("PositionAlongTubeCut",m_positionAlongTubeCut = -200., "Cut on distance from tube end used for holes, negative value means in the tube"); declareProperty("MinimumADCValue",m_lowerADCBound = 70. ); } - - MuonSegmentHitSummaryTool::~MuonSegmentHitSummaryTool(){} - - StatusCode MuonSegmentHitSummaryTool::initialize() { - if ( AthAlgTool::initialize().isFailure() ) { - return StatusCode::FAILURE; - } - ATH_CHECK(m_DetectorManagerKey.initialize()); - - if(m_edmHelperSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_edmHelperSvc); - return StatusCode::FAILURE; - } - - if(m_printer.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_printer); - return StatusCode::FAILURE; - } - - if(m_idHelperTool.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_idHelperTool); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; - } - - StatusCode MuonSegmentHitSummaryTool::finalize() - { - if( AthAlgTool::finalize().isFailure() ) return StatusCode::FAILURE; + ATH_CHECK(m_edmHelperSvc.retrieve()); + ATH_CHECK(m_printer.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -89,8 +51,8 @@ namespace Muon { double dxdy = 1.; Identifier chid = m_edmHelperSvc->chamberId(seg); - MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(chid); - if( (!m_idHelperTool->isCsc(chid) && stIndex == MuonStationIndex::EI) || + MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chid); + if( (!m_idHelperSvc->isCsc(chid) && stIndex == MuonStationIndex::EI) || stIndex == MuonStationIndex::BO ) hitCounts.nexpectedTrigHitLayers = 1; else if( stIndex == MuonStationIndex::BM ) hitCounts.nexpectedTrigHitLayers = 2; else if( stIndex == MuonStationIndex::EM ) hitCounts.nexpectedTrigHitLayers = 3; @@ -102,14 +64,14 @@ namespace Muon { // get id and check that it is a muon hit id Identifier id = m_edmHelperSvc->getIdentifier(**mit); - if( !id.is_valid() || !m_idHelperTool->isMuon(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; // check if MDT is so increase ml counter - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ // get layer index - int ml = m_idHelperTool->mdtIdHelper().multilayer(id); - int lay = m_idHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_idHelperTool->mdtIdHelper().tube(id); + int ml = m_idHelperSvc->mdtIdHelper().multilayer(id); + int lay = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); int layIndex = 4*(ml-1) + (lay-1); // start at 0 rather than at 1 MdtLayerIntersect& layIntersect = hitCounts.mdtHitHolePerLayerCounts[layIndex]; ++layIntersect.nhits; @@ -119,7 +81,7 @@ namespace Muon { const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ - ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperTool->toString(id)); + ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperSvc->toString(id)); continue; } @@ -129,7 +91,7 @@ namespace Muon { gToAMDB = detEl->GlobalToAmdbLRSTransform(); lpos = gToAMDB*seg.globalPosition(); ldir = (gToAMDB*seg.globalDirection()).unit(); - dxdy = fabs(ldir.y()) > 0.001 ? ldir.x()/ldir.y() : 1000.; + dxdy = std::abs(ldir.y()) > 0.001 ? ldir.x()/ldir.y() : 1000.; transformIsSet = true; } if( !mdtShortest || tubeLen < shortestTube ){ @@ -137,7 +99,7 @@ namespace Muon { shortestTube = tubeLen; } } - if( m_idHelperTool->mdtIdHelper().multilayer(id) == 1 ) ++hitCounts.nmdtHitsMl1; + if( m_idHelperSvc->mdtIdHelper().multilayer(id) == 1 ) ++hitCounts.nmdtHitsMl1; else ++hitCounts.nmdtHitsMl2; if (mdt){ @@ -148,14 +110,14 @@ namespace Muon { } } - }else if( m_idHelperTool->isTrigger(id) ){ + }else if( m_idHelperSvc->isTrigger(id) ){ // get gasgap ID (same for eta/phi projection) - Identifier gasGapId = m_idHelperTool->gasGapId(id); - bool measuresPhi = m_idHelperTool->measuresPhi(id); + Identifier gasGapId = m_idHelperSvc->gasGapId(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); if( measuresPhi ) ++hitCounts.hitCountsPerLayer[gasGapId].nphiHits; else ++hitCounts.hitCountsPerLayer[gasGapId].netaHits; }else{ - bool measuresPhi = m_idHelperTool->measuresPhi(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); if( measuresPhi ) ++hitCounts.ncscHitsPhi; else ++hitCounts.ncscHitsEta; } @@ -169,9 +131,9 @@ namespace Muon { const Identifier& id = *hit; // get layer index - int ml = m_idHelperTool->mdtIdHelper().multilayer(id); - int lay = m_idHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_idHelperTool->mdtIdHelper().tube(id); + int ml = m_idHelperSvc->mdtIdHelper().multilayer(id); + int lay = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); int layIndex = 4*(ml-1) + (lay-1); // subtract 1 as fields start with 1 instead of 0 MdtLayerIntersect& layIntersect = hitCounts.mdtHitHolePerLayerCounts[layIndex]; ++layIntersect.nholes; @@ -179,7 +141,7 @@ namespace Muon { if( transformIsSet ){ const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ - ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperTool->toString(id)); + ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperSvc->toString(id)); continue; } double tubeLen = detEl->getActiveTubeLength(lay,tube); @@ -220,7 +182,7 @@ namespace Muon { if( lit->second.nhits == 0 ){ ++currentEnclosedHoles; // count holes within chamber bounds - if( fabs(lit->second.distFromTubeEnd) - 0.5*lit->second.tubeLength < m_positionAlongTubeCut ) ++hitCounts.nmdtHolesInChamber; + if( std::abs(lit->second.distFromTubeEnd) - 0.5*lit->second.tubeLength < m_positionAlongTubeCut ) ++hitCounts.nmdtHolesInChamber; }else{ if( firstLayerWithHits ) hitCounts.nmdtEnclosedHoles += currentEnclosedHoles; currentEnclosedHoles = 0; @@ -230,7 +192,7 @@ namespace Muon { if( mdtShortest ){ double posAlongTube = (mdtShortest->associatedSurface().transform().inverse()*seg.globalPosition()).z(); - if( 0.5*shortestTube - fabs(posAlongTube) < 100. ) hitCounts.closeToChamberEdge = true; + if( 0.5*shortestTube - std::abs(posAlongTube) < 100. ) hitCounts.closeToChamberEdge = true; } if( seg.fitQuality() ){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h index 425c83debf0e10a7bd794101f4270c587ebf3734..5a26e209f7c6f19fdd11a44c10a35badb19c4e42 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h @@ -1,61 +1,45 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONSEGMENTHITSUMMARYTOOL_H #define MUON_MUONSEGMENTHITSUMMARYTOOL_H #include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" - #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "Identifier/Identifier.h" - -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - -class MsgStream; -class MdtIdHelper; +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { - class MuonIdHelperTool; - class MuonEDMPrinterTool; class MuonSegment; - } namespace Muon { - - /** @brief tool to calculate muon segment hit summary */ class MuonSegmentHitSummaryTool : virtual public IMuonSegmentHitSummaryTool, public AthAlgTool { public: - /** @brief constructor */ MuonSegmentHitSummaryTool(const std::string&,const std::string&,const IInterface*); - /** @brief destructor */ - virtual ~MuonSegmentHitSummaryTool (); + virtual ~MuonSegmentHitSummaryTool()=default; - /** @brief AlgTool initilize */ StatusCode initialize(); - - /** @brief AlgTool finalize */ - StatusCode finalize(); /** @brief calculate segment hit counts */ virtual HitCounts getHitCounts( const MuonSegment& seg ) const; private: - - ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; //!< IdHelper tool - ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< EDM Helper tool - ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //!< EDM printer tool + ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //!< EDM printer tool SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", "MuonDetectorManager", diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.cxx index c19e315bd430ab0b52524755752b14f554b36136..22fe6aa87052f7f8bd216f981b37678267978b6a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.cxx @@ -1,74 +1,35 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentSelectionTool.h" -#include "GaudiKernel/MsgStream.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" - #include "MuonSegment/MuonSegment.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonSegment/MuonSegmentQuality.h" -#include <map> +#include <map> namespace Muon { - MuonSegmentSelectionTool::MuonSegmentSelectionTool(const std::string& ty,const std::string& na,const IInterface* pa) - : AthAlgTool(ty,na,pa), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), + MuonSegmentSelectionTool::MuonSegmentSelectionTool(const std::string& ty,const std::string& na,const IInterface* pa) : + AthAlgTool(ty,na,pa), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_hitSummaryTool("Muon::MuonSegmentHitSummaryTool/MuonSegmentHitSummaryTool", this) { declareInterface<IMuonSegmentSelectionTool>(this); - declareProperty("SegmentQualityCut",m_cutSegmentQuality = 10.); declareProperty("MinADCPerSegmentCut",m_minAdcPerSegmentCut = 70. ); declareProperty("GoodADCFractionCut",m_adcFractionCut = -1. ); } - - MuonSegmentSelectionTool::~MuonSegmentSelectionTool(){} - - StatusCode MuonSegmentSelectionTool::initialize() { - - if ( AthAlgTool::initialize().isFailure() ) { - return StatusCode::FAILURE; - } - - if(m_edmHelperSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_edmHelperSvc); - return StatusCode::FAILURE; - } - - if(m_printer.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_printer); - return StatusCode::FAILURE; - } - - if(m_idHelperTool.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_idHelperTool); - return StatusCode::FAILURE; - } - - if(m_hitSummaryTool.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_hitSummaryTool); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; - } - - StatusCode MuonSegmentSelectionTool::finalize() - { - if( AthAlgTool::finalize().isFailure() ) return StatusCode::FAILURE; + ATH_CHECK(m_edmHelperSvc.retrieve()); + ATH_CHECK(m_printer.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_hitSummaryTool.retrieve()); return StatusCode::SUCCESS; } @@ -81,13 +42,13 @@ namespace Muon { // different treatment for CSC and MDT segments // mdt treatment - if( m_idHelperTool->isMdt(chid) ) return mdtSegmentQuality(seg,chid,ignoreHoles); + if( m_idHelperSvc->isMdt(chid) ) return mdtSegmentQuality(seg,chid,ignoreHoles); // csc segments - if( m_idHelperTool->isCsc(chid) ) return cscSegmentQuality(seg,chid,ignoreHoles,useEta,usePhi); + if( m_idHelperSvc->isCsc(chid) ) return cscSegmentQuality(seg,chid,ignoreHoles,useEta,usePhi); // rpc/tgc case - if( m_idHelperTool->isTgc(chid) || m_idHelperTool->isRpc(chid) ) return 1; + if( m_idHelperSvc->isTgc(chid) || m_idHelperSvc->isRpc(chid) ) return 1; // NSW segments return nswSegmentQuality(seg,chid,ignoreHoles); @@ -157,7 +118,7 @@ namespace Muon { /* cuts for quality level 2 */ // require hits in both projections - if( abs(m_idHelperTool->stationEta(chid)) > 2 && hitCounts.ncscHitsPhi == 0 ) return 1; + if( std::abs(m_idHelperSvc->stationEta(chid)) > 2 && hitCounts.ncscHitsPhi == 0 ) return 1; /**********************************/ @@ -165,7 +126,7 @@ namespace Muon { // require four hits in one of the projections and hits in the other if( hitCounts.ncscHitsEta < 12 || - ( abs(m_idHelperTool->stationEta(chid)) > 2 && hitCounts.ncscHitsPhi < 4 ) ) return 2; + ( std::abs(m_idHelperSvc->stationEta(chid)) > 2 && hitCounts.ncscHitsPhi < 4 ) ) return 2; /**********************************/ /* segment has highest quality */ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h index 73ada4a72b4b010bd0b5b5db5e53de156b430a1f..26c2312f8c92c2bffad91bed31e55588d67ee406 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h @@ -1,25 +1,21 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONSEGMENTSELECTIONTOOL_H #define MUON_MUONSEGMENTSELECTIONTOOL_H #include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" - #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - -class Identifier; +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" namespace Muon { - class MuonIdHelperTool; - class MuonEDMPrinterTool; class MuonSegment; - class IMuonSegmentHitSummaryTool; } namespace Muon { @@ -37,18 +33,12 @@ namespace Muon { */ class MuonSegmentSelectionTool : virtual public IMuonSegmentSelectionTool, public AthAlgTool { public: - /** @brief constructor */ MuonSegmentSelectionTool(const std::string&,const std::string&,const IInterface*); - /** @brief destructor */ - virtual ~MuonSegmentSelectionTool (); + virtual ~MuonSegmentSelectionTool ()=default; - /** @brief AlgTool initilize */ StatusCode initialize(); - /** @brief AlgTool finalize */ - StatusCode finalize(); - /** @brief select segment */ bool select( const MuonSegment& seg, bool ignoreHoles = false, int qualityLevel = 0, bool useEta=true, bool usePhi=true ) const; @@ -67,13 +57,12 @@ namespace Muon { /** @brief calculate segment quality for NSW segments */ int nswSegmentQuality( const MuonSegment& seg, const Identifier& chid, bool ignoreHoles ) const; - - ToolHandle<MuonIdHelperTool> m_idHelperTool; //!< IdHelper tool - ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< EDM Helper tool - ToolHandle<MuonEDMPrinterTool> m_printer; //!< EDM printer tool - ToolHandle<IMuonSegmentHitSummaryTool> m_hitSummaryTool; //!< hit summary tool + ToolHandle<MuonEDMPrinterTool> m_printer; //!< EDM printer tool + ToolHandle<IMuonSegmentHitSummaryTool> m_hitSummaryTool; //!< hit summary tool double m_cutSegmentQuality; //!< cut on the segment quality double m_adcFractionCut; //!< cut on fraction of MDT hits above ADC cut diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt index 01a5c1ab2dd4518489bda5ecd5c4c401eed53820..4bf979636196ee86b5cb0a825bb4d4e51771535d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt @@ -16,7 +16,6 @@ atlas_depends_on_subdirs( PRIVATE DetectorDescription/RoiDescriptor Event/EventPrimitives GaudiKernel - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers @@ -50,7 +49,10 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkTools/TrkToolInterfaces Tracking/TrkUtilityPackages/TrkDriftCircleMath - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData ) + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( Eigen ) @@ -61,5 +63,5 @@ atlas_add_component( MuonTrackFinderTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives IRegionSelector Identifier RoiDescriptor EventPrimitives GaudiKernel MagFieldInterfaces MuonAlignErrorBase MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonStationIntersectSvcLib MuonSegmentMakerUtils TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkRoad TrkTrack TrkSegment TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces TrkDriftCircleMath MuonCondData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives IRegionSelector Identifier RoiDescriptor EventPrimitives GaudiKernel MuonAlignErrorBase MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonStationIntersectSvcLib MuonSegmentMakerUtils TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkRoad TrkTrack TrkSegment TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces TrkDriftCircleMath MuonCondData MagFieldElements MagFieldConditions ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx index 54b18548bc002cdea976d0f2818822d2165bed55..9617770599ed778befccd630f94e043ddcf07a15 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // STL includes @@ -537,6 +537,7 @@ namespace Muon { continue; } Identifier id = m_edmHelperSvc->getIdentifier(*meas); + if (!id.is_valid()) continue; if( m_idHelperSvc->isMdt(id) ) stationIds.insert( m_idHelperSvc->chamberIndex(id) ); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx index 6d435c4271b11d9b1ab021aea3f5212a9ee078cc..76adc4d7dc62f35b7e4153b71c0a7dc8f8c3cb06 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx @@ -56,7 +56,7 @@ namespace Muon { ATH_CHECK( m_mdtRotCreator.retrieve() ); ATH_CHECK( m_compRotCreator.retrieve() ); ATH_CHECK( m_measurementUpdator.retrieve() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); return StatusCode::SUCCESS; } @@ -883,7 +883,20 @@ namespace Muon { state.nIdHits = 0; state.nPseudoMeasurements = 0; state.nPhiConstraints = 0; - state.slFit = !m_magFieldSvc->toroidOn() || m_edmHelperSvc->isSLTrack( track ); + + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return; + } + fieldCondObj->getInitializedCache (fieldCache); + + state.slFit = !fieldCache.toroidOn() || m_edmHelperSvc->isSLTrack( track ); // loop over track and calculate residuals const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces(); @@ -1319,7 +1332,7 @@ namespace Muon { } // update sl fit configuration if track has ID hits or vertex constraint - if( state.slFit && (state.hasVertexConstraint || state.nIdHits > 0 ) && m_magFieldSvc->solenoidOn() ) { + if( state.slFit && (state.hasVertexConstraint || state.nIdHits > 0 ) && fieldCache.solenoidOn() ) { state.slFit = false; } @@ -1327,9 +1340,9 @@ namespace Muon { if(state.hasVertexConstraint || state.nIdHits ) { if( state.hasVertexConstraint ) ATH_MSG_DEBUG(" Track has vertex contraint:"); if( state.nIdHits > 0 ) ATH_MSG_DEBUG(" Track has ID Hits: " << state.nIdHits); - if( m_magFieldSvc->solenoidOn() ) ATH_MSG_DEBUG(" Solenoid On"); + if( fieldCache.solenoidOn() ) ATH_MSG_DEBUG(" Solenoid On"); else ATH_MSG_DEBUG(" Solenoid Off"); - if( m_magFieldSvc->toroidOn() ) ATH_MSG_DEBUG(" Toroid On"); + if( fieldCache.toroidOn() ) ATH_MSG_DEBUG(" Toroid On"); else ATH_MSG_DEBUG(" Toroid Off"); if( state.slFit ) ATH_MSG_DEBUG(" Use SL fit"); else ATH_MSG_DEBUG(" Use curved fit"); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h index 86a81d42839516cc9badf6a010d3e7809d98e8ec..f06d4927d2c7cdbcd4410c722a54f493a1d795e1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h @@ -23,7 +23,8 @@ #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "TrkToolInterfaces/IUpdator.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TrkParameters/TrackParameters.h" #include <string> @@ -289,8 +290,10 @@ namespace Muon { "Handle to the service providing the IMuonEDMHelperSvc interface" }; ToolHandle<Muon::MuonEDMPrinterTool> m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc {this, "MagFieldSvc", "AtlasFieldSvc"}; ToolHandle<Trk::IExtrapolator> m_extrapolator {this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"}; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; Gaudi::Property<bool> m_useMdtResiCut {this, "UseMdtResiCut", false}; Gaudi::Property<double> m_chi2Cut {this, "Chi2Cut", 100.}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx index fca2de882fd6248575e3cb56c7bb4f05e0ba2eeb..573b70df37c68fa0b4d28300d5469e4d549d9b32 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx @@ -32,12 +32,10 @@ namespace Muon { m_atlasExtrapolator("Trk::Extrapolator/AtlasExtrapolator"), m_muonExtrapolator("Trk::Extrapolator/MuonExtrapolator"), m_muonExtrapolator2("Trk::Extrapolator/MuonExtrapolator"), - m_magFieldSvc("AtlasFieldSvc",na), m_trackingGeometrySvc("TrackingGeometrySvc/AtlasTrackingGeometrySvc",na), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { declareInterface<IMuonTrackExtrapolationTool>(this); - declareProperty( "MagFieldSvc", m_magFieldSvc ); declareProperty( "TrackingGeometrySvc", m_trackingGeometrySvc); declareProperty( "MuonExtrapolator", m_muonExtrapolator); declareProperty( "MuonExtrapolator2", m_muonExtrapolator2); @@ -57,7 +55,7 @@ namespace Muon { if( !m_muonExtrapolator.empty() ) ATH_CHECK( m_muonExtrapolator.retrieve() ); if( !m_muonExtrapolator2.empty() ) ATH_CHECK( m_muonExtrapolator2.retrieve() ); ATH_CHECK( m_trackingGeometrySvc.retrieve() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if( m_cosmics ) ATH_MSG_DEBUG("Running in cosmics mode" ); @@ -67,15 +65,15 @@ namespace Muon { const Trk::TrackParameters* MuonTrackExtrapolationTool::extrapolateToMuonEntryRecord( const Trk::TrackParameters& pars, Trk::ParticleHypothesis particleHypo ) const { - if( m_muonExtrapolator.empty() ) return 0; + if( m_muonExtrapolator.empty() ) return nullptr; if( !m_trackingGeometrySvc->trackingGeometry() ){ ATH_MSG_WARNING(" " << m_trackingGeometrySvc << " has no valid trackingGeometry pointer" ); - return 0; + return nullptr; } const Trk::TrackingVolume* msEntrance = m_trackingGeometrySvc->trackingGeometry()->trackingVolume(m_msEntranceName.c_str()); if( !msEntrance ) { ATH_MSG_WARNING(" MS entrance not found" ); - return 0; + return nullptr; } Trk::PropDirection dir = Trk::oppositeMomentum; @@ -101,7 +99,7 @@ namespace Muon { const Trk::TrackParameters* MuonTrackExtrapolationTool::extrapolateToIP( const Trk::TrackParameters& pars, Trk::ParticleHypothesis particleHypo ) const { - if( m_atlasExtrapolator.empty() ) return 0; + if( m_atlasExtrapolator.empty() ) return nullptr; // temporary hack to avoid crashes in Muid. Amg::Vector3D refPos(0.1,0.1,0.1); @@ -139,10 +137,10 @@ namespace Muon { const Trk::TrackingVolume* msEntrance = m_trackingGeometrySvc->trackingGeometry()->trackingVolume(m_msEntranceName.c_str()); if( !msEntrance ) { ATH_MSG_WARNING("Failed to obtain muon entry volume"); - return 0; + return nullptr; } const Trk::Perigee* pp = track.perigeeParameters(); - if( !pp ) return 0; + if( !pp ) return nullptr; const Trk::TrackParameters* closestPars = pp; const Trk::TrackParameters* closestMeasPars = pp->covariance() ? pp : 0; @@ -319,20 +317,33 @@ namespace Muon { Trk::Track* MuonTrackExtrapolationTool::extrapolate( const Trk::Track& track ) const { - if( m_muonExtrapolator.empty() ) return 0; - // if straightline track and the field is on return 0 + if( m_muonExtrapolator.empty() ) return nullptr; + // if straightline track and the field is on return nullptr bool isSL = m_edmHelperSvc->isSLTrack(track); - if( m_magFieldSvc->toroidOn() && isSL ) { - return 0; + if( isSL ) { // check isSL first to limit access overhead + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + if( fieldCache.toroidOn() ) { + return nullptr; + } } const Trk::Perigee* pp = track.perigeeParameters(); - if( !pp ) return 0; + if( !pp ) return nullptr; const Trk::TrackParameters* firstPars = findClosestParametersToMuonEntry(track); if( !firstPars ){ ATH_MSG_WARNING("failed to find closest parameters to muon entry "); - return 0; + return nullptr; } // extrapolate to muon entry record @@ -354,7 +365,7 @@ namespace Muon { // check mometum, this should always work for high pt track but low momentum track could get stuck if( firstPars->momentum().mag() < 7000. ) ATH_MSG_DEBUG("lower energy muon lost during extrapolation "); else ATH_MSG_WARNING("failed to extrapolate parameters to muon entry and perigee "); - return 0; + return nullptr; } // sanity check for cosmics, if we are at the IP we should not @@ -379,7 +390,7 @@ namespace Muon { // double check if( !perigee ){ ATH_MSG_WARNING(" failed to create perigee "); - return 0; + return nullptr; } // direction of perigee diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h index 70001a69b0166b782348314f135c710a3d600943..2c67bd9fddc6ced7346ceeeb41b8af9469acac0b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h @@ -17,7 +17,8 @@ #include "TrkDetDescrInterfaces/ITrackingGeometrySvc.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TrkParameters/TrackParameters.h" @@ -78,7 +79,9 @@ namespace Muon { ToolHandle<Trk::IExtrapolator> m_muonExtrapolator; ToolHandle<Trk::IExtrapolator> m_muonExtrapolator2; // Moved from MuonEDMHelperSvc, not sure if it should be private/separate from m_muonExtrapolator - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; ServiceHandle<Trk::ITrackingGeometrySvc> m_trackingGeometrySvc; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt index b6027c22fc02af26c7173e98642985fba879ea8f..6c850c2f9b118cc93e25adaa6fa06965dae28115 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt @@ -14,7 +14,6 @@ atlas_depends_on_subdirs( PRIVATE DetectorDescription/Identifier Event/EventPrimitives GaudiKernel - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonStationIndex @@ -41,7 +40,10 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkExtrapolation/TrkExUtils Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkUtilityPackages/TrkDriftCircleMath ) + Tracking/TrkUtilityPackages/TrkDriftCircleMath + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( Eigen ) @@ -51,7 +53,7 @@ atlas_add_component( MuonTrackSteeringTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils GeoPrimitives Identifier EventPrimitives GaudiKernel MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonStationIndexLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils TrkDetDescrUtils TrkGeometry TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkExUtils TrkFitterInterfaces TrkToolInterfaces TrkDriftCircleMath ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils GeoPrimitives Identifier EventPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonStationIndexLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils TrkDetDescrUtils TrkGeometry TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkExUtils TrkFitterInterfaces TrkToolInterfaces TrkDriftCircleMath MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx index 5b48ab2a9d7d93e513656fba3fe839e31eb6dc06..d6132b68c7202b4f5a6fd538f5e023f98b8ef255 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx @@ -107,7 +107,7 @@ namespace Muon { ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); ATH_CHECK( m_segmentMatchingTool.retrieve() ); ATH_CHECK( m_segmentMatchingToolTight.retrieve() ); ATH_CHECK( m_candidateTool.retrieve() ); @@ -723,6 +723,18 @@ namespace Muon { Identifier closestId; double closestIdDist = 1E9; bool trackHasPhi = true; + + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return; + } + fieldCondObj->getInitializedCache (fieldCache); // loop over TSOS const DataVector<const Trk::TrackStateOnSurface>* tsoses = entry1.track().trackStateOnSurfaces(); @@ -816,7 +828,7 @@ namespace Muon { msg(MSG::DEBUG) << endmsg; } - bool straightLineMatch = !m_magFieldSvc->toroidOn(); + bool straightLineMatch = !fieldCache.toroidOn(); if ( hasStereoAngle && !trackHasPhi && (straightLineMatch || entry1.hasMomentum() ) ) { // can not do any extrapolation (not reliable) info.reason = TrackSegmentMatchResult::StereoAngleWithoutPhi; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index b232d2bca007a8650007326223f104b64682bd18..8a0dc1ec89f38c4e5ff83ba91b22374acde8a334 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h @@ -15,7 +15,8 @@ #include "CxxUtils/checker_macros.h" #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" @@ -186,8 +187,9 @@ namespace Muon { {this, "SegmentMatchingTool", "Muon::MuonSegmentMatchingTool/MuonSegmentMatchingTool"}; ToolHandle<IMuonSegmentMatchingTool> m_segmentMatchingToolTight {this, "SegmentMatchingToolTight", "Muon::MuonSegmentMatchingTool/MuonSegmentMatchingToolTight"}; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc - {this, "MagFieldSvc", "AtlasFieldSvc"}; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; ToolHandle<MuPatCandidateTool> m_candidateTool {this, "MuPatCandidateTool", "Muon::MuPatCandidateTool/MuPatCandidateTool"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx index 5dbec3416b87b78d7ebea2d94a0898dbe17162b7..b8e0189937876b95fc425020e0717419df5ec65f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx @@ -42,7 +42,7 @@ namespace Muon { ATH_CHECK( m_fitter.retrieve() ); ATH_CHECK( m_slFitter.retrieve() ); - ATH_CHECK(m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if( !m_errorOptimisationTool.empty() ) ATH_CHECK( m_errorOptimisationTool.retrieve() ); ATH_CHECK( m_candidateHandler.retrieve() ); ATH_CHECK( m_candidateMatchingTool.retrieve() ); @@ -74,7 +74,23 @@ namespace Muon { Trk::Track* MooTrackBuilder::refit( const Trk::Track& track ) const { - if( m_edmHelperSvc->isSLTrack(track) || !m_magFieldSvc->toroidOn() ) return m_slFitter->refit(track); + // use slFitter for straight line fit, or toroid off, otherwise use normal Fitter + + if( m_edmHelperSvc->isSLTrack(track) ) return m_slFitter->refit(track); + + // Also check if toriod is off: + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("refit: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + if( !fieldCache.toroidOn() ) return m_slFitter->refit(track); // if not refit tool specified do a pure refit if( m_errorOptimisationTool.empty() ) return m_fitter->refit(track); @@ -86,7 +102,7 @@ namespace Muon { Trk::Track* finalTrack = m_hitRecoverTool->recover(track.track()); if( !finalTrack ) { ATH_MSG_WARNING(" final track lost, this should not happen " ); - return 0; + return nullptr; } ATH_MSG_VERBOSE("refine: after recovery " << std::endl << m_printer->print(*finalTrack) << std::endl @@ -147,7 +163,7 @@ namespace Muon { // try to get track Trk::Track* track = combine( seg1, seg2, externalPhiHits ); - if( !track ) return 0; + if( !track ) return nullptr; // create MuonSegment MuonSegment* seg = m_trackToSegmentTool->convert(*track); @@ -164,12 +180,12 @@ namespace Muon { Trk::Track* MooTrackBuilder::combine( const MuonSegment& seg1, const MuonSegment& seg2, const PrepVec* externalPhiHits ) const { // convert segments MuPatSegment* segInfo1 = m_candidateHandler->createSegInfo(seg1); - if( !segInfo1 ) return 0; + if( !segInfo1 ) return nullptr; MuPatSegment* segInfo2 = m_candidateHandler->createSegInfo(seg2); if( !segInfo2 ) { delete segInfo1; - return 0; + return nullptr; } // call fit() @@ -186,7 +202,7 @@ namespace Muon { // try to get track Trk::Track* track = combine( firstCandidate, secondCandidate, externalPhiHits ); - if( !track ) return 0; + if( !track ) return nullptr; // create MuonSegment MuonSegment* seg = m_trackToSegmentTool->convert(*track); @@ -208,7 +224,7 @@ namespace Muon { if (m_doTimeOutChecks && Athena::Timeout::instance().reached() ) { ATH_MSG_DEBUG("Timeout reached. Aborting sequence." ); ++m_nTimedOut; - return 0; + return nullptr; } @@ -255,7 +271,7 @@ namespace Muon { esit != candidate->excludedSegments().end(); ++esit ) { if(*esit == segment) { ATH_MSG_DEBUG(" Rejected segment based on exclusion list" ); - return 0; + return nullptr; } } } @@ -297,7 +313,7 @@ namespace Muon { // if all segments are already part of an existing track, don't perform the fit if( foundSegments.size() == segments.size() ){ ATH_MSG_DEBUG("Combination already part of an existing track"); - return 0; + return nullptr; } // if all segments but one are already part of an existing track, check the exclusion list @@ -317,13 +333,13 @@ namespace Muon { if( unassociatedSegments.size() != 1 ) { ATH_MSG_DEBUG("Inconsistent result from set difference: size result " << unassociatedSegments.size() << " candidate " << segments.size() << " found " << foundSegments.size() ); - return 0; + return nullptr; } // check that the result is indeed part of the original set if( !segments.count(unassociatedSegments.front()) ){ ATH_MSG_DEBUG("Segment point not part of the original set, aborting!"); - return 0; + return nullptr; } // now check whether the segment is part of the excluded segments @@ -332,7 +348,7 @@ namespace Muon { unassociatedSegments.front() ); if( pos != candidate->excludedSegments().end() ){ ATH_MSG_DEBUG("Segment found in exclusion list, not performing fit"); - return 0; + return nullptr; } } } @@ -341,8 +357,25 @@ namespace Muon { //ATH_MSG_INFO(" Performing fit" ); } - if( slFit || !m_magFieldSvc->toroidOn() ) return m_slFitter->fit(firstCandidate,secondCandidate,externalPhiHits); - else return m_fitter->fit(firstCandidate,secondCandidate,externalPhiHits); + + // use slFitter for straight line fit, or toroid off, otherwise use normal Fitter + + if( slFit ) return m_slFitter->fit(firstCandidate,secondCandidate,externalPhiHits); + + EventContext ctx = Gaudi::Hive::currentContext(); + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("combine: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + if( !fieldCache.toroidOn() ) return m_slFitter->fit(firstCandidate,secondCandidate,externalPhiHits); + + return m_fitter->fit(firstCandidate,secondCandidate,externalPhiHits); } @@ -350,12 +383,12 @@ namespace Muon { const PrepVec* externalPhiHits ) const { // convert segments MuPatTrack* candidate = m_candidateHandler->createCandidate(new Trk::Track(track)); - if( !candidate ) return 0; + if( !candidate ) return nullptr; MuPatSegment* segInfo = m_candidateHandler->createSegInfo(seg); if( !segInfo ) { delete candidate; - return 0; + return nullptr; } // call fit() @@ -372,12 +405,12 @@ namespace Muon { const PrepVec* externalPhiHits ) const { // convert segments MuPatTrack* candidate = m_candidateHandler->createCandidate(new Trk::Track(track)); - if( !candidate ) return 0; + if( !candidate ) return nullptr; MuPatSegment* segInfo = m_candidateHandler->createSegInfo(seg); if( !segInfo ) { delete candidate; - return 0; + return nullptr; } // call fit() @@ -406,7 +439,7 @@ namespace Muon { const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces(); if( !states ){ ATH_MSG_DEBUG(" track without states! " ); - return 0; + return nullptr; } // loop over TSOSs @@ -450,7 +483,7 @@ namespace Muon { // return clone of parameters if( closestParameters ) return closestParameters->clone(); - return 0; + return nullptr; } @@ -477,7 +510,7 @@ namespace Muon { const PrepVec* patternPhiHits ) const { // convert track MuPatTrack* can = m_candidateHandler->createCandidate(new Trk::Track(track)); - if( !can ) return 0; + if( !can ) return nullptr; std::vector<Trk::Track*>* tracks = combineWithSegmentFinding(*can,pars,chIds,patternPhiHits); delete can; @@ -500,19 +533,19 @@ namespace Muon { // get chamber Id of segment std::set<Identifier> chIds = m_edmHelperSvc->chamberIds(seg); - if( chIds.empty() ) return 0; + if( chIds.empty() ) return nullptr; // for now do not redo segment making for CSCs if( m_idHelperSvc->isCsc( *chIds.begin() ) ){ if( m_candidateMatchingTool->match(candidate,segInfo,true) ) { Trk::Track* newtrack = m_fitter->fit(candidate,segInfo,externalPhiHits); - if( !newtrack ) return 0; + if( !newtrack ) return nullptr; std::vector<Trk::Track*>* newTracks = new std::vector<Trk::Track*>; newTracks->push_back(newtrack); return newTracks; }else{ - return 0; + return nullptr; } } @@ -525,7 +558,7 @@ namespace Muon { if( !closestPars ) { ATH_MSG_WARNING( " unable to find closest TrackParameters " ); - return 0; + return nullptr; } ATH_MSG_VERBOSE(" closest parameter " << m_printer->print(*closestPars) ); @@ -539,7 +572,7 @@ namespace Muon { if( !exPars ) { ATH_MSG_WARNING( " Propagation failed!! " ); - return 0; + return nullptr; } ATH_MSG_VERBOSE(" extrapolated parameter " << m_printer->print(*exPars) ); @@ -619,11 +652,11 @@ namespace Muon { const std::set<Identifier>& chIds, const PrepVec* externalPhiHits ) const { - if( chIds.empty() ) return 0; + if( chIds.empty() ) return nullptr; if( !m_idHelperSvc->isMdt(*chIds.begin()) ) { ATH_MSG_WARNING("combineWithSegmentFinding called with CSC hits!! retuning zero pointer"); - return 0; + return nullptr; } // redo segment finding @@ -632,11 +665,11 @@ namespace Muon { // check whether we got segments if( !segments ) { ATH_MSG_DEBUG(" failed to find new segments " ); - return 0; + return nullptr; } if( segments->empty() ){ ATH_MSG_DEBUG(" got empty vector!! " ); - return 0; + return nullptr; } unsigned int nseg=segments->size(); @@ -698,7 +731,7 @@ namespace Muon { if( !newTracks || newTracks->empty() ){ delete newTracks; - return 0; + return nullptr; } ATH_MSG_DEBUG(" found new tracks for segment " << newTracks->size() ); @@ -712,7 +745,7 @@ namespace Muon { const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces(); if( !states ){ ATH_MSG_DEBUG(" track without states, discarding track " ); - return 0; + return nullptr; } if( msgLvl(MSG::DEBUG) ) { msg(MSG::DEBUG) << MSG::DEBUG << " recalibrating hits on track " << std::endl @@ -1013,13 +1046,34 @@ namespace Muon { } std::pair<Trk::Track*,Trk::Track*> MooTrackBuilder::splitTrack( const Trk::Track& track ) const { - return m_edmHelperSvc->isSLTrack(track) || !m_magFieldSvc->toroidOn() ? m_slFitter->splitTrack(track) : m_fitter->splitTrack(track); + + // use slFitter for straight line fit, or toroid off, otherwise use normal Fitter + + if ( m_edmHelperSvc->isSLTrack(track) ) return m_slFitter->splitTrack(track); + + EventContext ctx = Gaudi::Hive::currentContext(); + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("splitTrack: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + std::pair<Trk::Track*,Trk::Track*> emptyPair; + return emptyPair; + } + fieldCondObj->getInitializedCache (fieldCache); + + if ( !fieldCache.toroidOn() ) return m_slFitter->splitTrack(track); + + return m_fitter->splitTrack(track); + } std::vector<MuPatTrack*>* MooTrackBuilder::find( MuPatCandidateBase& candidate, const std::vector<MuPatSegment*>& segVec ) const { // check whether we have segments - if( segVec.empty() ) return 0; + if( segVec.empty() ) return nullptr; std::vector<MuPatTrack*>* candidates = new std::vector<MuPatTrack*>(); std::set<MuPatSegment*> usedSegments; @@ -1523,7 +1577,7 @@ namespace Muon { } // did we find any? - if( !foundSplitTracks ) return 0; + if( !foundSplitTracks ) return nullptr; // loop over the new track vector and create a new TrackCollection TrackCollection* newTracks = new TrackCollection(); newTracks->reserve(goodTracks.size()); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h index 072557066c786e9cb9337ee9a933649e7ab3f58d..fe5165bd708add71215d1a6528e02656ef22b69f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h @@ -25,7 +25,8 @@ #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" #include "TrkTrackSummary/MuonTrackSummary.h" @@ -280,7 +281,9 @@ namespace Muon { ToolHandle<IMuonErrorOptimisationTool> m_errorOptimisationTool {this, "ErrorOptimisationTool", ""}; ToolHandle<Trk::IExtendedTrackSummaryTool> m_trackSummaryTool {this, "TrackSummaryTool", "MuonTrackSummaryTool"}; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc {this, "MagFieldSvc", "AtlasFieldSvc"}; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; Trk::MagneticFieldProperties m_magFieldProperties {Trk::FullField}; //!< magnetic field properties Gaudi::Property<bool> m_doTimeOutChecks {this,"UseTimeOutGuard" , true }; //!< on/off time out check diff --git a/MuonSpectrometer/MuonSimEvent/MuonSimEvent/MM_SimIdToOfflineId.h b/MuonSpectrometer/MuonSimEvent/MuonSimEvent/MM_SimIdToOfflineId.h index 03d2d1b7f1575f63295ed6e15245491c91a6e1bc..10ae4b0c9db22d01c487aca2825c4bd928861a7e 100644 --- a/MuonSpectrometer/MuonSimEvent/MuonSimEvent/MM_SimIdToOfflineId.h +++ b/MuonSpectrometer/MuonSimEvent/MuonSimEvent/MM_SimIdToOfflineId.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MM_SIMIDTOOFFLINEID_H @@ -9,16 +9,14 @@ #include "MuonIdHelpers/MmIdHelper.h" #include "Identifier/Identifier.h" - - struct MM_SimIdToOfflineId { - MM_SimIdToOfflineId( const MmIdHelper& idHelper ) : m_idHelper(&idHelper),m_simIdHelper(MicromegasHitIdHelper::GetHelper()) {} + MM_SimIdToOfflineId( const MmIdHelper* idHelper ) : m_idHelper(idHelper),m_simIdHelper(MicromegasHitIdHelper::GetHelper()) {} inline Identifier convert( int simId ) const; inline int convert (const Identifier & id) const; - const MmIdHelper* m_idHelper; + const MmIdHelper* m_idHelper; MicromegasHitIdHelper* m_simIdHelper; }; diff --git a/MuonSpectrometer/MuonSimEvent/MuonSimEvent/sTgcSimIdToOfflineId.h b/MuonSpectrometer/MuonSimEvent/MuonSimEvent/sTgcSimIdToOfflineId.h index 5196cb93dfb83aaa70354c23372a5a7eb0534fe4..63c13bef559ca9239bc42df7576489a25fbe488a 100644 --- a/MuonSpectrometer/MuonSimEvent/MuonSimEvent/sTgcSimIdToOfflineId.h +++ b/MuonSpectrometer/MuonSimEvent/MuonSimEvent/sTgcSimIdToOfflineId.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef sTgcSIMIDTOOFFLINEID_H @@ -11,13 +11,13 @@ struct sTgcSimIdToOfflineId { - sTgcSimIdToOfflineId( const sTgcIdHelper& idHelper ) : m_idHelper(&idHelper),m_simIdHelper(sTgcHitIdHelper::GetHelper()) {} + sTgcSimIdToOfflineId( const sTgcIdHelper* idHelper ) : m_idHelper(idHelper),m_simIdHelper(sTgcHitIdHelper::GetHelper()) {} inline Identifier convert( int simId ) const; inline int convert (const Identifier & id) const; - const sTgcIdHelper* m_idHelper; - sTgcHitIdHelper* m_simIdHelper; + const sTgcIdHelper* m_idHelper; + sTgcHitIdHelper* m_simIdHelper; }; diff --git a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h index 63b6c0c53aa3350f39689f06155451940725bb80..3876339487e1cf164c3604053c9b5712724df275 100644 --- a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h +++ b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h @@ -1,16 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONTRACKTRUTHTOOL_H #define MUON_MUONTRACKTRUTHTOOL_H +#include "MuonRecToolInterfaces/IMuonTrackTruthTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecToolInterfaces/IMuonTrackTruthTool.h" -#include "Identifier/Identifier.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/CscSimDataCollection.h" #include "TrackRecord/TrackRecordCollection.h" @@ -21,7 +22,6 @@ #include <map> #include <utility> -class MsgStream; class TruthTrajectory; namespace MuonGM { @@ -29,8 +29,6 @@ namespace MuonGM { } namespace Muon { - class MuonEDMPrinterTool; - class MuonIdHelperTool; class MuonSegment; } @@ -61,14 +59,11 @@ namespace Muon { MuonTrackTruthTool(const std::string&,const std::string&,const IInterface*); /** @brief destructor */ - ~MuonTrackTruthTool (); + ~MuonTrackTruthTool()=default; /** @brief AlgTool initilize */ StatusCode initialize(); - /** @brief AlgTool finalize */ - StatusCode finalize(); - /** @brief perform truth matching for a given set of tracks */ ResultVec match(const TrackCollection& tracks ) const; @@ -146,7 +141,7 @@ namespace Muon { const MuonGM::MuonDetectorManager* m_detMgr; ToolHandle<Muon::MuonEDMPrinterTool> m_printer; - ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<Trk::ITruthTrajectoryBuilder> m_truthTrajectoryBuilder; mutable TruthTree m_truthTree; diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.cxx index d6e4d5dd2833b332688041840554f1976eaa94c5..1c494ba3e7cca79452fcccb46fdf016edfd519ef 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.cxx @@ -1,13 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonSegmentTruthAssociationAlg.cxx -// Implementation file for class MuonSegmentTruthAssociationAlg -/////////////////////////////////////////////////////////////////// - #include "MuonSegmentTruthAssociationAlg.h" + #include "xAODMuon/MuonSegment.h" #include "xAODMuon/MuonSegmentAuxContainer.h" #include "xAODTruth/TruthParticleContainer.h" @@ -20,23 +16,16 @@ namespace Muon { // Constructor with parameters: MuonSegmentTruthAssociationAlg::MuonSegmentTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_muonTrackTruthTool("Muon::MuonTrackTruthTool/MuonTrackTruthTool"), - m_hasCSC(true), - m_hasSTgc(true), - m_hasMM(true) + m_muonTrackTruthTool("Muon::MuonTrackTruthTool/MuonTrackTruthTool") { - declareProperty("BarcodeOffset", m_barcodeOffset = 1000000 ,"barcode offset for matching truth particles"); - declareProperty("HasCSC",m_hasCSC=true); - declareProperty("HasSTgc",m_hasSTgc=true); - declareProperty("HasMM",m_hasMM=true); + declareProperty("BarcodeOffset", m_barcodeOffset = 1000000 ,"barcode offset for matching truth particles"); } // Initialize method: StatusCode MuonSegmentTruthAssociationAlg::initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_muonTrackTruthTool.retrieve()); m_muonTruthSegmentContainerName=m_muonTruthSegmentContainerName.key()+".recoSegmentLink"; @@ -44,17 +33,12 @@ namespace Muon { ATH_CHECK(m_muonTruthSegmentContainerName.initialize()); ATH_CHECK(m_muonSegmentCollectionName.initialize()); ATH_CHECK(m_mcEventColl.initialize()); - if(!(m_hasSTgc && m_hasMM)) m_muonSimData={"MDT_SDO", "RPC_SDO", "TGC_SDO"}; + if(!(m_idHelperSvc->hasSTgc() && m_idHelperSvc->hasMM())) m_muonSimData={"MDT_SDO", "RPC_SDO", "TGC_SDO"}; ATH_CHECK(m_muonSimData.initialize()); - if (m_hasCSC) ATH_CHECK(m_cscSimData.initialize(true)); + if (m_idHelperSvc->hasCSC()) ATH_CHECK(m_cscSimData.initialize()); ATH_CHECK(m_trackRecord.initialize()); return StatusCode::SUCCESS; } - // Finalize method: - StatusCode MuonSegmentTruthAssociationAlg::finalize() - { - return StatusCode::SUCCESS; - } // Execute method: StatusCode MuonSegmentTruthAssociationAlg::execute() @@ -116,17 +100,17 @@ namespace Muon { if(!simDataMap.isPresent()) continue; muonSimData.push_back(simDataMap.cptr()); } - if(m_hasCSC){ + if(m_idHelperSvc->hasCSC()){ SG::ReadHandle<CscSimDataCollection> cscSimDataMap(m_cscSimData); if(!cscSimDataMap.isValid()){ ATH_MSG_WARNING(cscSimDataMap.key()<<" not valid"); - m_muonTrackTruthTool->createTruthTree(truthTrackCol.cptr(),mcEventCollection.cptr(),muonSimData,NULL); + m_muonTrackTruthTool->createTruthTree(truthTrackCol.cptr(),mcEventCollection.cptr(),muonSimData,nullptr); } else{ m_muonTrackTruthTool->createTruthTree(truthTrackCol.cptr(),mcEventCollection.cptr(),muonSimData,cscSimDataMap.cptr()); } } - else m_muonTrackTruthTool->createTruthTree(truthTrackCol.cptr(),mcEventCollection.cptr(),muonSimData,NULL); + else m_muonTrackTruthTool->createTruthTree(truthTrackCol.cptr(),mcEventCollection.cptr(),muonSimData,nullptr); ATH_MSG_DEBUG("Matching reconstructed segments " << muonSegments.size() ); IMuonTrackTruthTool::SegmentResultVec segmentMatchResult = m_muonTrackTruthTool->match(muonSegments); @@ -160,7 +144,7 @@ namespace Muon { if( !result.second.mms.matchedHits.empty() ) id = *result.second.mms.matchedHits.begin(); if( !id.is_valid() ) continue; - Muon::MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(id); + Muon::MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(id); auto pos = chambers.insert(chIndex); if( !pos.second ) { diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.h b/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.h index f8b353fb4d63882d69dbe124309e0cf3319e8827..3d8c36568bd40d34befbd17e0ae1d736c0d9e66c 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.h +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonSegmentTruthAssociationAlg.h @@ -1,25 +1,19 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonSegmentTruthAssociationAlg.h -// Header file for class MuonSegmentTruthAssociationAlg -/////////////////////////////////////////////////////////////////// - #ifndef TRUTHPARTICLEALGS_MUONSEGMENTTRUTHASSOCIATION_H #define TRUTHPARTICLEALGS_MUONSEGMENTTRUTHASSOCIATION_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecToolInterfaces/IMuonTrackTruthTool.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" - #include "xAODMuon/MuonSegmentContainer.h" #include "StoreGate/WriteDecorHandleKey.h" - #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/CscSimDataCollection.h" #include "TrackRecord/TrackRecordCollection.h" @@ -38,10 +32,9 @@ public: // Basic algorithm methods: virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); private: - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<Muon::MuonEDMPrinterTool> m_printer; ToolHandle<Muon::IMuonTrackTruthTool> m_muonTrackTruthTool; Gaudi::Property<SG::WriteDecorHandleKey<xAOD::MuonSegmentContainer> >m_muonTruthSegmentContainerName{this,"MuonTruthSegmentName","MuonTruthSegments","muon truth segment container name"}; @@ -51,9 +44,6 @@ private: SG::ReadHandleKey<CscSimDataCollection> m_cscSimData{this,"CSC_SDO_Container","CSC_SDO","CSC SDO"}; SG::ReadHandleKey<TrackRecordCollection> m_trackRecord{this,"TrackRecord","MuonEntryLayerFilter","Track Record Collection"}; int m_barcodeOffset; - bool m_hasCSC; - bool m_hasSTgc; - bool m_hasMM; }; } // namespace Muon diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx index aabb23eef5f3b3c0916cd9def39d40727f2a68ec..fa7fafc64d4fbf46fc3ae60c688ea7015d5804aa 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx @@ -1,11 +1,8 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" #include "MuonTruthAlgs/MuonTrackTruthTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "TrkToolInterfaces/ITruthTrajectoryBuilder.h" #include "AtlasHepMC/GenEvent.h" @@ -38,7 +35,6 @@ namespace Muon { : AthAlgTool(ty,na,pa), m_detMgr(0), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_truthTrajectoryBuilder("Muon::MuonDecayTruthTrajectoryBuilder/MuonDecayTruthTrajectoryBuilder") { declareInterface<IMuonTrackTruthTool>(this); @@ -50,14 +46,10 @@ namespace Muon { declareProperty("ConsideredPDGs", m_pdgsToBeConsidered ); } - - MuonTrackTruthTool::~MuonTrackTruthTool(){} - - StatusCode MuonTrackTruthTool::initialize() { ATH_CHECK(detStore()->retrieve( m_detMgr )); - ATH_CHECK(m_idHelperTool.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_truthTrajectoryBuilder.retrieve()); @@ -67,19 +59,17 @@ namespace Muon { m_selectedPdgs.insert(-13); }else{ // add pdgs - for( auto pdg : m_pdgsToBeConsidered.value() ) m_selectedPdgs.insert(pdg); - msg(MSG::DEBUG) << " PDG codes used for matching"; - for( auto val : m_selectedPdgs ) msg(MSG::DEBUG) << " " << val; - msg(MSG::DEBUG) << endmsg; + for( auto pdg : m_pdgsToBeConsidered.value() ) { + m_selectedPdgs.insert(pdg); + } + ATH_MSG_DEBUG(" PDG codes used for matching"); + for( auto val : m_selectedPdgs ) { + ATH_MSG_DEBUG(" " << val); + } } return StatusCode::SUCCESS; } - StatusCode MuonTrackTruthTool::finalize() - { - return StatusCode::SUCCESS; - } - int MuonTrackTruthTool::manipulateBarCode( int barcode ) const { if( m_manipulateBarCode ) return barcode%10000; return barcode; @@ -159,7 +149,7 @@ namespace Muon { return m_truthTree; } - const HepMC::GenEvent* genEvent = 0; + const HepMC::GenEvent* genEvent = nullptr; if( !mcEventCollection->empty() ) { ATH_MSG_VERBOSE( "McEventCollection size " << mcEventCollection->size()); if( mcEventCollection->size() == 1 ) genEvent = mcEventCollection ->front(); @@ -198,14 +188,13 @@ namespace Muon { barcode = truthTrajectory->front()->barcode(); if( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << MSG::VERBOSE << " found GenParticle: size " + ATH_MSG_VERBOSE(" found GenParticle: size " << truthTrajectory->size() << " fs barcode " << barcode << " pdg " << truthTrajectory->front()->pdg_id() - << " p " << truthTrajectory->front()->momentum().rho(); + << " p " << truthTrajectory->front()->momentum().rho()); if( truthTrajectory->front()->production_vertex() ) { - msg(MSG::VERBOSE) << " vertex: r " << truthTrajectory->front()->production_vertex()->position().perp() - << " z " << truthTrajectory->front()->production_vertex()->position().z(); + ATH_MSG_VERBOSE(" vertex: r " << truthTrajectory->front()->production_vertex()->position().perp() + << " z " << truthTrajectory->front()->production_vertex()->position().z()); } - msg(MSG::VERBOSE) << endmsg; } // now collect all barcodes beloning to this TruthTrajectory @@ -215,12 +204,10 @@ namespace Muon { int code = (*pit)->barcode(); if( msgLvl(MSG::VERBOSE) && code != barcode ) { - msg(MSG::VERBOSE) << " secondary barcode: " << code << " pdg " << (*pit)->pdg_id() - << " p " << (*pit)->momentum().rho(); - if( (*pit)->production_vertex() ) msg(MSG::VERBOSE) << " vertex: r " << (*pit)->production_vertex()->position().perp() - << " z " << (*pit)->production_vertex()->position().z(); - - msg(MSG::VERBOSE) << endmsg; + ATH_MSG_VERBOSE(" secondary barcode: " << code << " pdg " << (*pit)->pdg_id() + << " p " << (*pit)->momentum().rho()); + if( (*pit)->production_vertex() ) ATH_MSG_VERBOSE(" vertex: r " << (*pit)->production_vertex()->position().perp() + << " z " << (*pit)->production_vertex()->position().z()); // sanity check if( m_barcodeMap.count(code) ) ATH_MSG_VERBOSE(" pre-existing barcode " << code); } @@ -290,24 +277,23 @@ namespace Muon { if( m_doSummary || msgLvl(MSG::DEBUG) ){ - msg(MSG::INFO) << " summarizing truth tree: number of particles " << m_truthTree.size() << endmsg; + ATH_MSG_INFO(" summarizing truth tree: number of particles " << m_truthTree.size()); TruthTreeIt it = m_truthTree.begin(); TruthTreeIt it_end = m_truthTree.end(); for( ;it!=it_end;++it ){ - if( !it->second.truthTrack ) msg(MSG::INFO) << " no TrackRecord "; + if( !it->second.truthTrack ) ATH_MSG_INFO(" no TrackRecord "); else{ - msg(MSG::INFO) << " PDG " << it->second.truthTrack->GetPDGCode() << " barcode " << it->second.truthTrack->GetBarCode() - << " manip " << manipulateBarCode(it->second.truthTrack->GetBarCode()); + ATH_MSG_INFO(" PDG " << it->second.truthTrack->GetPDGCode() << " barcode " << it->second.truthTrack->GetBarCode() + << " manip " << manipulateBarCode(it->second.truthTrack->GetBarCode())); } - if( !it->second.mdtHits.empty() ) msg(MSG::INFO) << " mdt " << it->second.mdtHits.size(); - if( !it->second.rpcHits.empty() ) msg(MSG::INFO) << " rpc " << it->second.rpcHits.size(); - if( !it->second.tgcHits.empty() ) msg(MSG::INFO) << " tgc " << it->second.tgcHits.size(); - if( !it->second.cscHits.empty() ) msg(MSG::INFO) << " csc " << it->second.cscHits.size(); - if( !it->second.stgcHits.empty() ) msg(MSG::INFO) << " stgc " << it->second.stgcHits.size(); - if( !it->second.mmHits.empty() ) msg(MSG::INFO) << " mm " << it->second.mmHits.size(); + if( !it->second.mdtHits.empty() ) ATH_MSG_INFO(" mdt " << it->second.mdtHits.size()); + if( !it->second.rpcHits.empty() ) ATH_MSG_INFO(" rpc " << it->second.rpcHits.size()); + if( !it->second.tgcHits.empty() ) ATH_MSG_INFO(" tgc " << it->second.tgcHits.size()); + if( !it->second.cscHits.empty() ) ATH_MSG_INFO(" csc " << it->second.cscHits.size()); + if( !it->second.stgcHits.empty() ) ATH_MSG_INFO(" stgc " << it->second.stgcHits.size()); + if( !it->second.mmHits.empty() ) ATH_MSG_INFO(" mm " << it->second.mmHits.size()); if( it->second.mdtHits.empty() && it->second.rpcHits.empty() && it->second.tgcHits.empty() && - it->second.cscHits.empty() && it->second.stgcHits.empty() && it->second.mmHits.empty() ) msg(MSG::INFO) <<" no hits "; - msg(MSG::INFO) << endmsg; + it->second.cscHits.empty() && it->second.stgcHits.empty() && it->second.mmHits.empty() ) ATH_MSG_INFO(" no hits "); } } @@ -331,7 +317,7 @@ namespace Muon { int barcodeIn = dit->first.barcode(); std::map<int,int>::iterator bit = m_barcodeMap.find(barcodeIn); if( bit == m_barcodeMap.end() ){ - ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperTool->toString(id) << " barcode " << barcodeIn); + ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperSvc->toString(id) << " barcode " << barcodeIn); continue; } // replace barcode with barcode from map @@ -339,56 +325,55 @@ namespace Muon { TruthTreeIt eit = m_truthTree.find(barcode); if( eit == m_truthTree.end() ){ - ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperTool->toString(id) << " barcode " << barcode); + ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ if( m_detMgr && !m_detMgr->getMdtReadoutElement(id) ) { - ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } eit->second.mdtHits.insert(*it); - }else if( m_idHelperTool->isRpc(id) ){ + }else if( m_idHelperSvc->isRpc(id) ){ if( m_detMgr && !m_detMgr->getRpcReadoutElement(id) ) { - ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } - if( m_idHelperTool->stationIndex(id) == MuonStationIndex::BO && m_idHelperTool->rpcIdHelper().doubletR(id) == 2 ){ - ATH_MSG_VERBOSE(" Discarding non existing RPC hit " << m_idHelperTool->toString(id)); + if( m_idHelperSvc->stationIndex(id) == MuonStationIndex::BO && m_idHelperSvc->rpcIdHelper().doubletR(id) == 2 ){ + ATH_MSG_VERBOSE(" Discarding non existing RPC hit " << m_idHelperSvc->toString(id)); continue; } eit->second.rpcHits.insert(*it); - }else if( m_idHelperTool->isTgc(id) ) { + }else if( m_idHelperSvc->isTgc(id) ) { if( m_detMgr && !m_detMgr->getTgcReadoutElement(id) ) { - ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } eit->second.tgcHits.insert(*it); - }else if( m_idHelperTool->issTgc(id) ) { + }else if( m_idHelperSvc->issTgc(id) ) { if( m_detMgr && !m_detMgr->getsTgcReadoutElement(id) ) { - ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } eit->second.stgcHits.insert(*it); - }else if( m_idHelperTool->isMM(id) ) { + }else if( m_idHelperSvc->isMM(id) ) { if( m_detMgr && !m_detMgr->getMMReadoutElement(id) ) { - ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperTool->toString(id) + ATH_MSG_VERBOSE( " discarding: no detEl " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } eit->second.mmHits.insert(*it); } if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << MSG::VERBOSE << " adding hit " << m_idHelperTool->toString(id) << " barcode " << barcode; - if( barcode != barcodeIn ) msg(MSG::VERBOSE) << " hit barcode " << barcodeIn; - msg(MSG::VERBOSE) << endmsg; + ATH_MSG_VERBOSE(" adding hit " << m_idHelperSvc->toString(id) << " barcode " << barcode); + if( barcode != barcodeIn ) ATH_MSG_VERBOSE(" hit barcode " << barcodeIn); } } } @@ -411,7 +396,7 @@ namespace Muon { int barcodeIn = manipulateBarCode(dit->first.barcode()); std::map<int,int>::iterator bit = m_barcodeMap.find(barcodeIn); if( bit == m_barcodeMap.end() ){ - ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperTool->toString(id) << " barcode " << barcodeIn); + ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperSvc->toString(id) << " barcode " << barcodeIn); continue; } // replace barcode with barcode from map @@ -419,14 +404,13 @@ namespace Muon { TruthTreeIt eit = m_truthTree.find(barcode); if( eit == m_truthTree.end() ){ - ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperTool->toString(id) << " barcode " << barcode); + ATH_MSG_VERBOSE( " discarding " << " " << m_idHelperSvc->toString(id) << " barcode " << barcode); continue; } if( msgLvl(MSG::VERBOSE) ){ - msg(MSG::VERBOSE) << " adding hit " << m_idHelperTool->toString(id) << " barcode " << barcode; - if( barcode != barcodeIn ) msg(MSG::VERBOSE) << " hit barcode " << barcodeIn; - msg(MSG::VERBOSE) << endmsg; + ATH_MSG_VERBOSE(" adding hit " << m_idHelperSvc->toString(id) << " barcode " << barcode); + if( barcode != barcodeIn ) ATH_MSG_VERBOSE(" hit barcode " << barcodeIn); } eit->second.cscHits.insert(*it); } @@ -462,7 +446,7 @@ namespace Muon { continue; } Identifier id = rot->identify(); - if( !id.is_valid() || !m_idHelperTool->mdtIdHelper().is_muon(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->mdtIdHelper().is_muon(id) ) continue; if( ids.count(id) ) continue; measurements.push_back(meas); ids.insert(id); @@ -527,20 +511,20 @@ namespace Muon { continue; } Identifier id = rot->identify(); - if( !id.is_valid() || !m_idHelperTool->mdtIdHelper().is_muon(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->mdtIdHelper().is_muon(id) ) continue; - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ addMdtTruth( trackTruth.mdts, id, *meas, truthEntry.mdtHits ); - }else if( m_idHelperTool->isCsc(id) ){ + }else if( m_idHelperSvc->isCsc(id) ){ addClusterTruth( trackTruth.cscs, id, *meas, truthEntry.cscHits ); - }else if( m_idHelperTool->isRpc(id) ){ + }else if( m_idHelperSvc->isRpc(id) ){ addClusterTruth( trackTruth.rpcs, id, *meas, truthEntry.rpcHits ); - }else if( m_idHelperTool->isTgc(id) ){ + }else if( m_idHelperSvc->isTgc(id) ){ addClusterTruth( trackTruth.tgcs, id, *meas, truthEntry.tgcHits ); - }else if( m_idHelperTool->issTgc(id) ){ + }else if( m_idHelperSvc->issTgc(id) ){ addClusterTruth( trackTruth.stgcs, id, *meas, truthEntry.stgcHits ); - }else if( m_idHelperTool->isMM(id) ){ + }else if( m_idHelperSvc->isMM(id) ){ addClusterTruth( trackTruth.mms, id, *meas, truthEntry.mmHits ); } } @@ -565,13 +549,13 @@ namespace Muon { Identifier id = it->first; // for trigger chambers use layer id - if( m_idHelperTool->isTrigger(id) || m_idHelperTool->isCsc(id) ) id = m_idHelperTool->layerId(id); + if( m_idHelperSvc->isTrigger(id) || m_idHelperSvc->isCsc(id) ) id = m_idHelperSvc->layerId(id); int isOnTrack = ids.count(id); if( isOnTrack ) continue; // if restricted truth mode, skip if chamber has not hits - Identifier chid = m_idHelperTool->chamberId(id); + Identifier chid = m_idHelperSvc->chamberId(id); bool chamberHasHits = chids.count(chid); if( restrictedTruth && !chamberHasHits ) continue; @@ -595,13 +579,13 @@ namespace Muon { CscSimDataCollection::const_iterator it_end = simCol.end(); for( ;it!=it_end;++it ){ - Identifier id = m_idHelperTool->layerId(it->first); + Identifier id = m_idHelperSvc->layerId(it->first); int isOnTrack = ids.count(id); if( isOnTrack ) continue; // if restricted truth mode, skip if chamber has not hits - Identifier chid = m_idHelperTool->chamberId(id); + Identifier chid = m_idHelperSvc->chamberId(id); bool chamberHasHits = chids.count(chid); if( restrictedTruth && !chamberHasHits ) continue; @@ -621,11 +605,11 @@ namespace Muon { const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(&meas); if( !mdt ){ - ATH_MSG_WARNING(" dynamic_cast to MdtDriftCircleOnTrack failed for measurement with id " << m_idHelperTool->toString(id)); + ATH_MSG_WARNING(" dynamic_cast to MdtDriftCircleOnTrack failed for measurement with id " << m_idHelperSvc->toString(id)); return; } - Identifier chid = m_idHelperTool->chamberId(id); + Identifier chid = m_idHelperSvc->chamberId(id); // find SimData corresponding to identifier MuonSimDataCollection::const_iterator it = simCol.find(id); @@ -656,8 +640,8 @@ namespace Muon { const MuonSimDataCollection& simCol ) const { Trk::RoT_Extractor rotExtractor; - Identifier layid = m_idHelperTool->layerId(id); - Identifier chid = m_idHelperTool->chamberId(id); + Identifier layid = m_idHelperSvc->layerId(id); + Identifier chid = m_idHelperSvc->chamberId(id); MuonSimDataCollection::const_iterator it = simCol.end(); @@ -714,8 +698,8 @@ namespace Muon { void MuonTrackTruthTool::addClusterTruth( MuonTechnologyTruth& truth, const Identifier& id, const Trk::MeasurementBase& /*meas*/, const CscSimDataCollection& simCol ) const { - Identifier layid = m_idHelperTool->layerId(id); - Identifier chid = m_idHelperTool->chamberId(id); + Identifier layid = m_idHelperSvc->layerId(id); + Identifier chid = m_idHelperSvc->chamberId(id); // find SimData corresponding to identifier CscSimDataCollection::const_iterator it = simCol.find(id); if( it == simCol.end() ) { @@ -792,7 +776,7 @@ namespace Muon { } else { if( (*pit)->pdg_id() == pdgFinal ) { auto pit_p = *pit; - if ( (theFirst != pit_p) && ((*pit)->momentum().t()!=ePrev) ) ++scat; // if the particle has not changed pdgid after the first step count as scatter. also avoid counting pure interface changes as scatter + if ( (theFirst != pit_p.cptr()) && ((*pit)->momentum().t()!=ePrev) ) ++scat; // if the particle has not changed pdgid after the first step count as scatter. also avoid counting pure interface changes as scatter } else { // the first time this particle appears --pit; theFirst = *pit; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx index 0bc7b9b7c7e77f59e93355c61d08cdc565e16463..66be19e7ae9c98c235a8b7f0dc8b0f0f6776b928 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx @@ -66,7 +66,7 @@ MdtRawDataValAlg::MdtRawDataValAlg( const std::string & type, const std::string :ManagedMonitorToolBase( type, name, parent ), m_mg(0), m_masked_tubes(NULL), - m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"), + m_muonSelectionTool(this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool"), m_DQFilterTools(this), m_atlas_ready(0), m_trig_BARREL(false), diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx index abe1eb3d9a33a888422e1cd25c7c55eddae0280f..df96df67e299efbc90fe05183eeac972582c8336 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx @@ -135,13 +135,19 @@ TgcLv1RawDataValAlg::readTgcCoinDataContainer(const Muon::TgcCoinDataContainer* if(gposout[0]==0) { eta = 0; phi = 0;} else { eta = gposout.eta(); phi = gposout.phi(); } - const Identifier tcdidout = tcd->channelIdOut(); - int etaout = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidout))); - if(ef==0) etaout = 0; - - const Identifier tcdidin = tcd->channelIdIn(); - int etain = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidin))); - if(ef==0) etain = 0; + int etaout = 0; + int etain = 0; + if (ef != 0) { + const Identifier tcdidout = tcd->channelIdOut(); + if (tcdidout.is_valid()) { + etaout = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidout))); + } + + const Identifier tcdidin = tcd->channelIdIn(); + if (tcdidin.is_valid()) { + etain = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidin))); + } + } // Fill vectors for different Coincidence Types if( tcd->type() == Muon::TgcCoinData::TYPE_TRACKLET ){ diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt index 788cdaa1d065027272466aa76e2e39413965efc3..dd595bcefd8c62fc6700fdf9b941517a77066d6c 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/CMakeLists.txt @@ -45,6 +45,5 @@ atlas_add_component( MuonTrackMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaMonitoringLib StoreGateLib SGtests GeoPrimitives EventPrimitives FourMomUtils xAODEventInfo xAODMuon xAODTracking GaudiKernel MuonIdHelpersLib MuonPrepRawData MuonRecHelperToolsLib MuonRecToolInterfaces MuonHistUtils MuonResonanceToolsLib MuonSelectorToolsLib TrkEventPrimitives TrkParameters TrkTrack TrkToolInterfaces TrkValHistUtils TrigConfL1Data TrkMeasurementBase TrkMultiComponentStateOnSurface ) # Install files from the package: -atlas_install_headers( MuonTrackMonitoring ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py index 86c8791e77ff8c643d005bae86b0ebcd715f7cb1..17a556f53384d59e7ad59a9381badecf759662ca 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/python/MuonTrackMonitorAlgorithm.py @@ -16,7 +16,7 @@ def MuonTrackConfig(inputFlags, isOld=False): helper = AthMonitorCfgHelper(inputFlags, "MuonTrackMonitoringConfig") - muonTrackAlg = helper.addAlgorithm(MuonTrackMonitorAlgorithm, "MuonTrackMonitorAlgorithmAlg") + muonTrackAlg = helper.addAlgorithm(MuonTrackMonitorAlgorithm, "MuonTrackMonitorAlgorithm") myGroup = helper.addGroup(muonTrackAlg, "MuonTrackMonitorAlgorithm", "MuonPhysics/") diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx index a3d50de4a89eeb792c9021cac919858303768ca4..d18591933e2b7f128bb49c177b0376ea35f58e1c 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx @@ -3,7 +3,7 @@ 2020 Matthias Schott - Uni Mainz */ -#include "MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h" +#include "MuonTrackMonitorAlgorithm.h" MuonTrackMonitorAlgorithm::MuonTrackMonitorAlgorithm (const std::string& name, ISvcLocator* pSvcLocator) :AthMonitorAlgorithm(name,pSvcLocator){} @@ -11,8 +11,10 @@ MuonTrackMonitorAlgorithm::MuonTrackMonitorAlgorithm (const std::string& name, I StatusCode MuonTrackMonitorAlgorithm::initialize() { + ATH_CHECK(AthMonitorAlgorithm::initialize()); ATH_CHECK(m_MuonContainerKey.initialize()); - return AthMonitorAlgorithm::initialize(); + ATH_CHECK(m_MuonIsoDecorKey.initialize()); + return StatusCode::SUCCESS; } StatusCode MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*> &vecMuons) const @@ -103,7 +105,7 @@ StatusCode MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifie } //======================================================================================================== -StatusCode MuonTrackMonitorAlgorithm::analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const +StatusCode MuonTrackMonitorAlgorithm::analyseLowLevelMuonFeatures(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const { using namespace Monitored; /// Declaring all variables that are initialized via Python will be plotted @@ -125,7 +127,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseLowLevelMuonFeatures(const xAOD::Mu auto MSLumiBlockNumberOfSegments = Monitored::Scalar<float>("MSLumiBlockNumberOfSegments", 0); /// Loop over all muons - for(const auto& muon : *Muons) { + for(const auto& muon : Muons) { xAOD::Muon::Quality muonQuality = muon->quality(); xAOD::Muon::MuonType muonType = muon->muonType(); xAOD::Muon::Author muonAuthor = muon->author(); @@ -171,7 +173,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseLowLevelMuonFeatures(const xAOD::Mu //======================================================================================================== -StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const { +StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const { using namespace Monitored; /// Declaring all variables that are initialized via Python will be plotted @@ -188,7 +190,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonCont std::vector<const xAOD::Muon*> vecCombinedMuonsHighPT; std::vector<const xAOD::Muon*> vecCombinedMuons; - for(const auto& muon : *Muons) { + for(const auto& muon : Muons) { xAOD::Muon::MuonType muonType = muon->muonType(); if (muonType==xAOD::Muon::Combined) { CBMuonLumiBlock = lumiBlockID; @@ -222,7 +224,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonCont bool isTriggered = false; for(const auto& chain : m_hltchainList){ - if(getTrigDecisionTool()->isPassed( chain ) ){ + if(!getTrigDecisionTool().empty() && getTrigDecisionTool()->isPassed( chain ) ){ isTriggered = true; } } @@ -239,7 +241,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonCont //======================================================================================================== -StatusCode MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const { +StatusCode MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const { using namespace Monitored; /// Declaring all variables that are initialized via Python will be plotted @@ -257,7 +259,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonCo std::vector<const xAOD::Muon*> vecMuons_ZBoson_Candidates; /// Select Muons Relevant for Z - for(const auto& muon : *Muons) { + for(const auto& muon : Muons) { xAOD::Muon::MuonType muonType = muon->muonType(); if (muonType==xAOD::Muon::Combined) { const xAOD::TrackParticle *cbtp = nullptr; @@ -318,7 +320,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonCo //======================================================================================================== -StatusCode MuonTrackMonitorAlgorithm::analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const { +StatusCode MuonTrackMonitorAlgorithm::analyseJPsiCandidates(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const { using namespace Monitored; /// Declaring all variables that are initialized via Python will be plotted @@ -336,7 +338,7 @@ StatusCode MuonTrackMonitorAlgorithm::analyseJPsiCandidates(const xAOD::MuonCont std::vector<const xAOD::Muon*> vecMuons_JPsi_Candidates; /// JPsi Muon Selection - for(const auto& muon : *Muons) { + for(const auto& muon : Muons) { xAOD::Muon::MuonType muonType = muon->muonType(); if (muonType==xAOD::Muon::Combined) { const xAOD::TrackParticle *cbtp = nullptr; @@ -401,20 +403,18 @@ StatusCode MuonTrackMonitorAlgorithm::fillHistograms(const EventContext& ctx) co using namespace Monitored; //Declare the quantities which should be monitored - auto run = Monitored::Scalar<int>("run", 0); - run = GetEventInfo(ctx)->runNumber(); - - const xAOD::EventInfo* eventInfo = nullptr; - ATH_CHECK(evtStore()->retrieve(eventInfo)); - int lumiBlockID = (int)eventInfo->lumiBlock(); + uint32_t lumiBlockID = GetEventInfo(ctx)->lumiBlock(); - const xAOD::MuonContainer* Muons = nullptr; - ATH_CHECK(evtStore()->retrieve(Muons, "Muons")); + SG::ReadHandle<xAOD::MuonContainer> Muons{m_MuonContainerKey, ctx}; + if (ATH_UNLIKELY(! Muons.isValid())) { + ATH_MSG_ERROR("Unable to retrieve muon container " << m_MuonContainerKey); + return StatusCode::FAILURE; + } - ATH_CHECK( analyseLowLevelMuonFeatures(Muons, lumiBlockID) ); - ATH_CHECK( analyseCombinedTracks(Muons, lumiBlockID) ); - ATH_CHECK( analyseZBosonCandidates(Muons, lumiBlockID) ); - ATH_CHECK( analyseJPsiCandidates(Muons, lumiBlockID) ); + ATH_CHECK( analyseLowLevelMuonFeatures(*Muons, lumiBlockID) ); + ATH_CHECK( analyseCombinedTracks(*Muons, lumiBlockID) ); + ATH_CHECK( analyseZBosonCandidates(*Muons, lumiBlockID) ); + ATH_CHECK( analyseJPsiCandidates(*Muons, lumiBlockID) ); return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.h similarity index 89% rename from MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h rename to MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.h index 2787d39214e1b6f78fbbc1605ba5da87e2ddaaca..ea9352df58739183cb4e2eb24dd225c22dcc469a 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.h @@ -28,6 +28,7 @@ class MuonTrackMonitorAlgorithm : public AthMonitorAlgorithm private: SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey { this, "MuonContainerKey", "Muons", "Key for Muon Containers" }; + SG::ReadDecorHandleKey<xAOD::MuonContainer> m_MuonIsoDecorKey { this, "MuonIsoDecorKey", "Muons.ptcone30" }; // Toolds /// Fills data-quality information (e.g. pt, eta, phi..) to histograms for given selection of muons @@ -37,16 +38,16 @@ class MuonTrackMonitorAlgorithm : public AthMonitorAlgorithm StatusCode FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*> &vecMuons) const; /// Function to create performance plots for muon standalone tracks with some detailed informatiom - StatusCode analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + StatusCode analyseLowLevelMuonFeatures(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const; /// Function to create performance plots for all combined muons - StatusCode analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + StatusCode analyseCombinedTracks(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const; /// Function to create performance plots for all combined muons that lead to a Z Boson Candidate event - StatusCode analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + StatusCode analyseZBosonCandidates(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const; /// Function to create performance plots for all combined muons that lead to a JPsi Meson Candidate event - StatusCode analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const; + StatusCode analyseJPsiCandidates(const xAOD::MuonContainer& Muons, uint32_t lumiBlockID) const; Gaudi::Property< std::vector<std::string> > m_hltchainList{ this, "HLTTriggerList", {"HLT_2mu14", "HLT_mu26_ivarmedium"}, "High-level triggers used" }; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx index 725709de61b4f2b7b8ec97689c76b53a7b357e41..0d32f41b0e62f165d58d649f40d45f3989e57538 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/components/MuonTrackMonitoring_entries.cxx @@ -3,6 +3,6 @@ 2020 Matthias Schott - Uni Mainz */ -#include "MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h" +#include "../MuonTrackMonitorAlgorithm.h" DECLARE_COMPONENT( MuonTrackMonitorAlgorithm ) diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx index f373254a8db11d8f5cc9b7df36a3da84ad81dae7..3cd26d5407ff9f5b02b440b204e9e9089936ea20 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonGMNtupleWriter.h" @@ -17,7 +17,6 @@ namespace MuonGM { MuonGMNtupleWriter::MuonGMNtupleWriter(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), - //m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_tree(0), m_nevents(0) { @@ -56,11 +55,6 @@ namespace MuonGM { return StatusCode::FAILURE; } - // if(m_idHelper.retrieve().isFailure()) { - // ATH_MSG_ERROR("Failed to retrieve: " << m_idHelper ); - // return StatusCode::FAILURE; - // } - m_mdtSurfaceBranch.initForWrite(*m_tree,"mdt_"); return AthAlgorithm::initialize(); @@ -103,7 +97,7 @@ namespace MuonGM { ++nmdt; if( fout ) { (*fout) << " New MDT ReadoutElement " << detEl->identify().get_compact() - << " " << MuonDetMgr->mdtIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) + << " " << MuonDetMgr->mdtIdHelper()->print_to_string(detEl->identify()) << " nlayers " << detEl->getNLayers() << " ntubes " << detEl->getNtubesperlayer() << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } @@ -135,7 +129,7 @@ namespace MuonGM { if( fout ) { (*fout) << " New RPC ReadoutElement " << detEl->identify().get_compact() - << " " << MuonDetMgr->rpcIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) + << " " << MuonDetMgr->rpcIdHelper()->print_to_string(detEl->identify()) << " NphiStripPanels " << detEl->NphiStripPanels() << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h index e7373f70fb47782500ba29c746572a6e5a8f339c..ca7d683892dcc6dfbe2076317b5bc904a3b8e257 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONGM_MUONGMNTUPLEWRITER_H @@ -7,16 +7,11 @@ // Athena & Gaudi includes #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" #include "TrkValidationUtils/SurfaceNtupleBranch.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" class TTree; -namespace Muon { - class MuonIdHelperTool; -} - namespace MuonGM { /** @class MuonGMNtupleWriter @@ -48,8 +43,6 @@ namespace MuonGM { protected: void fillNtuple(); - //ToolHandle<Trk::MuonIdHelperTool> m_idHelper; - std::string m_ntupleTreeName; /** jobOption: Ntuple tree name*/ std::string m_ntupleFileName; /** jobOption: Ntuple file name*/ std::string m_ntupleDirName; /** jobOption: Ntuple directory name*/ diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt b/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt index cba3e58160b7a063ba2431cb0011ca2c8d15d1bf..eac751a86ed07d4c6f7ac56ad761368b811034cf 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/CMakeLists.txt @@ -44,4 +44,5 @@ atlas_add_component( MuonPRDTest # Install files from the package: atlas_install_joboptions( share/*.py ) +atlas_install_scripts( scripts/*.py ) diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/scripts/checkNSWValTree.py b/MuonSpectrometer/MuonValidation/MuonPRDTest/scripts/checkNSWValTree.py new file mode 100644 index 0000000000000000000000000000000000000000..be48c4ea6a1d5262be1261f97705bc98d740d22b --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/scripts/checkNSWValTree.py @@ -0,0 +1,91 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# this script can be used to check the output ntuples of NSWPRDValAlg + +from __future__ import print_function +import os, sys, ROOT, argparse + +if __name__ == "__main__": + parser = argparse.ArgumentParser(prog='checkNSWValTree', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-i', '--inputFile', help='choose input ROOT file', default='NSWPRDValAlg.digi.ntuple.root', type=str) + parser.add_argument('--checkPRD', help='check also the RPDs (for reco validation only)', action='store_true', default=False) + Options = parser.parse_args() + + ROOT.gROOT.SetBatch(True) + + if not os.path.exists(Options.inputFile): + print ('ERROR: File %s does not exist'%Options.inputFile) + sys.exit(1) + + inputFile = ROOT.TFile(Options.inputFile, "READ") + if not inputFile: + print ('ERROR: Failed to open file %s'%Options.inputFile) + sys.exit(1) + inputTree = inputFile.Get("NSWValTree") + if not inputTree: + print ('ERROR: NSWValTree does not exist in file %s'%Options.inputFile) + sys.exit(1) + + nEntries = inputTree.GetEntries() + if nEntries==0: + print ('ERROR: NSWValTree of file %s has 0 entries'%Options.inputFile) + sys.exit(1) + + nHitsMM = 0 + nHitsSTGC = 0 + nDigitsMM = 0 + nDigitsSTGC = 0 + nSDOMM = 0 + nSDOSTGC = 0 + nRDOMM = 0 + nRDOSTGC = 0 + if Options.checkPRD: + nPRDMM = 0 + nPRDSTGC = 0 + for i in range(nEntries): + inputTree.GetEntry(i) + nHitsMM += inputTree.Hits_MM_n + nHitsSTGC += inputTree.Hits_sTGC_n + nDigitsMM += inputTree.Digits_MM + nDigitsSTGC += inputTree.Digits_sTGC + nSDOMM += inputTree.SDO_MM + nSDOSTGC += inputTree.SDO_sTGC + nRDOMM += inputTree.RDO_MM_n + nRDOSTGC += inputTree.RDO_sTGC_n + if Options.checkPRD: + nPRDMM += inputTree.PRD_MM + nPRDSTGC += inputTree.PRD_sTGC + + if nHitsMM==0: + print ('ERROR: NSWValTree of file %s has 0 MM Hits'%Options.inputFile) + sys.exit(1) + elif nHitsSTGC==0: + print ('ERROR: NSWValTree of file %s has 0 STGC Hits'%Options.inputFile) + sys.exit(1) + elif nDigitsMM==0: + print ('ERROR: NSWValTree of file %s has 0 MM Digits'%Options.inputFile) + sys.exit(1) + elif nDigitsSTGC==0: + print ('ERROR: NSWValTree of file %s has 0 STGC Digits'%Options.inputFile) + sys.exit(1) + elif nSDOMM==0: + print ('ERROR: NSWValTree of file %s has 0 MM SDOs'%Options.inputFile) + sys.exit(1) + elif nSDOSTGC==0: + print ('ERROR: NSWValTree of file %s has 0 STGC SDOs'%Options.inputFile) + sys.exit(1) + elif nRDOMM==0: + print ('ERROR: NSWValTree of file %s has 0 MM RDOs'%Options.inputFile) + sys.exit(1) + elif nRDOSTGC==0: + print ('ERROR: NSWValTree of file %s has 0 STGC RDOs'%Options.inputFile) + sys.exit(1) + elif Options.checkPRD and nPRDMM==0: + print ('ERROR: NSWValTree of file %s has 0 MM PRDs'%Options.inputFile) + sys.exit(1) + elif Options.checkPRD and nPRDSTGC==0: + print ('ERROR: NSWValTree of file %s has 0 STGC PRDs'%Options.inputFile) + sys.exit(1) + + print ('INFO: All fine with file %s'%Options.inputFile) + diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx index 0411bb9b98b7ae22285cca92542f09ea18aaf940..172ab6bf89ee67d8b997a3ba09ab6d825bdd43fb 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CSCDigitVariables.h" @@ -12,6 +12,7 @@ #include "MuonReadoutGeometry/CscReadoutElement.h" +#include <TString.h> // for Form #include "TTree.h" /** ---------- filling of variables */ @@ -74,6 +75,7 @@ StatusCode CSCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* M m_CSC_dig_channel->push_back(channel); const MuonGM::CscReadoutElement* rdoEl = MuonDetMgr->getCscReadoutElement(Id); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nCSCDigitVariables::fillVariables() - Failed to retrieve CscReadoutElement for %s", __FILE__, __LINE__, m_CscIdHelper->print_to_string(Id).c_str())); // retrieve the MC truth associated with the digit (means the Geant4 hit information) if (csc_SdoContainer) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx index 4ed6536d860f83af105dfee3955e7c2c59e8afc9..58ff142d121afd7061b0f4c910c9c658c1038dd1 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx @@ -4,55 +4,38 @@ #include "MDTPRDValAlg.h" -#include "TTree.h" - #include "xAODEventInfo/EventInfo.h" - -///for GaudiKernel -#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ITHistSvc.h" - -#include "Identifier/Identifier.h" - #include "AtlasHepMC/GenParticle.h" +#include "Identifier/Identifier.h" #include "TrackRecord/TrackRecordCollection.h" - #include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MuonIdHelpers/MdtIdHelper.h" #include "MuonSimEvent/MdtHitIdHelper.h" - #include "GeneratorObjects/McEventCollection.h" - #include "MuonSimEvent/MDTSimHitCollection.h" #include "MuonSimEvent/MDTSimHit.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonSimData/MuonSimData.h" #include "MuonSimData/MuonSimDataCollection.h" - - #include "TrkParameters/TrackParameters.h" #include "TrkSurfaces/StraightLineSurface.h" #include "TrkGeometry/MagneticFieldProperties.h" -#include <iostream> -#include <fstream> #include "TTree.h" +#include <TString.h> // for Form #include <string> #include <sstream> #include <map> +#include <iostream> +#include <fstream> using namespace MuonGM; -MDTPRDValAlg::MDTPRDValAlg(const std::string& name, - ISvcLocator* pSvcLocator) : +MDTPRDValAlg::MDTPRDValAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_mdttree(0), m_event_counter(0), - m_log(0), - m_debug(false), - m_verbose(false), m_counter_ValHitNumber(-99), m_Validation_MDT_Type(-99), @@ -151,27 +134,10 @@ MDTPRDValAlg::MDTPRDValAlg(const std::string& name, } -MDTPRDValAlg::~MDTPRDValAlg() -{ -} - StatusCode MDTPRDValAlg::initialize() { - m_log = new MsgStream( msgSvc(), name()); - m_debug = m_log->level() <= MSG::DEBUG; - m_verbose = m_log->level() <= MSG::VERBOSE; - *m_log << MSG::INFO << " initializing MDTPRDValAlg " << endmsg; - - /**Locate the StoreGateSvc and initialize our local ptr - intitialize transient event store - */ - - StatusCode sc = m_muonIdHelperTool.retrieve(); - if (sc.isFailure()){ - *m_log << MSG::ERROR << "Cannot retrieve MuonIdHelperTool" << endmsg; - return sc; - } - + ATH_MSG_DEBUG(" initializing MDTPRDValAlg "); + ATH_CHECK(m_idHelperSvc.retrieve()); /// ROOT AANtuple Initialization--------------------------------------- @@ -187,20 +153,11 @@ StatusCode MDTPRDValAlg::initialize() StatusCode status; ITHistSvc* hSvc=0; ISvcLocator* svcLocator = Gaudi::svcLocator(); - sc = svcLocator->service("THistSvc", hSvc); - if (sc.isFailure()) { - *m_log << MSG::WARNING << " could not get THistSvc " << endmsg; - return sc; - } + ATH_CHECK(svcLocator->service("THistSvc", hSvc)); - status=ToolRootHistSvc()->regTree(mdttreePath, m_mdttree); - - if(status.isFailure()) { - *m_log << MSG::DEBUG << "MDTPRDValAlg:: Unable to register TTreeTuple : " << mdttreePath << endmsg; - return status; - } + ATH_CHECK(ToolRootHistSvc()->regTree(mdttreePath, m_mdttree)); - *m_log << MSG::INFO << " Creating new ntuple " << mdttreePath << endmsg; + ATH_MSG_DEBUG(" Creating new ntuple " << mdttreePath); //-----------------------------------------------// /**add items-variables to the validation AANTUPLE @@ -291,24 +248,14 @@ StatusCode MDTPRDValAlg::initialize() } - sc = m_extrapolator.retrieve(); - if( sc.isSuccess() ){ - *m_log<<MSG::INFO << "Retrieved " << m_extrapolator << endmsg; - }else{ - *m_log<<MSG::FATAL<<"Could not get " << m_extrapolator <<endmsg; - return sc; - } - sc = m_rotCreator.retrieve(); - if( sc.isSuccess() ){ - *m_log<<MSG::INFO << "Retrieved " << m_rotCreator << endmsg; - }else{ - *m_log<<MSG::FATAL<<"Could not get " << m_rotCreator <<endmsg; - return sc; - } + ATH_CHECK(m_extrapolator.retrieve()); + ATH_MSG_DEBUG("Retrieved " << m_extrapolator); + ATH_CHECK(m_rotCreator.retrieve()); + ATH_MSG_DEBUG("Retrieved " << m_rotCreator); m_event_counter=0; - *m_log << MSG::INFO << "MDTPRDValAlg:: Initialisation ended " << endmsg; + ATH_MSG_DEBUG("MDTPRDValAlg:: Initialisation ended "); return StatusCode::SUCCESS; } @@ -325,7 +272,7 @@ StatusCode MDTPRDValAlg::execute() to all MdtPrepData objects in the event that belong to a muon in the event. */ - if( m_debug ) *m_log << MSG::DEBUG << " MDTPRDValAlg:: execute " << endmsg; + ATH_MSG_DEBUG(" MDTPRDValAlg:: execute "); TruthMap truthMap; MuonMdtHitMap muonMdtHitMap; @@ -333,19 +280,19 @@ StatusCode MDTPRDValAlg::execute() // add MC event collection addMcEventCollection( truthMap ); - *m_log << MSG::INFO << " addMcEventCollection truth particles found " << truthMap.size() << endmsg; + ATH_MSG_DEBUG(" addMcEventCollection truth particles found " << truthMap.size()); // add muon entry record addMuonRecord( truthMap, false ); - *m_log << MSG::INFO << " addMuonEntryRecord truth particles found " << truthMap.size() << endmsg; + ATH_MSG_DEBUG(" addMuonEntryRecord truth particles found " << truthMap.size()); // add exit record addMuonRecord( truthMap, true ); - *m_log << MSG::INFO << " addMuonExitRecord truth particles found " << truthMap.size() << endmsg; + ATH_MSG_DEBUG(" addMuonExitRecord truth particles found " << truthMap.size()); // check whether we found truth particles if( truthMap.empty() ){ - *m_log << MSG::WARNING << "No truth particles found, cannot perform test" << endmsg; + ATH_MSG_WARNING("No truth particles found, cannot perform test"); return StatusCode::SUCCESS; } @@ -357,7 +304,7 @@ StatusCode MDTPRDValAlg::execute() // check whether we found truth hits if( muonMdtHitMap.empty() ){ - if( m_debug ) *m_log << MSG::DEBUG << "No truth hits found, cannot perform test" << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("No truth hits found, cannot perform test"); return StatusCode::SUCCESS; } @@ -370,16 +317,6 @@ StatusCode MDTPRDValAlg::execute() }/**Close execute*/ - -StatusCode MDTPRDValAlg::finalize() -{ - *m_log << MSG::INFO << " MDTPRDValAlg:: finalize " << endmsg; - - delete m_log; - - return StatusCode::SUCCESS; -} - /*---------------------------------------------------------*/ ITHistSvc* MDTPRDValAlg::ToolRootHistSvc() /*---------------------------------------------------------*/ @@ -387,7 +324,7 @@ ITHistSvc* MDTPRDValAlg::ToolRootHistSvc() StatusCode sc = service("THistSvc",m_rootsvc, true); if( sc.isFailure() ) { - *m_log << MSG::WARNING << ">>> Unable to locate the MDTPRDValAlg Histogram service" << endmsg; + ATH_MSG_WARNING(">>> Unable to locate the MDTPRDValAlg Histogram service"); } return m_rootsvc; @@ -401,22 +338,22 @@ void MDTPRDValAlg::addMcEventCollection( MDTPRDValAlg::TruthMap& truthMap ) cons /**Access MC truth information*/ const DataHandle<McEventCollection> mcEvent; if(!evtStore()->contains<McEventCollection>(m_key)) { - if( m_debug ) *m_log << MSG::DEBUG << "MDTPRDValAlg: Could not find MCevent" << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("MDTPRDValAlg: Could not find MCevent"); return; } if(evtStore()->retrieve(mcEvent,m_key).isFailure()){ - *m_log << MSG::WARNING << "MDTPRDValAlg: Could not retrieve MCevent" << endmsg; + ATH_MSG_WARNING("MDTPRDValAlg: Could not retrieve MCevent"); return; }else{ - if( m_debug ) *m_log << MSG::DEBUG << "MDTPRDValAlg: Found MCEvent" << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("MDTPRDValAlg: Found MCEvent"); } DataVector<HepMC::GenEvent>::const_iterator e; if (mcEvent->size()!=1) { - *m_log << MSG::WARNING << " MC event size larger than one: exit algorithm " << endmsg; + ATH_MSG_WARNING(" MC event size larger than one: exit algorithm "); } - if( m_verbose ) *m_log << MSG::VERBOSE << " looping over MC particles " << endmsg; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" looping over MC particles "); for (e=mcEvent->begin();e!=mcEvent->end(); e++) { for (HepMC::GenEvent::particle_const_iterator p= (**e).particles_begin(); p!= (**e).particles_end(); p++) { @@ -425,7 +362,7 @@ void MDTPRDValAlg::addMcEventCollection( MDTPRDValAlg::TruthMap& truthMap ) cons if( !(**p).production_vertex() ) continue; int barcode = (**p).barcode(); - *m_log << MSG::VERBOSE << " pdg " << pdg << " barcode " << barcode << endmsg; + ATH_MSG_VERBOSE(" pdg " << pdg << " barcode " << barcode); TruthInfo* info; @@ -437,15 +374,15 @@ void MDTPRDValAlg::addMcEventCollection( MDTPRDValAlg::TruthMap& truthMap ) cons info->barcode = barcode; info->pdg = pdg; truthMap.insert( std::make_pair(barcode,info) ); - *m_log << MSG::VERBOSE << " truthMap.size() " << truthMap.size() << endmsg; + ATH_MSG_VERBOSE(" truthMap.size() " << truthMap.size()); } else{ info = pos->second; if( info->pdg != pdg || info->barcode != barcode ){ - *m_log << MSG::WARNING << " TruthInfo inconsistent " << endmsg; + ATH_MSG_WARNING(" TruthInfo inconsistent "); continue; } if( info->vertex ){ - *m_log << MSG::WARNING << " TruthInfo already has vertex?!?!? " << endmsg; + ATH_MSG_WARNING(" TruthInfo already has vertex?!?!? "); continue; } } @@ -464,26 +401,26 @@ void MDTPRDValAlg::addMcEventCollection( MDTPRDValAlg::TruthMap& truthMap ) cons info->vertex = particle; - if( m_debug ) *m_log << MSG::DEBUG << " New muon at vertex " << barcode << " pos " << particle->position + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" New muon at vertex " << barcode << " pos " << particle->position << " phi " << particle->momentum.phi() << " theta " << particle->momentum.theta() - << " q*p " << particle->charge*particle->momentum.mag() << endmsg; + << " q*p " << particle->charge*particle->momentum.mag()); } } - if( m_debug ) { - if( truthMap.empty() ) *m_log << MSG::DEBUG << "MDTPRDValAlg: No Muons in MC event " << endmsg; - else *m_log << MSG::DEBUG << "MDTPRDValAlg: Found Muons: " << truthMap.size() << " in MC event" << endmsg; + if( msgLvl(MSG::DEBUG) ) { + if( truthMap.empty() ) ATH_MSG_DEBUG("MDTPRDValAlg: No Muons in MC event "); + else ATH_MSG_DEBUG("MDTPRDValAlg: Found Muons: " << truthMap.size() << " in MC event"); } } void MDTPRDValAlg::addMuonRecord( TruthMap& truthMap, bool exit ) const { - const TrackRecordCollection* truthCollection = 0; + const TrackRecordCollection* truthCollection = nullptr; std::string location = "MuonEntryLayer"; // Was "MuonEntryLayer" if(exit) location = "MuonExitLayer"; if ( evtStore()->contains<TrackRecordCollection>(location) ) { if(evtStore()->retrieve(truthCollection,location ).isFailure()){ - *m_log << MSG::WARNING << " Could not retrieve " << location << endmsg; + ATH_MSG_WARNING(" Could not retrieve " << location); } } @@ -492,7 +429,7 @@ void MDTPRDValAlg::addMuonRecord( TruthMap& truthMap, bool exit ) const { if(exit) location = "MuonExitLayerFilter"; if( evtStore()->contains<TrackRecordCollection>(location) ){ if(evtStore()->retrieve(truthCollection,location ).isFailure()){ - *m_log << MSG::WARNING << " Could not retrieve " << location << endmsg; + ATH_MSG_WARNING(" Could not retrieve " << location); } } } @@ -502,17 +439,17 @@ void MDTPRDValAlg::addMuonRecord( TruthMap& truthMap, bool exit ) const { if(exit) location = "MuonExitRecord"; if( evtStore()->contains<TrackRecordCollection>(location) ){ if(evtStore()->retrieve(truthCollection,location ).isFailure()){ - *m_log << MSG::WARNING << " Could not retrieve " << location << endmsg; + ATH_MSG_WARNING(" Could not retrieve " << location); } } } if( !truthCollection ){ - *m_log << MSG::WARNING << "MDTPRDValAlg: Could not retrieve TrackRecordCollection " << endmsg; + ATH_MSG_WARNING("MDTPRDValAlg: Could not retrieve TrackRecordCollection "); return; } - if( m_debug ) *m_log << MSG::DEBUG << "retrieved TrackRecordCollection " << truthCollection->size() << " at " << location << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("retrieved TrackRecordCollection " << truthCollection->size() << " at " << location); TrackRecordConstIterator tr_it = truthCollection->begin(); TrackRecordConstIterator tr_it_end = truthCollection->end(); for(;tr_it!=tr_it_end; ++tr_it){ @@ -536,11 +473,11 @@ void MDTPRDValAlg::addMuonRecord( TruthMap& truthMap, bool exit ) const { }else{ info = pos->second; if( info->pdg != pdg || info->barcode != barcode ){ - *m_log << MSG::WARNING << " TruthInfo inconsistent " << endmsg; + ATH_MSG_WARNING(" TruthInfo inconsistent "); continue; } if( info->muonEntry && !exit){ - *m_log << MSG::WARNING << " TruthInfo already has vertex?!?!? " << endmsg; + ATH_MSG_WARNING(" TruthInfo already has vertex?!?!? "); continue; } } @@ -560,18 +497,18 @@ void MDTPRDValAlg::addMuonRecord( TruthMap& truthMap, bool exit ) const { double e = (*tr_it).GetEnergy(); double mass = e*e - particle->momentum.mag()*particle->momentum.mag(); if(mass>0) mass = sqrt(mass); - if( m_debug ) *m_log << MSG::DEBUG << " New muon at " << location << " barcode " << barcode << " pdgid " << pdg + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" New muon at " << location << " barcode " << barcode << " pdgid " << pdg << " pos " << particle->position << " pergee pos " << particle->pars->position() << " phi " << particle->momentum.phi() << " theta " << particle->momentum.theta() << " q*p " << particle->charge*particle->momentum.mag() << " energy " << (*tr_it).GetEnergy() - << " mass " << mass << " volumeName " << (*tr_it).GetVolName() << endmsg; + << " mass " << mass << " volumeName " << (*tr_it).GetVolName()); } - if( m_debug ) { - if( truthMap.empty() ) *m_log << MSG::DEBUG << "MDTPRDValAlg: No Muons in TrackRecord event " << endmsg; - else *m_log << MSG::DEBUG << "MDTPRDValAlg: Found Muons: " << truthMap.size() << " in Track Record" << endmsg; + if( msgLvl(MSG::DEBUG) ) { + if( truthMap.empty() ) ATH_MSG_DEBUG("MDTPRDValAlg: No Muons in TrackRecord event "); + else ATH_MSG_DEBUG("MDTPRDValAlg: Found Muons: " << truthMap.size() << " in Track Record"); } } @@ -581,13 +518,13 @@ void MDTPRDValAlg::addSimHits( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR std::string location = "MDT_Hits"; if ( !evtStore()->contains<MDTSimHitCollection>(location) ) { - if( m_debug ) *m_log << MSG::DEBUG << " No SimHits found at " << location << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" No SimHits found at " << location); return; } const DataHandle<MDTSimHitCollection> p_collection; if (evtStore()->retrieve(p_collection,location).isFailure()) { - *m_log << MSG::WARNING << "No MDTSimHitCollection in StoreGate!" << endmsg; + ATH_MSG_WARNING("No MDTSimHitCollection in StoreGate!"); return; } @@ -620,12 +557,12 @@ void MDTPRDValAlg::addSimHits( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR /**Create the offline identifiers, fill them with hit info.Ready to be accessed and retrieve info. Currently not used in this code except for some checks. */ - Identifier offid = m_muonIdHelperTool->mdtIdHelper().channelID(mdt_stname, mdt_steta, mdt_stphi,mdt_ml,mdt_tl,mdt_tube); + Identifier offid = m_idHelperSvc->mdtIdHelper().channelID(mdt_stname, mdt_steta, mdt_stphi,mdt_ml,mdt_tl,mdt_tube); if (offid == 0){ - *m_log << MSG::WARNING << "MDT: Cannot build a valid Identifier; skip " << endmsg; + ATH_MSG_WARNING("MDT: Cannot build a valid Identifier; skip "); continue; } - if( m_verbose ) *m_log << MSG::VERBOSE << " SimHit: barcode " << barcode << " " << m_muonIdHelperTool->mdtIdHelper().print_to_string(offid) << endmsg; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" SimHit: barcode " << barcode << " " << m_idHelperSvc->mdtIdHelper().print_to_string(offid)); MdtHitMap& mdtHitMap = muonMdtHitMap[barcode]; @@ -638,17 +575,17 @@ void MDTPRDValAlg::addSimHits( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR }else{ MdtHitData* mdtHitData = pos->second; if( mdtHitData->barcode != barcode ){ - *m_log << MSG::WARNING << " MdtHitData barcode inconsistent " << endmsg; + ATH_MSG_WARNING(" MdtHitData barcode inconsistent "); continue; } if( mdtHitData->simHit ){ - *m_log << MSG::WARNING << " MdtHitData for barcode " << barcode << " already has sim hit " << endmsg; + ATH_MSG_WARNING(" MdtHitData for barcode " << barcode << " already has sim hit "); continue; } mdtHitData->simHit = simHit; } } - if( m_debug ) *m_log << MSG::DEBUG << " filled simhit into map " << muonMdtHitMap.size() << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" filled simhit into map " << muonMdtHitMap.size()); } @@ -658,15 +595,15 @@ void MDTPRDValAlg::addSimData( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR std::string location = "MDT_SDO"; const MuonSimDataCollection* sdoContainer = 0; if ( !evtStore()->contains<MuonSimDataCollection>(location) ) { - if( m_debug ) *m_log << MSG::DEBUG << " No SimData found at " << location << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" No SimData found at " << location); return; } if (evtStore()->retrieve(sdoContainer,location).isFailure()) { - *m_log << MSG::WARNING << "No MDT Sdo Container found" << endmsg; + ATH_MSG_WARNING("No MDT Sdo Container found"); return; } - if( m_debug ) *m_log << MSG::DEBUG << "MDT Sdo Container found " << sdoContainer->size() << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("MDT Sdo Container found " << sdoContainer->size()); MuonSimDataCollection::const_iterator sit = sdoContainer->begin(); @@ -677,15 +614,15 @@ void MDTPRDValAlg::addSimData( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR const MuonSimData& simData = sit->second; if( simData.getdeposits().empty() ) { - *m_log << MSG::WARNING << "MDT Sdo without deposits " << m_muonIdHelperTool->mdtIdHelper().print_to_string(id) << endmsg; + ATH_MSG_WARNING("MDT Sdo without deposits " << m_idHelperSvc->mdtIdHelper().print_to_string(id)); continue; } int barcode = simData.getdeposits().front().first.barcode(); - if( m_debug ) *m_log << MSG::DEBUG << " SDO barcode " << barcode << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" SDO barcode " << barcode); if(barcode==0) { // barcode = 10001; - *m_log << MSG::WARNING << " barcode == 0 fixed to " << barcode << endmsg; + ATH_MSG_WARNING(" barcode == 0 fixed to " << barcode); } if( !truthMap.count(barcode) ) continue; @@ -700,16 +637,16 @@ void MDTPRDValAlg::addSimData( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap, MDTPR }else{ MdtHitData* mdtHitData = pos->second; if( mdtHitData->barcode != barcode ){ - *m_log << MSG::WARNING << " MdtHitData barcode inconsistent " << endmsg; + ATH_MSG_WARNING(" MdtHitData barcode inconsistent "); continue; } if( mdtHitData->sdo ){ - *m_log << MSG::WARNING << " MdtHitData for barcode " << barcode << " already has sim hit " << endmsg; + ATH_MSG_WARNING(" MdtHitData for barcode " << barcode << " already has sim hit "); continue; } - if( m_verbose ) *m_log << MSG::VERBOSE << "New SDO: barcode " << barcode << " " - << m_muonIdHelperTool->mdtIdHelper().print_to_string(id) << endmsg; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE("New SDO: barcode " << barcode << " " + << m_idHelperSvc->mdtIdHelper().print_to_string(id)); mdtHitData->sdo = &simData; } } @@ -722,16 +659,16 @@ void MDTPRDValAlg::addPrepData( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap ) con const Muon::MdtPrepDataContainer* mdtPrds = 0; std::string location = "MDT_DriftCircles"; if ( !evtStore()->contains<Muon::MdtPrepDataContainer>(location) ) { - if( m_debug ) *m_log << MSG::DEBUG << " No MdtPrepData found at " << location << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" No MdtPrepData found at " << location); return; } if( evtStore()->retrieve( mdtPrds,location ).isFailure() ) { - *m_log << MSG::WARNING << "MdtPrepDataContainer not found at " << location << endmsg; + ATH_MSG_WARNING("MdtPrepDataContainer not found at " << location); return; } - if( m_debug ) *m_log << MSG::DEBUG << "MdtPrepDataContainer found at " << location << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("MdtPrepDataContainer found at " << location); Muon::MdtPrepDataContainer::const_iterator p_mdt_it = mdtPrds->begin(); Muon::MdtPrepDataContainer::const_iterator p_mdt_it_end = mdtPrds->end(); @@ -749,12 +686,12 @@ void MDTPRDValAlg::addPrepData( MDTPRDValAlg::MuonMdtHitMap& muonMdtHitMap ) con if( !mdtHitData ) continue; if( mdtHitData->prd ){ - *m_log << MSG::WARNING << " MdtHitData already has prd " << endmsg; + ATH_MSG_WARNING(" MdtHitData already has prd "); continue; } - if( m_verbose ) *m_log << MSG::VERBOSE << " Muon PRD: barcode " << mdtHitData->barcode - << " " << m_muonIdHelperTool->mdtIdHelper().print_to_string(id) << endmsg; + if( msgLvl(MSG::VERBOSE) ) ATH_MSG_VERBOSE(" Muon PRD: barcode " << mdtHitData->barcode + << " " << m_idHelperSvc->mdtIdHelper().print_to_string(id)); mdtHitData->prd = &mdt; } @@ -784,14 +721,14 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap if (evtStore()->retrieve(pevt).isFailure()) { - *m_log << MSG::WARNING << "Could not find event" << endmsg; + ATH_MSG_WARNING("Could not find event"); return; }else { - if( m_debug ) *m_log << MSG::DEBUG << "Found EventInfo in SG" << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("Found EventInfo in SG"); } - if(m_verbose) { - *m_log << MSG::VERBOSE <<"Processing EventInfo event #"<<pevt->eventNumber() << " run: " << pevt->runNumber() << endmsg; + if(msgLvl(MSG::VERBOSE)) { + ATH_MSG_VERBOSE("Processing EventInfo event #"<<pevt->eventNumber() << " run: " << pevt->runNumber()); } @@ -803,8 +740,10 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap /**Enter MDT hits loop, initialize the hits counter*/ m_counter_ValHitNumber =0 ; - if( m_debug ) *m_log << MSG::DEBUG << " Event number: " << evt << endmsg; - if( m_debug ) *m_log << MSG::DEBUG << "Looping over muons: " << muonMdtHitMap.size() << endmsg; + if( msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG(" Event number: " << evt); + ATH_MSG_DEBUG("Looping over muons: " << muonMdtHitMap.size()); + } MuonMdtHitIt mit = muonMdtHitMap.begin(); MuonMdtHitIt mit_end = muonMdtHitMap.end(); @@ -812,11 +751,11 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap int barcode = mit->first; - if( m_debug ) *m_log << MSG::DEBUG << "Muon with bar code: " << barcode << " associated hits " << mit->second.size() << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("Muon with bar code: " << barcode << " associated hits " << mit->second.size()); TruthIt tit = truthMap.find(barcode); if( tit == truthMap.end() ){ - *m_log << MSG::WARNING << " barcode not found " << endmsg; + ATH_MSG_WARNING(" barcode not found "); continue; } @@ -829,34 +768,34 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap if( !muon ){ // if no entry record but vertex, use vertex if( m_useEntryLayer && vertex ){ - *m_log << MSG::WARNING << " No MuonEntry parameters, using vertex parameters instead " << endmsg; + ATH_MSG_WARNING(" No MuonEntry parameters, using vertex parameters instead "); muon = vertex; }else if( !m_useEntryLayer && muonEntry ){ - *m_log << MSG::WARNING << " No vertex parameters, using MuonEntry parameters instead " << endmsg; + ATH_MSG_WARNING(" No vertex parameters, using MuonEntry parameters instead "); muon = vertex; }else{ - *m_log << MSG::WARNING << " No parameters cannot perform extrapolation " << endmsg; + ATH_MSG_WARNING(" No parameters cannot perform extrapolation "); continue; } } if( !muon || !muon->pars ) { - *m_log << MSG::WARNING << " No track parameters cannot perform extrapolation " << endmsg; + ATH_MSG_WARNING(" No track parameters cannot perform extrapolation "); continue; } - if( m_debug ) *m_log << MSG::DEBUG << " muon entry " << barcode << " pos " << muon->position + if(msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG(" muon entry " << barcode << " pos " << muon->position << " phi " << muon->momentum.phi() << " theta " << muon->momentum.theta() - << " q*p " << muon->charge*muon->momentum.mag() << endmsg; - if( m_debug && muonExit) *m_log << MSG::DEBUG << " muon Exit " << barcode << " pos " << muonExit->position + << " q*p " << muon->charge*muon->momentum.mag()); + if(muonExit) ATH_MSG_DEBUG(" muon Exit " << barcode << " pos " << muonExit->position << " phi " << muonExit->momentum.phi() << " theta " << muonExit->momentum.theta() - << " q*p " << muonExit->charge*muonExit->momentum.mag() << endmsg; - + << " q*p " << muonExit->charge*muonExit->momentum.mag()); + } - const Trk::TrackParameters& muonPerigee = *muon->pars; - if( m_debug ) *m_log << MSG::DEBUG << " muonPerigee position " << muonPerigee.position() << " momentum " << muonPerigee.momentum() << endmsg; + if( msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG(" muonPerigee position " << muonPerigee.position() << " momentum " << muonPerigee.momentum()); // loop over MdtHitData MdtHitIt hit = mit->second.begin(); MdtHitIt hit_end = mit->second.end(); @@ -876,20 +815,17 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap if( !mdt ) { - *m_log << MSG::WARNING << " MdtHitData without MdtPrepData!!! " << endmsg; + ATH_MSG_WARNING(" MdtHitData without MdtPrepData!!! "); continue; } if( mdt->identify() != id ){ - *m_log << MSG::WARNING << " Identifier of MdtHitData not consisted with Identifier of MdtPrepData!!! " << endmsg; + ATH_MSG_WARNING(" Identifier of MdtHitData not consisted with Identifier of MdtPrepData!!! "); continue; } - const MuonGM::MdtReadoutElement* detEl = mdt->detectorElement() ; - if( !detEl ) { - *m_log << MSG::WARNING << " no associated detectorElement!!! " << endmsg; - continue; - } + const MuonGM::MdtReadoutElement* detEl = mdt->detectorElement(); + if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nMDTPRDValAlg::analyseHits() - no associated detectorElement", __FILE__, __LINE__)); // transform to global coords Amg::Vector3D simHitPosLoc(simHit->localPosition().x(), simHit->localPosition().y(), simHit->localPosition().z()); @@ -911,25 +847,25 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap for( ; deposits_it!= deposits_it_end; ++deposits_it) { sdoRadius = (*deposits_it).second.firstEntry(); sdoDistRO = (*deposits_it).second.secondEntry(); - if(m_debug) { + if(msgLvl(MSG::DEBUG)) { // check geometry Amg::Vector3D lpos0(0.,0.,0.); sdoHitPos = detEl->localToGlobalCoords(lpos0, id ); - if(m_debug) *m_log << MSG::DEBUG << " sdoHitPos 0 0 0 " << sdoHitPos << endmsg; + ATH_MSG_DEBUG(" sdoHitPos 0 0 0 " << sdoHitPos); Amg::Vector3D lpos1(100.,0.,0.); sdoHitPos = detEl->localToGlobalCoords(lpos1, id ); - if(m_debug) *m_log << MSG::DEBUG << " sdoHitPos 100 0 0 " << sdoHitPos << endmsg; + ATH_MSG_DEBUG(" sdoHitPos 100 0 0 " << sdoHitPos); Amg::Vector3D lpos2(0.,100.,0.); sdoHitPos = detEl->localToGlobalCoords(lpos2, id ); - if(m_debug) *m_log << MSG::DEBUG << " sdoHitPos 0 100 0 " << sdoHitPos << endmsg; + ATH_MSG_DEBUG(" sdoHitPos 0 100 0 " << sdoHitPos); Amg::Vector3D lpos3(0.,0.,100.); sdoHitPos = detEl->localToGlobalCoords(lpos3, id ); - if(m_debug) *m_log << MSG::DEBUG << " sdoHitPos 0 0 100 " << sdoHitPos << endmsg; + ATH_MSG_DEBUG(" sdoHitPos 0 0 100 " << sdoHitPos); } // position along wire = locZ in DetEl frame ( != Tracking frame...) Amg::Vector3D lpos(0.,0.,sdoDistRO); sdoHitPos = detEl->localToGlobalCoords(lpos, id ); - if(m_debug) *m_log << MSG::DEBUG << " sdoHitPos " << sdoHitPos << " phi " << sdoHitPos.phi() << endmsg; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG(" sdoHitPos " << sdoHitPos << " phi " << sdoHitPos.phi()); } // simHit = sdoHit = Wire position in global coordinates @@ -943,18 +879,20 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap const Trk::TrackParameters* expar = m_extrapolator->extrapolateDirectly(muonPerigee,sagSurf, Trk::alongMomentum,false); if( !expar ){ - *m_log << MSG::INFO << " extrapolation failed " << endmsg; + ATH_MSG_DEBUG(" extrapolation failed "); continue; } - if(m_debug) *m_log << MSG::DEBUG << " extrapolated position " << expar->position() << " local position X " << expar->parameters()[Trk::locX] << " local position Y " << expar->parameters()[Trk::locY] << " position phi " << expar->position().phi() << " global phi direction " << expar->parameters()[Trk::phi] << endmsg; - if(m_debug) *m_log << MSG::DEBUG << " SL surface position " << sagSurf.center() << endmsg; + if(msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG(" extrapolated position " << expar->position() << " local position X " << expar->parameters()[Trk::locX] << " local position Y " << expar->parameters()[Trk::locY] << " position phi " << expar->position().phi() << " global phi direction " << expar->parameters()[Trk::phi]); + ATH_MSG_DEBUG(" SL surface position " << sagSurf.center()); + } // calculate local position of extrapolated track parameter Amg::Vector2D lexpos, lsimpos; bool trf_ok=sagSurf.globalToLocal( expar->position(), expar->momentum(), lexpos); if(trf_ok) trf_ok=sagSurf.globalToLocal( expar->position(), expar->momentum() , lsimpos); if( !trf_ok ){ - *m_log << MSG::INFO << " global to local failed " << endmsg; + ATH_MSG_DEBUG(" global to local failed "); delete expar; continue; } @@ -963,13 +901,13 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap // const Trk::TrackParameters* exparEloss = m_extrapolator->extrapolate(muonPerigee,sagSurf,Trk::alongMomentum,false); if( !exparEloss ){ - *m_log << MSG::INFO << " extrapolation failed " << endmsg; + ATH_MSG_DEBUG(" extrapolation failed "); delete expar; continue; } Amg::Vector2D lexposEloss(0., 0.); if( sagSurf.globalToLocal( exparEloss->position(), exparEloss->momentum() , lexposEloss) ){ - *m_log << MSG::INFO << " global to local failed lexposEloss " << endmsg; + ATH_MSG_DEBUG(" global to local failed lexposEloss "); delete expar; delete exparEloss; continue; @@ -977,7 +915,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap const Trk::StraightLineSurface* saggedSurface = sagSurf.correctedSurface(lexpos); if( !saggedSurface ){ - *m_log << MSG::INFO << " could to create sagged surface " << endmsg; + ATH_MSG_DEBUG(" could to create sagged surface "); delete expar; delete exparEloss; continue; @@ -985,7 +923,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap const Trk::TrackParameters* exparSag = m_extrapolator->extrapolateDirectly(muonPerigee,*saggedSurface, Trk::alongMomentum,false); if( !exparSag ){ - *m_log << MSG::INFO << " extrapolation failed " << endmsg; + ATH_MSG_DEBUG(" extrapolation failed "); delete saggedSurface; delete expar; delete exparEloss; @@ -995,7 +933,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap // calculate local position of extrapolated track parameter Amg::Vector2D lexposSag(0., 0.); if( saggedSurface->globalToLocal( exparSag->position(), expar->momentum() , lexposSag)){ - *m_log << MSG::INFO << " global to local failed " << endmsg; + ATH_MSG_DEBUG(" global to local failed "); delete saggedSurface; delete expar; delete exparEloss; @@ -1009,7 +947,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap if(sdo&&!simHit) hitPos = sdoHitPos; const Muon::MdtDriftCircleOnTrack* rot = m_rotCreator->createRIO_OnTrack( *mdt, hitPos ); if( !rot ){ - *m_log << MSG::INFO << " rot creation failed " << endmsg; + ATH_MSG_DEBUG(" rot creation failed "); delete saggedSurface; delete expar; delete exparEloss; @@ -1020,7 +958,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap const Trk::TrackParameters* exparSagRot = m_extrapolator->extrapolateDirectly(muonPerigee,rot->associatedSurface(), Trk::alongMomentum,false); if( !exparSagRot ){ - *m_log << MSG::INFO << " extrapolation failed " << endmsg; + ATH_MSG_DEBUG(" extrapolation failed "); delete rot; delete saggedSurface; delete expar; @@ -1036,11 +974,13 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap }else{ trf_ok = rot->associatedSurface().globalToLocal( exparSagRot->position(), Amg::Vector3D(0., 0., 0.), lexposSagRot ); } - if(m_debug) *m_log << MSG::DEBUG << " extrapolated position ito ROT " << exparSagRot->position() << endmsg; - if(m_debug) *m_log << MSG::DEBUG << " SL surface position ROT " << slSurf->center() << endmsg; + if(msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG(" extrapolated position ito ROT " << exparSagRot->position()); + ATH_MSG_DEBUG(" SL surface position ROT " << slSurf->center()); + } if( trf_ok ){ - *m_log << MSG::INFO << " global to local failed " << endmsg; + ATH_MSG_DEBUG(" global to local failed "); delete rot; delete saggedSurface; delete expar; @@ -1079,16 +1019,16 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap } // put station name string in AANTUPLE as Val_StName - if( m_muonIdHelperTool->mdtIdHelper().stationNameString( m_muonIdHelperTool->mdtIdHelper().stationName(id) ).size() == 3 ) - strcpy(m_Validation_MDT_StationName,m_muonIdHelperTool->mdtIdHelper().stationNameString( m_muonIdHelperTool->mdtIdHelper().stationName(id) ).c_str() ); + if( m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName(id) ).size() == 3 ) + strcpy(m_Validation_MDT_StationName,m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName(id) ).c_str() ); else strcpy(m_Validation_MDT_StationName,"ERR" ); - std::string stName = m_muonIdHelperTool->mdtIdHelper().stationNameString( m_muonIdHelperTool->mdtIdHelper().stationName(id)); + std::string stName = m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName(id)); int geoSign = 1; int codeBESL = 0; if(stName[0]=='B') { - if(m_muonIdHelperTool->mdtIdHelper().stationEta(id)>0) geoSign = -1; + if(m_idHelperSvc->mdtIdHelper().stationEta(id)>0) geoSign = -1; if(stName[2]=='L') codeBESL = 1; if(stName[2]=='S') codeBESL = 2; if(stName[2]=='F') codeBESL = 2; @@ -1100,18 +1040,18 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap // BEE if(stName[2]=='E') codeBESL = 3; } else if (stName[0]=='E') { - if(m_muonIdHelperTool->mdtIdHelper().stationEta(id)<0) geoSign = -1; + if(m_idHelperSvc->mdtIdHelper().stationEta(id)<0) geoSign = -1; if(stName[2]=='L') codeBESL = 11; if(stName[2]=='S') codeBESL = 12; // EE if(stName[1]=='E') codeBESL = 13; } - m_Validation_MDT_StationEta=m_muonIdHelperTool->mdtIdHelper().stationEta(id); - m_Validation_MDT_StationPhi=m_muonIdHelperTool->mdtIdHelper().stationPhi(id); - m_Validation_MDT_IDTube=m_muonIdHelperTool->mdtIdHelper().tube(id); - m_Validation_MDT_IDMultiLayer=m_muonIdHelperTool->mdtIdHelper().multilayer(id); - m_Validation_MDT_IDLayer=m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); + m_Validation_MDT_StationEta=m_idHelperSvc->mdtIdHelper().stationEta(id); + m_Validation_MDT_StationPhi=m_idHelperSvc->mdtIdHelper().stationPhi(id); + m_Validation_MDT_IDTube=m_idHelperSvc->mdtIdHelper().tube(id); + m_Validation_MDT_IDMultiLayer=m_idHelperSvc->mdtIdHelper().multilayer(id); + m_Validation_MDT_IDLayer=m_idHelperSvc->mdtIdHelper().tubeLayer(id); m_Validation_MDT_GeoSign = geoSign; m_Validation_MDT_BESL = codeBESL; @@ -1183,13 +1123,13 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap m_Validation_MDT_ExSagWireZ = (lexposSag)[Trk::locY]; m_Validation_MDT_SimRadius = simRadius; m_Validation_MDT_SdoRadius = sdoRadius; - m_Validation_MDT_WireLen = detEl->getWireLength(m_muonIdHelperTool->mdtIdHelper().tubeLayer(id),m_muonIdHelperTool->mdtIdHelper().tube(id) ); + m_Validation_MDT_WireLen = detEl->getWireLength(m_idHelperSvc->mdtIdHelper().tubeLayer(id),m_idHelperSvc->mdtIdHelper().tube(id) ); m_Validation_MDT_ExSagRotR = (lexposSagRot)[Trk::locX]; m_Validation_MDT_ExSagRotZ = (lexposSagRot)[Trk::locY]; m_Validation_MDT_RotRadius = rot->driftRadius(); - if( m_debug ){ + if( msgLvl(MSG::DEBUG) ){ double epr = (lexpos)[Trk::locX]; double epz = (lexpos)[Trk::locY]; double epsr = (lexposSag)[Trk::locX]; @@ -1217,7 +1157,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap double res_eprz_sdo = sdoDistRO - eprz; double res_simz_sdo = sdoDistRO - simDistRO; double res_sdoz_sdo = sdoDistRO - sdoDistRO; - *m_log << MSG::DEBUG << " new PRD " << m_muonIdHelperTool->mdtIdHelper().print_to_string( id ) << std::endl << std::setprecision(4) + ATH_MSG_DEBUG(" new PRD " << m_idHelperSvc->mdtIdHelper().print_to_string( id ) << std::endl << std::setprecision(4) << std::setw(15) << " " << std::setw(15) << "| expos " << std::setw(15) << "| expos sag " << std::setw(15) << "| expos ROT " << std::setw(15) << "| sim " << std::setw(15) << "| sdo " << "|" << std::endl << std::setw(15) << " r " << std::setw(15) << epr << std::setw(15) << epsr << std::setw(15) << eprr @@ -1231,7 +1171,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap << std::setw(15) << " res sim " << std::setw(15) << res_epz_sim << std::setw(15) << res_epsz_sim << std::setw(15) << res_eprz_sim << std::setw(15) << res_simz_sim << std::setw(15) << res_sdoz_sim << std::endl << std::setw(15) << " res sdo " << std::setw(15) << res_epz_sdo << std::setw(15) << res_epsz_sdo << std::setw(15) << res_eprz_sdo - << std::setw(15) << res_simz_sdo << std::setw(15) << res_sdoz_sdo << endmsg; + << std::setw(15) << res_simz_sdo << std::setw(15) << res_sdoz_sdo); } delete rot; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h index b09a186df0d080f18a3524cc8c7e1b21e0e53173..2bddf1d6ea31caa8849c87eb6b44519bb44ef89e 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h @@ -1,35 +1,29 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MDTPRDValAlg_H #define MDTPRDValAlg_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" - #include "TrkExInterfaces/IExtrapolator.h" #include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" - #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "TrkParameters/TrackParameters.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <sstream> #include <string> #include <vector> #include <map> - class MDTSimHit; class MuonSimData; -class Identifier; class TTree; -class TFile; class ITHistSvc; -class MsgStream; // pre-declarations namespace MuonGM { @@ -90,14 +84,11 @@ class MDTPRDValAlg: public AthAlgorithm { public: MDTPRDValAlg(const std::string& name, ISvcLocator* pSvcLocator); - ~MDTPRDValAlg(); + ~MDTPRDValAlg()=default; StatusCode initialize(); - StatusCode finalize(); StatusCode execute(); - - private: @@ -130,12 +121,8 @@ class MDTPRDValAlg: public AthAlgorithm { int m_StationPhi; int m_LastEvent; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - MsgStream* m_log; - bool m_debug; - bool m_verbose; bool isVerbose() {return (msgLevel() <= MSG::VERBOSE);} void addMcEventCollection( TruthMap& truthMap ) const; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx index 807ba187e898b378c1dc63c0bbc7d2c79401ced5..d543f0ad34c570e9756f427165a160b0e7c44ad0 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTSimHitVariables.cxx @@ -12,6 +12,7 @@ #include "AtlasHepMC/GenParticle.h" #include "TTree.h" +#include <TString.h> // for Form /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ @@ -52,11 +53,7 @@ StatusCode MDTSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* } const MuonGM::MdtReadoutElement* mdtdet = MuonDetMgr->getMdtReadoutElement(offid); - if (mdtdet == nullptr) - { - ATH_MSG_WARNING("MDT readout element not found for Id = " << m_MdtIdHelper->show_to_string(offid) << " skipping."); - continue; - } + if (!mdtdet) throw std::runtime_error(Form("File: %s, Line: %d\nMDTSimHitVariables::fillVariables() - Failed to retrieve MdtReadoutElement for %s", __FILE__, __LINE__, m_MdtIdHelper->print_to_string(offid).c_str())); m_MDT_Sim_stationName ->push_back(stname); m_MDT_stationName ->push_back(m_MdtIdHelper->stationName(offid)); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx index 8c809ca0a19fa1f54a47e84a900ae124ed6935bb..2f2110a9107c7d91b51fa760710490776fceb4f9 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MMDigitVariables.h" @@ -11,6 +11,7 @@ #include "MuonReadoutGeometry/MMReadoutElement.h" #include "TTree.h" +#include <TString.h> // for Form /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ @@ -66,7 +67,8 @@ StatusCode MMDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu // get the readout element class where the digit is recorded int isSmall = (stName[2] == 'S'); - const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); + const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMDigitVariables::fillVariables() - Failed to retrieve MMReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet)); // information from VMM chip std::vector<float> time = digit->chipResponseTime(); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx index b026d68d98d17e1a6750fe6a02944ad7266348e9..603629547bd91c194510abbd642f15e3a6bc0f11 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MMPRDVariables.h" @@ -11,10 +11,10 @@ #include "MuonRDO/MM_RawDataContainer.h" #include "MuonSimData/MuonSimDataCollection.h" - #include "MMRDOVariables.h" #include "MuonReadoutGeometry/MMReadoutElement.h" +#include <TString.h> // for Form #include "TTree.h" @@ -74,6 +74,7 @@ StatusCode MMPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* Muon m_NSWMM_prd_time->push_back(prd->time()); const MuonGM::MMReadoutElement* det = prd->detectorElement(); + if (!det) throw std::runtime_error(Form("File: %s, Line: %d\nMMPRDVariables::fillVariables() - no associated detectorElement", __FILE__, __LINE__)); Amg::Vector3D pos = prd->globalPosition(); const Amg::MatrixX & cov = prd->localCovariance(); Amg::Vector2D loc_pos(0., 0.); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx index 184a0bdf2c243531362143de604d3f7c11335930..d10ebbfd2f413675259bf507ecf790897096a10b 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx @@ -12,6 +12,7 @@ #include "MuonReadoutGeometry/MMReadoutElement.h" #include "TTree.h" +#include <TString.h> // for Form using namespace Muon; @@ -69,11 +70,8 @@ StatusCode MMRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Muon // get the readout element class where the RDO is recorded int isSmall = (stName[2] == 'S'); - const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); - if (!rdoEl) { - ATH_MSG_WARNING("Could not retrieve MMReadoutElement from DetectorManager for isSmall=" << isSmall << ", stationEta=" << stationEta << ", stationPhi=" << stationPhi << ", multiplet=" << multiplet << ", skipping this entry..."); - continue; - } + const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMRDOVariables::fillVariables() - Failed to retrieve MMReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet)); Amg::Vector2D localStripPos(0.,0.); if ( rdoEl->stripPosition(Id,localStripPos) ) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx index 60d1203c437e3d5e8fe1688f5b6ae43950d10737..55b977b0e200a2f447430f9ffa8ab08e3c9fa890 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx @@ -13,6 +13,7 @@ #include "MuonAGDDDescription/MMDetectorDescription.h" #include "MuonAGDDDescription/MMDetectorHelper.h" +#include <TString.h> // for Form #include "TTree.h" StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) @@ -27,7 +28,7 @@ StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* M // Get the MicroMegas Id hit helper MicromegasHitIdHelper* hitHelper = MicromegasHitIdHelper::GetHelper(); - MM_SimIdToOfflineId simToOffline(*m_MmIdHelper); + MM_SimIdToOfflineId simToOffline(m_MmIdHelper); if(nswContainer->size()==0) ATH_MSG_WARNING(" MMSimHit empty "); for( auto it : *nswContainer ) { @@ -133,11 +134,7 @@ StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* M << " phi " << m_MmIdHelper->stationPhi(offId) << " ml " << m_MmIdHelper->multilayer(offId) ); const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(offId); - - if( !detEl ){ - ATH_MSG_WARNING("MicroMegas geometry, failed to retrieve detector element for: " << m_MmIdHelper->print_to_string(offId) ); - continue; - } + if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nMMSimHitVariables::fillVariables() - Failed to retrieve MMReadoutElement for %s", __FILE__, __LINE__, m_MmIdHelper->print_to_string(offId).c_str())); // surface const Trk::PlaneSurface& surf = detEl->surface(offId); @@ -191,7 +188,6 @@ StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* M Amg::Vector2D fastDigitPos(0.,0.); if( !detEl->stripPosition(offId,fastDigitPos ) ){ ATH_MSG_WARNING("MicroMegas validation: failed to obtain local position for identifier " << m_MmIdHelper->print_to_string(offId) ); - continue; } Amg::Vector3D detpos = detEl->globalPosition(); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx index cf8281f6f697b0ca25b660acb681c752000fc34c..ac5993abd27caec7e52bf0a717185f61667e5362 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/RPCSimHitVariables.cxx @@ -12,6 +12,7 @@ #include "AtlasHepMC/GenParticle.h" #include "TTree.h" +#include <TString.h> // for Form /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ @@ -59,11 +60,7 @@ StatusCode RPCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* } const MuonGM::RpcReadoutElement* rpcdet = MuonDetMgr->getRpcReadoutElement(offid); - if (rpcdet == nullptr) - { - ATH_MSG_WARNING("RPC readout element not found for Id = " << m_RpcIdHelper->show_to_string(offid) << " skipping."); - continue; - } + if (!rpcdet) throw std::runtime_error(Form("File: %s, Line: %d\nRPCSimHitVariables::fillVariables() - Failed to retrieve RpcReadoutElement for %s", __FILE__, __LINE__, m_RpcIdHelper->print_to_string(offid).c_str())); m_RPC_Sim_stationName ->push_back(stname); m_RPC_stationName ->push_back(m_RpcIdHelper->stationName(offid)); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx index 6f0548591b413a3007090493e9333b7bee1f1dd8..256fceb14b039aca624a0efd4301b71bfe74e280 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx @@ -13,6 +13,7 @@ #include "MuonDigitContainer/sTgcDigitCollection.h" #include "TTree.h" +#include <TString.h> // for Form /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ @@ -71,8 +72,8 @@ StatusCode sTGCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* << " Station PhiMax [" << stationPhiMax << "]"); int isSmall = stName[2] == 'S'; - const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); - + const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCDigitVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet)); int channelNumber = 0; const Identifier phiId, etaId; Amg::Vector3D gpos(0.,0.,0.); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx index aa7ac9764eaf9b66326d13793fb5b080b997f13f..db22c4ab3776f4f2cac2bfd7aabec5db084ab9c3 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx @@ -8,7 +8,7 @@ #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "TTree.h" - +#include <TString.h> // for Form StatusCode sTGCPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { @@ -56,6 +56,7 @@ StatusCode sTGCPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu m_NSWsTGC_prd_bcTag->push_back(bcTag); const MuonGM::sTgcReadoutElement* det = prd->detectorElement(); + if (!det) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCPRDVariables::fillVariables() - no associated detectorElement", __FILE__, __LINE__)); Amg::Vector3D pos = prd->globalPosition(); Amg::Vector2D loc_pos(0., 0.); det->surface(Id).globalToLocal(pos, Amg::Vector3D(0., 0., 0.), loc_pos); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx index c5aeea59fa8a6b5d588552976aa99425ba77e117..dd4a02350e0c2947056963f0a9663922a120e654 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx @@ -11,6 +11,7 @@ #include "MuonRDO/STGC_RawDataContainer.h" #include "TTree.h" +#include <TString.h> // for Form using namespace Muon; @@ -73,11 +74,8 @@ StatusCode sTGCRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu // get the readout element class where the RDO is recorded int isSmall = stName[2] == 'S'; - const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); - if (!rdoEl) { - ATH_MSG_WARNING("Could not retrieve sTgcReadoutElement from DetectorManager for isSmall=" << isSmall << ", stationEta=" << stationEta << ", stationPhi=" << stationPhi << ", multiplet=" << multiplet << ", skipping this entry..."); - continue; - } + const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCRDOVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet)); Amg::Vector2D localStripPos(0.,0.); if ( rdoEl->stripPosition(Id,localStripPos) ) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx index 7e0d06fc996145bcc3b01ca13d0c98116c4c6f7b..440ecc5d8eb9a7122766b53c97f2fdce32d54157 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx @@ -9,7 +9,7 @@ #include "MuonReadoutGeometry/sTgcReadoutElement.h" #include "TTree.h" - +#include <TString.h> // for Form StatusCode sTGCSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { @@ -80,12 +80,8 @@ StatusCode sTGCSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* Mu // Retrive the detector element and local SDO coordinates bool isSmall = stName[2] == 'S'; - const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); - - if( !rdoEl ){ - ATH_MSG_WARNING("sTGC geometry, failed to retrieve detector element for: isSmall " << isSmall << " eta " << stationEta - << " phi " << stationPhi << " multiplet " << multiplet ); - } + const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet); + if (!rdoEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCSDOVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for isSmall=%d, stationEta=%d, stationPhi=%d, multiplet=%d", __FILE__, __LINE__, isSmall, stationEta, stationPhi, multiplet)); Amg::Vector2D loc_pos(0., 0.); rdoEl->surface(Id).globalToLocal(hit_gpos, Amg::Vector3D(0., 0., 0.), loc_pos); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx index cbef17f2cdfdf2fd26d4010b7ae354fb290003d8..3113b996a4b01374ed334dc7d7e7ea34c9a1a9d6 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx @@ -11,6 +11,7 @@ #include "MuonReadoutGeometry/sTgcReadoutElement.h" #include "TTree.h" +#include <TString.h> // for Form StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { @@ -25,7 +26,7 @@ StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* // Get sTGC Helper sTgcHitIdHelper* hitHelper = sTgcHitIdHelper::GetHelper(); - sTgcSimIdToOfflineId simToOffline (*m_sTgcIdHelper); + sTgcSimIdToOfflineId simToOffline(m_sTgcIdHelper); if(nswContainer->size()==0) ATH_MSG_WARNING(" sTGCSimHit empty "); for(auto it : *nswContainer) { @@ -88,10 +89,7 @@ StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* } const MuonGM::sTgcReadoutElement* detEl = MuonDetMgr->getsTgcReadoutElement(offId); - if( !detEl ){ - ATH_MSG_WARNING("sTGC geometry, failed to retrieve detector element for: isSmall " << isSmall << " eta " << m_sTgcIdHelper->stationEta(offId) - << " phi " << m_sTgcIdHelper->stationPhi(offId) << " ml " << m_sTgcIdHelper->multilayer(offId) ); - } + if (!detEl) throw std::runtime_error(Form("File: %s, Line: %d\nsTGCSimHitVariables::fillVariables() - Failed to retrieve sTgcReadoutElement for %s", __FILE__, __LINE__, m_sTgcIdHelper->print_to_string(offId).c_str())); if( !m_sTgcIdHelper->is_stgc(offId) ){ ATH_MSG_WARNING("sTgc id is not a stgc id! " << m_sTgcIdHelper->print_to_string(offId)); diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx index a6073b0869c7339cc4ba075213a1eaa4f586c2c4..302a732f07ab1352adf822f2916c7801de7b04eb 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx @@ -294,7 +294,7 @@ bool MuonTrackPerformanceAlg::handleTracks() { } bool MuonTrackPerformanceAlg::goodTruthTrack( const Muon::IMuonTrackTruthTool::TruthTreeEntry& entry ) const { - if( (!entry.cscHits.empty() || !entry.mmHits.empty()) && entry.mdtHits.empty() ) return false; + if( (!entry.cscHits.empty()||(!entry.mmHits.empty()&&!entry.stgcHits.empty()) ) && entry.mdtHits.empty() ) return false; TrackRecord* trackRecord = const_cast<TrackRecord*>(entry.truthTrack); if( !trackRecord ) return false; if( m_usePtCut ){ @@ -303,7 +303,7 @@ bool MuonTrackPerformanceAlg::goodTruthTrack( const Muon::IMuonTrackTruthTool::T if( trackRecord->GetMomentum().mag() < m_momentumCutSim ) return false; } if( !selectPdg(trackRecord->GetPDGCode()) ) return false; - if( m_isCombined && fabs(trackRecord->GetMomentum().eta()) > 2.8 ) return false; + if( m_isCombined && std::abs(trackRecord->GetMomentum().eta()) > 2.5 ) return false; int hits = entry.mdtHits.size(); if(m_idHelperSvc->hasCSC()) hits += entry.cscHits.size(); if(m_idHelperSvc->hasMM()) hits += entry.mmHits.size(); @@ -785,7 +785,7 @@ std::string MuonTrackPerformanceAlg::print( const Muon::IMuonTrackTruthTool::Tru << " phi " << trackRecord.GetMomentum().phi() << " theta " << trackRecord.GetMomentum().theta() << std::setw(6) << " q*mom " << (int)trackRecord.GetMomentum().mag()*charge << " pt " << std::setw(5) << (int)trackRecord.GetMomentum().perp(); - if( abs(trackRecord.GetPDGCode()) != 13 ) sout << " pdg " << trackRecord.GetPDGCode(); + if( std::abs(trackRecord.GetPDGCode()) != 13 ) sout << " pdg " << trackRecord.GetPDGCode(); if( trackTruth.truthTrajectory ) { const HepMC::GenParticle* mother = getMother( *trackTruth.truthTrajectory ); @@ -1210,7 +1210,7 @@ std::string MuonTrackPerformanceAlg::print( const MuonTrackPerformanceAlg::Track trackData.truthTrack->GetMomentum().z()), charge,Trk::PerigeeSurface(Amg::Vector3D(0.,0.,0.))); sout << "Truth: " << m_printer->print(perigee);// << " barcode " << trackData.truthTrack->GetBarCode(); - if( abs(trackData.truthTrack->GetPDGCode()) == 13 ){ + if( std::abs(trackData.truthTrack->GetPDGCode()) == 13 ){ if( trackData.motherPdg != -1 ) sout << " mother " << trackData.motherPdg; }else{ sout << " pdg " << trackData.truthTrack->GetPDGCode(); @@ -1225,15 +1225,15 @@ std::string MuonTrackPerformanceAlg::print( const MuonTrackPerformanceAlg::Track if( trackData.trackPars ){ sout << "Track: " << m_printer->print(*trackData.trackPars) << " chi2/ndof " << trackData.chi2Ndof << std::endl; if(trackData.trackPars->covariance()) { - double qOverP = fabs(trackData.trackPars->parameters()[Trk::qOverP]); + double qOverP = std::abs(trackData.trackPars->parameters()[Trk::qOverP]); double dpp = 0.; double cov00 = (*trackData.trackPars->covariance())(0,0); double cov11 = (*trackData.trackPars->covariance())(1,1); double cov22 = (*trackData.trackPars->covariance())(2,2); double cov33 = (*trackData.trackPars->covariance())(3,3); double cov44 = (*trackData.trackPars->covariance())(4,4); - if(qOverP>0) dpp = sqrt(cov44)/qOverP; - sout << " error d0 " << sqrt(cov00) << " z0 " << sqrt(cov11) << " phi (mrad) " << 1000*sqrt(cov22) << " theta (mrad) " << 1000*sqrt(cov33) << " dp/p " << dpp << std::endl; + if(qOverP>0) dpp = std::sqrt(cov44)/qOverP; + sout << " error d0 " << std::sqrt(cov00) << " z0 " << std::sqrt(cov11) << " phi (mrad) " << 1000*std::sqrt(cov22) << " theta (mrad) " << 1000*std::sqrt(cov33) << " dp/p " << dpp << std::endl; } @@ -1457,7 +1457,7 @@ const HepMC::GenParticle* MuonTrackPerformanceAlg::getMother( const TruthTraject std::vector<HepMcParticleLink>::const_reverse_iterator pit = traj.rbegin(); std::vector<HepMcParticleLink>::const_reverse_iterator pit_end = traj.rend(); for( ;pit!=pit_end;++pit ){ - if( abs((*pit)->pdg_id()) != 13 ) return *pit; + if( std::abs((*pit)->pdg_id()) != 13 ) return *pit; } return 0; } @@ -1466,7 +1466,7 @@ const HepMC::GenParticle* MuonTrackPerformanceAlg::getInitialState( const TruthT std::vector<HepMcParticleLink>::const_reverse_iterator pit = traj.rbegin(); std::vector<HepMcParticleLink>::const_reverse_iterator pit_end = traj.rend(); for( ;pit!=pit_end;++pit ){ - if( abs((*pit)->pdg_id()) != 13 ) { + if( std::abs((*pit)->pdg_id()) != 13 ) { if( pit!=traj.rbegin() ) --pit; else return 0; return *pit; diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx index d924661a7d0ebae6424408b59a315af574bb692c..ca06be7d3a7f781286d3baa2e53d914c68afa2f7 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackStatisticsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -371,67 +371,4 @@ std::string MuonTrackStatisticsTool::printTrackCounters() const void MuonTrackStatisticsTool::storeTruthTracks(void) { - /* - const McEventCollection* mcCollection = 0; - std::string key = "TruthEvent"; - StatusCode sc = evtStore()->retrieve(mcCollection,key); - if (sc.isFailure()) { - *m_log << MSG::ERROR << "Could not find the McEventCollection" << endmsg; - return; - } - - const TrackRecordCollection* recordCollection = 0; - std::string recordKey = "MuonEntryLayer"; - if (!(evtStore()->retrieve(recordCollection, recordKey))) { - *m_log << MSG::WARNING << "Could not find the TrackRecordCollection" << endmsg; - } - - m_nkine = 0; - - const HepMC::GenEvent* event = *mcCollection->begin(); - HepMC::GenEvent::particle_const_iterator particle = event->particles_begin(); - HepMC::GenEvent::particle_const_iterator particle_end = event->particles_end(); - - for ( ; particle != particle_end; ++particle) { - - // select final-state muons above min calo penetration energy - // and in MS acceptance - if (abs((*particle)->pdg_id()) != 13) continue; - if ((*particle)->status() != 1) continue; - if ((*particle)->momentum().e() < m_minProductionEnergy) continue; - if (fabs((*particle)->momentum().pseudoRapidity()) > m_maxEtaMS) continue; - // if ((*particle)->barcode() > 10000) continue; - - const Trk::TrackParameters* genPerigee = m_truthToTrack->makePerigeeParameters(*particle); - if( !genPerigee ) continue; - - const Trk::TrackParameters* genEntry = m_edmHelperSvc->extrapolateToMuonEntryRecord(*genPerigee,Trk::muon); - if( !genEntry ){ - delete genPerigee; - continue; - } - HepPoint3D gen_position = genPerigee->position(); - HepVector3D gen_momentum = genPerigee->momentum(); - double gen_charge = (*particle)->pdg_id() < 0 ? 1. : -1.; - - HepPoint3D extr_position = genEntry->position(); - HepVector3D extr_momentum = genEntry->momentum(); - double extr_charge = (*particle)->pdg_id() < 0 ? 1. : -1.; - - ++m_nkine; - - // store the muon generated parameters - m_xvtxg->push_back((*particle)->production_vertex()->point3d().x()); - m_yvtxg->push_back((*particle)->production_vertex()->point3d().y()); - m_zvtxg->push_back((*particle)->production_vertex()->point3d().z()); - m_a0g->push_back(genPerigee->parameters()[Trk::d0]); - m_z0g->push_back(genPerigee->parameters()[Trk::z0]); - m_phig->push_back((*particle)->momentum().phi()); - m_thetag->push_back((*particle)->momentum().theta()); - m_qpig->push_back(gen_charge/(*particle)->momentum().mag()); - m_etag->push_back((*particle)->momentum().pseudoRapidity()); - m_barcode->push_back((*particle)->barcode()); - m_status->push_back((*particle)->status()); - */ - } diff --git a/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.cxx b/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.cxx index 5817b809886025d9317b244f6d8e813d482d9f69..02951a30f2e8fb0bed4f483f3357dcb2ab1ee998 100644 --- a/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.cxx +++ b/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.cxx @@ -1,16 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonStationNtupleHelperTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #include "MuonStationNtupleHelperTool.h" + #include "TrkEventUtils/IdentifierExtractor.h" -#include "TTree.h" #include "TrkEventPrimitives/TrackStateDefs.h" -//#include "MuonIdHelpers/RpcIdHelper.h" + +#include "TTree.h" //================ Constructor ================================================= @@ -19,7 +16,6 @@ Muon::MuonStationNtupleHelperTool::MuonStationNtupleHelperTool(const std::string const IInterface* p ) : AthAlgTool(t,n,p), - m_muonIdHelperTool("Muon::MuonIdHelperTool"), m_mdtSectorIx(0), m_mdtStationIx(0), m_rpcSectorIx(0), @@ -29,35 +25,13 @@ Muon::MuonStationNtupleHelperTool::MuonStationNtupleHelperTool(const std::string m_tgcMeasuresPhi(0) { declareInterface<Trk::IValidationNtupleHelperTool>(this); - - // template for property decalration - //declareProperty("PropertyName", m_propertyName); } -//================ Destructor ================================================= - -Muon::MuonStationNtupleHelperTool::~MuonStationNtupleHelperTool() -{} - - //================ Initialisation ================================================= StatusCode Muon::MuonStationNtupleHelperTool::initialize() { - - StatusCode sc = AlgTool::initialize(); - if (sc.isFailure()) return sc; - - /* - if (detStore()->retrieve(m_rpcId).isFailure()) { - ATH_MSG_WARNING ("Could not get RPC ID helper !"); - return StatusCode::FAILURE; - }*/ - - if (m_muonIdHelperTool.retrieve().isFailure()) { - ATH_MSG_WARNING ("Could not get muon custom ID helper !"); - return StatusCode::FAILURE; - } + ATH_CHECK(m_idHelperSvc.retrieve()); m_mdtSectorIx = new std::vector<int>(); m_mdtStationIx = new std::vector<int>(); @@ -82,9 +56,7 @@ StatusCode Muon::MuonStationNtupleHelperTool::finalize() delete m_rpcMeasuresPhi; m_rpcMeasuresPhi=0; delete m_tgcStationIx; m_tgcStationIx=0; delete m_tgcMeasuresPhi; m_tgcMeasuresPhi=0; - - StatusCode sc = AlgTool::finalize(); - return sc; + return StatusCode::SUCCESS; } /////////////////////////////////////// @@ -130,17 +102,17 @@ StatusCode Muon::MuonStationNtupleHelperTool::fillMeasurementData ( Identifier id = Trk::IdentifierExtractor::extract(hit); if (detectorType==Trk::TrackState::MDT) { - m_mdtSectorIx->push_back(m_muonIdHelperTool->sector(id)); - m_mdtStationIx->push_back(m_muonIdHelperTool->stationIndex(id)); + m_mdtSectorIx->push_back(m_idHelperSvc->sector(id)); + m_mdtStationIx->push_back(m_idHelperSvc->stationIndex(id)); } if (detectorType==Trk::TrackState::RPC) { - m_rpcSectorIx->push_back(m_muonIdHelperTool->sector(id)); - m_rpcStationIx->push_back(m_muonIdHelperTool->stationIndex(id)); - m_rpcMeasuresPhi->push_back(m_muonIdHelperTool->measuresPhi(id)); + m_rpcSectorIx->push_back(m_idHelperSvc->sector(id)); + m_rpcStationIx->push_back(m_idHelperSvc->stationIndex(id)); + m_rpcMeasuresPhi->push_back(m_idHelperSvc->measuresPhi(id)); } if (detectorType==Trk::TrackState::TGC) { - m_tgcStationIx->push_back(m_muonIdHelperTool->stationIndex(id)); - m_tgcMeasuresPhi->push_back(m_muonIdHelperTool->measuresPhi(id)); + m_tgcStationIx->push_back(m_idHelperSvc->stationIndex(id)); + m_tgcMeasuresPhi->push_back(m_idHelperSvc->measuresPhi(id)); } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.h b/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.h index 833cf3d85ea1aaf20ab9c302ae739cccdd63f6aa..496be1fbe803d0f5e3b3cae1cfec4135bee851ae 100644 --- a/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.h +++ b/MuonSpectrometer/MuonValidation/MuonTrackValidation/src/MuonStationNtupleHelperTool.h @@ -1,23 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonStationNtupleHelperTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef MUONMUONSTATIONNTUPLEHELPERTOOL_H #define MUONMUONSTATIONNTUPLEHELPERTOOL_H -#include "AthenaBaseComps/AthAlgTool.h" #include "TrkValInterfaces/IValidationNtupleHelperTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" // this tool is not correctly interfaced -#include "GaudiKernel/ToolHandle.h" - -// class MdtIdHelper; -// class TgcIdHelper; -// class CscIdHelper; -// class MdtIdHelper; +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -39,7 +30,7 @@ namespace Muon MuonStationNtupleHelperTool(const std::string&,const std::string&,const IInterface*); /** default destructor */ - virtual ~MuonStationNtupleHelperTool (); + virtual ~MuonStationNtupleHelperTool()=default; /** standard Athena-Algorithm method */ virtual StatusCode initialize(); @@ -71,7 +62,7 @@ namespace Muon private: - ToolHandle<MuonIdHelperTool> m_muonIdHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; mutable std::vector<int>* m_mdtSectorIx; //!< sector number 1-16, odd=large, even=small mutable std::vector<int>* m_mdtStationIx; //!< describe diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx index bba7731d9650759ad487e063eaa22b53564dd17b..09b2bdc012ab90df83a4d45f55e2e87c06fea284 100644 --- a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionHelpers.cxx @@ -11,7 +11,7 @@ #include <SelectionHelpers/SelectionHelpers.h> -#include <PATCore/TAccept.h> +#include <PATCore/AcceptData.h> // // method implementations @@ -29,7 +29,7 @@ namespace CP - SelectionType selectionFromAccept (const Root::TAccept& accept) + SelectionType selectionFromAccept (const asg::AcceptData& accept) { return ~SelectionType (accept.getCutResultInvertedBitSet().to_ulong()); } diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h index c75f7ba99eed885ac220b2f78327ab0d5895f7d1..076dd2fcb7697a2117c1206e48bf15c5d42cd123 100644 --- a/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/SelectionHelpers/SelectionHelpers.h @@ -11,17 +11,17 @@ #include <AsgTools/MessageCheck.h> #include <cstdint> -namespace Root +namespace asg { - class TAccept; + class AcceptData; } namespace CP { /// \brief the type for selection decorations that are meant to hold - /// a \ref Root::TAccept + /// a \ref asg::AcceptData /// - /// This is matched to the number of bits in a TAccept, since that + /// This is matched to the number of bits in a AcceptData, since that /// holds 32 bits, so do we. typedef uint32_t SelectionType; @@ -30,7 +30,7 @@ namespace CP /// selected /// /// This is to be used when making a selection decoration for a - /// single cut and no TAccept object is at hand, as well as to check + /// single cut and no AcceptData object is at hand, as well as to check /// whether a particular selection passed. inline constexpr SelectionType selectionAccept () { return ~SelectionType (0);} @@ -40,7 +40,7 @@ namespace CP /// rejected /// /// This is to be used when making a selection decoration for a - /// single cut and no TAccept object is at hand. + /// single cut and no AcceptData object is at hand. inline constexpr SelectionType selectionReject () { return ~SelectionType (1);} @@ -50,9 +50,9 @@ namespace CP SelectionType selectionFromBool (bool accept); - /// \brief the selection decoration made from the given TAccept + /// \brief the selection decoration made from the given AcceptData /// object - SelectionType selectionFromAccept (const Root::TAccept& accept); + SelectionType selectionFromAccept (const asg::AcceptData& accept); ANA_MSG_HEADER (msgSelectionHelpers) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTools/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AnalysisTools/CMakeLists.txt index 7958eeb85f3a80533fe0239842fb0e7526fb2fb2..90b130eba6639a7a0ec975d79e2c4c67947f013d 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTools/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisTools/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC Database/APR/RootCollection Database/AthenaPOOL/AthenaPoolUtilities Database/PersistentDataModel + Event/xAOD/xAODEventInfo Event/EventInfo ) # External dependencies: @@ -34,18 +35,18 @@ atlas_add_library( AthAnalysisToolsLib INCLUDE_DIRS ${Python_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Python_LIBRARIES} AthenaBaseComps AthContainers NavFourMom GaudiKernel McParticleEvent StoreGateLib SGtests AnalysisUtilsLib RootCollection - PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} SGTools RootCollection AthenaPoolUtilities PersistentDataModel EventInfo ) + PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} SGTools RootCollection AthenaPoolUtilities PersistentDataModel xAODEventInfo EventInfo ) atlas_add_component( AthAnalysisTools src/components/*.cxx INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${Python_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests NavFourMom GaudiKernel AnalysisUtilsLib McParticleEvent SGTools RootCollection AthenaPoolUtilities PersistentDataModel EventInfo AthAnalysisToolsLib ) + LINK_LIBRARIES ${CORAL_LIBRARIES} ${Python_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests NavFourMom GaudiKernel AnalysisUtilsLib McParticleEvent SGTools RootCollection AthenaPoolUtilities PersistentDataModel xAODEventInfo EventInfo AthAnalysisToolsLib ) atlas_add_dictionary( AthAnalysisToolsDict AnalysisTools/AnalysisToolsDict.h AnalysisTools/selection.xml INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${Python_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests NavFourMom GaudiKernel AnalysisUtilsLib McParticleEvent SGTools RootCollection RootCollectionComponents AthenaPoolUtilities PersistentDataModel EventInfo AthAnalysisToolsLib ) + LINK_LIBRARIES ${CORAL_LIBRARIES} ${Python_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests NavFourMom GaudiKernel AnalysisUtilsLib McParticleEvent SGTools RootCollection RootCollectionComponents AthenaPoolUtilities PersistentDataModel xAODEventInfo EventInfo AthAnalysisToolsLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisTools/src/AANTupleStream.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisTools/src/AANTupleStream.cxx index 83cd6cd66ed91c976540faade8a65df11031ad2f..2576ccd5a3876af8050825b5f30d89d431409cdf 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisTools/src/AANTupleStream.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisTools/src/AANTupleStream.cxx @@ -31,7 +31,7 @@ #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" -#include "EventInfo/TriggerInfo.h" +#include "xAODEventInfo/EventInfo.h" #include "TFile.h" #include "TTree.h" @@ -285,18 +285,35 @@ StatusCode AANTupleStream::execute() // AthenaAttributeList newAttr(*m_attribSpec); coral::AttributeList newAttr(*m_attribSpec); + unsigned int runNumber = 0; + unsigned int eventNumber = 0; + // retrieve event info const EventInfo* eventInfo; - sc = evtStore()->retrieve( eventInfo ); - if (sc.isFailure()) + eventInfo = evtStore()->tryConstRetrieve<EventInfo>(); + if ( !eventInfo ) { - ATH_MSG_ERROR ("Cannot get event info."); - return sc; + // Try to get the xAOD::EventInfo + const xAOD::EventInfo* eventInfoX{nullptr}; + sc = evtStore()->retrieve(eventInfoX); + if (sc.isFailure()) + { + ATH_MSG_ERROR ("Cannot get event info."); + return sc; + } + else + { + runNumber = eventInfoX->runNumber(); + eventNumber = eventInfoX->eventNumber(); + } + } + else + { + runNumber = eventInfo->event_ID()->run_number(); + eventNumber = eventInfo->event_ID()->event_number(); } // add global event tag data - unsigned int runNumber = eventInfo->event_ID()->run_number(); - unsigned int eventNumber = eventInfo->event_ID()->event_number(); newAttr[ name_RunNumber ].setValue( runNumber ); newAttr[ name_EventNumber ].setValue( eventNumber ); diff --git a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/CMakeLists.txt index ffe4785437b6c5a0b34ddeb8811b1c15c0647e06..dc11e1707c193ef4d9d8b405e47ae3cc5111ebec 100644 --- a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/CMakeLists.txt @@ -83,7 +83,7 @@ endmacro( _add_gtest ) # Define the google unit tests. # Disabling some which don't work in Athena. foreach( test gt_AnaToolHandle_test ) # gt_OverlapRemovalInit_test gt_toolbox_test - _add_gtest( ${test} LINK_LIBRARIES AsgTestingLib ) + _add_gtest( ${test} ) endforeach() if( XAOD_STANDALONE ) diff --git a/PhysicsAnalysis/AnalysisCommon/IsolationSelection/util/testIsolationCloseByCorrectionTool.cxx b/PhysicsAnalysis/AnalysisCommon/IsolationSelection/util/testIsolationCloseByCorrectionTool.cxx index bfbbaff4ebc7547888589da9d134df695c67d898..707c501085cd5bcf25ab88d843bd6ea999eacfe5 100644 --- a/PhysicsAnalysis/AnalysisCommon/IsolationSelection/util/testIsolationCloseByCorrectionTool.cxx +++ b/PhysicsAnalysis/AnalysisCommon/IsolationSelection/util/testIsolationCloseByCorrectionTool.cxx @@ -173,20 +173,20 @@ int main(int argc, char** argv) { if (!RetrieveContainer(event, "Photons", Photons, AuxPhotons).isSuccess()) break; for (const auto ielec : *Electrons) { //Store if the electron passes the isolation - dec_PassIsol(*ielec) = m_isoSelTool->accept(*ielec); + dec_PassIsol(*ielec) = bool (m_isoSelTool->accept(*ielec)); //Quality criteria only baseline kinematic selection dec_PassQuality(*ielec) = ielec->pt() > 10.e3 && fabs(ielec->eta()) < 2.47; } for (const auto iphot : *Photons) { //Store if the photon passes the isolation (only needed for later comparisons) - dec_PassIsol(*iphot) = m_isoSelTool->accept(*iphot); + dec_PassIsol(*iphot) = bool (m_isoSelTool->accept(*iphot)); //Quality criteria only baseline kinematic selection dec_PassQuality(*iphot) = iphot->pt() > 25.e3 && fabs(iphot->eta()) < 2.35; } for (const auto imuon : *Muons) { //Store if the muon passes the isolation - dec_PassIsol(*imuon) = m_isoSelTool->accept(*imuon); + dec_PassIsol(*imuon) = bool (m_isoSelTool->accept(*imuon)); //Quality criteria only baseline kinematic selection dec_PassQuality(*imuon) = imuon->pt() > 5.e3 && fabs(imuon->eta()) < 2.7; } diff --git a/PhysicsAnalysis/AnalysisCommon/PATInterfaces/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/PATInterfaces/CMakeLists.txt index 2b17f8f4db4b186316027fbd5bb0ae0b08d87f51..3c0e7f91eca3c500a3b5ee3294f51b4b440039d8 100644 --- a/PhysicsAnalysis/AnalysisCommon/PATInterfaces/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/PATInterfaces/CMakeLists.txt @@ -45,7 +45,7 @@ endmacro( _add_test ) atlas_add_test( gt_SystematicSet SOURCES test/gt_SystematicSet.cxx INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} - LINK_LIBRARIES ${GTEST_LIBRARIES} PATInterfaces ) + LINK_LIBRARIES ${GTEST_LIBRARIES} PATInterfaces RootCoreUtils ) _add_test( ut_SystematicSet_unordered_map ) _add_test( ut_SystematicVariation ) diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEventAthenaPool/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/ParticleEventAthenaPool/CMakeLists.txt index ea7aede1a202230124dd4330d502973dc1e189e0..e9b0644d91dc7f4bb116a8975050ca48dae51a21 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEventAthenaPool/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEventAthenaPool/CMakeLists.txt @@ -16,12 +16,15 @@ atlas_depends_on_subdirs( PUBLIC Database/AthenaPOOL/AthenaPoolCnvSvc Database/AthenaPOOL/AthenaPoolUtilities ) +atlas_add_library( ParticleEventAthenaPoolLib + ParticleEventAthenaPool/*.h + INTERFACE + PUBLIC_HEADERS ParticleEventAthenaPool + LINK_LIBRARIES GaudiKernel AthenaPoolCnvSvcLib StoreGateLib ParticleEvent ParticleEventTPCnv ) + # Component(s) in the package: atlas_add_poolcnv_library( ParticleEventAthenaPoolPoolCnv src/*.cxx FILES ParticleEvent/ParticleBaseContainer.h ParticleEvent/NeutrinoContainer.h ParticleEvent/CompositeParticleContainer.h ParticleEvent/ParticleShallowCloneContainer.h ParticleEvent/SelectedParticles.h ParticleEvent/TrackParticleAssocs.h ParticleEvent/INav4MomToTrackParticleAssocs.h - LINK_LIBRARIES StoreGateLib SGtests GaudiKernel ParticleEvent ParticleEventTPCnv AthenaPoolCnvSvcLib AthenaPoolUtilities ) - -# Install files from the package: -atlas_install_headers( ParticleEventAthenaPool ) + LINK_LIBRARIES ParticleEventAthenaPoolLib SGtests AthenaPoolUtilities ) diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SCTTrackParticleToMuonAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SCTTrackParticleToMuonAssociationTool.cxx index b59cd1e17ba26c8042ab60f87d65b2892baef2c2..887e2442f20e7f067359458c00dbaaf4acef1afc 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SCTTrackParticleToMuonAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/SCTTrackParticleToMuonAssociationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //********************************************************/ @@ -15,6 +15,8 @@ #include "muonEvent/MuonContainer.h" #include "AthenaKernel/errorcheck.h" +#include <cmath> + using namespace Analysis; namespace D3PD { @@ -57,7 +59,7 @@ namespace D3PD { for (const Analysis::Muon* cmuon : *muonsForCombination) { /// the Inner Detector track if ( cmuon->hasInDetTrackParticle() && - fabs(TP.pt() - cmuon->inDetTrackParticle()->pt()) < 0.01) { + std::abs(TP.pt() - cmuon->inDetTrackParticle()->pt()) < 0.01) { muon = cmuon; } diff --git a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleToSCTClusterAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleToSCTClusterAssociationTool.cxx index 96d0f218412ead63a42cda8e0f82763e009d599e..fc00cef0dc376ad40a413ef5fd8bb97f94efc5c8 100644 --- a/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleToSCTClusterAssociationTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/InDetD3PDMaker/src/TrackParticleToSCTClusterAssociationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //********************************************************/ @@ -17,7 +17,6 @@ #include "TrkTrack/TrackCollection.h" #include "InDetPrepRawData/SCT_ClusterContainer.h" #include "InDetPrepRawData/SCT_ClusterCollection.h" -#include <map> #include "TrkTrack/TrackStateOnSurface.h" #include "Identifier/Identifier.h" @@ -31,7 +30,8 @@ #include "InDetIdentifier/SCT_ID.h" - +#include <cmath> +#include <map> namespace D3PD { @@ -468,7 +468,7 @@ const InDet::SCT_Cluster* TrackParticleToSCTClusterAssociationTool::next() float trketacomp = (float)mytrack.dot(myetaax); float trkphicomp = (float)mytrack.dot(myphiax); float trknormcomp = (float)mytrack.dot(mynormal); - if (fabs(trknormcomp*1e07)>0 ){ + if (std::abs(trknormcomp*1e07)>0. ){ const double inv_trknormcomp = 1. / trknormcomp; *m_locPhi = (float)atan(trkphicomp * inv_trknormcomp); *m_locTheta = (float)atan(trketacomp * inv_trknormcomp); diff --git a/PhysicsAnalysis/D3PDTools/EventLoopGrid/data/ELG_jediState.py b/PhysicsAnalysis/D3PDTools/EventLoopGrid/data/ELG_jediState.py index f4d4f1aa6991db6d37c8f7e94d866e20cc6e8a2c..55531216e0d08ac3154190839fa5038ab94175e3 100644 --- a/PhysicsAnalysis/D3PDTools/EventLoopGrid/data/ELG_jediState.py +++ b/PhysicsAnalysis/D3PDTools/EventLoopGrid/data/ELG_jediState.py @@ -26,4 +26,4 @@ def ELG_jediState(sample) : print ("Problem checking status of task %s with id %s" % (sample.name(), jediTaskID)) return '' - return ret[1]['status'] + return ret[1]['status'].encode("ascii") diff --git a/PhysicsAnalysis/DPDUtils/CMakeLists.txt b/PhysicsAnalysis/DPDUtils/CMakeLists.txt index ac3c89bb615e238490c8d922711943686f125620..ce6768266bed90051e4458eabf65fa4cf8d2877e 100644 --- a/PhysicsAnalysis/DPDUtils/CMakeLists.txt +++ b/PhysicsAnalysis/DPDUtils/CMakeLists.txt @@ -41,8 +41,4 @@ atlas_add_component( DPDUtils # Install files from the package: atlas_install_headers( DPDUtils ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h index f39483f02c902ac0da1eeb43faa9de4ba53dbe83..309d1c4589944fa4c8dbb48ef37ee554763df415 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/DerivationFrameworkCalo/ClusterEnergyPerLayerDecorator.h @@ -14,9 +14,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IThinningTool.h" #include "DerivationFrameworkInterfaces/IAugmentationTool.h" - #include "xAODEgamma/EgammaFwd.h" - +#include "GaudiKernel/EventContext.h" #include "GaudiKernel/ToolHandle.h" class CaloFillRectangularCluster; @@ -45,8 +44,9 @@ namespace DerivationFramework { ToolHandle<CaloClusterCollectionProcessor> m_caloFillRectangularTool; CaloFillRectangularCluster *m_tool; std::string m_CellCollectionName; - - void decorateObject(const xAOD::Egamma*& egamma) const; + + void decorateObject(const EventContext& ctx, + const xAOD::Egamma* egamma) const; }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx index fb82b127204fdcac97630d264da9c87fcc900bbb..4bf6030d84fa9e8a1c21a9eeee5ea807eeabec89 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/src/ClusterEnergyPerLayerDecorator.cxx @@ -66,20 +66,27 @@ StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::finalize() // The decoration itself StatusCode DerivationFramework::ClusterEnergyPerLayerDecorator::addBranches() const { + + const EventContext& ctx=Gaudi::Hive::currentContext(); for (const std::string& SGkey : {m_SGKey_photons, m_SGKey_electrons}) { if (SGkey == "") continue; const xAOD::EgammaContainer *container(0); ATH_CHECK( evtStore()->retrieve(container, SGkey) ); - for (auto egamma : *container) - decorateObject(egamma); + for (auto egamma : *container){ + decorateObject(ctx, egamma); + } } - + return StatusCode::SUCCESS; } -void DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject(const xAOD::Egamma*& egamma) const{ - +void +DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject( + const EventContext& ctx, + const xAOD::Egamma* egamma) const +{ + if (not egamma or not egamma->caloCluster()) return; const CaloCellContainer* cellCont(0); @@ -88,17 +95,20 @@ void DerivationFramework::ClusterEnergyPerLayerDecorator::decorateObject(const x if (evtStore()->retrieve(cellCont,m_CellCollectionName).isFailure()) ATH_MSG_WARNING(m_CellCollectionName<< " not found"); else if (not egamma->author(xAOD::EgammaParameters::AuthorCaloTopo35) ) - { - egcClone = CaloClusterStoreHelper::makeCluster( cellCont, - egamma->caloCluster()->eta0(), - egamma->caloCluster()->phi0(), - egamma->caloCluster()->clusterSize()); - m_tool->makeCorrection(egcClone); + { + egcClone = + CaloClusterStoreHelper::makeCluster(cellCont, + egamma->caloCluster()->eta0(), + egamma->caloCluster()->phi0(), + egamma->caloCluster()->clusterSize()); + m_tool->makeCorrection(ctx, egcClone); } - for (unsigned int layer: m_layers) - egamma->auxdecor<float>(Form("E%dx%d_Lr%d", m_eta_size, m_phi_size, layer)) =\ + for (unsigned int layer: m_layers){ + egamma->auxdecor<float>( + Form("E%dx%d_Lr%d", m_eta_size, m_phi_size, layer)) = egcClone ? egcClone->energyBE(layer) : 0.; + } delete egcClone; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ThinningHelper.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ThinningHelper.py index e0d111fad15cda096a4a753ac9ef9ce358fcadc9..d03049845f304e0cf907be95172661536c8ad97f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ThinningHelper.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ThinningHelper.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #################################################################### # ThinningHelper.py @@ -14,66 +14,6 @@ # Needed import(s): import AthenaCommon.CfgMgr as CfgMgr -from AthenaServices.Configurables import ThinningSvc as AthThinningSvc - -## Custom specialisation of the core ThinningSvc configurable -# -# Unfortunately the ThinningSvc configurable in AthenaServices was not written -# with extendability in mind. So in order to change its behaviour, one must -# inherit from it. As most of the settings made by that class are only made -# after the jobOption code is already done executing... -# -class WorkerThinningSvc( AthThinningSvc ): - - def __init__( self, name, athStream, navThinSvc, **kwargs ): - - # Remember the object's properties: - self.athStream = athStream - self.navThinSvc = navThinSvc - # Set up a logger object: - from AthenaCommon.Logging import logging - self.log = logging.getLogger( name ) - # Call the initialisation of the base class: - AthThinningSvc.__init__( self, name, **kwargs ) - return - - ## Function overriding the one defined in Configurable - # - # This is probably not the very best design, but because of how weirdly - # ThinningSvc.setDefaults(...) is implemented, this seemed to be the best - # way to tweak the configuration made by that function. - # - def setup( self ): - - # Let the base class do all of its setup functions - super( WorkerThinningSvc, self ).setup() - - # Make the stream talk to this service: - toolFound = False - for tool in self.athStream.HelperTools: - # Check whether there's a tool of this type already attached - # to the stream. If there is, it should start talking to the - # navigation thinning service from now on: - if not isinstance( tool, CfgMgr.ThinningOutputTool ): - continue - tool.ThinningSvc = self.navThinSvc - toolFound = True - self.log.info( "Updated the existing ThinningOutputTool to point at" - " the TrigNavigationThinningSvc instance" ) - pass - if not toolFound: - # If there was no such tool yet, let's create one from scratch: - stream.HelperTools.insert( 0, - CfgMgr.ThinningOutputTool( formatName + - "ThinningOutputTool", - ThinningSvc = self.navThinSvc ) ) - self.log.warning( "No ThinningOutputTool found for the output " - "stream" ) - self.log.warning( "Configured one now, job will likely be " - "faulty..." ) - pass - - return ## Class helping to set up (navigation) thinning in derivation jobs # @@ -97,7 +37,6 @@ class ThinningHelper: from AthenaCommon.AppMgr import ServiceMgr as svcMgr self.helperName = helperName self.TriggerChains = "" - self.worker = None from AthenaCommon.Logging import logging self.log = logging.getLogger( "ThinningHelper" ) return @@ -119,31 +58,11 @@ class ThinningHelper: formatName = stream.name().strip( "StreamDAOD_" ) # The necessary import(s): from AthenaCommon.AppMgr import ServiceMgr as svcMgr - from AthenaServices.Configurables import createThinningSvc - # If no trigger selection was required, just set up "the usual" thinning - # service: + if self.TriggerChains == "": - svcMgr += createThinningSvc( svcName = formatName + "ThinningSvc", - outStreams = [ stream ] ) - self.worker = getattr( svcMgr, formatName + "ThinningSvc" ) + # No trigger selection required. return - # Let's create the navigation thinning service first. Notice that its - # 'WorkerThinningSvc' property is not getting set at this point yet. - svcMgr += CfgMgr.TrigNavigationThinningSvc( formatName + - "ThinningSvc" ) - thinningSvc = getattr( svcMgr, formatName + "ThinningSvc" ) - - # Now set up the worker thinning service: - svcMgr += WorkerThinningSvc( formatName + "NavThinningWorkerSvc", - athStream = stream, - navThinSvc = thinningSvc, - Streams = [ stream.name() ] ) - self.worker = getattr( svcMgr, formatName + "NavThinningWorkerSvc" ) - - # And now point the navigation thinning service to the worker: - thinningSvc.WorkerThinningSvc = self.worker - # And finally, configure what the navigation thinning is supposed # to do: from DerivationFrameworkMuons.MuonTriggerContent import \ @@ -166,21 +85,18 @@ class ThinningHelper: JetTriggerContent +EtMissTriggerContent + \ TauTriggerContent + BJetTriggerContent + \ BPhysTriggerContent + MinBiasTriggerContent + extraTriggerContent - from TrigNavTools.TrigNavToolsConfig import slimmingTool - sTool = slimmingTool( { 'name' : self.helperName, - 'features' : allFeatures, - 'chains' : self.TriggerChains, - 'mode' : 'slimming', - 'ThinningSvc' : thinningSvc } ) - thinningSvc.SlimmingTool = sTool + from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc + tSvc = navigationThinningSvc( { 'name' : self.helperName, + 'features' : allFeatures, + 'chains' : self.TriggerChains, + 'mode' : 'slimming' } ) + + for t in stream.HelperTools: + if t.getType() == 'Athena::ThinningCacheTool': + t.TrigNavigationThinningSvc = tSvc + break + else: + log.error ("Can't find ThinningCacheTool for stream %s", stream) + return - ## Convenience function returning the thinning service - # - # This is the thinning service that needs to be passed to "normal" - # thinning tools to operate on. - # - # @returns The thinning service that tools should operate on - # - def ThinningSvc( self ): - return self.worker diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/SoftBtagCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/SoftBtagCommon.py index 91f7b6f471cfba4e7941d34a447c9d1df0cb375a..851ac74ec106b9fef716027fb460cbf1196523db 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/SoftBtagCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/SoftBtagCommon.py @@ -53,8 +53,7 @@ def applySoftBtagging(algname,sequence): from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter InclusiveVxFitterTool = Trk__TrkVKalVrtFitter(name = "InclusiveVxFitter", Extrapolator = ToolSvc.AtlasExtrapolator, - IterationNumber = 30, - AtlasMagFieldSvc = "AtlasFieldSvc" + IterationNumber = 30 ) ToolSvc += InclusiveVxFitterTool; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/InDetTrackSelectionToolWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/InDetTrackSelectionToolWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..ed9e2eb4fdf8e71da51bc4fd36203b118b80108c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/InDetTrackSelectionToolWrapper.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// InDetTrackSelectionToolWrapper.h +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_INDETTRACKSELECTIONTOOLWRAPPER_H +#define DERIVATIONFRAMEWORK_INDETTRACKSELECTIONTOOLWRAPPER_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "GaudiKernel/ToolHandle.h" + +namespace DerivationFramework { + + class InDetTrackSelectionToolWrapper : public AthAlgTool, public IAugmentationTool { + public: + InDetTrackSelectionToolWrapper(const std::string& t, const std::string& n, const IInterface* p); + + StatusCode initialize(); + StatusCode finalize(); + virtual StatusCode addBranches() const; + + private: + ToolHandle< InDet::IInDetTrackSelectionTool > m_tool; + std::string m_sgName; + std::string m_containerName; + }; +} + +#endif // DERIVATIONFRAMEWORK_INDETTRACKSELECTIONTOOLWRAPPER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TauTrackParticleThinning.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TauTrackParticleThinning.h index 985c7a9bf366a8ccb95085c1b5665873acee7957..abdf8f47dea86842fcc1099febdaf5cee3d77fb5 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TauTrackParticleThinning.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TauTrackParticleThinning.h @@ -46,7 +46,10 @@ namespace DerivationFramework { { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }; SG::ReadHandleKey<xAOD::TauJetContainer> m_tauKey { this, "TauKey", "", ""}; - + Gaudi::Property<bool> m_doTauTracksThinning + { this, "DoTauTracksThinning", "", "Apply thinning to tau tracks in addition to ID tracks"}; + SG::ThinningHandleKey<xAOD::TauTrackContainer> m_tauTracksSGKey + { this, "TauTracksKey", "TauTracks", "StoreGate key of the tau track container" }; Gaudi::Property<std::string> m_selectionString { this, "SelectionString", "",""}; Gaudi::Property<float> m_coneSize diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TracksInCone.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TracksInCone.h index 1e1596341e016c507aeeb9ee90fa052404cf2e2e..e72ac58c17aa978fbbae4dc7541d623cf8cab508 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TracksInCone.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/TracksInCone.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ====================================================================== @@ -13,6 +13,8 @@ #include "xAODBase/IParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODTau/TauTrackContainer.h" + namespace DerivationFramework { struct TracksInCone{ @@ -29,5 +31,22 @@ namespace DerivationFramework { } return; } + + // Extend the functionality to tau tracks for consistency (TauTrackParticleThinning), + // although it's not recommended to select tau tracks based on dR; + // the selection should only rely on the tau track classification + void select(const xAOD::IParticle* particle, float coneSize, const xAOD::TauTrackContainer* tracks, std::vector<bool> &mask) { + float particleEta = particle->eta(); + float particlePhi = particle->phi(); + unsigned int i(0); + for (xAOD::TauTrackContainer::const_iterator trIt = tracks->begin(); trIt!=tracks->end(); ++trIt, ++i) { + float deltaEta = (*trIt)->eta() - particleEta; + float deltaPhi = fabs((*trIt)->phi() - particlePhi); + if (deltaPhi > TMath::Pi()) deltaPhi = 2.0*TMath::Pi() - deltaPhi; + float deltaR = sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi); + if (deltaR < coneSize) mask[i] = true; + } + return; + } }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetCommon.py index facd6de4964edccc10c37d46022a7dd5d7d3c81c..56339d7b609b24aa23c80d36e4e834923c7e13ba 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetCommon.py @@ -13,6 +13,17 @@ from RecExConfig.InputFilePeeker import inputFileSummary from AthenaCommon.BeamFlags import jobproperties if (jobproperties.Beam.beamType()!="cosmics") and ( not inputFileSummary['eventdata_items'] or any('PrimaryVertices' in elements for elements in inputFileSummary['eventdata_items']) ): +#==================================================================== +# LABELLING TRACKS WITH OUTCOME OF SELECTOR TOOL +#==================================================================== + + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__InDetTrackSelectionToolWrapper + DFCommonTrackSelection = DerivationFramework__InDetTrackSelectionToolWrapper(name = "DFCommonTrackSelection", + ContainerName = "InDetTrackParticles", + DecorationName = "DFCommonTightPrimary" ) + DFCommonTrackSelection.TrackSelectionTool.CutLevel = "TightPrimary" + ToolSvc += DFCommonTrackSelection + #==================================================================== # EXPRESSION OF Z0 AT THE PRIMARY VERTEX #==================================================================== @@ -23,11 +34,13 @@ if (jobproperties.Beam.beamType()!="cosmics") and ( not inputFileSummary['eventd Z0SGEntryName = "DFCommonInDetTrackZ0AtPV" ) ToolSvc += DFCommonZ0AtPV + + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("InDetCommonKernel", - AugmentationTools = [DFCommonZ0AtPV] + AugmentationTools = [DFCommonTrackSelection,DFCommonZ0AtPV] ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/InDetTrackSelectionToolWrapper.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/InDetTrackSelectionToolWrapper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..203c5090ac0f4ba6e718417a7efd390aeef2c5ed --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/InDetTrackSelectionToolWrapper.cxx @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// InDetTrackSelectionToolWrapper.cxx +/////////////////////////////////////////////////////////////////// + +#include "DerivationFrameworkInDet/InDetTrackSelectionToolWrapper.h" +#include "xAODTracking/TrackParticleContainer.h" +#include <vector> +#include <string> + +namespace DerivationFramework { + + InDetTrackSelectionToolWrapper::InDetTrackSelectionToolWrapper(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p), + m_tool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this ), + m_sgName(""), + m_containerName("") + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("TrackSelectionTool", m_tool); + declareProperty("DecorationName", m_sgName); + declareProperty("ContainerName", m_containerName); + } + + StatusCode InDetTrackSelectionToolWrapper::initialize() + { + if (m_sgName=="") { + ATH_MSG_ERROR("No decoration prefix name provided for the output of InDetTrackSelectionToolWrapper!"); + return StatusCode::FAILURE; + } + if (m_containerName=="") { + ATH_MSG_ERROR("No TrackParticle collection provided for InDetTrackSelectionToolWrapper!"); + return StatusCode::FAILURE; + } + ATH_CHECK(m_tool.retrieve()); + return StatusCode::SUCCESS; + } + + StatusCode InDetTrackSelectionToolWrapper::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode InDetTrackSelectionToolWrapper::addBranches() const + { + + // retrieve track container + const xAOD::TrackParticleContainer* tracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >( m_containerName ); + if( ! tracks ) { + ATH_MSG_ERROR ("Couldn't retrieve TrackParticles with key: " << m_containerName ); + return StatusCode::FAILURE; + } + // Run tool for each element and decorate with the decision + for (xAOD::TrackParticleContainer::const_iterator trItr = tracks->begin(); trItr!=tracks->end(); ++trItr) { + SG::AuxElement::Decorator< bool > accept(m_sgName); + accept( **trItr ) = m_tool->accept(*trItr).getCutResult(0); + } // end of loop over tracks + + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/TauTrackParticleThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/TauTrackParticleThinning.cxx index 38e13682229ad0f9ce011aa628c7480fbe03c764..351d069ff38ec30b3c24bdd9ee21d4a8b1ae75d4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/TauTrackParticleThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/TauTrackParticleThinning.cxx @@ -45,6 +45,15 @@ StatusCode DerivationFramework::TauTrackParticleThinning::initialize() return StatusCode::FAILURE; } else { ATH_MSG_INFO("Inner detector track particles associated with objects in " << m_tauKey.key() << " will be retained in this format with the rest being thinned away");} ATH_CHECK(m_tauKey.initialize()); + if (m_doTauTracksThinning) { + if (m_tauTracksSGKey.key().empty()) { + ATH_MSG_FATAL("No tau tracks collection provided for thinning, despite this option being requested."); + return StatusCode::FAILURE; + } else { + ATH_MSG_INFO("Tau track thinning requested; tau tracks with the SG key " << m_tauTracksSGKey.key() << " will be thinned if not associated with objects in " << m_tauKey.key()); + ATH_CHECK( m_tauTracksSGKey.initialize (m_streamName) ); + } + } // Set up the text-parsing machinery for selectiong the tau directly according to user cuts if (!m_selectionString.empty()) { @@ -114,24 +123,16 @@ StatusCode DerivationFramework::TauTrackParticleThinning::doThinning() const for (xAOD::TauJetContainer::const_iterator tauIt=importedTaus->begin(); tauIt!=importedTaus->end(); ++tauIt) { if (m_coneSize>0.0) trIC.select(*tauIt,m_coneSize,importedTrackParticles.cptr(),mask); // check tracks in a cone around the tau if req'd for (unsigned int i=0; i<(*tauIt)->nTracks(); ++i) { -#ifndef XAODTAU_VERSIONS_TAUJET_V3_H - int index = (*tauIt)->trackLinks().at(i).index(); -#else int index = xAOD::TauHelpers::trackParticleLinks(*tauIt, xAOD::TauJetParameters::TauTrackFlag::classifiedCharged).at(i).index(); -#endif - mask[index] = true; + mask[index] = true; } } } else { // check only taus passing user selection string for (std::vector<const xAOD::TauJet*>::iterator tauIt = tauToCheck.begin(); tauIt!=tauToCheck.end(); ++tauIt) { if (m_coneSize>0.0) trIC.select(*tauIt,m_coneSize,importedTrackParticles.cptr(),mask); // check tracks in a cone around the tau if req'd for (unsigned int i=0; i<(*tauIt)->nTracks(); ++i) { -#ifndef XAODTAU_VERSIONS_TAUJET_V3_H - int index = (*tauIt)->trackLinks().at(i).index(); -#else int index = xAOD::TauHelpers::trackParticleLinks(*tauIt, xAOD::TauJetParameters::TauTrackFlag::classifiedCharged).at(i).index(); -#endif - mask[index] = true; + mask[index] = true; } } } @@ -143,9 +144,45 @@ StatusCode DerivationFramework::TauTrackParticleThinning::doThinning() const } m_npass += n_pass; - // Execute the thinning service based on the mask. Finish. + // Execute the thinning service based on the mask. importedTrackParticles.keep (mask); - return StatusCode::SUCCESS; + // Apply thinning to tau track collection if requested + if( m_doTauTracksThinning ) { + SG::ThinningHandle<xAOD::TauTrackContainer> importedTauTracks + (m_tauTracksSGKey, ctx); + if( importedTauTracks->size() == 0 ) { + return StatusCode::SUCCESS; + } + std::vector< bool > mask_tautracks( importedTauTracks->size(), false ); + + for( const xAOD::TauJet* tau : tauToCheck ) { + // Get all the associated charged tau tracks: + auto ttLinks = tau->tauTrackLinks(xAOD::TauJetParameters::TauTrackFlag::classifiedCharged ); + // Process the links: + for( const auto& ttLink : ttLinks ) { + if( ! ttLink.isValid() ) { + continue; + } + if( ttLink.dataID() != m_tauTracksSGKey.key() ) { + ATH_MSG_FATAL( "Charged tau track does not come from " + "container \"" << m_tauTracksSGKey << "\"" ); + return StatusCode::FAILURE; + } + // If it is, set the mask for it: + mask_tautracks.at( ttLink.index() ) = true; + } + // Select the tau tracks in a cone if it was requested (NOT RECOMMENDED): + if( m_coneSize > 0.0 ) { + trIC.select( tau, m_coneSize, importedTauTracks.cptr(), mask_tautracks ); + } + } + + importedTauTracks.keep(mask_tautracks); + + } + + return StatusCode::SUCCESS; + } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/components/DerivationFrameworkInDet_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/components/DerivationFrameworkInDet_entries.cxx index 68df09c97aaea1c60f7c685bc1b0a53c736b029a..eb3e0aad67b6bdf61b545f7ad56709abbf9358f4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/components/DerivationFrameworkInDet_entries.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/components/DerivationFrameworkInDet_entries.cxx @@ -15,6 +15,7 @@ #include "DerivationFrameworkInDet/TrackMeasurementThinning.h" #include "DerivationFrameworkInDet/EventInfoPixelDecorator.h" #include "DerivationFrameworkInDet/PixelNtupleMaker.h" +#include "DerivationFrameworkInDet/InDetTrackSelectionToolWrapper.h" using namespace DerivationFramework; @@ -35,3 +36,4 @@ DECLARE_COMPONENT( EGammaTracksThinning ) DECLARE_COMPONENT( TrackMeasurementThinning ) DECLARE_COMPONENT( EventInfoPixelDecorator ) DECLARE_COMPONENT( PixelNtupleMaker ) +DECLARE_COMPONENT( InDetTrackSelectionToolWrapper ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt index 2540eb7eb360214e0774911472330624e93fc718..d96bd1e3eb1285176311497381d03a84ac1db5b2 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt @@ -32,13 +32,13 @@ atlas_add_library( DerivationFrameworkMCTruthLib PUBLIC_HEADERS DerivationFrameworkMCTruth INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel SGtests ExpressionEvaluationLib MCTruthClassifierLib + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel SGtests ExpressionEvaluationLib MCTruthClassifierLib TauAnalysisToolsLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel xAODBase xAODJet GeneratorObjects ) atlas_add_component( DerivationFrameworkMCTruth src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel AthenaKernel SGtests EventInfo xAODBase xAODJet GeneratorObjects ExpressionEvaluationLib MCTruthClassifierLib DerivationFrameworkMCTruthLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${FASTJET_LIBRARIES} AtlasHepMCLib AthenaBaseComps xAODEventInfo xAODTruth GaudiKernel AthenaKernel SGtests EventInfo xAODBase xAODJet GeneratorObjects ExpressionEvaluationLib MCTruthClassifierLib TauAnalysisToolsLib DerivationFrameworkMCTruthLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/DecayGraphHelper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/DecayGraphHelper.h index 355f9119ef2e3f0cac50ca71c7f6918a88ea6e16..243a59f06865371737e11865e005a87bf6646237 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/DecayGraphHelper.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/DecayGraphHelper.h @@ -2,292 +2,310 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// ====================================================================== -// DecayGraphHelper.h -// James.Catmore@cern.ch -// Helper struct which implements two simple recursive functions; -// descends or ascends through a decay from a head particle provided by -// the user, and records all particles and vertices it encounters in the -// masks -// -// Also contains functions shared by TruthDressing tool and -// TruthIsolationTool. -// ====================================================================== -#pragma once - -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODTruth/TruthVertexContainer.h" -#include "HepPID/ParticleIDMethods.hh" -#include<unordered_set> - -namespace DerivationFramework { - struct DecayGraphHelper { - // Geant4 barcode offset - int g4BarcodeOffset; - DecayGraphHelper(int init_g4BarcodeOffset) { - g4BarcodeOffset = init_g4BarcodeOffset; - } - DecayGraphHelper(void) { - g4BarcodeOffset = 200000; - } - - // Immediate relatives (parents, siblings, children) - void immediateRelatives(const xAOD::TruthParticle* pHead, - std::vector<bool> &particleMask, - std::vector<bool> &vertexMask, - bool keepHadVtx) { - - // Save the particle position in the mask - int headIndex = pHead->index(); - particleMask[headIndex] = true; - - // Get the production and decay vertex for the particle - const xAOD::TruthVertex* decayVtx(0); - const xAOD::TruthVertex* prodVtx(0); - - if (pHead->hasDecayVtx()) { - decayVtx = pHead->decayVtx(); - int decayIndex = decayVtx->index(); - vertexMask[decayIndex] = true; - unsigned int nParents = decayVtx->nIncomingParticles(); - unsigned int nChildren = decayVtx->nOutgoingParticles(); - - // Hadronization vertex? (quarks,gluons -> hadrons) - bool isHadVtx = true; - for (unsigned int i=0; i<nParents; ++i) { - int idabs = std::abs(decayVtx->incomingParticle(i)->pdgId()); - isHadVtx = isHadVtx && (idabs<6 || idabs==21); - } - for (unsigned int i=0; i<nChildren; ++i) { - int idabs = std::abs(decayVtx->outgoingParticle(i)->pdgId()); - isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) || - idabs>9000000); - } - - if( !isHadVtx || keepHadVtx ){ - // Get the particles leaving the decay vertex (CHILDREN) - for (unsigned int i=0; i<nChildren; ++i) { - int childIndex = decayVtx->outgoingParticle(i)->index(); - particleMask[childIndex] = true; - } - } - } - - if (pHead->hasProdVtx()) { - prodVtx = pHead->prodVtx(); - int prodIndex = prodVtx->index(); - vertexMask[prodIndex] = true; - unsigned int nParents = prodVtx->nIncomingParticles(); - unsigned int nSiblings = prodVtx->nOutgoingParticles(); - unsigned int nChildren = nSiblings; - - // Hadronization vertex? (quarks,gluons -> hadrons) - bool isHadVtx = true; - for (unsigned int i=0; i<nParents; ++i) { - int idabs = std::abs(prodVtx->incomingParticle(i)->pdgId()); - isHadVtx = isHadVtx && (idabs<6 || idabs==21); - } - for (unsigned int i=0; i<nChildren; ++i) { - int idabs = std::abs(prodVtx->outgoingParticle(i)->pdgId()); - isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) || - idabs>9000000); - } - - if( !isHadVtx || keepHadVtx ){ - // Get the particles entering the production vertex (PARENTS) - for (unsigned int i=0; i<nParents; ++i) { - int parentIndex = prodVtx->incomingParticle(i)->index(); - particleMask[parentIndex] = true; - } - // Get the particles leaving the production vertex (SIBLINGS) - for (unsigned int i=0; i<nSiblings; ++i) { - int siblingIndex = prodVtx->outgoingParticle(i)->index(); - particleMask[siblingIndex] = true; - } - } - } - return; - } - - // descendants: starting from particle (simple listing version) - void descendants(const xAOD::TruthParticle* pHead, - std::vector<int> &particleList, - std::unordered_set<int> &encounteredBarcodes) { - - // Check that this barcode hasn't been seen before (e.g. we are in a loop) - //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; - std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); - if (found!=encounteredBarcodes.end()) return; - encounteredBarcodes.insert(pHead->barcode()); - - // Get the decay vertex - const xAOD::TruthVertex* decayVtx(0); - if (pHead->hasDecayVtx()) {decayVtx = pHead->decayVtx();} - else {return;} - - // Save the PDG ID number of the particle - particleList.push_back(pHead->pdgId()); - - // Get children particles and self-call - int nChildren = decayVtx->nOutgoingParticles(); - for (int i=0; i<nChildren; ++i) descendants(decayVtx->outgoingParticle(i),particleList,encounteredBarcodes); - return; - } - - // descendants: starting from particle - void descendants(const xAOD::TruthParticle* pHead, - std::vector<bool> &particleMask, - std::vector<bool> &vertexMask, - std::unordered_set<int> &encounteredBarcodes, - bool includeGeant) { - - // Check that this barcode hasn't been seen before (e.g. we are in a loop) - //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; - std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); - if (found!=encounteredBarcodes.end()) return; - encounteredBarcodes.insert(pHead->barcode()); - - // Save the particle position in the mask - // If user doesn't want Geant, check and reject Geant particles - if (!includeGeant && pHead->barcode()>g4BarcodeOffset) return; - int headIndex = pHead->index(); - particleMask[headIndex] = true; - - // Get the decay vertex - const xAOD::TruthVertex* decayVtx(0); - if (pHead->hasDecayVtx()) {decayVtx = pHead->decayVtx();} - else {return;} - - // Get children particles and self-call - int nChildren = decayVtx->nOutgoingParticles(); - bool saveVertex = false; - for (int i=0; i<nChildren; ++i) { - descendants(decayVtx->outgoingParticle(i),particleMask,vertexMask,encounteredBarcodes,includeGeant); - saveVertex = saveVertex || includeGeant || !(decayVtx->outgoingParticle(i)->barcode()>g4BarcodeOffset); - } - - // Save the decay vertex - if ( saveVertex ) { - int vtxIndex = decayVtx->index(); - vertexMask[vtxIndex] = true; - } - return; - } - - // ancestors: starting from particle - void ancestors(const xAOD::TruthParticle* pHead, - std::vector<bool> &particleMask, - std::vector<bool> &vertexMask, - std::unordered_set<int> &encounteredBarcodes ) { - - // Check that this barcode hasn't been seen before (e.g. we are in a loop) - //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; - std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); - if (found!=encounteredBarcodes.end()) return; - encounteredBarcodes.insert(pHead->barcode()); - - // Save particle position in the mask - int headIndex = pHead->index(); - particleMask[headIndex] = true; - - // Get the production vertex - const xAOD::TruthVertex* prodVtx(0); - if (pHead->hasProdVtx()) {prodVtx = pHead->prodVtx();} - else {return;} - - // Save the production vertex - int vtxIndex = prodVtx->index(); - vertexMask[vtxIndex] = true; - - // Get children particles and self-call - int nParents = prodVtx->nIncomingParticles(); - for (int i=0; i<nParents; ++i) ancestors(prodVtx->incomingParticle(i),particleMask,vertexMask,encounteredBarcodes); - return; - } - - void constructListOfFinalParticles(const xAOD::TruthParticleContainer* allParticles, - std::vector<const xAOD::TruthParticle*> &selectedlist, - const std::vector<int> &pdgId, bool usePhotonsFromHadrons = false, - bool chargedOnly = false) const - { - //fill the vector selectedlist with only particles with abs(ID) in the list - //pdgID that are 'good' for dressing: status==1, barcode < 2e5 (for the - //photons), not from hadron decay, - //skip pdgId check if pdgId is an empty vector, - //ignore photons coming from hadrons if usePhotonsFromHadrons=false, - //only use charged particles if chargedOnly=true - - bool skipPdgCheck = (pdgId.size()==0); - //bypass the hadron veto? - - for (xAOD::TruthParticleContainer::const_iterator pItr=allParticles->begin(); pItr!=allParticles->end(); ++pItr) { - const xAOD::TruthParticle *particle = *pItr; - - if (particle->status() != 1) continue; - - if (!skipPdgCheck && find(pdgId.begin(), pdgId.end(), abs(particle->pdgId())) == pdgId.end()) continue; - - //ensure particles are not from GEANT - if (particle->barcode() >= g4BarcodeOffset) continue; - - //check if we have a neutral particle (threeCharge returns int) - if (chargedOnly && HepPID::threeCharge(particle->pdgId()) == 0) continue; - - //if we have a photon from hadron decay, and usePhotonsFromHadrons=false, skip this particle - if (!usePhotonsFromHadrons && fromHadronDecay(particle) && particle->pdgId()==22) continue; - - //good particle, add to list - selectedlist.push_back(particle); - } - } - - bool fromHadronDecay(const xAOD::TruthParticle* particle) const - { - //does this particle come from a hadron decay? - //copied and modified from - //MenuTruthDressingTool::isLeptonFromTau() - - const xAOD::TruthVertex* prod = particle->prodVtx(); - if(!prod) return false; // no parent. - - // Simple loop catch - if (prod==particle->decayVtx()) return false; - - // Loop over the parents of this particle. - unsigned int nIncoming = prod->nIncomingParticles(); - for(unsigned int itr = 0; itr<nIncoming; ++itr){ - int parentId = prod->incomingParticle(itr)->pdgId(); - if(HepPID::isHadron(parentId)) { - return true; - } - - //note from tancredi: should we search up the chain for leptons as - //well? B->l->photon should be rejected? - if(parentId == particle->pdgId()) { - //continue searching up photon->photon chains - if(fromHadronDecay(prod->incomingParticle(itr))) { - return true; - } - } - } - - return false; - } - - float calculateDeltaR(const xAOD::IParticle *p1, const xAOD::IParticle *p2) const - { - float phi1 = p1->phi(); - float phi2 = p2->phi(); - float eta1 = p1->eta(); - float eta2 = p2->eta(); - float deltaPhi = fabs(phi1-phi2); - if (deltaPhi>TMath::Pi()) deltaPhi = 2.0*TMath::Pi() - deltaPhi; - float deltaPhiSq = (phi1-phi2)*(phi1-phi2); - float deltaEtaSq = (eta1-eta2)*(eta1-eta2); - float deltaR = sqrt(deltaPhiSq+deltaEtaSq); - return deltaR; - } - }; -} - - +// ====================================================================== +// DecayGraphHelper.h +// James.Catmore@cern.ch +// Helper struct which implements two simple recursive functions; +// descends or ascends through a decay from a head particle provided by +// the user, and records all particles and vertices it encounters in the +// masks +// +// Also contains functions shared by TruthDressing tool and +// TruthIsolationTool. +// ====================================================================== +#pragma once + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "HepPID/ParticleIDMethods.hh" +#include<unordered_set> + +namespace DerivationFramework { + struct DecayGraphHelper { + // Geant4 barcode offset + int g4BarcodeOffset; + DecayGraphHelper(int init_g4BarcodeOffset) { + g4BarcodeOffset = init_g4BarcodeOffset; + } + DecayGraphHelper(void) { + g4BarcodeOffset = 200000; + } + + // Immediate relatives (parents, siblings, children) + void immediateRelatives(const xAOD::TruthParticle* pHead, + std::vector<bool> &particleMask, + std::vector<bool> &vertexMask, + bool keepHadVtx) { + + // Save the particle position in the mask + int headIndex = pHead->index(); + particleMask[headIndex] = true; + + // Get the production and decay vertex for the particle + const xAOD::TruthVertex* decayVtx(0); + const xAOD::TruthVertex* prodVtx(0); + + if (pHead->hasDecayVtx()) { + decayVtx = pHead->decayVtx(); + int decayIndex = decayVtx->index(); + vertexMask[decayIndex] = true; + unsigned int nParents = decayVtx->nIncomingParticles(); + unsigned int nChildren = decayVtx->nOutgoingParticles(); + + // Hadronization vertex? (quarks,gluons -> hadrons) + bool isHadVtx = true; + for (unsigned int i=0; i<nParents; ++i) { + if (decayVtx->incomingParticle(i)==nullptr) continue; + int idabs = std::abs(decayVtx->incomingParticle(i)->pdgId()); + isHadVtx = isHadVtx && (idabs<6 || idabs==21); + } + for (unsigned int i=0; i<nChildren; ++i) { + if (decayVtx->outgoingParticle(i)==nullptr) continue; + int idabs = std::abs(decayVtx->outgoingParticle(i)->pdgId()); + isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) || + idabs>9000000); + } + + if( !isHadVtx || keepHadVtx ){ + // Get the particles leaving the decay vertex (CHILDREN) + for (unsigned int i=0; i<nChildren; ++i) { + if (decayVtx->outgoingParticle(i)==nullptr) continue; + int childIndex = decayVtx->outgoingParticle(i)->index(); + particleMask[childIndex] = true; + } + } + } + + if (pHead->hasProdVtx()) { + prodVtx = pHead->prodVtx(); + int prodIndex = prodVtx->index(); + vertexMask[prodIndex] = true; + unsigned int nParents = prodVtx->nIncomingParticles(); + unsigned int nSiblings = prodVtx->nOutgoingParticles(); + unsigned int nChildren = nSiblings; + + // Hadronization vertex? (quarks,gluons -> hadrons) + bool isHadVtx = true; + for (unsigned int i=0; i<nParents; ++i) { + if (prodVtx->incomingParticle(i)==nullptr) continue; + int idabs = std::abs(prodVtx->incomingParticle(i)->pdgId()); + isHadVtx = isHadVtx && (idabs<6 || idabs==21); + } + for (unsigned int i=0; i<nChildren; ++i) { + if (prodVtx->outgoingParticle(i)==nullptr) continue; + int idabs = std::abs(prodVtx->outgoingParticle(i)->pdgId()); + isHadVtx = isHadVtx && ((idabs>=80 && idabs<1000000) || + idabs>9000000); + } + + if( !isHadVtx || keepHadVtx ){ + // Get the particles entering the production vertex (PARENTS) + for (unsigned int i=0; i<nParents; ++i) { + if (prodVtx->incomingParticle(i)==nullptr) continue; + int parentIndex = prodVtx->incomingParticle(i)->index(); + particleMask[parentIndex] = true; + } + // Get the particles leaving the production vertex (SIBLINGS) + for (unsigned int i=0; i<nSiblings; ++i) { + if (prodVtx->outgoingParticle(i)==nullptr) continue; + int siblingIndex = prodVtx->outgoingParticle(i)->index(); + particleMask[siblingIndex] = true; + } + } + } + return; + } + + // descendants: starting from particle (simple listing version) + void descendants(const xAOD::TruthParticle* pHead, + std::vector<int> &particleList, + std::unordered_set<int> &encounteredBarcodes) { + + // Check that this barcode hasn't been seen before (e.g. we are in a loop) + //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; + std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); + if (found!=encounteredBarcodes.end()) return; + encounteredBarcodes.insert(pHead->barcode()); + + // Get the decay vertex + const xAOD::TruthVertex* decayVtx(0); + if (pHead->hasDecayVtx()) {decayVtx = pHead->decayVtx();} + else {return;} + + // Save the PDG ID number of the particle + particleList.push_back(pHead->pdgId()); + + // Get children particles and self-call + int nChildren = decayVtx->nOutgoingParticles(); + for (int i=0; i<nChildren; ++i) { + if (decayVtx->outgoingParticle(i)==nullptr) continue; + descendants(decayVtx->outgoingParticle(i),particleList,encounteredBarcodes); + } + return; + } + + // descendants: starting from particle + void descendants(const xAOD::TruthParticle* pHead, + std::vector<bool> &particleMask, + std::vector<bool> &vertexMask, + std::unordered_set<int> &encounteredBarcodes, + bool includeGeant) { + + // Check that the particle exists + if (pHead==nullptr) return; + + // Check that this barcode hasn't been seen before (e.g. we are in a loop) + //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; + std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); + if (found!=encounteredBarcodes.end()) return; + encounteredBarcodes.insert(pHead->barcode()); + + // Save the particle position in the mask + // If user doesn't want Geant, check and reject Geant particles + if (!includeGeant && pHead->barcode()>g4BarcodeOffset) return; + int headIndex = pHead->index(); + particleMask[headIndex] = true; + + // Get the decay vertex + const xAOD::TruthVertex* decayVtx(0); + if (pHead->hasDecayVtx()) {decayVtx = pHead->decayVtx();} + else {return;} + + // Get children particles and self-call + int nChildren = decayVtx->nOutgoingParticles(); + bool saveVertex = false; + for (int i=0; i<nChildren; ++i) { + if (decayVtx->outgoingParticle(i)==nullptr) continue; + descendants(decayVtx->outgoingParticle(i),particleMask,vertexMask,encounteredBarcodes,includeGeant); + saveVertex = saveVertex || includeGeant || !(decayVtx->outgoingParticle(i)->barcode()>g4BarcodeOffset); + } + + // Save the decay vertex + if ( saveVertex ) { + int vtxIndex = decayVtx->index(); + vertexMask[vtxIndex] = true; + } + return; + } + + // ancestors: starting from particle + void ancestors(const xAOD::TruthParticle* pHead, + std::vector<bool> &particleMask, + std::vector<bool> &vertexMask, + std::unordered_set<int> &encounteredBarcodes ) { + + // Check that the head particle exists + if (pHead==nullptr) return; + + // Check that this barcode hasn't been seen before (e.g. we are in a loop) + //if ( find(encounteredBarcodes.begin(),encounteredBarcodes.end(),pHead->barcode()) != encounteredBarcodes.end()) return; + std::unordered_set<int>::const_iterator found = encounteredBarcodes.find(pHead->barcode()); + if (found!=encounteredBarcodes.end()) return; + encounteredBarcodes.insert(pHead->barcode()); + + // Save particle position in the mask + int headIndex = pHead->index(); + particleMask[headIndex] = true; + + // Get the production vertex + const xAOD::TruthVertex* prodVtx(0); + if (pHead->hasProdVtx()) {prodVtx = pHead->prodVtx();} + else {return;} + + // Save the production vertex + int vtxIndex = prodVtx->index(); + vertexMask[vtxIndex] = true; + + // Get children particles and self-call + int nParents = prodVtx->nIncomingParticles(); + for (int i=0; i<nParents; ++i) ancestors(prodVtx->incomingParticle(i),particleMask,vertexMask,encounteredBarcodes); + return; + } + + void constructListOfFinalParticles(const xAOD::TruthParticleContainer* allParticles, + std::vector<const xAOD::TruthParticle*> &selectedlist, + const std::vector<int> &pdgId, bool usePhotonsFromHadrons = false, + bool chargedOnly = false) const + { + //fill the vector selectedlist with only particles with abs(ID) in the list + //pdgID that are 'good' for dressing: status==1, barcode < 2e5 (for the + //photons), not from hadron decay, + //skip pdgId check if pdgId is an empty vector, + //ignore photons coming from hadrons if usePhotonsFromHadrons=false, + //only use charged particles if chargedOnly=true + + bool skipPdgCheck = (pdgId.size()==0); + //bypass the hadron veto? + + for (xAOD::TruthParticleContainer::const_iterator pItr=allParticles->begin(); pItr!=allParticles->end(); ++pItr) { + const xAOD::TruthParticle *particle = *pItr; + + if (particle->status() != 1) continue; + + if (!skipPdgCheck && find(pdgId.begin(), pdgId.end(), abs(particle->pdgId())) == pdgId.end()) continue; + + //ensure particles are not from GEANT + if (particle->barcode() >= g4BarcodeOffset) continue; + + //check if we have a neutral particle (threeCharge returns int) + if (chargedOnly && HepPID::threeCharge(particle->pdgId()) == 0) continue; + + //if we have a photon from hadron decay, and usePhotonsFromHadrons=false, skip this particle + if (!usePhotonsFromHadrons && fromHadronDecay(particle) && particle->pdgId()==22) continue; + + //good particle, add to list + selectedlist.push_back(particle); + } + } + + bool fromHadronDecay(const xAOD::TruthParticle* particle) const + { + //does this particle come from a hadron decay? + //copied and modified from + //MenuTruthDressingTool::isLeptonFromTau() + + const xAOD::TruthVertex* prod = particle->prodVtx(); + if(!prod) return false; // no parent. + + // Simple loop catch + if (prod==particle->decayVtx()) return false; + + // Loop over the parents of this particle. + unsigned int nIncoming = prod->nIncomingParticles(); + for(unsigned int itr = 0; itr<nIncoming; ++itr){ + if (prod->incomingParticle(itr)==nullptr) continue; + int parentId = prod->incomingParticle(itr)->pdgId(); + if(HepPID::isHadron(parentId)) { + return true; + } + + //note from tancredi: should we search up the chain for leptons as + //well? B->l->photon should be rejected? + if(parentId == particle->pdgId()) { + //continue searching up photon->photon chains + if(fromHadronDecay(prod->incomingParticle(itr))) { + return true; + } + } + } + + return false; + } + + float calculateDeltaR(const xAOD::IParticle *p1, const xAOD::IParticle *p2) const + { + float phi1 = p1->phi(); + float phi2 = p2->phi(); + float eta1 = p1->eta(); + float eta2 = p2->eta(); + float deltaPhi = fabs(phi1-phi2); + if (deltaPhi>TMath::Pi()) deltaPhi = 2.0*TMath::Pi() - deltaPhi; + float deltaPhiSq = (phi1-phi2)*(phi1-phi2); + float deltaEtaSq = (eta1-eta2)*(eta1-eta2); + float deltaR = sqrt(deltaPhiSq+deltaEtaSq); + return deltaR; + } + }; +} + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h index 7c31ee6af23105284c97c2d3e3a57a1553d854f9..dbeffbad84dc124b9fa03a1fb43f4f3b68fb2622 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h @@ -46,8 +46,9 @@ namespace DerivationFramework { bool isttHFHadron(const xAOD::TruthParticle*) const; bool isBoson(const xAOD::TruthParticle*) const; bool isFsrFromLepton(const xAOD::TruthParticle*) const; - - + bool parentIsLongLived(const xAOD::TruthParticle*) const; + + private: // THE MENU @@ -68,7 +69,10 @@ namespace DerivationFramework { /// Parameter: Keep b-hadrons? bool m_writeBHadrons; - + + /// Parameter: Keep c-hadrons? + bool m_writeCHadrons; + /// Parameter: Keep geant particles? bool m_writeGeant; @@ -125,12 +129,22 @@ namespace DerivationFramework { bool m_preserveAncestors; bool m_preserveImmediate; // parents, siblings, children only bool m_preserveHadVtx; // hadronization vertices for above - + + /// Parameter: List of PDG IDs to always keep + std::vector<int> m_pdgIdsToKeep; + + /// Parameter: List of PDG IDs of long lived particles so that one can keep their children + std::vector<int> m_longLivedPdgIds; + + /// for keeping trace of barcodes in order to detect loops + mutable std::unordered_set<int> m_barcode_trace; + // counters mutable std::atomic<unsigned int> m_totpart; mutable std::atomic<unsigned int> m_removedpart; mutable std::atomic<int> m_eventCount; + /// Parameter: simulation barcode offset int m_geantOffset; }; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthClassificationDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthClassificationDecorator.h index 664b27d6b9022c2009c06bb4d3337994c973aacc..eff733044a1c8be029c40190eeaf69ce50434a51 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthClassificationDecorator.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthClassificationDecorator.h @@ -2,10 +2,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TruthClassificationDecorator.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef DERIVATIONFRAMEWORK_TRUTHCLASSIFICATIONDECORATOR_H #define DERIVATIONFRAMEWORK_TRUTHCLASSIFICATIONDECORATOR_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMaker.h index 444a9a738d43a7c7ca141eb186ce7beb10a99752..73cc81c9882d64ebe39f64a8883deceea0361670 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMaker.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMaker.h @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TruthCollectionMaker.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef DERIVATIONFRAMEWORK_TRUTHCOLLECTIONMAKER_H #define DERIVATIONFRAMEWORK_TRUTHCOLLECTIONMAKER_H @@ -14,7 +10,10 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IAugmentationTool.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +// Forward declarations +class StoreGateSvc; namespace ExpressionParsing { class ExpressionParser; } @@ -33,10 +32,11 @@ namespace DerivationFramework { ExpressionParsing::ExpressionParser *m_partParser; mutable unsigned int m_ntotpart, m_npasspart; std::string m_particlesKey; - //std::string m_verticesKey; std::string m_collectionName; std::string m_partString; bool m_do_compress, m_do_sherpa; + bool m_keep_navigation_info; + ServiceHandle<StoreGateSvc> m_metaStore; //!< Handle on the metadata store for init }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMakerTau.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMakerTau.h index d53d4edb4de856b03b25643f05d8767791250d8c..a9378976100dc111a6a8fa65cf8ca7e0c8e392f1 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMakerTau.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthCollectionMakerTau.h @@ -1,21 +1,21 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//////////////////////////////////////////OB//////////////////////// -// TruthCollectionMakerTau.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef DERIVATIONFRAMEWORK_TRUTHCOLLECTIONMAKERTAU_H #define DERIVATIONFRAMEWORK_TRUTHCOLLECTIONMAKERTAU_H +// Interface classes #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +// For the tool handle #include "GaudiKernel/ToolHandle.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODTruth/TruthParticleAuxContainer.h" -class IMCTruthClassifier; +// Forward declarations +namespace TauAnalysisTools{ + class IBuildTruthTaus; +} namespace DerivationFramework { @@ -24,41 +24,12 @@ namespace DerivationFramework { TruthCollectionMakerTau(const std::string& t, const std::string& n, const IInterface* p); ~TruthCollectionMakerTau(); StatusCode initialize(); - StatusCode finalize(); virtual StatusCode addBranches() const; - void printDecay(const xAOD::TruthParticle& xTruthParticle, int depth = 0) const; - - private: - - StatusCode examineTruthTau(const xAOD::TruthParticle& xTruthParticle) const; - StatusCode examineTruthTauDecay(const xAOD::TruthParticle& xTruthParticle) const; - StatusCode getPromptTLV(const xAOD::TruthParticle& xTruthParticle) const; - - std::string m_particlesKey; - std::string m_collectionName; - ToolHandle<IMCTruthClassifier> m_classifier; - - bool m_runClassifier; - bool m_writeVisibleChargedFourMomentum; - bool m_writeVisibleNeutralFourMomentum; - bool m_writeDecayModeVector; - mutable size_t m_iNChargedPions; - mutable size_t m_iNNeutralPions; - mutable size_t m_iNChargedOthers; - mutable size_t m_iNNeutralOthers; - mutable size_t m_iNChargedDaughters; - mutable std::vector<int> m_vDecayMode; - - mutable TLorentzVector m_vTruthVisTLV; - mutable TLorentzVector m_vTruthPromptTLV; - mutable TLorentzVector m_vTruthVisTLVCharged; - mutable TLorentzVector m_vTruthVisTLVNeutral; + ToolHandle<TauAnalysisTools::IBuildTruthTaus> m_buildTruthTaus; - mutable bool m_bIsHadronicTau; - }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthD2Decorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthD2Decorator.h new file mode 100644 index 0000000000000000000000000000000000000000..dbf2107ba9963d3fc49bfc61411ae2b95564c7f5 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthD2Decorator.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// TruthD2Decorator.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_TRUTHD2DECORATOR_H +#define DERIVATIONFRAMEWORK_TRUTHD2DECORATOR_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +namespace DerivationFramework { + + class TruthD2Decorator : public AthAlgTool, public IAugmentationTool { + public: + TruthD2Decorator(const std::string& t, const std::string& n, const IInterface* p); + virtual StatusCode addBranches() const; + + private: + //configurables + std::string m_jetContainerKey; + std::string m_decorationName; + }; +} + +#endif // DERIVATIONFRAMEWORK_TruthD2Decorator_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDecayCollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDecayCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..3a9c546f207de2656f76adcc0a19f608dba65393 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDecayCollectionMaker.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H +#define DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H + +// Base classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +// EDM -- typedefs so these are includes +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +// Standard library includes +#include <vector> +#include <string> + +namespace DerivationFramework { + + class TruthDecayCollectionMaker : public AthAlgTool, public IAugmentationTool { + public: + TruthDecayCollectionMaker(const std::string& t, const std::string& n, const IInterface* p); + ~TruthDecayCollectionMaker(); + StatusCode initialize(); + virtual StatusCode addBranches() const; + + private: + std::vector<int> m_pdgIdsToKeep; //!< List of PDG IDs to build this collection from + bool m_keepBHadrons; //!< Option to keep all b-hadrons (better than giving PDG IDs) + bool m_keepCHadrons; //!< Option to keep all c-hadrons (better than giving PDG IDs) + bool m_keepBSM; //!< Option to keep all BSM particles (better than giving PDG IDs) + bool m_rejectHadronChildren; //!< Option to reject hadron descendants + std::string m_particlesKey; //!< Input particle collection (navigates to the vertices) + std::string m_collectionName; //!< Output collection name stem + int m_generations; //!< Number of generations after the particle in question to keep + // Helper functions for building up the decay product collections + int addTruthParticle( const xAOD::TruthParticle& old_part, xAOD::TruthParticleContainer* part_cont, + xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles, + const int generations=-1) const; + int addTruthVertex( const xAOD::TruthVertex& old_vert, xAOD::TruthParticleContainer* part_cont, + xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles, + const int generations=-1) const; + bool id_ok( const xAOD::TruthParticle& part ) const; + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDressingTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDressingTool.h index 76eae44ca2c69cecce798f97541756234ecee08f..14d2976ea823bf51a0e56089c5c1f7304aa8706d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDressingTool.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthDressingTool.h @@ -2,10 +2,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TruthDressingTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef DERIVATIONFRAMEWORK_TRUTHDRESSINGTOOL_H #define DERIVATIONFRAMEWORK_TRUTHDRESSINGTOOL_H @@ -40,6 +36,8 @@ namespace DerivationFramework { std::vector<int> m_listOfPIDs; /// Parameter: Use antikT algorithm for dressing? bool m_useAntiKt; + /// Parameter: Name of the decoration to apply + std::string m_decorationName; }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthIsolationTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthIsolationTool.h index 4112c89c1422dfeb9766277872185d5d40a5761c..3c41b0436b5e43afad3c6292636f93f48c17161f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthIsolationTool.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthIsolationTool.h @@ -2,10 +2,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TruthIsolationTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef DERIVATIONFRAMEWORK_TRUTHISOLATIONTOOL_H #define DERIVATIONFRAMEWORK_TRUTHISOLATIONTOOL_H @@ -42,6 +38,10 @@ namespace DerivationFramework { std::vector<int> m_excludeFromCone; /// Parameter: name of output variable std::string m_isoVarNamePrefix; + /// Parameter: Include non-interacting particles? + bool m_includeNonInteracting; + /// Parameter: Use variable radius? + bool m_variableR; std::vector<float> *m_coneSizesSort; std::vector<float> *m_coneSizes2; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthPVCollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthPVCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..8005cf147f367ebe11b2486970b53badb40e044a --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthPVCollectionMaker.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TRUTHPVCOLLECTIONMAKER_H +#define DERIVATIONFRAMEWORK_TRUTHPVCOLLECTIONMAKER_H + +// Base classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +// Standard library includes +#include <string> + +namespace DerivationFramework { + + class TruthPVCollectionMaker : public AthAlgTool, public IAugmentationTool { + public: + TruthPVCollectionMaker(const std::string& t, const std::string& n, const IInterface* p); + ~TruthPVCollectionMaker(); + StatusCode initialize(); + virtual StatusCode addBranches() const; + + private: + std::string m_eventsKey; //!< Input event collection (navigates to the vertices) + std::string m_collectionName; //!< Output collection name + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHPVCOLLECTIONMAKER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthQGDecorationTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthQGDecorationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..71136f770735fdbccd5293ba8358b6c7a4557b6c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/TruthQGDecorationTool.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TruthQGDecorationTool_H +#define DERIVATIONFRAMEWORK_TruthQGDecorationTool_H + +// Interface classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +// STL includes +#include <string> + +namespace DerivationFramework { + + class TruthQGDecorationTool : public AthAlgTool, public IAugmentationTool { + public: + TruthQGDecorationTool(const std::string& t, const std::string& n, const IInterface* p); + ~TruthQGDecorationTool(); + virtual StatusCode addBranches() const; + + private: + /// Parameter: input collection key + std::string m_jetsKey; + /// Parameter: output decoration + std::string m_decOutput; + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHDRESSINGTool_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/GenFilterToolSetup.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/GenFilterToolSetup.py new file mode 100644 index 0000000000000000000000000000000000000000..530c5165733bbe97ce44a62df685ddc83512f021 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/GenFilterToolSetup.py @@ -0,0 +1,18 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Common code for setting up the gen filter tools + +# Set up the MCTruthClassifier +from AthenaCommon.AppMgr import ToolSvc +if not hasattr(ToolSvc,'DFCommonTruthClassifier'): + from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier + DFCommonTruthClassifier = MCTruthClassifier(name = "DFCommonTruthClassifier", + ParticleCaloExtensionTool = "") + ToolSvc += DFCommonTruthClassifier + +#Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo) +#from AthenaCommon import CfgMgr +#DFCommonTruthGenFilter = CfgMgr.DerivationFramework__GenFilterTool( +# "DFCommonTruthGenFilt", +# ) +#ToolSvc += DFCommonTruthGenFilter diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/HFHadronsCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/HFHadronsCommon.py index 1d62b8e3ea6071a538da600f60806dca4ab5d664..56af6be1820f0fdea8a69ef9378750b3f4e02ca0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/HFHadronsCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/HFHadronsCommon.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ############################################# # Heavy flavour from tt tools @@ -19,13 +19,82 @@ DSIDList=[ 410121, 410159, 410160, + 410163, 410186, 410187, 410188, 410189, + 410225, + 410226, + 410227, 410232, 410233, + 410249, + 410250, + 410251, + 410252, + 410342, + 410343, + 410344, + 410345, + 410346, + 410347, + 410350, + 410351, + 410352, + 410353, + 410354, + 410355, + 410357, + 410358, + 410359, + 410361, + 410362, + 410363, + 410364, + 410365, + 410366, + 410367, + 410274, + 410275, 410500, + 410501, + 410502, + 410503, + 410504, + 410505, + 410506, + 410507, + 410508, + 410511, + 410512, + 410513, + 410514, + 410515, + 410516, + 410517, + 410518, + 410519, + 410520, + 410521, + 410522, + 410523, + 410524, + 410525, + 410526, + 410527, + 410528, + 410529, + 410530, + 410531, + 410532, + 410533, + 410534, + 410535, + 410536, + 410537, + 410568, + 410569, 301528, 301529, 301530, @@ -40,6 +109,30 @@ DSIDList=[ 407010, 407011, 407012, + 407029, + 407030, + 407031, + 407032, + 407033, + 407034, + 407035, + 407036, + 407037, + 407038, + 407039, + 407040, + 407342, + 407343, + 407344, + 407345, + 407346, + 407347, + 407354, + 407355, + 407356, + 407348, + 407349, + 407350, 410120, 426090, 426091, @@ -50,11 +143,115 @@ DSIDList=[ 426096, 426097, 429007, -] + 410244, + 410245, + 410323, + 410324, + 410325, + 410369, + 410281, + 410282, + 410283, + 364345, + 364346, + 364347, + 364348, + 410424, + 410425, + 410426, + 410427, + 410441, + 410442, + 410470, + 410471, + 410472, + 410480, + 410481, + 410482, + 410452, + 410557, + 410558, + 410559, + 410464, + 410465, + 410466, + 411073, + 411074, + 411075, + 411076, + 411077, + 411078, + 411079, + 411080, + 411081, + 411082, + 411083, + 411084, + 411085, + 411086, + 411087, + 411088, + 411089, + 411090, + 411068, + 411069, + 411070, + 411178, + 411179, + 411180, + 411275, + 410661, + 410662, + 410663, + 410664, + 410265, + 410266, + 410267, + 412066, + 412067, + 412068, + 412069, + 412070, + 412071, + 412072, + 412073, + 412074, + 411233, + 411234, + 411329, + 411330, + 411331, + 411332, + 411333, + 411334, + 411335, + 411336, + 411337, + 412116, + 412117, + 421152, + 421153, + 421154, + 421156, + 421157, + 421158, + 700051, + 700052, + 700053, + 700054, + ] import PyUtils.AthFile as af from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -f = af.fopen(athenaCommonFlags.PoolAODInput()[0]) + +# Peek at the file -- this depends on what kind of file we have +from RecExConfig.ObjKeyStore import objKeyStore +if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ): + f = af.fopen(athenaCommonFlags.FilesInput()[0]) +elif objKeyStore.isInInput( "McEventCollection", "TruthEvent"): + f = af.fopen(athenaCommonFlags.FilesInput()[0]) +else: + f = af.fopen(athenaCommonFlags.PoolAODInput()[0]) if len(f.mc_channel_number) > 0: if(int(f.mc_channel_number[0]) in DSIDList): from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HadronOriginClassifier diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommon.py index a56d1660bdcd849d275926816e238c0e0e4110fd..6b2790589620051a4daccc0c42f3a906a796eb96 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommon.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Add translator from EVGEN input to xAOD-like truth here from DerivationFrameworkCore.DerivationFrameworkMaster import * @@ -6,32 +6,654 @@ from RecExConfig.ObjKeyStore import objKeyStore from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__xAODTruthCnvAlg from DerivationFrameworkMCTruth.TruthDerivationTools import * -dfInputIsEVNT = False # Flag to distinguish EVNT from AOD input -# Build truth collection if input is HepMC. Must be scheduled first to allow slimming. -# Input file is EVNT -if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ): - DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT")) - dfInputIsEVNT = True -# Input file is HITS -elif objKeyStore.isInInput( "McEventCollection", "TruthEvent"): - DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="TruthEvent")) - dfInputIsEVNT = True -# Input file must be xAOD -if (dfInputIsEVNT==False): - # xAOD input so we need to schedule the special truth building tools and add them to a common augmentation - augmentationToolsList = [ DFCommonTruthClassificationTool, - DFCommonTruthMuonTool,DFCommonTruthElectronTool, - DFCommonTruthPhotonToolSim, - #DFCommonTruthTauTool, - DFCommonTruthNeutrinoTool, - TRUTH3TopTool, - TRUTH3BosonTool, - TRUTH3BSMTool, - DFCommonTruthElectronDressingTool, DFCommonTruthMuonDressingTool, - DFCommonTruthElectronIsolationTool1, DFCommonTruthElectronIsolationTool2, - DFCommonTruthMuonIsolationTool1, DFCommonTruthMuonIsolationTool2, - DFCommonTruthPhotonIsolationTool1, DFCommonTruthPhotonIsolationTool2] - from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation - DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonKernel", - AugmentationTools = augmentationToolsList - ) +from AthenaCommon import Logging +dfcommontruthlog = Logging.logging.getLogger('DFCommonTruth') + +# Execute this only for MC +from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkIsMonteCarlo +if DerivationFrameworkIsMonteCarlo: + dfInputIsEVNT = False # Flag to distinguish EVNT from AOD input + # Build truth collection if input is HepMC. Must be scheduled first to allow slimming. + # Input file is EVNT + if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ): + if not hasattr(DerivationFrameworkJob,'GEN_EVNT2xAOD'): + DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT")) + dfInputIsEVNT = True + # Input file is HITS and translation hasn't been scheduled - careful with the name difference! + elif objKeyStore.isInInput( "McEventCollection", "TruthEvent"): + if not hasattr(DerivationFrameworkJob,'GEN_AOD2xAOD'): + DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="TruthEvent")) + dfInputIsEVNT = True + # If it isn't available, make a truth meta data object (will hold MC Event Weights) + #if not objKeyStore.isInInput( "xAOD::TruthMetaDataContainer", "TruthMetaData" ) and not dfInputIsEVNT: + # # If we are going to be making the truth collection (dfInputIsEVNT) then this will be made elsewhere + # from AthenaCommon.AppMgr import ToolSvc + # ToolSvc += CfgMgr.DerivationFramework__TruthMetaDataWriter(name='DFCommonTruthMetaDataWriter') + # from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + # from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + # DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonMetaDataWriterKernel", + # AugmentationTools = [ToolSvc.DFCommonTruthMetaDataWriter] + # ) + + # Add in some jets - global config if we are running on EVNT + if dfInputIsEVNT: + from JetRec.JetRecFlags import jetFlags + jetFlags.useTruth = True + jetFlags.useTracks = False + jetFlags.truthFlavorTags = ["BHadronsInitial", "BHadronsFinal", "BQuarksFinal", + "CHadronsInitial", "CHadronsFinal", "CQuarksFinal", + "TausFinal", + "Partons", + ] + +def addTruthJetsEVNT(kernel=None, decorationDressing=None): + # Ensure that we are running on something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + # Add jet algorithms if they aren't there + from JetRec.JetRecStandard import jtm + from JetRec.JetRecConf import JetAlgorithm + truth_modifiers = [jtm.truthpartondr, jtm.partontruthlabel, jtm.jetdrlabeler, jtm.trackjetdrlabeler] + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt4TruthJets") and not hasattr(kernel,'jetalgAntiKt4Truth'): + # Standard truth jets + # To remove jet constituents add the modifier jtm.removeconstit + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + addStandardJets("AntiKt", 0.4, "Truth", 15000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt4TruthWZJets") and not hasattr(kernel,'jetalgAntiKt4TruthWZ'): + # WZ Truth Jets - handle non-dressed case + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + addStandardJets("AntiKt", 0.4, "TruthWZ", 15000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt4TruthDressedWZJets") and decorationDressing is not None: + # WZ Dressed Truth Jets - handle dressed case + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + addStandardJets("AntiKt", 0.4, "TruthDressedWZ", ptmin=15000, mods="truth_ungroomed", algseq=kernel, outputGroup="DFCommonMCTruthJets") + + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt2TruthChargedJets"): + # R=0.2 truth charged jets + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + addStandardJets("AntiKt", 0.2, "TruthCharged", 5000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") + + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt10TruthJets") and not hasattr(kernel,'jetalgAntiKt10Truth'): + # AntiKt2 truth charged jets ghost association + from JetRec.JetRecConf import PseudoJetGetter + if not 'gakt2truthchargedget' in jtm.tools: + jtm += PseudoJetGetter("gakt2truthchargedget", # give a unique name + InputContainer = "AntiKt2TruthChargedJets", # SG key + Label = "GhostAntiKt2TruthChargedJets", # this is the name you'll use to retrieve associated ghosts + OutputContainer = "PseudoJetGhostAntiKt2TruthChargedJet", + SkipNegativeEnergy = True, + GhostScale = 1.e-20, # This makes the PseudoJet Ghosts, and thus the reco flow will treat them as so. + ) + trackjetgetters = [] + trackjetgetters += [jtm.gakt2truthchargedget] + truthgetters = [jtm.truthget] + truthgetters += trackjetgetters + flavorgetters = [] + for ptype in jetFlags.truthFlavorTags(): + flavorgetters += [getattr(jtm, "gtruthget_" + ptype)] + truthgetters += flavorgetters + jtm.gettersMap["truth"] = list(truthgetters) + + # NB! This line works together with the next block. Some care is required here! + # If we build groomed jets, the jet code will automatically build ungroomed jets, so no need to add them separately + #Large R ungroomed jets + if objKeyStore.isInInput( "xAOD::JetContainer","AntiKt10TruthTrimmedPtFrac5SmallR20Jets"): + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + addStandardJets('AntiKt', 1.0, 'Truth', ptmin=50000, mods=truth_modifiers, algseq=kernel, outputGroup="DFCommonMCTruthJets") + + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt10TruthTrimmedPtFrac5SmallR20Jets") and not hasattr(kernel,'jetalgAntiKt10TruthTrimmedPtFrac5SmallR20'): + #Large R jets + from DerivationFrameworkJetEtMiss.JetCommon import addTrimmedJets + #addTrimmedJets('AntiKt', 1.0, 'Truth', rclus=0.2, ptfrac=0.05, mods="truth_groomed", + # algseq=kernel, outputGroup="Trimmed", writeUngroomed=False) + +def addTruthJetsAOD(kernel=None, decorationDressing=None): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + # In this case, we simply use the helpers from ExtendedJetCommon + from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addAntiKt4TruthJets,addAntiKt4TruthWZJets,addAntiKt10TruthJets + addAntiKt4TruthJets(kernel,"TRUTH") # Ignore the output list + addAntiKt4TruthWZJets(kernel,"TRUTH") + #if decorationDressing is not None: + # from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addAntiKt4TruthDressedWZJets + # addAntiKt4TruthDressedWZJets(kernel,'TRUTH') + if not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt10TruthTrimmedPtFrac5SmallR20Jets"): + #Large R jets + from DerivationFrameworkJetEtMiss.JetCommon import addTrimmedJets + #addTrimmedJets('AntiKt', 1.0, 'Truth', rclus=0.2, ptfrac=0.05, mods="truth_groomed", + # algseq=kernel, outputGroup="Trimmed", writeUngroomed=False) + elif not objKeyStore.isInInput( "xAOD::JetContainer","AntiKt10TruthJets"): + addAntiKt10TruthJets(kernel,"TRUTH") + +# Helper for adding truth jet collections +def addTruthJets(kernel=None, decorationDressing=None): + # In case it's requested, set up the use of photon decorations from dressing code + from JetRec.JetRecStandardToolManager import jtm + if decorationDressing is not None and not hasattr(jtm,'truthpartdressedwz'): + # Ensure that we are adding it to something, and that we haven't run it already + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + # make sure if we are using EVNT that we don't try to check sim metadata + barCodeFromMetadata=2 + if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ): + barCodeFromMetadata=0 + from JetRec.JetRecStandardToolManager import jtm + from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles + if not 'truthpartdressedwz' in jtm.tools: + jtm += CopyTruthJetParticles("truthpartdressedwz", OutputName="JetInputTruthParticlesDressedWZ", + MCTruthClassifier=jtm.JetMCTruthClassifier, + #IncludePromptLeptons=False,#IncludePromptPhotons=False, + #IncludeMuons=True,IncludeNeutrinos=True,BarCodeFromMetadata=barCodeFromMetadata, + #FSRPhotonCone=-1. #, DressingDecorationName=decorationDressing + ) + # Add a jet tool runner for this thing + from JetRec.JetRecConf import JetToolRunner,JetAlgorithm,PseudoJetGetter + jtm += JetToolRunner("jetdressedwzrun", EventShapeTools=[], Tools=[jtm.truthpartdressedwz], Timer=jetFlags.timeJetToolRunner() ) + # And an algorithm to run in + kernel += JetAlgorithm("jetdressedwzalg") + jetdressedwzalg = kernel.jetdressedwzalg + jetdressedwzalg.Tools = [ jtm.jetdressedwzrun ] + if not 'truthdressedwzget' in jtm.tools: + jtm += PseudoJetGetter("truthdressedwzget", + Label = "TruthDressedWZ", + InputContainer = jtm.truthpartdressedwz.OutputName, + OutputContainer = "PseudoJetTruthDressedWZ", + GhostScale = 0.0, + SkipNegativeEnergy = True + ) + jtm.gettersMap['truthdressedwz'] = list(jtm.gettersMap['truth']) + jtm.gettersMap['truthdressedwz'][0] = jtm.truthdressedwzget + if not hasattr(jtm,'truthpartcharged'): + # Ensure that we are adding it to something, and that we haven't run it already + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + # make sure if we are using EVNT that we don't try to check sim metadata + barCodeFromMetadata=2 + if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ): + barCodeFromMetadata=0 + from JetRec.JetRecStandardToolManager import jtm + from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles + if not 'truthpartcharged' in jtm.tools: + jtm += CopyTruthJetParticles("truthpartcharged", OutputName="JetInputTruthParticlesCharged", + MCTruthClassifier=jtm.JetMCTruthClassifier, + #ChargedParticlesOnly=True, + #BarCodeFromMetadata=barCodeFromMetadata + ) + # Add a jet tool runner for this thing + from JetRec.JetRecConf import JetToolRunner,JetAlgorithm,PseudoJetGetter + jtm += JetToolRunner("jetchargedrun", EventShapeTools=[], Tools=[jtm.truthpartcharged], Timer=jetFlags.timeJetToolRunner() ) + # And an algorithm to run in + kernel += JetAlgorithm("jetchargedalg") + jetchargedalg = kernel.jetchargedalg + jetchargedalg.Tools = [ jtm.jetchargedrun ] + if not 'truthchargedget' in jtm.tools: + jtm += PseudoJetGetter("truthchargedget", + Label = "TruthCharged", + InputContainer = jtm.truthpartcharged.OutputName, + OutputContainer = "PseudoJetTruthCharged", + GhostScale = 0.0, + SkipNegativeEnergy = True + ) + jtm.gettersMap['truthcharged'] = [jtm.truthchargedget] + # Propagate that downward + if dfInputIsEVNT: + addTruthJetsEVNT(kernel,decorationDressing) + else: + addTruthJetsAOD(kernel,decorationDressing) + +# Helper for scheduling the truth MET collection +def addTruthMET(kernel=None): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + # Only do this if the truth MET is not present + # This should handle EVNT correctly without an explicit check + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + if not objKeyStore.isInInput( "xAOD::MissingETContainer","MET_Truth") and not hasattr(DerivationFrameworkJob,"METReconstruction"): + import METReconstruction.METConfig_Truth + from METReconstruction.METRecoConfig import getMETRecoAlg + metAlg = getMETRecoAlg('METReconstruction') + kernel += metAlg + +def schedulePreJetMCTruthAugmentations(kernel=None, decorationDressing=None): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonPreJetKernel'): + # Already there! Carry on... + return + # These augmentations do *not* require truth jets at all + # If requested, add a decoration to photons that were used in the dressing + if decorationDressing is not None: + DFCommonTruthElectronDressingTool.decorationName = decorationDressing + DFCommonTruthMuonDressingTool.decorationName = decorationDressing + + # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below + augmentationToolsList = [ DFCommonTruthClassificationTool, + DFCommonTruthMuonTool,DFCommonTruthElectronTool, + DFCommonTruthPhotonToolSim, + DFCommonTruthNeutrinoTool, + DFCommonTruthBottomTool, + DFCommonTruthTopTool, + DFCommonTruthBosonTool, + DFCommonTruthBSMTool, + DFCommonTruthForwardProtonTool, + DFCommonTruthElectronDressingTool, DFCommonTruthMuonDressingTool, + DFCommonTruthElectronIsolationTool1, DFCommonTruthElectronIsolationTool2, + DFCommonTruthMuonIsolationTool1, DFCommonTruthMuonIsolationTool2, + DFCommonTruthPhotonIsolationTool1, DFCommonTruthPhotonIsolationTool2, DFCommonTruthPhotonIsolationTool3] + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonPreJetKernel", + AugmentationTools = augmentationToolsList + ) + + + + + +def schedulePostJetMCTruthAugmentations(kernel=None, decorationDressing=None): + # These augmentations *require* truth jets in order to behave properly + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonPostJetKernel'): + # Already there! Carry on... + return + + # Tau collections are built separately + # truth tau matching needs truth jets, truth electrons and truth muons + from DerivationFrameworkTau.TauTruthCommon import scheduleTauTruthTools + scheduleTauTruthTools(kernel) + augmentationToolsList = [ DFCommonTruthTauDressingTool ] + + #Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo) + #from DerivationFrameworkMCTruth.GenFilterToolSetup import DFCommonTruthGenFilter + + # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below + #augmentationToolsList += [ DFCommonTruthGenFilter, + # DFCommonTruthQGLabelTool] + augmentationToolsList = [] + #if decorationDressing is not None: + # from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthQGDecorationTool + # DFCommonTruthDressedWZQGLabelTool = DerivationFramework__TruthQGDecorationTool(name="DFCommonTruthDressedWZQGLabelTool", + # JetCollection = "AntiKt4TruthDressedWZJets") + # from AthenaCommon.AppMgr import ToolSvc + # ToolSvc += DFCommonTruthDressedWZQGLabelTool + # augmentationToolsList += [ DFCommonTruthDressedWZQGLabelTool ] + # SUSY signal decorations + from DerivationFrameworkSUSY.DecorateSUSYProcess import IsSUSYSignal + if IsSUSYSignal(): + from DerivationFrameworkSUSY.DecorateSUSYProcess import DecorateSUSYProcess + augmentationToolsList += DecorateSUSYProcess('MCTruthCommon') + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonPostJetKernel", + AugmentationTools = augmentationToolsList + ) + +# This adds the entirety of TRUTH3 +def addStandardTruthContents(kernel=None, + decorationDressing='dressedPhoton', + includeTausInDressingPhotonRemoval=False, + prefix=''): + # Tools that must come before jets + schedulePreJetMCTruthAugmentations(kernel, decorationDressing) + # Should photons that are dressed onto taus also be removed from truth jets? + if includeTausInDressingPhotonRemoval: + from AthenaCommon.AppMgr import ToolSvc + ToolSvc.DFCommonTruthTauDressingTool.decorationName=decorationDressing + # Jets and MET + #addTruthJets(kernel, decorationDressing) + addTruthMET(kernel) + # Tools that must come after jets + schedulePostJetMCTruthAugmentations(kernel, decorationDressing) + # Add back the navigation contect for the collections we want + addTruthCollectionNavigationDecorations(kernel, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix) + # Some more additions for standard TRUTH3 + addBosonsAndDownstreamParticles(kernel) + #addLargeRJetD2(kernel) + # Special collection for BSM particles + addBSMAndDownstreamParticles(kernel) + # Special collection for Born leptons + addBornLeptonCollection(kernel) + # Special collection for hard scatter (matrix element) - save TWO extra generations of particles + addHardScatterCollection(kernel,2) + # Energy density for isolation corrections + #addTruthEnergyDensity(kernel) + + +def addParentAndDownstreamParticles(kernel=None, + generations=1, + parents=[6], + prefix='TopQuark', + collection_prefix=None, + rejectHadronChildren=False): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + kernel_name = 'MCTruthCommon'+prefix+'AndDecaysKernel' + if hasattr(kernel,kernel_name): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate "+kernel_name+". Failing.") + return + collection_name=collection_prefix+'WithDecay' if collection_prefix!=None else 'Truth'+prefix+'WithDecay' + # Set up a tool to keep the W/Z/H bosons and all downstream particles + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthDecayCollectionMaker + collection_maker = DerivationFramework__TruthDecayCollectionMaker( name='DFCommon'+prefix+'AndDecaysTool', + NewCollectionName=collection_name, + PDGIDsToKeep=parents, + Generations=generations, + RejectHadronChildren=rejectHadronChildren) + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += collection_maker + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation(kernel_name, + AugmentationTools = [collection_maker] ) + +# Add taus and their downstream particles (immediate and further decay products) in a special collection +def addTausAndDownstreamParticles(kernel=None, generations=1): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[15], + prefix='Tau') + +# Add W bosons and their downstream particles +def addWbosonsAndDownstreamParticles(kernel=None, generations=1, + rejectHadronChildren=False): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[24], + prefix='Wboson', + rejectHadronChildren=rejectHadronChildren) + +# Add W/Z/H bosons and their downstream particles (notice "boson" here does not include photons and gluons) +def addBosonsAndDownstreamParticles(kernel=None, generations=1, + rejectHadronChildren=False): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[23,24,25], + prefix='Bosons', + rejectHadronChildren=rejectHadronChildren) + + +def addBottomQuarkAndDownstreamParticles(kernel=None, generations=1, rejectHadronChildren=False): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[5], + prefix='BottomQuark', + rejectHadronChildren=rejectHadronChildren) + +def addTopQuarkAndDownstreamParticles(kernel=None, generations=1, + rejectHadronChildren=False): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[6], + prefix='TopQuark', + rejectHadronChildren=rejectHadronChildren) + +# Add electrons, photons, and their downstream particles in a special collection +def addEgammaAndDownstreamParticles(kernel=None, generations=1): + return addParentAndDownstreamParticles(kernel=kernel, + generations=generations, + parents=[11,22], + prefix='Egamma') + +# Add b/c-hadrons and their downstream particles (immediate and further decay products) in a special collection +def addHFAndDownstreamParticles(kernel=None, addB=True, addC=True, generations=-1, prefix=''): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,prefix+'MCTruthCommonHFAndDecaysKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate "+prefix+"MCTruthCommonHFAndDecaysKernel. Failing.") + return + # Set up a tool to keep b- and c-quarks and all downstream particles + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthDecayCollectionMaker + DFCommonHFAndDecaysTool = DerivationFramework__TruthDecayCollectionMaker( name=prefix+"DFCommonHFAndDecaysTool", + NewCollectionName=prefix+"TruthHFWithDecay", + KeepBHadrons=addB, + KeepCHadrons=addC, + Generations=generations) + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonHFAndDecaysTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation(prefix+"MCTruthCommonHFAndDecaysKernel", + AugmentationTools = [DFCommonHFAndDecaysTool] ) + +# Add a one-vertex-per event "primary vertex" container +def addPVCollection(kernel=None): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonTruthPVCollKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate MCTruthCommonTruthPVCollKernel. Failing.") + return + # Set up a tool to keep the primary vertices + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthPVCollectionMaker + DFCommonTruthPVCollTool = DerivationFramework__TruthPVCollectionMaker( name="DFCommonTruthPVCollTool", + NewCollectionName="TruthPrimaryVertices") + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonTruthPVCollTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonTruthPVCollKernel", + AugmentationTools = [DFCommonTruthPVCollTool] ) + +# Add a mini-collection for the hard scatter and N subsequent generations +def addHardScatterCollection(kernel=None, generations=1): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonHSCollectionKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate MCTruthCommonHSCollectionKernel. Failing.") + return + # Set up a tool to keep the taus and all downstream particles + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HardScatterCollectionMaker + DFCommonHSCollectionTool = DerivationFramework__HardScatterCollectionMaker( name="DFCommonHSCollectionTool", + NewCollectionName="HardScatter", + Generations=generations) + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonHSCollectionTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonHSCollectionKernel", + AugmentationTools = [DFCommonHSCollectionTool] ) + +# Add navigation decorations on the truth collections +def addTruthCollectionNavigationDecorations(kernel=None,TruthCollections=[], prefix=''): + if len(TruthCollections)==0: return + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,prefix+'MCTruthNavigationDecoratorKernel'): + # Already there, no need for duplication + dfcommontruthlog.warning("Attempt to add a duplicate "+prefix+"MCTruthNavigationDecoratorKernel. Failing.") + return + # Set up a tool to add the navigation decorations + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthNavigationDecorator + DFCommonTruthNavigationDecorator = DerivationFramework__TruthNavigationDecorator( name=prefix+'DFCommonTruthNavigationDecorator', + InputCollections=TruthCollections) + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonTruthNavigationDecorator + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation(prefix+"MCTruthNavigationDecoratorKernel", + AugmentationTools = [DFCommonTruthNavigationDecorator] ) + +# Add BSM particles and their downstream particles (immediate and further decay products) in a special collection +def addBSMAndDownstreamParticles(kernel=None, generations=-1): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonBSMAndDecaysKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate MCTruthCommonBSMAndDecaysKernel. Failing.") + return + # Set up a tool to keep the taus and all downstream particles + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthDecayCollectionMaker + DFCommonBSMAndDecaysTool = DerivationFramework__TruthDecayCollectionMaker( name="DFCommonBSMAndDecaysTool", + NewCollectionName="TruthBSMWithDecay", + KeepBSM=True, + Generations=generations) + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonBSMAndDecaysTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonBSMAndDecaysKernel", + AugmentationTools = [DFCommonBSMAndDecaysTool] ) + +# Add a mini-collection for the born leptons +def addBornLeptonCollection(kernel=None): + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MCTruthCommonBornLeptonsKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate MCTruthCommonBornLeptonsKernel. Failing.") + return + # Set up a tool to keep the taus and all downstream particles + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthBornLeptonCollectionMaker + DFCommonBornLeptonCollTool = DerivationFramework__TruthBornLeptonCollectionMaker( name="DFCommonBornLeptonCollTool", + NewCollectionName="BornLeptons") + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += DFCommonBornLeptonCollTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + kernel += CfgMgr.DerivationFramework__CommonAugmentation("MCTruthCommonBornLeptonsKernel", + AugmentationTools = [DFCommonBornLeptonCollTool] ) + +def addLargeRJetD2(kernel=None): + #Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'TRUTHD2Kernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate TRUTHD2Kernel. Failing.") + return + + #Extra classifier for D2 variable + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthD2Decorator + TruthD2Decorator= DerivationFramework__TruthD2Decorator("TruthD2Decorator", + JetContainerKey = "AntiKt10TruthTrimmedPtFrac5SmallR20Jets", + DecorationName = "D2") + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += TruthD2Decorator + kernel +=CfgMgr.DerivationFramework__DerivationKernel("TRUTHD2Kernel", + AugmentationTools = [TruthD2Decorator] ) + + +def addTruthEnergyDensity(kernel=None): + #Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'DFCommonTruthEDKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate DFCommonTruthEDKernel. Failing.") + return + # Truth energy density tools + from EventShapeTools.EventDensityConfig import configEventDensityTool,EventDensityAthAlg + from AthenaCommon.AppMgr import ToolSvc + from JetRec.JetRecStandard import jtm + # Algorithms for the energy density - needed only if e/gamma hasn't set things up already + if not hasattr(ToolSvc,'EDTruthCentralTool'): + DFCommonTruthCentralEDTool = configEventDensityTool("DFCommonTruthCentralEDTool", jtm.truthget, + 0.5, + AbsRapidityMax = 1.5, + OutputContainer = "TruthIsoCentralEventShape", + ) + ToolSvc += DFCommonTruthCentralEDTool + kernel += EventDensityAthAlg("DFCommonTruthCentralEDAlg", EventDensityTool = DFCommonTruthCentralEDTool ) + if not hasattr(ToolSvc,'EDTruthForwardTool'): + DFCommonTruthForwardEDTool = configEventDensityTool("DFCommonTruthForwardEDTool", jtm.truthget, + 0.5, + AbsRapidityMin = 1.5, + AbsRapidityMax = 3.0, + OutputContainer = "TruthIsoForwardEventShape", + ) + ToolSvc += DFCommonTruthForwardEDTool + kernel += EventDensityAthAlg("DFCommonTruthForwardEDAlg", EventDensityTool = DFCommonTruthForwardEDTool ) + + # Now add the tool to do the decoration + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthEDDecorator + DFCommonTruthEDDecorator = DerivationFramework__TruthEDDecorator("DFCommonTruthEDDecorator", + EventInfoName="EventInfo", + EnergyDensityKeys=["TruthIsoCentralEventShape","TruthIsoForwardEventShape"], + DecorationSuffix="_rho" + ) + ToolSvc += DFCommonTruthEDDecorator + kernel +=CfgMgr.DerivationFramework__DerivationKernel("DFCommonTruthEDKernel", + AugmentationTools = [DFCommonTruthEDDecorator] ) + + + +def addMiniTruthCollectionLinks(kernel=None, doElectrons=True, doPhotons=True, doMuons=True): + # Sets up modifiers to move pointers to old truth collections to new mini truth collections + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'MiniCollectionTruthLinkKernel'): + # Already there! Carry on... + dfcommontruthlog.warning("Attempt to add a duplicate MiniCollectionTruthLinkKernel. Failing.") + return + # Truth link setup for electrons, photons, and muons + from AthenaCommon.AppMgr import ToolSvc + aug_tools = [] + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthLinkRepointTool + if doElectrons: + electron_relink = DerivationFramework__TruthLinkRepointTool("ElMiniCollectionTruthLinkTool", + RecoCollection="Electrons", TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]) + ToolSvc += electron_relink + aug_tools += [ electron_relink ] + if doPhotons: + photon_relink = DerivationFramework__TruthLinkRepointTool("PhMiniCollectionTruthLinkTool", + RecoCollection="Photons", TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]) + ToolSvc += photon_relink + aug_tools += [ photon_relink ] + if doMuons: + muon_relink = DerivationFramework__TruthLinkRepointTool("MuMiniCollectionTruthLinkTool", + RecoCollection="Muons", TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]) + ToolSvc += muon_relink + aug_tools += [ muon_relink ] + kernel +=CfgMgr.DerivationFramework__DerivationKernel("MiniCollectionTruthLinkKernel", + AugmentationTools = aug_tools ) + + +def addTruth3ContentToSlimmerTool(slimmer): + slimmer.AllVariables += [ + "MET_Truth", + "TruthElectrons", + "TruthMuons", + "TruthPhotons", + "TruthTaus", + "TruthNeutrinos", + "TruthBSM", + "TruthBottom", + "TruthTop", + "TruthBoson", + "TruthForwardProtons", + "BornLeptons", + "TruthBosonsWithDecayParticles", + "TruthBosonsWithDecayVertices", + "TruthBSMWithDecayParticles", + "TruthBSMWithDecayVertices", + "HardScatterParticles", + "HardScatterVertices", + ] + slimmer.ExtraVariables += [ + "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.ConeTruthLabelID.PartonTruthLabelID.TrueFlavor", + "AntiKt10TruthTrimmedPtFrac5SmallR20Jets.pt.Tau1_wta.Tau2_wta.Tau3_wta.D2", + "TruthEvents.Q.XF1.XF2.PDGID1.PDGID2.PDFID1.PDFID2.X1.X2.crossSection"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py index 06bab2d273a97c6a06cc03c1bfd317e36dea572a..e1d8205d77b2b8b52d8fae04274c4370b3a6c621 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py @@ -1,71 +1,101 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AppMgr import ToolSvc -# Set up the MCTruthClassifier from DerivationFrameworkCore.DerivationFrameworkMaster import * from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier DFCommonTruthClassifier = MCTruthClassifier(name = "DFCommonTruthClassifier", - ParticleCaloExtensionTool="") + ParticleCaloExtensionTool = "") ToolSvc += DFCommonTruthClassifier #============================================================================== # Schedule the tools for adding new truth collection +# Note that taus are handled separately (see MCTruthCommon.py) +# Note also that navigation info is dropped here and added separately #============================================================================== from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMaker -#from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau -DFCommonTruthMuonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthMuonTool", +DFCommonTruthMuonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthMuonTool", NewCollectionName = "TruthMuons", + KeepNavigationInfo = False, ParticleSelectionString = "(abs(TruthParticles.pdgId) == 13) && (TruthParticles.status == 1) && TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset)) ToolSvc += DFCommonTruthMuonTool -DFCommonTruthElectronTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthElectronTool", +DFCommonTruthElectronTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthElectronTool", NewCollectionName = "TruthElectrons", + KeepNavigationInfo = False, ParticleSelectionString = "(abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset)) ToolSvc += DFCommonTruthElectronTool -DFCommonTruthPhotonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthPhotonTool", +DFCommonTruthPhotonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthPhotonTool", NewCollectionName = "TruthPhotons", + KeepNavigationInfo = False, ParticleSelectionString = "(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset)) ToolSvc += DFCommonTruthPhotonTool -# this tool is needed for making TruthPhotons from sim samples, where extra cuts are needed -DFCommonTruthPhotonToolSim = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthPhotonToolSim", +# this tool is needed for making TruthPhotons from sim samples, where extra cuts are needed. Origin 42 (pi0) and 23 (light meson) cut way down uninteresting photons +DFCommonTruthPhotonToolSim = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthPhotonToolSim", NewCollectionName = "TruthPhotons", - ParticleSelectionString = "(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && ((TruthParticles.classifierParticleOrigin != 42) || (TruthParticles.pt > 20.0*GeV)) && ( TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset)+")") + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && ((TruthParticles.classifierParticleOrigin != 42 && TruthParticles.classifierParticleOrigin !=23) || (TruthParticles.pt > 20.0*GeV)) && ( TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset)+")") ToolSvc += DFCommonTruthPhotonToolSim - -# Tau truth handled in TauCommon -#DFCommonTruthTauTool = DerivationFramework__TruthCollectionMakerTau(name = "DFCommonTruthTauTool", -# NewCollectionName = "TruthTaus", -# MCTruthClassifier = DFCommonTruthClassifier) -#ToolSvc += DFCommonTruthTauTool - -neutrinoexpression = "((abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14 || abs(TruthParticles.pdgId) == 16) && (TruthParticles.status == 1)) && TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset) +neutrinoexpression = "(TruthParticles.isNeutrino && TruthParticles.status == 1) && TruthParticles.barcode < "+str(DerivationFrameworkSimBarcodeOffset) DFCommonTruthNeutrinoTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthNeutrinoTool", - NewCollectionName = "TruthNeutrinos", - ParticleSelectionString = neutrinoexpression) + NewCollectionName = "TruthNeutrinos", + KeepNavigationInfo = False, + ParticleSelectionString = neutrinoexpression) ToolSvc += DFCommonTruthNeutrinoTool -TRUTH3TopTool = DerivationFramework__TruthCollectionMaker(name = "TRUTH3TopTool", - NewCollectionName = "TruthTop", - ParticleSelectionString = "(abs(TruthParticles.pdgId) == 6)", - Do_Compress = True, - ) -ToolSvc += TRUTH3TopTool - -TRUTH3BosonTool = DerivationFramework__TruthCollectionMaker(name = "TRUTH3BosonTool", - NewCollectionName = "TruthBoson", - ParticleSelectionString = "(abs(TruthParticles.pdgId) == 23 || abs(TruthParticles.pdgId) == 24 || abs(TruthParticles.pdgId) == 25)", - Do_Compress = True, - Do_Sherpa= True) -ToolSvc += TRUTH3BosonTool - -TRUTH3BSMTool = DerivationFramework__TruthCollectionMaker(name = "TRUTH3BSMTool", - NewCollectionName = "TruthBSM", - ParticleSelectionString = "( (31<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<38) || abs(TruthParticles.pdgId)==39 || abs(TruthParticles.pdgId)==41 || abs(TruthParticles.pdgId)==42 || abs(TruthParticles.pdgId)== 7 || abs(TruthParticles.pdgId)== 8 || (1000000<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<1000040) || (2000000<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<2000040) )", - Do_Compress = True) -ToolSvc += TRUTH3BSMTool +DFCommonTruthBottomTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthBottomTool", + NewCollectionName = "TruthBottom", + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 5)", + Do_Compress = True) +ToolSvc += DFCommonTruthBottomTool + +DFCommonTruthTopTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthTopTool", + NewCollectionName = "TruthTop", + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 6)", + Do_Compress = True) +ToolSvc += DFCommonTruthTopTool + +DFCommonTruthBosonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthBosonTool", + NewCollectionName = "TruthBoson", + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 23 || abs(TruthParticles.pdgId) == 24 || abs(TruthParticles.pdgId) == 25)", + Do_Compress = True, + Do_Sherpa = True) +ToolSvc += DFCommonTruthBosonTool + +DFCommonTruthBSMTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthBSMTool", + NewCollectionName = "TruthBSM", + KeepNavigationInfo = False, + ParticleSelectionString = "(TruthParticles.isBSM)", + Do_Compress = True) +ToolSvc += DFCommonTruthBSMTool + +# Set up a tool to keep forward protons for AFP +# Note that we have inputFileSummary coming from derivation framework master +if 'beam_energy' in inputFileSummary: + beam_energy = inputFileSummary['beam_energy'] +elif '/TagInfo' in inputFileSummary and 'beam_energy' in inputFileSummary['/TagInfo']: + beam_energy = inputFileSummary['/TagInfo']['beam_energy'] +elif 'metadata_itemsList' in inputFileSummary and 'tag_info' in inputFileSummary['metadata_itemsList'] and 'beam_energy' in inputFileSummary['metadata_itemsList']['tag_info']: + beam_energy = inputFileSummary['metadata_itemsList']['tag_info']['beam_energy'] +else: + from AthenaCommon import Logging + dfcommontruthlog = Logging.logging.getLogger('DFCommonTruth') + dfcommontruthlog.warninng('Could not find beam energy in input file. Using default of 6.5 TeV') + beam_energy = 6500000.0 # Sensible defaults +# Weird formats in some metadata +if type(beam_energy) is list: beam_energy = beam_energy[0] + +DFCommonTruthForwardProtonTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthForwardProtonTool", + NewCollectionName = "TruthForwardProtons", + KeepNavigationInfo = False, + ParticleSelectionString = "(TruthParticles.status==1) && (abs(TruthParticles.pdgId)==2212) && (TruthParticles.e>0.8*"+str(beam_energy)+")", + Do_Compress = True) +ToolSvc += DFCommonTruthForwardProtonTool #============================================================================== # Decoration tools @@ -82,18 +112,25 @@ ToolSvc += DFCommonTruthClassificationTool from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthDressingTool DFCommonTruthElectronDressingTool = DerivationFramework__TruthDressingTool(name = "DFCommonTruthElectronDressingTool", dressParticlesKey = "TruthElectrons", - usePhotonsFromHadrons = False, + usePhotonsFromHadrons = False, dressingConeSize = 0.1, particleIDsToDress = [11] ) ToolSvc += DFCommonTruthElectronDressingTool DFCommonTruthMuonDressingTool = DerivationFramework__TruthDressingTool(name = "DFCommonTruthMuonDressingTool", dressParticlesKey = "TruthMuons", - usePhotonsFromHadrons = False, + usePhotonsFromHadrons = False, dressingConeSize = 0.1, particleIDsToDress = [13] ) ToolSvc += DFCommonTruthMuonDressingTool +DFCommonTruthTauDressingTool = DerivationFramework__TruthDressingTool(name = "DFCommonTruthTauDressingTool", + dressParticlesKey = "TruthTaus", + usePhotonsFromHadrons = False, + dressingConeSize = 0.2, # Tau special + particleIDsToDress = [15] + ) +ToolSvc += DFCommonTruthTauDressingTool from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthIsolationTool DFCommonTruthElectronIsolationTool1 = DerivationFramework__TruthIsolationTool(name = "DFCommonTruthElectronIsolationTool1", @@ -145,9 +182,22 @@ DFCommonTruthPhotonIsolationTool2 = DerivationFramework__TruthIsolationTool(name isoParticlesKey = "TruthPhotons", allParticlesKey = "TruthParticles", particleIDsToCalculate = [22], - IsolationConeSizes = [0.3], + IsolationConeSizes = [0.2], IsolationVarNamePrefix = 'ptcone', ChargedParticlesOnly = True ) ToolSvc += DFCommonTruthPhotonIsolationTool2 - +DFCommonTruthPhotonIsolationTool3 = DerivationFramework__TruthIsolationTool(name = "DFCommonTruthPhotonIsolationTool3", + isoParticlesKey = "TruthPhotons", + allParticlesKey = "TruthParticles", + particleIDsToCalculate = [22], + IsolationConeSizes = [0.4], + IsolationVarNamePrefix = 'etcone', + ChargedParticlesOnly = False + ) +ToolSvc += DFCommonTruthPhotonIsolationTool3 +# Quark/gluon decoration for jets +#from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthQGDecorationTool +#DFCommonTruthQGLabelTool = DerivationFramework__TruthQGDecorationTool(name="DFCommonTruthQGLabelTool", +# JetCollection = "AntiKt4TruthWZJets") +#ToolSvc += DFCommonTruthQGLabelTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9c11f028fbd51ff358752215e0d23a480804f024 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.cxx @@ -0,0 +1,115 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// CollectionMakerHelpers.cxx +// Helper functions used in a couple of collection makers to add +// particles and vertices to light collections + +#include "CollectionMakerHelpers.h" +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "xAODTruth/TruthVertexAuxContainer.h" + +// STL includes +#include <vector> +// For a find in the vector +#include <algorithm> + +int DerivationFramework::CollectionMakerHelpers::addTruthVertex( const xAOD::TruthVertex& oldVert, xAOD::TruthParticleContainer* partCont, + xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles, + const int generations) { + // Make a new vertex and add it to the container + xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex(); + vertCont->push_back( xTruthVertex ); + // Get a link to this vertex -- will be used to set production vertices on all the next particles + int myIndex = vertCont->size()-1; + ElementLink<xAOD::TruthVertexContainer> eltv(*vertCont, myIndex); + // Set properties + xTruthVertex->setId(oldVert.id()); + xTruthVertex->setBarcode(oldVert.barcode()); + xTruthVertex->setX(oldVert.x()); + xTruthVertex->setY(oldVert.y()); + xTruthVertex->setZ(oldVert.z()); + xTruthVertex->setT(oldVert.t()); + // If we are done, then stop here + if (generations==0) return myIndex; + // Add all the outgoing particles + for (size_t n=0;n<oldVert.nOutgoingParticles();++n){ + if (!oldVert.outgoingParticle(n)) continue; // Just in case we removed some truth particles, e.g. G4 decays + int partIndex = CollectionMakerHelpers::addTruthParticle( *oldVert.outgoingParticle(n), partCont, vertCont, seenParticles, generations-1); + ElementLink<xAOD::TruthParticleContainer> eltp( *partCont, partIndex); + xTruthVertex->addOutgoingParticleLink( eltp ); + (*partCont)[partIndex]->setProdVtxLink( eltv ); + } + // Return a link to this vertex + return myIndex; +} + +int DerivationFramework::CollectionMakerHelpers::addTruthParticle( const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont, + xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles, + const int generations, bool includeVertex) { + // See if we've seen it - note, could also do this with a unary function on the container itself + if (std::find(seenParticles.begin(),seenParticles.end(),oldPart.barcode())!=seenParticles.end()){ + for (size_t p=0;p<partCont->size();++p){ + // Was it a hit? + if ((*partCont)[p]->barcode()==oldPart.barcode()) return p; + } // Look through the old container + } // Found it in the old container + // Now we have seen it + seenParticles.push_back(oldPart.barcode()); + // Make a nw truth particle + xAOD::TruthParticle* xTruthParticle = setupTruthParticle(oldPart,partCont); + // Make a link to this particle + int myIndex = partCont->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*partCont, myIndex); + // Decay vertex information + if (oldPart.hasDecayVtx() && includeVertex) { + int vertIndex = CollectionMakerHelpers::addTruthVertex( *oldPart.decayVtx(), partCont, vertCont, seenParticles, generations); + ElementLink<xAOD::TruthVertexContainer> eltv( *vertCont, vertIndex ); + xTruthParticle->setDecayVtxLink( eltv ); + (*vertCont)[vertIndex]->addIncomingParticleLink( eltp ); + } + // Return a link to this particle + return myIndex; +} + +xAOD::TruthParticle* DerivationFramework::CollectionMakerHelpers::setupTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont){ + // Set up decorators + const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin"); + const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType"); + const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome"); + const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID"); + const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID"); + // Make a truth particle and add it to the container + xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); + partCont->push_back( xTruthParticle ); + // Fill with numerical content + xTruthParticle->setPdgId(oldPart.pdgId()); + xTruthParticle->setBarcode(oldPart.barcode()); + xTruthParticle->setStatus(oldPart.status()); + xTruthParticle->setM(oldPart.m()); + xTruthParticle->setPx(oldPart.px()); + xTruthParticle->setPy(oldPart.py()); + xTruthParticle->setPz(oldPart.pz()); + xTruthParticle->setE(oldPart.e()); + // Copy over the polarization information if it's there + if (oldPart.polarization().valid()){ + xTruthParticle->setPolarizationParameter( oldPart.polarizationParameter( xAOD::TruthParticle::polarizationPhi ) , xAOD::TruthParticle::polarizationPhi ); + xTruthParticle->setPolarizationParameter( oldPart.polarizationParameter( xAOD::TruthParticle::polarizationTheta ) , xAOD::TruthParticle::polarizationTheta ); + } + // Copy over the decorations if they are available + if (oldPart.isAvailable<unsigned int>("classifierParticleType")) { + typeDecorator(*xTruthParticle) = oldPart.auxdata< unsigned int >( "classifierParticleType" ); + } else {typeDecorator(*xTruthParticle) = 0;} + if (oldPart.isAvailable<unsigned int>("classifierParticleOrigin")) { + originDecorator(*xTruthParticle) = oldPart.auxdata< unsigned int >( "classifierParticleOrigin" ); + } else {originDecorator(*xTruthParticle) = 0;} + if (oldPart.isAvailable<unsigned int>("classifierParticleOutCome")) { + outcomeDecorator(*xTruthParticle) = oldPart.auxdata< unsigned int >( "classifierParticleOutCome" ); + } else {outcomeDecorator(*xTruthParticle) = 0;} + return xTruthParticle; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..3c159b1153c88f312df0304e6de6ae01301d98e3 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CollectionMakerHelpers.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// CollectionMakerHelpers.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_COLLECTIONMAKERHELPERS_H +#define DERIVATIONFRAMEWORK_COLLECTIONMAKERHELPERS_H + +// Just a couple of EDM includes +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +// Standard library includes +#include <vector> + +namespace DerivationFramework { + + class CollectionMakerHelpers { + + public: + //!< Helper function to add truth particles to a collection + static int addTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont, + xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles, + const int generations, bool includeVertex=true); + //!< Helper function to add truth vertices to a collection + static int addTruthVertex( const xAOD::TruthVertex& oldVert, xAOD::TruthParticleContainer* partCont, + xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles, + const int generations); + //!< Helper function to set up a truth particle based on an old particle + static xAOD::TruthParticle* setupTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont); + }; +} + +#endif // DERIVATIONFRAMEWORK_COLLECTIONMAKERHELPERS_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx index 2cfcd3dc035fe08cc4958ff46fdff4a2d083400e..9590503b34fe025190eeb67716ac35048c1196e6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/CompactHardTruth.cxx @@ -184,7 +184,7 @@ StatusCode CompactHardTruth::execute() { // Signal event is first (only?) event; front() is from DataVector const HepMC::GenEvent* mcEvt = mcEvts->front(); - HepMC::WeightContainer wtCont = mcEvt->weights(); + auto wtCont = mcEvt->weights(); //double wt = 1; if( wtCont.size() != 0 ){ //wt = wtCont[0]; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginClassifier.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginClassifier.cxx index ca114630b468c17e53bb7ffcaaa3c76b5303dc0c..4779a446f2db21f77819c8f33d3d32c91fd09f35 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginClassifier.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginClassifier.cxx @@ -1,158 +1,188 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ - #include "DerivationFrameworkMCTruth/HadronOriginClassifier.h" namespace DerivationFramework{ - - - HadronOriginClassifier::HadronOriginClassifier(const std::string& t, const std::string& n, const IInterface* p): + HadronOriginClassifier::HadronOriginClassifier(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t,n,p), m_mcName("TruthEvents"), m_HadronPtMinCut(0), m_HadronEtaMaxCut(0), m_DSID(0) { - declareInterface<DerivationFramework::HadronOriginClassifier>(this); - declareProperty("MCCollectionName",m_mcName="TruthEvents"); + declareProperty("MCCollectionName",m_mcName="TruthEvents"); declareProperty("HadronpTMinCut",m_HadronPtMinCut=5000.); /// MeV declareProperty("HadronetaMaxCut",m_HadronEtaMaxCut=2.5); declareProperty("DSID",m_DSID=410000); - - } - - //-------------------------------------------------------------------------- HadronOriginClassifier::~HadronOriginClassifier(){ ///// } - + //--------------------------------------------------------------------------- StatusCode HadronOriginClassifier::initialize() { ATH_MSG_INFO("Initialize " ); - if(m_DSID==410003 || m_DSID == 410004 || m_DSID == 410008 || m_DSID == 410232 || m_DSID == 410233){ + // all Herwig++/Herwig7 showered samples + if( m_DSID==410003 || m_DSID == 410008 //aMC@NLO+Hpp + || m_DSID == 410004 || m_DSID == 410163 //Powheg+Hpp + || m_DSID == 410232 //first attempt for Powheg+H7 + || m_DSID == 410233 //first attempt for aMC@NLO+H7 + || (m_DSID>=410525 && m_DSID<=410530) //New Powheg+H7 samples + || (m_DSID>=407037 && m_DSID<=407040) //Powheg+Hpp MET/HT sliced + || m_DSID ==410536 || m_DSID == 410537 + || m_DSID == 410245 //aMC@NLO+H++ , ttbb + || (m_DSID>=410557 && m_DSID<=410559) // new Powheg+H7, mc16 + || (m_DSID>=411082 && m_DSID<=411090) //Powheg+H7 HF-filtered + || (m_DSID>=407354 && m_DSID<=407356) //Powheg+H7 ttbar HT-filtered + || m_DSID ==411233 || m_DSID == 411234 //Powheg+H7.1.3 ttbar + || (m_DSID>=411329 && m_DSID<=411334) //Powheg+H7.1.3 ttbar HF-filtered + || (m_DSID>=411335 && m_DSID<=411337) //Powheg+H7.1.3 ttbar HT-filtered + || m_DSID ==412116 || m_DSID == 412117 //amc@NLO+H7.1.3 ttbar + ){ m_GenUsed=HerwigPP; + if (m_DSID==410245){ + m_ttbb=true; + } } - else if(m_DSID==410006 || m_DSID==410500 || m_DSID==410159 || m_DSID==410160){ + // all Pythia8 showered samples + else if( m_DSID==410006 //Powheg+P8 old main31 + || m_DSID==410500 //Powheg+P8 new main31, hdamp=mt + || (m_DSID>=410501 && m_DSID<=410508) //Powheg+P8 new main31, hdamp=1.5m // Boosted samples are included 410507 410508 + || (m_DSID>=410511 && m_DSID<=410524) //Powheg+P8 new main31, hdamp=1.5mt, radiation systematics + || (m_DSID>=410531 && m_DSID<=410535) //Powheg+P8 allhad samples + || m_DSID==410159 || m_DSID==410160 //aMC@NLO+P8, old settings + || (m_DSID>=410225 && m_DSID<=410227) || m_DSID==410274 || m_DSID==410275 //aMC@NLO+P8, new settings + || m_DSID==410568 || m_DSID==410569 // nonallhad boosted c-filtered + || m_DSID==410244 //aMC@NLO+P8, ttbb (old) + || m_DSID==410441 || m_DSID==410442 //new aMC@NLO+P8 mc16, new shower starting scale + || (m_DSID>=410464 && m_DSID<=410466) //new aMC@NLO+P8 mc16, new shower starting scale, no shower weights + || (m_DSID>=410470 && m_DSID<=410472) || (m_DSID>=410480 && m_DSID<=410482) //new Powheg+P8 mc16 + || m_DSID==410452 //new aMC@NLO+P8 FxFx mc16 + || (m_DSID>=411073 && m_DSID<=411081) //Powheg+P8 HF-filtered + || (m_DSID>=412066 && m_DSID<=412074) //aMC@NLO+P8 HF-filtered + || (m_DSID>=411068 && m_DSID<=411070) //Powheg+P8 ttbb + || (m_DSID>=410265 && m_DSID<=410267) //aMC@NLO+P8 ttbb + || (m_DSID>=411178 && m_DSID<=411180) || (m_DSID==411275) //Powheg+P8 ttbb OTF production - ATLMCPROD-7240 + || (m_DSID>=407342 && m_DSID<=407344) //Powheg+P8 ttbar HT-filtered + || (m_DSID>=407348 && m_DSID<=407350) //aMC@NLO+P8 ttbar HT-filtered + ){ m_GenUsed=Pythia8; + if ( m_DSID==410244 //aMC@NLO+P8, ttbb (old) + || (m_DSID>=411068 && m_DSID<=411070) //Powheg+P8 ttbb + || (m_DSID>=410265 && m_DSID<=410267) //aMC@NLO+P8 ttbb + || (m_DSID>=411178 && m_DSID<=411180) || (m_DSID==411275) //Powheg+P8 ttbb OTF production - ATLMCPROD-7240 + ){ + m_ttbb=true; + } } - else if(m_DSID==410186 || m_DSID==410187 || m_DSID==410188 || m_DSID==410189 || m_DSID==410051){ + // all Sherpa showered samples + else if( (m_DSID>=410186 && m_DSID<=410189) //Sherpa 2.2.0 + || (m_DSID>=410249 && m_DSID<=410252) //Sherpa 2.2.1 + || (m_DSID>=410342 && m_DSID<=410347) //Sherpa 2.2.1 sys + || (m_DSID>=410350 && m_DSID<=410355) //Sherpa 2.2.1 sys + || (m_DSID>=410357 && m_DSID<=410359) //Sherpa 2.2.1 sys + || (m_DSID>=410361 && m_DSID<=410367) //Sherpa 2.2.1 sys + || (m_DSID>=410281 && m_DSID<=410283) //Sherpa BFilter + || m_DSID==410051 //Sherpa ttbb (ICHEP sample) + || (m_DSID>=410323 && m_DSID<=410325) || (m_DSID==410369) //New Sherpa 2.2.1 ttbb + || (m_DSID>=364345 && m_DSID<=364348) //Sherpa 2.2.4 (test) + || (m_DSID>=410424 && m_DSID<=410427) //Sherpa 2.2.4 + || (m_DSID>=410661 && m_DSID<=410664) //Sherpa 2.2.4 ttbb + || (m_DSID>=421152 && m_DSID<=421158) //Sherpa2.2.8 ttbar + || (m_DSID>=700051 && m_DSID<=700054) //Sherpa2.2.8 ttbb + ){ m_GenUsed=Sherpa; - - if(m_DSID==410051){ - m_ttbb=true; + if( m_DSID==410051 + || (m_DSID>=410323 && m_DSID<=410325) || (m_DSID==410369) + || (m_DSID>=410661 && m_DSID<=410664) + || (m_DSID>=700051 && m_DSID<=700054) + ){ + m_ttbb=true; } - } + // the default is Pythia6, so no need to list the Pythia6 showered samples else{ m_GenUsed=Pythia6; } - + return StatusCode::SUCCESS; } - + //--------------------------------------------------------------------------- StatusCode HadronOriginClassifier::finalize() { return StatusCode::SUCCESS; } - - - + //--------------------------------------------------------------------------- std::map<const xAOD::TruthParticle*, DerivationFramework::HadronOriginClassifier::HF_id> HadronOriginClassifier::GetOriginMap(){ - - - - - initMaps(); - + //--- map partons to hadrons std::vector<const xAOD::TruthParticle*> matched_partons; - std::vector<const xAOD::TruthParticle*> matched_hadrons; + std::vector<const xAOD::TruthParticle*> matched_hadrons; matched_partons.clear(); matched_hadrons.clear(); while (matched_partons.size()<m_partonsOrigin.size() && matched_hadrons.size()<m_mainHadronMap.size()){ - - float dR=999.; const xAOD::TruthParticle* hadron=0; const xAOD::TruthParticle* parton=0; for(std::map<const xAOD::TruthParticle*, HF_id>::iterator itr = m_partonsOrigin.begin(); itr!=m_partonsOrigin.end(); itr++){ + if(std::find(matched_partons.begin(), matched_partons.end(), (*itr).first) != matched_partons.end()) continue; + + TVector3 v, vtmp; + if ((*itr).first->pt()>0.) + v.SetPtEtaPhi((*itr).first->pt(),(*itr).first->eta(),(*itr).first->phi()); + else // Protection against FPE from eta and phi calculation + v.SetXYZ(0.,0.,(*itr).first->pz()); + + for(std::map<const xAOD::TruthParticle*, int>::iterator it = m_mainHadronMap.begin(); it!=m_mainHadronMap.end(); it++){ - if(std::find(matched_partons.begin(), matched_partons.end(), (*itr).first) != matched_partons.end()) continue; + if(std::find(matched_hadrons.begin(), matched_hadrons.end(), (*it).first) != matched_hadrons.end()) continue; - TVector3 v, vtmp; - v.SetPtEtaPhi((*itr).first->pt(),(*itr).first->eta(),(*itr).first->phi()); - - - for(std::map<const xAOD::TruthParticle*, int>::iterator it = m_mainHadronMap.begin(); it!=m_mainHadronMap.end(); it++){ + if((*it).second != abs((*itr).first->pdgId()) ) continue; + vtmp.SetPtEtaPhi((*it).first->pt(),(*it).first->eta(),(*it).first->phi()); - if(std::find(matched_hadrons.begin(), matched_hadrons.end(), (*it).first) != matched_hadrons.end()) continue; + if(vtmp.DeltaR(v) < dR){ + dR = vtmp.DeltaR(v); + hadron = (*it).first; + parton = (*itr).first; + } - - if((*it).second != abs((*itr).first->pdgId()) ) continue; - vtmp.SetPtEtaPhi((*it).first->pt(),(*it).first->eta(),(*it).first->phi()); - - if(vtmp.DeltaR(v) < dR){ - dR = vtmp.DeltaR(v); - hadron = (*it).first; - parton = (*itr).first; - } - + }//loop hadrons - }//loop hadrons - }//loop partons - - + matched_partons.push_back(parton); matched_hadrons.push_back(hadron); - - m_hadronsPartons[ hadron ] = parton; + m_hadronsPartons[ hadron ] = parton; } - - for(std::map<const xAOD::TruthParticle*, int>::iterator it = m_mainHadronMap.begin(); it!=m_mainHadronMap.end(); it++){ - const xAOD::TruthParticle* hadron = (*it).first; - - if(m_hadronsPartons.find(hadron)!=m_hadronsPartons.end()){ - - m_hadronsOrigin[hadron] = m_partonsOrigin[ m_hadronsPartons[hadron] ]; - - } - - else{ - m_hadronsOrigin[hadron] = extrajet; - - } - + if(m_hadronsPartons.find(hadron)!=m_hadronsPartons.end()){ + m_hadronsOrigin[hadron] = m_partonsOrigin[ m_hadronsPartons[hadron] ]; + } else{ + m_hadronsOrigin[hadron] = extrajet; + } } - return m_hadronsOrigin; - - - } + //--------------------------------------------------------------------------- void HadronOriginClassifier::initMaps(){ - - m_partonsOrigin.clear(); m_hadronsOrigin.clear(); @@ -162,475 +192,452 @@ namespace DerivationFramework{ m_hadronsPartons.clear(); buildPartonsHadronsMaps(); - } - + //--------------------------------------------------------------------------- void HadronOriginClassifier::buildPartonsHadronsMaps(){ - - + const xAOD::TruthEventContainer* xTruthEventContainer = 0; if (evtStore()->retrieve(xTruthEventContainer,m_mcName).isFailure()) { ATH_MSG_WARNING("could not retrieve TruthEventContainer " <<m_mcName); - } - + for ( const auto* truthevent : *xTruthEventContainer ) { - + for(unsigned int i = 0; i < truthevent->nTruthParticles(); i++){ - - const xAOD::TruthParticle* part = truthevent->truthParticle(i); - - if(part->barcode() >= 200000) break; - - - bool isbquark=false; - bool iscquark=false; - bool isHFhadron=false; - - int pdgid = abs(part->pdgId()); - - //// don't loose time checking all if one found - if(pdgid == 5 ){ - isbquark=true; - } - else if(pdgid == 4 ){ - iscquark=true; - } - else if(isBHadron(part) || isCHadron(part)){ - isHFhadron=true; - } - else{ - continue; - } - - - if(isbquark){ - bool islooping = isLooping(part); - if(isDirectlyFromWTop(part, islooping)){ - m_partonsOrigin[ part ] = b_from_W; - } - else if(isDirectlyFromTop(part, islooping)){ - m_partonsOrigin[ part ] = b_from_top; - } - else if(!IsTtBb()&&(IsHerwigPP()||IsSherpa())&&isDirectlyFSR(part,islooping)){ - m_partonsOrigin[ part ] = b_FSR; - } - else if(!IsTtBb()&&IsPythia8()&&isDirectlyFSRPythia8(part,islooping)){ - m_partonsOrigin[ part ] = b_FSR; - } - else if(!IsTtBb()&&IsPythia6()&&isDirectlyFSRPythia6(part,islooping)){ - m_partonsOrigin[ part ] = b_FSR; - } - else if(!IsTtBb()&&IsPythia6()&&isDirectlyMPIPythia6(part, islooping)){ - m_partonsOrigin[ part ] = b_MPI; - } - else if(!IsTtBb()&&IsPythia8()&&isDirectlyMPIPythia8(part, islooping)){ - m_partonsOrigin[ part ] = b_MPI; - } - else if(!IsTtBb()&&IsSherpa()&&isDirectlyMPISherpa(part)){ - m_partonsOrigin[ part ] = b_MPI; - } - - - - - } - if(iscquark){ - bool islooping = isLooping(part); - - if(isDirectlyFromWTop(part, islooping)){ - m_partonsOrigin[ part ] = c_from_W; - } - else if(isDirectlyFromTop(part, islooping)){ - m_partonsOrigin[ part ] = c_from_top; - } - else if(!IsTtBb()&&(IsHerwigPP()&&IsSherpa())&&isDirectlyFSR(part,islooping)){ - m_partonsOrigin[ part ] = c_FSR; - } - else if(!IsTtBb()&&IsPythia8()&&isDirectlyFSRPythia8(part,islooping)){ - m_partonsOrigin[ part ] = c_FSR; - } - else if(!IsTtBb()&&IsPythia6()&&isDirectlyFSRPythia6(part,islooping)){ - m_partonsOrigin[ part ] = c_FSR; - } - - else if(!IsTtBb()&&IsPythia6()&&isDirectlyMPIPythia6(part, islooping)){ - m_partonsOrigin[ part ] = c_MPI; - } - else if(!IsTtBb()&&IsPythia8()&&isDirectlyMPIPythia8(part, islooping)){ - m_partonsOrigin[ part ] = c_MPI; - } - else if(!IsTtBb()&&IsSherpa()&&isDirectlyMPISherpa(part)){ - m_partonsOrigin[ part ] = c_MPI; - } - - - - } - - - - - if(isHFhadron){ - if(!isCHadronFromB(part)){ - if(m_usedHadron.count(part)) continue; - - fillHadronMap(part,part); - } - } - - - - + + const xAOD::TruthParticle* part = truthevent->truthParticle(i); + if(!part) continue; + if(part->barcode() >= 200000) break; + + bool isbquark=false; + bool iscquark=false; + bool isHFhadron=false; + + int pdgid = abs(part->pdgId()); + + //// don't loose time checking all if one found + if(pdgid == 5 ){ + isbquark=true; + } + else if(pdgid == 4 ){ + iscquark=true; + } + else if(isBHadron(part) || isCHadron(part)){ + isHFhadron=true; + } + else{ + continue; + } + + + if(isbquark){ + bool islooping = isLooping(part); + if(isDirectlyFromWTop(part, islooping)){ + m_partonsOrigin[ part ] = b_from_W; + } + else if(isDirectlyFromTop(part, islooping)){ + m_partonsOrigin[ part ] = b_from_top; + } + else if(!IsTtBb()&&(IsHerwigPP()||IsSherpa())&&isDirectlyFSR(part,islooping)){ + m_partonsOrigin[ part ] = b_FSR; + } + else if(!IsTtBb()&&IsPythia8()&&isDirectlyFSRPythia8(part,islooping)){ + m_partonsOrigin[ part ] = b_FSR; + } + else if(!IsTtBb()&&IsPythia6()&&isDirectlyFSRPythia6(part,islooping)){ + m_partonsOrigin[ part ] = b_FSR; + } + else if(!IsTtBb()&&IsPythia6()&&isDirectlyMPIPythia6(part, islooping)){ + m_partonsOrigin[ part ] = b_MPI; + } + else if(!IsTtBb()&&IsPythia8()&&isDirectlyMPIPythia8(part, islooping)){ + m_partonsOrigin[ part ] = b_MPI; + } + else if(!IsTtBb()&&IsSherpa()&&isDirectlyMPISherpa(part)){ + m_partonsOrigin[ part ] = b_MPI; + } + + + + + } + if(iscquark){ + bool islooping = isLooping(part); + + if(isDirectlyFromWTop(part, islooping)){ + m_partonsOrigin[ part ] = c_from_W; + } + else if(isDirectlyFromTop(part, islooping)){ + m_partonsOrigin[ part ] = c_from_top; + } + else if(!IsTtBb()&&(IsHerwigPP()&&IsSherpa())&&isDirectlyFSR(part,islooping)){ + m_partonsOrigin[ part ] = c_FSR; + } + else if(!IsTtBb()&&IsPythia8()&&isDirectlyFSRPythia8(part,islooping)){ + m_partonsOrigin[ part ] = c_FSR; + } + else if(!IsTtBb()&&IsPythia6()&&isDirectlyFSRPythia6(part,islooping)){ + m_partonsOrigin[ part ] = c_FSR; + } + + else if(!IsTtBb()&&IsPythia6()&&isDirectlyMPIPythia6(part, islooping)){ + m_partonsOrigin[ part ] = c_MPI; + } + else if(!IsTtBb()&&IsPythia8()&&isDirectlyMPIPythia8(part, islooping)){ + m_partonsOrigin[ part ] = c_MPI; + } + else if(!IsTtBb()&&IsSherpa()&&isDirectlyMPISherpa(part)){ + m_partonsOrigin[ part ] = c_MPI; + } + + + + } + + + + + if(isHFhadron){ + if(!isCHadronFromB(part)){ + if(m_usedHadron.count(part)) continue; + + fillHadronMap(part,part); + } + } + + + + }//loop on particles }//loop on truthevent container - + } - + int HadronOriginClassifier::hadronType(int pdgid) const{ - + int rest1(abs(pdgid%1000)); int rest2(abs(pdgid%10000)); - + if ( rest2 >= 5000 && rest2 < 6000 ) return 5; if( rest1 >= 500 && rest1 < 600 ) return 5; - + if ( rest2 >= 4000 && rest2 < 5000 ) return 4; if( rest1 >= 400 && rest1 < 500 ) return 4; - + return 0; - + } - - + + bool HadronOriginClassifier::isBHadron(const xAOD::TruthParticle* part) const{ - + if(part->barcode() >= 200000) return false; int type = hadronType(part->pdgId()); if(type == 5) return true; - + return false; - + } - - + + bool HadronOriginClassifier::isCHadron(const xAOD::TruthParticle* part) const{ - + if(part->barcode() >= 200000) return false; int type = hadronType(part->pdgId()); if(type == 4) return true; - + return false; - + } - + bool HadronOriginClassifier::isQuarkFromHadron(const xAOD::TruthParticle* part) const{ - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() ) continue; /// protection for sherpa int mothertype = hadronType( parent->pdgId() ); if( 4 == mothertype || 5 == mothertype ){ - return true; + return true; } if(isQuarkFromHadron(parent))return true; } - + return false; - + } - + bool HadronOriginClassifier::isCHadronFromB(const xAOD::TruthParticle* part) const{ - + if(!isCHadron(part)) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() ) continue; /// protection for sherpa if( isBHadron(parent) ){ - return true; + return true; } if(isCHadron(parent)){ - if(isCHadronFromB(parent))return true; + if(isCHadronFromB(parent))return true; } } - + return false; } - - + + void HadronOriginClassifier::fillHadronMap(const xAOD::TruthParticle* mainhad, const xAOD::TruthParticle* ihad, bool decayed){ + if (!ihad) return; - m_usedHadron.insert(ihad); + m_usedHadron.insert(ihad); int parent_flav,child_flav; bool isFinal = true; - if(!ihad->nChildren()) return; for(unsigned int j=0; j<ihad->nChildren(); ++j){ const xAOD::TruthParticle* child = ihad->child(j); if(decayed){ - fillHadronMap(mainhad,child,true); - isFinal=false; + fillHadronMap(mainhad,child,true); + isFinal=false; } else{ - child_flav = hadronType(child->pdgId()); - if(child_flav!=4 && child_flav!=5) continue; - parent_flav = hadronType(mainhad->pdgId()); - if(child_flav!=parent_flav) continue; - fillHadronMap(mainhad,child); - isFinal=false; + child_flav = hadronType(child->pdgId()); + if(child_flav!=4 && child_flav!=5) continue; + parent_flav = hadronType(mainhad->pdgId()); + if(child_flav!=parent_flav) continue; + fillHadronMap(mainhad,child); + isFinal=false; } - + } - + if(isFinal && !decayed){ m_mainHadronMap[mainhad]=hadronType(mainhad->pdgId()); - - + for(unsigned int j=0; j<ihad->nChildren(); ++j){ - const xAOD::TruthParticle* child = ihad->child(j); - fillHadronMap(mainhad,child,true); + const xAOD::TruthParticle* child = ihad->child(j); + fillHadronMap(mainhad,child,true); } } - - - - } - - - - - - + + } + + //-------------------------------------------------------------------------- bool HadronOriginClassifier::passHadronSelection(const xAOD::TruthParticle* part) const{ - double pt = part->pt(); double eta = fabs(part->eta()); - + if(pt<m_HadronPtMinCut) return false; if(eta>m_HadronEtaMaxCut) return false; - + return true; - } - - - + //-------------------------------------------------------------------------- bool HadronOriginClassifier::isFromTop(const xAOD::TruthParticle* part, bool looping) const{ - const xAOD::TruthParticle* initpart = findInitial(part, looping); return isDirectlyFromTop(initpart, looping); - } - + + //-------------------------------------------------------------------------- bool HadronOriginClassifier::isDirectlyFromTop(const xAOD::TruthParticle* part, bool looping) const{ - - - - if(!part->nParents()) return false; - + if(!part || !part->nParents()) return false; + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs( parent->pdgId() ) == 6 ) return true; } - + return false; } - + //-------------------------------------------------------------------------- bool HadronOriginClassifier::isFromWTop(const xAOD::TruthParticle* part, bool looping) const{ - const xAOD::TruthParticle* initpart = findInitial(part, looping); return isDirectlyFromWTop(initpart, looping); - } - - + + //-------------------------------------------------------------------------- bool HadronOriginClassifier::isDirectlyFromWTop(const xAOD::TruthParticle * part, bool looping) const{ - - - if(!part->nParents()) return false; - + if(!part || !part->nParents()) return false; + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs( parent->pdgId() ) == 24 ){ - if( isFromTop(parent, looping) ) return true; + if( isFromTop(parent, looping) ) return true; } } - + return false; - - + + } bool HadronOriginClassifier::isDirectlyFromGluonQuark(const xAOD::TruthParticle* part, bool looping) const{ - - - + + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs( parent->pdgId() ) == 21 || abs(parent->pdgId())<5 ) return true; } - + return false; } - + bool HadronOriginClassifier::isFromGluonQuark(const xAOD::TruthParticle* part, bool looping) const{ - + const xAOD::TruthParticle* initpart = findInitial(part, looping); return isDirectlyFromGluonQuark(initpart, looping); - + } - - + + bool HadronOriginClassifier::isDirectlyFSRPythia6(const xAOD::TruthParticle * part, bool looping) const{ - - + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if(abs( parent->pdgId() ) == 24){ - if(abs(part->pdgId())==4){ - //trick to get at least 50% of PowhegPythia c from FSR - if(part->pdgId()==-(parent->pdgId())/6){ - if( isFromGluonQuark(parent, looping) ) return true; - } - } - else{ - if( isFromGluonQuark(parent, looping) ) return true; - } + if(abs(part->pdgId())==4){ + //trick to get at least 50% of PowhegPythia c from FSR + if(part->pdgId()==-(parent->pdgId())/6){ + if( isFromGluonQuark(parent, looping) ) return true; + } + } + else{ + if( isFromGluonQuark(parent, looping) ) return true; + } } } - + return false; - - + + } bool HadronOriginClassifier::isDirectlyFSR(const xAOD::TruthParticle * part, bool looping) const{ - - + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs(parent->pdgId())== 21 || abs(parent->pdgId())==22 ){ - if( isFromQuarkTop( parent,looping ) ) return true; + if( isFromQuarkTop( parent,looping ) ) return true; } } - + return false; - - + + } bool HadronOriginClassifier::isDirectlyFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const{ - - - + + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs(parent->pdgId())<6 ) { - if(isFromTop(parent,looping)){ - return true; - } - else if(isFromWTop(parent,looping)){ - return true; - } - + if(isFromTop(parent,looping)){ + return true; + } + else if(isFromWTop(parent,looping)){ + return true; + } + } } - + return false; } - + bool HadronOriginClassifier::isFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const{ - + const xAOD::TruthParticle* initpart = findInitial(part, looping); return isDirectlyFromQuarkTop(initpart, looping); - + } - + bool HadronOriginClassifier::isDirectlyFSRPythia8(const xAOD::TruthParticle * part, bool looping) const{ - - + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs(parent->pdgId())== 21 || abs(parent->pdgId())==22 ){ - if( isFromQuarkTopPythia8( parent,looping ) ) return true; + if( isFromQuarkTopPythia8( parent,looping ) ) return true; } } - + return false; - - + + } bool HadronOriginClassifier::isDirectlyFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const{ - - - + + + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs(parent->pdgId())<6 ) { - - if(isFromWTop(parent,looping)){ - return true; - } - + + if(isFromWTop(parent,looping)){ + return true; + } + } } - + return false; } - + bool HadronOriginClassifier::isFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const{ - + const xAOD::TruthParticle* initpart = findInitial(part, looping); return isDirectlyFromQuarkTopPythia8(initpart, looping); - + } @@ -639,117 +646,109 @@ namespace DerivationFramework{ bool HadronOriginClassifier::isDirectlyMPIPythia6(const xAOD::TruthParticle * part, bool looping) const{ - + if(!part->nParents()) return false; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping ) continue; /// protection for sherpa if( abs(parent->pdgId())== 2212 && part->status()!=3) return true; } - + return false; - + } - - - + + + bool HadronOriginClassifier::isDirectlyMPIPythia8(const xAOD::TruthParticle * part, bool looping) const{ - + const xAOD::TruthParticle* initpart = findInitial(part, looping); - + if( initpart->status()>30 && initpart->status()<40) return true; - + return false; - + } bool HadronOriginClassifier::isDirectlyMPISherpa(const xAOD::TruthParticle * part) const{ - + if(!part->hasProdVtx()) return false; - + const xAOD::TruthVertex* vertex = part->prodVtx(); if(vertex->id()==2) return true; - + return false; - + } - + bool HadronOriginClassifier::isLooping(const xAOD::TruthParticle* part, std::set<const xAOD::TruthParticle*> init_part) const{ - + if(!part->nParents()) return false; - + init_part.insert(part); - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( init_part.find(parent) != init_part.end() ) return true; if( isLooping(parent, init_part) ) return true; } - + return false; - + } - - - + + + const xAOD::TruthParticle* HadronOriginClassifier::findInitial(const xAOD::TruthParticle* part, bool looping) const{ - - + + if(!part->nParents()) return part; - + for(unsigned int i=0; i<part->nParents(); ++i){ const xAOD::TruthParticle* parent = part->parent(i); if( part->barcode() < parent->barcode() && looping) continue; /// protection for sherpa if( part->pdgId() == parent->pdgId() ){ - return findInitial(parent, looping); + return findInitial(parent, looping); } } - + return part; - } - - - + //-------------------------------------------------------------------------- const xAOD::TruthParticle* HadronOriginClassifier::partonToHadron(const xAOD::TruthParticle* parton){ - const xAOD::TruthParticle* hadron(NULL); - + const xAOD::TruthParticle* hadron(nullptr); + TVector3 v, vtmp; v.SetPtEtaPhi(parton->pt(),parton->eta(),parton->phi()); float dR=999.; - - for(std::map<const xAOD::TruthParticle*,int>::iterator it = m_mainHadronMap.begin(); it != m_mainHadronMap.end(); it++){ - - + // const xAOD::TruthParticle* fhadron=(*it).first; - + if((*it).second != abs(parton->pdgId()) ) continue; // || ((fhadron->pt()/parton->pt())>1) vtmp.SetPtEtaPhi((*it).first->pt(),(*it).first->eta(),(*it).first->phi()); - + if(vtmp.DeltaR(v) < dR){ - dR = vtmp.DeltaR(v); - hadron = (*it).first; - + dR = vtmp.DeltaR(v); + hadron = (*it).first; } - + } - + return hadron; } - - + }//namespace diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginDecorator.cxx index 1bd5ac5cdc1fe5315ea38d789035186c128c75d0..3b3168e12b91a3ea12484b7b73e24e5f9de9dd55 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HadronOriginDecorator.cxx @@ -3,91 +3,57 @@ */ #include "DerivationFrameworkMCTruth/HadronOriginDecorator.h" - #include "xAODTruth/TruthParticleContainer.h" - #include "DerivationFrameworkMCTruth/HadronOriginClassifier.h" namespace DerivationFramework { - - + HadronOriginDecorator::HadronOriginDecorator(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t,n,p), m_Tool("") { - declareInterface<DerivationFramework::IAugmentationTool>(this); - - + declareProperty("ToolName",m_Tool); declareProperty("TruthEventName",m_TruthEventName="TruthParticles"); - } - - - + HadronOriginDecorator::~HadronOriginDecorator(){} - - - + StatusCode HadronOriginDecorator::initialize(){ - ATH_MSG_INFO("Initialize " ); - - + if(m_Tool.retrieve().isFailure()){ ATH_MSG_ERROR("unable to retrieve the tool " <<m_Tool); return StatusCode::FAILURE; } - + return StatusCode::SUCCESS; - } - - - + StatusCode HadronOriginDecorator::finalize(){ - return StatusCode::SUCCESS; - } - - - + StatusCode HadronOriginDecorator::addBranches() const{ - - const xAOD::TruthParticleContainer* xTruthParticleContainer = 0; if (evtStore()->retrieve(xTruthParticleContainer,m_TruthEventName).isFailure()) { ATH_MSG_WARNING("could not retrieve TruthParticleContainer " <<m_TruthEventName); return StatusCode::FAILURE; } - - - + std::map<const xAOD::TruthParticle*, DerivationFramework::HadronOriginClassifier::HF_id> hadronMap=m_Tool->GetOriginMap(); - - - + for(xAOD::TruthParticleContainer::const_iterator PItr = xTruthParticleContainer->begin(); PItr!=xTruthParticleContainer->end(); ++PItr){ - int flavortype=6; - if(hadronMap.find((*PItr))!=hadronMap.end()){ - flavortype= static_cast<int>(hadronMap[(*PItr)]); + flavortype= static_cast<int>(hadronMap[(*PItr)]); } - SG::AuxElement::Decorator< int > decoration("TopHadronOriginFlag"); - decoration(**PItr) = flavortype; - } - return StatusCode::SUCCESS; - } - - - + } /// namespace diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9b4091dacc9c1ac90036f1998da1f0bb537df991 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.cxx @@ -0,0 +1,276 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// HardScatterCollectionMaker.cxx +// Keeps the first N generations of particles from the hard scatter +// Based on TruthDecayCollectionMaker (but simpler) + +#include "HardScatterCollectionMaker.h" +#include "CollectionMakerHelpers.h" +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "xAODTruth/TruthVertexAuxContainer.h" + +// To look up which generator is being used +#include "StoreGate/StoreGateSvc.h" +#include "xAODTruth/TruthMetaDataContainer.h" + +// STL includes +#include <vector> +#include <string> +#include <algorithm> + +// For string manipulation +#include <boost/algorithm/string.hpp> + +// Constructor +DerivationFramework::HardScatterCollectionMaker::HardScatterCollectionMaker(const std::string& t, + const std::string& n, + const IInterface* p) + : AthAlgTool(t,n,p) + , m_eventsKey("TruthEvents") + , m_collectionName("") + , m_metaStore( "MetaDataStore", n ) +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("TruthEventKey", m_eventsKey); + declareProperty("NewCollectionName", m_collectionName); + declareProperty("Generations", m_generations=1, "Number of generations after the particle in question to keep (-1 for all)"); + declareProperty("MetaDataStore", m_metaStore ); +} + +// Destructor +DerivationFramework::HardScatterCollectionMaker::~HardScatterCollectionMaker() { +} + +// Athena initialize +StatusCode DerivationFramework::HardScatterCollectionMaker::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + if (m_eventsKey=="") { + ATH_MSG_FATAL("No truth event collection provided to use as a basis for new collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("Using " << m_eventsKey << " as the source collections for new truth collections");} + + if (m_collectionName=="") { + ATH_MSG_FATAL("No key provided for the new truth particle collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName );} + + return StatusCode::SUCCESS; +} + + +// Selection and collection creation +StatusCode DerivationFramework::HardScatterCollectionMaker::addBranches() const +{ + // Set up for some metadata handling + static int is_pure_pythia8 = -1; + if (is_pure_pythia8<0 && m_metaStore->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")){ + // Note that I'd like to get this out of metadata in general, but it seems that the + // metadata isn't fully available in initialize, and since this is a const function + // I can only do the retrieve every event, rather than lazy-initializing, since this + // metadata ought not change during a run + const DataHandle<xAOD::TruthMetaDataContainer> truthMetaData(nullptr); + // Shamelessly stolen from the file meta data tool + ATH_CHECK( m_metaStore->retrieve(truthMetaData) ); + + if (truthMetaData->size()>0){ + // Let's just be super sure... + const std::string gens = boost::algorithm::to_lower_copy(truthMetaData->at(0)->generators()); + // Check if it has Pythia8 in it + is_pure_pythia8 = (gens.find("pythia8")==std::string::npos)?0:1; + // Check if it has something *else* in it + std::string remainder = boost::algorithm::erase_all_copy(gens,"pythia8"); + boost::algorithm::erase_all(remainder,"evtgen"); + boost::algorithm::erase_all(remainder,"+"); + if (remainder!=""){ + ATH_MSG_INFO("Ideentified sample as not pure-Pythia8. Gen info was " << gens); + is_pure_pythia8=0; + } else if (is_pure_pythia8){ + ATH_MSG_INFO("Identified sample as pure-Pythia8. Reconfiguring accordingly. Gen info was " << gens); + } + } // Seems to be the only sure way... + else { + ATH_MSG_WARNING("Found xAODTruthMetaDataContainer empty! Configuring to be NOT pure Pythia8."); + } + } else if (is_pure_pythia8<0){ + ATH_MSG_WARNING("Could not find metadata container in storegate; assuming NOT pure Pythia8"); + is_pure_pythia8=0; + } + + // Retrieve truth collections + const xAOD::TruthEventContainer* importedTruthEvents(nullptr); + if (evtStore()->retrieve(importedTruthEvents,m_eventsKey).isFailure()) { + ATH_MSG_ERROR("No TruthEvent collection with name " << m_eventsKey << " found in StoreGate!"); + return StatusCode::FAILURE; + } + // We only care about the first event + if (importedTruthEvents->size()==0){ + ATH_MSG_ERROR("TruthEvent collection with name " << m_eventsKey << " is empty!"); + return StatusCode::FAILURE; + } + // Check that it has a hard scatter process defined + const xAOD::TruthVertex* my_tv = importedTruthEvents->at(0)->signalProcessVertex(); + if (my_tv==nullptr){ + static bool warn_once=false; + if (!warn_once){ + ATH_MSG_WARNING("TruthEvent collection with name " << m_eventsKey << " has a null signal process vertex!"); + warn_once=true; + } + size_t i_vtx=0; + // Sometimes we're unlucky and the first vertex is null! + while (!my_tv && i_vtx<importedTruthEvents->at(0)->nTruthVertices()){ + my_tv = importedTruthEvents->at(0)->truthVertex(i_vtx); + i_vtx++; + } + if (my_tv==nullptr){ + ATH_MSG_ERROR("TruthEvent collection had no vertices at all? Something is wrong with your truth record!"); + return StatusCode::FAILURE; + } + } + + // Create the new particle containers + xAOD::TruthParticleContainer* newParticleCollection = new xAOD::TruthParticleContainer(); + CHECK( evtStore()->record( newParticleCollection, m_collectionName + "Particles" ) ); + xAOD::TruthParticleAuxContainer* newParticleAuxCollection = new xAOD::TruthParticleAuxContainer(); + CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName + "ParticlesAux." ) ); + newParticleCollection->setStore( newParticleAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << (m_collectionName+"Particles")); + // Create the new vertex containers + xAOD::TruthVertexContainer* newVertexCollection = new xAOD::TruthVertexContainer(); + CHECK( evtStore()->record( newVertexCollection, m_collectionName + "Vertices" ) ); + xAOD::TruthVertexAuxContainer* newVertexAuxCollection = new xAOD::TruthVertexAuxContainer(); + CHECK( evtStore()->record( newVertexAuxCollection, m_collectionName + "VerticesAux." ) ); + newVertexCollection->setStore( newVertexAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthVertexContainer with key: " << (m_collectionName+"Vertices")); + + std::vector<int> seen_particles; // Loop protection + + // If this was pure Pythia8, we are going to fake the collection + if (is_pure_pythia8){ + // Make a dummy vertex + xAOD::TruthVertex* xTruthVertex0 = new xAOD::TruthVertex(); + newVertexCollection->push_back( xTruthVertex0 ); + // Get a link to this vertex -- will be used to set production vertices on all the next particles + int myIndex0 = newVertexCollection->size()-1; + ElementLink<xAOD::TruthVertexContainer> eltv0(*newVertexCollection, myIndex0); + // Set properties. Cheating here; if we had a signal process vertex, use its properties + xTruthVertex0->setId(my_tv->id()); + xTruthVertex0->setBarcode(my_tv->barcode()); + xTruthVertex0->setX(my_tv->x()); + xTruthVertex0->setY(my_tv->y()); + xTruthVertex0->setZ(my_tv->z()); + xTruthVertex0->setT(my_tv->t()); + // Same story, but for the completed intermediate particles + xAOD::TruthVertex* xTruthVertex1 = new xAOD::TruthVertex(); + newVertexCollection->push_back( xTruthVertex1 ); + // Get a link to this vertex -- will be used to set production vertices on all the next particles + int myIndex1 = newVertexCollection->size()-1; + ElementLink<xAOD::TruthVertexContainer> eltv1(*newVertexCollection, myIndex1); + // Set properties. Cheating here; if we had a signal process vertex, use its properties + xTruthVertex1->setId(my_tv->id()); + xTruthVertex1->setBarcode(my_tv->barcode()-1); + xTruthVertex1->setX(my_tv->x()); + xTruthVertex1->setY(my_tv->y()); + xTruthVertex1->setZ(my_tv->z()); + xTruthVertex1->setT(my_tv->t()); + + // Now run through the particles... + for (size_t np=0;np<importedTruthEvents->at(0)->nTruthParticles();++np){ + // Get the particle + const xAOD::TruthParticle* tp = importedTruthEvents->at(0)->truthParticle(np); + // Better not be a null pointer + if (!tp) continue; + // Attach based on status codes! + // status 21 means incoming + if (tp->status()==21){ + xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection ); + // Make a link to this particle + int myIndex = newParticleCollection->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex); + // Add it to the vertex + xTruthParticle->setDecayVtxLink( eltv0 ); + (*newVertexCollection)[myIndex0]->addIncomingParticleLink( eltp ); + seen_particles.push_back(tp->barcode()); + } + // Status 23 means outgoing - include requested generations (less this one) + else if (tp->status()==23){ + int handyIndex = CollectionMakerHelpers::addTruthParticle( *tp, newParticleCollection, newVertexCollection, seen_particles, m_generations-1 ); + // Make a link to this particle + ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, handyIndex); + // Add it to the vertex + (*newParticleCollection)[handyIndex]->setProdVtxLink( eltv1 ); + (*newVertexCollection)[myIndex1]->addOutgoingParticleLink( eltp ); + seen_particles.push_back(tp->barcode()); + } + // Status 22 or 62 means intermediate - only save bosons + else if ((tp->status()==22 || tp->status()==62) && (tp->isW() || tp->isZ() || tp->isHiggs() || tp->isBSM())){ + xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection ); + // Make a link to this particle + int myIndex = newParticleCollection->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex); + // Add it to both the vertices + xTruthParticle->setProdVtxLink( eltv0 ); + (*newVertexCollection)[myIndex0]->addOutgoingParticleLink( eltp ); + xTruthParticle->setDecayVtxLink( eltv1 ); + (*newVertexCollection)[myIndex1]->addIncomingParticleLink( eltp ); + seen_particles.push_back(tp->barcode()); + } + } + // Done with my new collection for Pythia8 + return StatusCode::SUCCESS; + } + + // Get the signal process vertex. Get the incoming particles and outgoing particles and + // make a mini truth collection based on those + // Let's assume a reasonable case... + CollectionMakerHelpers::addTruthParticle( *(my_tv->incomingParticle(0)), newParticleCollection, newVertexCollection, seen_particles, m_generations ); + // Are there any other incoming particles we need to add? + for (size_t i=1;i<my_tv->nIncomingParticles();++i){ + // Set up the truth particle + xAOD::TruthParticle* xTruthParticle = CollectionMakerHelpers::setupTruthParticle(*(my_tv->incomingParticle(i)),newParticleCollection); + // Make a link to this particle + int my_index = newParticleCollection->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, my_index); + // Decay vertex link + ElementLink<xAOD::TruthVertexContainer> eltv( *newVertexCollection, 0 ); // First one we added in + xTruthParticle->setDecayVtxLink( eltv ); + (*newVertexCollection)[0]->addIncomingParticleLink( eltp ); + // Note that we did it + seen_particles.push_back( xTruthParticle->barcode() ); + } // Done adding incoming particles -- all finished! + + // Extra check, because truth records are complicated, based on studies by Dan Hayden (thanks!) + for (size_t np=0;np<importedTruthEvents->at(0)->nTruthParticles();++np){ + // Get the particle + const xAOD::TruthParticle* tp = importedTruthEvents->at(0)->truthParticle(np); + // Better not be a null pointer + if (!tp) continue; + // Attach based on status codes! + // status 21 means incoming + if (tp->status()!=21) continue; + // See if we already got this one + if (std::find(seen_particles.begin(),seen_particles.end(),tp->barcode())!=seen_particles.end()){ + continue; + } // Found it in the old container + // Otherwise, add it + xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection ); + // Make a link to this particle + int myIndex = newParticleCollection->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex); + // Add it to the vertex + ElementLink<xAOD::TruthVertexContainer> eltv( *newVertexCollection, 0 ); // First one we added in + xTruthParticle->setDecayVtxLink( eltv ); + (*newVertexCollection)[0]->addIncomingParticleLink( eltp ); + // Note that we did it + seen_particles.push_back( xTruthParticle->barcode() ); + } + + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..4884f121ec20a4d98f87ba002d1391e625d82abc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardScatterCollectionMaker.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// HardScatterCollectionMaker.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_HARDSCATTERCOLLECTIONMAKER_H +#define DERIVATIONFRAMEWORK_HARDSCATTERCOLLECTIONMAKER_H + +// Base classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +// For handles +#include "GaudiKernel/ServiceHandle.h" +// Standard library includes +#include <string> + +// Forward declaration +class StoreGateSvc; + +namespace DerivationFramework { + + class HardScatterCollectionMaker : public AthAlgTool, public IAugmentationTool { + public: + HardScatterCollectionMaker(const std::string& t, const std::string& n, const IInterface* p); + ~HardScatterCollectionMaker(); + StatusCode initialize(); + virtual StatusCode addBranches() const; + + private: + std::string m_eventsKey; //!< Input particle collection (navigates to the vertices) + std::string m_collectionName; //!< Output collection name stem + int m_generations; //!< Number of generations after the particle in question to keep + ServiceHandle<StoreGateSvc> m_metaStore; //!< Handle on the metadata store for init + }; +} + +#endif // DERIVATIONFRAMEWORK_HARDSCATTERCOLLECTIONMAKER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx index cbf80bb0df60a45bb6be3fd4b0a6e4ef498a4e08..e5e22ccc56dee00af7b8962d3b864b12a07baeb6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx @@ -63,7 +63,11 @@ m_geantOffset(200000) declareProperty ("WriteBHadrons", m_writeBHadrons = true, "Keep b-hadrons?"); - + + declareProperty ("WriteCHadrons", + m_writeCHadrons = true, + "Keep c-hadrons?"); + declareProperty ("WriteGeant", m_writeGeant = false, "Keep Geant particles?"); @@ -156,8 +160,14 @@ m_geantOffset(200000) declareProperty ("WritettHFHadrons", m_writettHFHadrons = false, "Keep tt+HF hadrons?"); - - + + declareProperty ("PDGIDsToKeep", + m_pdgIdsToKeep={}, + "List of PDG IDs to always keep"); + + declareProperty ("LongLivedPDGIDs", + m_longLivedPdgIds={}, + "List of PDG IDs of long lived particles so that one can store their children"); } // Destructor @@ -300,7 +310,14 @@ bool DerivationFramework::MenuTruthThinning::isAccepted(const xAOD::TruthParticl int pdg_id = std::abs(p->pdgId()); int barcode = p->barcode(); - + + // All explicitly requested PDG IDs of long lived particles, this is needed + // because their childrens barcodes can be above the cut off m_geantOffset = 200000 + if(m_longLivedPdgIds.size()>0 && parentIsLongLived(p)){ + ok=true; + } + + if (barcode > m_geantOffset && !m_writeGeant && !m_writeEverything && !ok) { if (! (pdg_id == 22/*PDG::gamma*/ && m_geantPhotonPtThresh >= 0 && @@ -331,7 +348,12 @@ bool DerivationFramework::MenuTruthThinning::isAccepted(const xAOD::TruthParticl // JRC: cut changed from PHOTOSMIN to m_geantOffset if( m_writeBHadrons && barcode < m_geantOffset && HepPID::isHadron (pdg_id) && HepPID::hasBottom (pdg_id) ) ok= true; - + + // OK if we should select c hadrons and are in hadron range + // JRC: cut changed from PHOTOSMIN to m_geantOffset + if( m_writeCHadrons && barcode < m_geantOffset && HepPID::isHadron (pdg_id) && HepPID::hasCharm (pdg_id) ) + ok= true; + // PHOTOS range: check whether photons come from parton range or // hadron range int motherPDGID = 999999999; @@ -410,7 +432,12 @@ bool DerivationFramework::MenuTruthThinning::isAccepted(const xAOD::TruthParticl } } - + + // All explicitly requested PDG IDs + for (const auto id : m_pdgIdsToKeep){ + if (pdg_id==id) ok=true; + } // Loop over PDG IDs + return ok; } @@ -717,3 +744,16 @@ bool DerivationFramework::MenuTruthThinning::isFsrFromLepton(const xAOD::TruthPa return false; } +bool DerivationFramework::MenuTruthThinning::parentIsLongLived(const xAOD::TruthParticle* part) const { + //loop over the parents of the truth particle, if the parent is in the list of long lived particles + //store this truth particle. + for(size_t parent_itr = 0; parent_itr < part->nParents(); parent_itr++){ + if(!part->parent(parent_itr)) continue; + const xAOD::TruthParticle* parent = part->parent(parent_itr); + const int parent_abs_pdgid = abs(parent->pdgId()); + if(std::find(m_longLivedPdgIds.begin(), m_longLivedPdgIds.end(), parent_abs_pdgid) != m_longLivedPdgIds.end() ){ + return true; + } + } + return false; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5f043e3f48e6176929f5029d274bac581e9261db --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.cxx @@ -0,0 +1,195 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthBornLeptonCollectionMaker.cxx +// Makes a special collection of Born leptons + +// My own header file +#include "TruthBornLeptonCollectionMaker.h" +// EDM includes for the particles we need +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +// To look up which generator is being used +#include "StoreGate/StoreGateSvc.h" +#include "xAODTruth/TruthMetaDataContainer.h" +// STL includes +#include <string> + +// Constructor +DerivationFramework::TruthBornLeptonCollectionMaker::TruthBornLeptonCollectionMaker(const std::string& t, + const std::string& n, + const IInterface* p) + : AthAlgTool(t,n,p) + , m_metaStore( "MetaDataStore", n ) +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("ParticlesKey", m_particlesKey="TruthParticles"); + declareProperty("NewCollectionName", m_collectionName=""); + declareProperty( "MetaDataStore", m_metaStore ); +} + +// Destructor +DerivationFramework::TruthBornLeptonCollectionMaker::~TruthBornLeptonCollectionMaker() { +} + +// Athena initialize and finalize +StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + if (m_particlesKey=="" /*|| m_verticesKey==""*/) { + ATH_MSG_FATAL("No truth particle collection provided to use as a basis for new collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("Using " << m_particlesKey << " as the source collections for new truth collections");} + + if (m_collectionName=="") { + ATH_MSG_FATAL("No key provided for the new truth particle collection"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName );} + + ATH_CHECK( m_metaStore.retrieve() ); + + return StatusCode::SUCCESS; +} + +// Selection and collection creation +StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::addBranches() const +{ + // Set up for some metadata handling + static int is_sherpa = -1; + if (is_sherpa<0 && m_metaStore->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")){ + // Note that I'd like to get this out of metadata in general, but it seems that the + // metadata isn't fully available in initialize, and since this is a const function + // I can only do the retrieve every event, rather than lazy-initializing, since this + // metadata ought not change during a run + const DataHandle<xAOD::TruthMetaDataContainer> truthMetaData(nullptr); + // Shamelessly stolen from the file meta data tool + ATH_CHECK( m_metaStore->retrieve(truthMetaData) ); + + if (truthMetaData->size()>0){ + // Let's just be super sure... + const std::string gens = truthMetaData->at(0)->generators(); + is_sherpa = (gens.find("sherpa")==std::string::npos && + gens.find("Sherpa")==std::string::npos && + gens.find("SHERPA")==std::string::npos)?0:1; + } // Seems to be the only sure way... + else { + ATH_MSG_WARNING("Found xAODTruthMetaDataContainer empty! Configuring to be NOT Sherpa."); + } + ATH_MSG_INFO("From metadata configured: Sherpa? " << is_sherpa); + } else if (is_sherpa<0){ + ATH_MSG_WARNING("Could not find metadata container in storegate; assuming NOT Sherpa"); + is_sherpa=0; + } + + // Retrieve truth collections + const DataHandle<xAOD::TruthParticleContainer> importedTruthParticles(nullptr); + if (evtStore()->retrieve(importedTruthParticles,m_particlesKey).isFailure()) { + ATH_MSG_ERROR("No TruthParticle collection with name " << m_particlesKey << " found in StoreGate!"); + return StatusCode::FAILURE; + } + + // Create the new containers + xAOD::TruthParticleContainer* newParticleCollection = new xAOD::TruthParticleContainer(); + CHECK( evtStore()->record( newParticleCollection, m_collectionName ) ); + xAOD::TruthParticleAuxContainer* newParticleAuxCollection = new xAOD::TruthParticleAuxContainer(); + CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName + "Aux." ) ); + newParticleCollection->setStore( newParticleAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << m_collectionName); + + // Set up decorators + const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin"); + const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType"); + const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome"); + + // add relevant particles to new collection + for (unsigned int i=0; i<importedTruthParticles->size(); ++i) { + // Grab the particle + const xAOD::TruthParticle* theParticle = (*importedTruthParticles)[i]; + if (!theParticle) continue; // Protection against null pointers + if (!theParticle->isLepton()) continue; // Only include leptons! + + if (is_sherpa>0 && theParticle->status()!=11){ + // If Sherpa, take leptons with status 11 + continue; + } else if (is_sherpa==0) { + // Some generators, look for leptons with status 3 coming from vertices with other leptons + bool has_status_n3=false, has_status_3=false, has_V=false; + if (theParticle->status()==3){ + // Look for other leptons in the production vertex... carefully + if (theParticle->hasProdVtx()){ + const xAOD::TruthVertex * prod = theParticle->prodVtx(); + for (size_t p=0;p<prod->nOutgoingParticles();++p){ + if (prod->outgoingParticle(p) && + prod->outgoingParticle(p)->isLepton()){ + has_status_n3 = has_status_n3 || prod->outgoingParticle(p)->status()!=3; + has_status_3 = has_status_3 || prod->outgoingParticle(p)->status()==3; + } + } // Loop over particles from the same production vertex + for (size_t p=0;p<prod->nIncomingParticles();++p){ + // See if there was a boson going *into* the vertex + if (prod->incomingParticle(p) && + (prod->incomingParticle(p)->isZ() || prod->incomingParticle(p)->isW() || prod->incomingParticle(p)->isHiggs()) ){ + has_V=true; + break; + } // Found a vector boson + } // Loop over particles going into the same production vertex + } // Doesn't have a production vertex + } // Had status 3 + + // Now we have all the information for the special case of V->l(born) l(bare) l(born) l(bare) + if ( !(has_status_3 && has_status_n3 && has_V && theParticle->status()==3) && + theParticle->status()!=23){ + // If not a special case, deal with the standard: has a boson parent, is a lepton, and has a descendent that is a bare lepton + if (!theParticle->parent()) continue; + if (!theParticle->parent()->isZ() && !theParticle->parent()->isW() && !theParticle->parent()->isHiggs()) continue; + if (!hasBareDescendent( theParticle ) ) continue; + } + } // End of treatment for generators that are not Sherpa + + // Add this particle to the new collection + xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); + newParticleCollection->push_back( xTruthParticle ); + // Fill with numerical content + xTruthParticle->setPdgId(theParticle->pdgId()); + xTruthParticle->setBarcode(theParticle->barcode()); + xTruthParticle->setStatus(theParticle->status()); + xTruthParticle->setM(theParticle->m()); + xTruthParticle->setPx(theParticle->px()); + xTruthParticle->setPy(theParticle->py()); + xTruthParticle->setPz(theParticle->pz()); + xTruthParticle->setE(theParticle->e()); + // Copy over the decorations if they are available + if (theParticle->isAvailable<unsigned int>("classifierParticleType")) { + typeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleType" ); + } else {typeDecorator(*xTruthParticle) = 0;} + if (theParticle->isAvailable<unsigned int>("classifierParticleOrigin")) { + originDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOrigin" ); + } else {originDecorator(*xTruthParticle) = 0;} + if (theParticle->isAvailable<unsigned int>("classifierParticleOutCome")) { + outcomeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOutCome" ); + } else {outcomeDecorator(*xTruthParticle) = 0;} + } // Loop over alll particles + + return StatusCode::SUCCESS; +} + +// Find out if a particle has a bare descendent +bool DerivationFramework::TruthBornLeptonCollectionMaker::hasBareDescendent( const xAOD::TruthParticle* p ) const +{ + // Null pointer check + if (!p) return false; + // If we hit a bare descendent, then we're a winnner + if (p->isLepton() && p->status()==1) return true; + // Otherwise look through all the children + for (size_t c=0;c<p->nChildren();++c){ + if (!p->child(c)) continue; // Null pointer protection + if (p->pdgId()!=p->child(c)->pdgId()) continue; // Different particle child + if (hasBareDescendent( p->child(c) )) return true; + } + // No luck -- this branch is a dead end + return false; +} + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.h new file mode 100644 index 0000000000000000000000000000000000000000..0d940b34366e2af11329b54614d1471e70f84184 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthBornLeptonCollectionMaker.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// TruthBornLeptonCollectionMaker.h +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_TRUTHBORNLEPTONCOLLECTIONMAKER_H +#define DERIVATIONFRAMEWORK_TRUTHBORNLEPTONCOLLECTIONMAKER_H + +// Base classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +// EDM includes for the particles we need +#include "xAODTruth/TruthParticle.h" +// For the Metadata store +#include "GaudiKernel/ServiceHandle.h" +// STL includes +#include <string> + +// Forward declarations +class StoreGateSvc; + +namespace DerivationFramework { + + class TruthBornLeptonCollectionMaker : public AthAlgTool, public IAugmentationTool { + public: + TruthBornLeptonCollectionMaker(const std::string& t, const std::string& n, const IInterface* p); + ~TruthBornLeptonCollectionMaker(); + StatusCode initialize(); + virtual StatusCode addBranches() const; + + private: + std::string m_particlesKey; //!< Input particle collection key + std::string m_collectionName; //!< Output particle collection key + ServiceHandle<StoreGateSvc> m_metaStore; //!< Handle on the metadata store for init + /// Helper function for finding bare descendents of born leptons + bool hasBareDescendent( const xAOD::TruthParticle* p ) const; + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHBORNLEPTONCOLLECTIONMAKER_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthClassificationDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthClassificationDecorator.cxx index 706e1d7d0dc6ac4e47b2cd07b32f1a94a7ced7a3..fd60c91856d9327d007bf0694a7b5659b48a33e0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthClassificationDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthClassificationDecorator.cxx @@ -3,8 +3,7 @@ */ ///////////////////////////////////////////////////////////////// -// TruthClassificationDecorator.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// +// TruthClassificationDecorator.cxx // Author: James Catmore (James.Catmore@cern.ch) // Removes all truth particles/vertices which do not pass a user-defined cut diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMaker.cxx index ad227bd2c372fe918250e2362b14186d40076158..b072f2f729efdc4762c84825446197bc743f78f4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMaker.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMaker.cxx @@ -3,19 +3,24 @@ */ ///////////////////////////////////////////////////////////////// -// TruthCollectionMaker.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// +// TruthCollectionMaker.cxx // Author: James Catmore (James.Catmore@cern.ch) // Removes all truth particles/vertices which do not pass a user-defined cut +// Base class #include "DerivationFrameworkMCTruth/TruthCollectionMaker.h" +// For evaluating the expression of what particles to keep #include "ExpressionEvaluation/ExpressionParser.h" #include "ExpressionEvaluation/SGxAODProxyLoader.h" #include "ExpressionEvaluation/SGNTUPProxyLoader.h" #include "ExpressionEvaluation/MultipleProxyLoader.h" +// EDM includes #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthParticleAuxContainer.h" -//#include "xAODTruth/TruthVertexContainer.h" +// To look up which generator is being used +#include "StoreGate/StoreGateSvc.h" +#include "xAODTruth/TruthMetaDataContainer.h" +// STL Includes #include <vector> #include <string> #include <numeric> @@ -23,32 +28,24 @@ // Constructor DerivationFramework::TruthCollectionMaker::TruthCollectionMaker(const std::string& t, const std::string& n, - const IInterface* p) : - + const IInterface* p) //m_do_compress = true: removes particles with the same pdgId in a decay chain (but keeps first and last) //m_do_sherpa = true: checks if there are truth W bosons in the current record. If not, tries to combine W daughters to create one. - //Disclaimer: m_do_sherpa currently only works for W+jets. It will not work for Z+jets for dibosons (coming soon). - -AthAlgTool(t,n,p), -//m_ntotvtx(0), -m_ntotpart(0), -//m_npassvtx(0), -m_npasspart(0), -m_particlesKey("TruthParticles"), -//m_verticesKey("TruthVertices"), -m_collectionName(""), -m_partString(""), -m_do_compress(false), -m_do_sherpa(false) + : AthAlgTool(t,n,p) + , m_ntotpart(0) + , m_npasspart(0) + , m_metaStore( "MetaDataStore", n ) { declareInterface<DerivationFramework::IAugmentationTool>(this); - declareProperty("ParticlesKey", m_particlesKey); + declareProperty("ParticlesKey", m_particlesKey="TruthParticles"); //declareProperty("VerticesKey", m_verticesKey); - declareProperty("NewCollectionName", m_collectionName); - declareProperty("ParticleSelectionString", m_partString); - declareProperty("Do_Compress",m_do_compress); - declareProperty("Do_Sherpa",m_do_sherpa); + declareProperty("NewCollectionName", m_collectionName=""); + declareProperty("ParticleSelectionString", m_partString=""); + declareProperty("Do_Compress",m_do_compress=false); + declareProperty("Do_Sherpa",m_do_sherpa=false); + declareProperty("KeepNavigationInfo",m_keep_navigation_info=true); + declareProperty("MetaDataStore", m_metaStore ); } // Destructor @@ -103,7 +100,33 @@ StatusCode DerivationFramework::TruthCollectionMaker::finalize() // Selection and collection creation StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const { + // Set up for some metadata handling + static int is_sherpa = -1; + if (is_sherpa<0 && m_metaStore->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")){ + // Note that I'd like to get this out of metadata in general, but it seems that the + // metadata isn't fully available in initialize, and since this is a const function + // I can only do the retrieve every event, rather than lazy-initializing, since this + // metadata ought not change during a run + const DataHandle<xAOD::TruthMetaDataContainer> truthMetaData(nullptr); + // Shamelessly stolen from the file meta data tool + ATH_CHECK( m_metaStore->retrieve(truthMetaData) ); + if (truthMetaData->size()>0){ + // Let's just be super sure... + const std::string gens = truthMetaData->at(0)->generators(); + is_sherpa = (gens.find("sherpa")==std::string::npos && + gens.find("Sherpa")==std::string::npos && + gens.find("SHERPA")==std::string::npos)?0:1; + } // Seems to be the only sure way... + else { + ATH_MSG_WARNING("Found xAODTruthMetaDataContainer empty! Configuring to be NOT Sherpa."); + } + ATH_MSG_INFO("From metadata configured: Sherpa? " << is_sherpa); + } else if (is_sherpa<0){ + ATH_MSG_WARNING("Could not find metadata container in storegate; assuming NOT Sherpa"); + is_sherpa=0; + } + // Retrieve truth collections const xAOD::TruthParticleContainer* importedTruthParticles; if (evtStore()->retrieve(importedTruthParticles,m_particlesKey).isFailure()) { @@ -130,13 +153,13 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const m_ntotpart += nParticles; // Set up decorators - SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > linkDecorator("originalTruthParticle"); - SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin"); - SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType"); - SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome"); - SG::AuxElement::Decorator< int > motherIDDecorator("motherID"); - SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID"); - SG::AuxElement::Decorator< int > HadronOriginDecorator("TopHadronOriginFlag"); + const static SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > linkDecorator("originalTruthParticle"); + const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin"); + const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType"); + const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome"); + const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID"); + const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID"); + const static SG::AuxElement::Decorator< int > HadronOriginDecorator("TopHadronOriginFlag"); // Execute the text parsers and update the mask if (m_partString!="") { @@ -156,23 +179,111 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const //Let's check if we want to build W/Z bosons bool SherpaW = false; bool SherpaZ = false; - if (m_partString.find("24") != std::string::npos && m_do_sherpa) { + if (m_partString.find("24") != std::string::npos && m_do_sherpa && is_sherpa) { SherpaW = true; } - if (m_partString.find("23") != std::string::npos && m_do_sherpa) { + if (m_partString.find("23") != std::string::npos && m_do_sherpa && is_sherpa) { SherpaZ = true; } - if (SherpaW or SherpaZ){ + if ((SherpaW or SherpaZ) && is_sherpa){ if (std::accumulate(entries.begin(),entries.end(),0) > 0){ //We actually have some W and Z bosons in there. SherpaW = false; SherpaZ = false; } } - if (SherpaW){ //In principle, we should add a block for Z's and dibosons as well - it will look quite similar to this one. - //auto xTruthParticle = make_particle(&*importedTruthParticles); - //newParticleCollection->push_back( xTruthParticle ); - //return StatusCode::SUCCESS; + if ((SherpaW || SherpaZ) && is_sherpa){ + // Currently only handles un-ambiguous cases + std::vector<const xAOD::TruthParticle*> status20, status3; + for (unsigned int i=0; i<nParticles; ++i) { + // Nullptr check + if (!importedTruthParticles->at(i)) continue; + // Only collect leptons + if (importedTruthParticles->at(i)->absPdgId()<11 || importedTruthParticles->at(i)->absPdgId()>16) continue; + // Gather by status + if (importedTruthParticles->at(i)->status()==20) status20.push_back( importedTruthParticles->at(i) ); + if (importedTruthParticles->at(i)->status()== 3) status3.push_back( importedTruthParticles->at(i) ); + } // Done with loop over truth particles + // Make it so that we can exclusively use one vector + // Status 20 should have the priority -- it is the future + if (status20.size()>0){ + status3.swap(status20); + } + // Boson cases that we can actually deal with -- generically up to VVV + if ((status3.size()==2 || status3.size()==4 || status3.size()==6) && (SherpaZ || SherpaW)){ + // Basic boson pairing... + int gens[3] = {0,0,0}; + for (size_t i=0;i<status3.size();++i){ + if (status3[i]->absPdgId()<13) gens[0]++; + else if (status3[i]->absPdgId()<15) gens[1]++; + else gens[2]++; + } // Loop over status3 particles + // Should only have even numbers per generation. Any number greater than 2 or ==1 and we're dead + if (gens[0]>2 || gens[0]==1 || gens[1]>2 || gens[1]==1 || gens[2]>2 || gens[2]==1){ + // In agreeing with Sherpa authors, these are Q-M ambiguous states. Do not let users be evil. + ATH_MSG_VERBOSE("Too many leptons of one generation. Cannot make bosons. Give up"); + return StatusCode::SUCCESS; + } + std::vector<const xAOD::TruthParticle*> boson; + for (size_t i=0;i<status3.size();++i){ + if (status3[i]->absPdgId()<13) boson.push_back(status3[i]); + else if (gens[0]==0 && status3[i]->absPdgId()<15) boson.push_back(status3[i]); + else if (gens[0]==0 && gens[1]==0) boson.push_back(status3[i]); + if (boson.size()==2){ + // Make a boson! Just have to figure out _which_ boson! + int pdg_id=0; + // Easy case: Z boson + if (boson[0]->pdgId()==-boson[1]->pdgId()) pdg_id=23; + else if (std::abs(boson[0]->pdgId()+boson[1]->pdgId())!=1){ + // No idea what you were + ATH_MSG_WARNING("Do not know how to interpret as a boson: " << boson[0]->pdgId() << " " << boson[1]->pdgId()); + } else { + // W boson + pdg_id=24*(boson[0]->pdgId()+boson[1]->pdgId()); + } + if ( (SherpaW && std::abs(pdg_id)==24) || + (SherpaZ && pdg_id==23) ){ + // Make a Z or a W + xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); + newParticleCollection->push_back( xTruthParticle ); + if (m_keep_navigation_info){ + if (boson[0]->hasProdVtx()) { + if ((boson[0]->prodVtx()->nIncomingParticles() > 0) && (boson[0]->prodVtx()->incomingParticle(0)!=nullptr)) { + motherIDDecorator(*xTruthParticle) = boson[0]->prodVtx()->incomingParticle(0)->pdgId(); + } else {motherIDDecorator(*xTruthParticle) = 0;} + } else {motherIDDecorator(*xTruthParticle) = 0;} + if (boson[0]->hasDecayVtx()) { + if ((boson[0]->decayVtx()->nOutgoingParticles() > 0) && (boson[0]->decayVtx()->outgoingParticle(0)!=nullptr)) { + daughterIDDecorator(*xTruthParticle) = boson[0]->decayVtx()->outgoingParticle(0)->pdgId(); + } else {daughterIDDecorator(*xTruthParticle) = 0;} + } else {daughterIDDecorator(*xTruthParticle) = 0;} + } + // Set with what makes sense here + xTruthParticle->setPdgId(pdg_id); + // Set dummy values + xTruthParticle->setBarcode(-1); + xTruthParticle->setStatus(3); + // Use the sum of the momenta + xAOD::IParticle::FourMom_t new_mom = boson[0]->p4()+boson[1]->p4(); + xTruthParticle->setM(new_mom.M()); + xTruthParticle->setPx(new_mom.Px()); + xTruthParticle->setPy(new_mom.Py()); + xTruthParticle->setPz(new_mom.Pz()); + xTruthParticle->setE(new_mom.E()); + } + // Now clear the vectors + boson.clear(); + // And move to the next generation + if (gens[0]==0 && gens[1]==0) gens[2]=0; + else if (gens[0]==0) gens[1]=0; + else gens[0]=0; + } // Done making a boson + } // Done looping over particles + } + if (status3.size()==1 || status3.size()==3 || status3.size()==5 || status3.size()>6){ + ATH_MSG_WARNING(status3.size() << " leptons found in the Sherpa event record. Not sure how to deal with this."); + } + return StatusCode::SUCCESS; } for (unsigned int i=0; i<nParticles; ++i) { ElementLink<xAOD::TruthParticleContainer> eltp(*importedTruthParticles,i); @@ -184,14 +295,14 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const bool same_as_mother = false; bool same_as_daughter = false; if (theParticle->hasProdVtx()){ - if (theParticle->prodVtx()->nIncomingParticles() > 0) { + if ((theParticle->prodVtx()->nIncomingParticles() > 0) && (theParticle->prodVtx()->incomingParticle(0)!=nullptr)) { if (theParticle->prodVtx()->incomingParticle(0)->pdgId() == theParticle->pdgId()){ same_as_mother = true; } } } if (theParticle->hasDecayVtx()){ - if (theParticle->decayVtx()->nOutgoingParticles() > 0) { + if ((theParticle->decayVtx()->nOutgoingParticles() > 0) && (theParticle->decayVtx()->outgoingParticle(0)!=nullptr)) { if (theParticle->decayVtx()->outgoingParticle(0)->pdgId() == theParticle->pdgId()){ same_as_daughter = true; } @@ -204,17 +315,17 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const } xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); newParticleCollection->push_back( xTruthParticle ); - if (theParticle->hasProdVtx()) { - if (theParticle->prodVtx()->nIncomingParticles() > 0) motherIDDecorator(*xTruthParticle) = theParticle->prodVtx()->incomingParticle(0)->pdgId(); - } - if (theParticle->hasDecayVtx()) { - if (theParticle->decayVtx()->nOutgoingParticles() > 0) { - const xAOD::TruthParticle* d = - theParticle->decayVtx()->outgoingParticle(0); - if (d) { - daughterIDDecorator(*xTruthParticle) = d->pdgId(); - } - } + if (m_keep_navigation_info){ + if (theParticle->hasProdVtx()) { + if ((theParticle->prodVtx()->nIncomingParticles() > 0) && (theParticle->prodVtx()->incomingParticle(0)!=nullptr)) { + motherIDDecorator(*xTruthParticle) = theParticle->prodVtx()->incomingParticle(0)->pdgId(); + } else {motherIDDecorator(*xTruthParticle) = 0;} + } else {motherIDDecorator(*xTruthParticle) = 0;} + if (theParticle->hasDecayVtx()) { + if ((theParticle->decayVtx()->nOutgoingParticles() > 0) && (theParticle->decayVtx()->outgoingParticle(0)!=nullptr)) { + daughterIDDecorator(*xTruthParticle) = theParticle->decayVtx()->outgoingParticle(0)->pdgId(); + } else {daughterIDDecorator(*xTruthParticle) = 0;} + } else {daughterIDDecorator(*xTruthParticle) = 0;} } // Fill with numerical content xTruthParticle->setPdgId(theParticle->pdgId()); @@ -226,17 +337,21 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const xTruthParticle->setPz(theParticle->pz()); xTruthParticle->setE(theParticle->e()); // Copy over the decorations if they are available - if (theParticle->isAvailable<unsigned int>("classifierParticleType")) - typeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleType" ); - if (theParticle->isAvailable<unsigned int>("classifierParticleOrigin")) - originDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOrigin" ); - if (theParticle->isAvailable<unsigned int>("classifierParticleOutCome")) - outcomeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOutCome" ); + if (theParticle->isAvailable<unsigned int>("classifierParticleType")) { + typeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleType" ); + } else {typeDecorator(*xTruthParticle) = 0;} + if (theParticle->isAvailable<unsigned int>("classifierParticleOrigin")) { + originDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOrigin" ); + } else {originDecorator(*xTruthParticle) = 0;} + if (theParticle->isAvailable<unsigned int>("classifierParticleOutCome")) { + outcomeDecorator(*xTruthParticle) = theParticle->auxdata< unsigned int >( "classifierParticleOutCome" ); + } else {outcomeDecorator(*xTruthParticle) = 0;} if (m_collectionName=="TruthHFHadrons"){ - if (theParticle->isAvailable<int>("TopHadronOriginFlag")) - HadronOriginDecorator(*xTruthParticle) = theParticle->auxdata< int >( "TopHadronOriginFlag" ); + if (theParticle->isAvailable<int>("TopHadronOriginFlag")) { + HadronOriginDecorator(*xTruthParticle) = theParticle->auxdata< int >( "TopHadronOriginFlag" ); + } else {HadronOriginDecorator(*xTruthParticle) = 0;} } - linkDecorator(*xTruthParticle) = eltp; + if(m_keep_navigation_info) linkDecorator(*xTruthParticle) = eltp; } } } @@ -246,42 +361,3 @@ StatusCode DerivationFramework::TruthCollectionMaker::addBranches() const return StatusCode::SUCCESS; } - - -/* - xAOD::TruthParticle* DerivationFramework::TruthCollectionMaker::make_particle(const xAOD::TruthParticleContainer* importedTruthParticles){ - - xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); - unsigned int nParticles = importedTruthParticles->size(); - - bool sherpa_foundone = false; - for (unsigned int i=0; i<nParticles; ++i) { - xAOD::TruthParticle* theParticle = const_cast<xAOD::TruthParticle*>( (*importedTruthParticles)[i] ); - if (!theParticle->isChLepton()) continue; - for (unsigned int j=0; j<nParticles; ++j) { - xAOD::TruthParticle* theParticle2 = const_cast<xAOD::TruthParticle*>( (*importedTruthParticles)[j] ); - if (!theParticle2->isNeutrino()) continue; - if (abs(theParticle->pdgId()+theParticle2->pdgId())!=1) continue; - if (!(theParticle->prodVtx()->incomingParticle(0)->isQuark() || theParticle->prodVtx()->incomingParticle(0)->pdgId()==21)) continue; - if (!(theParticle2->prodVtx()->incomingParticle(0)->isQuark() || theParticle2->prodVtx()->incomingParticle(0)->pdgId()==21)) continue; - - xTruthParticle->setBarcode(-1); - xTruthParticle->setPdgId(theParticle->threeCharge()*8); //3*8 = 24. - xTruthParticle->setStatus(-1); - xTruthParticle->setM((theParticle->p4()+theParticle2->p4()).M()); - xTruthParticle->setPx((theParticle->p4()+theParticle2->p4()).Px()); - xTruthParticle->setPy((theParticle->p4()+theParticle2->p4()).Py()); - xTruthParticle->setPz((theParticle->p4()+theParticle2->p4()).Pz()); - xTruthParticle->setE((theParticle->p4()+theParticle2->p4()).E()); - - sherpa_foundone = true; - break; //Just take the first one we find. - } - - if (sherpa_foundone) break; - } - - return xTruthParticle; - - } - */ diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMakerTau.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMakerTau.cxx index 3e926fe49f9b91b9683993eb44bd842e38bbb1b6..5fa12dfb57e65305bd457555a9d03630d82c8df3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMakerTau.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthCollectionMakerTau.cxx @@ -1,37 +1,28 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// -// TruthCollectionMakerTau.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Author: Dirk Duschinger (dirk.duschinger@cern.ch) +// TruthCollectionMakerTau.cxx // Create truth tau collection decorated with tau decay specific variables +// Class header file #include "DerivationFrameworkMCTruth/TruthCollectionMakerTau.h" -#include "MCTruthClassifier/IMCTruthClassifier.h" + +// Tool header file +#include "TauAnalysisTools/IBuildTruthTaus.h" +// for TruthTausEvent +#include "TauAnalysisTools/BuildTruthTaus.h" // Constructor DerivationFramework::TruthCollectionMakerTau::TruthCollectionMakerTau(const std::string& t, const std::string& n, - const IInterface* p ) : - AthAlgTool(t,n,p), - m_particlesKey("TruthParticles"), - m_collectionName(""), - m_classifier("MCTruthClassifier/MCTruthClassifier"), - m_runClassifier(true), - m_writeVisibleChargedFourMomentum(false), - m_writeVisibleNeutralFourMomentum(false), - m_writeDecayModeVector(true) + const IInterface* p ) + : AthAlgTool(t,n,p) + , m_buildTruthTaus("TauAnalysisTools::BuildTruthTaus/BuildTruthTaus") { declareInterface<DerivationFramework::IAugmentationTool>(this); - declareProperty("ParticlesKey", m_particlesKey); - declareProperty("NewCollectionName", m_collectionName); - declareProperty("MCTruthClassifier", m_classifier); - declareProperty("RunClassifier", m_runClassifier); - declareProperty("WriteVisibleChargedFourMomentum", m_writeVisibleChargedFourMomentum); - declareProperty("WriteVisibleNeutralFourMomentum", m_writeVisibleNeutralFourMomentum); - declareProperty("WriteDecayModeVector", m_writeDecayModeVector); + declareProperty("BuildTruthTaus", m_buildTruthTaus); } // Destructor @@ -42,296 +33,21 @@ DerivationFramework::TruthCollectionMakerTau::~TruthCollectionMakerTau() { StatusCode DerivationFramework::TruthCollectionMakerTau::initialize() { ATH_MSG_VERBOSE("initialize() ..."); - if ( m_runClassifier) ATH_CHECK(m_classifier.retrieve() ); - if ( m_particlesKey=="" ) { - ATH_MSG_FATAL("No truth particle collection provided to use as a basis for new collections"); - return StatusCode::FAILURE; - } else {ATH_MSG_INFO("Using " << m_particlesKey << " as the source collections for new truth collections");} - - if ( m_collectionName=="" ) { - ATH_MSG_FATAL("No key provided for the new truth particle collection"); - return StatusCode::FAILURE; - } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName );} + ATH_CHECK( m_buildTruthTaus.retrieve() ); return StatusCode::SUCCESS; } -StatusCode DerivationFramework::TruthCollectionMakerTau::finalize() -{ - ATH_MSG_VERBOSE("finalize() ..."); - return StatusCode::SUCCESS; -} - // Selection and collection creation StatusCode DerivationFramework::TruthCollectionMakerTau::addBranches() const { ATH_MSG_VERBOSE("addBranches() ..."); - // Retrieve truth collections - const xAOD::TruthParticleContainer* xTruthParticleContainer; - if ( evtStore()->retrieve(xTruthParticleContainer,m_particlesKey).isFailure() ) { - ATH_MSG_ERROR("No TruthParticle collection with name " << m_particlesKey << " found in StoreGate!"); - return StatusCode::FAILURE; - } - - // Create the new containers - xAOD::TruthParticleContainer* newParticleCollection = new xAOD::TruthParticleContainer(); - CHECK( evtStore()->record( newParticleCollection, m_collectionName ) ); - xAOD::TruthParticleAuxContainer* newParticleAuxCollection = new xAOD::TruthParticleAuxContainer(); - CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName + "Aux." ) ); - newParticleCollection->setStore( newParticleAuxCollection ); - ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << m_collectionName); - - if ( !xTruthParticleContainer ) - return Status::SUCCESS; - - for (auto xTruthParticle : *xTruthParticleContainer) - { - if ( xTruthParticle->isTau() ) - { - xAOD::TruthParticle* xTruthTau = new xAOD::TruthParticle(); - xTruthTau->makePrivateStore( *xTruthParticle ); - - if ( examineTruthTau(*xTruthTau).isFailure() ) - { - delete xTruthTau; - continue; - } - - // Run classification - if ( m_runClassifier ) { - std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> classification = m_classifier->particleTruthClassifier(xTruthTau); - unsigned int particleType = classification.first; - unsigned int particleOrigin = classification.second; - xTruthTau->auxdecor<unsigned int>("classifierParticleType") = particleType; - xTruthTau->auxdecor<unsigned int>("classifierParticleOrigin") = particleOrigin; - } - - // create link to the original TruthParticle - ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthParticle, *xTruthParticleContainer); - xTruthTau->auxdata< ElementLink< xAOD::TruthParticleContainer > >("originalTruthParticle" ) = lTruthParticleLink; - - newParticleCollection->push_back(xTruthTau); - } - } - - return StatusCode::SUCCESS; -} - -//______________________________________________________________________________ -StatusCode DerivationFramework::TruthCollectionMakerTau::examineTruthTau(const xAOD::TruthParticle& xTruthParticle) const -{ - // skip this tau if it has no decay vertex, should not happen - if ( !xTruthParticle.hasDecayVtx() ) - return StatusCode::FAILURE; - - ATH_MSG_VERBOSE("looking for charged daughters of a truth tau"); - - m_iNChargedPions = 0; - m_iNNeutralPions = 0; - m_iNChargedOthers = 0; - m_iNNeutralOthers = 0; - m_iNChargedDaughters = 0; - m_vDecayMode.clear(); - - // define truth kinematic variables - m_vTruthVisTLV = TLorentzVector(); - m_vTruthPromptTLV = TLorentzVector(); - m_vTruthVisTLVCharged = TLorentzVector(); - m_vTruthVisTLVNeutral = TLorentzVector(); - - // default false, if there is a hadron in decay products, it is - // switched to true - m_bIsHadronicTau = false; - - const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx(); - if ( !xDecayVertex ) - return StatusCode::FAILURE; - for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle ) - { - const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle); - // if tau decays into tau this is not a proper tau decay - if ( xTruthDaughter->isTau() ) - { - ATH_MSG_VERBOSE("Tau decays into a tau itself -> skip this decay"); - return StatusCode::FAILURE; - } - } - - examineTruthTauDecay(xTruthParticle).ignore(); - - getPromptTLV(xTruthParticle).ignore(); - - ATH_MSG_VERBOSE(m_iNChargedDaughters << " prong truth tau was found with barcode "<<xTruthParticle.barcode()); - if ( m_iNChargedDaughters%2 == 0 ) - { - ATH_MSG_WARNING("found tau with even multiplicity: " << m_iNChargedDaughters); - printDecay(xTruthParticle); - } - - xTruthParticle.auxdecor<double>("pt_vis") = m_vTruthVisTLV.Pt(); - xTruthParticle.auxdecor<double>("eta_vis") = m_vTruthVisTLV.Eta(); - xTruthParticle.auxdecor<double>("phi_vis") = m_vTruthVisTLV.Phi(); - xTruthParticle.auxdecor<double>("m_vis") = m_vTruthVisTLV.M(); - - xTruthParticle.auxdecor<double>("pt_prompt") = m_vTruthPromptTLV.Pt(); - xTruthParticle.auxdecor<double>("eta_prompt") = m_vTruthPromptTLV.Eta(); - xTruthParticle.auxdecor<double>("phi_prompt") = m_vTruthPromptTLV.Phi(); - xTruthParticle.auxdecor<double>("m_prompt") = m_vTruthPromptTLV.M(); - - xTruthParticle.auxdecor<size_t>("numCharged") = m_iNChargedDaughters; - xTruthParticle.auxdecor<size_t>("numChargedPion") = m_iNChargedPions; - xTruthParticle.auxdecor<size_t>("numNeutral") = m_iNNeutralPions+m_iNNeutralOthers; - xTruthParticle.auxdecor<size_t>("numNeutralPion") = m_iNNeutralPions; - - xTruthParticle.auxdecor<char>("IsHadronicTau") = (char)m_bIsHadronicTau; - - if ( m_writeVisibleChargedFourMomentum ) - { - xTruthParticle.auxdecor<double>("pt_vis_charged") = m_vTruthVisTLVCharged.Pt(); - xTruthParticle.auxdecor<double>("eta_vis_charged") = m_vTruthVisTLVCharged.Eta(); - xTruthParticle.auxdecor<double>("phi_vis_charged") = m_vTruthVisTLVCharged.Phi(); - xTruthParticle.auxdecor<double>("m_vis_charged") = m_vTruthVisTLVCharged.M(); - } - if ( m_writeVisibleNeutralFourMomentum ) - { - xTruthParticle.auxdecor<double>("pt_vis_neutral") = m_vTruthVisTLVNeutral.Pt(); - xTruthParticle.auxdecor<double>("eta_vis_neutral") = m_vTruthVisTLVNeutral.Eta(); - xTruthParticle.auxdecor<double>("phi_vis_neutral") = m_vTruthVisTLVNeutral.Phi(); - xTruthParticle.auxdecor<double>("m_vis_neutral") = m_vTruthVisTLVNeutral.M(); - } - - if ( m_writeDecayModeVector ) - xTruthParticle.auxdecor<std::vector<int>>("DecayModeVector") = m_vDecayMode; + // One call to build the truth tau collection + TauAnalysisTools::BuildTruthTaus::TruthTausEvent truthTausEvent; + ATH_CHECK( m_buildTruthTaus->retrieveTruthTaus( truthTausEvent ) ); return StatusCode::SUCCESS; } -//______________________________________________________________________________ -StatusCode DerivationFramework::TruthCollectionMakerTau::examineTruthTauDecay(const xAOD::TruthParticle& xTruthParticle) const -{ - // get vertex and check if it exists - const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx(); - if (!xDecayVertex) - return StatusCode::SUCCESS; - - for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle ) - { - const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle); - int iAbsPdgId = xTruthDaughter->absPdgId(); - int iPdgId = xTruthDaughter->pdgId(); - - // look at decay of unstable particles - if (xTruthDaughter->status() == 2 or xTruthDaughter->status() == 11 or xTruthDaughter->status() == 10902) // 11 for HERWIG++ - { - if ( iAbsPdgId != 111 and iAbsPdgId != 311 and iAbsPdgId != 310 and iAbsPdgId != 130 ) // don't move on for neutral pions and kaons - { - examineTruthTauDecay(*xTruthDaughter).ignore(); - continue; - } - } - - // only process stable particles and neutral pions and kaons - if (xTruthDaughter->status() != 1 and xTruthDaughter->status() != 2) - continue; - - // add pdgID to vector for decay mode classification - m_vDecayMode.push_back(iPdgId); - - // if tau decays leptonically, indicated by an electron/muon neutrino then - // it is not a hadronic decay - if ( xTruthDaughter->isHadron() ) - m_bIsHadronicTau = true; - - // ignore neutrinos for further progress - if ( xTruthDaughter->isNeutrino() ) - { - ATH_MSG_VERBOSE("found neutrino decay particle with PdgId "<<iPdgId); - continue; - } - - // add momentum of non-neutrino particle to visible momentum - m_vTruthVisTLV += xTruthDaughter->p4(); - if ( m_writeVisibleChargedFourMomentum ) - if ( xTruthDaughter->isCharged() ) - m_vTruthVisTLVCharged += xTruthDaughter->p4(); - if ( m_writeVisibleNeutralFourMomentum ) - if ( xTruthDaughter->isNeutral() ) - m_vTruthVisTLVNeutral += xTruthDaughter->p4(); - - // only count charged decay particles - if ( xTruthDaughter->isCharged() ) - { - ATH_MSG_VERBOSE("found charged decay particle with PdgId "<<iPdgId); - m_iNChargedDaughters++; - // count charged pions - if (iAbsPdgId==211) m_iNChargedPions++; - else m_iNChargedOthers++; - } - else - { - ATH_MSG_VERBOSE("found neutral decay particle with PdgId "<<iPdgId); - // count neutral pions - if (iAbsPdgId==111) m_iNNeutralPions++; - else m_iNNeutralOthers++; - } - } - return StatusCode::SUCCESS; -} - -//______________________________________________________________________________ -StatusCode DerivationFramework::TruthCollectionMakerTau::getPromptTLV(const xAOD::TruthParticle& xTruthParticle) const -{ - // get vertex and check if it exists - const xAOD::TruthVertex* xProdVertex = xTruthParticle.prodVtx(); - if (!xProdVertex) - return StatusCode::SUCCESS; - - // if there are more than one incoming particles than the parent is not well defined - if (xProdVertex->nIncomingParticles() != 1) - { - m_vTruthPromptTLV = xTruthParticle.p4(); - return StatusCode::SUCCESS; - } - else - { - // if parent is a tau then proceed to this particle for finding the prompt - // TLV, if it is not a tau, then the current particle is the prompt tau - const xAOD::TruthParticle* xTruthParent = xProdVertex->incomingParticle(0); - - if (xTruthParent->isTau()) - { - return getPromptTLV(*xTruthParent); - } - else - { - m_vTruthPromptTLV = xTruthParticle.p4(); - return StatusCode::SUCCESS; - } - } - - return StatusCode::SUCCESS; -} - -void DerivationFramework :: TruthCollectionMakerTau :: printDecay(const xAOD::TruthParticle& xTruthParticle, int depth) const -{ - // loop over all decay particles, print their kinematic and other properties - - const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx(); - if (!xDecayVertex) - return; - - for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle ) - { - const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle); - ATH_MSG_WARNING("depth "<<depth - <<" e "<<xTruthDaughter->e() - <<" eta "<<xTruthDaughter->p4().Eta() - <<" phi "<<xTruthDaughter->p4().Phi() - <<" pdgid "<<xTruthDaughter->pdgId() - <<" status "<<xTruthDaughter->status() - <<" barcode "<<xTruthDaughter->barcode()); - printDecay(*xTruthDaughter, depth+1); - } -} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthD2Decorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthD2Decorator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..381d667933a375ccab24a6679de8a1474ed145d1 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthD2Decorator.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthD2Decorator.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Robert Les (robert.les@cern.ch) +// + +#include "DerivationFrameworkMCTruth/TruthD2Decorator.h" +#include "xAODJet/JetContainer.h" +#include <vector> +#include <string> + +namespace DerivationFramework { + + TruthD2Decorator::TruthD2Decorator(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t,n,p) + { + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty ("JetContainerKey", m_jetContainerKey = "AntiKt10TruthTrimmedPtFrac5SmallR20Jets", "Name of jet container key for input"); + declareProperty ("DecorationName", m_decorationName = "D2", "Decoration Name"); + + } + + StatusCode TruthD2Decorator::addBranches() const + { + + // Set up the decorators + SG::AuxElement::Decorator< float > decoratorD2(m_decorationName); + + // Get the Large-R jet Container + const xAOD::JetContainer* largeRjets = evtStore()->retrieve< const xAOD::JetContainer >(m_jetContainerKey); + + if(!largeRjets) { + ATH_MSG_ERROR ("Couldn't retrieve JetContainer with key " << m_jetContainerKey.c_str()); + return StatusCode::FAILURE; + } + + // loop over jet collection + for( auto jet: *largeRjets){ + //get ECF + float ecf1 = jet->getAttribute<float>("ECF1"); + float ecf2 = jet->getAttribute<float>("ECF2"); + float ecf3 = jet->getAttribute<float>("ECF3"); + + //calculate D2 and decorate + float D2=-999; + if(fabs(ecf2)>1e-8) + D2=ecf3 * pow(ecf1, 3.0) / pow(ecf2, 3.0); + decoratorD2(*jet) = D2; + } + + return StatusCode::SUCCESS; + } +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDecayCollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDecayCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3b8a33bb0171a972553ef441c4bea26a587b75f --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDecayCollectionMaker.cxx @@ -0,0 +1,216 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthDecayCollectionMaker.cxx +// Removes all truth particles/vertices which do not pass a user-defined cut +// Based on TruthCollectionMaker (but simpler) + +#include "DerivationFrameworkMCTruth/TruthDecayCollectionMaker.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "xAODTruth/TruthVertexAuxContainer.h" +// STL includes +#include <vector> +#include <string> +// For a find in the vector +#include <algorithm> + +// Constructor +DerivationFramework::TruthDecayCollectionMaker::TruthDecayCollectionMaker(const std::string& t, + const std::string& n, + const IInterface* p) + : AthAlgTool(t,n,p) + , m_particlesKey("TruthParticles") + , m_collectionName("") +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("ParticlesKey", m_particlesKey); + declareProperty("NewCollectionName", m_collectionName); + declareProperty("PDGIDsToKeep", m_pdgIdsToKeep={}, "PDG IDs of particles to build the collection from"); + declareProperty("KeepBHadrons", m_keepBHadrons=false, "Keep b-hadrons (easier than by PDG ID)"); + declareProperty("KeepCHadrons", m_keepCHadrons=false, "Keep c-hadrons (easier than by PDG ID)"); + declareProperty("KeepBSM", m_keepBSM=false, "Keep BSM particles (easier than by PDG ID)"); + declareProperty("RejectHadronChildren", m_rejectHadronChildren=false, "Drop hadron descendants"); + declareProperty("Generations", m_generations=-1, "Number of generations after the particle in question to keep (-1 for all)"); +} + +// Destructor +DerivationFramework::TruthDecayCollectionMaker::~TruthDecayCollectionMaker() { +} + +// Athena initialize +StatusCode DerivationFramework::TruthDecayCollectionMaker::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + if (m_particlesKey=="") { + ATH_MSG_FATAL("No truth particle collection provided to use as a basis for new collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("Using " << m_particlesKey << " as the source collections for new truth collections");} + + if (m_collectionName=="") { + ATH_MSG_FATAL("No key provided for the new truth particle collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName );} + + if (m_pdgIdsToKeep.size()==0 && !m_keepBHadrons && !m_keepCHadrons && !m_keepBSM) { + ATH_MSG_FATAL("No PDG IDs provided, not keeping b- or c-hadrons or BSM particles -- what do you want?"); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + + +// Selection and collection creation +StatusCode DerivationFramework::TruthDecayCollectionMaker::addBranches() const +{ + // Retrieve truth collections + const xAOD::TruthParticleContainer* importedTruthParticles(nullptr); + if (evtStore()->retrieve(importedTruthParticles,m_particlesKey).isFailure()) { + ATH_MSG_ERROR("No TruthParticle collection with name " << m_particlesKey << " found in StoreGate!"); + return StatusCode::FAILURE; + } + + // Create the new particle containers + xAOD::TruthParticleContainer* newParticleCollection = new xAOD::TruthParticleContainer(); + CHECK( evtStore()->record( newParticleCollection, m_collectionName + "Particles" ) ); + xAOD::TruthParticleAuxContainer* newParticleAuxCollection = new xAOD::TruthParticleAuxContainer(); + CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName + "ParticlesAux." ) ); + newParticleCollection->setStore( newParticleAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << (m_collectionName+"Particles")); + // Create the new vertex containers + xAOD::TruthVertexContainer* newVertexCollection = new xAOD::TruthVertexContainer(); + CHECK( evtStore()->record( newVertexCollection, m_collectionName + "Vertices" ) ); + xAOD::TruthVertexAuxContainer* newVertexAuxCollection = new xAOD::TruthVertexAuxContainer(); + CHECK( evtStore()->record( newVertexAuxCollection, m_collectionName + "VerticesAux." ) ); + newVertexCollection->setStore( newVertexAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthVertexContainer with key: " << (m_collectionName+"Vertices")); + + // List of barcodes for particles in our collection already. Because of the way we recurse, + // adding more particles as we go, there should be no need to add (or help from adding) the + // barcodes of particles that we are *not* going to keep + std::vector<int> seen_particles; + // Go through that list of particles! + for (auto * part : *importedTruthParticles){ + // If this passes my cuts, keep it + if (id_ok(*part)){ + addTruthParticle( *part, newParticleCollection, newVertexCollection, seen_particles , m_generations ); + } + } // Loop over the initial truth particle collection + return StatusCode::SUCCESS; +} + +int DerivationFramework::TruthDecayCollectionMaker::addTruthParticle( const xAOD::TruthParticle& old_part, xAOD::TruthParticleContainer* part_cont, + xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles, + const int generations) const { + // See if we've seen it - note, could also do this with a unary function on the container itself + if (std::find(seen_particles.begin(),seen_particles.end(),old_part.barcode())!=seen_particles.end()){ + for (size_t p=0;p<part_cont->size();++p){ + // Was it a hit? + if ((*part_cont)[p]->barcode()==old_part.barcode()) return p; + } // Look through the old container + } // Found it in the old container + // Now we have seen it + seen_particles.push_back(old_part.barcode()); + // Set up decorators + const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin"); + const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType"); + const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome"); + const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID"); + const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID"); + // Make a truth particle and add it to the container + xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle(); + part_cont->push_back( xTruthParticle ); + // Make a link to this particle + int my_index = part_cont->size()-1; + ElementLink<xAOD::TruthParticleContainer> eltp(*part_cont, my_index); + // Decay vertex information + if (old_part.hasDecayVtx()) { + int vert_index = addTruthVertex( *old_part.decayVtx(), part_cont, vert_cont, seen_particles, generations); + ElementLink<xAOD::TruthVertexContainer> eltv( *vert_cont, vert_index ); + xTruthParticle->setDecayVtxLink( eltv ); + (*vert_cont)[vert_index]->addIncomingParticleLink( eltp ); + } + // Fill with numerical content + xTruthParticle->setPdgId(old_part.pdgId()); + xTruthParticle->setBarcode(old_part.barcode()); + xTruthParticle->setStatus(old_part.status()); + xTruthParticle->setM(old_part.m()); + xTruthParticle->setPx(old_part.px()); + xTruthParticle->setPy(old_part.py()); + xTruthParticle->setPz(old_part.pz()); + xTruthParticle->setE(old_part.e()); + // Copy over the polarization information if it's there + if (old_part.polarization().valid()){ + xTruthParticle->setPolarizationParameter( old_part.polarizationParameter( xAOD::TruthParticle::polarizationPhi ) , xAOD::TruthParticle::polarizationPhi ); + xTruthParticle->setPolarizationParameter( old_part.polarizationParameter( xAOD::TruthParticle::polarizationTheta ) , xAOD::TruthParticle::polarizationTheta ); + } + // Copy over the decorations if they are available + if (old_part.isAvailable<unsigned int>("classifierParticleType")) { + typeDecorator(*xTruthParticle) = old_part.auxdata< unsigned int >( "classifierParticleType" ); + } else {typeDecorator(*xTruthParticle) = 0;} + if (old_part.isAvailable<unsigned int>("classifierParticleOrigin")) { + originDecorator(*xTruthParticle) = old_part.auxdata< unsigned int >( "classifierParticleOrigin" ); + } else {originDecorator(*xTruthParticle) = 0;} + if (old_part.isAvailable<unsigned int>("classifierParticleOutCome")) { + outcomeDecorator(*xTruthParticle) = old_part.auxdata< unsigned int >( "classifierParticleOutCome" ); + } else {outcomeDecorator(*xTruthParticle) = 0;} + // Return a link to this particle + return my_index; +} + +int DerivationFramework::TruthDecayCollectionMaker::addTruthVertex( const xAOD::TruthVertex& old_vert, xAOD::TruthParticleContainer* part_cont, + xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles, + const int generations) const { + // Make a new vertex and add it to the container + xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex(); + vert_cont->push_back( xTruthVertex ); + // Get a link to this vertex -- will be used to set production vertices on all the next particles + int my_index = vert_cont->size()-1; + ElementLink<xAOD::TruthVertexContainer> eltv(*vert_cont, my_index); + // Set properties + xTruthVertex->setId(old_vert.id()); + xTruthVertex->setBarcode(old_vert.barcode()); + xTruthVertex->setX(old_vert.x()); + xTruthVertex->setY(old_vert.y()); + xTruthVertex->setZ(old_vert.z()); + xTruthVertex->setT(old_vert.t()); + // If we are done, then stop here + if (generations==0) return my_index; + // Add all the outgoing particles + for (size_t n=0;n<old_vert.nOutgoingParticles();++n){ + if (!old_vert.outgoingParticle(n)) continue; // Just in case we removed some truth particles, e.g. G4 decays + if (m_rejectHadronChildren && old_vert.outgoingParticle(n)->isHadron()) { // Option to skip hadrons outright{ + continue; + } + // Continue on the next generation; note that we only decrement the generation if this particle doesn't also pass our cuts + int part_index = addTruthParticle( *old_vert.outgoingParticle(n), part_cont, vert_cont, seen_particles, + generations-1+(id_ok(*old_vert.outgoingParticle(n))?1:0) ); + ElementLink<xAOD::TruthParticleContainer> eltp( *part_cont, part_index); + xTruthVertex->addOutgoingParticleLink( eltp ); + (*part_cont)[part_index]->setProdVtxLink( eltv ); + } + // Return a link to this vertex + return my_index; +} + +bool DerivationFramework::TruthDecayCollectionMaker::id_ok( const xAOD::TruthParticle& part ) const +{ + // Check list of PDG IDs to keep + for (int id : m_pdgIdsToKeep){ + if (part.absPdgId()==id){ + return true; + } // Found a particle of interest! + } // Loop over the PDG IDs we want to keep + // Also check functions for B/C/BSM + if ((m_keepBHadrons && part.isBottomHadron()) || + (m_keepCHadrons && part.isCharmHadron()) || + (m_keepBSM && part.isBSM()) ){ + return true; + } + return false; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDressingTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDressingTool.cxx index 974556b041318998b67a46a037bcf310609ebc97..0c5a0d59db03a6a3799b258587cc349604050ae2 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDressingTool.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthDressingTool.cxx @@ -3,8 +3,7 @@ */ ///////////////////////////////////////////////////////////////// -// TruthDressingTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// +// TruthDressingTool.cxx // Author: Kevin Finelli (kevin.finelli@cern.ch) // Create dressed (i.e. including FSR photons) 4-vectors of truth objects @@ -20,8 +19,8 @@ // Constructor DerivationFramework::TruthDressingTool::TruthDressingTool(const std::string& t, const std::string& n, - const IInterface* p ) : - AthAlgTool(t,n,p) + const IInterface* p ) + : AthAlgTool(t,n,p) { declareInterface<DerivationFramework::IAugmentationTool>(this); declareProperty ("particlesKey", @@ -38,7 +37,9 @@ DerivationFramework::TruthDressingTool::TruthDressingTool(const std::string& t, declareProperty ("particleIDsToDress", m_listOfPIDs = std::vector<int>{11,13}, "List of the pdgID's of particles to be dressed (usually 11,13). Special treatment for taus (15)"); declareProperty ("useAntiKt", m_useAntiKt = false, - "use anti-k_T in addition to fixed-cone dressing"); + "use anti-k_T instead of fixed-cone dressing"); + declareProperty ("decorationName", m_decorationName = "", + "Name of the decoration for photons that were used in dressing"); } @@ -72,31 +73,31 @@ StatusCode DerivationFramework::TruthDressingTool::addBranches() const ATH_MSG_ERROR("No TruthParticleContainer with name " << m_dressParticlesKey << " found in StoreGate!"); return StatusCode::FAILURE; } - SG::AuxElement::Decorator< float > decorator_e("e_dressed"); - SG::AuxElement::Decorator< float > decorator_pt("pt_dressed"); - SG::AuxElement::Decorator< float > decorator_eta("eta_dressed"); - SG::AuxElement::Decorator< float > decorator_phi("phi_dressed"); + const static SG::AuxElement::Decorator< float > decorator_e("e_dressed"); + const static SG::AuxElement::Decorator< float > decorator_pt("pt_dressed"); + const static SG::AuxElement::Decorator< float > decorator_eta("eta_dressed"); + const static SG::AuxElement::Decorator< float > decorator_phi("phi_dressed"); // for truth taus, use 'vis' in the decoration name to avoid prompt/visible tau momentum ambiguity // use (pt,eta,phi,m) for taus, for consistency with other TauAnalysisTools decorations - SG::AuxElement::Decorator< float > decorator_pt_vis("pt_vis_dressed"); - SG::AuxElement::Decorator< float > decorator_eta_vis("eta_vis_dressed"); - SG::AuxElement::Decorator< float > decorator_phi_vis("phi_vis_dressed"); - SG::AuxElement::Decorator< float > decorator_m_vis("m_vis_dressed"); - - SG::AuxElement::Decorator< int > decorator_nphoton("nPhotons_dressed"); - - //anti-kt dressing - SG::AuxElement::Decorator< float > decorator_e_akt("e_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_pt_akt("pt_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_eta_akt("eta_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_phi_akt("phi_dressed_akt"); - - // anti-kt for truth taus - SG::AuxElement::Decorator< float > decorator_pt_vis_akt("pt_vis_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_eta_vis_akt("eta_vis_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_phi_vis_akt("phi_vis_dressed_akt"); - SG::AuxElement::Decorator< float > decorator_m_vis_akt("m_vis_dressed_akt"); + const static SG::AuxElement::Decorator< float > decorator_pt_vis("pt_vis_dressed"); + const static SG::AuxElement::Decorator< float > decorator_eta_vis("eta_vis_dressed"); + const static SG::AuxElement::Decorator< float > decorator_phi_vis("phi_vis_dressed"); + const static SG::AuxElement::Decorator< float > decorator_m_vis("m_vis_dressed"); + + const static SG::AuxElement::Decorator< int > decorator_nphoton("nPhotons_dressed"); + + // One for the photons as well + std::string decorationName = m_decorationName.empty()?"unusedPhotonDecoration":m_decorationName; + const static SG::AuxElement::Decorator< char > dressDec (decorationName); + // If we want to decorate, then we need to decorate everything with false to begin with + if (!m_decorationName.empty()){ + for (const auto * particle : *importedTruthParticles){ + if (!particle->isAvailable<char>(decorationName)) { + dressDec(*particle); + } + } // Loop over particles + } // We are using the decoration //get struct of helper functions DerivationFramework::DecayGraphHelper decayHelper; @@ -126,65 +127,71 @@ StatusCode DerivationFramework::TruthDressingTool::addBranches() const std::vector<int> photonPID{22}; decayHelper.constructListOfFinalParticles(importedTruthParticles, photonsFSRList, photonPID, m_usePhotonsFromHadrons); - //loop over photons, uniquely associate each to nearest bare particle - for (const auto& phot : photonsFSRList ) { - double dRmin = m_coneSize; - int idx = -1; - - for (size_t i = 0; i < listOfParticlesToDress.size(); ++i) { - xAOD::TruthParticle::FourMom_t bare_part; - if(abs(listOfParticlesToDress[i]->pdgId())==15) { - - if( !listOfParticlesToDress[i]->isAvailable<double>("pt_vis") || - !listOfParticlesToDress[i]->isAvailable<double>("eta_vis") || - !listOfParticlesToDress[i]->isAvailable<double>("phi_vis") || - !listOfParticlesToDress[i]->isAvailable<double>("m_vis")) { - ATH_MSG_ERROR("Visible momentum not available for truth taus, cannot perform dressing!"); - return StatusCode::FAILURE; + // Do dR-based photon dressing (default) + if (!m_useAntiKt){ + //loop over photons, uniquely associate each to nearest bare particle + for (const auto& phot : photonsFSRList ) { + double dRmin = m_coneSize; + int idx = -1; + + for (size_t i = 0; i < listOfParticlesToDress.size(); ++i) { + xAOD::TruthParticle::FourMom_t bare_part; + if(abs(listOfParticlesToDress[i]->pdgId())==15) { + + if( !listOfParticlesToDress[i]->isAvailable<double>("pt_vis") || + !listOfParticlesToDress[i]->isAvailable<double>("eta_vis") || + !listOfParticlesToDress[i]->isAvailable<double>("phi_vis") || + !listOfParticlesToDress[i]->isAvailable<double>("m_vis")) { + ATH_MSG_ERROR("Visible momentum not available for truth taus, cannot perform dressing!"); + return StatusCode::FAILURE; + } + + bare_part.SetPtEtaPhiM(listOfParticlesToDress[i]->auxdata<double>("pt_vis"), + listOfParticlesToDress[i]->auxdata<double>("eta_vis"), + listOfParticlesToDress[i]->auxdata<double>("phi_vis"), + listOfParticlesToDress[i]->auxdata<double>("m_vis")); + } + else { + bare_part = listOfParticlesToDress[i]->p4(); + } + + double dR = bare_part.DeltaR(phot->p4()); + if (dR < dRmin) { + dRmin = dR; + idx = i; } - - bare_part.SetPtEtaPhiM(listOfParticlesToDress[i]->auxdata<double>("pt_vis"), - listOfParticlesToDress[i]->auxdata<double>("eta_vis"), - listOfParticlesToDress[i]->auxdata<double>("phi_vis"), - listOfParticlesToDress[i]->auxdata<double>("m_vis")); - } - else { - bare_part = listOfParticlesToDress[i]->p4(); } - - double dR = bare_part.DeltaR(phot->p4()); - if (dR < dRmin) { - dRmin = dR; - idx = i; + + if(idx > -1) { + listOfDressedParticles[idx] += phot->p4(); + dressedParticlesNPhot[idx]++; + if (!m_decorationName.empty()){ + dressDec(*phot) = 1; + } } } - - if(idx > -1) { - listOfDressedParticles[idx] += phot->p4(); - dressedParticlesNPhot[idx]++; - } - } - - //loop over particles and add decorators - //for (const auto& part : listOfDressedParticles) { - for (size_t i = 0; i < listOfParticlesToDress.size(); ++i) { - const xAOD::TruthParticle* part = listOfParticlesToDress[i]; - xAOD::TruthParticle::FourMom_t& dressedVec = listOfDressedParticles[i]; - - if(abs(part->pdgId())==15) { - decorator_pt_vis(*part) = dressedVec.Pt(); - decorator_eta_vis(*part) = dressedVec.Eta(); - decorator_phi_vis(*part) = dressedVec.Phi(); - decorator_m_vis(*part) = dressedVec.M(); - } - else { - decorator_e(*part) = dressedVec.E(); - decorator_pt(*part) = dressedVec.Pt(); - decorator_eta(*part) = dressedVec.Eta(); - decorator_phi(*part) = dressedVec.Phi(); + + //loop over particles and add decorators + //for (const auto& part : listOfDressedParticles) { + for (size_t i = 0; i < listOfParticlesToDress.size(); ++i) { + const xAOD::TruthParticle* part = listOfParticlesToDress[i]; + xAOD::TruthParticle::FourMom_t& dressedVec = listOfDressedParticles[i]; + + if(abs(part->pdgId())==15) { + decorator_pt_vis(*part) = dressedVec.Pt(); + decorator_eta_vis(*part) = dressedVec.Eta(); + decorator_phi_vis(*part) = dressedVec.Phi(); + decorator_m_vis(*part) = dressedVec.M(); + } + else { + decorator_e(*part) = dressedVec.E(); + decorator_pt(*part) = dressedVec.Pt(); + decorator_eta(*part) = dressedVec.Eta(); + decorator_phi(*part) = dressedVec.Phi(); + } + decorator_nphoton(*part) = dressedParticlesNPhot[i]; } - decorator_nphoton(*part) = dressedParticlesNPhot[i]; - } + } // end of the dR matching part //build the anti-kt jet list if (m_useAntiKt) { @@ -220,6 +227,8 @@ StatusCode DerivationFramework::TruthDressingTool::addBranches() const fastjet::ClusterSequence cseq(fj_particles, jet_def); sorted_jets = sorted_by_pt(cseq.inclusive_jets(0)); //associate clustered jets back to bare particles + std::vector<int> photon_barcodes(50); + photon_barcodes.clear(); for (const auto& part : listOfParticlesToDress) { //loop over fastjet pseudojets and associate one with this particle by barcode bool found=false; @@ -233,41 +242,55 @@ StatusCode DerivationFramework::TruthDressingTool::addBranches() const // to decorate leptons with the number of dressing photons found by the anti-kt algorithm? if(abs(part->pdgId())==15) { - decorator_pt_vis_akt(*part) = pjItr->pt(); - decorator_eta_vis_akt(*part) = pjItr->pseudorapidity(); - decorator_phi_vis_akt(*part) = pjItr->phi_std(); //returns phi in [-pi,pi] - decorator_m_vis_akt(*part) = pjItr->m(); + decorator_pt_vis(*part) = pjItr->pt(); + decorator_eta_vis(*part) = pjItr->pseudorapidity(); + decorator_phi_vis(*part) = pjItr->phi_std(); //returns phi in [-pi,pi] + decorator_m_vis(*part) = pjItr->m(); } else { - decorator_e_akt(*part) = pjItr->e(); - decorator_pt_akt(*part) = pjItr->pt(); - decorator_eta_akt(*part) = pjItr->pseudorapidity(); - decorator_phi_akt(*part) = pjItr->phi_std(); //returns phi in [-pi,pi] + decorator_e(*part) = pjItr->e(); + decorator_pt(*part) = pjItr->pt(); + decorator_eta(*part) = pjItr->pseudorapidity(); + decorator_phi(*part) = pjItr->phi_std(); //returns phi in [-pi,pi] } found=true; break; - } - - } + } // Found the matching barcode + } // Loop over the jet constituents + if (found){ + for(const auto& constit : constituents) { + photon_barcodes.push_back(constit.user_index()); + } // Loop over the constituents + } // Found one of the key leptons in this jet ++pjItr; } if (!found) { if(abs(part->pdgId())==15) { - decorator_pt_vis_akt(*part) = 0.; - decorator_eta_vis_akt(*part) = 0.; - decorator_phi_vis_akt(*part) = 0.; - decorator_m_vis_akt(*part) = 0.; + decorator_pt_vis(*part) = 0.; + decorator_eta_vis(*part) = 0.; + decorator_phi_vis(*part) = 0.; + decorator_m_vis(*part) = 0.; } else { - decorator_e_akt(*part) = 0; - decorator_pt_akt(*part) = 0; - decorator_eta_akt(*part) = 0; - decorator_phi_akt(*part) = 0; + decorator_e(*part) = 0; + decorator_pt(*part) = 0; + decorator_eta(*part) = 0; + decorator_phi(*part) = 0; } ATH_MSG_WARNING("Bare particle not found in constituents "); } } - } + // Check if we wanted to decorate photons used for dressing + if (!m_decorationName.empty()){ + //loop over photons, uniquely associate each to nearest bare particle + for (const auto& phot : photonsFSRList ) { + bool found=std::find(photon_barcodes.begin(),photon_barcodes.end(),phot->barcode())!=photon_barcodes.end(); + if (found){ + dressDec(*phot) = 1; + } + } // End of loop over photons + } // End of decoration of photons used in dressing + } // End of anti-kT dressing return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthIsolationTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthIsolationTool.cxx index 849c1eed00251357c05acd8fc17ca8c27b2b897a..536a89755304e3b16e7df77925fca0675bb04937 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthIsolationTool.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthIsolationTool.cxx @@ -3,14 +3,14 @@ */ ///////////////////////////////////////////////////////////////// -// TruthIsolationTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// +// TruthIsolationTool.cxx // Author: Kevin Finelli (kevin.finelli@cern.ch) // Calculate isolation at truth level for given lists of truth particles #include "DerivationFrameworkMCTruth/TruthIsolationTool.h" #include "xAODTruth/TruthEventContainer.h" #include "HepPID/ParticleIDMethods.hh" +#include "TruthUtils/PIDHelpers.h" #include <vector> #include <string> #include <algorithm> @@ -37,10 +37,13 @@ DerivationFramework::TruthIsolationTool::TruthIsolationTool(const std::string& t declareProperty ("particleIDsToCalculate", m_listOfPIDs = std::vector<int>{11,13,22}, "List of the pdgIDs of particles for which to calculate isolation"); declareProperty ("excludeIDsFromCone", m_excludeFromCone = std::vector<int>(), - "List of the pdgIDs of particles to exclude from the cone when calculating isolation"); + "List of the pdgIDs of particles to exclude from the cone when calculating isolation"); declareProperty ("IsolationVarNamePrefix", m_isoVarNamePrefix, "Prefix of name of the variable to add to output xAOD"); - + declareProperty ("IncludeNonInteracting", m_includeNonInteracting=false, + "Include non-interacting particles in the isolation definition"); + declareProperty ("VariableR", m_variableR = false, + "Use radius that shrinks with pT in isolation"); m_coneSizes2 = new std::vector<float>(); m_coneSizesSort = new std::vector<float>(); } @@ -86,6 +89,7 @@ StatusCode DerivationFramework::TruthIsolationTool::addBranches() const std::vector<SG::AuxElement::Decorator< float > > decorators_iso; for ( auto csize_itr : *m_coneSizesSort ) { std::ostringstream sizess; + if (m_variableR) sizess << "var"; sizess << m_isoVarNamePrefix << (int)((csize_itr)*100.); decorators_iso.push_back( SG::AuxElement::Decorator< float >(sizess.str()) ); } @@ -138,10 +142,16 @@ void DerivationFramework::TruthIsolationTool::calcIsos(const xAOD::TruthParticle //skip if we find a particle in the exclude list continue; } + if (!m_includeNonInteracting && MC::isNonInteracting(cand_part->pdgId())){ + // Do not include non-interacting particles, and this particle is non-interacting + continue; + } if (cand_part->barcode() != particle->barcode()) { //iteration over sorted cone sizes for ( unsigned int icone = 0; icone < m_coneSizes2->size(); ++icone ) { - if (calculateDeltaR2(cand_part, part_eta, part_phi) < m_coneSizes2->at(icone) ) { + float dr2 = calculateDeltaR2(cand_part, part_eta, part_phi); + if (dr2 < m_coneSizes2->at(icone) && + (!m_variableR || dr2*particle->pt()*particle->pt() < 100000000.)) { //sum the transverse momenta isoCalcs.at(icone) = isoCalcs.at(icone) + cand_part->pt(); } else { diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..586662c88c93009e147b803705515c5a7badcfd6 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.cxx @@ -0,0 +1,122 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthLinkRepointTool.cxx +// Truth links on some objects point to the main truth particle +// container, or to some other container that won't be saved in the +// output derivation. This re-points the links from the old +// container to the new container (and serves as a chance to clean +// up / harmonize the names of the decorations). + +#include "TruthLinkRepointTool.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODTruth/xAODTruthHelpers.h" +#include "xAODTruth/TruthParticleContainer.h" +#include <string> +#include <vector> + +// Constructor +DerivationFramework::TruthLinkRepointTool::TruthLinkRepointTool(const std::string& t, + const std::string& n, + const IInterface* p ) : + AthAlgTool(t,n,p) +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + + declareProperty ("RecoCollection", m_recoKey = "Muons", "Name of reco collection for decoration"); + declareProperty ("OutputDecoration", m_decOutput = "TruthLink", "Name of the output decoration on the reco object"); + declareProperty ("TargetCollections", m_targetKeys = {"TruthMuons","TruthPhotons","TruthElectrons"}, "Name of target truth collections"); +} + +// Destructor +DerivationFramework::TruthLinkRepointTool::~TruthLinkRepointTool() { +} + +// Function to do dressing, implements interface in IAugmentationTool +StatusCode DerivationFramework::TruthLinkRepointTool::addBranches() const +{ + // Retrieve the truth collections + const std::vector<DataHandle<xAOD::TruthParticleContainer> > target(m_targetKeys.size(),nullptr); + for (size_t i=0;i<m_targetKeys.size();++i) ATH_CHECK(evtStore()->retrieve(target[i], m_targetKeys[i])); + + SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > output_decorator(m_decOutput); + + // Handle separate cases: Photons, Electrons, Muons, Jets + if (std::string::npos!=m_recoKey.find("Electron")){ + const DataHandle<xAOD::ElectronContainer> inputCont(nullptr); + ATH_CHECK(evtStore()->retrieve(inputCont, m_recoKey)); + for (auto input : *inputCont){ + const xAOD::TruthParticle* truthPart = xAOD::TruthHelpers::getTruthParticle(*input); + int index = -1; + for (size_t i=0;i<m_targetKeys.size() && index<0 && truthPart;++i){ + index = find_match(truthPart,target[i]); + if (index>=0) output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(*(target[i]),index); + } + if (index<0){ + if (truthPart){ + ATH_MSG_DEBUG("No particle with barcode " << truthPart->barcode() << " PDG ID " << truthPart->pdgId() + << " pT=" << truthPart->pt()*0.001 << " GeV and status " << truthPart->status() + << " found in " << m_targetKeys.size() << " target containers"); + } + output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(); + } + } // Loop over input particles + } else if (std::string::npos!=m_recoKey.find("Photon")){ + const DataHandle<xAOD::PhotonContainer> inputCont(nullptr); + ATH_CHECK(evtStore()->retrieve(inputCont, m_recoKey)); + for (auto input : *inputCont){ + const xAOD::TruthParticle* truthPart = xAOD::TruthHelpers::getTruthParticle(*input); + int index = -1; + for (size_t i=0;i<m_targetKeys.size() && index<0 && truthPart;++i){ + index = find_match(truthPart,target[i]); + if (index>=0) output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(*(target[i]),index); + } + if (index<0){ + if (truthPart){ + ATH_MSG_DEBUG("No particle with barcode " << truthPart->barcode() << " PDG ID " << truthPart->pdgId() + << " pT=" << truthPart->pt()*0.001 << " GeV and status " << truthPart->status() + << " found in " << m_targetKeys.size() << " target containers"); + } + output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(); + } + } // Loop over input particles + } else if (std::string::npos!=m_recoKey.find("Muon")){ + const DataHandle<xAOD::MuonContainer> inputCont(nullptr); + ATH_CHECK(evtStore()->retrieve(inputCont, m_recoKey)); + for (auto input : *inputCont){ + const xAOD::TruthParticle* truthPart = xAOD::TruthHelpers::getTruthParticle(*input); + int index = -1; + for (size_t i=0;i<m_targetKeys.size() && index<0 && truthPart;++i){ + index = find_match(truthPart,target[i]); + if (index>=0) output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(*(target[i]),index); + } + if (index<0){ + if (truthPart){ + ATH_MSG_DEBUG("No particle with barcode " << truthPart->barcode() << " PDG ID " << truthPart->pdgId() + << " pT=" << truthPart->pt()*0.001 << " GeV and status " << truthPart->status() + << " found in " << m_targetKeys.size() << " target containers"); + } + output_decorator(*input) = ElementLink<xAOD::TruthParticleContainer>(); + } + } // Loop over input particles + } + + return StatusCode::SUCCESS; +} + +// Find a match by barcode in a different container +int DerivationFramework::TruthLinkRepointTool::find_match(const xAOD::TruthParticle* p, const DataHandle<xAOD::TruthParticleContainer> & c) const +{ + // See if it's already gone + if (!p) return -1; + // Look through the mini-collection + for (int i=0;i<int(c->size());++i){ + if (c->at(i) && p->barcode()==c->at(i)->barcode()) return i; + } + // Note: just fine if it wasn't in the mini-collection + return -1; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d2fdff6479bb42cad2dadf75704bb91f97942fc5 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthLinkRepointTool.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TruthLinkRepointTool_H +#define DERIVATIONFRAMEWORK_TruthLinkRepointTool_H + +// Interface classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +// Types for functions. Note these are typedefs, so can't forward reference. +#include "xAODTruth/TruthParticleContainer.h" + +// STL includes +#include <string> +#include <vector> + +namespace DerivationFramework { + + class TruthLinkRepointTool : public AthAlgTool, public IAugmentationTool { + public: + TruthLinkRepointTool(const std::string& t, const std::string& n, const IInterface* p); + ~TruthLinkRepointTool(); + virtual StatusCode addBranches() const override final; + + private: + /// Parameter: input collection key + std::string m_recoKey; + /// Parameter: output decoration + std::string m_decOutput; + /// Parameter: target collection + std::vector<std::string> m_targetKeys; + // Helper function for finding matching truth particle and warning consistently + int find_match(const xAOD::TruthParticle* p, const DataHandle<xAOD::TruthParticleContainer> & c) const; + }; +} + +#endif // DERIVATIONFRAMEWORK_TruthLinkRepointTool_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bbdccd83b2019684c7f98def3cbbe92c077a73b3 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.cxx @@ -0,0 +1,143 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthNavigationDecorator.cxx +// Add navigation information to small truth collections + +#include "TruthNavigationDecorator.h" +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include <string> +#include <vector> +#include <map> + +// Constructor +DerivationFramework::TruthNavigationDecorator::TruthNavigationDecorator(const std::string& t, + const std::string& n, + const IInterface* p ) : + AthAlgTool(t,n,p) +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty ("InputCollections", m_inputKeys = {}); +} + +// Destructor +DerivationFramework::TruthNavigationDecorator::~TruthNavigationDecorator() { +} + +// Function to do dressing, implements interface in IAugmentationTool +StatusCode DerivationFramework::TruthNavigationDecorator::addBranches() const +{ + // Retrieve the truth collections + const DataHandle<xAOD::TruthEventContainer> truthEvents(nullptr); + CHECK(evtStore()->retrieve(truthEvents, "TruthEvents")); + + // Retrieve all the individual particle collections + // Either use DataHandles or reserve the memory; these are just pointers, so the reserve is not such a big deal? + std::vector< DataHandle<xAOD::TruthParticleContainer> > inputParticles; + for (size_t k=0;k<m_inputKeys.size();++k){ + inputParticles.push_back(nullptr); + CHECK(evtStore()->retrieve(inputParticles[k],m_inputKeys[k])); + } + + // Build a dictionary of barcodes and element links + std::map<int,ElementLink<xAOD::TruthParticleContainer> > linkMap; + for (auto coll : inputParticles){ + for (size_t p=0;p<coll->size();++p){ + if (!coll->at(p)) continue; // Protection against null ptrs + if (linkMap.find(coll->at(p)->barcode())!=linkMap.end()) continue; // Particle in multiple collections + linkMap[coll->at(p)->barcode()] = ElementLink<xAOD::TruthParticleContainer>(*coll,p); + } // Loop over particles in the collection + } // Loop over collections + + // Naming to be consistent with xAOD::TruthParticle + SG::AuxElement::Decorator< std::vector<ElementLink<xAOD::TruthParticleContainer> > > parent_decorator("parentLinks"); + SG::AuxElement::Decorator< std::vector<ElementLink<xAOD::TruthParticleContainer> > > child_decorator("childLinks"); + + // Now loop over the collections and for each one decorate children and parents + // The list of particles we keep is small-ish, and the list of particles in the + // original truth record is large-ish, so I think it will be more efficient to + // do a loop (O(N)) over the big record and a search (O(Nlog(N))) over the small + // container. Future performance optimization is welcome... + + // Keep maps, do the decoration last. This ensures that duplicates all get decorated. + std::map< int , std::vector<ElementLink<xAOD::TruthParticleContainer> > > parentMap; + std::map< int , std::vector<ElementLink<xAOD::TruthParticleContainer> > > childMap; + + // Loop protection + std::vector<int> seen_particles(20); + // As usual, only consider the first truth event + const xAOD::TruthEvent * event = truthEvents->at(0); + for (size_t p=0;p<event->nTruthParticles();++p){ + if (!event->truthParticle(p)) continue; // Protection against null ptrs + if (linkMap.find(event->truthParticle(p)->barcode())==linkMap.end()) continue; // Not a particle we are interested in + // Make parent and child lists + std::vector<ElementLink<xAOD::TruthParticleContainer> > parents; + std::vector<ElementLink<xAOD::TruthParticleContainer> > children; + // Populate the lists - include loop protection + seen_particles.clear(); + find_parents( event->truthParticle(p) , parents , linkMap , seen_particles ); + seen_particles.clear(); + find_children( event->truthParticle(p) , children , linkMap , seen_particles ); + // Set the maps, so that we can decorate later + parentMap[event->truthParticle(p)->barcode()] = parents; + childMap[event->truthParticle(p)->barcode()] = children; + } // Loop over truth particles in the big truth collection + + // Now final loop over the collections and setting all the decorators + for (auto coll : inputParticles){ + for (size_t p=0;p<coll->size();++p){ + if (!coll->at(p)) continue; // Protection against null ptrs + parent_decorator(*coll->at(p)) = parentMap[ coll->at(p)->barcode() ]; + child_decorator(*coll->at(p)) = childMap[ coll->at(p)->barcode() ]; + } // Loop over the particles in each collection + } // Loop over the collections + + return StatusCode::SUCCESS; +} + +void DerivationFramework::TruthNavigationDecorator::find_parents( const xAOD::TruthParticle* part , + std::vector<ElementLink<xAOD::TruthParticleContainer> >& parents , + std::map<int,ElementLink<xAOD::TruthParticleContainer> >& linkMap , + std::vector<int>& seen_particles ) const { + // Null pointer protection + if (!part) return; + // Check if we've seen the particle before, otherwise add it to our list + if (std::find(seen_particles.begin(),seen_particles.end(),part->barcode())!=seen_particles.end()) return; + seen_particles.push_back(part->barcode()); + // Loop through the parents and see if we know about them; otherwise iterate through the list + for (size_t parent=0;parent<part->nParents();++parent){ + if (!part->parent(parent)) continue; // Null pointer check + if (linkMap.find(part->parent(parent)->barcode())!=linkMap.end()){ + // Hit! Add it to the list + parents.push_back( linkMap[part->parent(parent)->barcode()] ); + } else { + // Not a hit yet, keep iterating + find_parents( part->parent(parent) , parents , linkMap , seen_particles ); + } + } // Loop over parents +} + +void DerivationFramework::TruthNavigationDecorator::find_children( const xAOD::TruthParticle* part , + std::vector<ElementLink<xAOD::TruthParticleContainer> >& children , + std::map<int,ElementLink<xAOD::TruthParticleContainer> >& linkMap , + std::vector<int>& seen_particles ) const { + // Null pointer protection + if (!part) return; + // Check if we've seen the particle before, otherwise add it to our list + if (std::find(seen_particles.begin(),seen_particles.end(),part->barcode())!=seen_particles.end()) return; + seen_particles.push_back(part->barcode()); + // Look through the children and see if we know about them; otherwise iterate through the list + for (size_t child=0;child<part->nChildren();++child){ + if (!part->child(child)) continue; // Null pointer check + if (linkMap.find(part->child(child)->barcode())!=linkMap.end()){ + // Hit! Add it to the list + children.push_back( linkMap[part->child(child)->barcode()] ); + } else { + // Not a hit yet, keep iterating + find_children( part->child(child) , children , linkMap , seen_particles ); + } + } // Loop over parents +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.h new file mode 100644 index 0000000000000000000000000000000000000000..177804c2d5d7ad418fb29358fd74bcf5ec8b0dab --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthNavigationDecorator.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef DERIVATIONFRAMEWORK_TRUTHNAVIGATIONDECORATOR_H +#define DERIVATIONFRAMEWORK_TRUTHNAVIGATIONDECORATOR_H + +// Interface classes +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" + +// EDM includes -- typedefs, so can't just be forward declared +#include "xAODTruth/TruthParticleContainer.h" + +// STL includes +#include <string> +#include <vector> + +namespace DerivationFramework { + + class TruthNavigationDecorator : public AthAlgTool, public IAugmentationTool { + public: + TruthNavigationDecorator(const std::string& t, const std::string& n, const IInterface* p); + ~TruthNavigationDecorator(); + virtual StatusCode addBranches() const; + + private: + /// Parameter: input particle collections + std::vector<std::string> m_inputKeys; + /// Helper function for finding all the parents of a particle + void find_parents( const xAOD::TruthParticle* part , + std::vector<ElementLink<xAOD::TruthParticleContainer> >& parents , + std::map<int,ElementLink<xAOD::TruthParticleContainer> >& linkMap , + std::vector<int>& seen_particles ) const; + /// Helper function for finding all the children of a particle + void find_children( const xAOD::TruthParticle* part , + std::vector<ElementLink<xAOD::TruthParticleContainer> >& parents , + std::map<int,ElementLink<xAOD::TruthParticleContainer> >& linkMap , + std::vector<int>& seen_particles ) const; + }; +} + +#endif // DERIVATIONFRAMEWORK_TRUTHNAVIGATIONDECORATOR_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthPVCollectionMaker.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthPVCollectionMaker.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d786b9a127b5ebd6dba7c6cfeae0144ae5fa151d --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthPVCollectionMaker.cxx @@ -0,0 +1,99 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthPVCollectionMaker.cxx +// Makes a small collection of 'primary' vertices, one per event +// A bit like a collection of 'reconstructable' vertices +// Future option: try to add b-decay vertices, or LLP vertices? + +#include "DerivationFrameworkMCTruth/TruthPVCollectionMaker.h" +#include "xAODTruth/TruthEventContainer.h" +#include "xAODTruth/TruthVertexContainer.h" +#include "xAODTruth/TruthVertexAuxContainer.h" +// STL includes +#include <string> + +// Constructor +DerivationFramework::TruthPVCollectionMaker::TruthPVCollectionMaker(const std::string& t, + const std::string& n, + const IInterface* p) + : AthAlgTool(t,n,p) + , m_eventsKey("TruthEvents") + , m_collectionName("") +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty("EventsKey", m_eventsKey); + declareProperty("NewCollectionName", m_collectionName); +} + +// Destructor +DerivationFramework::TruthPVCollectionMaker::~TruthPVCollectionMaker() { +} + +// Athena initialize +StatusCode DerivationFramework::TruthPVCollectionMaker::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + // Check configuration, print errors, warning, and information for the user + if (m_eventsKey=="") { + ATH_MSG_FATAL("No truth event collection provided to use as a basis for new collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("Using " << m_eventsKey << " as the source collections for new truth collections");} + if (m_collectionName=="") { + ATH_MSG_FATAL("No key provided for the new truth vertex collections"); + return StatusCode::FAILURE; + } else {ATH_MSG_INFO("New truth vertex collection key: " << m_collectionName );} + + return StatusCode::SUCCESS; +} + + +// Selection and collection creation +StatusCode DerivationFramework::TruthPVCollectionMaker::addBranches() const +{ + // Retrieve truth collections + const xAOD::TruthEventContainer* importedTruthEvents(nullptr); + if (evtStore()->retrieve(importedTruthEvents,m_eventsKey).isFailure()) { + ATH_MSG_ERROR("No TruthEvent collection with name " << m_eventsKey << " found in StoreGate!"); + return StatusCode::FAILURE; + } + + // Create the new vertex containers + xAOD::TruthVertexContainer* newVertexCollection = new xAOD::TruthVertexContainer(); + CHECK( evtStore()->record( newVertexCollection, m_collectionName ) ); + xAOD::TruthVertexAuxContainer* newVertexAuxCollection = new xAOD::TruthVertexAuxContainer(); + CHECK( evtStore()->record( newVertexAuxCollection, m_collectionName + "Aux." ) ); + newVertexCollection->setStore( newVertexAuxCollection ); + ATH_MSG_DEBUG( "Recorded new TruthVertexContainer with key: " << m_collectionName); + + // Go through the events, add one vertex for each event + for (auto * event : *importedTruthEvents){ + // Just in case there is a place-holder + if (!event) continue; + // Try with the signal process vertex + const xAOD::TruthVertex* old_vert(event->signalProcessVertex()); + // If that's not there, grab the first vertex + if (!old_vert && event->nTruthVertices()>0){ + old_vert = event->truthVertex(0); + } + if (old_vert){ + // Hit -- copy it! + // Make a new vertex and add it to the container + xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex(); + newVertexCollection->push_back( xTruthVertex ); + // Set properties + xTruthVertex->setId(old_vert->id()); + xTruthVertex->setBarcode(old_vert->barcode()); + xTruthVertex->setX(old_vert->x()); + xTruthVertex->setY(old_vert->y()); + xTruthVertex->setZ(old_vert->z()); + xTruthVertex->setT(old_vert->t()); + } else { + ATH_MSG_WARNING("No signal vertex or vertices associated to an input event!"); + } + } + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthQGDecorationTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthQGDecorationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..42540612ff5b15a2c78a8db3087b604ca17ef110 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthQGDecorationTool.cxx @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// TruthQGDecorationTool.cxx +// Create a single decoration for flavor tagging of truth jets + +#include "DerivationFrameworkMCTruth/TruthQGDecorationTool.h" +#include "xAODJet/JetContainer.h" +#include <string> + +// Constructor +DerivationFramework::TruthQGDecorationTool::TruthQGDecorationTool(const std::string& t, + const std::string& n, + const IInterface* p ) : + AthAlgTool(t,n,p) +{ + declareInterface<DerivationFramework::IAugmentationTool>(this); + declareProperty ("JetCollection", + m_jetsKey = "AntiKt4TruthWZJets", + "Name of jet collection for decoration"); + declareProperty ("OutputDecoration", + m_decOutput = "TrueFlavor", + "Name of the output decoration on the jet"); +} + +// Destructor +DerivationFramework::TruthQGDecorationTool::~TruthQGDecorationTool() { +} + +// Function to do dressing, implements interface in IAugmentationTool +StatusCode DerivationFramework::TruthQGDecorationTool::addBranches() const +{ + // Retrieve the truth collections + const DataHandle<xAOD::JetContainer> inputJets(nullptr); + CHECK(evtStore()->retrieve(inputJets, m_jetsKey)); + + SG::AuxElement::Decorator<int> output_decorator(m_decOutput); + + for (auto ajet : *inputJets){ + if (!ajet->isAvailable<int>("PartonTruthLabelID") || + !ajet->isAvailable<int>("HadronConeExclTruthLabelID")){ + ATH_MSG_ERROR("Did not have input decorations available"); + return StatusCode::FAILURE; + } // Now we have the input decorations + /* Agreement from the HF-tagging and Jet/MET group: + - If it is non-zero, use the label from the HF-tagging group (b, c, tau) + - If it is zero, use the label from the Jet/MET group (q/g) + - In the case that the two disagree (e.g. Jet/MET says b and HF says light), + multiply the Jet/MET label by 100 to ensure this case is kept separate + */ + if (ajet->auxdata<int>("HadronConeExclTruthLabelID")!=0){ + output_decorator(*ajet) = ajet->auxdata<int>("HadronConeExclTruthLabelID"); + } else { + if (std::abs(ajet->auxdata<int>("PartonTruthLabelID"))!=5 && + std::abs(ajet->auxdata<int>("PartonTruthLabelID"))!=4 && + std::abs(ajet->auxdata<int>("PartonTruthLabelID"))!=15){ + output_decorator(*ajet) = ajet->auxdata<int>("PartonTruthLabelID"); + } else { + output_decorator(*ajet) = ajet->auxdata<int>("PartonTruthLabelID")*100; + } + } + } // Loop over jets + + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/components/DerivationFrameworkMCTruth_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/components/DerivationFrameworkMCTruth_entries.cxx index 9cf62e589c6c76458b8a4cc25c6882495e02f35a..685652d2c4b96f8dfd27c961a9b86c5fcc13bc3f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/components/DerivationFrameworkMCTruth_entries.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/components/DerivationFrameworkMCTruth_entries.cxx @@ -7,9 +7,16 @@ #include "DerivationFrameworkMCTruth/TruthClassificationDecorator.h" #include "DerivationFrameworkMCTruth/CompactHardTruth.h" #include "DerivationFrameworkMCTruth/HardTruthThinning.h" - #include "DerivationFrameworkMCTruth/HadronOriginDecorator.h" #include "DerivationFrameworkMCTruth/HadronOriginClassifier.h" +#include "DerivationFrameworkMCTruth/TruthDecayCollectionMaker.h" +#include "src/TruthNavigationDecorator.h" +#include "DerivationFrameworkMCTruth/TruthD2Decorator.h" +#include "DerivationFrameworkMCTruth/TruthQGDecorationTool.h" +#include "src/TruthBornLeptonCollectionMaker.h" +#include "src/HardScatterCollectionMaker.h" +#include "src/TruthLinkRepointTool.h" +#include "DerivationFrameworkMCTruth/TruthPVCollectionMaker.h" using namespace DerivationFramework; @@ -22,7 +29,13 @@ DECLARE_COMPONENT( TruthCollectionMakerTau ) DECLARE_COMPONENT( TruthClassificationDecorator ) DECLARE_COMPONENT( CompactHardTruth ) DECLARE_COMPONENT( HardTruthThinning ) - DECLARE_COMPONENT( HadronOriginDecorator ) DECLARE_COMPONENT( HadronOriginClassifier ) - +DECLARE_COMPONENT( TruthDecayCollectionMaker ) +DECLARE_COMPONENT( TruthNavigationDecorator ) +DECLARE_COMPONENT( TruthD2Decorator ) +DECLARE_COMPONENT( TruthQGDecorationTool ) +DECLARE_COMPONENT( TruthBornLeptonCollectionMaker ) +DECLARE_COMPONENT( HardScatterCollectionMaker ) +DECLARE_COMPONENT( TruthLinkRepointTool ) +DECLARE_COMPONENT( TruthPVCollectionMaker ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py index be7fe10d5482c7223e906070320f2bbd62769eaf..8864dfd23ddd30ae4cc966b4db93c42df83417f6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py @@ -198,13 +198,10 @@ def ConstituentPileupIso(privateSeq): UseEMScale = True, addCaloExtensionDecoration = False) ToolSvc += TimePFCSSKCaloIsolationTool - - import ROOT, cppyy - # Need to be sure base dict is loaded first. - cppyy.loadDictionary('xAODCoreRflxDict') - cppyy.loadDictionary('xAODPrimitivesDict') - isoPar = ROOT.xAOD.Iso - + + # Import the xAOD isolation parameters. + from xAODPrimitives.xAODIso import xAODIso as isoPar + from IsolationAlgs.IsolationAlgsConf import IsolationBuilder isoBuilderLC = IsolationBuilder( name = "isoBuilderLC", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py index d2ecc20518018153a1a74e02949911fa0941c32a..518fdf6886822abfc088aedbfd0be767db13b412 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py @@ -42,10 +42,8 @@ print (CaloIsoTool) ToolSvc += CaloIsoTool -import ROOT, cppyy -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso +# Import the xAOD isolation parameters. +from xAODPrimitives.xAODIso import xAODIso as isoPar deco_ptcones = [isoPar.ptcone40, isoPar.ptcone30] deco_topoetcones = [isoPar.topoetcone40, isoPar.topoetcone20] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py index c839a9aa48de9bafa3bed6cf7647333cc096f51b..ea86d9cdce3d23fb9511562760afb7fb219f4979 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py @@ -32,6 +32,46 @@ AugmentationTools = [] # Special sequence SeqPHYS = CfgMgr.AthSequencer("SeqPHYS") +#==================================================================== +# MONTE CARLO TRUTH +#==================================================================== +if (DerivationFrameworkIsMonteCarlo): + from DerivationFrameworkMCTruth.MCTruthCommon import addStandardTruthContents,addMiniTruthCollectionLinks,addHFAndDownstreamParticles,addPVCollection + #import DerivationFrameworkHiggs.TruthCategories + # Add charm quark collection + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMaker + PHYSTruthCharmTool = DerivationFramework__TruthCollectionMaker(name = "PHYSTruthCharmTool", + NewCollectionName = "TruthCharm", + KeepNavigationInfo = False, + ParticleSelectionString = "(abs(TruthParticles.pdgId) == 4)", + Do_Compress = True) + ToolSvc += PHYSTruthCharmTool + from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation + SeqPHYS += CfgMgr.DerivationFramework__CommonAugmentation("PHYSTruthCharmKernel",AugmentationTools=[PHYSTruthCharmTool]) + # Add HF particles + addHFAndDownstreamParticles(SeqPHYS) + # Add standard truth + addStandardTruthContents(SeqPHYS,prefix='PHYS_') + # Update to include charm quarks and HF particles - require a separate instance to be train safe + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthNavigationDecorator + PHYSTruthNavigationDecorator = DerivationFramework__TruthNavigationDecorator( name="PHYSTruthNavigationDecorator", + InputCollections=["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson","TruthCharm","TruthHFWithDecayParticles"]) + ToolSvc += PHYSTruthNavigationDecorator + SeqPHYS.PHYS_MCTruthNavigationDecoratorKernel.AugmentationTools = [PHYSTruthNavigationDecorator] + # Re-point links on reco objects + addMiniTruthCollectionLinks(SeqPHYS) + addPVCollection(SeqPHYS) + # Set appropriate truth jet collection for tau truth matching + ToolSvc.DFCommonTauTruthMatchingTool.TruthJetContainerName = "AntiKt4TruthDressedWZJets" + # SUSY signal + from DerivationFrameworkSUSY.DecorateSUSYProcess import IsSUSYSignal + if IsSUSYSignal(): + from DerivationFrameworkSUSY.SUSYWeightMetadata import * + # Add sumOfWeights metadata for LHE3 multiweights ======= + #from DerivationFrameworkCore.LHE3WeightMetadata import * + + + #==================================================================== # TRIGGER CONTENT #==================================================================== @@ -71,8 +111,7 @@ for trig_item in inputFileSummary['metadata']['/TRIGGER/HLT/Menu']: # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/DaodRecommendations # Inner detector group recommendations for indet tracks in analysis -#PHYS_thinning_expression = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV" -PHYS_thinning_expression = "abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV" +PHYS_thinning_expression = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV" from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning PHYSTrackParticleThinningTool = DerivationFramework__TrackParticleThinning(name = "PHYSTrackParticleThinningTool", StreamName = PHYSStream.Name, @@ -108,9 +147,9 @@ PHYSTauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name StreamName = PHYSStream.Name, TauKey = "TauJets", InDetTrackParticlesKey = "InDetTrackParticles", - SelectionString = tau_thinning_expression) - #DoTauTracksThinning = True, - #TauTracksKey = "TauTracks") + SelectionString = tau_thinning_expression, + DoTauTracksThinning = True, + TauTracksKey = "TauTracks") ToolSvc += PHYSTauTPThinningTool thinningTools.append(PHYSTauTPThinningTool) @@ -157,29 +196,29 @@ DerivationFrameworkJob += SeqPHYS #==================================================================== # Tau #==================================================================== - +''' # Schedule low-pt di-tau reconstruction (needs AntiKt2PV0TrackJets) -# from DerivationFrameworkTau.TauCommon import addDiTauLowPt -# addDiTauLowPt() +from DerivationFrameworkTau.TauCommon import addDiTauLowPt +addDiTauLowPt() # Low-pt di-tau thinning -# from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning -# PHYSDiTauLowPtThinningTool = DerivationFramework__GenericObjectThinning(name = "PHYSDiTauLowPtThinningTool", -# ThinningService = PHYSThinningHelper.ThinningSvc(), -# ContainerName = "DiTauJetsLowPt", -# SelectionString = "DiTauJetsLowPt.nSubjets > 1") -# ToolSvc += PHYSDiTauLowPtThinningTool -# thinningTools.append(PHYSDiTauLowPtThinningTool) +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning +PHYSDiTauLowPtThinningTool = DerivationFramework__GenericObjectThinning(name = "PHYSDiTauLowPtThinningTool", + ThinningService = PHYSThinningHelper.ThinningSvc(), + ContainerName = "DiTauJetsLowPt", + SelectionString = "DiTauJetsLowPt.nSubjets > 1") +ToolSvc += PHYSDiTauLowPtThinningTool +thinningTools.append(PHYSDiTauLowPtThinningTool) # ID tracks associated with low-pt ditau -# PHYSDiTauLowPtTPThinningTool = DerivationFramework__DiTauTrackParticleThinning(name = "PHYSDiTauLowPtTPThinningTool", -# ThinningService = PHYSThinningHelper.ThinningSvc(), -# DiTauKey = "DiTauJetsLowPt", -# InDetTrackParticlesKey = "InDetTrackParticles", -# SelectionString = "DiTauJetsLowPt.nSubjets > 1") -# ToolSvc += PHYSDiTauLowPtTPThinningTool -# thinningTools.append(PHYSDiTauLowPtTPThinningTool) - +PHYSDiTauLowPtTPThinningTool = DerivationFramework__DiTauTrackParticleThinning(name = "PHYSDiTauLowPtTPThinningTool", + ThinningService = PHYSThinningHelper.ThinningSvc(), + DiTauKey = "DiTauJetsLowPt", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = "DiTauJetsLowPt.nSubjets > 1") +ToolSvc += PHYSDiTauLowPtTPThinningTool +thinningTools.append(PHYSDiTauLowPtTPThinningTool) +''' #==================================================================== # CREATE THE DERIVATION KERNEL ALGORITHM #==================================================================== @@ -233,7 +272,7 @@ PHYSSlimmingHelper.SmartCollections = ["Electrons", #"MET_Baseline_AntiKt4EMTopo", #"MET_Baseline_AntiKt4EMPFlow", "TauJets", - #"DiTauJets", + "DiTauJets", #"DiTauJetsLowPt", #"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", #"AntiKtVR30Rmax4Rmin02TrackJets_BTagging201903", @@ -293,9 +332,9 @@ if DerivationFrameworkIsMonteCarlo: 'AntiKt10TruthTrimmedPtFrac5SmallR20Jets':'xAOD::JetContainer', 'AntiKt10TruthTrimmedPtFrac5SmallR20JetsAux':'xAOD::JetAuxContainer' } - # from DerivationFrameworkMCTruth.MCTruthCommon import addTruth3ContentToSlimmerTool - # addTruth3ContentToSlimmerTool(PHYSSlimmingHelper) - # PHYSSlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm'] + from DerivationFrameworkMCTruth.MCTruthCommon import addTruth3ContentToSlimmerTool + addTruth3ContentToSlimmerTool(PHYSSlimmingHelper) + PHYSSlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm'] PHYSSlimmingHelper.ExtraVariables += ["AntiKt10TruthTrimmedPtFrac5SmallR20Jets.Tau1_wta.Tau2_wta.Tau3_wta.D2.GhostBHadronsFinalCount", "Electrons.TruthLink", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY4.py index 8261b3b9c295303cddaeb15f47493d5bebd086c8..9e100c6bdaec72b7f40194426bc33df68b7afb74 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY4.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY4.py @@ -1,3 +1,4 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #******************************************************************** # SUSY4.py # reductionConf flag SUSY4 in Reco_tf.py @@ -199,10 +200,7 @@ TrackIsoTool500.TrackSelectionTool.CutLevel= "Loose" ToolSvc += TrackIsoTool500 from DerivationFrameworkSUSY.DerivationFrameworkSUSYConf import DerivationFramework__trackIsolationDecorator -import ROOT, cppyy -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso +from xAODPrimitives.xAODIso import xAODIso as isoPar Pt1000IsoTrackDecorator = DerivationFramework__trackIsolationDecorator(name = "Pt1000IsoTrackDecorator", TrackIsolationTool = TrackIsoTool, TargetContainer = "InDetTrackParticles", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsCPContent.py new file mode 100644 index 0000000000000000000000000000000000000000..f67a88d5c4e570d4c62bfd0bfddc640776267c50 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsCPContent.py @@ -0,0 +1,6 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +DiTauJetsCPContent = [ +"DiTauJets", +"DiTauJetsAux.pt.eta.phi.m.TauJetVtxFraction.subjet_pt.subjet_phi.subjet_e.subjet_f_core.subjet_eta.isoTrackLinks.jetLink.vertexLink.trackLinks" +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsLowPtCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsLowPtCPContent.py new file mode 100644 index 0000000000000000000000000000000000000000..10b91f74b15a7dac99a5ae6060d786659fb7233e --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/DiTauJetsLowPtCPContent.py @@ -0,0 +1,6 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +DiTauJetsLowPtCPContent = [ +"DiTauJetsLowPt", +"DiTauJetsLowPtAux.pt.eta.phi.m.TauJetVtxFraction.subjet_pt.subjet_phi.subjet_e.subjet_f_core.subjet_eta.isoTrackLinks.jetLink.vertexLink.trackLinks" +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py index 02d2b874faced4ed52ca6147ef7d77b6f5e2fe2b..d8e46c00e874b57e14b26c95f5ae2d1b53edc73d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py @@ -22,12 +22,32 @@ from AthenaCommon import CfgMgr #==================================================================== from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauSelectionTool + +#from tauRec.TauRecAODBuilder import TauRecAODProcessor_FTau +#TauRecAODProcessor_FTau() + DFCommonTauWrapperTools = [] +# VeryLoose +DFCommonTausSelectorVeryLoose = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorVeryLoose") +DFCommonTausSelectorVeryLoose.JetIDWP = 19 +DFCommonTausSelectorVeryLoose.SelectionCuts = 1<<6 +DFCommonTausSelectorVeryLoose.ConfigPath = '' +#TauAnalysisTools::CutJetIDWP should be used but issue with the dictionnary +ToolSvc += DFCommonTausSelectorVeryLoose +DFCommonTausVeryLooseWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausVeryLooseWrapper", + AsgSelectionTool = DFCommonTausSelectorVeryLoose, + StoreGateEntryName = "DFCommonTausVeryLoose", + ContainerName = "TauJets") +ToolSvc += DFCommonTausVeryLooseWrapper +print (DFCommonTausVeryLooseWrapper) +DFCommonTauWrapperTools.append(DFCommonTausVeryLooseWrapper) + # Loose DFCommonTausSelectorLoose = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorLoose") -DFCommonTausSelectorLoose.JetIDWP = 2 +DFCommonTausSelectorLoose.JetIDWP = 20 DFCommonTausSelectorLoose.SelectionCuts = 1<<6 +DFCommonTausSelectorLoose.ConfigPath = '' #TauAnalysisTools::CutJetIDWP should be used but issue with the dictionnary ToolSvc += DFCommonTausSelectorLoose DFCommonTausLooseWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausLooseWrapper", @@ -40,33 +60,122 @@ DFCommonTauWrapperTools.append(DFCommonTausLooseWrapper) # Medium DFCommonTausSelectorMedium = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorMedium") -DFCommonTausSelectorMedium.JetIDWP = 3 +DFCommonTausSelectorMedium.JetIDWP = 21 DFCommonTausSelectorMedium.SelectionCuts = 1<<6 +DFCommonTausSelectorMedium.ConfigPath = '' ToolSvc += DFCommonTausSelectorMedium DFCommonTausMediumWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausMediumWrapper", - AsgSelectionTool = DFCommonTausSelectorMedium, - StoreGateEntryName = "DFCommonTausMedium", - ContainerName = "TauJets") + AsgSelectionTool = DFCommonTausSelectorMedium, + StoreGateEntryName = "DFCommonTausMedium", + ContainerName = "TauJets") ToolSvc += DFCommonTausMediumWrapper print (DFCommonTausMediumWrapper) DFCommonTauWrapperTools.append(DFCommonTausMediumWrapper) # Tight DFCommonTausSelectorTight = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorTight") -DFCommonTausSelectorTight.JetIDWP = 4 +DFCommonTausSelectorTight.JetIDWP = 22 DFCommonTausSelectorTight.SelectionCuts = 1<<6 +DFCommonTausSelectorTight.ConfigPath = '' ToolSvc += DFCommonTausSelectorTight DFCommonTausTightWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausTightWrapper", AsgSelectionTool = DFCommonTausSelectorTight, StoreGateEntryName = "DFCommonTausTight", - ContainerName = "TauJets") + ContainerName = "TauJets" ) ToolSvc += DFCommonTausTightWrapper print (DFCommonTausTightWrapper) DFCommonTauWrapperTools.append(DFCommonTausTightWrapper) + #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= -DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("TauCommonKernel", - AugmentationTools = DFCommonTauWrapperTools) +DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation( "TauCommonKernel", + AugmentationTools = DFCommonTauWrapperTools ) + +#================= +# TAU THINNING +#================= +def ThinTau(Name=None, ThinningService=None, Seq=None, SelectionString=None): + + if not Name or not ThinningService or not Seq: + print ("Can't schedule tau thinning") + return + + if not SelectionString: + SelectionString = "(TauJets.pt >= 15.*GeV) && (TauJets.nTracks<4 && TauJets.nTracks>0)" + + from AthenaCommon.AppMgr import ToolSvc + + # TauJets thinning + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning + TauJetsThinningTool = DerivationFramework__GenericObjectThinning(name = Name+"TauJetsThinningTool", + ThinningService = ThinningService, + ContainerName = "TauJets", + SelectionString = SelectionString) + ToolSvc += TauJetsThinningTool + print (TauJetsThinningTool) + + # Only keep tau tracks (and associated ID tracks) classified as charged tracks + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = Name+"TauTPThinningTool", + ThinningService = ThinningService, + TauKey = "TauJets", + InDetTrackParticlesKey = "InDetTrackParticles", + SelectionString = SelectionString, + ApplyAnd = False, + DoTauTracksThinning = True, + TauTracksKey = "TauTracks") + ToolSvc += TauTPThinningTool + print (TauTPThinningTool) + + Seq += CfgMgr.DerivationFramework__DerivationKernel(Name+"TauThinningKernel", ThinningTools = [TauJetsThinningTool,TauTPThinningTool]) + +''' +#======================================= +# Low-pt di-tau reconstruction +#======================================= +def addDiTauLowPt(): + + from AthenaCommon.AppMgr import ToolSvc + if hasattr(ToolSvc,"DFCommonDiTauLowPtBuilder"): + return + + from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addCHSPFlowObjects + addCHSPFlowObjects() + + from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + addStandardJets("AntiKt", 1.0, "EMPFlow", ptmin=40000, ptminFilter=50000, mods="pflow_ungroomed", calibOpt="none", algseq=DerivationFrameworkJob, outputGroup="TauCommon") + + import DiTauRec.DiTauAlgorithmsHolder as DiTauAlgs + from DiTauRec.DiTauRecConf import DiTauBuilder + + ditauTools = [] + ditauTools.append(DiTauAlgs.getSeedJetBuilder("AntiKt10EMPFlowJets")) + ditauTools.append(DiTauAlgs.getElMuFinder()) + ditauTools.append(DiTauAlgs.getSubjetBuilder()) + ditauTools.append(DiTauAlgs.getVertexFinder()) + ditauTools.append(DiTauAlgs.getDiTauTrackFinder()) + ditauTools.append(DiTauAlgs.getIDVarCalculator(False)) + + for tool in ditauTools: + if not hasattr(ToolSvc,tool.name()): + ToolSvc += tool + + DiTauLowPtBuilder = DiTauBuilder(name="DFCommonDiTauLowPtBuilder", + DiTauContainer="DiTauJetsLowPt", + DiTauAuxContainer="DiTauJetsLowPtAux.", + SeedJetName="AntiKt10EMPFlowJets", + minPt=50000, + maxEta=2.5, + Rjet=1.0, + Rsubjet=0.2, + Rcore=0.1, + Tools=ditauTools) + ToolSvc += DiTauLowPtBuilder + DerivationFrameworkJob += DiTauLowPtBuilder + + print ("Low-pt di-tau building has been scheduled") +''' diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py index 14290fb80ba3092af0e57f7e8b6c692561ba66ee..7fc38cbb54c33c83d8906590722ace6e689182d7 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py @@ -1,9 +1,13 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration TauJetsCPContent = [ "AntiKt4LCTopoJets", "InDetTrackParticles", "InDetTrackParticlesAux.phi.vertexLink.theta.qOverP.truthParticleLink.truthMatchProbability", "TauJets", -"TauJetsAux.pt.eta.phi.m.trackLinks.wideTrackLinks.otherTrackLinks.jetLink.vertexLink.secondaryVertexLink.hadronicPFOLinks.shotPFOLinks.chargedPFOLinks.neutralPFOLinks.pi0PFOLinks.protoChargedPFOLinks.protoNeutralPFOLinks.protoPi0PFOLinks.charge.isTauFlags.BDTJetScore.BDTEleScore.conversionTrackLinks.charged_PFOLinks.neutral_PFOLinks.pi0_PFOLinks.cellBased_Charged_PFOLinks.cellBased_Neutral_PFOLinks.cellBased_Pi0_PFOLinks.eflowRec_Charged_PFOLinks.eflowRec_Neutral_PFOLinks.eflowRec_Pi0_PFOLinks.shot_PFOLinks" +"TauJetsAux.pt.eta.phi.m.tauTrackLinks.jetLink.vertexLink.charge.isTauFlags.BDTJetScore.BDTEleScore.ptFinalCalib.etaFinalCalib.phiFinalCalib.mFinalCalib.electronLink.EleMatchLikelihoodScore.pt_combined.eta_combined.phi_combined.m_combined.BDTJetScoreSigTrans.BDTEleScoreSigTrans.PanTau_DecayMode.RNNJetScore.RNNJetScoreSigTrans.seedJetWidth.seedJetJvt.BDTEleScore_retuned.BDTEleScoreSigTrans_retuned.BDTEleLoose_retuned.BDTEleMedium_retuned.BDTEleTight_retuned.seedTrackWidthPt1000.seedTrackWidthPt500.truthParticleLink.truthJetLink", +"TauTracks", +"TauTracksAux.pt.eta.phi.flagSet.trackLinks", +"TruthTaus", +"TruthTausAux.pt_vis_neutral_pions.pt_vis_neutral_others.numCharged.classifierParticleType.classifierParticleOrigin.IsHadronicTau.numNeutralPion.numNeutral.numChargedPion.pt_vis.eta_vis.phi_vis.m_vis" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py index 945f60641cfd50ebb56ba6e9d433c8d389d23b01..6be88d676e7e3763a95486cf0c6315313bd365e3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py @@ -8,52 +8,61 @@ from __future__ import print_function -from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob, DerivationFrameworkIsMonteCarlo -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon import CfgMgr - #==================================================================== # AUGMENTATION TOOLS #==================================================================== # Tau Truth making and matching -if DerivationFrameworkIsMonteCarlo: - - from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper - from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool +def scheduleTauTruthTools(kernel=None): + # Ensure that we are running on MC! + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkIsMonteCarlo + if not DerivationFrameworkIsMonteCarlo: + return + # Ensure that we are adding it to something + if kernel is None: + from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob + kernel = DerivationFrameworkJob + if hasattr(kernel,'TauTruthCommonKernel'): + # Already there! Carry on... + return DFCommonTauTruthWrapperTools = [] - # Tau Truth making and matching - # Set up the MCTruthClassifier - from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier - DFCommonTauTruthClassifier = MCTruthClassifier(name = "DFCommonTauTruthClassifier", - ParticleCaloExtensionTool="") - ToolSvc += DFCommonTauTruthClassifier - - # Build the truth taus - from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau - DFCommonTruthTauTool = DerivationFramework__TruthCollectionMakerTau(name = "DFCommonTruthTauTool", - NewCollectionName = "TruthTaus", - MCTruthClassifier = DFCommonTauTruthClassifier) - ToolSvc += DFCommonTruthTauTool - DFCommonTauTruthWrapperTools.append(DFCommonTruthTauTool) - + from AthenaCommon.AppMgr import ToolSvc # Matching # Only do if working with AOD from RecExConfig.ObjKeyStore import objKeyStore if objKeyStore.isInInput( "xAOD::TauJetContainer", "TauJets" ): + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool DFCommonTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(name="DFCommonTauTruthMatchingTool") + DFCommonTauTruthMatchingTool.WriteTruthTaus = True + DFCommonTauTruthMatchingTool.WriteInvisibleFourMomentum = True + DFCommonTauTruthMatchingTool.WriteVisibleNeutralFourMomentum = True ToolSvc += DFCommonTauTruthMatchingTool + + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper DFCommonTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper( name = "DFCommonTauTruthMatchingWrapper", TauTruthMatchingTool = DFCommonTauTruthMatchingTool, TauContainerName = "TauJets") ToolSvc += DFCommonTauTruthMatchingWrapper print (DFCommonTauTruthMatchingWrapper) DFCommonTauTruthWrapperTools.append(DFCommonTauTruthMatchingWrapper) + else: + # No reco taus, so just build the truth tau container + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__BuildTruthTaus + btt = TauAnalysisTools__BuildTruthTaus( WriteTruthTaus = True, + WriteInvisibleFourMomentum = True, + WriteVisibleNeutralFourMomentum = True ) + ToolSvc += btt + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau + DFCommonTruthTauCollectionMaker = DerivationFramework__TruthCollectionMakerTau() + DFCommonTruthTauCollectionMaker.BuildTruthTaus = btt + ToolSvc += DFCommonTruthTauCollectionMaker + print (DFCommonTruthTauCollectionMaker) + DFCommonTauTruthWrapperTools.append(DFCommonTruthTauCollectionMaker) #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= - - DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("TauTruthCommonKernel", - AugmentationTools = DFCommonTauTruthWrapperTools) + from AthenaCommon import CfgMgr + kernel += CfgMgr.DerivationFramework__CommonAugmentation( "TauTruthCommonKernel", + AugmentationTools = DFCommonTauTruthWrapperTools ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/CMakeLists.txt index 23668b8d556e9e793268c24712678190afaea296..4c50480a29eddc87d95f669d36c9b90ec32527cb 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/CMakeLists.txt @@ -13,7 +13,7 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigCost/EnhancedBiasWeighter Trigger/TrigAnalysis/TrigAnalysisInterfaces Trigger/TrigAnalysis/TriggerMatchingTool - Trigger/TrigDecisionTool/TrigDecisionTool + Trigger/TrigAnalysis/TrigDecisionTool Trigger/TrigEvent/TrigNavStructure Event/xAOD/xAODBase Event/xAOD/xAODCore diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/python/TrigThinningHelper.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/python/TrigThinningHelper.py index 436e0a7e714281cf4786236c303999d80714279b..78b67edb0c8da82ffd414c9c0810139e79978e26 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/python/TrigThinningHelper.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/python/TrigThinningHelper.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #################################################################### # TrigThinningHelper.py @@ -16,66 +16,6 @@ # Needed import(s): import AthenaCommon.CfgMgr as CfgMgr -from AthenaServices.Configurables import ThinningSvc as AthThinningSvc - -## Custom specialisation of the core ThinningSvc configurable -# -# Unfortunately the ThinningSvc configurable in AthenaServices was not written -# with extendability in mind. So in order to change its behaviour, one must -# inherit from it. As most of the settings made by that class are only made -# after the jobOption code is already done executing... -# -class WorkerThinningSvc( AthThinningSvc ): - - def __init__( self, name, athStream, navThinSvc, **kwargs ): - - # Remember the object's properties: - self.athStream = athStream - self.navThinSvc = navThinSvc - # Set up a logger object: - from AthenaCommon.Logging import logging - self.log = logging.getLogger( name ) - # Call the initialisation of the base class: - AthThinningSvc.__init__( self, name, **kwargs ) - return - - ## Function overriding the one defined in Configurable - # - # This is probably not the very best design, but because of how weirdly - # ThinningSvc.setDefaults(...) is implemented, this seemed to be the best - # way to tweak the configuration made by that function. - # - def setup( self ): - - # Let the base class do all of its setup functions - super( WorkerThinningSvc, self ).setup() - - # Make the stream talk to this service: - toolFound = False - for tool in self.athStream.HelperTools: - # Check whether there's a tool of this type already attached - # to the stream. If there is, it should start talking to the - # navigation thinning service from now on: - if not isinstance( tool, CfgMgr.ThinningOutputTool ): - continue - tool.ThinningSvc = self.navThinSvc - toolFound = True - self.log.info( "Updated the existing ThinningOutputTool to point at" - " the TrigNavigationThinningSvc instance" ) - pass - if not toolFound: - # If there was no such tool yet, let's create one from scratch: - stream.HelperTools.insert( 0, - CfgMgr.ThinningOutputTool( formatName + - "ThinningOutputTool", - ThinningSvc = self.navThinSvc ) ) - self.log.warning( "No ThinningOutputTool found for the output " - "stream" ) - self.log.warning( "Configured one now, job will likely be " - "faulty..." ) - pass - - return ## Class helping to set up (navigation) thinning in derivation jobs # @@ -99,7 +39,6 @@ class ThinningHelper: from AthenaCommon.AppMgr import ServiceMgr as svcMgr self.helperName = helperName self.TriggerChains = "" - self.worker = None self.edmList = edmList self.mode = mode from AthenaCommon.Logging import logging @@ -123,39 +62,19 @@ class ThinningHelper: formatName = stream.name().strip( "StreamDAOD_" ) # The necessary import(s): from AthenaCommon.AppMgr import ServiceMgr as svcMgr - from AthenaServices.Configurables import createThinningSvc - # Let's create the navigation thinning service first. Notice that its - # 'WorkerThinningSvc' property is not getting set at this point yet. - svcMgr += CfgMgr.TrigNavigationThinningSvc( formatName + - "ThinningSvc" ) - thinningSvc = getattr( svcMgr, formatName + "ThinningSvc" ) - - # Now set up the worker thinning service: - svcMgr += WorkerThinningSvc( formatName + "NavThinningWorkerSvc", - athStream = stream, - navThinSvc = thinningSvc, - Streams = [ stream.name() ] ) - self.worker = getattr( svcMgr, formatName + "NavThinningWorkerSvc" ) + from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc + tSvc = navigationThinningSvc( { 'name' : self.helperName, + 'features' : self.edmList, + 'chains' : self.TriggerChains, + 'mode' : self.mode } ) + + for t in stream.HelperTools: + if t.getType() == 'Athena::ThinningCacheTool': + t.TrigNavigationThinningSvc = tSvc + break + else: + log.error ("Can't find ThinningCacheTool for stream %s", stream) - # And now point the navigation thinning service to the worker: - thinningSvc.WorkerThinningSvc = self.worker - - from TrigNavTools.TrigNavToolsConfig import slimmingTool - sTool = slimmingTool( { 'name' : self.helperName, - 'features' : self.edmList, - 'chains' : self.TriggerChains, - 'mode' : self.mode, - 'ThinningSvc' : thinningSvc } ) - thinningSvc.SlimmingTool = sTool return - ## Convenience function returning the thinning service - # - # This is the thinning service that needs to be passed to "normal" - # thinning tools to operate on. - # - # @returns The thinning service that tools should operate on - # - def ThinningSvc( self ): - return self.worker diff --git a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt index 7be6c424ada56ae62f25590166b1db33557a294c..0639fdc571305371749167e60348eaef6c99dbc3 100644 --- a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt @@ -73,5 +73,5 @@ endif() atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_add_test( flake8_test - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/test + SCRIPT ${ATLAS_FLAKE8} ${CMAKE_CURRENT_SOURCE_DIR}/test POST_EXEC_SCRIPT nopost.sh ) diff --git a/PhysicsAnalysis/EventTag/EventTagRawAlgs/CMakeLists.txt b/PhysicsAnalysis/EventTag/EventTagRawAlgs/CMakeLists.txt index 04dfbddcbd7589f618a1295bb3034a38dc3e85bd..f16ce190126aa7cb5ff417388ceff6e39eceb284 100644 --- a/PhysicsAnalysis/EventTag/EventTagRawAlgs/CMakeLists.txt +++ b/PhysicsAnalysis/EventTag/EventTagRawAlgs/CMakeLists.txt @@ -10,7 +10,6 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Control/AthenaKernel GaudiKernel - MagneticField/MagFieldInterfaces Tracking/TrkEvent/TrkSegment PRIVATE Calorimeter/CaloEvent @@ -25,7 +24,10 @@ atlas_depends_on_subdirs( PUBLIC TileCalorimeter/TileIdentifier Tracking/TrkEvent/TrkSpacePoint Tracking/TrkEvent/TrkTrack - Tracking/TrkEvent/TrkTrackSummary ) + Tracking/TrkEvent/TrkTrackSummary + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( CLHEP ) @@ -35,7 +37,7 @@ atlas_add_component( EventTagRawAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel MagFieldInterfaces TrkSegment CaloEvent CommissionEvent StoreGateLib SGtests xAODCaloEvent InDetBCM_RawData InDetPrepRawData LArRecEvent TagEvent TileEvent TileIdentifier TrkSpacePoint TrkTrack TrkTrackSummary ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel TrkSegment CaloEvent CommissionEvent StoreGateLib SGtests xAODCaloEvent InDetBCM_RawData InDetPrepRawData LArRecEvent TagEvent TileEvent TileIdentifier TrkSpacePoint TrkTrack TrkTrackSummary MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.cxx b/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.cxx index ed61707fad9e1184548b41b277b752cf24d0bcfe..d33cbc6f12ac77d0344bf8ad351002328355886f 100644 --- a/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.cxx +++ b/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.cxx @@ -22,8 +22,7 @@ RawInfoSummaryForTagWriter::RawInfoSummaryForTagWriter(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name,pSvcLocator), - m_fieldServiceHandle("AtlasFieldSvc",name) + AthAlgorithm(name,pSvcLocator) { declareProperty("IDTrackKey",m_sgKeyIDtrack); declareProperty("CaloCellContKey", m_cellContKey="AllCalo"); @@ -33,12 +32,10 @@ RawInfoSummaryForTagWriter::RawInfoSummaryForTagWriter(const std::string& name, declareProperty("TRT_DriftCircleContainerName", m_TRT_DriftCircleName="TRT_DriftCircles"); declareProperty("SCT_SpacePointName",m_sctSpacePointName="SCT_SpacePoints"); declareProperty("Pixel_SpacePointName",m_pixSpacePointName="PixelSpacePoints"); - declareProperty("BCM_RDOName", m_bcmRDOName="BCM_RDOs"); declareProperty("TRT_PhaseName", m_trtPhaseName="");//"TRT_Phase"); declareProperty("MBTSName",m_mbtsName="MBTSContainer"); declareProperty("MBTSCollTimeKey",m_MBTSCollTimeKey="MBTSCollisionTime"); declareProperty("MBTS_Threshold", m_mbts_threshold = 40.0/222.0 ); // Value in pC - declareProperty("MagFieldSvc" , m_fieldServiceHandle); declareProperty("OutputKey", m_RISFTKey="RawInfoSummaryForTag"); } @@ -63,7 +60,6 @@ StatusCode RawInfoSummaryForTagWriter::initialize() return StatusCode::FAILURE; } - ATH_CHECK(m_fieldServiceHandle.retrieve()); ATH_CHECK(m_sgKeyIDtrack.initialize()); ATH_CHECK(m_cellContKey.initialize()); if(m_doClusterSums) { @@ -75,13 +71,14 @@ StatusCode RawInfoSummaryForTagWriter::initialize() ATH_CHECK(m_MBTSCollTimeKey.initialize()); ATH_CHECK(m_sctSpacePointName.initialize()); ATH_CHECK(m_pixSpacePointName.initialize()); - ATH_CHECK(m_bcmRDOName.initialize()); ATH_CHECK(m_mbtsName.initialize()); ATH_CHECK(m_larCollTimeName.initialize()); if (!m_trtPhaseName.key().empty()) { ATH_CHECK(m_trtPhaseName.initialize()); } + ATH_CHECK(m_bcmRDOName.initialize(!m_bcmRDOName.key().empty())); ATH_CHECK(m_RISFTKey.initialize()); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); return StatusCode::SUCCESS; } @@ -93,9 +90,10 @@ StatusCode RawInfoSummaryForTagWriter::execute() ATH_MSG_DEBUG("Executing " << name()); + EventContext ctx = Gaudi::Hive::currentContext(); ATH_MSG_DEBUG("making RawInfoSummaryForTag object "); - SG::WriteHandle<RawInfoSummaryForTag> RISFTobject(m_RISFTKey); + SG::WriteHandle<RawInfoSummaryForTag> RISFTobject(m_RISFTKey, ctx); ATH_CHECK(RISFTobject.record(std::make_unique<RawInfoSummaryForTag>())); /////////////////////////////////////////////////////////////// @@ -115,8 +113,18 @@ StatusCode RawInfoSummaryForTagWriter::execute() // input Track Collection int totNPixHits(0),totNSCTHits(0),totNTRTHits(0); + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache (fieldCache); - SG::ReadHandle<TrackCollection> tracks{m_sgKeyIDtrack}; + SG::ReadHandle<TrackCollection> tracks{m_sgKeyIDtrack, ctx}; for (const Trk::Track* track : *tracks) { const Trk::TrackSummary* summary = track->trackSummary(); @@ -128,7 +136,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() if (nSCTHits>0) totNSCTHits++; if (nTRTHits>0) totNTRTHits++; - if(m_fieldServiceHandle->solenoidOn()){ + if(fieldCache.solenoidOn()){ const Trk::Perigee* perigee = track->perigeeParameters(); if(!perigee) continue; if(perigee->parameters()[Trk::qOverP]!=0){ @@ -232,7 +240,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() float totClusterEne(0.),totCellEne(0.),CellEx(0.),CellEy(0.),CellMissEt(0.),CellMissEtPhi(0.); float totCellEneEMB(0.),totCellEneEMEC(0.),totCellEneHEC(0.),totCellEneFCAL(0.),totCellEneTile(0.); // - SG::ReadHandle<CaloCellContainer> cell_container{m_cellContKey}; + SG::ReadHandle<CaloCellContainer> cell_container{m_cellContKey, ctx}; for (const CaloCell* cell : *cell_container) { float energy = cell->energy(); @@ -259,7 +267,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() float clusEt1(0.),clusEta1(-999.),clusPhi1(-999.),clusE1(0.); if(m_doClusterSums){ - SG::ReadHandle< xAOD::CaloClusterContainer> cluster_container(m_caloClusterKey); + SG::ReadHandle< xAOD::CaloClusterContainer> cluster_container(m_caloClusterKey, ctx); for (const auto* cluster : *cluster_container) { const float energy = cluster->e(); totClusterEne += energy; @@ -292,7 +300,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() // hit multiplicities... unsigned int nDCs(0), nDCsAll(0); // TRT - SG::ReadHandle<InDet::TRT_DriftCircleContainer> TRTcontainer(m_TRT_DriftCircleName); + SG::ReadHandle<InDet::TRT_DriftCircleContainer> TRTcontainer(m_TRT_DriftCircleName, ctx); for(InDet::TRT_DriftCircleContainer::const_iterator it=TRTcontainer->begin(); it!=TRTcontainer->end(); it++) { const InDet::TRT_DriftCircleCollection *colNext=&(**it); if (!colNext) continue; @@ -310,7 +318,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() // SCT SPs unsigned int spsize=0; - SG::ReadHandle<SpacePointContainer> SCT_spcontainer(m_sctSpacePointName); + SG::ReadHandle<SpacePointContainer> SCT_spcontainer(m_sctSpacePointName, ctx); for(SpacePointContainer::const_iterator it=SCT_spcontainer->begin(); it!=SCT_spcontainer->end(); ++it) { const SpacePointCollection *colNext=&(**it); if (!colNext) continue; @@ -320,7 +328,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() // Pixel SPs unsigned int pspsize=0; - SG::ReadHandle<SpacePointContainer> P_spcontainer(m_pixSpacePointName); + SG::ReadHandle<SpacePointContainer> P_spcontainer(m_pixSpacePointName, ctx); for(SpacePointContainer::const_iterator it=P_spcontainer->begin(); it!=P_spcontainer->end(); ++it) { const SpacePointCollection *colNext=&(**it); if (!colNext) continue; @@ -336,26 +344,28 @@ StatusCode RawInfoSummaryForTagWriter::execute() // BCM tag bit unsigned int bcmHit=0; + + if (!m_bcmRDOName.key().empty()) { + SG::ReadHandle<BCM_RDO_Container> bcmRDO(m_bcmRDOName, ctx); + int num_collect = bcmRDO->size(); + if ( num_collect != 16 ){ + ATH_MSG_WARNING (" Number of collections: " << num_collect); + } - SG::ReadHandle<BCM_RDO_Container> bcmRDO(m_bcmRDOName); - int num_collect = bcmRDO->size(); - if ( num_collect != 16 ){ - ATH_MSG_WARNING (" Number of collections: " << num_collect); + BCM_RDO_Container::const_iterator chan_itr = bcmRDO->begin(); + BCM_RDO_Container::const_iterator chan_itr_end = bcmRDO->end(); + for (; chan_itr != chan_itr_end; chan_itr++) { + // Loop over all BCM hits in this collection + BCM_RDO_Collection::const_iterator bcm_itr = (*chan_itr)->begin(); + BCM_RDO_Collection::const_iterator bcm_itr_end = (*chan_itr)->end(); + + for (; bcm_itr != bcm_itr_end; bcm_itr++) { + if ((*bcm_itr)->getPulse1Width() != 0 || (*bcm_itr)->getPulse2Width() != 0) { + bcmHit++; + } + } // end of loop over raw data + } // end of loop over collections } - - BCM_RDO_Container::const_iterator chan_itr = bcmRDO->begin(); - BCM_RDO_Container::const_iterator chan_itr_end = bcmRDO->end(); - for (; chan_itr != chan_itr_end; chan_itr++) { - // Loop over all BCM hits in this collection - BCM_RDO_Collection::const_iterator bcm_itr = (*chan_itr)->begin(); - BCM_RDO_Collection::const_iterator bcm_itr_end = (*chan_itr)->end(); - - for (; bcm_itr != bcm_itr_end; bcm_itr++) { - if ((*bcm_itr)->getPulse1Width() != 0 || (*bcm_itr)->getPulse2Width() != 0) { - bcmHit++; - } - } // end of loop over raw data - } // end of loop over collections RISFTobject->setBCMHit(bcmHit); @@ -363,7 +373,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() /////////////////////////////////////////////////////// // MBTS word - copied from: - SG::ReadHandle<TileCellContainer> tileCellCnt(m_mbtsName); + SG::ReadHandle<TileCellContainer> tileCellCnt(m_mbtsName, ctx); uint32_t ibit, bit_pos = 0; float charge = 0; uint32_t mbtsBits = 0; @@ -410,7 +420,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() RISFTobject->setMBTSword(mbtsBits); - SG::ReadHandle<MBTSCollisionTime> mbtsTime{m_MBTSCollTimeKey}; + SG::ReadHandle<MBTSCollisionTime> mbtsTime{m_MBTSCollTimeKey, ctx}; float timeDiff=-999.; float timeSum=-999.; int MBTS_SideCut(2); @@ -426,7 +436,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() float LArECtimeDiff=-999.; float LArECtimeSum=-999.; - SG::ReadHandle<LArCollisionTime> tps(m_larCollTimeName); + SG::ReadHandle<LArCollisionTime> tps(m_larCollTimeName, ctx); const int nMin=2; if (tps->ncellA() > nMin && tps->ncellC() > nMin){ LArECtimeDiff = tps->timeA()-tps->timeC(); @@ -441,7 +451,7 @@ StatusCode RawInfoSummaryForTagWriter::execute() // https://twiki.cern.ch/twiki/bin/view/Atlas/TRTEventPhase#Accessing_TRT_time_from_ESD_file float myTRTtime=0; if (!m_trtPhaseName.key().empty()) { - SG::ReadHandle<ComTime> theComTime(m_trtPhaseName); + SG::ReadHandle<ComTime> theComTime(m_trtPhaseName, ctx); myTRTtime = theComTime->getTime(); } RISFTobject->setTrtEventPhase(myTRTtime); diff --git a/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.h b/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.h index 41f6d4cc74e32dbc4d4936e034686ad374aee7ca..887d0ddef141c25fcd302f8e62795ec7c17a58fb 100644 --- a/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.h +++ b/PhysicsAnalysis/EventTag/EventTagRawAlgs/src/RawInfoSummaryForTagWriter.h @@ -17,7 +17,8 @@ Jamie Boyd 21 Jan 2008 (Jamie.Boyd@cern.ch) #include "GaudiKernel/ToolHandle.h" #include "AthenaKernel/IOVSvcDefs.h" #include "GaudiKernel/ServiceHandle.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include <string> #include <vector> @@ -66,13 +67,13 @@ class RawInfoSummaryForTagWriter : public AthAlgorithm SG::ReadHandleKey<MBTSCollisionTime> m_MBTSCollTimeKey; SG::ReadHandleKey<SpacePointContainer> m_sctSpacePointName; SG::ReadHandleKey<SpacePointContainer> m_pixSpacePointName; - SG::ReadHandleKey<BCM_RDO_Container> m_bcmRDOName; SG::ReadHandleKey<TileCellContainer> m_mbtsName; SG::ReadHandleKey<LArCollisionTime> m_larCollTimeName; SG::ReadHandleKey<ComTime> m_trtPhaseName; + SG::ReadHandleKey<BCM_RDO_Container> m_bcmRDOName{ + this, "BCM_RDOKey", "BCM_RDOs", "SG key for BCM RDOs"}; SG::WriteHandleKey<RawInfoSummaryForTag> m_RISFTKey; - bool m_doClusterSums;//!< turn on/off the cluster sum in the tag (as it crashes if Tile is off) std::string m_mbtsContainerName; @@ -85,7 +86,8 @@ class RawInfoSummaryForTagWriter : public AthAlgorithm //coral::AttributeListSpecification* m_attribListSpec; - ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; }; #endif diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt index 5ce7e9ac8986aafcf6fac2ebe1bc206584bfe606..15d5161eb53fdc0983cd7fe33af1dacd00a4e4f2 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt @@ -42,13 +42,17 @@ atlas_add_library( FlavorTagDiscriminants Root/DL2Tool.cxx Root/customGetter.cxx Root/FlipTagEnums.cxx + Root/VRJetOverlapDecorator.cxx + Root/VRJetOverlapDecoratorTool.cxx Root/HbbTag.cxx + Root/HbbTagTool.cxx Root/HbbTagConfig.cxx Root/HbbGraphConfig.cxx Root/VRJetOverlapDecorator.cxx INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} PUBLIC_HEADERS FlavorTagDiscriminants LINK_LIBRARIES AsgTools xAODBase xAODJet xAODMuon xAODEventInfo PathResolver + JetInterface ${LWTNN_LIBRARIES}) if (NOT XAOD_STANDALONE) diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/FlavorTagDiscriminantsDict.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/FlavorTagDiscriminantsDict.h index 0d8d0d56eda9c332c25be25b01f8a24cd6968690..6fa9f8866181ee704541d84809adcd30c44a5b2a 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/FlavorTagDiscriminantsDict.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/FlavorTagDiscriminantsDict.h @@ -8,6 +8,7 @@ // This file includes all the header files that you need to create // dictionaries for. +#include "FlavorTagDiscriminants/HbbTagTool.h" #include "FlavorTagDiscriminants/DL2Tool.h" #include "FlavorTagDiscriminants/BTagAugmenterTool.h" #include "FlavorTagDiscriminants/BTagMuonAugmenterTool.h" diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h index 43f41eb9173242f955fdb56c6a1e565705f2f593..2ce72c57439abae49ad663a71fcd00fe6e27dc23 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h @@ -23,6 +23,7 @@ namespace FlavorTagDiscriminants { { public: HbbTag(const HbbTagConfig& config); + ~HbbTag(); void decorate(const xAOD::Jet& jet) const; private: diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTagTool.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTagTool.h new file mode 100644 index 0000000000000000000000000000000000000000..18ac4e7abe92d47cfbe9f761f4a521f5808329bd --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTagTool.h @@ -0,0 +1,37 @@ +// for text editors: this file is -*- C++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef HBB_TAG_TOOL_H +#define HBB_TAG_TOOL_H + +#include "AsgTools/AsgTool.h" +#include "JetInterface/IJetDecorator.h" + +namespace FlavorTagDiscriminants { + + class HbbTag; + + struct HbbTagProperties { + std::string nnFile; + }; + + class HbbTagTool : public asg::AsgTool, virtual public IJetDecorator + { + ASG_TOOL_CLASS(HbbTagTool, IJetDecorator ) + public: + HbbTagTool(const std::string& name); + ~HbbTagTool(); + + StatusCode initialize() override; + + // returns 0 for success + StatusCode decorate(const xAOD::JetContainer& jets) const override; + private: + HbbTagProperties m_props; + std::unique_ptr<HbbTag> m_hbb; + }; + +} +#endif diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/VRJetOverlapDecoratorTool.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/VRJetOverlapDecoratorTool.h new file mode 100644 index 0000000000000000000000000000000000000000..59e2f4651017b8f3e8d9cf75c881a1d93c6440cd --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/VRJetOverlapDecoratorTool.h @@ -0,0 +1,32 @@ +// for text editors: this file is -*- C++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef VR_JET_OVERLAP_DECORATOR_TOOL_H +#define VR_JET_OVERLAP_DECORATOR_TOOL_H + +#include "AsgTools/AsgTool.h" +#include "JetInterface/IJetDecorator.h" + +class VRJetOverlapDecorator; + +namespace FlavorTagDiscriminants { + + class VRJetOverlapDecoratorTool : public asg::AsgTool, virtual public IJetDecorator + { + ASG_TOOL_CLASS(VRJetOverlapDecoratorTool, IJetDecorator ) + public: + VRJetOverlapDecoratorTool(const std::string& name); + ~VRJetOverlapDecoratorTool(); + + StatusCode initialize() override; + + // returns 0 for success + StatusCode decorate(const xAOD::JetContainer& jets) const override; + private: + std::unique_ptr<VRJetOverlapDecorator> m_dec; + }; + +} +#endif diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md index 280db9f138ed6b33020fa4ef3907cc1e0a3e717d..7023310b498811eefee13f9fff7052f30f7dc6b0 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md @@ -73,6 +73,30 @@ Some components of Hbb tagging also live here. These include: flavor tagging inputs. It also uses `HbbGraphConfig` and `HbbConstants`. + - `HbbTagTool`: ASG Tool interface around `HbbTag`. + + - `VRJetOverlapDecorator`: Adds decorations which quantify the + degree of overlap between VR subjets. The validity of flavor + tagging calibrations depends on this overlap being small. Two + numbers in particular are added: + + - `relativeDeltaRToVRJet`: smallest value of `dR / jet_radius`, + considering this jet paired with every other jet in the + event. Here `dR` is the angular separation between the two + jets, while `jet_radius` is the smallest the of the two jet + radii. + + - `deltaRToVRJet`: corresponds to the `dR` to whatever jet has + the smallest _relative_ delta R. This isn't necessarily the + smallest delta R. + + A smaller value in either of these corresponds to a larger + overlap. In general we recommend removing any jet where + `relativeDeltaRToVRJet < 1.0`. + + - `VRJetOverlapDecoratorTool`: ASG interface around the class + above. + ### Other Files ### @@ -91,7 +115,7 @@ The neural networks we use in DL2 are saved as JSON files in the [ATLAS groupdata area][gd]. They follow the naming scheme ``` -[dev/]flavtag/<timestamp>/<tagger>/<tagger-specific-name>.json +[dev/]BTagging/<timestamp>/<tagger>/<jet-collection>/<tagger-specific-name>.json ``` where the `dev/` is for taggers which are in development (i.e. should diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx index 8e5a310342b4b6338ffdc659f8ec11fed7bedec2..f2acff73d034e0887f130754c878c5782fe717ec 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx @@ -87,6 +87,7 @@ namespace FlavorTagDiscriminants { m_outputs.emplace_back(node_name, node_writer); } } + HbbTag::~HbbTag() {} void HbbTag::decorate(const xAOD::Jet& jet) const { namespace hk = hbb_key; diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTagTool.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTagTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..72ebd1d5de773ae276f5c8dab9b5edf6f2d00244 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTagTool.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FlavorTagDiscriminants/HbbTagTool.h" +#include "FlavorTagDiscriminants/HbbTag.h" + +namespace FlavorTagDiscriminants { + + HbbTagTool::HbbTagTool(const std::string& name): + asg::AsgTool(name), + m_props(), + m_hbb(nullptr) + { + declareProperty("nnFile", m_props.nnFile); + } + HbbTagTool::~HbbTagTool() {} + + StatusCode HbbTagTool::initialize() { + ATH_MSG_INFO("Initialize HbbTag from: " + m_props.nnFile); + m_hbb.reset(new HbbTag(HbbTagConfig(m_props.nnFile))); + return StatusCode::SUCCESS; + } + + StatusCode HbbTagTool::decorate(const xAOD::JetContainer& jets) const { + for (const xAOD::Jet* jet: jets) { + m_hbb->decorate(*jet); + } + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/VRJetOverlapDecoratorTool.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/VRJetOverlapDecoratorTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a324d10be16531bea867028dee37109d9df038c2 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/VRJetOverlapDecoratorTool.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FlavorTagDiscriminants/VRJetOverlapDecoratorTool.h" +#include "FlavorTagDiscriminants/VRJetOverlapDecorator.h" + +namespace FlavorTagDiscriminants { + + VRJetOverlapDecoratorTool::VRJetOverlapDecoratorTool(const std::string& name): + asg::AsgTool(name), + m_dec(nullptr) + { + } + VRJetOverlapDecoratorTool::~VRJetOverlapDecoratorTool() {} + + StatusCode VRJetOverlapDecoratorTool::initialize() { + m_dec.reset(new VRJetOverlapDecorator); + return StatusCode::SUCCESS; + } + + StatusCode VRJetOverlapDecoratorTool::decorate(const xAOD::JetContainer& jets) const { + m_dec->decorate(jets); + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/components/FlavorTagDiscriminants_entries.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/components/FlavorTagDiscriminants_entries.cxx index 626fb19f5b841e4b81c47fa6745f8aba6b6d77c2..4855fa22f06f3ceb583efc61ee61a9fb1018b59a 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/components/FlavorTagDiscriminants_entries.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/components/FlavorTagDiscriminants_entries.cxx @@ -2,12 +2,16 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "FlavorTagDiscriminants/VRJetOverlapDecoratorTool.h" +#include "FlavorTagDiscriminants/HbbTagTool.h" #include "FlavorTagDiscriminants/DL2Tool.h" #include "FlavorTagDiscriminants/BTagAugmenterTool.h" #include "FlavorTagDiscriminants/BTagMuonAugmenterTool.h" using namespace FlavorTagDiscriminants; +DECLARE_COMPONENT(VRJetOverlapDecoratorTool) +DECLARE_COMPONENT(HbbTagTool) DECLARE_COMPONENT(DL2Tool) DECLARE_COMPONENT(BTagAugmenterTool) DECLARE_COMPONENT(BTagMuonAugmenterTool) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h index b74d9fd3dac5611f98a17c30c435692ca7055f25..61ee38e22928796ebfb13d4a38d38424c0873660 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h @@ -20,7 +20,8 @@ #include "BTagging/IBTagTrackAssociation.h" #include "BTagging/IBTagSecVertexing.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace Analysis{ @@ -53,7 +54,8 @@ class JetBTaggerAlg: ToolHandle< IBTagTool > m_bTagTool; ToolHandle< IBTagTrackAssociation > m_BTagTrackAssocTool; ToolHandle< IBTagSecVertexing > m_bTagSecVtxTool; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; }; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerTool.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerTool.h index d7784fdfac728de06513a327bbca9e5ce40bcc43..293b5ccd12ed2e0706e74663510ce4b91084a248 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerTool.h @@ -19,7 +19,8 @@ #include "StoreGate/WriteHandleKey.h" #include "StoreGate/WriteDecorHandleKey.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace Analysis{ @@ -45,6 +46,8 @@ class JetBTaggerTool: private: SG::ReadHandleKey<xAOD::JetContainer > m_JetCollectionName { this, "JetCollectionName", "", "Input jet container"}; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; Gaudi::Property<SG::WriteDecorHandleKey<xAOD::JetContainer> >m_jetBTaggingLinkName{this,"JetContainerName","","Element link form jet to BTagging container"}; SG::WriteHandleKey<xAOD::BTaggingContainer> m_BTaggingCollectionName { this, "BTaggingCollectionName", "", "Output BTagging container"} ; @@ -54,7 +57,6 @@ class JetBTaggerTool: ToolHandle< IBTagTrackAssociation > m_BTagTrackAssocTool; ToolHandle< IBTagSecVertexing > m_bTagSecVtxTool; bool m_augment; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; }; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h index 64969d14122d060ea30af5c100cabddb2cb3cb05..061b1fd3fc5a38c4dad372983d9cb62f96dfd4f0 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h @@ -22,7 +22,8 @@ #include "BTagging/IBTagTool.h" #include "BTagging/IBTagLightSecVertexing.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace Analysis{ class IJetFitterVariablesFactory; @@ -47,6 +48,8 @@ class JetBTaggingAlg: //SG::ReadHandleKey<xAOD::VertexContainer> m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}; SG::ReadHandleKey<xAOD::VertexContainer> m_BTagSVCollectionName {this, "BTagSVCollectionName", "", "Input BTagging secondary vertex container"}; SG::ReadHandleKey<xAOD::BTagVertexContainer> m_BTagJFVtxCollectionName {this, "BTagJFVtxCollectionName", "", "Input BTagging Jet Fitter container"}; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; SG::WriteDecorHandleKey<xAOD::JetContainer> m_jetBTaggingLinkName {this, "BTaggingLinkName", "", "Element link from jet to BTagging container"}; SG::WriteHandleKey<xAOD::BTaggingContainer> m_BTaggingCollectionName {this, "BTaggingCollectionName", "", "Output BTagging container"}; SG::WriteDecorHandleKey<xAOD::BTaggingContainer> m_bTagJetDecorLinkName {this, "JetLinkName", "", "Element Link from BTagging to Jet container"}; @@ -55,7 +58,6 @@ class JetBTaggingAlg: ToolHandle< IBTagTool > m_bTagTool; ToolHandle< IBTagLightSecVertexing > m_bTagSecVtxTool; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; }; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt index e295aa977188748b9a1340a1c6def617502a047b..7b4db02be98369920740ce0e69f058bf5b82380e 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt @@ -12,7 +12,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODBTagging Event/xAOD/xAODJet GaudiKernel - MagneticField/MagFieldInterfaces Reconstruction/Jet/JetInterface Tracking/TrkEvent/VxVertex PRIVATE @@ -31,7 +30,10 @@ atlas_depends_on_subdirs( PUBLIC Reconstruction/Particle Tracking/TrkEvent/TrkLinks Tracking/TrkEvent/VxJetVertex - Tracking/TrkEvent/VxSecVertex ) + Tracking/TrkEvent/VxSecVertex + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( Eigen ) @@ -55,13 +57,13 @@ atlas_add_library( BTaggingLib src/HighLevelBTagAlg.cxx PUBLIC_HEADERS BTagging PRIVATE_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES AsgTools AthenaBaseComps xAODBTagging xAODJet GaudiKernel MagFieldInterfaces JetInterface VxVertex ParticleJetToolsLib JetTagToolsLib FlavorTagDiscriminants - PRIVATE_LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives xAODBase xAODCore xAODMuon xAODTracking InDetRecToolInterfaces JetTagEvent JetTagInfo Particle TrkLinks VxJetVertex VxSecVertex ) + LINK_LIBRARIES AsgTools AthenaBaseComps xAODBTagging xAODJet GaudiKernel JetInterface VxVertex ParticleJetToolsLib JetTagToolsLib FlavorTagDiscriminants + PRIVATE_LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives xAODBase xAODCore xAODMuon xAODTracking InDetRecToolInterfaces JetTagEvent JetTagInfo Particle TrkLinks VxJetVertex VxSecVertex MagFieldElements MagFieldConditions ) atlas_add_component( BTagging src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AsgTools AthenaBaseComps xAODBTagging xAODJet GaudiKernel MagFieldInterfaces JetInterface VxVertex GeoPrimitives xAODBase xAODCore xAODMuon xAODTracking InDetRecToolInterfaces ParticleJetToolsLib JetTagEvent JetTagInfo JetTagToolsLib FlavorTagDiscriminants Particle TrkLinks VxJetVertex VxSecVertex BTaggingLib ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AsgTools AthenaBaseComps xAODBTagging xAODJet GaudiKernel JetInterface VxVertex GeoPrimitives xAODBase xAODCore xAODMuon xAODTracking InDetRecToolInterfaces ParticleJetToolsLib JetTagEvent JetTagInfo JetTagToolsLib FlavorTagDiscriminants Particle TrkLinks VxJetVertex VxSecVertex BTaggingLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py index 313c3876162a654108bde15e653844fcd0f96788..365414623b27bb2b32bcf3066c1d32c6487421c3 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py @@ -130,17 +130,12 @@ def BTagCfg(inputFlags,**kwargs): from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg result.merge(PixelGeometryCfg( inputFlags )) + # get standard config for magnetic field - map and cache + from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg + result.merge(MagneticFieldSvcCfg( inputFlags )) + from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline - result.merge(addFolders(inputFlags,['/GLOBAL/BField/Maps <noover/>'],'GLOBAL_OFL')) - #result.merge(addFolders(inputFlags,['/GLOBAL/BField/Maps <noover/>'],'GLOBAL_ONL')) - #result.merge(addFolders(inputFlags,['/GLOBAL/TrackingGeo/LayerMaterialV2'],'GLOBAL_ONL')) - result.merge(addFolders(inputFlags,['/EXT/DCS/MAGNETS/SENSORDATA'],'DCS_OFL')) - MagField__AtlasFieldSvc=CompFactory.MagField.AtlasFieldSvc - kwargs.setdefault( "UseDCS", True ) - result.addService(MagField__AtlasFieldSvc("AtlasFieldSvc",**kwargs)) - del kwargs['UseDCS'] - #load folders needed for Run2 ID alignment result.merge(addFoldersSplitOnline(inputFlags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")) result.merge(addFolders(inputFlags,['/TRT/Align'],'TRT_OFL')) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/RecExRecoTest_ART_btagging_fromESD.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/RecExRecoTest_ART_btagging_fromESD.py index 65d0661d10758a50c658a66727099680366dfa64..2a9553232dc5dda14c75d91b3bf1fc2921baab50 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/RecExRecoTest_ART_btagging_fromESD.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/RecExRecoTest_ART_btagging_fromESD.py @@ -13,6 +13,10 @@ doDumpProperties=True #Turn of TAG rec.doWriteTAG.set_Value_and_Lock(False) +#Disables PFO Thnning - these cotnainers do not exist, unless you run jet finding +from ParticleBuilderOptions.AODFlags import AODFlags +AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False) + athenaCommonFlags.EvtMax=-1 #Run btagging diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx index 717f65cf2db2de556e019e78e032181fe5b8a716..dbb0b874d6f4d7e17c0fd5004286800c9df4e862 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx @@ -28,15 +28,13 @@ namespace Analysis { m_BTagLink(".btaggingLink"), m_bTagTool("Analysis::BTagTool",this), m_BTagTrackAssocTool("Analysis::BTagTrackAssociation",this), - m_bTagSecVtxTool("Analysis::BTagSecVertexing",this), - m_magFieldSvc("AtlasFieldSvc",n) + m_bTagSecVtxTool("Analysis::BTagSecVertexing",this) { declareProperty("JetCalibrationName", m_JetName); declareProperty("BTaggingLink", m_BTagLink); declareProperty("BTagTool", m_bTagTool); declareProperty("BTagTrackAssocTool", m_BTagTrackAssocTool); declareProperty("BTagSecVertexing", m_bTagSecVtxTool); - declareProperty("MagFieldSvc", m_magFieldSvc ); } JetBTaggerAlg::~JetBTaggerAlg() @@ -83,19 +81,19 @@ namespace Analysis { ATH_MSG_DEBUG("#BTAGVTX# Retrieved tool " << m_bTagSecVtxTool); } - /// retrieve the magnetic field service - if (m_magFieldSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_magFieldSvc); - return StatusCode::FAILURE; - } + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); return StatusCode::SUCCESS; } StatusCode JetBTaggerAlg::execute() { + + EventContext ctx = Gaudi::Hive::currentContext(); + //retrieve the Jet container - SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName); + SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName, ctx); if (!h_JetCollectionName.isValid()) { ATH_MSG_ERROR( " cannot retrieve jet container with key " << m_JetCollectionName.key() ); return StatusCode::FAILURE; @@ -109,18 +107,29 @@ namespace Analysis { } //Decor Jet with element link to the BTagging - SG::WriteDecorHandle<xAOD::JetContainer,ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName); + SG::WriteDecorHandle<xAOD::JetContainer,ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName, ctx); //Create a xAOD::BTaggingContainer in any case (must be done) std::string bTaggingContName = m_BTaggingCollectionName.key(); ATH_MSG_DEBUG("#BTAG# Container name: "<< bTaggingContName); /* Record the BTagging output container */ - SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName); + SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName, ctx); ATH_CHECK( h_BTaggingCollectionName.record(std::make_unique<xAOD::BTaggingContainer>(), std::make_unique<xAOD::BTaggingAuxContainer>()) ); - if (!m_magFieldSvc->solenoidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.solenoidOn()) { for (size_t jetIndex=0; jetIndex < h_JetCollectionName->size() ; ++jetIndex) { const xAOD::Jet * jet = h_JetCollectionName->at(jetIndex); ElementLink< xAOD::BTaggingContainer> linkBTagger; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerTool.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerTool.cxx index 7e56b9a45c9c9f8f1aad62f8da4cb6f70eea4058..d2c524af54a0964d02d95a3d394c78b585fd2660 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerTool.cxx @@ -34,15 +34,13 @@ namespace Analysis { m_bTagTool("Analysis::BTagTool",this), m_BTagTrackAssocTool("Analysis::BTagTrackAssociation", this), m_bTagSecVtxTool("Analysis::BTagSecVertexing", this), - m_augment(false), - m_magFieldSvc("AtlasFieldSvc",n) + m_augment(false) { declareProperty( "JetCalibrationName", m_JetName); declareProperty( "BTagTool", m_bTagTool); declareProperty( "BTagTrackAssocTool", m_BTagTrackAssocTool); declareProperty( "BTagSecVertexing", m_bTagSecVtxTool); declareProperty( "BTagAugmentation", m_augment, "switch to decide whether to merely extend the BTagging information as opposed to re-tagging from scratch"); - declareProperty("MagFieldSvc", m_magFieldSvc ); } JetBTaggerTool::~JetBTaggerTool() @@ -88,19 +86,18 @@ namespace Analysis { ATH_MSG_DEBUG("#BTAGVTX# Retrieved tool " << m_bTagSecVtxTool); } - /// retrieve the magnetic field service - if (m_magFieldSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_magFieldSvc); - return StatusCode::FAILURE; - } + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); return StatusCode::SUCCESS; } StatusCode JetBTaggerTool::execute() { + EventContext ctx = Gaudi::Hive::currentContext(); + //retrieve the Jet container - SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName); + SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName, ctx); if (!h_JetCollectionName.isValid()) { ATH_MSG_ERROR( " cannot retrieve jet container with key " << m_JetCollectionName.key() ); return StatusCode::FAILURE; @@ -114,18 +111,29 @@ namespace Analysis { } //Decor Jet with element link to the BTagging - SG::WriteDecorHandle<xAOD::JetContainer,ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName); + SG::WriteDecorHandle<xAOD::JetContainer,ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName, ctx); //Create a xAOD::BTaggingContainer in any case (must be done) std::string bTaggingContName = m_BTaggingCollectionName.key(); ATH_MSG_DEBUG("#BTAG# Container name: "<< bTaggingContName); /* Record the BTagging output container */ - SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName); + SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName, ctx); ATH_CHECK( h_BTaggingCollectionName.record(std::make_unique<xAOD::BTaggingContainer>(), std::make_unique<xAOD::BTaggingAuxContainer>()) ); - if (!m_magFieldSvc->solenoidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.solenoidOn()) { for (size_t jetIndex=0; jetIndex < h_JetCollectionName->size() ; ++jetIndex) { const xAOD::Jet * jet = h_JetCollectionName->at(jetIndex); ElementLink< xAOD::BTaggingContainer> linkBTagger; @@ -214,9 +222,21 @@ namespace Analysis { ATH_CHECK(sc); + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache (fieldCache); + xAOD::JetContainer::const_iterator itB = jets.begin(); xAOD::JetContainer::const_iterator itE = jets.end(); - if (m_magFieldSvc->solenoidOn()) { + if (fieldCache.solenoidOn()) { for (xAOD::JetContainer::const_iterator it = itB ; it != itE; ++it) { xAOD::BTagging * newBTagMT = new xAOD::BTagging(); h_BTaggingCollectionName->push_back(newBTagMT); diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx index b381bcd2383a8a4632a9e20651cb511222d454a6..cc3647eb31eeef558084ee8d97068c9c94caf6f2 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx @@ -29,13 +29,11 @@ namespace Analysis { AthAlgorithm(n,p), m_JetName(""), m_bTagTool("Analysis::BTagTool",this), - m_bTagSecVtxTool("Analysis::BTagSecVertexing",this), - m_magFieldSvc("AtlasFieldSvc",n) + m_bTagSecVtxTool("Analysis::BTagSecVertexing",this) { declareProperty("JetCalibrationName", m_JetName); declareProperty("BTagTool", m_bTagTool); declareProperty("BTagSecVertexing", m_bTagSecVtxTool); - declareProperty("MagFieldSvc", m_magFieldSvc ); } JetBTaggingAlg::~JetBTaggingAlg() @@ -79,11 +77,8 @@ namespace Analysis { ATH_MSG_DEBUG("#BTAGVTX# Retrieved tool " << m_bTagSecVtxTool); } - /// retrieve the magnetic field service - if (m_magFieldSvc.retrieve().isFailure()){ - ATH_MSG_ERROR("Could not get " << m_magFieldSvc); - return StatusCode::FAILURE; - } + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if (m_jetParticleLinkNameList.size() == 0) { ATH_MSG_FATAL( "#BTAG# Please provide track to jet association list"); @@ -95,8 +90,11 @@ namespace Analysis { StatusCode JetBTaggingAlg::execute() { + + EventContext ctx = Gaudi::Hive::currentContext(); + //retrieve the Jet container - SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName); + SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName, ctx); if (!h_JetCollectionName.isValid()) { ATH_MSG_ERROR( " cannot retrieve jet container with key " << m_JetCollectionName.key() ); return StatusCode::FAILURE; @@ -110,7 +108,7 @@ namespace Analysis { } //retrieve the JF Vertex container - SG::ReadHandle<xAOD::BTagVertexContainer> h_BTagJFVtxCollectionName (m_BTagJFVtxCollectionName.key() ); + SG::ReadHandle<xAOD::BTagVertexContainer> h_BTagJFVtxCollectionName (m_BTagJFVtxCollectionName.key(), ctx ); if (!h_BTagJFVtxCollectionName.isValid()) { ATH_MSG_ERROR( " cannot retrieve JF Vertex container with key " << m_BTagJFVtxCollectionName.key() ); return StatusCode::FAILURE; @@ -118,7 +116,7 @@ namespace Analysis { ATH_MSG_DEBUG("#BTAG# Size of the JF Vertex container: " << h_BTagJFVtxCollectionName->size()); //retrieve the Secondary Vertex container - SG::ReadHandle<xAOD::VertexContainer> h_BTagSVCollectionName ( m_BTagSVCollectionName.key() ); + SG::ReadHandle<xAOD::VertexContainer> h_BTagSVCollectionName ( m_BTagSVCollectionName.key(), ctx ); if (!h_BTagSVCollectionName.isValid()) { ATH_MSG_ERROR( " cannot retrieve Sec Vertex container with key " << m_BTagJFVtxCollectionName.key() ); return StatusCode::FAILURE; @@ -126,20 +124,31 @@ namespace Analysis { //Decor Jet with element link to the BTagging - SG::WriteDecorHandle<xAOD::JetContainer, ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName); + SG::WriteDecorHandle<xAOD::JetContainer, ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName, ctx); //Decor BTagging with element link to the Jet - SG::WriteDecorHandle<xAOD::BTaggingContainer, ElementLink< xAOD::JetContainer > > h_bTagJetLinkName(m_bTagJetDecorLinkName); + SG::WriteDecorHandle<xAOD::BTaggingContainer, ElementLink< xAOD::JetContainer > > h_bTagJetLinkName(m_bTagJetDecorLinkName, ctx); //Create a xAOD::BTaggingContainer in any case (must be done) std::string bTaggingContName = m_BTaggingCollectionName.key(); ATH_MSG_DEBUG("#BTAG# Container name: "<< bTaggingContName); /* Record the BTagging output container */ - SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName); + SG::WriteHandle<xAOD::BTaggingContainer> h_BTaggingCollectionName (m_BTaggingCollectionName, ctx); ATH_CHECK( h_BTaggingCollectionName.record(std::make_unique<xAOD::BTaggingContainer>(), std::make_unique<xAOD::BTaggingAuxContainer>()) ); - if (!m_magFieldSvc->solenoidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return StatusCode::FAILURE; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.solenoidOn()) { for (size_t jetIndex=0; jetIndex < h_JetCollectionName->size() ; ++jetIndex) { const xAOD::Jet * jet = h_JetCollectionName->at(jetIndex); ElementLink< xAOD::BTaggingContainer> linkBTagger; @@ -153,7 +162,7 @@ namespace Analysis { h_BTaggingCollectionName->push_back(newBTagMT); //Track association for(SG::ReadDecorHandleKey<xAOD::JetContainer > elTP : m_jetParticleLinkNameList) { - SG::ReadDecorHandle<xAOD::JetContainer, std::vector<ElementLink< xAOD::TrackParticleContainer> > > h_jetParticleLinkName(elTP); + SG::ReadDecorHandle<xAOD::JetContainer, std::vector<ElementLink< xAOD::TrackParticleContainer> > > h_jetParticleLinkName(elTP, ctx); if (!h_jetParticleLinkName.isAvailable()) { ATH_MSG_ERROR( " cannot retrieve jet container particle EL decoration with key " << elTP.key() ); return StatusCode::FAILURE; diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx index fd8c485e2b4e7c64b238279ce60bf01074e3545f..feaef044feb3b78cdc61a26c47e1d02afbda46aa 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx @@ -2,21 +2,13 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//#include "ITrackToVertex/ITrackToVertex.h" -#include "xAODJet/JetContainer.h" #include "xAODJet/JetAttributes.h" #include "xAODBTagging/BTagging.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODMuon/MuonContainer.h" -#include "JetTagMonitoring/JetTagMonitoring.h" -#include "JetTagTools/TrackSelector.h" +#include "JetTagMonitoring.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" +// #include "xAODTracking/TrackParticle.h" +// #include "xAODTracking/Vertex.h" #include "TrigDecisionTool/TrigDecisionTool.h" // added by SARA #include "TrkParticleBase/LinkToTrackParticleBase.h" @@ -41,46 +33,15 @@ #include <string> #include <sstream> -//** --------------------------------------------------------------------------------------------------------------- **// - -// Private methods - -namespace { - - template< class T > - bool retrieveCollection(const ServiceHandle<StoreGateSvc>& sg, const DataHandle<T>& coll, std::string key ) { - - StatusCode sc; - sc = sg->retrieve( coll, key ); - - if (!sc.isSuccess()) - return false; - - return true; - } - -} // unnamed namespace - - //** --------------------------------------------------------------------------------------------------------------- **// JetTagMonitoring::JetTagMonitoring(const std::string & type, const std::string & name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent), - m_storeGate( "StoreGateSvc", name ), - m_trackSelectorTool("Analysis::TrackSelector"), - m_trackToVertexTool("Reco::TrackToVertex"), - m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool"), // added by SARA m_histogramsCreated(false), + m_jetBtagKey(this, "JetBtagKey", m_jetName.key()+".btaggingLink"), m_switch_off(false) { - - declareProperty("JetContainer", m_jetName = "AntiKt4EMTopoJets"); - declareProperty("TrackParticleContainer", m_trackParticleName = "InDetTrackParticles"); - declareProperty("PrimaryVertexContainer", m_primaryVertexName = "PrimaryVertices"); - declareProperty("ElectronContainer", m_electronName = "Electrons"); // added by SARA - declareProperty("MuonContainer", m_muonName = "Muons" ); // added by SARA - declareProperty("DQcuts", m_do_cuts = true); declareProperty("PriVtxTrkMinCut", m_pri_vtx_trk_min_cut = 4 ); @@ -179,11 +140,12 @@ StatusCode JetTagMonitoring::initialize() { return sc; } - sc = m_storeGate.retrieve(); - if (!sc.isSuccess()) { - ATH_MSG_WARNING("Unable to retrieve StoreGateSvc handle"); - m_switch_off = true; - } + ATH_CHECK(m_jetName.initialize()); + ATH_CHECK(m_trackParticleName.initialize()); + ATH_CHECK(m_primaryVertexName.initialize()); + ATH_CHECK(m_electronName.initialize()); + ATH_CHECK(m_muonName.initialize()); + ATH_CHECK(m_eventInfoKey.initialize()); if ( m_use_trackselector ) { if ( m_trackSelectorTool.retrieve().isFailure() ) { @@ -194,6 +156,10 @@ StatusCode JetTagMonitoring::initialize() { ATH_MSG_INFO("Analysis::TrackSelector not used"); } + if (!m_use_trigdectool) { + m_trigDecTool.disable(); + } + if ( m_switch_off ) ATH_MSG_WARNING("Switching off JetTagMonitoring::fillHistograms()"); @@ -589,9 +555,11 @@ StatusCode JetTagMonitoring::fillHistograms() { m_cutflow->Fill(0.); - const xAOD::EventInfo* thisEventInfo; - if (evtStore()->retrieve(thisEventInfo).isFailure()) - ATH_MSG_WARNING("Cannot retrieve EventInfo"); + SG::ReadHandle<xAOD::EventInfo> thisEventInfo{m_eventInfoKey}; + if (!thisEventInfo.isValid()) { + ATH_MSG_ERROR("Cannot retrieve EventInfo"); + return StatusCode::FAILURE; + } m_lumiBlockNum = thisEventInfo->lumiBlock(); @@ -692,16 +660,13 @@ StatusCode JetTagMonitoring::fillHistograms() { unsigned int npv = 0, npv_trk = 0; double xpv = 0., ypv = 0., zpv = 0.; - const xAOD::VertexContainer* vxContainer(0); - // const DataHandle<VxContainer> vxContainer; - StatusCode foundPrimaryVtx = evtStore()->retrieve(vxContainer, m_primaryVertexName); - - if (!foundPrimaryVtx) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_primaryVertexName << "\" from StoreGate"); + SG::ReadHandle<xAOD::VertexContainer> vxContainer{m_primaryVertexName}; + if (!vxContainer.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_primaryVertexName.key() << "\" from StoreGate"); return StatusCode::SUCCESS; } - ATH_MSG_DEBUG("VxContainer \"" << m_primaryVertexName << "\" found with " << vxContainer->size() << " entries"); + ATH_MSG_DEBUG("VxContainer \"" << m_primaryVertexName.key() << "\" found with " << vxContainer->size() << " entries"); npv = vxContainer->size(); m_global_nPrimVtx->Fill((float)npv); @@ -786,18 +751,14 @@ StatusCode JetTagMonitoring::fillHistograms() { /////////////////////////////// - const DataHandle<xAOD::TrackParticleContainer> trackParticles; - bool foundTrackPartColl = retrieveCollection(m_storeGate, trackParticles, m_trackParticleName); - - if (!foundTrackPartColl) { - - ATH_MSG_WARNING("Unable to retrieve \"" << m_trackParticleName << "\" from StoreGate"); + SG::ReadHandle<xAOD::TrackParticleContainer> trackParticles{m_trackParticleName}; + if (!trackParticles.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_trackParticleName.key() << "\" from StoreGate"); return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG("TrackParticleContainer \"" << m_trackParticleName << "\" found with " << trackParticles->size() << " entries"); + ATH_MSG_DEBUG("TrackParticleContainer \"" << m_trackParticleName.key() << "\" found with " << trackParticles->size() << " entries"); xAOD::TrackParticleContainer::const_iterator trackParticleItr = trackParticles->begin(); xAOD::TrackParticleContainer::const_iterator trackParticleEnd = trackParticles->end(); @@ -927,29 +888,25 @@ bool JetTagMonitoring::isTopEvent() { // added by SARA for 2017 data taking // == 1 isolated muon with pT > m_MuonPtCut (normally 25 GeV) // electron and muon of opposite charge - const DataHandle<xAOD::ElectronContainer> electrons; - bool foundElectronColl = retrieveCollection(m_storeGate, electrons, m_electronName); - - if (!foundElectronColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_electronName << "\" from StoreGate"); + SG::ReadHandle<xAOD::ElectronContainer> electrons{m_electronName}; + if (!electrons.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_electronName.key() << "\" from StoreGate"); return false; } - ATH_MSG_DEBUG("ElectronContainer \"" << m_electronName << "\" found with " << electrons->size() << " entries"); + ATH_MSG_DEBUG("ElectronContainer \"" << m_electronName.key() << "\" found with " << electrons->size() << " entries"); xAOD::ElectronContainer::const_iterator electronItr = electrons->begin(); xAOD::ElectronContainer::const_iterator electronEnd = electrons->end(); xAOD::ElectronContainer::const_iterator isoElectronItr = electrons->end(); - const DataHandle<xAOD::MuonContainer> muons; - bool foundMuonColl = retrieveCollection(m_storeGate, muons, m_muonName); - - if (!foundMuonColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_muonName << "\" from StoreGate"); + SG::ReadHandle<xAOD::MuonContainer> muons{m_muonName}; + if (!muons.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_muonName.key() << "\" from StoreGate"); return false; } - ATH_MSG_DEBUG("MuonContainer \"" << m_muonName << "\" found with " << muons->size() << " entries"); + ATH_MSG_DEBUG("MuonContainer \"" << m_muonName.key() << "\" found with " << muons->size() << " entries"); xAOD::MuonContainer::const_iterator muonItr = muons->begin(); xAOD::MuonContainer::const_iterator muonEnd = muons->end(); @@ -1126,15 +1083,13 @@ void JetTagMonitoring::fillJetHistograms() { //* Jet container *// ///////////////////// - const DataHandle<xAOD::JetContainer> jets; - bool foundJetColl = retrieveCollection(m_storeGate, jets, m_jetName); - - if (!foundJetColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_jetName << "\" from StoreGate"); + SG::ReadHandle<xAOD::JetContainer> jets{m_jetName}; + if (!jets.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_jetName.key() << "\" from StoreGate"); return; } - ATH_MSG_DEBUG("JetContainer \"" << m_jetName << "\" found with " << jets->size() << " entries"); + ATH_MSG_DEBUG("JetContainer \"" << m_jetName.key() << "\" found with " << jets->size() << " entries"); xAOD::JetContainer::const_iterator jetItr = jets->begin(); xAOD::JetContainer::const_iterator jetEnd = jets->end(); @@ -1600,6 +1555,7 @@ void JetTagMonitoring::fillSuspectJetHistos(const xAOD::Jet *jet) { const xAOD::BTagging* btag = jet->btagging(); if (not btag){ ATH_MSG_WARNING("btag pointer is null in JetTagMonitoring::fillSuspectJetHistos; filling these histograms will be skipped"); + return; } double sv1ip3d = btag->SV1plusIP3D_discriminant(); double mv_tmp = 0; diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h similarity index 92% rename from PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h rename to PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h index bab6fc68a18dc7dfcebdadcf0a5aa80b1b03ec30..aac2f4c94ea36866edd44aa7c58269af37fbd0a6 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h @@ -24,8 +24,16 @@ #include "GaudiKernel/ToolHandle.h" #include "ITrackToVertex/ITrackToVertex.h" #include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include "JetTagTools/TrackSelector.h" -#include "xAODJet/Jet.h" +#include "xAODJet/JetContainer.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODEventInfo/EventInfo.h" + +// #include "xAODJet/Jet.h" #include "TrigDecisionTool/TrigDecisionTool.h" // added by SARA class TH1F_LW; @@ -37,9 +45,6 @@ class LWHist; namespace Trk { class VxCandidate; } -namespace Analysis { - class TrackSelector; -} /** * @brief Class for monitoring variables related to offline flavour tagging. @@ -95,12 +100,10 @@ private: Jet_t getTaggabilityLabel(const xAOD::Jet *jet); bool isTopEvent(); // added by SARA - ServiceHandle<StoreGateSvc> m_storeGate; - - ToolHandle< Analysis::TrackSelector > m_trackSelectorTool; - ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool; - ToolHandle< Trig::TrigDecisionTool > m_trigDecTool; // added by SARA + ToolHandle< Analysis::TrackSelector > m_trackSelectorTool{this, "TrackSelectorTool", "Analysis::TrackSelector"}; + ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool{this, "TrackToVertexTool", "Reco::TrackToVertex"}; + PublicToolHandle< Trig::TrigDecisionTool > m_trigDecTool{this, "JTMTrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}; // added by SARA /* ToolHandle<InDet::IInDetTestBLayerTool> m_blayerTool; */ bool m_histogramsCreated; @@ -108,15 +111,18 @@ private: const xAOD::Vertex* m_priVtx = nullptr; /** @brief String to retrieve JetContainer from StoreGate. */ - std::string m_jetName; + SG::ReadHandleKey<xAOD::JetContainer> m_jetName {this, "JetContainer", "AntiKt4EMTopoJets"}; /** @brief String to retrieve TrackParticleContainer from StoreGate. */ - std::string m_trackParticleName; + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleName {this, "TrackParticleContainer", "InDetTrackParticles"}; /** @brief String to retrieve PrimaryVertexContainer from StoreGate. */ - std::string m_primaryVertexName; + SG::ReadHandleKey<xAOD::VertexContainer> m_primaryVertexName {this, "PrimaryVertexContainer", "PrimaryVertices"}; /** @brief String to retrieve ElectronContainer from StoreGate. */ - std::string m_electronName; // added by SARA + SG::ReadHandleKey<xAOD::ElectronContainer> m_electronName {this, "ElectronContainer", "Electrons"}; // added by SARA /** @brief String to retrieve MuonContainer from StoreGate. */ - std::string m_muonName; // added by SARA + SG::ReadHandleKey<xAOD::MuonContainer> m_muonName {this, "MuonContainer", "Muons"}; // added by SARA + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {this, "EventInfoKey", "EventInfo"}; + SG::ReadDecorHandleKey<xAOD::JetContainer> m_jetBtagKey; /** @brief DQ cuts switcher. */ bool m_do_cuts; double m_trk_d0_min_cut; diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx index 31a3b80d3b711cc99e61b9786028fa358df89206..624e604f719815c05aaf2f039b005f2893bdb0c3 100644 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx @@ -1,4 +1,4 @@ -#include "JetTagMonitoring/JetTagMonitoring.h" +#include "../JetTagMonitoring.h" #include "../JetTagMonitorAlgorithm.h" DECLARE_COMPONENT( JetTagMonitoring ) diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h index 378d2492b1d8c432a7ea24db230daa669b3c2d77..0c7201d9e7527a35dcd37eea9ade9a65928c6ffe 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h @@ -10,6 +10,8 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "ITrackToVertex/ITrackToVertex.h" + #include <string> #include <bitset> @@ -109,7 +111,7 @@ private: int m_ntrf; mutable std::atomic<int> m_ntrc[numCuts]; - ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool; + ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool{this, "trackToVertexTool", "Reco::TrackToVertex"}; std::bitset<numCuts> m_passedCuts; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx index 6d9200f5b6b69a876d437d0c47e0f0b07eb69519..cee6040779a6295a21854ff6fc0049b919bd90d4 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx @@ -12,7 +12,6 @@ #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "GeoPrimitives/GeoPrimitives.h" #include "GaudiKernel/IToolSvc.h" -#include "ITrackToVertex/ITrackToVertex.h" #include <TMath.h> #include <string> #include <bitset> @@ -26,11 +25,10 @@ namespace Analysis { const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), m_ntri(0), - m_ntrf(0), - m_trackToVertexTool("Reco::TrackToVertex", this) { + m_ntrf(0) + { declareInterface<TrackSelector>(this); - declareProperty("trackToVertexTool", m_trackToVertexTool); declareProperty("useBLayerHitPrediction", m_useBLayerHitPrediction = false); declareProperty("usePerigeeParameters", m_usePerigeeParameters = false); declareProperty("pTMin", m_pTMin = 1.*Gaudi::Units::GeV); diff --git a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt index 0fda74025555b344a78891241d7eae804c00ef54..dab7644f21d059844bd550b15df9f5850855549a 100644 --- a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt +++ b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt @@ -56,7 +56,7 @@ else() Control/AthenaKernel ) set( extra_libs xAODCaloEvent xAODEgamma xAODJet xAODMuon xAODTracking - RecoToolInterfaces GeneratorObjects + RecoToolInterfaces GeneratorObjects ParticlesInConeToolsLib PRIVATE_LINK_LIBRARIES TrkEventPrimitives TrkParametersIdentificationHelpers ) endif() @@ -73,6 +73,7 @@ atlas_depends_on_subdirs( # External dependencies: find_package( ROOT COMPONENTS Core RIO ) +find_package( HepMC ) # Libraries in the package: if( HEPMC_FOUND ) diff --git a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx index 0b405a330e3799ead7b1efd1c595d8c022221fab..ed92f73571d0820c93cd2b5ca120d3328d8a6f7e 100644 --- a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx @@ -32,7 +32,7 @@ MCTruthClassifier::particleTruthClassifier(const HepMC::GenParticle* thePart, In } for (const auto& entry : *truthParticleLinkVecReadHandle) { - if (entry->first.isValid() && entry->second.isValid() && entry->first.cptr()->barcode() == thePart->barcode()) { + if (entry->first.isValid() && entry->second.isValid() && HepMC::barcode(entry->first.cptr()) == HepMC::barcode(thePart)) { const xAOD::TruthParticle* truthParticle = *entry->second; if (!compareTruthParticles(thePart, truthParticle)) { // if the barcode/pdg id / status of the pair does not match @@ -53,7 +53,7 @@ MCTruthClassifier::compareTruthParticles(const HepMC::GenParticle* genPart, cons if (!genPart || !truthPart) return false; - if (genPart->barcode() != truthPart->barcode() || genPart->pdg_id() != truthPart->pdgId() || + if (HepMC::barcode(genPart) != truthPart->barcode() || genPart->pdg_id() != truthPart->pdgId() || genPart->status() != truthPart->status()) { ATH_MSG_DEBUG("HepMC::GenParticle and xAOD::TruthParticle do not match"); return false; diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EffiCollection.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EffiCollection.h index d583ff0cc359bddfbbaa34d2add4133beea29628..45438ca29f678895fc6c492aed83ec680b05ecb6 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EffiCollection.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EffiCollection.h @@ -167,7 +167,7 @@ namespace CP { bool isNominal() const; bool isUpVariation() const; - bool seperateBinSyst() const; + bool separateBinSyst() const; private: std::map<std::string, std::pair<unsigned int, unsigned int>> findPeriods(const MuonEfficiencyScaleFactors& ref_tool) const; diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EfficiencyScaleFactor.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EfficiencyScaleFactor.h index 1d1d6387c91d73188cd9fed514fc44c65b98ca03..11a572c7649e902d623c3755d47a84d5d1bb7278 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EfficiencyScaleFactor.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/EfficiencyScaleFactor.h @@ -88,7 +88,7 @@ namespace CP { /// bin by bin bool SetSystematicBin(int bin); - bool SeperateSystBins() const; + bool separateBinSyst() const; bool IsUpVariation() const; @@ -174,7 +174,7 @@ namespace CP { /// steers the pt dependent systematics bool m_respond_to_kineDepSyst; /// Can the systematic be decorrelated - bool m_seperateBinSyst; + bool m_separateBinSyst; /// the histograms needed to run std::unique_ptr<HistHandler> m_sf; std::unique_ptr<HistHandler> m_eff; diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/HistHandler.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/HistHandler.h index 6dc6b68e0c2ca48e2910c9c964bcb67bbc3f44ef..01f06c8a01f4d0c206c2c261d2cdc2f19bf5154d 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/HistHandler.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/HistHandler.h @@ -15,7 +15,6 @@ #include <TH2Poly.h> #include "PATInterfaces/CorrectionCode.h" -#include "AsgMessaging/MessageCheck.h" // further ROOT includes #include <TFile.h> #include <TDirectory.h> @@ -28,8 +27,6 @@ #include <memory> #include <cmath> -ANA_MSG_HEADER (msgMuonEfficiency) - namespace CP { ///Forward declarations @@ -196,79 +193,47 @@ namespace CP { class PtAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - value = mu.pt() / 1000.; - return CorrectionCode::Ok; - } + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~PtAxisHandler() = default; - }; class ChargeAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - value = mu.charge(); - return CorrectionCode::Ok; - } + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~ChargeAxisHandler() = default; - }; class EtaAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - value = mu.eta(); - return CorrectionCode::Ok; - } + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~EtaAxisHandler() = default; - }; class AbsEtaAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - value = std::abs(mu.eta()); - return CorrectionCode::Ok; - } + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~AbsEtaAxisHandler() = default; - }; class PhiAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - value = mu.phi(); - return CorrectionCode::Ok; - } + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~PhiAxisHandler() = default; - }; class dRJetAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override { - static const SG::AuxElement::ConstAccessor<float> dRJet("dRJet"); - value = dRJet.isAvailable(mu) ? dRJet(mu) : -2; - // We want these warnings to be printed few times per job, so that they're visible, then stop before log file's size blows up - static std::atomic<unsigned int> warned = {0}; - if (warned<5 && !dRJet.isAvailable(mu)){ - using namespace msgMuonEfficiency; - ANA_MSG_WARNING("The dRJet decoration has not been found for the Muon. Isolation scale-factors are now also binned in #Delta R(jet,#mu)"); - ANA_MSG_WARNING("using the closest calibrated AntiKt4EMTopo jet with p_{T}>20~GeV and surving the standard OR criteria."); - ANA_MSG_WARNING("You should decorate your muon appropiately before passing to the tool, and use dRJet = -1 in case there is no jet in an event."); - ANA_MSG_WARNING("For the time being the inclusive scale-factor is going to be returned."); - ANA_MSG_WARNING("In future derivations, muons will also be decorated centrally with dRJet, for your benefit."); - warned++; - } - return CorrectionCode::Ok; - } + dRJetAxisHandler(); + + CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override; virtual ~dRJetAxisHandler() = default; - + static void set_close_jet_decorator(const std::string& decor_name); + + private: + static std::string m_close_jet_decor; + SG::AuxElement::ConstAccessor<float> m_acc; }; class UndefinedAxisHandler: public AxisHandler { public: - CorrectionCode GetBinningParameter(const xAOD::Muon &, float &) const override { - return CorrectionCode::Error; - } + CorrectionCode GetBinningParameter(const xAOD::Muon &, float &) const override; virtual ~UndefinedAxisHandler() = default; - }; } // namespace CP diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h index 30dce714741f9b726ea2db0e2dc0a287b500c061..fef0330e8126a6c7ef18dc6e15f5eb693ec14cde 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h @@ -25,7 +25,7 @@ namespace CP { public: MuonEfficiencyScaleFactors(const std::string& name); - virtual ~MuonEfficiencyScaleFactors(); + virtual ~MuonEfficiencyScaleFactors() = default; //Proper constructor for Athena ASG_TOOL_CLASS2( MuonEfficiencyScaleFactors, CP::IMuonEfficiencyScaleFactors, CP::ISystematicsTool ) @@ -135,6 +135,14 @@ namespace CP { /// Returns the number of EffiCollections stored in this class size_t getNCollections() const; + /// Returns a boolean whether the uncorrelation of systematics has been switched on + bool uncorrelate_sys() const; + + /// Returns the string telling the tool in which + /// float AuxElement the information of the separation + /// to the closest jet is stored + std::string close_by_jet_decoration() const; + private: /// utility method to 'dress' a filename using the path resolver @@ -165,10 +173,12 @@ namespace CP { /// subfolder to load from the calibration db std::string m_calibration_version; + /// threshold below which low-pt SF (i.e. from JPsi) should be used float m_lowpt_threshold; - + /// Name of the decoration to catch up the close by jets + std::string m_iso_jet_dR; CP::SystematicSet m_affectingSys; /// It turned out that the code spends a large time in the look up of /// the systematics. This map tries to mitigate this issue. diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonSFTestHelper.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonSFTestHelper.h index ec1693410b0951266e6c8399df22e95177cae586..f673ce1c378558585ad1f728fc668b60161fa354 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonSFTestHelper.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/MuonEfficiencyCorrections/MuonSFTestHelper.h @@ -35,7 +35,7 @@ namespace TestMuonSF { class SFBranches { public: SFBranches(TTree* tree); - virtual ~SFBranches(); + virtual ~SFBranches()= default; virtual std::string name() const =0; virtual bool init()=0; protected: @@ -62,7 +62,7 @@ namespace TestMuonSF { class TriggerSFBranches: public SFBranches { public: TriggerSFBranches(TTree* tree, const ToolHandle<CP::IMuonTriggerScaleFactors>& Handle, const std::string& Trigger); - virtual ~TriggerSFBranches(); + virtual ~TriggerSFBranches() = default; CP::CorrectionCode fill(const xAOD::MuonContainer* Muons); virtual bool init(); virtual std::string name() const; @@ -86,7 +86,7 @@ namespace TestMuonSF { public: MuonEffiBranches(TTree* tree); virtual CP::CorrectionCode fill(const xAOD::Muon& muon)=0; - virtual ~MuonEffiBranches(); + ~MuonEffiBranches() = default; }; typedef std::unique_ptr<MuonEffiBranches> EffiBranch_Ptr; @@ -96,13 +96,14 @@ namespace TestMuonSF { //################################################################### class MuonSFBranches: public MuonEffiBranches { public: - MuonSFBranches(TTree* tree, const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle, const std::string& rel_name = ""); - virtual CP::CorrectionCode fill(const xAOD::Muon& muon); - - virtual bool init(); - virtual std::string name() const; + MuonSFBranches(TTree* tree, const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle, const std::string& rel_name = ""); + CP::CorrectionCode fill(const xAOD::Muon& muon) override; + virtual ~MuonSFBranches() = default; + bool init() override; + std::string name() const override; private: ToolHandle<CP::IMuonEfficiencyScaleFactors> m_handle; + bool m_uncorrelate_sys; std::string m_release; //SF's @@ -114,6 +115,8 @@ namespace TestMuonSF { float mc_eff; float data_eff; }; + + CP::CorrectionCode fill_systematic(const xAOD::Muon muon, std::pair<const CP::SystematicSet, MuonSFBranches::SFSet>& set); bool AddToTree(const CP::SystematicSet& syst, MuonSFBranches::SFSet& ScaleFactor); std::map<CP::SystematicSet, SFSet> m_SFs; @@ -126,10 +129,10 @@ namespace TestMuonSF { class MuonReplicaBranches: public MuonEffiBranches { public: MuonReplicaBranches(TTree* tree, const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle, const std::string& rel_name = ""); - virtual CP::CorrectionCode fill(const xAOD::Muon& muon); + CP::CorrectionCode fill(const xAOD::Muon& muon) override; - virtual bool init(); - virtual std::string name() const; + bool init() override; + std::string name() const override; private: ToolHandle<CP::IMuonEfficiencyScaleFactors> m_handle; std::string m_release; @@ -143,10 +146,10 @@ namespace TestMuonSF { class MuonInfoBranches: public MuonEffiBranches { public: MuonInfoBranches(TTree* tree, const ToolHandle<CP::IMuonSelectionTool>& sel_tool); - virtual ~MuonInfoBranches(); - virtual bool init(); - virtual std::string name() const; - virtual CP::CorrectionCode fill(const xAOD::Muon& muon); + virtual ~MuonInfoBranches() = default; + bool init() override; + std::string name() const override; + CP::CorrectionCode fill(const xAOD::Muon& muon) override; private: const ToolHandle<CP::IMuonSelectionTool>& m_selection_tool; @@ -170,7 +173,7 @@ namespace TestMuonSF { MuonSFTestHelper(std::shared_ptr<TTree> Tree, const std::string& release_name = ""); MuonSFTestHelper(TTree*Tree, const std::string& release_name = ""); - ~MuonSFTestHelper(); + ~MuonSFTestHelper() = default; //Initialize the tool bool init(); diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EffiCollection.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EffiCollection.cxx index 44f21eda53e18bc9b33024a31ad667d57c9f8e63..31bae725abd6a1e1d9eff1557eff24f0c137b6a8 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EffiCollection.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EffiCollection.cxx @@ -8,8 +8,12 @@ #include <MuonEfficiencyCorrections/UtilFunctions.h> #include <TTree.h> namespace CP { - const std::vector<std::string> ToRemove { "GeV", "MeV", "[", "]", "{", "}", "(", ")", "#", " " }; - const std::vector<std::string> ToReplace { "-", "." }; + namespace { + static const std::vector<std::string> ToRemove { "GeV", "MeV", "[", "]", "{", "}", "(", ")", "#", " " }; + typedef std::pair<std::string,std::string> stringpair; + static const std::vector<stringpair> ToReplace { stringpair("-","minus"), stringpair(".","p")}; + + } EffiCollection::EffiCollection(const MuonEfficiencyScaleFactors& ref_tool) : m_ref_tool(ref_tool), m_central_eff(), @@ -100,16 +104,17 @@ namespace CP { /// bin numbers unsigned int n = m_central_eff->nBins(); std::function<void (CollectionContainer*)> assign_mapping = [this, &n](CollectionContainer* container){ - if (container != m_central_eff.get()){ + if (container != m_central_eff.get() && container->separateBinSyst()){ container->SetGlobalOffSet(n); - n += container->nBins(); + n += container->nBins(); }; }; assign_mapping(m_calo_eff.get()); assign_mapping(m_calo_eff.get()); - assign_mapping(m_forward_eff.get()); assign_mapping(m_lowpt_central_eff.get()); assign_mapping(m_lowpt_calo_eff.get()); + + assign_mapping(m_forward_eff.get()); /// Systematic constructor has been called. We can now assemble /// the systematic variations @@ -125,9 +130,9 @@ namespace CP { std::shared_ptr<CollectionContainer> container = retrieveContainer(file_type); if (container->isNominal()) continue; - if (container->seperateBinSyst()){ + if (container->separateBinSyst()){ /// Let the world implode... Yeaha register foreach bin - /// a systematic variation + /// a systematic variation for (unsigned int b = container->nBins() - 1; b > 0 ; --b){ unsigned int bin = b + container->globalOffSet(); if (container->isOverFlowBin(bin)) continue; @@ -222,8 +227,8 @@ namespace CP { for (const std::string& R : ToRemove) { BinName = ReplaceExpInString(BinName, R, ""); } - for (const std::string& R : ToReplace) { - BinName = ReplaceExpInString(BinName, R, "_"); + for (const stringpair& R : ToReplace) { + BinName = ReplaceExpInString(BinName, R.first, R.second); } return BinName; } @@ -404,9 +409,9 @@ namespace CP { if (m_SF.empty()) return false; return (*m_SF.begin())->IsUpVariation(); } - bool CollectionContainer::seperateBinSyst() const { + bool CollectionContainer::separateBinSyst() const { if (m_SF.empty()) return false; - return (*m_SF.begin())->SeperateSystBins(); + return (*m_SF.begin())->separateBinSyst(); } std::string CollectionContainer::sysname() const{ if (m_SF.empty()) return "UNKNOWN SYST"; diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EfficiencyScaleFactor.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EfficiencyScaleFactor.cxx index 3cc105aac3668dc441276b61b1998ee4410dd7ec..3dfff506bea67c76f86831b57851c8bda20ee45c 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EfficiencyScaleFactor.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/EfficiencyScaleFactor.cxx @@ -20,7 +20,7 @@ namespace CP { m_is_up(syst_type_bitmap & EffiCollection::UpVariation), m_is_lowpt(syst_type_bitmap & EffiCollection::JPsiAnalysis), m_respond_to_kineDepSyst(syst_type_bitmap & EffiCollection::PtDependent), - m_seperateBinSyst(syst_type_bitmap & EffiCollection::UnCorrelated), + m_separateBinSyst(syst_type_bitmap & EffiCollection::UnCorrelated), m_sf(), m_eff(), m_mc_eff(), @@ -44,7 +44,9 @@ namespace CP { m_firstRun(1), m_lastRun(999999){ - + if (ref_tool.measurement() == CP::MuonEfficiencyType::Iso){ + dRJetAxisHandler::set_close_jet_decorator(ref_tool.close_by_jet_decoration()); + } // open the file std::unique_ptr<TFile> f (TFile::Open(file.c_str(), "READ")); if (!f || !f->IsOpen()) { @@ -175,8 +177,8 @@ namespace CP { std::string EfficiencyScaleFactor::sysname(bool with_direction) const { return m_syst_name.empty() ? "" : EfficiencyTypeName(m_measurement) + "_" + m_syst_name +(m_is_lowpt ? "_LOWPT" : "") + (with_direction ? (m_is_up ?"__1UP" : "__1DN") :""); } - bool EfficiencyScaleFactor::SeperateSystBins() const { - return m_seperateBinSyst; + bool EfficiencyScaleFactor::separateBinSyst() const { + return m_separateBinSyst; } bool EfficiencyScaleFactor::IsUpVariation() const{ return m_is_up; @@ -286,7 +288,7 @@ namespace CP { return m_sf ? m_sf->isOverFlowBin(b) : true; } CorrectionCode EfficiencyScaleFactor::ScaleFactor(const xAOD::Muon& mu, float & SF) const { - if (m_seperateBinSyst && m_NominalFallBack) { + if (m_separateBinSyst && m_NominalFallBack) { int bin = -1; CorrectionCode cc = m_sf->FindBin(mu, bin); if (cc == CP::CorrectionCode::Error) { @@ -302,7 +304,7 @@ namespace CP { } CorrectionCode EfficiencyScaleFactor::DataEfficiency(const xAOD::Muon& mu, float & Eff) const { - if (m_seperateBinSyst && m_NominalFallBack && m_eff) { + if (m_separateBinSyst && m_NominalFallBack && m_eff) { int bin = -1; CorrectionCode cc = m_eff->FindBin(mu, bin); if (cc == CP::CorrectionCode::Error) { @@ -317,7 +319,7 @@ namespace CP { return cc; } CorrectionCode EfficiencyScaleFactor::MCEfficiency(const xAOD::Muon& mu, float & Eff) const { - if (m_seperateBinSyst && m_NominalFallBack && m_mc_eff) { + if (m_separateBinSyst && m_NominalFallBack && m_mc_eff) { int bin = -1; CorrectionCode cc = m_mc_eff->FindBin(mu, bin); if (cc == CP::CorrectionCode::Error) { @@ -442,7 +444,7 @@ namespace CP { if (!h) return; TRandom3 Rndm(seed); replicas.clear(); - replicas.resize(nrep); + replicas.reserve(nrep); int nBins = h->nBins(); for (int t = 0; t < nrep; t++) { replicas.push_back(package_histo(h->GetHist())); @@ -459,7 +461,7 @@ namespace CP { Error("EfficiencyScaleFactor::SetSystematicBin()", "No fallback has been given for %s", sysname().c_str()); return false; } - if (!m_seperateBinSyst || bin < 1 || bin > nBins()) { + if (!m_separateBinSyst || bin < 1 || bin > nBins()) { Error("EfficiencyScaleFactor::SetSystematicBin()", "The current bin %i is out of the maximum range %u ", bin, nBins()); return false; } diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/HistHandler.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/HistHandler.cxx index 0bd3f9df1746d4186b280ed362791b95497ecedc..c129f69ad92e6e0877df4fd5f10af926770e9ca2 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/HistHandler.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/HistHandler.cxx @@ -2,8 +2,9 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "MuonEfficiencyCorrections/HistHandler.h" +#include <MuonEfficiencyCorrections/HistHandler.h> #include <MuonEfficiencyCorrections/UtilFunctions.h> + #include <iostream> #include <cmath> #include <cstdint> @@ -12,9 +13,7 @@ #include <TH1.h> #include <TH2Poly.h> -ANA_MSG_SOURCE (msgMuonEfficiency, "MuonEfficiency") namespace CP { - using namespace msgMuonEfficiency; //########################################################################################################### // AxisHandlerProvider //########################################################################################################### @@ -45,6 +44,68 @@ namespace CP { } return std::make_unique<UndefinedAxisHandler>(); } + + + CorrectionCode PtAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + value = mu.pt() / 1000.; + return CorrectionCode::Ok; + } + CorrectionCode ChargeAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + value = mu.charge(); + return CorrectionCode::Ok; + } + CorrectionCode EtaAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + value = mu.eta(); + return CorrectionCode::Ok; + } + CorrectionCode AbsEtaAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + value = std::abs(mu.eta()); + return CorrectionCode::Ok; + } + CorrectionCode PhiAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + value = mu.phi(); + return CorrectionCode::Ok; + } + void dRJetAxisHandler::set_close_jet_decorator(const std::string& decor_name){ + m_close_jet_decor = decor_name; + } + + std::string dRJetAxisHandler::m_close_jet_decor = "dRJet"; + dRJetAxisHandler::dRJetAxisHandler(): + m_acc(m_close_jet_decor){} + + CorrectionCode dRJetAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const { + static std::atomic<unsigned int> warned = {0}; + static const SG::AuxElement::ConstAccessor<float> acc_dR_deriv("DFCommonJetDr"); + if (acc_dR_deriv.isAvailable(mu)){ + value = acc_dR_deriv(mu); + }else if( m_acc.isAvailable(mu) ) { + // decoration available in DxAOD + value = m_acc(mu); + if (warned < 5){ + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The DFCommonJetDr jet decoration is not available in the derivaiton will fall back to %s",m_close_jet_decor.c_str()); + ++warned; + } + } else { + // decoration not available + value = -2.; + // We want these warnings to be printed few times per job, so that they're visible, then stop before log file's size blows up + if (warned<5){ + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The %s decoration has not been found for the Muon. Isolation scale-factors are now also binned in #Delta R(jet,#mu)", m_close_jet_decor.c_str()); + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "using the closest calibrated AntiKt4EMTopo jet with p_{T}>20~GeV and surving the standard OR criteria."); + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "You should decorate your muon appropiately before passing to the tool, and use dRJet = -1 in case there is no jet in an event."); + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "For the time being the inclusive scale-factor is going to be returned."); + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "In future derivations, muons will also be decorated centrally with DFCommonJetDr, for your benefit."); + Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "You can define custom jet decorations via the 'CloseJetDRDecorator' property of the MuonEfficiencyCorrections tool"); + ++warned; + } + } + return CorrectionCode::Ok; + } + + CorrectionCode UndefinedAxisHandler::GetBinningParameter(const xAOD::Muon &, float &) const { + return CorrectionCode::Error; + } //########################################################################################################### // HistHandler //########################################################################################################### @@ -104,7 +165,7 @@ namespace CP { bool HistHandler_TH1::isOverFlowBin(int b) const { return b == 0 || b >= nBins() -1; } std::string HistHandler_TH1::GetBinName(unsigned int bin) const { TAxis* xAx = GetHist()->GetXaxis(); - return Form("%s_%.2f-%.2f", xAx->GetTitle(), xAx->GetBinLowEdge(bin), xAx->GetBinUpEdge(bin)); + return Form("%s_%.2f_to_%.2f", xAx->GetTitle(), xAx->GetBinLowEdge(bin), xAx->GetBinUpEdge(bin)); } CorrectionCode HistHandler_TH1::FindBin(const xAOD::Muon & muon, int & bin) const { if (!GetHist()) { @@ -179,7 +240,7 @@ namespace CP { GetHist()->GetBinXYZ(bin, x, y, z); TAxis* xAx = GetHist()->GetXaxis(); TAxis* yAx = GetHist()->GetYaxis(); - return Form("%s_%.2f-%.2f--%s_%.2f-%.2f", + return Form("%s_%.2f_to_%.2f_times_%s_%.2f_to_%.2f", //xAxis xAx->GetTitle(), xAx->GetBinLowEdge(x), xAx->GetBinUpEdge(x), //yAxis @@ -254,7 +315,7 @@ namespace CP { TAxis* xAx = GetHist()->GetXaxis(); TAxis* yAx = GetHist()->GetYaxis(); TAxis* zAx = GetHist()->GetZaxis(); - return Form("%s_%.2f-%.2f--%s_%.2f-%.2f--%s_%.2f-%.2f", + return Form("%s_%.2f_to_%.2f_times_%s_%.2f_to_%.2f_times_%s_%.2f_to_%.2f", //xAxis xAx->GetTitle(), xAx->GetBinLowEdge(x), xAx->GetBinUpEdge(x), //yAxis @@ -322,10 +383,8 @@ namespace CP { GetHist()->GetBinXYZ(bin, x, y, z); TAxis* xAx = GetHist()->GetXaxis(); TAxis* yAx = GetHist()->GetYaxis(); - return Form("%s_%.2f-%.2f--%s_%.2f-%.2f", - //xAxis + return Form("%s_%.2f_to_%.2f__times_%s_%.2f_to_%.2f", xAx->GetTitle(), xAx->GetBinLowEdge(x), xAx->GetBinUpEdge(x), - //yAxis yAx->GetTitle(), yAx->GetBinLowEdge(y), yAx->GetBinUpEdge(y)); } } // namespace CP diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonEfficiencyScaleFactors.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonEfficiencyScaleFactors.cxx index 64a9af1bdd88f86db91e2621c940e4c1bf4df36f..42d441877c3deb7c80816d6197ee1070eb7e838c 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonEfficiencyScaleFactors.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonEfficiencyScaleFactors.cxx @@ -31,8 +31,9 @@ namespace CP { m_efficiency_decoration_name_data(), m_efficiency_decoration_name_mc(), m_sf_decoration_name(), - m_calibration_version("200202_Precision_r21"), + m_calibration_version("200513_Precision_r21"), m_lowpt_threshold(15.e3), + m_iso_jet_dR("dRJet"), m_affectingSys(), m_filtered_sys_sets(), m_init(false), @@ -66,13 +67,17 @@ namespace CP { declareProperty("LowPtThreshold", m_lowpt_threshold); declareProperty("UncorrelateSystematics", m_seperateSystBins); declareProperty("BreakDownSystematics", m_breakDownSyst); + /// Name of the decorator carrying the information the distance to the + /// next what ever jet (AntiKt4EMTopo,....) + declareProperty("CloseJetDRDecorator", m_iso_jet_dR); } - - MuonEfficiencyScaleFactors::~MuonEfficiencyScaleFactors() { + std::string MuonEfficiencyScaleFactors::close_by_jet_decoration() const{ + return m_iso_jet_dR; } float MuonEfficiencyScaleFactors::lowPtTransition() const{ return m_lowpt_threshold; } + bool MuonEfficiencyScaleFactors::uncorrelate_sys() const { return m_seperateSystBins; } CP::MuonEfficiencyType MuonEfficiencyScaleFactors::measurement() const{ return m_Type; } @@ -134,6 +139,7 @@ namespace CP { } else { ATH_MSG_INFO("JPsi based low pt SF will start to rock below " << m_lowpt_threshold / 1000. << " GeV!"); } + std::set<std::string> decorations{ sf_decoration() , data_effi_decoration(), @@ -533,7 +539,7 @@ namespace CP { m_current_sf = itr->second; if (m_seperateSystBins && !itr->first.name().empty()){ - for (std::set<SystematicVariation>::iterator t = mySysConf.begin(); t != mySysConf.end(); ++t) { + for (std::set<SystematicVariation>::const_iterator t = mySysConf.begin(); t != mySysConf.end(); ++t) { if ((*t).isToyVariation()) { // First entry corresponds to the bin number and // the second entry to the position in which the map is ordered @@ -551,7 +557,7 @@ namespace CP { } std::string MuonEfficiencyScaleFactors::getUncorrelatedSysBinName(unsigned int Bin) const { if (!m_current_sf){ - throw std::runtime_error("No systematic has been loaded. Cannot return any syst-bin") ; + throw std::runtime_error("No systematic has been loaded. Cannot return any syst-bin") ; ATH_MSG_FATAL("No systematic has been loaded. Cannot return any syst-bin"); } diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonSFTestHelper.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonSFTestHelper.cxx index decd092d7e7da6143eda4dd3789aff756f7f467c..a27b3722164eb7a0defcdeeeaa85a8890ea176d7 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonSFTestHelper.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/MuonSFTestHelper.cxx @@ -4,6 +4,8 @@ #include "MuonEfficiencyCorrections/MuonSFTestHelper.h" #include "MuonEfficiencyCorrections/UtilFunctions.h" +#include "MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h" + #include "PATInterfaces/SystematicsUtil.h" #include <TH1D.h> @@ -29,8 +31,6 @@ namespace TestMuonSF { SFBranches::SFBranches(TTree* tree) : m_tree(tree) { } - SFBranches::~SFBranches() { - } //############################################################ // TriggerSFBranches //############################################################ @@ -44,8 +44,6 @@ namespace TestMuonSF { m_sys_up_SF(1.), m_sys_down_SF(1.) { } - TriggerSFBranches::~TriggerSFBranches() { - } CP::CorrectionCode TriggerSFBranches::fill(const xAOD::MuonContainer* muons) { if (getSF(muons, m_nominal_SF, CP::SystematicVariation("", 0)) == CP::CorrectionCode::Error) return CP::CorrectionCode::Error; if (getSF(muons, m_stat_up_SF, CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", +1)) == CP::CorrectionCode::Error) return CP::CorrectionCode::Error; @@ -82,48 +80,87 @@ namespace TestMuonSF { MuonEffiBranches::MuonEffiBranches(TTree* tree) : SFBranches(tree) { } - MuonEffiBranches::~MuonEffiBranches() { - } //############################################################ // MuonSFBranches //############################################################ MuonSFBranches::MuonSFBranches(TTree* tree, const ToolHandle<CP::IMuonEfficiencyScaleFactors> &handle, const std::string& rel_name) : MuonEffiBranches(tree), m_handle(handle), + m_uncorrelate_sys(dynamic_cast<const CP::MuonEfficiencyScaleFactors*>(handle.operator->())->uncorrelate_sys()), m_release(rel_name), m_SFs() { } CP::CorrectionCode MuonSFBranches::fill(const xAOD::Muon& muon) { - for (auto& Syst_SF : m_SFs) { - if (m_handle->applySystematicVariation(Syst_SF.first) != CP::SystematicCode::Ok) { - Error("MuonSFBranches()", "Failed to apply variation %s for %s", Syst_SF.first.name().c_str(), name().c_str()); - return CP::CorrectionCode::Error; - } - CP::CorrectionCode cc = m_handle->getEfficiencyScaleFactor(muon, Syst_SF.second.scale_factor); - if (cc == CP::CorrectionCode::Error) { - Error("MuonSFBranches()", "Failed to retrieve %s scale-factor for variation %s", name().c_str(), Syst_SF.first.name().c_str()); - return CP::CorrectionCode::Error; - } - - /// No data-mc efficiencies provided for eta beyond 2.5 - if (std::abs(muon.eta()) > 2.5) { - Syst_SF.second.data_eff = -1; - Syst_SF.second.mc_eff = -1; - continue; - } - cc = m_handle->getDataEfficiency(muon, Syst_SF.second.data_eff); - if (cc == CP::CorrectionCode::Error) { - Error("MuonSFBranches()", "Failed to retrieve %s data efficiency for variation %s", name().c_str(), Syst_SF.first.name().c_str()); - return CP::CorrectionCode::Error; - } - cc = m_handle->getMCEfficiency(muon, Syst_SF.second.mc_eff); - if (cc == CP::CorrectionCode::Error) { - Error("MuonSFBranches()", "Failed to retrieve %s mc efficiency for variation %s", name().c_str(), Syst_SF.first.name().c_str()); - return CP::CorrectionCode::Error; + /// Only the raw systematic sets have been activated + /// We can loop over each set and fill it properly + if (!m_uncorrelate_sys){ + for (auto& Syst_SF : m_SFs) { + CP::CorrectionCode cc = fill_systematic(muon,Syst_SF); + if (cc == CP::CorrectionCode::Error) return cc; } - } + } else { + int bin = m_handle->getUnCorrelatedSystBin(muon); + if (bin < 0){ + Warning("MuonSFBranches()", "Did not find a valid bin for muon with pT: %.2f GeV, eta: %.2f, phi: %2.f", + muon.pt(), muon.eta(),muon.phi()); + return CP::CorrectionCode::OutOfValidityRange; + } + for (auto& Syst_SF: m_SFs){ + /// Only process the nominal set or the set matching the syst bin + bool process = false; + if (Syst_SF.first.name().empty()) process =true; + else { + for (std::set<CP::SystematicVariation>::const_iterator t = Syst_SF.first.begin(); t != Syst_SF.first.end(); ++t) { + if ((*t).isToyVariation()) { + std::pair<unsigned, float> pair = (*t).getToyVariation(); + if (pair.first == (unsigned) bin){ + process = true; + break; + } + } + } + } + if (process) { + CP::CorrectionCode cc = fill_systematic(muon, Syst_SF); + if (cc == CP::CorrectionCode::Error) return cc; + } else { + /// Assign a dummy value + Syst_SF.second.scale_factor = Syst_SF.second.mc_eff = Syst_SF.second.data_eff = -1.; + } + } + } return CP::CorrectionCode::Ok; } + CP::CorrectionCode MuonSFBranches::fill_systematic(const xAOD::Muon muon, std::pair<const CP::SystematicSet, MuonSFBranches::SFSet>& Syst_SF){ + if (m_handle->applySystematicVariation(Syst_SF.first) != CP::SystematicCode::Ok) { + Error("MuonSFBranches()", "Failed to apply variation %s for %s", Syst_SF.first.name().c_str(), name().c_str()); + return CP::CorrectionCode::Error; + } + CP::CorrectionCode cc = m_handle->getEfficiencyScaleFactor(muon, Syst_SF.second.scale_factor); + if (cc == CP::CorrectionCode::Error) { + Error("MuonSFBranches()", "Failed to retrieve %s scale-factor for variation %s", name().c_str(), Syst_SF.first.name().c_str()); + return CP::CorrectionCode::Error; + } + + /// No data-mc efficiencies provided for eta beyond 2.5 + if (std::fabs(muon.eta()) > 2.5) { + Syst_SF.second.data_eff = -1; + Syst_SF.second.mc_eff = -1; + return CP::CorrectionCode::Ok; + } + cc = m_handle->getDataEfficiency(muon, Syst_SF.second.data_eff); + if (cc == CP::CorrectionCode::Error) { + Error("MuonSFBranches()", "Failed to retrieve %s data efficiency for variation %s", name().c_str(), Syst_SF.first.name().c_str()); + return CP::CorrectionCode::Error; + } + cc = m_handle->getMCEfficiency(muon, Syst_SF.second.mc_eff); + if (cc == CP::CorrectionCode::Error) { + Error("MuonSFBranches()", "Failed to retrieve %s mc efficiency for variation %s", name().c_str(), Syst_SF.first.name().c_str()); + return CP::CorrectionCode::Error; + } + return CP::CorrectionCode::Ok; + } + std::string MuonSFBranches::name() const { return m_release + (m_release.empty() ? "" : "_") + getProperty<std::string>(m_handle.operator->(), "WorkingPoint"); } @@ -195,8 +232,6 @@ namespace TestMuonSF { m_passHighPt(false), m_precLayers(0){ } - MuonInfoBranches::~MuonInfoBranches() { - } bool MuonInfoBranches::init() { if (!initBranch(m_pt, "pt")) return false; if (!initBranch(m_eta, "eta")) return false; @@ -242,7 +277,7 @@ namespace TestMuonSF { m_Branches(), m_sel_tool(){ if (release_name.find("/") != std::string::npos) m_name = "c" + release_name.substr(release_name.rfind("/") + 1, m_name.size()); // branches cannot start with number - m_Branches.push_back(EffiBranch_Ptr(new MuonInfoBranches(tree(),m_sel_tool))); + m_Branches.push_back(std::make_unique<TestMuonSF::MuonInfoBranches>(tree(),m_sel_tool)); if (HasOwnerShip) m_tree = std::shared_ptr < TTree > (m_tree_raw_ptr); } MuonSFTestHelper::MuonSFTestHelper(std::shared_ptr<TTree> tree, const std::string& release_name) : @@ -261,19 +296,17 @@ namespace TestMuonSF { m_sel_tool(){ if (release_name.find("/") != std::string::npos) m_name = "c" + release_name.substr(release_name.rfind("/") + 1, m_name.size()); // branches cannot start with number } - MuonSFTestHelper::~MuonSFTestHelper() { - } void MuonSFTestHelper::addTool(const asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> &handle) { addTool(handle.getHandle()); } void MuonSFTestHelper::addTool(const ToolHandle<CP::IMuonEfficiencyScaleFactors>& handle) { - m_Branches.push_back(EffiBranch_Ptr(new MuonSFBranches(tree(), handle, m_name))); + m_Branches.push_back(std::make_unique<TestMuonSF::MuonSFBranches>(tree(), handle, m_name)); } void MuonSFTestHelper::addReplicaTool(const asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> &handle) { addReplicaTool(handle.getHandle()); } void MuonSFTestHelper::addReplicaTool(const ToolHandle<CP::IMuonEfficiencyScaleFactors>& handle) { - m_Branches.push_back(EffiBranch_Ptr(new MuonReplicaBranches(tree(), handle, m_name))); + m_Branches.push_back(std::make_unique<TestMuonSF::MuonReplicaBranches>(tree(), handle, m_name)); } void MuonSFTestHelper::setSelectionTool(const asg::AnaToolHandle<CP::IMuonSelectionTool> & sel_tool){ setSelectionTool(sel_tool.getHandle()); diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/macros/CheckAppliedSFs.py b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/macros/CheckAppliedSFs.py index 12a6a852e140d899294d47b6ae61f9591195c108..789f9d80407cda57cf00b3433b1e5c65f26a518f 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/macros/CheckAppliedSFs.py +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/macros/CheckAppliedSFs.py @@ -23,11 +23,19 @@ class ReleaseComparer(object): ### Direct access to the branch which are going to be compared self.__old_branch = test_tree.GetLeaf(branch_old) self.__new_branch = test_tree.GetLeaf(branch_new) - + if not self.__old_branch: + raise NameError("Could not find "+branch_old+" in the Tree") + + if not self.__new_branch: + raise NameError("Could not find "+branch_new+" in the Tree") ### Weights as a function of the muon kinematics self.__old_weight = 1. if not weight_old else test_tree.GetLeaf(weight_old) self.__new_weight = 1. if not weight_new else test_tree.GetLeaf(weight_new) - + if weight_old and not self.__old_weight: + raise NameError("Could not find "+weight_old+" in the Tree") + if weight_new and not self.__new_weight: + raise NameError("Could not find "+weight_new+" in the Tree") + self.__quality_branch = test_tree.GetLeaf("Muon_quality") if branch_old.find("HighPt") != -1 : self.__quality_branch = test_tree.GetLeaf("Muon_isHighPt") if branch_old.find("LowPt") != -1 : self.__quality_branch = test_tree.GetLeaf("Muon_isLowPt") @@ -112,6 +120,11 @@ class SystematicComparer(ReleaseComparer): log_binning = True) self.__sys_old = test_tree.GetLeaf(branch_sys_old) self.__sys_new = test_tree.GetLeaf(branch_sys_new) + if not self.__sys_old: + raise NameError("Failed to retrieve "+branch_sys_old) + if not self.__sys_new: + raise NameError("Failed to retrieve "+branch_sys_new) + def fill(self): self.get_old_histo().fill(value = math.fabs(self.get_old_var().GetValue() - self.__sys_old.GetValue()) / (self.get_old_var().GetValue() if self.get_old_var().GetValue() != 0. else 1.) , @@ -125,8 +138,11 @@ KnownWPs = { "Loose" : "RECO", "Medium" : "RECO", "Tight" : "RECO", + "HightPt3Layers":"RECO", "HighPt" : "RECO", "LowPt" : "RECO", + "LowPtMVA" : "RECO", + "TTVA" : "TTVA", "FCLooseIso": "ISO", "FCTight_FixedRadIso": "ISO", @@ -146,12 +162,6 @@ def getArgParser(): parser.add_argument('-o', '--outDir', help='Specify a destination directory', default="Plots") parser.add_argument('-l', '--label', help='Specify the dataset you used with MuonEfficiencyCorrectionsSFFilesTest', default="Internal") parser.add_argument('-w', '--WP', help='Specify a WP to plot', nargs='+', default=[]) - parser.add_argument('--varType', help='Specify a variation type', nargs='+', default=["", - "MUON_EFF_RECO_SYS_LOWPT__1down", - "MUON_EFF_RECO_STAT_LOWPT__1down", - "MUON_EFF_RECO_SYS__1down", - "MUON_EFF_RECO_STAT__1down" - ]) parser.add_argument('-c', '--SFConstituent', help='Specify if you want to plot nominal value, sys or stat error', nargs='+', default=["SF","DataEff","MCEff"]) parser.add_argument('--bonusname', help='Specify a bonus name for the filename', default="") parser.add_argument('--bonuslabel', help='Specify a bonus label printed in the histogram', default="") @@ -165,19 +175,25 @@ def getCalibReleasesAndWP(tree): allWPs = set([wp for wp in KnownWPs.iterkeys() ]) WPs = [] for i in branchesInFile: + print i if not i.endswith("SF"): continue if not i.startswith("c"): continue calibCand = i[1:-3] - beststr = "" - for wp in allWPs: - wpstr = "_"+wp - if not wpstr in calibCand: continue - if calibCand.rfind(wpstr) < calibCand.rfind(beststr): beststr = wpstr - if len(beststr) > 0: - if not beststr[1:] in WPs: WPs.append(beststr[1:]) - if not calibCand.replace(beststr,"") in calibReleases: calibReleases.append(calibCand.replace(beststr,"")) + + wp_str = i[ : i.rfind("_")] + beststr = wp_str[wp_str.rfind("_")+1 : ] + if beststr in allWPs: + if not beststr in WPs: WPs.append(beststr) + if not calibCand[ : calibCand.find(beststr)-1] in calibReleases: calibReleases.append(calibCand[ : calibCand.find(beststr)-1]) print "INFO: Found the following working points: %s"%(", ".join(WPs)) return calibReleases, WPs + +def getSystematics(tree, wp, calib_release): + search_str = "c%s_%s_SF"%(calib_release, wp) + syst_names = [key.GetName()[len(search_str) + 2:] for key in tree.GetListOfBranches() if key.GetName().startswith(search_str) and key.GetName() != search_str] + print syst_names + return syst_names + if __name__ == "__main__": Options = getArgParser().parse_args() @@ -212,12 +228,13 @@ if __name__ == "__main__": Histos = [] for wp in WPs: + systematics = getSystematics(tree,wp, calibReleases[0])+[""] for t in Options.SFConstituent: corrType = "Scale Factor" if t == "DataEff": corrType = "Data efficiency" elif t == "MCEff": corrType = "MC efficiency" - for var in Options.varType: + for var in systematics: if len(var) == 0: Histos += [ ReleaseComparer( @@ -237,8 +254,8 @@ if __name__ == "__main__": test_tree = tree, branch_old = "c%s_%s_%s"%(calibReleases[0],wp,t), branch_new = "c%s_%s_%s"%(calibReleases[1],wp,t), - branch_sys_old = "c%s_%s_%s__%s"%(calibReleases[0],wp,t,var.replace("RECO",KnownWPs[wp])), - branch_sys_new = "c%s_%s_%s__%s"%(calibReleases[1],wp,t,var.replace("RECO",KnownWPs[wp])), + branch_sys_old = "c%s_%s_%s__%s"%(calibReleases[0],wp,t,var), + branch_sys_new = "c%s_%s_%s__%s"%(calibReleases[1],wp,t,var), )] continue diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/share/MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/share/MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py index bf85ce524b8e931e6ab8ddc7158b4a829e5a85a7..ef51eebeeb36f3d5ada3c6d7d256259a5ff9dcb3 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/share/MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/share/MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py @@ -29,55 +29,53 @@ theJob += CP__MuonCloseJetDecorationAlg("JetDecorationAlg", alg = CP__MuonEfficiencyCorrections_TestAlg("EffiTestAlg") alg.PileupReweightingTool = GetPRWTool() alg.MuonSelectionTool = GetSelectionTool() -alg.DefaultRelease="cFeb_2019" -alg.ValidationRelease="cJan_2020" +alg.DefaultRelease="cJan_2020" +alg.ValidationRelease="cApr_2020" alg.SGKey = "CalibratedMuons" ## Select 30 GeV muons for the high-pt WP only alg.MinPt = 3.e3 alg.MaxEta = 2.5 WPs = [ - # reconstruction WPs + # reconstruction WPs "LowPt", "Loose", "Medium", "Tight", - #"HighPt", - #"CaloTag", - # track-to-vertex-association WPs - #"TTVA", - # BadMuon veto SFs - "BadMuonVeto_HighPt", - # isolation WPs - "FCLooseIso", + "HighPt", + "CaloTag", + "HighPt3Layers", + "LowPtMVA", + # track-to-vertex-association WPs + "TTVA", + # BadMuon veto SFs + "BadMuonVeto_HighPt", + # isolation WPs + "FCLooseIso", + "FCTightIso", + "FCTightTrackOnlyIso", + "FCLoose_FixedRadIso", "FCTight_FixedRadIso", - "FCLoose_FixedRadIso", + "FCTightTrackOnly_FixedRadIso", + "FCTight_FixedRadIso", "FixedCutHighPtTrackOnlyIso", - "FCTightIso", - "FixedCutPflowLooseIso", - "FCTightTrackOnlyIso", + "FixedCutPflowLooseIso", "FixedCutPflowTightIso", - "FCTightTrackOnly_FixedRadIso", - ] + ] for WP in WPs: alg.EfficiencyTools += [GetMuonEfficiencyTool(WP, - Release="191111_Winter_PrecisionZ", - BreakDownSystematics=False, - UncorrelateSystematics=False)] + Release="200202_Precision_r21", + BreakDownSystematics=False, + UncorrelateSystematics=False)] alg.EfficiencyToolsForComparison += [GetMuonEfficiencyTool(WP, CustomInput = "/ptmp/mpp/junggjo9/Cluster/SFFiles/Feb_2020_iso/", BreakDownSystematics=False, UncorrelateSystematics=False)] - -#ToolSvc.MuonEfficiencyTool_CaloTag.ApplyKinematicSystematic = False -#ToolSvc.MuonEfficiencyTool_CaloTag_190530_r21.ApplyKinematicSystematic = False -### New working points -for WP in["HighPt3Layers", "LowPtMVA"]: - break - alg.EfficiencyTools += [GetMuonEfficiencyTool(WP, - CustomInput = "/eos/user/j/jojungge/AutumunRecommendations/to_copy/")] - alg.EfficiencyToolsForComparison += [GetMuonEfficiencyTool(WP, - CustomInput = "/eos/user/j/jojungge/AutumunRecommendations/to_copy/")] +try: ToolSvc.MuonEfficiencyTool_CaloTag.ApplyKinematicSystematic = False +except: pass +try: ToolSvc.MuonEfficiencyTool_CaloTag_200202_Precision_r21.ApplyKinematicSystematic = False +except: pass + theJob += alg # Do some additional tweaking: diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/src/MuonEfficiencyCorrections_TestAlg.h b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/src/MuonEfficiencyCorrections_TestAlg.h index 53f4a93483d780a359464e639ade08480d715808..e82c0569a6fc9a65fc86cccb6f0f9b355dbb9bd3 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/src/MuonEfficiencyCorrections_TestAlg.h +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/src/MuonEfficiencyCorrections_TestAlg.h @@ -32,11 +32,10 @@ namespace CP { MuonEfficiencyCorrections_TestAlg(const std::string& name, ISvcLocator* svcLoc); /// Function initialising the algorithm - virtual StatusCode initialize(); + StatusCode initialize() override; /// Function executing the algorithm - virtual StatusCode execute(); - virtual ~MuonEfficiencyCorrections_TestAlg() { - } + StatusCode execute() override; + virtual ~MuonEfficiencyCorrections_TestAlg() = default; private: SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"}; diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/util/MuonEfficiencyScaleFactorsTest.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/util/MuonEfficiencyScaleFactorsTest.cxx index c15814b8c1441f2d1981e572cc8ef54656a795b6..104a54d90197f73321a4c50a4005e74235dad2cd 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/util/MuonEfficiencyScaleFactorsTest.cxx +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/util/MuonEfficiencyScaleFactorsTest.cxx @@ -148,14 +148,15 @@ int main(int argc, char* argv[]) { const std::vector<std::string> WPs { // reconstruction WPs - "Loose", "Medium", "Tight", "HighPt", + "Loose", "Medium", "Tight", "HighPt", "LowPt", "LowPtMVA", // track-to-vertex-association WPs "TTVA", // BadMuon veto SFs "BadMuonVeto_HighPt", // isolation WPs - "FixedCutLooseIso", "LooseTrackOnlyIso", "LooseIso", "GradientIso", "GradientLooseIso", - "FixedCutTightTrackOnlyIso", "FixedCutHighPtTrackOnlyIso", "FixedCutTightIso" + "PLVLooseIso", "PLVTightIso", "HighPtTrackOnlyIso", + "Loose_FixedRadIso", "Tight_FixedRadIso", "PflowLoose_FixedRadIso", "PflowTight_FixedRadIso", "TightTrackOnly_FixedRadIso", + "Loose_VarRadIso", "Tight_VarRadIso", "PflowLoose_VarRadIso", "PflowTight_VarRadIso", "TightTrackOnly_VarRadIso" }; std::vector<EffiToolInstance> EffiTools; diff --git a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt index 2a4be6c836c9cf02f30f35dbf14741b9658c95e2..1b7fffff4fac4573f0801dba2477a0dc27db9342 100644 --- a/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt +++ b/PhysicsAnalysis/NTUPtoNTUP/JetN2N/CMakeLists.txt @@ -7,8 +7,4 @@ atlas_subdir( JetN2N ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h b/PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h index 82cfeefe3485b009edef336b8d025695b9475e07..bf993e129448ac47226d9f991143805439072127 100644 --- a/PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h +++ b/PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h @@ -16,8 +16,6 @@ #include "GaudiKernel/IAppMgrUI.h" -#include "StoreGateBindings/StoreGatePyExt.h" - //include the CLIDs of simple types so that we don't need to do this ourselves from ROOT prompt //when reading in kTreeAccess #include "SGTools/BuiltinsClids.h" diff --git a/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx b/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx index b0d5af28a2a1ee3d9045521ea408d17845189c14..ec3dba1c77eb1df37d40f0a96d63bb9aa26aa58b 100644 --- a/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx +++ b/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx @@ -16,6 +16,7 @@ #include "TChain.h" #include "AthAnalysisBaseComps/AthAnalysisHelper.h" +#include "StoreGateBindings/StoreGatePyExt.h" namespace Gaudi { IAppMgrUI* Init() { diff --git a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/AsgElectronRingerSelector.h b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/AsgElectronRingerSelector.h index 36efd866808d15ab529b6d27924eba293a2a0280..dbccb06ddd7b96979da7e47fe8e748e4bd203cae 100644 --- a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/AsgElectronRingerSelector.h +++ b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/AsgElectronRingerSelector.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017, 2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: AsgElectronRingerSelector.h 704615 2015-10-29 18:50:12Z wsfreund $ #ifndef RINGERSELECTORTOOLS_ASGELECTRONCALORINGERSELECTOR_H #define RINGERSELECTORTOOLS_ASGELECTRONCALORINGERSELECTOR_H @@ -21,8 +20,7 @@ #include "EgammaAnalysisInterfaces/IAsgElectronIsEMSelector.h" // xAOD includes: -#include "xAODCaloRings/CaloRingsContainer.h" // needed for caloRingsReader_t -#include "xAODCaloRings/RingSetConfContainerFwd.h" +#include "xAODCaloRings/RingSetConfContainer.h" // Local includes: #include "RingerSelectorTools/IAsgElectronRingerSelector.h" @@ -254,9 +252,6 @@ class AsgElectronRingerSelector : public asg::AsgMetadataTool, /// @brief Hold the track patterns: mutable TrackPatternsHolder *m_trackPat; - /// @brief The particles CaloRings decorations reader - xAOD::caloRingsReader_t* m_ringsELReader; - /// @brief Last particle accept bitmask (already applying the m_cutsToUse) asg::AcceptInfo m_accept; diff --git a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/IRedirectMsgStream.h b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/IRedirectMsgStream.h index c4616dc8eee90913739ab0d7cae28521c8540734..fcf799b0a67aec20395183143322235f711dd8b2 100644 --- a/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/IRedirectMsgStream.h +++ b/PhysicsAnalysis/RingerSelectorTools/RingerSelectorTools/tools/IRedirectMsgStream.h @@ -12,7 +12,6 @@ // Asg includes: # include "AsgTools/MsgStream.h" # include "AsgTools/MsgStreamMacros.h" -# include "xAODCaloRings/tools/PrintHelperFcns.h" //#pragma message "ASGTOOL or XAOD_STANDALONE" #else # include <iostream> diff --git a/PhysicsAnalysis/RingerSelectorTools/Root/AsgElectronRingerSelector.cxx b/PhysicsAnalysis/RingerSelectorTools/Root/AsgElectronRingerSelector.cxx index 55a4ea8fec49f74c7338e0da12e2ee24da5a0381..314f8fed155fd12c4f36446298e1b61799fc713b 100644 --- a/PhysicsAnalysis/RingerSelectorTools/Root/AsgElectronRingerSelector.cxx +++ b/PhysicsAnalysis/RingerSelectorTools/Root/AsgElectronRingerSelector.cxx @@ -8,6 +8,7 @@ #include <iostream> #include <limits> #include <iostream> +#include <sstream> #ifndef RINGER_STANDALONE // Athena framework includes: @@ -141,8 +142,6 @@ AsgElectronRingerSelector::AsgElectronRingerSelector(std::string asgToolName) : m_primVtxContName="PrimaryVertices", "The primary vertex container name" ); - m_ringsELReader = xAOD::getCaloRingsReader(); - } //============================================================================== @@ -297,7 +296,11 @@ StatusCode AsgElectronRingerSelector::configureFromStruct(RingerConfStruct &file for ( auto &discrWrapper : m_discrWrapperCol ) { discrWrapper->setRawConfCol( &m_rawConfCol ); } - xAOD::RingSetConf::print( m_rawConfCol, msg() ); + if( msgLevel() <= MSG::DEBUG ) { + std::ostringstream str; + xAOD::RingSetConf::print( m_rawConfCol, str ); + ATH_MSG_DEBUG( str.str() ); + } } // See if we are using CutID selector and retrieve it if so: @@ -407,7 +410,7 @@ StatusCode AsgElectronRingerSelector::execute( // First, check if we can retrieve decoration: const xAOD::CaloRingsLinks *caloRingsLinks(nullptr); try { - caloRingsLinks = &(m_ringsELReader->operator()(*el)); + caloRingsLinks = &(xAOD::getCaloRingsReader()(*el)); } catch ( const std::exception &e) { ATH_MSG_ERROR("Couldn't retrieve CaloRingsLinks. Reason: " << e.what()); @@ -676,7 +679,11 @@ StatusCode AsgElectronRingerSelector::beginInputFile() discrWrapper->setRawConfCol( &m_rawConfCol ); } - xAOD::RingSetConf::print( m_rawConfCol, msg() ); + if( msgLevel() <= MSG::DEBUG ) { + std::ostringstream str; + xAOD::RingSetConf::print( m_rawConfCol, str ); + ATH_MSG_DEBUG( str.str() ); + } m_metaDataCached = true; } else { // Flag that meta is on outputMeta rather than the input @@ -703,7 +710,11 @@ StatusCode AsgElectronRingerSelector::beginInputFile() for ( auto &discrWrapper : m_discrWrapperCol ) { discrWrapper->setRawConfCol( &m_rawConfCol ); } - xAOD::RingSetConf::print( m_rawConfCol, msg() ); + if( msgLevel() <= MSG::DEBUG ) { + std::ostringstream str; + xAOD::RingSetConf::print( m_rawConfCol, str ); + ATH_MSG_DEBUG( str.str() ); + } ATH_MSG_DEBUG( "Successfully retrieve configuration info."); } diff --git a/PhysicsAnalysis/RingerSelectorTools/util/dumpRings.cxx b/PhysicsAnalysis/RingerSelectorTools/util/dumpRings.cxx index 1325ee38c72118b52de40de81c2761f34dcda5c2..acdac7845c9adc5fd1f304ab027bb1b2b3fb8a15 100644 --- a/PhysicsAnalysis/RingerSelectorTools/util/dumpRings.cxx +++ b/PhysicsAnalysis/RingerSelectorTools/util/dumpRings.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // // Print out the rings information and its metadata. @@ -48,7 +48,7 @@ int main( int argc, char* argv[] ) { return 1; } - auto* ringsReader = getCaloRingsReader(); + const auto& ringsReader = getCaloRingsReader(); // // Add initialization code for tools here @@ -83,11 +83,11 @@ int main( int argc, char* argv[] ) { std::cout << "The electron size is : " << electronCont->size() << std::endl; for ( const xAOD::Electron *electron : *electronCont ){ std::cout << "----------------- CaloRings info ------------------- " << std::endl; - std::cout << "isAvailable is : " << ringsReader->isAvailable(*electron) << std::endl; + std::cout << "isAvailable is : " << ringsReader.isAvailable(*electron) << std::endl; std::cout << "(eta,phi) is : (" << electron->eta() << "," << electron->phi() << ") | cluster pt is : " << electron->caloCluster()->pt() << std::endl; - if ( ringsReader->isAvailable(*electron) ) { + if ( ringsReader.isAvailable(*electron) ) { //std::cout << "isAvailableWritable is : " << ringsReader->isAvailableWritable(*electron) << std::endl; - const xAOD::CaloRingsLinks &caloRingsELVec = ringsReader->operator()(*electron); + const xAOD::CaloRingsLinks &caloRingsELVec = ringsReader(*electron); std::cout << "The vectorEL size is : " << caloRingsELVec.size() << std::endl; for ( const ElementLink<xAOD::CaloRingsContainer> &clRingsEL : caloRingsELVec ){ if ( clRingsEL.isValid() ) { diff --git a/PhysicsAnalysis/RingerSelectorTools/util/ringsHist.cxx b/PhysicsAnalysis/RingerSelectorTools/util/ringsHist.cxx index 6ff69b432b10490c2cd9f8a613b1370353abb041..ad85e92e93031942cf8ee55b030c2ba921c0cce1 100644 --- a/PhysicsAnalysis/RingerSelectorTools/util/ringsHist.cxx +++ b/PhysicsAnalysis/RingerSelectorTools/util/ringsHist.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // // Create a histogram with offline rings information @@ -51,7 +51,7 @@ int main( int argc, char* argv[] ) { return 1; } - auto* ringsReader = getCaloRingsReader(); + const auto& ringsReader = getCaloRingsReader(); // // Add initialization code for tools here @@ -95,7 +95,7 @@ int main( int argc, char* argv[] ) { if ( event.retrieve(electronCont, "Electrons").isSuccess() ){ for ( const Electron *electron : *electronCont ){ - const xAOD::CaloRingsLinks &caloRingsELVec = ringsReader->operator()(*electron); + const xAOD::CaloRingsLinks &caloRingsELVec = ringsReader(*electron); for ( const ElementLink<xAOD::CaloRingsContainer> &clRingsEL : caloRingsELVec ){ (*clRingsEL)->exportRingsTo(ringsE); for ( auto ringE : ringsE ){ diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py index cd687a7ab04a194943e393120b176c663fd1f4bb..d0efe972615c5787b1d22697bbc4fc0a819ff552 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/HNLFlags.py @@ -1,5 +1,5 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================= ## Name: HNLFlags.py @@ -18,10 +18,10 @@ from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties import AthenaCommon.SystemOfUnits as Units -import ROOT, cppyy -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') +from xAODPrimitives.xAODIso import xAODIso +import ROOT +from LongLivedParticleDPDMaker.PrimaryDPDFlags_RPVLLStream import jobproperties primRPVLLDESDM=jobproperties.PrimaryDPDFlags_RPVLLStream class doHnlElMu(JobProperty): @@ -116,7 +116,7 @@ class promptElectronIsoTypeHnl(JobProperty): # isolation type for prompt electrons statusOn = True allowedTypes = ["int"] - StoredValue = ROOT.xAOD.Iso.ptcone30 + StoredValue = xAODIso.ptcone30 pass primRPVLLDESDM.add_JobProperty(promptElectronIsoTypeHnl) @@ -124,7 +124,7 @@ class displacedElectronIsoTypeHnl(JobProperty): # isolation type for displaced electrons statusOn = True allowedTypes = ["int"] - StoredValue = ROOT.xAOD.Iso.ptcone30 + StoredValue = xAODIso.ptcone30 pass primRPVLLDESDM.add_JobProperty(displacedElectronIsoTypeHnl) @@ -132,7 +132,7 @@ class promptMuonTypesHnl(JobProperty): # allowed types of prompt muons statusOn = True allowedTypes = ["list"] - StoredValue = [ROOT.xAOD.Muon_v1.Combined] + StoredValue = [ROOT.xAOD.Muon.Combined] pass primRPVLLDESDM.add_JobProperty(promptMuonTypesHnl) @@ -140,8 +140,8 @@ class displacedMuonTypesHnl(JobProperty): # allowed types of displaced muons statusOn = True allowedTypes = ["list"] - StoredValue = [ROOT.xAOD.Muon_v1.Combined, - ROOT.xAOD.Muon_v1.MuonStandAlone] + StoredValue = [ROOT.xAOD.Muon.Combined, + ROOT.xAOD.Muon.MuonStandAlone] pass primRPVLLDESDM.add_JobProperty(displacedMuonTypesHnl) diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx index 7fbd99e53ba36526b53ea1ad9e8cf86fd1c9f3fb..e684027791018664180f5cbaaf2156ef95da898d 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Local include(s) @@ -24,8 +24,6 @@ using namespace TauAnalysisTools; //______________________________________________________________________________ BuildTruthTaus::BuildTruthTaus( const std::string& name ) : AsgMetadataTool(name) - , m_bIsData(false) - , m_bIsConfigured(false) , m_bTruthTauAvailable(true) , m_sNewTruthTauContainerNameAux("TruthTausAux.") , m_bTruthMuonAvailable(true) @@ -34,8 +32,6 @@ BuildTruthTaus::BuildTruthTaus( const std::string& name ) , m_tMCTruthClassifier("MCTruthClassifier", this) { declareProperty( "WriteTruthTaus", m_bWriteTruthTaus = false); - - // container names declareProperty( "NewTruthTauContainerName", m_sNewTruthTauContainerName = "TruthTaus"); declareProperty( "TruthTauContainerName", m_sTruthTauContainerName = "TruthTaus"); declareProperty( "TruthMuonContainerName", m_sTruthMuonContainerName = "TruthMuons"); @@ -70,28 +66,24 @@ StatusCode BuildTruthTaus::initialize() //______________________________________________________________________________ xAOD::TruthParticleContainer* BuildTruthTaus::getTruthTauContainer() { - if (m_bIsData) - return 0; if (!m_bTruthTauAvailable) return m_truthTausEvent.m_xTruthTauContainer; else { ATH_MSG_WARNING("TruthTau container was available from the event store and not rebuilt. Please get it from the event store"); - return 0; + return nullptr; } } //______________________________________________________________________________ xAOD::TruthParticleAuxContainer* BuildTruthTaus::getTruthTauAuxContainer() { - if (m_bIsData) - return 0; if (!m_bTruthTauAvailable) return m_truthTausEvent.m_xTruthTauAuxContainer; else { ATH_MSG_WARNING("TruthTau auxiliary container was available from the event store and not rebuilt. Please get it from the event store"); - return 0; + return nullptr; } } @@ -99,17 +91,11 @@ xAOD::TruthParticleAuxContainer* BuildTruthTaus::getTruthTauAuxContainer() StatusCode BuildTruthTaus::beginEvent() { m_truthTausEvent.m_valid = false; - if (m_bIsConfigured) - return StatusCode::SUCCESS; - - const xAOD::EventInfo* xEventInfo = 0; - ATH_CHECK(evtStore()->retrieve(xEventInfo,"EventInfo")); - m_bIsData = !(xEventInfo->eventType( xAOD::EventInfo::IS_SIMULATION)); - m_bIsConfigured=true; return StatusCode::SUCCESS; } + StatusCode BuildTruthTaus::retrieveTruthTaus() { return retrieveTruthTaus (m_truthTausEvent); @@ -124,9 +110,6 @@ StatusCode BuildTruthTaus::retrieveTruthTaus(ITruthTausEvent& truthTausEvent) co StatusCode BuildTruthTaus::retrieveTruthTaus(TruthTausEvent& truthTausEvent) const { - if (m_bIsData) - return StatusCode::SUCCESS; - if (truthTausEvent.m_valid) return StatusCode::SUCCESS; truthTausEvent.m_valid = true; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx index 015074bb714caf7dae60743a7691ed20a281d768..9a82a334f8b5049e20058b357d979697fb803658 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx @@ -47,9 +47,6 @@ StatusCode DiTauTruthMatchingTool::initialize() //______________________________________________________________________________ void DiTauTruthMatchingTool::getTruth(const xAOD::DiTauJet& xDiTau) { - if (m_bIsData) - return; - if (retrieveTruthTaus().isFailure()) return; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx index fb6ee6433bdbccd7ab71ae63a0131bf27379c334..309a733bffd8f0843fb3ac57f68d649d192ad1e9 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx @@ -65,8 +65,6 @@ TauTruthMatchingTool::getTruth(const xAOD::TauJet& xTau, ITruthTausEvent& itruthTausEvent) const { TruthTausEvent& truthTausEvent = dynamic_cast<TruthTausEvent&> (itruthTausEvent); - if (m_bIsData) - return nullptr; if (retrieveTruthTaus(truthTausEvent).isFailure()) return nullptr; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/BuildTruthTaus.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/BuildTruthTaus.h index 92ce175a84dd6eebfc261953de56b123d64d5001..7d763458eb97603489d9abcf70fd096b1802657c 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/BuildTruthTaus.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/BuildTruthTaus.h @@ -1,7 +1,5 @@ -// Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TAUANALYSISTOOLS_BUILDTRUTHTAUS_H @@ -9,12 +7,7 @@ /* author: Dirk Duschinger - mail: dirk.duschinger@cern.ch - documentation in: ../README.rst - or - https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/tags/TauAnalysisTools-<tag>/README.rst - or - https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/README.rst + documentation: https://gitlab.cern.ch/atlas/athena/-/blob/master/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst */ // Framework include(s): @@ -109,8 +102,6 @@ private: void printDecay(const xAOD::TruthParticle& xTruthParticle, int depth = 0) const; protected: - bool m_bIsData; - bool m_bIsConfigured; // steering variables bool m_bWriteTruthTaus; diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h index 5f20cd1489492fed12570b798fecf8592efd39f1..bfccaf2c6b71a234ca57b94e52337ddb00762c0d 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h @@ -109,13 +109,13 @@ class TruthParticle : public ParticleImpl< // */ /// Retrieve the GenParticle mother of this TruthParticle - const HepMC::GenParticle * genMother(const std::size_t i=0) const; + const HepMC::GenParticle* genMother(const std::size_t i=0) const; /// Retrieve the GenParticle this TruthParticle has been made from (if any) - const HepMC::GenParticle * genParticle() const; + const HepMC::GenParticle* genParticle() const; /// Retrieve the i-th child (GenParticle) of this TruthParticle - const HepMC::GenParticle * genChild( const std::size_t i ) const; + const HepMC::GenParticle* genChild( const std::size_t i ) const; /** @{ HepMC::GenParticle forwarding interface */ @@ -237,7 +237,7 @@ class TruthParticle : public ParticleImpl< protected: /// Fill the data members of ParticleBase from the GenParticle - void setGenParticle( const HepMC::GenParticle * particle ); + void setGenParticle( const HepMC::GenParticle* particle ); @@ -279,7 +279,7 @@ std::ostream& operator<<( std::ostream& out, const TruthParticle& mc ); inline TruthParticle::~TruthParticle() {} -inline const HepMC::GenParticle * TruthParticle::genParticle() const +inline const HepMC::GenParticle* TruthParticle::genParticle() const { return this->particleBase().genParticle(); } @@ -291,22 +291,22 @@ inline int TruthParticle::status() const inline const HepMC::Flow TruthParticle::flow() const { - return genParticle()->flow(); + return HepMC::flow(genParticle()); } inline int TruthParticle::flow( int code_index ) const { - return genParticle()->flow(code_index); + return HepMC::flow(genParticle(),code_index); } inline const HepMC::Polarization TruthParticle::polarization() const { - return genParticle()->polarization(); + return HepMC::polarization(genParticle()); } inline int TruthParticle::barcode() const { - return genParticle()->barcode(); + return HepMC::barcode(genParticle()); } inline unsigned int TruthParticle::nParents() const diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h index bb5c3fe8b1a66273b5fc6b810c8c165df3f1b362..289869ce35f5080849155eaef1d69cba3df924ef 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h @@ -112,7 +112,7 @@ class TruthParticleBase void setCharge( const ChargeType charge ); /// Fill the data members of ParticleBase from the GenParticle - void setGenParticle( const HepMC::GenParticle * particle ); + void setGenParticle( const HepMC::GenParticle* particle ); /// return the (atlas) unique identifier AthenaBarCodeImpl& getAthenaBarCodeImpl() {return m_abc;} diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/share/TruthParticle_test.ref b/PhysicsAnalysis/TruthParticleID/McParticleEvent/share/TruthParticle_test.ref index c86efe3e50db24b9b2eef343db9bd7b6fdb7b9fe..0c97e0a948620c1f33827c6ba155c37439c55bfa 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/share/TruthParticle_test.ref +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/share/TruthParticle_test.ref @@ -27,6 +27,7 @@ ApplicationMgr Ready Build test data... Launching tests... JobIDSvc INFO Initializing JobIDSvc - package version AthenaServices-00-00-00 +HepMcParticleLink INFO find_proxy: Using GEN_AOD as McEventCollection key for this job indices[0]= 0 child[0]= 24 24 child[1]= 5 5 diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/PileUpClassification.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/PileUpClassification.cxx index dd47c3cd1ffcc07230b96848dc117b8bc1394a88..92c6a0bd35c8ba82c8a41b5b12c55b171503172b 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/PileUpClassification.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/PileUpClassification.cxx @@ -24,7 +24,7 @@ void PileUpClassification::findEventIterators(PileuType_t putype, McEventCollect // Special case : there's no SEPARATOR between SIGNAL and INTIME : fEvt++; lEvt = fEvt; lEvt++; for(; lEvt < maxIterator; lEvt++){ - if( (*lEvt)->signal_process_id() == 0 ) break; + if(HepMC::signal_process_id(*lEvt) == 0 ) break; } break; } @@ -48,11 +48,11 @@ void PileUpClassification::findEventIterators(PileuType_t putype, McEventCollect // if needed, search the correct interval while(intervallN>0){ for(; fEvt < maxIterator; fEvt++){ - if( (*fEvt)->signal_process_id() == 0 ) { fEvt++; break; } + if( HepMC::signal_process_id(*fEvt) == 0 ) { fEvt++; break; } } lEvt = fEvt; for(; lEvt < maxIterator; lEvt++){ - if( (*lEvt)->signal_process_id() == 0 ) break; + if( HepMC::signal_process_id(*lEvt) == 0 ) break; } intervallN--; } @@ -83,7 +83,7 @@ PileUpClassification::PileuType_t PileUpClassification::pileUpType(const McEvent while( itEvt != lEvt){ if( size_t(itEvt - fEvt) == evtIndex ){ return type ;} ++itEvt; - if( (*itEvt)->signal_process_id() == 0 ) { // a SEPARATOR + if(HepMC::signal_process_id(*itEvt) == 0 ) { // a SEPARATOR ++itEvt; type = (PileuType_t) (type+1); } } @@ -100,7 +100,7 @@ void PileUpClassification::fillPileUpType(const McEventCollection* evts, std::v PileuType_t type = INTIME; int c=1; for(; fEvt != lEvt; ++fEvt){ - if( (*fEvt)->signal_process_id() == 0 ) type= (PileuType_t)(type+1); + if(HepMC::signal_process_id(*fEvt) == 0 ) type= (PileuType_t)(type+1); evtToPUType[c] = type; c++; } diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx index 3a1e3cf3758ce2ac8279dd323002e773cbd1a8c2..f2e1e45b71fe31aec22ed2f805989a99fc76b7dc 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx @@ -99,7 +99,7 @@ TruthEtIsolations::hasEtIsol( const HepMC::GenParticle* p ) const { return ( 0 == p ) ? false - : hasEtIsol( p->barcode() ); + : hasEtIsol( HepMC::barcode(p) ); } const TruthEtIsolations::EtIsol_t* @@ -107,7 +107,7 @@ TruthEtIsolations::etIsolations( const HepMC::GenParticle* p ) const { return ( 0 == p ) ? 0 - : etIsolations( p->barcode() ); + : etIsolations( HepMC::barcode(p) ); } double @@ -116,7 +116,7 @@ TruthEtIsolations::etIsol( const HepMC::GenParticle* p, { return ( 0 == p ) ? m_dfltEtIsols[idx] - : etIsol( p->barcode(), idx ); + : etIsol( HepMC::barcode(p), idx ); } /////////////////////////////////////////////////////////////////// @@ -128,14 +128,14 @@ TruthEtIsolations::setEtIsol( const HepMC::GenParticle* genParticle, const TruthParticleParameters::ConeSize coneIdx, const double etIsol ) { - m_etIsolations[genParticle->barcode()][coneIdx] = etIsol; + m_etIsolations[HepMC::barcode(genParticle)][coneIdx] = etIsol; } void TruthEtIsolations::setEtIsol( const HepMC::GenParticle* genParticle, const std::vector<double>& etIsols ) { - EtIsol_t& et = m_etIsolations[genParticle->barcode()]; + EtIsol_t& et = m_etIsolations[HepMC::barcode(genParticle)]; for ( std::size_t i = 0, iMax = std::min<std::size_t>( etIsols.size(), @@ -152,7 +152,7 @@ void TruthEtIsolations::setEtIsol( const HepMC::GenParticle* genParticle, const EtIsol_t& etIsols ) { - m_etIsolations[genParticle->barcode()] = etIsols; + m_etIsolations[HepMC::barcode(genParticle)] = etIsols; } /////////////////////////////////////////////////////////////////// diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx index a781df015e47be248d91a1cc1631a3a56d2e011f..2f8e7e87ccc13c36dafa4a34486d74dc12f8b565 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx @@ -107,22 +107,22 @@ const TruthParticle * TruthParticle::child(const std::size_t i) const } -const HepMC::GenParticle * TruthParticle::genMother(const std::size_t i) const +const HepMC::GenParticle* TruthParticle::genMother(const std::size_t i) const { if ( i < m_mothers.size() ) { - const TruthParticle* mother = this->mother(i); - return mother ? mother->genParticle() : 0; + auto mother = this->mother(i); + return mother ? mother->genParticle() : nullptr; } else { std::string error = "WRONG index for TruthParticle::genMother(index)"; throw std::out_of_range(error); } } -const HepMC::GenParticle * TruthParticle::genChild(const std::size_t i) const +const HepMC::GenParticle* TruthParticle::genChild(const std::size_t i) const { if ( i < m_children.size() ) { - const TruthParticle* child = this->child(i); - return child ? child->genParticle() : 0; + auto child = this->child(i); + return child ? child->genParticle() : nullptr; } else { std::string error = "WRONG index for TruthParticle::genChild(index)"; throw std::out_of_range(error); @@ -133,7 +133,7 @@ bool TruthParticle::hasMother( const PDG::pidType pdgId ) const { const std::size_t nMothers = m_mothers.size(); for ( std::size_t iMother = 0; iMother != nMothers; ++iMother ) { - const TruthParticle * mother = this->mother(iMother); + auto mother = this->mother(iMother); if ( mother && ( pdgId == mother->pdgId() ) ) { return true; } @@ -145,7 +145,7 @@ bool TruthParticle::hasChild( const PDG::pidType pdgId ) const { const std::size_t nChildren = m_children.size(); for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const TruthParticle * child = this->child(iChild); + auto child = this->child(iChild); if ( child && ( pdgId == child->pdgId() ) ) { return true; } @@ -159,7 +159,7 @@ bool TruthParticle::hasMother( const PDG::pidType pdgId, bool found = false; const std::size_t nMothers = m_mothers.size(); for ( std::size_t iMother = 0; iMother != nMothers; ++iMother ) { - const TruthParticle* mother = this->mother(iMother); + auto mother = this->mother(iMother); if ( mother && ( pdgId == mother->pdgId() ) ) { found = true; indices.push_back(iMother); @@ -174,7 +174,7 @@ bool TruthParticle::hasChild( const PDG::pidType pdgId, bool found = false; const std::size_t nChildren = m_children.size(); for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const TruthParticle * child = this->child(iChild); + auto child = this->child(iChild); if ( child && ( pdgId == child->pdgId() ) ) { found = true; indices.push_back(iChild); @@ -208,7 +208,7 @@ TruthParticle::etIsol( const TruthParticleParameters::ConeSize coneIdx ) const CLHEP::HepLorentzVector TruthParticle::pDecay( const std::size_t i ) const { if ( i < m_children.size() ) { - const TruthParticle* child = this->child(i); + auto child = this->child(i); if ( child ) { return child->hlv(); } else { @@ -224,7 +224,7 @@ CLHEP::HepLorentzVector TruthParticle::pDecay( const std::size_t i ) const PDG::pidType TruthParticle::pdgDecay( const std::size_t i ) const { if ( i < m_children.size() ) { - const TruthParticle* child = this->child(i); + auto child = this->child(i); if ( child ) { return child->pdgId(); } else { @@ -256,7 +256,7 @@ void TruthParticle::setGenParticle( const HepMC::GenParticle* particle ) this->set4Mom(particle->momentum()); // children - const HepMC::GenVertex * dcyVtx = particle->end_vertex(); + auto dcyVtx = particle->end_vertex(); m_children.reserve( dcyVtx ? dcyVtx->particles_out_size() : 0 ); if ( dcyVtx ) { @@ -269,7 +269,7 @@ void TruthParticle::setGenParticle( const HepMC::GenParticle* particle ) }//> decay vertex exists // parents - const HepMC::GenVertex * prodVtx = particle->production_vertex(); + auto prodVtx = particle->production_vertex(); m_mothers.reserve( prodVtx ? prodVtx->particles_in_size() : 0 ); if ( prodVtx ) { for ( HepMC::GenVertex::particles_in_const_iterator itr = diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticleContainer.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticleContainer.cxx index f21ca56f9c63e265d9c7ba66f37f61f332c240e8..0ab1dbaaa328fac783cb65f809257b93de4eb19c 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticleContainer.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticleContainer.cxx @@ -70,7 +70,7 @@ TruthParticleContainer::TruthParticleContainer( const SG::OwnershipPolicy own ) const TruthParticle* TruthParticleContainer::truthParticle( const int barcode,std::size_t genEventIdx ) const { - HepMcParticleLink mcLink(barcode, genEventIdx); + HepMcParticleLink mcLink(barcode, genEventIdx, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); Map_t::const_iterator itr = m_particles.find(mcLink.compress()); if ( itr != m_particles.end() ) { return itr->second; @@ -81,7 +81,7 @@ TruthParticleContainer::truthParticle( const int barcode,std::size_t genEventIdx std::size_t TruthParticleContainer::truthParticleIdx( const int barcode, std::size_t genEventIdx ) const { - HepMcParticleLink mcLink(barcode, genEventIdx); + HepMcParticleLink mcLink(barcode, genEventIdx, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); Map_t::const_iterator itr = m_particles.find(mcLink.compress()); if ( itr != m_particles.end() ) { for ( std::size_t idx = 0; idx != this->size(); ++idx ) { diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx index 102fbd101d7efa7772aa6ce716745eca914c4863..f329a50a81911ca45c8b13b2173d456209e22b81 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/test/TruthParticle_test.cxx @@ -23,6 +23,8 @@ #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/IService.h" +#include "StoreGate/WriteHandle.h" + // CLHEP includes #include "CLHEP/Units/SystemOfUnits.h" #include "GeneratorObjects/McEventCollection.h" @@ -85,7 +87,7 @@ make_map_t_pair(const HepMC::GenParticle &p, const TruthParticle &tp) { const std::size_t genEventIdx = 0; - HepMcParticleLink link(p.barcode(), genEventIdx); + HepMcParticleLink link(p.barcode(), genEventIdx, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION); return Map_t::value_type(link.compress(), &tp); } @@ -192,8 +194,10 @@ TruthParticleTest* makeTestData() 21, 2 ); vtx->add_particle_out( g2 ); - McEventCollection * genEvt = new McEventCollection; - genEvt->push_back( evt ); + SG::WriteHandle<McEventCollection> inputTestDataHandle{"GEN_AOD"}; + inputTestDataHandle = std::make_unique<McEventCollection>(); + inputTestDataHandle->push_back( evt ); + McEventCollection * genEvt = &*inputTestDataHandle; // filling Data test members test->m_evt = evt; diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p5_test.ref b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p5_test.ref index 452a0e0dc0e3b056d24ce64f8e272f9cfaf8396d..b4527f64cc7d23735e62be03ccee359b7118f8a5 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p5_test.ref +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p5_test.ref @@ -1,2 +1,4 @@ McParticleEventTPCnv/TruthParticleContainerCnv_p5_test test1 +Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout +HepMcParticleLink INFO find_proxy: Using GEN_AOD as McEventCollection key for this job diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p6_test.ref b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p6_test.ref index 662be6d858c27bf7fa4e73d8c8e89ff4270d837f..6dd10d7bbe44ba5a887a35f684bd820b293d006f 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p6_test.ref +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/share/TruthParticleContainerCnv_p6_test.ref @@ -1,2 +1,4 @@ McParticleEventTPCnv/TruthParticleContainerCnv_p6_test test1 +Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout +HepMcParticleLink INFO find_proxy: Using GEN_AOD as McEventCollection key for this job diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/RootTruthParticleCnvTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/RootTruthParticleCnvTool.cxx index 1d20686874393eefe06c77f274a984c47daad6a3..add3feeee5b1cccc7ce4b552d77d05962fd12e7c 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/RootTruthParticleCnvTool.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/src/RootTruthParticleCnvTool.cxx @@ -97,7 +97,7 @@ RootTruthParticleCnvTool::convert(const McEventCollection *mcCollection, "TruthParticle is not wrapping the GenParticle : %d !!", hepMcPart->barcode()); } - HepMcParticleLink mcLink( hepMcPart->barcode(), genEventIndex ); + HepMcParticleLink mcLink( hepMcPart->barcode(), genEventIndex, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION ); bcToMcPart[ mcLink.compress() ] = mcPart; }//> end loop over particles diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p5_test.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p5_test.cxx index 8f2198394409dd86f0d1ad05faafcc9973086404..09a28a1d645df546cf65a4346a8bbc4e1336eac1 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p5_test.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p5_test.cxx @@ -16,6 +16,9 @@ #include "SGTools/TestStore.h" #include "TestTools/leakcheck.h" #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" +// Athena +#include "AthenaKernel/ExtendedEventContext.h" #include <cassert> #include <iostream> @@ -89,10 +92,10 @@ void test1 (SGTest::TestStore& store) std::cout << "test1\n"; auto evcoll = std::make_unique<McEventCollection>(); - evcoll->push_back (std::make_unique<HepMC::GenEvent>()); - evcoll->push_back (std::make_unique<HepMC::GenEvent>()); + evcoll->push_back (std::make_unique<HepMC::GenEvent>(1000082, 4)); + evcoll->push_back (std::make_unique<HepMC::GenEvent>(1000087, 5)); - auto ge = std::make_unique<HepMC::GenEvent>(); + auto ge = std::make_unique<HepMC::GenEvent>(1000083, 7); auto gv = std::make_unique<HepMC::GenVertex>(); std::vector<HepMC::GenParticle*> parts; for (size_t i = 0; i < 5; i++) { @@ -107,9 +110,15 @@ void test1 (SGTest::TestStore& store) } ge->add_vertex (gv.release()); evcoll->push_back (std::move(ge)); - store.record (std::move(evcoll), "mcevt"); + store.record (std::move(evcoll), "GEN_AOD"); + // create a dummy EventContext + EventContext ctx; + ctx.setExtension( Atlas::ExtendedEventContext( &store ) ); + Gaudi::Hive::setCurrentContext( ctx ); + + RootTruthParticleCnvTool cnvTool; - ElementLink<McEventCollection> evlink ("mcevt", 2); + ElementLink<McEventCollection> evlink ("GEN_AOD", 2); ElementLink<TruthEtIsolationsContainer> isoLink ("isol", 1); TruthParticleContainer trans1; @@ -122,7 +131,7 @@ void test1 (SGTest::TestStore& store) trans1.push_back (std::move (tp)); } - Athena_test::Leakcheck check; + //Athena_test::Leakcheck check; testit (trans1, cnvTool); } diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx index af0bb414fd299109246889d38d7bb54e06a3a1b1..fcb94b06dda16bcad9faf0729647ed8cad0111a1 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** * @file McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx @@ -16,6 +16,9 @@ #include "SGTools/TestStore.h" #include "TestTools/leakcheck.h" #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" +// Athena +#include "AthenaKernel/ExtendedEventContext.h" #include <cassert> #include <iostream> @@ -76,10 +79,10 @@ void test1 (SGTest::TestStore& store) std::cout << "test1\n"; auto evcoll = std::make_unique<McEventCollection>(); - evcoll->push_back (std::make_unique<HepMC::GenEvent>()); - evcoll->push_back (std::make_unique<HepMC::GenEvent>()); + evcoll->push_back (std::make_unique<HepMC::GenEvent>(1000082, 4)); + evcoll->push_back (std::make_unique<HepMC::GenEvent>(1000087, 5)); - auto ge = std::make_unique<HepMC::GenEvent>(); + auto ge = std::make_unique<HepMC::GenEvent>(1000083, 7); auto gv = std::make_unique<HepMC::GenVertex>(); std::vector<HepMC::GenParticle*> parts; for (size_t i = 0; i < 5; i++) { @@ -94,9 +97,15 @@ void test1 (SGTest::TestStore& store) } ge->add_vertex (gv.release()); evcoll->push_back (std::move(ge)); - store.record (std::move(evcoll), "mcevt"); + store.record (std::move(evcoll), "GEN_AOD"); + // create a dummy EventContext + EventContext ctx; + ctx.setExtension( Atlas::ExtendedEventContext( &store ) ); + Gaudi::Hive::setCurrentContext( ctx ); + + RootTruthParticleCnvTool cnvTool; - ElementLink<McEventCollection> evlink ("mcevt", 2); + ElementLink<McEventCollection> evlink ("GEN_AOD", 2); ElementLink<TruthEtIsolationsContainer> isoLink ("isol", 1); TruthParticleContainer trans1; @@ -109,7 +118,7 @@ void test1 (SGTest::TestStore& store) trans1.push_back (std::move (tp)); } - Athena_test::Leakcheck check; + //Athena_test::Leakcheck check; testit (trans1, cnvTool); } diff --git a/Projects/AnalysisBase/CMakeGraphVizOptions.cmake b/Projects/AnalysisBase/CMakeGraphVizOptions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f6d416f611d2a909e75120f4cedd261ebd7f504 --- /dev/null +++ b/Projects/AnalysisBase/CMakeGraphVizOptions.cmake @@ -0,0 +1,5 @@ +# Options used by cmake --graphviz +set( GRAPHVIZ_CUSTOM_TARGETS TRUE ) +set( GRAPHVIZ_GENERATE_DEPENDERS FALSE ) +set( GRAPHVIZ_GENERATE_PER_TARGET FALSE ) +set( GRAPHVIZ_IGNORE_TARGETS ".*Pkg$" ".*PkgPrivate$" "^__.*" ) diff --git a/Projects/AnalysisBase/CMakeLists.txt b/Projects/AnalysisBase/CMakeLists.txt index 48f09c856590e8844bfaceb71200f80cf7e1de60..2493bcda372c73eb300951947f0d6d4c1f932223 100644 --- a/Projects/AnalysisBase/CMakeLists.txt +++ b/Projects/AnalysisBase/CMakeLists.txt @@ -34,10 +34,13 @@ atlas_ctest_setup() atlas_project( USE AnalysisBaseExternals ${AnalysisBaseExternals_VERSION} PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) -# Configure and install the post-configuration file: +# Configure and install the pre/post-configuration files: +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PreConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PreConfig.cmake @ONLY ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/PostConfig.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) -install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PreConfig.cmake + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) # Generate replacement rules for the installed paths: @@ -56,5 +59,9 @@ lcg_generate_env( install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh DESTINATION . RENAME env_setup.sh ) +# Install graphviz output if available: +install( FILES ${CMAKE_BINARY_DIR}/packages.dot + DESTINATION . OPTIONAL ) + # Set up the release packaging: atlas_cpack_setup() diff --git a/Projects/AnalysisBase/build.sh b/Projects/AnalysisBase/build.sh index bb6fd98656f9062ceb6826f70b3189ab37033820..32bad6b42593a6b50998b58e63447b4fc1f289b6 100755 --- a/Projects/AnalysisBase/build.sh +++ b/Projects/AnalysisBase/build.sh @@ -127,7 +127,7 @@ if [ -n "$EXE_CMAKE" ]; then fi # Now run the actual CMake configuration: - _time_ cmake -G "${GENERATOR}" \ + _time_ cmake -G "${GENERATOR}" --graphviz=packages.dot \ -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ ${USE_LAUNCHERS} ${EXTRACMAKE[@]} \ ${AnalysisBaseSrcDir} 2>&1 | tee cmake_config.log diff --git a/Projects/AnalysisBase/build_externals.sh b/Projects/AnalysisBase/build_externals.sh index 7cc750af5a854d99a67a133461256047b69d1abf..6a7361bf9c66c3bb131f5b33f99dbded4b458c7b 100755 --- a/Projects/AnalysisBase/build_externals.sh +++ b/Projects/AnalysisBase/build_externals.sh @@ -82,12 +82,23 @@ if [ "$FORCE" = "1" ]; then rm -fr ${BUILDDIR}/build/AnalysisBaseExternals fi -# Create some directories: -mkdir -p ${BUILDDIR}/{src,install} - # Get the version of AnalysisBase for the build. version=`cat ${thisdir}/version.txt` +# Check if previous externals build can be reused: +externals_stamp=${BUILDDIR}/build/AnalysisBaseExternals/externals-${version}.stamp +if [ -f ${externals_stamp} ]; then + if diff -q ${externals_stamp} ${thisdir}/externals.txt; then + echo "Correct version of externals already available in ${BUILDDIR}" + exit 0 + else + rm ${externals_stamp} + fi +fi + +# Create some directories: +mkdir -p ${BUILDDIR}/{src,install} + # The directory holding the helper scripts: scriptsdir=${thisdir}/../../Build/AtlasBuildScripts scriptsdir=$(cd ${scriptsdir}; pwd) @@ -117,3 +128,6 @@ ${scriptsdir}/build_atlasexternals.sh \ -i ${BUILDDIR}/install \ -p AnalysisBaseExternals ${RPMOPTIONS} -t ${BUILDTYPE} \ -v ${version} ${EXTRACMAKE[@]/#/-x } + +# Due to 'set -e' only gets here on success: +cp ${thisdir}/externals.txt ${externals_stamp} diff --git a/Projects/AnalysisBase/cmake/PreConfig.cmake.in b/Projects/AnalysisBase/cmake/PreConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..c29dae3afd0ecffd33e1b4a3c4883a902f8d8846 --- /dev/null +++ b/Projects/AnalysisBase/cmake/PreConfig.cmake.in @@ -0,0 +1,17 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# File setting up imported targets needed by the exported targets of +# @CMAKE_PROJECT_NAME@. +# + +# Figure out whether to use QUIET in the find_package call(s). +set( _quietFlag ) +if( @CMAKE_PROJECT_NAME@_FIND_QUIETLY ) + set( _quietFlag QUIET ) +endif() + +# Imported target(s) used by the project. +find_package( Threads ${_quietFlag} ) + +# Clean up. +unset( _quietFlag ) diff --git a/Projects/AnalysisBase/package_filters.txt b/Projects/AnalysisBase/package_filters.txt index 866ee2c8959aea725e5cb44bc6b5cd225f979a68..347b2ae6dee32c626ad0a874f7e80735d5cf7e1c 100644 --- a/Projects/AnalysisBase/package_filters.txt +++ b/Projects/AnalysisBase/package_filters.txt @@ -8,6 +8,12 @@ # packages get fixed up, or moved to the main list if these packages # are not intended for analysis. +- PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms +- PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms +- PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms +- PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms +- PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms +- PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms - PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection - PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection - PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools @@ -54,17 +60,17 @@ #+ ForwardDetectors/ZDC/ZdcAnalysis #+ ForwardDetectors/ZDC/ZdcNtuple + Generators/TruthUtils -#+ InnerDetector/InDetRecTools/InDetTrackSelectionTool ++ InnerDetector/InDetRecTools/InDetTrackSelectionTool + InnerDetector/InDetRecTools/TrackVertexAssociationTool + MuonSpectrometer/MuonStationIndex -#+ PhysicsAnalysis/Algorithms/.* ++ PhysicsAnalysis/Algorithms/.* + PhysicsAnalysis/AnalysisCommon/AssociationUtils #+ PhysicsAnalysis/AnalysisCommon/CPAnalysisExamples + PhysicsAnalysis/AnalysisCommon/CutBookkeeperUtils #+ PhysicsAnalysis/AnalysisCommon/FakeBkgTools #+ PhysicsAnalysis/AnalysisCommon/FsrUtils + PhysicsAnalysis/AnalysisCommon/HDF5Utils -#+ PhysicsAnalysis/AnalysisCommon/IsolationSelection ++ PhysicsAnalysis/AnalysisCommon/IsolationSelection + PhysicsAnalysis/AnalysisCommon/PATCore + PhysicsAnalysis/AnalysisCommon/PATInterfaces + PhysicsAnalysis/AnalysisCommon/PMGOverlapRemovalTools/GammaORTools diff --git a/Projects/AnalysisBase/version.txt b/Projects/AnalysisBase/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/AnalysisBase/version.txt +++ b/Projects/AnalysisBase/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/AthDataQuality/version.txt +++ b/Projects/AthDataQuality/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Projects/AthGeneration/CMakeGraphVizOptions.cmake b/Projects/AthGeneration/CMakeGraphVizOptions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f6d416f611d2a909e75120f4cedd261ebd7f504 --- /dev/null +++ b/Projects/AthGeneration/CMakeGraphVizOptions.cmake @@ -0,0 +1,5 @@ +# Options used by cmake --graphviz +set( GRAPHVIZ_CUSTOM_TARGETS TRUE ) +set( GRAPHVIZ_GENERATE_DEPENDERS FALSE ) +set( GRAPHVIZ_GENERATE_PER_TARGET FALSE ) +set( GRAPHVIZ_IGNORE_TARGETS ".*Pkg$" ".*PkgPrivate$" "^__.*" ) diff --git a/Projects/AthGeneration/CMakeLists.txt b/Projects/AthGeneration/CMakeLists.txt index c5f40f2264e051005c3a8c267cc3f7f8af55f11c..8a4a04ddf1ee4614d8456c24d11a73a239cc8701 100644 --- a/Projects/AthGeneration/CMakeLists.txt +++ b/Projects/AthGeneration/CMakeLists.txt @@ -92,5 +92,9 @@ install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) +# Install graphviz output if available: +install( FILES ${CMAKE_BINARY_DIR}/packages.dot + DESTINATION . OPTIONAL ) + # Package up the release using CPack: atlas_cpack_setup() diff --git a/Projects/AthGeneration/build.sh b/Projects/AthGeneration/build.sh index e793b9959e7618dfb8b0a8e569d448d117bef7aa..aaad79f712897a94af184be9811aeb8a48b34967 100755 --- a/Projects/AthGeneration/build.sh +++ b/Projects/AthGeneration/build.sh @@ -129,9 +129,10 @@ if [ -n "$EXE_CMAKE" ]; then # from scratch in an incremental build. rm -f CMakeCache.txt # Now run the actual CMake configuration: - { _time_ cmake ${BUILDTOOLTYPE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ - ${EXTRACMAKE[@]} \ + { _time_ cmake ${BUILDTOOLTYPE} --graphviz=packages.dot \ + -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${EXTRACMAKE[@]} \ ${AthGenerationSrcDir}; } 2>&1 | tee cmake_config.log fi diff --git a/Projects/AthGeneration/build_externals.sh b/Projects/AthGeneration/build_externals.sh index 94536827037bffd410b1e2f8d633f209b275c747..ce567fe02c130c158fbf315ed565bb0f5fdfd724 100755 --- a/Projects/AthGeneration/build_externals.sh +++ b/Projects/AthGeneration/build_externals.sh @@ -95,8 +95,11 @@ if [ "$FORCE" = "1" ]; then rm -fr ${BUILDDIR}/build/AthGenerationExternals ${BUILDDIR}/build/GAUDI fi +# Get the version of AthGeneration for the build. +version=`cat ${thisdir}/version.txt` + # Check if previous externals build can be reused: -externals_stamp=${BUILDDIR}/build/AthGenerationExternals/${BINARY_TAG}/externals.stamp +externals_stamp=${BUILDDIR}/build/AthGenerationExternals/externals-${version}.stamp if [ -f ${externals_stamp} ]; then if diff -q ${externals_stamp} ${thisdir}/externals.txt; then echo "Correct version of externals already available in ${BUILDDIR}" @@ -109,9 +112,6 @@ fi # Create some directories: mkdir -p ${BUILDDIR}/{src,install} -# Get the version of AthGeneration for the build. -version=`cat ${thisdir}/version.txt` - # The directory holding the helper scripts: scriptsdir=${thisdir}/../../Build/AtlasBuildScripts scriptsdir=$(cd ${scriptsdir}; pwd) diff --git a/Projects/AthGeneration/package_filters.txt b/Projects/AthGeneration/package_filters.txt index 60386767e4ac9cf15d018944c802dbd4a95f08f2..e4d2888809449379721955c197cf721c96140f36 100644 --- a/Projects/AthGeneration/package_filters.txt +++ b/Projects/AthGeneration/package_filters.txt @@ -183,8 +183,6 @@ + Reconstruction/RecExample/RecExConfig + Simulation/Tools/AtlasCLHEP_RandomGenerators + Tools/ART -+ Tools/JobTransforms -+ Tools/KitValidation + Tools/PathResolver + Tools/PmbCxxUtils + Tools/PyJobTransforms diff --git a/Projects/AthGeneration/version.txt b/Projects/AthGeneration/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/AthGeneration/version.txt +++ b/Projects/AthGeneration/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Projects/AthSimulation/CMakeGraphVizOptions.cmake b/Projects/AthSimulation/CMakeGraphVizOptions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f6d416f611d2a909e75120f4cedd261ebd7f504 --- /dev/null +++ b/Projects/AthSimulation/CMakeGraphVizOptions.cmake @@ -0,0 +1,5 @@ +# Options used by cmake --graphviz +set( GRAPHVIZ_CUSTOM_TARGETS TRUE ) +set( GRAPHVIZ_GENERATE_DEPENDERS FALSE ) +set( GRAPHVIZ_GENERATE_PER_TARGET FALSE ) +set( GRAPHVIZ_IGNORE_TARGETS ".*Pkg$" ".*PkgPrivate$" "^__.*" ) diff --git a/Projects/AthSimulation/CMakeLists.txt b/Projects/AthSimulation/CMakeLists.txt index 4c7ceb4fce317665c9b08ed9c5a811f49cc6806b..d44b378aeeb53bb2b5a05a6eddd0c3c21fead0cd 100644 --- a/Projects/AthSimulation/CMakeLists.txt +++ b/Projects/AthSimulation/CMakeLists.txt @@ -82,5 +82,9 @@ install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) +# Install graphviz output if available: +install( FILES ${CMAKE_BINARY_DIR}/packages.dot + DESTINATION . OPTIONAL ) + # Package up the release using CPack: atlas_cpack_setup() diff --git a/Projects/AthSimulation/build.sh b/Projects/AthSimulation/build.sh index 488cb89a8196f1572ac10384e8941252fcf1b941..ce76f4247fbc557ae5265e9919d191679a0764cf 100755 --- a/Projects/AthSimulation/build.sh +++ b/Projects/AthSimulation/build.sh @@ -117,9 +117,10 @@ if [ -n "$EXE_CMAKE" ]; then # from scratch in an incremental build. rm -f CMakeCache.txt # Now run the actual CMake configuration: - { _time_ cmake ${BUILDTOOLTYPE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ - ${EXTRACMAKE[@]} \ + { _time_ cmake ${BUILDTOOLTYPE} --graphviz=packages.dot \ + -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${EXTRACMAKE[@]} \ ${AthSimulationSrcDir}; } 2>&1 | tee cmake_config.log fi diff --git a/Projects/AthSimulation/build_externals.sh b/Projects/AthSimulation/build_externals.sh index 1b15d6e1a684ec22286eb13527cd4826d21a20b3..da06fa2d0fe961468a6e60fccb187dd0b67e20b2 100755 --- a/Projects/AthSimulation/build_externals.sh +++ b/Projects/AthSimulation/build_externals.sh @@ -87,8 +87,11 @@ if [ "$FORCE" = "1" ]; then rm -fr ${BUILDDIR}/build/AthSimulationExternals ${BUILDDIR}/build/GAUDI fi +# Get the version of AthSimulation for the build. +version=`cat ${thisdir}/version.txt` + # Check if previous externals build can be reused: -externals_stamp=${BUILDDIR}/build/AthSimulationExternals/${BINARY_TAG}/externals.stamp +externals_stamp=${BUILDDIR}/build/AthSimulationExternals/externals-${version}.stamp if [ -f ${externals_stamp} ]; then if diff -q ${externals_stamp} ${thisdir}/externals.txt; then echo "Correct version of externals already available in ${BUILDDIR}" @@ -101,9 +104,6 @@ fi # Create some directories: mkdir -p ${BUILDDIR}/{src,install} -# Get the version of AthSimulation for the build. -version=`cat ${thisdir}/version.txt` - # The directory holding the helper scripts: scriptsdir=${thisdir}/../../Build/AtlasBuildScripts scriptsdir=$(cd ${scriptsdir}; pwd) diff --git a/Projects/AthSimulation/package_filters.txt b/Projects/AthSimulation/package_filters.txt index a4cb2f4c05ed15ac048ca2907eb879c58cd054e7..20caeb65b6c94fa086ac9374e7d30811d5dd47e0 100644 --- a/Projects/AthSimulation/package_filters.txt +++ b/Projects/AthSimulation/package_filters.txt @@ -170,7 +170,6 @@ + InnerDetector/InDetConditions/InDetConditionsSummaryService + InnerDetector/InDetConditions/InDetCoolCoralClientUtils + InnerDetector/InDetConditions/PixelConditionsData -+ InnerDetector/InDetConditions/PixelConditionsTools + InnerDetector/InDetConditions/PixelCoralClientUtils + InnerDetector/InDetConditions/SCT_ConditionsData + InnerDetector/InDetConditions/TRT_ConditionsAlgs @@ -330,8 +329,6 @@ + TileCalorimeter/TileSvc/TileSimEventTPCnv + Tools/ART + Tools/FilePeeker -+ Tools/JobTransforms -+ Tools/KitValidation + Tools/PathResolver + Tools/PmbCxxUtils + Tools/PROCTools diff --git a/Projects/AthSimulation/version.txt b/Projects/AthSimulation/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/AthSimulation/version.txt +++ b/Projects/AthSimulation/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Projects/Athena/CMakeGraphVizOptions.cmake b/Projects/Athena/CMakeGraphVizOptions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f6d416f611d2a909e75120f4cedd261ebd7f504 --- /dev/null +++ b/Projects/Athena/CMakeGraphVizOptions.cmake @@ -0,0 +1,5 @@ +# Options used by cmake --graphviz +set( GRAPHVIZ_CUSTOM_TARGETS TRUE ) +set( GRAPHVIZ_GENERATE_DEPENDERS FALSE ) +set( GRAPHVIZ_GENERATE_PER_TARGET FALSE ) +set( GRAPHVIZ_IGNORE_TARGETS ".*Pkg$" ".*PkgPrivate$" "^__.*" ) diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt index e411026d8cb5445baf7078e74ea13524754f375e..42958c9bddf44a8e2fe269842645d0fabfb03cda 100644 --- a/Projects/Athena/CMakeLists.txt +++ b/Projects/Athena/CMakeLists.txt @@ -123,6 +123,10 @@ string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}" TDAQ-COMMON_ATROOT "${TDAQ-COMMON_ATROOT}" ) +# Install graphviz output if available: +install( FILES ${CMAKE_BINARY_DIR}/packages.dot + DESTINATION . OPTIONAL ) + # Temporarily add tdaq dependency to Athena build: string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" TDAQ_ATROOT "${TDAQ_ATROOT}" ) diff --git a/Projects/Athena/build.sh b/Projects/Athena/build.sh index b01005cdb5a79077465317dcb5394d493b38a352..1f5d14a0b098c60343118233ec2bb4525d1ba42f 100755 --- a/Projects/Athena/build.sh +++ b/Projects/Athena/build.sh @@ -129,9 +129,10 @@ if [ -n "$EXE_CMAKE" ]; then # from scratch in an incremental build. rm -f CMakeCache.txt # Now run the actual CMake configuration: - { _time_ cmake ${BUILDTOOLTYPE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ - ${EXTRACMAKE[@]} \ + { _time_ cmake ${BUILDTOOLTYPE} --graphviz=packages.dot \ + -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${EXTRACMAKE[@]} \ ${AthenaSrcDir}; } 2>&1 | tee cmake_config.log fi diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 70a842876216afe272efade6f93d0911395525ec..6ad6ab29730792933233bb800793540a868ac83f 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -95,8 +95,11 @@ if [ "$FORCE" = "1" ]; then rm -fr ${BUILDDIR}/build/AthenaExternals ${BUILDDIR}/build/GAUDI fi +# Get the version of Athena for the build. +version=`cat ${thisdir}/version.txt` + # Check if previous externals build can be reused: -externals_stamp=${BUILDDIR}/build/AthenaExternals/${BINARY_TAG}/externals.stamp +externals_stamp=${BUILDDIR}/build/AthenaExternals/externals-${version}.stamp if [ -f ${externals_stamp} ]; then if diff -q ${externals_stamp} ${thisdir}/externals.txt; then echo "Correct version of externals already available in ${BUILDDIR}" @@ -109,9 +112,6 @@ fi # Create some directories: mkdir -p ${BUILDDIR}/{src,install} -# Get the version of Athena for the build. -version=`cat ${thisdir}/version.txt` - # The directory holding the helper scripts: scriptsdir=${thisdir}/../../Build/AtlasBuildScripts scriptsdir=$(cd ${scriptsdir}; pwd) diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index f16426834fe13bad69d8c3662959d07929d0ca94..09bde47556f409b0fdd04a585c97af55797c99d8 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -56,7 +56,9 @@ #- DataQuality/DCSCalculator2 # obsolete packages to be removed in a second step +- Tools/KitValidation - Tracking/TrkTools/TrkSegmentConverter +- Tools/JobTransforms # Huge D3PD librarys not really useful any more - PhysicsAnalysis/D3PDMaker/InDetD3PDMaker diff --git a/Projects/Athena/version.txt b/Projects/Athena/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/Athena/version.txt +++ b/Projects/Athena/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Projects/VP1Light/version.txt b/Projects/VP1Light/version.txt index 99278c76a6bb42b6cda25a73efd1ca8ca6f83084..ce217b910b2bf83e79ac798599669ed2fffec82f 100644 --- a/Projects/VP1Light/version.txt +++ b/Projects/VP1Light/version.txt @@ -1 +1 @@ -22.0.14 +22.0.15 diff --git a/Reconstruction/DiTauRec/CMakeLists.txt b/Reconstruction/DiTauRec/CMakeLists.txt index 76aefbb839bbea7683da514b2f0e6f1ace94d551..c87b989731727d20118092a6503d618cf414d976 100644 --- a/Reconstruction/DiTauRec/CMakeLists.txt +++ b/Reconstruction/DiTauRec/CMakeLists.txt @@ -36,8 +36,4 @@ atlas_add_component( DiTauRec # Install files from the package: atlas_install_headers( DiTauRec ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIClusterPseudoJetGetter.h b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIClusterPseudoJetGetter.h deleted file mode 100644 index 7ec03231a96debe4b90b41e9c565b1ff4a942d68..0000000000000000000000000000000000000000 --- a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIClusterPseudoJetGetter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HIJETREC_HICLUSTERPSEUDOJETGETTER_H -#define HIJETREC_HICLUSTERPSEUDOJETGETTER_H -//////////////////////////////////////////// -/// \class HIClusterPseudoJetGetter -/// -/// Specialized PseudoJetGetter for HIClusters, handles neg E/ghosts in way needed for HI jets -/// \author Aaron Angerami -////////////////////////////////////////////////// - -#include "JetRec/PseudoJetGetter.h" - - -class HIClusterPseudoJetGetter : public PseudoJetGetter { - ASG_TOOL_CLASS(HIClusterPseudoJetGetter, IPseudoJetGetter) -public: - HIClusterPseudoJetGetter(const std::string &name); - - // virtual int appendTo(PseudoJetVector& psjs, const LabelIndex* pli) const; - -}; - -#endif diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIClusterPseudoJetGetter.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIClusterPseudoJetGetter.cxx deleted file mode 100644 index d832aabcfb524aef6ee985d1a7fcfa35caaf6a25..0000000000000000000000000000000000000000 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIClusterPseudoJetGetter.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "HIJetRec/HIClusterPseudoJetGetter.h" - -HIClusterPseudoJetGetter::HIClusterPseudoJetGetter(const std::string &name) : PseudoJetGetter(name) -{ - -} - -/* -int HIClusterPseudoJetGetter::appendTo(PseudoJetVector& psjs, const LabelIndex* pli) const -{ - bool doGhosts=bool(m_ghostscale)&!m_negEnergyAsGhosts; - ATH_MSG_DEBUG("Entering appendTo(PseudoJetVector)..."); - - if ( evtStore()->contains<xAOD::IParticleContainer>(m_incoll) ) - { - ATH_MSG_DEBUG("Retrieving xAOD container " << m_incoll << ", ghost scale=" - << m_ghostscale << ", isGhost=" << doGhosts); - const xAOD::IParticleContainer* ppars = 0; - ppars = evtStore()->retrieve<const xAOD::IParticleContainer>(m_incoll); - if ( ppars != 0 ) - { - //for now direct copy/paste of PseudoJetGetter::append method with local mods - //explicitly using IParticle instead of templated version - const xAOD::IParticleContainer& inputs=*ppars; - int nskip = 0; - jet::IConstituentUserInfo::Index labidx = 0; - if ( pli != 0 ) labidx = pli->index(m_label); - else ATH_MSG_WARNING("Index-to-label map is not supplied."); - if ( doGhosts ) labidx = -labidx; - ATH_MSG_DEBUG( "Ghost scale = " << m_ghostscale << "; idx = " << labidx ); - - /// Loop over input, buid CUI and PseudoJets - for ( auto iinp=inputs.begin(); iinp!=inputs.end(); ++iinp ) - { - auto ppar = *iinp; // IParticle pointer - if ( ppar == 0 || (m_skipNegativeEnergy && ppar->e() <= 0.0) ) - { - if ( ppar == 0 ) ATH_MSG_DEBUG("NUll object!"); - else ATH_MSG_VERBOSE("Skipping cluster with E = " << ppar->e()); - ++nskip; - continue; - } - // Take momentum from IParticle. - fastjet::PseudoJet psj(ppar->p4()); - // Form EM scale, use uncalibrated four-vector. - if ( m_emtopo ) - { - const xAOD::CaloCluster* pclu = dynamic_cast<const xAOD::CaloCluster*>(ppar); - if ( pclu == 0 ) { - ATH_MSG_WARNING("EM particle is not type CaloCluster"); - continue; - } - psj.reset(pclu->p4(xAOD::CaloCluster::UNCALIBRATED)); - } - if(m_negEnergyAsGhosts) - { - if(ppar->e() <=0.) - { - psj.reset_momentum(psj.px(), psj.py(), psj.pz(), std::abs(ppar->e())); - psj*=m_ghostscale; - } - } - else if ( doGhosts ) psj *= m_ghostscale; - - bool show = psjs.size() < 20; - if ( show ) ATH_MSG_VERBOSE("index/label: " << labidx << "/" << m_label); - if ( show ) ATH_MSG_VERBOSE("old/p4/new" - << " pt: " << ppar->pt() << "/" << ppar->p4().Pt() << "/" << psj.pt() - << ", pz: /" << ppar->p4().Pz() << "/" << psj.pz() - << ", p: /" << ppar->p4().P() << "/" - << ", E: " << ppar->e() << "/" << ppar->p4().E() << "/" << psj.e() - << ", m: " << ppar->m() << "/" << ppar->p4().M() << "/" << psj.m() - << ", eta: " << ppar->eta() << "/" << ppar->p4().Eta() << "/" << psj.eta() - ); - if ( pli != 0 ) - { - jet::IConstituentUserInfo* pcui = this->buildCUI(ppar, labidx, pli); - psj.set_user_info(pcui); - if ( show ) ATH_MSG_VERBOSE("User info particle: " << pcui->particle()); - } - psjs.push_back(psj); - } // end loop over input - if ( nskip ) ATH_MSG_DEBUG("Skipped constituent count: " << nskip); - ATH_MSG_DEBUG("After append, PseudoJet count is " << psjs.size()); - return 0; - } - } - ATH_MSG_ERROR("Unable to find input collection: " << m_incoll); - return 1; -} -*/ diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py index fbebcf188ea4d0ab78c074fd8594ae8d424889a5..89a8a323c15276b86a13648b56585dbb0eff606b 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py +++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py @@ -8,10 +8,10 @@ import AthenaCommon.SystemOfUnits as Units #configuring getter tools #selection for track jets from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool -from JetRecTools.JetRecToolsConf import TrackPseudoJetGetter from JetRecTools.JetRecToolsConf import JetTrackSelectionTool from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool +from JetRecTools.JetRecToolsConf import PseudoJetAlgorithm from JetMomentTools.JetMomentToolsConf import JetCaloQualityTool from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool @@ -41,7 +41,7 @@ if HIJetFlags.UseHITracks() : MaxLongitudinalDistance = 1.0e7, MaxZ0SinTheta = 1.5) #build PJ getter - jtm += TrackPseudoJetGetter("trackget_HI", + jtm += PseudoJetAlgorithm("trackget_HI", InputContainer = jtm.tracksel_HI.OutputContainer, Label = "Track", OutputContainer = "PseudoJetTracks_HI", @@ -63,7 +63,7 @@ if HIJetFlags.UseHITracks() : Selector = jtm.trk_gtracksel_HI) - jtm += TrackPseudoJetGetter("gtrackget_HI", + jtm += PseudoJetAlgorithm("gtrackget_HI", InputContainer = jtm.gtracksel_HI.OutputContainer, Label = "GhostTrack", OutputContainer = "PseudoJetGhostTracks_HI_ghost", @@ -81,11 +81,9 @@ if HIJetFlags.UseHITracks() : jtm.trkmoms.lock() -from JetRec.JetRecConf import PseudoJetGetter ClusterKey=HIJetFlags.HIClusterKey() -from HIJetRec.HIJetRecConf import HIClusterPseudoJetGetter -jtm += HIClusterPseudoJetGetter("get_HI", +jtm += PseudoJetAlgorithm("get_HI", InputContainer = ClusterKey, Label = "LCTopo", #Label = "Tower", OutputContainer = "PseudoJet" + ClusterKey, @@ -94,7 +92,7 @@ jtm += HIClusterPseudoJetGetter("get_HI", GhostScale = 1.e-20 ) -jtm += PseudoJetGetter("gakt4trackget_HI", +jtm += PseudoJetAlgorithm("gakt4trackget_HI", InputContainer = HIJetFlags.TrackJetContainerName(), Label = "Ghost" + HIJetFlags.TrackJetContainerName(), SkipNegativeEnergy = True, diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx index 13c26e6a2f9caa660fc8b755b53e7b6c8f940b5b..ac457b88e17794efd6b3fc80df057d6b3ac1e5a0 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx @@ -13,7 +13,6 @@ #include "HIJetRec/HIJetDiscriminatorTool.h" #include "HIJetRec/HIJetSignificanceTool.h" #include "HIJetRec/HIUEModulatorTool.h" -#include "HIJetRec/HIClusterPseudoJetGetter.h" #ifndef XAOD_ANALYSIS DECLARE_COMPONENT( HIClusterMaker ) @@ -31,5 +30,4 @@ DECLARE_COMPONENT( HIJetMaxOverMeanTool ) DECLARE_COMPONENT( HIJetDiscriminatorTool ) DECLARE_COMPONENT( HIJetSignificanceTool ) DECLARE_COMPONENT( HIUEModulatorTool ) -DECLARE_COMPONENT( HIClusterPseudoJetGetter ) diff --git a/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h b/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..7a630808ad06117e7a1aac2d6a30cc2e15c4edf9 --- /dev/null +++ b/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// IJetEventSelector.h + +#ifndef IJetEventSelector_H +#define IJetEventSelector_H + +/// IJetEventSelector is a dual-use tool interface for a tool that selects +/// a jet based on EventInfo selections (e.g. mu, nPV) + +#include "AsgTools/IAsgTool.h" +#include "xAODEventInfo/EventInfo.h" + +class IJetEventSelector : virtual public asg::IAsgTool { +ASG_TOOL_INTERFACE(IJetEventSelector) + +public: + + /// Destructor. + virtual ~IJetEventSelector() { }; + + /// Method to select. + /// Returns true if eventinfo condition is passed. + virtual int keep(const xAOD::EventInfo &e) const =0; + +}; + +#endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetIsolationTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetIsolationTool.h index 0a55cf2178ae6246ecf38d8689a49bbf2e59fb78..c3855d1fc3a391f879c37d05504cb05a545adb1d 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetIsolationTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetIsolationTool.h @@ -71,11 +71,10 @@ /////////////////////////////////////////////////////////////////////// #include "AsgTools/AsgTool.h" -#include "AsgTools/ToolHandle.h" #include "JetRec/JetModifierBase.h" #include "JetUtils/TiledEtaPhiMap.h" -#include "JetInterface/IPseudoJetGetter.h" #include "fastjet/PseudoJet.hh" +#include "JetRec/PseudoJetContainer.h" #include "JetEDM/IConstituentUserInfo.h" namespace jet { @@ -145,7 +144,7 @@ public: private: std::vector<std::string> m_isolationCodes; - ToolHandle<IPseudoJetGetter> m_hpjg; + SG::ReadHandleKey<PseudoJetContainer> m_pjsin{this, "PseudoJetsIn", "", "PseudoJetContainer to read"}; /// the list of isolation calculation objects (they are actually used /// only as template objects from which the actual calculators are build diff --git a/Reconstruction/Jet/JetMomentTools/src/JetIsolationTool.cxx b/Reconstruction/Jet/JetMomentTools/src/JetIsolationTool.cxx index 10dd27ba4ccd9bd7f37d796e6a034cf350ea7712..71f805d17f0599cb2c0c5d3e1f8a49de1fb8e15b 100644 --- a/Reconstruction/Jet/JetMomentTools/src/JetIsolationTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/src/JetIsolationTool.cxx @@ -7,7 +7,6 @@ #include "JetMomentTools/JetIsolationTool.h" #include "xAODCaloEvent/CaloCluster.h" #include "JetUtils/JetDistances.h" -#include "JetRec/PseudoJetGetterRegistry.h" #include <sstream> using std::string; @@ -236,9 +235,8 @@ using namespace jet::JetIsolation; //********************************************************************** JetIsolationTool::JetIsolationTool(const string& name) -: JetModifierBase(name), m_hpjg("") { +: JetModifierBase(name) { declareProperty( "IsolationCalculations", m_isolationCodes); - declareProperty("PseudoJetGetter", m_hpjg); } //********************************************************************** @@ -282,10 +280,12 @@ StatusCode JetIsolationTool::initialize() { } ATH_MSG_INFO("Initialized JetIsolationTool " << name()); - if ( m_hpjg.empty() ) { - ATH_MSG_INFO(" Pseudojet getter will found using JetInput"); + if ( m_pjsin.empty() ) { + ATH_MSG_ERROR(" No input pseudojet collection supplied"); + return StatusCode::FAILURE; } else { - ATH_MSG_INFO(" Pseudojet getter: " << m_hpjg->name()); + ATH_MSG_INFO(" Input pseudojet collection: " << m_pjsin.key()); + ATH_CHECK(m_pjsin.initialize()); } ATH_MSG_INFO(" Isolation calculations: " << m_isolationCodes); @@ -299,33 +299,9 @@ StatusCode JetIsolationTool::modify(xAOD::JetContainer& jets) const { ATH_MSG_DEBUG("Modifying jets in container with size " << jets.size()); if ( jets.empty() ) return StatusCode::SUCCESS; - // Find the pseudojet getter. - // If one is not supplied, the InputType field for the first jet is used - // to locate the appropriate tool. - const IPseudoJetGetter* ppjg = nullptr; - int iinp = -1; - if ( m_hpjg.empty() ) { - iinp = jets[0]->getAttribute<int>("InputType"); - auto iiinp = static_cast<xAOD::JetInput::Type>(iinp); - string sinp = xAOD::JetInput::typeName(iiinp); - ATH_MSG_DEBUG("Jet input type is " << sinp); - ppjg = PseudoJetGetterRegistry::find(sinp); - if ( ppjg == nullptr ) { - ATH_MSG_WARNING("Unable to retrieve pseudojet getter for input index/name " - << iinp << "/" << sinp); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("Found pseudojet getter " << ppjg->name()); - } else { - ppjg = &*m_hpjg; - } - if ( ppjg == nullptr ) { - ATH_MSG_WARNING("Unable to retrieve pseudojet getter."); - return StatusCode::FAILURE; - } - // Fetch the input pseudojets. - const PseudoJetVector* inputConstits = ppjg->get(); + auto pjsin = SG::makeHandle(m_pjsin); + const PseudoJetContainer* inputConstits = pjsin.get(); ATH_MSG_DEBUG("Retrieved input count is " << inputConstits->size()); // adapt the calculators to these jets (radius, input type, etc...) @@ -341,11 +317,10 @@ StatusCode JetIsolationTool::modify(xAOD::JetContainer& jets) const { for ( xAOD::Jet* pjet : jets ) { // Check this jet has the same inputs. - int jinp = pjet->getAttribute<int>("InputType"); - if ( m_hpjg.empty() && jinp != iinp ) { - ATH_MSG_WARNING("Jets have inconsistent inputs: " << iinp << " and " << jinp); - continue; - } + // int jinp = pjet->getAttribute<int>("InputType"); + // This needs to be reimplemented when we decide how to better + // encode this information -- right now this can't be matched + // to the input PseudoJetContainer // Create jet position. jet::ParticlePosition jetPos(pjet); @@ -358,7 +333,7 @@ StatusCode JetIsolationTool::modify(xAOD::JetContainer& jets) const { ATH_MSG_VERBOSE("Jet eta=" << jetPos.x() << ", phi=" << jetPos.y()); for ( unsigned int ippj=0; ippj<inputConstits->size(); ++ippj ) { - const PseudoJet* ppj = &(inputConstits->at(ippj)); + const PseudoJet* ppj = &(inputConstits->casVectorPseudoJet()->at(ippj)); const xAOD::IParticle* ppar = nullptr; string label = "none"; if ( ppj->has_user_info<jet::IConstituentUserInfo>() ) { diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h new file mode 100644 index 0000000000000000000000000000000000000000..5013ebdab2301a1b92e8416dc82617040250c442 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h @@ -0,0 +1,58 @@ +/* this file is -*- C++ -*- + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETMONITORING_EventVARTOOL_H +#define JETMONITORING_EventVARTOOL_H + +#include "xAODEventInfo/EventInfo.h" + +#include "GaudiKernel/IAlgTool.h" +#include "AthenaBaseComps/AthAlgTool.h" + + +static const InterfaceID IID_IEventHistoVarTool("IEventHistoVarTool", 1 , 0); + +/////////////////////////////////////////////////////////// +/// \class EventHistoVarTool +/// +/// This class is a simple tool to access EventInfo +/// variables within the JetMonitoring environment +/// + +class IEventHistoVarTool : virtual public IAlgTool +{ +public: + + // Retrieve interface ID + static const InterfaceID& interfaceID() { return IID_IEventHistoVarTool; } + + virtual ~IEventHistoVarTool(){} + + /// the value of the variable for a given Event + virtual float value(const xAOD::EventInfo &) const = 0; + /// a compact description of the variable. + virtual std::string describe() const =0; +}; + + +class EventHistoVarTool : public AthAlgTool, virtual public IEventHistoVarTool { +public: + EventHistoVarTool(const std::string & type, const std::string & name, const IInterface* parent); + virtual ~EventHistoVarTool(){} + + virtual StatusCode initialize() ; + + virtual float value(const xAOD::EventInfo &) const; + virtual std::string describe() const {return m_varName;} + + +private: + + Gaudi::Property<std::string> m_varName {this,"Variable", ""}; + Gaudi::Property<float> m_defaultValue = {this,"Default", -1.}; + +}; + + +#endif diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h index 930ba84ed2cf10ab35c0acaf4421775183a6359d..84bf7fb3c60ec514af2c9590abbaca3b4b9bbe79 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef JETMONITORING_JETCONTAINERHISTOFILLER_H @@ -19,6 +19,7 @@ #include "AsgTools/AsgTool.h" #include "JetMonitoring/JetHistoBase.h" +#include "xAODEventInfo/EventInfo.h" // temporary, we should define a proper interface @@ -57,7 +58,8 @@ protected: /// The list of histogramming tools ToolHandleArray<JetHistoBase> m_histoTools; /// the jet container to build histos from - std::string m_jetContainerName; + SG::ReadHandleKey<xAOD::JetContainer> m_jetContainerName{this, "JetContainer", ""}; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; }; #endif diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h new file mode 100644 index 0000000000000000000000000000000000000000..f35ce02283e44a7aa69c72f8ebb3f6849830181e --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h @@ -0,0 +1,39 @@ +// -*- c++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETMONITORING_JetEventSelector_H +#define JETMONITORING_JetEventSelector_H +#include "AsgTools/AsgTool.h" + +#include "JetInterface/IJetEventSelector.h" +#include "JetMonitoring/EventHistoVarTool.h" + + +class JetEventSelector : public asg::AsgTool , virtual public IJetEventSelector + { + ASG_TOOL_CLASS(JetEventSelector,IJetEventSelector) + public: + + JetEventSelector(const std::string &t); + virtual ~JetEventSelector(); + + virtual StatusCode initialize() ; + + int keep(const xAOD::EventInfo& e) const; + + protected: + + float m_min; + float m_max; + + ToolHandle<IEventHistoVarTool> m_var; + +}; + + + + +#endif diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoSelectSort.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoSelectSort.h index 80da49ee4287f034c70b5709003268703d6c751b..241e8e9fc1c5f82948974dd299c724891c92dd37 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoSelectSort.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoSelectSort.h @@ -10,6 +10,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "JetInterface/IJetSelector.h" +#include "JetInterface/IJetEventSelector.h" #include "JetMonitoring/IJetHistoFiller.h" #include "JetMonitoring/JetHistoVarTool.h" @@ -31,6 +32,7 @@ private: ToolHandleArray<IJetHistoFiller> m_jetFillerTools; ToolHandle<IJetSelector> m_selectTool; + ToolHandle<IJetEventSelector> m_eventSelTool; Gaudi::Property<int> m_selIndex {this,"SelectedIndex", -1}; ToolHandle<IJetHistoVarTool> m_sortVar; diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h index 356b646d08ac682f9bd15a5b64379d7150b833a2..1666553d75ceeef18894b0b751f9228275c25e2e 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h @@ -176,11 +176,11 @@ namespace JetVar { xAOD::JetFourMom_t fourVec; bool status = false; - status = j.getAttribute<xAOD::JetFourMom_t>( "JetConstitScaleMomentum", fourVec ); + status = j.getAttribute<xAOD::JetFourMom_t>( "JetConstitScaleMomentum", fourVec ); // Jet four-momentum at constituent scale if( status ) constitScaleEnergy = fourVec.E() * m_scale ; else return 0.; - status = j.getAttribute<std::vector<float> >("EnergyPerSampling", samplingFrac ); - if( status ) return (samplingFrac[3]+samplingFrac[7])/constitScaleEnergy; + status = j.getAttribute<std::vector<float> >("EnergyPerSampling", samplingFrac ); //EnergyPerSampling is a vector of size 24; element i refers to the energy deposited in calo sampling i, see https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/Run2JetMoments#Sampling_layers + if( status ) return (samplingFrac[3]+samplingFrac[7])/constitScaleEnergy; //3 is 'EMB3' in the LAr barrel, 7 is 'EME3' in the LAr EM endcap else return 0.; } }; @@ -193,11 +193,11 @@ namespace JetVar { xAOD::JetFourMom_t fourVec; bool status = false; - status = j.getAttribute<xAOD::JetFourMom_t>( "JetConstitScaleMomentum", fourVec ); + status = j.getAttribute<xAOD::JetFourMom_t>( "JetConstitScaleMomentum", fourVec ); // Jet four-momentum at constituent scale if( status ) constitScaleEnergy = fourVec.E() * m_scale ; else return 0.; - status = j.getAttribute<std::vector<float> >("EnergyPerSampling", samplingFrac ); - if( status ) return (samplingFrac[12]+samplingFrac[18])/constitScaleEnergy; + status = j.getAttribute<std::vector<float> >("EnergyPerSampling", samplingFrac ); // refer to EM3FracVar above + if( status ) return (samplingFrac[12]+samplingFrac[18])/constitScaleEnergy; //12 is 'TileBar0' in the Tile barrel, 18 is 'TileExt0' in the Tile extended barrel else return 0.; } }; diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx index f91740c24a2fa15923d2ab69ef140cf78797bdc4..b5ac8f10e60a9e03364f951a0f38b9729957dd63 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx @@ -1,17 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetMonitoring/JetContainerHistoFiller.h" -#include "xAODEventInfo/EventInfo.h" JetContainerHistoFiller::JetContainerHistoFiller(const std::string& n) : HistoGroupBase(n) , m_histoTools(this) - , m_jetContainerName("") { declareInterface<JetContainerHistoFiller>(this); - - declareProperty("JetContainer", m_jetContainerName=""); declareProperty("HistoTools", m_histoTools); } @@ -20,12 +16,14 @@ StatusCode JetContainerHistoFiller::initialize() { CHECK( m_histoTools.retrieve() ); - if(m_jetContainerName=="") { + if(m_jetContainerName.empty()) { ATH_MSG_ERROR("Jet Container name not set. Please set the JetContainer property"); return StatusCode::FAILURE; } + CHECK( m_jetContainerName.initialize() ); + CHECK( m_EventInfoKey.initialize() ); - if(m_histoDir=="") m_histoDir = m_jetContainerName+"/"; + if(m_histoDir=="") m_histoDir = m_jetContainerName.key()+"/"; return StatusCode::SUCCESS; } @@ -34,10 +32,13 @@ StatusCode JetContainerHistoFiller::initialize() { int JetContainerHistoFiller::fillHistos(){ - ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName); + ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName.key()); - const xAOD::EventInfo* evtInfo; - CHECK(evtStore()->retrieve( evtInfo ), 1); + SG::ReadHandle<xAOD::EventInfo> evtInfo{m_EventInfoKey}; + if (!evtInfo.isValid()) { + ATH_MSG_DEBUG("Unable to retrieve xAOD::EventInfo"); + return 1; + } //LAr event veto: skip events rejected by LAr if(evtInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error){ @@ -45,10 +46,9 @@ int JetContainerHistoFiller::fillHistos(){ return 1; } - const xAOD::JetContainer* jCont = 0; - StatusCode sc= evtStore()->retrieve(jCont, m_jetContainerName) ; - if( sc.isFailure() ) { - ATH_MSG_DEBUG (" No container " << m_jetContainerName<< " in Evt store. Returning."); + SG::ReadHandle<xAOD::JetContainer> jCont{m_jetContainerName}; + if( !jCont.isValid() ) { + ATH_MSG_DEBUG (" No container " << m_jetContainerName.key()<< " in Evt store. Returning."); return 0; } diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6aeadb562f634201e86e5c112c661ac054f87ea9 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "JetMonitoring/JetEventSelector.h" +#include <limits> + + +JetEventSelector::JetEventSelector(const std::string &t) + : asg::AsgTool(t) + , m_min(-std::numeric_limits<float>::max()) + , m_max( std::numeric_limits<float>::max()) + , m_var(this) +{ + + declareProperty("CutMin", m_min ); + declareProperty("CutMax", m_max ); + declareProperty("Var", m_var); +} + +JetEventSelector:: ~JetEventSelector(){ +} + +StatusCode JetEventSelector::initialize() { + + ATH_CHECK(m_var.retrieve() ); + ATH_MSG_INFO( "Selecting on var ("<< m_var->describe() << ") in ["<< m_min << " , "<< m_max<< "]"); + + return StatusCode::SUCCESS; +} + +int JetEventSelector::keep(const xAOD::EventInfo& e) const { + float v = m_var->value(e); + return (m_min < v ) && (v<m_max); +} diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py index af41a7cb530e8b46cb3519722614197df06b3bc3..8ae162453e5aa66e445ccd170a5de9bde0a73f8c 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py @@ -390,12 +390,15 @@ class SelectSpec(ToolSpec): if '<' in selexpr: # interpret it as min<v<max cmin, v , cmax = interpretSelStr(selexpr) - selSpec = ToolSpec('JetSelectorAttribute', v+'sel', - Var = retrieveVarToolConf(v), - ) + if args.setdefault('isEventVariable', False) : + selProp = 'EventSelector' + selSpec = ToolSpec('JetEventSelector', v+'sel', Var = retrieveEventVarToolConf(v), ) + else: + selProp = 'Selector' + selSpec = ToolSpec('JetSelectorAttribute', v+'sel', Var = retrieveVarToolConf(v), ) if cmin is not None: selSpec['CutMin'] = cmin if cmax is not None: selSpec['CutMax'] = cmax - args['Selector'] = selSpec + args[selProp] = selSpec elif selexpr != '': from JetMonitoring.JetStandardHistoSpecs import knownSelector # assume it's a known pre-defined jet selector @@ -533,6 +536,21 @@ def retrieveVarToolConf(alias): return conf +def retrieveEventVarToolConf(alias): + """Return a ToolSpec from alias : (now with EventInfo variables) + * if alias is a string build a ToolSpec, assuming alias is an attribute of type float. + * if alias is a ToolSpec, returns it directly + """ + from JetMonitoring.JetStandardHistoSpecs import knownEventVar + if isinstance(alias, str): + conf = knownEventVar.get(alias,None) + if conf is None: + conf = ToolSpec('EventHistoVarTool', name=alias, Variable=alias) + else: # assume it's a config dict + conf = alias + return conf + + def retrieveHistoToolConf(alias): """Return a HistoSpec from alias : * if alias is a string look up in JetStandardHistoSpecs.knownHistos diff --git a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py index fb50c6effd000c17b99e9902835065658bfe9d5d..587b5c67221fcdd386fe9d20936f90179c603420 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py @@ -22,7 +22,11 @@ knownVar = dict( ) - +knownEventVar = dict( + # These always are of type 'float' + avgMu = ToolSpec('EventHistoVarTool', 'avgMu', Variable='averageInteractionsPerCrossing'), + actMu = ToolSpec('EventHistoVarTool', 'actMu', Variable='actualInteractionsPerCrossing'), +) # *************************************** # The list of standard jet histograms. @@ -79,8 +83,8 @@ _knownHistos = [ HistoSpec('Jvt', (70, -0.2, 1.2), title='Jet JVT;JVT;', ), HistoSpec('JVFCorr', (120, -1.2, 1.2), title='Jet JVT; JVFCorr;', ), HistoSpec('JvtRpt', (75, 0, 1.5), title='Jet JVT Rpt; JVTRpt;', ), - HistoSpec('EM3Frac', (50,-0.1,0.5), title="EM3 fraction;EM3 fraction;Entries"), - HistoSpec('Tile0Frac', (50,-0.1,0.5), title="Tile0 fraction;Tile0 fraction;Entries"), + HistoSpec('EM3Frac', (50,-0.1,1.0), title="EM3 fraction;EM3 fraction;Entries"), + HistoSpec('Tile0Frac', (50,-0.1,1.0), title="Tile0 fraction;Tile0 fraction;Entries"), HistoSpec('GhostMuonSegmentCount', (60, 0, 60), title='Number of associated muon segments;Number;', xvar=VarSpec('GhostMuonSegmentCount','int')), @@ -94,8 +98,10 @@ _knownHistos = [ HistoSpec('NumTrkPt500[0]', (100, 0, 100), title='Number of tracks from PV0 above 0.5 GeV:N_{tracks}(p_{T}>0.5 GeV);', ), HistoSpec('NumTrkPt1000[0]', (100, 0, 100), title='Number of all tracks above 1 GeV:N_{tracks}(p_{T}>1 GeV);', ), - HistoSpec('SumPtTrkPt500:GeV', (100, 0, 200), title='Sum Pt of all tracks above 0.5 GeV:SumPt(p_{T}>0.5 GeV);', ), - HistoSpec('SumPtTrkPt500[0]:GeV', (100, 0, 200), title='Sum Pt of all tracks above 0.5 GeV[0]:SumPt(p_{T}>0.5 GeV)[0];', ), + HistoSpec('SumPtTrkPt500:GeV', (100, 0, 200), title='Sum Pt of all tracks above 0.5 GeV:SumPtTrk(p_{T}>0.5 GeV);', ), + HistoSpec('SumPtTrkPt500[0]:GeV', (100, 0, 200), title='Sum Pt of all tracks above 0.5 GeV[0]:SumPtTrk(p_{T}>0.5 GeV)[0];', ), + HistoSpec('SumPtChargedPFOPt500:GeV', (100, 0, 200), title='Sum Pt of all charged PFO above 0.5 GeV:SumPtChargedPFO(p_{T}>0.5 GeV);', ), + HistoSpec('SumPtChargedPFOPt500[0]:GeV', (100, 0, 200), title='Sum Pt of all charged PFO above 0.5 GeV[0]:SumPtChargedPFO(p_{T}>0.5 GeV)[0];', ), HistoSpec('FoxWolfram4', (100, -1, 1), title='FoxWolfram0;FoxWolfram4;', ), HistoSpec('FoxWolfram0', (100, -1, 1), title='FoxWolfram0;FoxWolfram0;', ), diff --git a/Reconstruction/Jet/JetMonitoring/src/EventHistoVarTool.cxx b/Reconstruction/Jet/JetMonitoring/src/EventHistoVarTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9db068ccc9ca6473dd8abd39c672bdcb8da606cc --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/src/EventHistoVarTool.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "JetMonitoring/EventHistoVarTool.h" + + +EventHistoVarTool::EventHistoVarTool(const std::string & type, const std::string & name ,const IInterface* parent): + AthAlgTool( type, name, parent ) + +{ + declareInterface<IEventHistoVarTool>(this); +} + +StatusCode EventHistoVarTool::initialize() { + + if(m_varName=="") m_varName = name(); + + return StatusCode::SUCCESS; + +} + +float EventHistoVarTool::value(const xAOD::EventInfo & e) const { + + if (! e.isAvailable<float>(m_varName) ) { + ATH_MSG_WARNING("Could not access EventInfo variable "<< m_varName << ", returning default value " << m_defaultValue ); + return m_defaultValue; + } + + return e.auxdata<float>(m_varName); + +} diff --git a/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx b/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx index c360098d4cc876c9ea4c0db583f98e74c210823f..93e04da248ef9e3125be9f1ccf6a0ba27cb8d14b 100644 --- a/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx @@ -1,7 +1,7 @@ #include <list> #include "AthContainers/ConstDataVector.h" #include "JetMonitoring/JetHistoSelectSort.h" - +#include "JetMonitoring/JetMonitoringAlg.h" JetHistoSelectSort::JetHistoSelectSort( const std::string& type, const std::string & name ,const IInterface* parent): @@ -16,6 +16,7 @@ JetHistoSelectSort::JetHistoSelectSort( const std::string& type, const std::str declareProperty("FillerTools",m_jetFillerTools); declareProperty("Selector",m_selectTool); + declareProperty("EventSelector",m_eventSelTool); declareProperty("SortVariable",m_sortVar); } @@ -36,6 +37,11 @@ StatusCode JetHistoSelectSort::initialize() { ATH_CHECK(m_selectTool.retrieve()); ATH_MSG_INFO( " Selecting with "<< m_selectTool->name() ); } + + if(m_eventSelTool.isEnabled()){ + ATH_CHECK(m_eventSelTool.retrieve()); + ATH_MSG_INFO( " Selecting with "<< m_eventSelTool->name() ); + } if( m_sortVar.isEnabled() ){ ATH_CHECK(m_sortVar.retrieve()); @@ -70,6 +76,10 @@ StatusCode JetHistoSelectSort::processJetContainer(const JetMonitoringAlg& paren tmpList.remove_if( sel ); } + if(m_eventSelTool.isEnabled()){ + auto eventInfo = parentAlg.GetEventInfo(ctx); + if ( ! m_eventSelTool->keep(*eventInfo) ) tmpList.clear(); + } ConstDataVector< xAOD::JetContainer > tmpCont(SG::VIEW_ELEMENTS); diff --git a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx index fa5c644f972ce9f7e5ce8cd40204c56ef8da4427..cf1c2e33da6b7ce00d57e7afa8c32d67e697c284 100644 --- a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx @@ -8,6 +8,7 @@ #include "JetMonitoring/HIEfficiencyResponseHistos.h" #include "JetMonitoring/JetContainerHistoFiller.h" #include "JetMonitoring/JetSelectorAttribute.h" +#include "JetMonitoring/JetEventSelector.h" #include "JetMonitoring/HIJetUEMonitoring.h" #include "JetMonitoring/JetMonitoringAlg.h" @@ -15,6 +16,7 @@ #include "JetMonitoring/JetHistoAttributeFiller.h" #include "JetMonitoring/JetHistoTriggEfficiency.h" #include "JetMonitoring/JetHistoVarTool.h" +#include "JetMonitoring/EventHistoVarTool.h" #include "JetMonitoring/JetHistoSelectSort.h" #include "JetMonitoring/JetHistoResponseAndEff.h" @@ -32,6 +34,7 @@ DECLARE_COMPONENT( EfficiencyResponseHistos ) DECLARE_COMPONENT( HIEfficiencyResponseHistos ) DECLARE_COMPONENT( JetContainerHistoFiller ) DECLARE_COMPONENT( JetSelectorAttribute ) +DECLARE_COMPONENT( JetEventSelector ) DECLARE_COMPONENT( HIJetUEMonitoring ) DECLARE_COMPONENT( JetMonitoringAlg ) @@ -40,6 +43,7 @@ DECLARE_COMPONENT( JetHistoTriggEfficiency) DECLARE_COMPONENT( JetHistoAttributeFiller) DECLARE_COMPONENT( JetHistoSelectSort) DECLARE_COMPONENT( JetHistoVarTool) +DECLARE_COMPONENT( EventHistoVarTool) DECLARE_COMPONENT( JetHistoResponseAndEff) DECLARE_COMPONENT( JetAttributeHisto ) diff --git a/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h b/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h index 8f11b692ae839ddc1ab7ee36dfc9ee5e85e138af..ca7763e79c998f70df282baf189ff8387f198552 100644 --- a/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h +++ b/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h @@ -23,9 +23,6 @@ #include "JetRec/JetSplitter.h" #include "JetRec/JetToolRunner.h" #include "JetRec/JetTrimmer.h" -#include "JetRec/MuonSegmentPseudoJetGetter.h" -#include "JetRec/PseudoJetGetter.h" -#include "JetRec/PseudoJetGetterRegistry.h" #endif diff --git a/Reconstruction/Jet/JetRec/JetRec/MuonSegmentPseudoJetGetter.h b/Reconstruction/Jet/JetRec/JetRec/MuonSegmentPseudoJetGetter.h deleted file mode 100644 index 4e19d91c993de1b10c0dcdf91523e7ca61e0f89f..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/JetRec/MuonSegmentPseudoJetGetter.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// MuonSegmentPseudoJetGetter.h - -#ifndef MuonSegmentPseudoJetGetter_H -#define MuonSegmentPseudoJetGetter_H - -// David Adams -// January 2014 - -/// MuonSegmentPseudoJetGetter is a dual-use tool to retrieve and build the pseudojet -/// inputs from muon segments. -/// -/// Tool Properties: -/// - InputCollection: Name of the input collection. -/// - OutputCollection: Name of the output collection of pseudojets. -/// - Label: Label for the constituents. See note below. -/// - SkipNegativeEnergy: Flag indicating that inputs with negative energy -/// should be ignored. -/// - Pt : The pT set on the MS ghosts - -#include "AsgTools/AsgTool.h" -#include "JetInterface/IPseudoJetGetter.h" -#include "fastjet/PseudoJet.hh" -#include "xAODMuon/MuonSegmentContainer.h" -#include "JetEDM/PseudoJetVector.h" -#include "JetRec/PseudoJetContainer.h" - - -class MuonSegmentPseudoJetGetter -: public asg::AsgTool, - virtual public IPseudoJetGetter { - ASG_TOOL_CLASS(MuonSegmentPseudoJetGetter, IPseudoJetGetter) - -public: - - typedef jet::PseudoJetVector PseudoJetVector; - - /// Constructor from tool name. - MuonSegmentPseudoJetGetter(const std::string& myname); - - /// Initialization. - /// Can be skipped. - virtual StatusCode initialize(); - - /// Method to construct the PseudoJetVector and record in StoreGate - StatusCode createAndRecord() const; - - /// Returns the pseudojet collection. - /// If already existing, the collection in the event store is returned. - /// If not, an new collection is created and filled by calling @c appendTo. - /// Returns null if the collection cannot be created. - const PseudoJetContainer* getC() const; - - /// Return the label for these pseudojets. - std::string label() const; - - /// Dump to properties to the log. - void print() const; - -protected: //data - - // Job options. - SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_incoll; /// Input collection name. - SG::WriteHandleKey<PseudoJetContainer> m_outcoll; /// Output collection name. - - std::string m_label; /// Label for the collection. - double m_pt; /// PT assiged to the pseudojets. - - - private: - std::vector<fastjet::PseudoJet> - createPseudoJets(const xAOD::MuonSegmentContainer*) const; - -}; - -#endif diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetAlgorithm.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..9eb80acde4f98b6cf2991fec1fb2a9387a3bb1ef --- /dev/null +++ b/Reconstruction/Jet/JetRec/JetRec/PseudoJetAlgorithm.h @@ -0,0 +1,84 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// PseudoJetAlgorithm.h + +/// PseudoJetAlgorithm retrieves and builds the pseudojet inputs used in jet finding +/// +/// Alg Properties: +/// - InputCollection: Name of the input collection. +/// - OutputCollection: Name of the output collection of pseudojets. +/// - Label: Label for the constituents. See note below. +/// - SkipNegativeEnergy: Flag indicating that inputs with negative energy +/// should be ignored. +/// - GhostScale : If nonzero, the pseudojets are labeled as ghosts and +/// their four-momenta are scaled by this factor. +/// +/// Note: The label is attached to the CUI (constituent user info) associated with +/// created pseudojet and is used to name jet moments that point to the PJs, +/// and in rare cases (EMTopo, PFlow) to toggle special treatments. + +#ifndef PseudoJetAlgorithm_H +#define PseudoJetAlgorithm_H + +#include <memory> +#include "fastjet/PseudoJet.hh" +#include "JetRec/PseudoJetContainer.h" + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" + +class PseudoJetAlgorithm : public AthReentrantAlgorithm { + +public: + + // No need for a specialised constructor + using AthReentrantAlgorithm::AthReentrantAlgorithm; + + /// Athena algorithm's Hooks + virtual StatusCode initialize() override; + virtual StatusCode finalize() override {}; + + // Standard execute, forwards to createAndRecord + virtual StatusCode execute(const EventContext& ctx) const override final; + +private: + + /// Method to construct the PseudoJetContainer and record in StoreGate + virtual std::unique_ptr<PseudoJetContainer> createPJContainer(const xAOD::IParticleContainer& cont) const; + + /// Dump to properties to the log. + virtual void print() const; + + std::vector<fastjet::PseudoJet> + createPseudoJets(const xAOD::IParticleContainer* ) const; + +private: + + /// Input collection name. + SG::ReadHandleKey<xAOD::IParticleContainer> m_incoll{"InputContainer", "", "The input IParticleContainer name"}; + + /// Output collection name. + SG::WriteHandleKey<PseudoJetContainer> m_outcoll{"OutputContainer", "", "The output PseudoJetContainer name"}; + + /// Label for the collection. + Gaudi::Property<std::string> m_label{"Label", "", "String label identifying the pseudojet type"}; + + /// Flag indicating to skip objects with E<0. + Gaudi::Property<bool> m_skipNegativeEnergy{"SkipNegativeEnergy", false, "Whether to skip negative energy inputs"}; + + /// Ghost scale factor. + Gaudi::Property<double> m_ghostscale{"GhostScale", 0.0, "Scale factor to convert PJs into ghosts that don't affect jet kinematics"}; + + /// Flag indicating to treat objects with E<0 as ghosts (useful for HI) + Gaudi::Property<bool> m_negEnergyAsGhosts{"TreatNegativeEnergyAsGhost", false, "Whether to convert negative energy inputs into ghosts"}; + + /// Internal steering flags + /// Set in initialize() + bool m_isGhost{false}; /// Determinines whether the PJs should be made ghosts + bool m_emtopo; /// True if inputs are EM-scale topo clusters. + bool m_pflow; /// True if inputs are PFlow + +}; + +#endif diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetter.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetter.h index fd4fd02d6af6f6a9f6c0c21890dc2d126f9adaf4..eebbc0592fb27c0bb2f328b90f7ec180b4ef7d86 100644 --- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetter.h +++ b/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetter.h @@ -1,130 +1,166 @@ -// this file is -*- C++ -*- - /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// PseudoJetGetter.h - -#ifndef PseudoJetGetter_H -#define PseudoJetGetter_H +/// Implementations of concrete input-to-PseudoJet conversions +/// Separated from PseudoJetAlgorithm for readability +/// +/// IParticle is the generic type that is normally assumed. +/// Special treatment is needed for two cases: +/// * EMTopo clusters will be converted at the uncalibrated +/// cluster scale -- this is mostly obsolete in offline reco +/// but used by trigger for the moment +/// * ParticleFlowObjects that are charged will be filtered +/// out if they are not matched to the primary vertex -// David Adams -// January 2014 +#ifndef PSEUDOJETGETTER_H +#define PSEUDOJETGETTER_H -/// PseudoJetGetter is a dual-use tool to retrieve and build the pseudojet -/// inputs used in jet finding. -/// -/// Tool Properties: -/// - InputCollection: Name of the input collection. -/// - OutputCollection: Name of the output collection of pseudojets. -/// - Label: Label for the constituents. See note below. -/// - SkipNegativeEnergy: Flag indicating that inputs with negative energy -/// should be ignored. -/// - GhostScale : If nonzero, the pseudojets are labeled as ghosts and -/// their four-momenta are scaled by this factor. -/// -/// Note: The label is attached to the CUI (constituent user info) associated with -/// created pseudojet and should be unique for each set of pseuodjets used as input -/// for finding a particular collection of jets. -/// -/// The label for a primary pseudojet getter (the first in the vector presented -/// to JetRecTool) is used to deduce the input type and must be one of the -/// following: LCTopo, EMTopo, TopoTower, Tower, Truth, Track, PFlow. -/// Names beginning with "EM" are assumed to correspond to uncalibrated clusters. - -#include "AsgTools/AsgTool.h" -#include "JetRec/PseudoJetContainer.h" -#include "JetInterface/IPseudoJetGetter.h" #include "fastjet/PseudoJet.hh" -#include "JetEDM/PseudoJetVector.h" +#include "xAODBase/IParticle.h" +#ifndef GENERATIONBASE +#include "xAODCaloEvent/CaloCluster.h" +#include "xAODPFlow/PFO.h" +#endif -class PseudoJetGetter -: public asg::AsgTool, - virtual public IPseudoJetGetter { - ASG_TOOL_CLASS(PseudoJetGetter, IPseudoJetGetter) +namespace PseudoJetGetter { -public: + struct IParticleRejecter{ + bool null{false}; + bool negativeE{false}; + bool skipNegativeEnergy{false}; + + IParticleRejecter(bool skip): skipNegativeEnergy(skip){ + } - typedef jet::PseudoJetVector PseudoJetVector; + bool operator()(const xAOD::IParticle* ip) { + null = (ip == 0); + negativeE = skipNegativeEnergy && ip->e() <= 0.0; + return (null || negativeE); + } + }; - /// Constructor from tool name. - PseudoJetGetter(const std::string& myname); - /// Initialization. - /// Can be skipped. - virtual StatusCode initialize() override; + std::vector<fastjet::PseudoJet> + IParticlesToPJs(const xAOD::IParticleContainer& ips, bool skipNegativeEnergy) { - /// Method to construct the PseudoJetVector and record in StoreGate - virtual StatusCode createAndRecord() const override; + IParticleRejecter rejecter(skipNegativeEnergy); - // Kept for backward compatibity - virtual const PseudoJetVector* get() const override; + std::vector<fastjet::PseudoJet> vpj; + int index = -1; - /// Return the label for these pseudojets. - virtual std::string label() const override; + // loop over the input iparticles, select and convert to pseudojets + for(const xAOD::IParticle* ip: ips) { + ++index; + if(rejecter(ip)){continue;} + + // Create a Pseudojet with the momentum of the selected IParticles. + fastjet::PseudoJet psj(ip->p4()); - /// Dump to properties to the log. - virtual void print() const override; + // user index is used to identify the xAOD object used for the PseudoJet + psj.set_user_index(index); + vpj.push_back(psj); - /// Method to return the list of input containers. - /// The names of required input containers are appended to connames. - /// Returns nonzero for error. - /// Default returns 0 and adds no names. - virtual int inputContainerNames(std::vector<std::string>& connames) override; + } + return vpj; + } - /// Method to return the list of output containers. - /// The names of produced output containers are appended to connames. - /// Returns nonzero for error. - /// Default returns 0 and adds no names. - virtual int outputContainerNames(std::vector<std::string>& connames) override; + //********************************************************************** -protected: // data +#ifndef GENERATIONBASE - // Job options. + struct EMTopoRejecter{ + const xAOD::CaloCluster* cluster{0}; - /// Input collection name. - SG::ReadHandleKey<xAOD::IParticleContainer> m_incoll; + bool operator()(const xAOD::IParticle* ip){ + cluster = dynamic_cast<const xAOD::CaloCluster*>(ip); + return cluster == 0; // reject if not a cluster + } + }; - /// Output collection name. - SG::WriteHandleKey<PseudoJetContainer> m_outcoll; + std::vector<fastjet::PseudoJet> + EMToposToPJs(const xAOD::IParticleContainer& ips, bool skipNegativeEnergy) { - /// Label for the collection. - std::string m_label; + // helper objects for selecting iparticles to be converted to pseudojets + IParticleRejecter ipRejecter(skipNegativeEnergy); + EMTopoRejecter emRejecter; + + std::vector<fastjet::PseudoJet> vpj; + int index = -1; + + // loop over iparticles, select and convert to pseudojets + + for(const xAOD::IParticle* ip: ips) { + ++index; + if(ipRejecter(ip) or emRejecter(ip)){continue;} + + // Create a Pseudojet with the momentum of the cluster. + fastjet::PseudoJet + psj(emRejecter.cluster->p4(xAOD::CaloCluster::UNCALIBRATED)); + + // user index is used to identify the xAOD object used for the PseudoJet + psj.set_user_index(index); + vpj.push_back(psj); + } + return vpj; + } + + //********************************************************************** + + struct PFlowRejecter{ + + bool skipNegativeEnergy{false}; + + PFlowRejecter(bool skip): skipNegativeEnergy(skip){ + } + + bool operator()(const xAOD::IParticle* ip){ + + const xAOD::PFO* pfo = dynamic_cast<const xAOD::PFO*>(ip); + + // keep charged PFOs with energy==0 because for MET TST with PFlow, + // there may be high pt + // charged PFOs that receive a weight of 0 due to being in dense + // showers, but need to be present for overlap removal, because they + // don't retain these weights when added to the TST + + if( pfo->isCharged() ) { + const static SG::AuxElement::ConstAccessor<char> + PVMatchedAcc("matchedToPV"); + return !PVMatchedAcc(*pfo); + } + + return skipNegativeEnergy && pfo->e()<FLT_MIN; + } + }; - /// Flag indicating to skip objects with E<0. - bool m_skipNegativeEnergy; - /// Ghost scale factor. - double m_ghostscale; + std::vector<fastjet::PseudoJet> + PFlowsToPJs(const xAOD::IParticleContainer& ips, bool skipNegativeEnergy) { - /// Flag indicating to treat objects with E<0 as ghosts (useful for HI) - bool m_negEnergyAsGhosts; + PFlowRejecter rejecter(skipNegativeEnergy); + std::vector<fastjet::PseudoJet> vpj; + int index = -1; - bool m_emtopo; /// True if inputs are EM-scale topo clusters. - bool m_pflow; /// True if inputs are PFlow + // loop over the input iparticles, select and convert to pseudojets -private: + for(const xAOD::IParticle* ip: ips) { + ++index; + if(rejecter(ip)){continue;} + + // Create a PSeudojet with the momentum of the selected IParticles. + fastjet::PseudoJet psj(ip->p4()); - /// Returns the pseudojet collection. - /// If it already exists, the collection in the event store is returned. - /// If not, an new collection is created and filled by calling @c appendTo. - /// Returns null if the collection cannot be created. - const PseudoJetContainer* getC() const; + // user index is used to identify the xAOD object used for the PSeudoJet + psj.set_user_index(index); + vpj.push_back(psj); + } + return vpj; + } +#endif - std::vector<fastjet::PseudoJet> - createPseudoJets(const xAOD::IParticleContainer* ) const; +} - std::vector<fastjet::PseudoJet> - IParticlesToPJs(const xAOD::IParticleContainer*) const; - - std::vector<fastjet::PseudoJet> - EMToposToPJs(const xAOD::IParticleContainer*) const; -#ifndef GENERATIONBASE - std::vector<fastjet::PseudoJet> - PFlowsToPJs(const xAOD::IParticleContainer*) const; -#endif -}; #endif diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetterRegistry.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetterRegistry.h deleted file mode 100644 index b3b359d1a1e5dd35956231c31d9bf319e92a0d1e..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetGetterRegistry.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// PseudoJetGetterRegistry.h - -#ifndef PseudoJetGetterRegistry_H -#define PseudoJetGetterRegistry_H - -// David Adams -// February 2015 -// -// Class to hold pseudojet getters indexed by label. -// Each pseudojet getter is expected to register itself here. -// JetIsolationtool uses this to find the appropriate getter -// for a given jet. - -#include <string> -#include <map> -#include "JetInterface/IPseudoJetGetter.h" - -class PseudoJetGetterRegistry { - -public: - - typedef std::string Label; - typedef std::map<std::string, const IPseudoJetGetter*> Map; - - // Add a getter. - // Overwrites existing value. - // Returns 0 for success. - static int add(Label lab, const IPseudoJetGetter* ptool); - static int add(const IPseudoJetGetter* ptool); - - // Return if a getter is registered. - static bool has(Label lab); - - // Return the getter. - static const IPseudoJetGetter* find(Label lab); - -private: - - static Map m_map; - -}; - -#endif diff --git a/Reconstruction/Jet/JetRec/Root/MuonSegmentPseudoJetGetter.cxx b/Reconstruction/Jet/JetRec/Root/MuonSegmentPseudoJetGetter.cxx deleted file mode 100644 index 9b2960c589a925be79db9ac38c7012d558015368..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/Root/MuonSegmentPseudoJetGetter.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// MuonSegmentPseudoJetGetter.cxx - -#include "JetRec/MuonSegmentPseudoJetGetter.h" -#ifdef USE_BOOST_AUTO -#include <boost/typeof/typeof.hpp> -#endif -#include "JetEDM/PseudoJetVector.h" -#include "JetEDM/IndexedTConstituentUserInfo.h" - -#include "JetRec/PseudoJetContainer.h" -#include "JetRec/MuonSegmentExtractor.h" -#include "JetRec/PseudoJetContainer.h" - -using std::string; -using jet::PseudoJetVector; -using fastjet::PseudoJet; - -//********************************************************************** - -MuonSegmentPseudoJetGetter::MuonSegmentPseudoJetGetter(const std::string& name) -: AsgTool(name) { - declareProperty("InputContainer", m_incoll); - declareProperty("OutputContainer", m_outcoll); - declareProperty("Label", m_label); - declareProperty("Pt", m_pt =1.e-10); -} - -//********************************************************************** - -StatusCode MuonSegmentPseudoJetGetter::initialize() { - ATH_MSG_DEBUG("Initializing..."); - print(); - - ATH_CHECK( m_incoll.initialize() ); - ATH_CHECK( m_outcoll.initialize() ); - - return StatusCode::SUCCESS; -} - -//********************************************************************** - -StatusCode MuonSegmentPseudoJetGetter::createAndRecord() const { - // Use const pointer for now, but can change to unique pointer when - // we move to DataVector and when MR 2431 is complete: - // https://gitlab.cern.ch/atlas/athena/merge_requests/2431 - - // should rename getC createAndRecord once get() is removed. - - const PseudoJetContainer* pjc = this->getC(); - if(!pjc) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} - -//********************************************************************** - -const PseudoJetContainer* MuonSegmentPseudoJetGetter::getC() const { - ATH_MSG_DEBUG("Getting MuonSegmentPseudoJetContainer..."); - const PseudoJetContainer * pjcont; - - // build and record the container - const xAOD::MuonSegmentContainer* cont; - auto handle_in = SG::makeHandle(m_incoll); - if ( handle_in.isValid() ) { - ATH_MSG_DEBUG("Retrieving xAOD container " << m_incoll.key() ); - // retrieve the input. - cont = handle_in.cptr(); - } else { - ATH_MSG_ERROR("Unable to find input collection: " << m_incoll.key()); - ATH_MSG_ERROR("Error creating pseudojets."); - return nullptr; - } - - std::vector<PseudoJet> vpj = createPseudoJets(cont); - - // create an extractor (MuonSegmentExtractors are always ghost extractors) - MuonSegmentExtractor* extractor = new MuonSegmentExtractor(cont, m_label); - - // Put the PseudoJetContainer together : - pjcont = new PseudoJetContainer(extractor, vpj); - std::unique_ptr<const PseudoJetContainer> pjcont_ptr(pjcont); - - // record - SG::WriteHandle<PseudoJetContainer> handle_out(m_outcoll); - //ATH_MSG_DEBUG("New PseudoJetContainer in event store with extractor: " - // << extractor->toString(0)); - - // notify - if ( ! handle_out.put(std::move(pjcont_ptr))) { - ATH_MSG_ERROR("Unable to write new PseudoJetContainer to event store: " - << m_outcoll.key()); - } else { - ATH_MSG_DEBUG("Created new PseudoJetContainer in event store: " - << m_outcoll.key()); - } - - return pjcont; -} - - -std::vector<PseudoJet> -MuonSegmentPseudoJetGetter::createPseudoJets(const xAOD::MuonSegmentContainer* ms) const { - - std::vector<PseudoJet> vpj; - int index=0; - for(const xAOD::MuonSegment* part: *ms) { - double pt = m_pt; - double x = part->x(); - double y = part->y(); - double z = part->z(); - double xy = sqrt(x*x + y*y); - double r = sqrt(xy*xy + z*z); - double pfac = pt/xy; - double px = pfac*x; - double py = pfac*y; - double pz = pfac*z; - double e = pfac*r; - fastjet::PseudoJet psj(px, py, pz, e); - ATH_MSG_VERBOSE("Muon segment pseuojet y: " << psj.rap()); - vpj.push_back(psj); - //vpj.push_back( PseudoJet(part->px(),part->py(),part->pz(),part->t0()) ); - vpj.back().set_user_index(index); // Set the index !! - index++; - } - - return vpj; -} - -//********************************************************************** - -std::string MuonSegmentPseudoJetGetter::label() const{ - return m_label; -} - -//********************************************************************** - -void MuonSegmentPseudoJetGetter::print() const { - ATH_MSG_INFO("Properties for PseudoJetGetter " << name()); - ATH_MSG_INFO(" Label: " << m_label); - ATH_MSG_INFO(" Input container: " << m_incoll.key()); - ATH_MSG_INFO(" Output container: " << m_outcoll.key()); - ATH_MSG_INFO(" Pseudojet pT: " << m_pt); - -} - -//********************************************************************** diff --git a/Reconstruction/Jet/JetRec/Root/PseudoJetGetter.cxx b/Reconstruction/Jet/JetRec/Root/PseudoJetGetter.cxx deleted file mode 100644 index db1135f9e95e8af82ed932146a454efb7ab8111a..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/Root/PseudoJetGetter.cxx +++ /dev/null @@ -1,311 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// PseudoJetGetter.cxx - -#include "JetRec/PseudoJetGetter.h" -#include "fastjet/PseudoJet.hh" -#include "JetRec/PseudoJetContainer.h" -#include "JetEDM/PseudoJetVector.h" - -#include "xAODBase/IParticleContainer.h" -#include "JetRec/IParticleExtractor.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#ifndef GENERATIONBASE -#include "xAODPFlow/PFOContainer.h" -#endif - -using std::string; -using jet::PseudoJetVector; -using fastjet::PseudoJet; - -//********************************************************************** - -PseudoJetGetter::PseudoJetGetter(const std::string& name) - : AsgTool(name), m_emtopo(false), m_pflow(false) { - declareProperty("InputContainer", m_incoll); - declareProperty("OutputContainer", m_outcoll); - declareProperty("Label", m_label); - declareProperty("SkipNegativeEnergy", m_skipNegativeEnergy =false); - declareProperty("GhostScale", m_ghostscale =0.0); - declareProperty("TreatNegativeEnergyAsGhost", m_negEnergyAsGhosts =false); - -} - -//********************************************************************** - -StatusCode PseudoJetGetter::initialize() { - ATH_MSG_DEBUG("Initializing..."); - // PJG needs to know if this is the basic EMTopo cluster collection - // in order to change the cluster signal state. - if ( m_label == "EMTopo") m_emtopo = true; - if ( m_label == "EMPFlow") m_pflow = true; - if ( m_label == "EMNPFlow") m_pflow = true; - print(); - - ATH_CHECK( m_incoll.initialize() ); - ATH_CHECK( m_outcoll.initialize() ); - - return StatusCode::SUCCESS; -} - -//********************************************************************** - -StatusCode PseudoJetGetter::createAndRecord() const { - // Use const pointer for now, but can change to unique pointer when - // we move to DataVector and when MR 2431 is complete: - // https://gitlab.cern.ch/atlas/athena/merge_requests/2431 - - // should rename getC createAndRecord once get() is removed. - const PseudoJetContainer* pjc = this->getC(); - if (!pjc) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} -//********************************************************************** -const PseudoJetVector* PseudoJetGetter::get() const { - // Kept for backward compatibity - ATH_MSG_DEBUG("Getting PseudoJetContainer as PseudoJetVector ..."); - const PseudoJetContainer* cont = this->getC(); - const PseudoJetVector* vpj = cont->casVectorPseudoJet(); - return vpj; -} - -//********************************************************************** - -const PseudoJetContainer* PseudoJetGetter::getC() const { - ATH_MSG_DEBUG("Getting PseudoJetContainer..."); - // build and record the container - const xAOD::IParticleContainer* cont; - auto handle_in = SG::makeHandle(m_incoll); - if ( handle_in.isValid() ) { - cont = handle_in.cptr(); - ATH_MSG_DEBUG("Retrieving xAOD container " << m_incoll.key() << "of size "<<cont->size() - << ", ghost scale=" << m_ghostscale - << ", isGhost=" << bool(m_ghostscale)); - - - } else { - ATH_MSG_ERROR("Unable to find input collection: " << m_incoll.key()); - ATH_MSG_ERROR("Error creating pseudojets."); - return nullptr; - } - - // create PseudoJets - std::vector<PseudoJet> vpj = createPseudoJets(cont); - - // create an extractor - - // "Ghost" in outout collection name? If so is a ghost collection. - bool isGhost = (m_outcoll.key()).find("Ghost") != std::string::npos; - - IParticleExtractor* extractor = new IParticleExtractor(cont, - m_label, - isGhost); - ATH_MSG_DEBUG("New extractor: " << extractor->toString(0)); - - // ghostify the pseudojets if necessary - if(isGhost){ - for(PseudoJet& pj : vpj) {pj *= 1e-40;} - } - - // Put the PseudoJetContainer together : - std::unique_ptr<const PseudoJetContainer> uppjcont(new PseudoJetContainer(extractor, vpj)); - - // record - - SG::WriteHandle<PseudoJetContainer> handle_out(m_outcoll); - - - ATH_MSG_DEBUG("New PseudoJetContainer size " << uppjcont->size()); - // notify - const PseudoJetContainer* ppjcont = handle_out.put(std::move(uppjcont)); - if (!ppjcont) { - ATH_MSG_ERROR("Unable to write new PseudoJetContainer to event store: " - << m_outcoll.key()); - } else { - ATH_MSG_DEBUG("Created new PseudoJetContainer in event store: " - << m_outcoll.key()); - } - - return ppjcont; // used by legacy code, looks wrong.... -} - - -std::vector<PseudoJet> -PseudoJetGetter::createPseudoJets(const xAOD::IParticleContainer* ips) const{ -#ifndef GENERATIONBASE - if (m_pflow) {return PFlowsToPJs(ips);} -#endif - if (m_emtopo) {return EMToposToPJs(ips);} - return IParticlesToPJs(ips); -} - -struct IParticleRejecter{ - bool null{false}; - bool negativeE{false}; - bool skipNegativeEnergy{false}; - - IParticleRejecter(bool skip): skipNegativeEnergy(skip){ - } - - bool operator()(const xAOD::IParticle* ip) { - null = (ip == 0); - negativeE = skipNegativeEnergy && ip->e() <= 0.0; - return (null || negativeE); - } -}; - - -std::vector<PseudoJet> -PseudoJetGetter::IParticlesToPJs(const xAOD::IParticleContainer* ips) const { - - IParticleRejecter rejecter(m_skipNegativeEnergy); - - std::vector<PseudoJet> vpj; - int index = -1; - - // loop over the input iparticles, select and convert to pseudojets - for(const xAOD::IParticle* ip: *ips) { - ++index; - if(rejecter(ip)){continue;} - - // Create a PSeudojet with the momentum of the selected IParticles. - fastjet::PseudoJet psj(ip->p4()); - - // user index is used to identify the xAOD object used for the PseudoJet - psj.set_user_index(index); - vpj.push_back(psj); - - } - return vpj; -} - -struct EMTopoRejecter{ - const xAOD::CaloCluster* cluster{0}; - - bool operator()(const xAOD::IParticle* ip){ - cluster = dynamic_cast<const xAOD::CaloCluster*>(ip); - return cluster == 0; // reject if not a cluster - } -}; - -std::vector<PseudoJet> -PseudoJetGetter::EMToposToPJs(const xAOD::IParticleContainer* ips) const { - - // helper objects for selecting iparticles to be converted to pseudojets - IParticleRejecter ipRejecter(m_skipNegativeEnergy); - EMTopoRejecter emRejecter; - - std::vector<PseudoJet> vpj; - int index = -1; - - // loop over iparticles, select and convert to pseudojets - - for(const xAOD::IParticle* ip: *ips) { - ++index; - if(ipRejecter(ip) or emRejecter(ip)){continue;} - - // Create a Pseudojet with the momentum of the cluster. - fastjet::PseudoJet - psj(emRejecter.cluster->p4(xAOD::CaloCluster::UNCALIBRATED)); - - // user index is used to identify the xAOD object used for the PSeudoJet - psj.set_user_index(index); - vpj.push_back(psj); - } - return vpj; -} - -#ifndef GENERATIONBASE -struct PFlowRejecter{ - - bool skipNegativeEnergy{false}; - - PFlowRejecter(bool skip): skipNegativeEnergy(skip){ - } - - bool operator()(const xAOD::IParticle* ip){ - - const xAOD::PFO* pfo = dynamic_cast<const xAOD::PFO*>(ip); - - // keep charged PFOs with energy==0 because for MET TST with PFlow, - // there may be high pt - // charged PFOs that receive a weight of 0 due to being in dense - // showers, but need to be present for overlap removal, because they - // don't retain these weights when added to the TST - - if( fabs(pfo->charge())>FLT_MIN) { - const static SG::AuxElement::ConstAccessor<char> - PVMatchedAcc("matchedToPV"); - return !PVMatchedAcc(*pfo); - } - - // This also skips 0 energy, which has no effect other than - // on memory size, but is used in some workflows for pileup rejection - return skipNegativeEnergy && pfo->e()<FLT_MIN; - } -}; - -std::vector<PseudoJet> -PseudoJetGetter::PFlowsToPJs(const xAOD::IParticleContainer* ips) const { - - PFlowRejecter rejecter(m_skipNegativeEnergy); - std::vector<PseudoJet> vpj; - int index = -1; - - // loop over the input iparticles, select and convert to pseudojets - - for(const xAOD::IParticle* ip: *ips) { - ++index; - if(rejecter(ip)){continue;} - - // Create a PSeudojet with the momentum of the selected IParticles. - fastjet::PseudoJet psj(ip->p4()); - - // user index is used to identify the xAOD object used for the PSeudoJet - psj.set_user_index(index); - - vpj.push_back(psj); - } - return vpj; -} -#endif - -//********************************************************************** - - -std::string PseudoJetGetter::label() const{ - return m_label; -} - -//********************************************************************** - -void PseudoJetGetter::print() const { - string sskip = m_skipNegativeEnergy ? "true" : "false"; - ATH_MSG_INFO("Properties for PseudoJetGetter " << name()); - ATH_MSG_INFO(" Label: " << m_label); - ATH_MSG_INFO(" Input container: " << m_incoll.key()); - ATH_MSG_INFO(" Output container: " << m_outcoll.key()); - ATH_MSG_INFO(" Skip negative E: " << sskip); - ATH_MSG_INFO(" Is EMTopo: " << m_emtopo); - ATH_MSG_INFO(" Is PFlow: " << m_pflow); - ATH_MSG_INFO(" Treat negative E as ghost: " << m_negEnergyAsGhosts); -} - -//********************************************************************** - -int PseudoJetGetter::inputContainerNames(std::vector<std::string>& connames) { - if ( m_incoll.key().size() ) connames.push_back(m_incoll.key()); - return 0; -} - -//********************************************************************** - -int PseudoJetGetter::outputContainerNames(std::vector<std::string>& connames) { - if ( m_outcoll.key().size() ) connames.push_back(m_outcoll.key()); - return 0; -} - -//********************************************************************** diff --git a/Reconstruction/Jet/JetRec/Root/PseudoJetGetterRegistry.cxx b/Reconstruction/Jet/JetRec/Root/PseudoJetGetterRegistry.cxx deleted file mode 100644 index 98e2e7f1ea18022a0018436beb3be0f53d5e7306..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRec/Root/PseudoJetGetterRegistry.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// PseudoJetGetterRegistry.cxx - -#include "JetRec/PseudoJetGetterRegistry.h" - -PseudoJetGetterRegistry::Map PseudoJetGetterRegistry::m_map; - -//********************************************************************** - -int PseudoJetGetterRegistry::add(Label lab, const IPseudoJetGetter* ptool) { - m_map[lab] = ptool; - return 0; -} - -//********************************************************************** - -int PseudoJetGetterRegistry::add(const IPseudoJetGetter* ptool) { - if ( ptool == nullptr ) return 1; - std::string lab = ptool->label(); - if ( lab.size() == 0 ) return 2; - m_map[lab] = ptool; - return 0; -} - -//********************************************************************** - -bool PseudoJetGetterRegistry::has(Label lab) { - return m_map.find(lab) != m_map.end(); -} - -//********************************************************************** - -const IPseudoJetGetter* PseudoJetGetterRegistry::find(Label lab) { - auto ient = m_map.find(lab); - if ( ient == m_map.end() ) return nullptr; - return ient->second; -} - -//********************************************************************** diff --git a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py index 4ca800975b3992a101432541bb78721aa2708da3..6905069617a5bdb71bd82f1b3f50c47ea1a4ee5c 100644 --- a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py +++ b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py @@ -155,9 +155,11 @@ def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None, Tools=[jtm.jetconstit]) # Add all the PseudoJetAlgorithms now - from JetRec.JetRecConf import PseudoJetAlgorithm + # To avoid massive refactoring and to preserve familiarity, + # kept calling things "getters", but these are already + # PseudoJetAlgorithms as we eliminated the wrappers for getter in jtm.allGetters: - job += PseudoJetAlgorithm("pjalg_"+getter.Label,PJGetter=getter) + job += getter # Then, add all event shape tools in separate algs for evstool in jtm.allEDTools: diff --git a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py b/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py index fa89b11bbf2c5fe54cc2039c69e78dc8b7dc4932..93215db951c562a7f3b545fac9ddeb10bb25ec4a 100644 --- a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py +++ b/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py @@ -32,18 +32,10 @@ from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier from PFlowUtils.PFlowUtilsConf import CP__WeightPFOTool as WeightPFOTool from JetRecTools.JetRecToolsConf import CorrectPFOTool from JetRecTools.JetRecToolsConf import ChargedHadronSubtractionTool -from JetRecTools.JetRecToolsConf import TrackPseudoJetGetter from JetRecTools.JetRecToolsConf import JetTrackSelectionTool from JetRecTools.JetRecToolsConf import JetTrackSelectionTool2 from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool -# PS 5/12/2017 from JetSimTools.JetSimToolsConf import TruthPseudoJetGetter -# FIXME JE -#from JetRecTools.JetRecToolsConf import CorrectPFOTool -# FIXME JE -#from JetRecTools.JetRecToolsConf import ChargedHadronSubtractionTool -# FIXME JE -#from JetRecTools.JetRecToolsConf import JetConstituentModSequence try: from JetRecCalo.JetRecCaloConf import MissingCellListTool @@ -53,11 +45,11 @@ except ImportError: from JetRec.JetRecConf import JetPseudojetRetriever from JetRec.JetRecConf import JetConstituentsRetriever from JetRec.JetRecConf import JetRecTool -from JetRec.JetRecConf import PseudoJetGetter -from JetRec.JetRecConf import MuonSegmentPseudoJetGetter from JetRec.JetRecConf import JetFromPseudojet from JetRec.JetRecConf import JetConstitRemover from JetRec.JetRecConf import JetSorter +from JetRec.JetRecConf import PseudoJetAlgorithm +from JetRec.JetRecConf import MuonSegmentPseudoJetAlgorithm from JetMomentTools.JetMomentToolsConf import JetCaloQualityTool try: from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool @@ -246,7 +238,7 @@ jtm += ctm.buildConstitModifSequence( "JetConstitSeq_EMOrigin", InputContainer= 'CaloCalTopoClusters', modList = [ 'clus_emscale', 'clus_origin' ] ) -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "lcoriginget", InputContainer = jtm.JetConstitSeq_LCOrigin.OutputContainer, Label = "LCTopoOrigin", @@ -255,7 +247,7 @@ jtm += PseudoJetGetter( GhostScale = 0.0 ) -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "emoriginget", InputContainer = jtm.JetConstitSeq_EMOrigin.OutputContainer, Label = "EMTopoOrigin", @@ -265,7 +257,7 @@ jtm += PseudoJetGetter( ) # Clusters. -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "lcget", InputContainer = "CaloCalTopoClusters", Label = "LCTopo", @@ -275,7 +267,7 @@ jtm += PseudoJetGetter( ) # EM clusters. -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "emget", InputContainer = "CaloCalTopoClusters", Label = "EMTopo", @@ -285,29 +277,27 @@ jtm += PseudoJetGetter( ) # Tracks. -jtm += TrackPseudoJetGetter( +jtm += PseudoJetAlgorithm( "trackget", InputContainer = jtm.trackselloose_trackjets.OutputContainer, Label = "Track", OutputContainer = "PseudoJetTrack", - TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation, SkipNegativeEnergy = True, GhostScale = 0.0 ) # Ghost tracks. -jtm += TrackPseudoJetGetter( +jtm += PseudoJetAlgorithm( "gtrackget", InputContainer = jtm.tracksel.OutputContainer, Label = "GhostTrack", OutputContainer = "PseudoJetGhostTrack", - TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation, SkipNegativeEnergy = True, GhostScale = ghostScaleFactor ) # Muon segments -jtm += MuonSegmentPseudoJetGetter( +jtm += MuonSegmentPseudoJetAlgorithm( "gmusegget", InputContainer = "MuonSegments", Label = "GhostMuonSegment", @@ -370,7 +360,7 @@ jtm += ctm.buildConstitModifSequence( "JetConstitSeq_PFlowCHS", modList = ['correctPFO', 'chsPFO'] ) # EM-scale pflow. -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "empflowget", Label = "EMPFlow", InputContainer = "CHSParticleFlowObjects", @@ -380,7 +370,7 @@ jtm += PseudoJetGetter( ) # AntiKt2 track jets. -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "gakt2trackget", # give a unique name InputContainer = jetFlags.containerNamePrefix() + "AntiKt2PV0TrackJets", # SG key Label = "GhostAntiKt2TrackJet", # this is the name you'll use to retrieve associated ghosts @@ -390,7 +380,7 @@ jtm += PseudoJetGetter( ) # AntiKt4 track jets. -jtm += PseudoJetGetter( +jtm += PseudoJetAlgorithm( "gakt4trackget", # give a unique name InputContainer = jetFlags.containerNamePrefix() + "AntiKt4PV0TrackJets", # SG key Label = "GhostAntiKt4TrackJet", # this is the name you'll use to retrieve associated ghosts @@ -401,8 +391,7 @@ jtm += PseudoJetGetter( # Truth. if jetFlags.useTruth and jtm.haveParticleJetTools: - # PS 5/1/2017 jtm += TruthPseudoJetGetter( - jtm += PseudoJetGetter( + jtm += PseudoJetAlgorithm( "truthget", Label = "Truth", InputContainer = jtm.truthpartcopy.OutputName, @@ -411,8 +400,7 @@ if jetFlags.useTruth and jtm.haveParticleJetTools: SkipNegativeEnergy = True, ) - # PS 5/1/2017 jtm += TruthPseudoJetGetter( - jtm += PseudoJetGetter( + jtm += PseudoJetAlgorithm( "truthwzget", Label = "TruthWZ", InputContainer = jtm.truthpartcopywz.OutputName, @@ -421,8 +409,7 @@ if jetFlags.useTruth and jtm.haveParticleJetTools: SkipNegativeEnergy = True, ) - # PS 5/1/2017 jtm += TruthPseudoJetGetter( - jtm += PseudoJetGetter( + jtm += PseudoJetAlgorithm( "gtruthget", Label = "GhostTruth", InputContainer = jtm.truthpartcopy.OutputName, @@ -433,8 +420,7 @@ if jetFlags.useTruth and jtm.haveParticleJetTools: # Truth flavor tags. for ptype in jetFlags.truthFlavorTags(): - # PS 5/1/2017 jtm += TruthPseudoJetGetter( - jtm += PseudoJetGetter( + jtm += PseudoJetAlgorithm( "gtruthget_" + ptype, InputContainer = "TruthLabel" + ptype, Label = "Ghost" + ptype, @@ -661,7 +647,7 @@ jtm += JetVoronoiMomentsTool( #jtm += JetMuonSegmentMomentsTool("muonsegs") # Isolations. -# Note absence of PseudoJetGetter property means the jet inputs +# Note absence of PseudoJetAlgorithm property means the jet inputs # are obtained according to the InputType property of the jet. jtm += JetIsolationTool( "jetisol", diff --git a/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py b/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py index 8a162c7e04846b574da8f73911f828994c6ffd4f..ccf56adce351441ca6a7ed2612563a71057e4c76 100755 --- a/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py +++ b/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py @@ -77,32 +77,25 @@ def JetInputCfg(ConfigFlags): # Add the alg to the sequence in the ComponentAccumulator inputcfg.addEventAlgo(jetmodalg,sequencename) - # Create a PseudoJetGetter & corresponding algorithm - constitgetter = CompFactory.PseudoJetGetter( - "pjg_LCTopo", + # Create a PseudoJetAlgorithm + + constitpjgalg = CompFactory.PseudoJetAlgorithm( + "pjgalg_LCTopo", InputContainer = "LCOriginTopoClusters", OutputContainer = "PseudoJetLCTopo", Label = "LCTopo", SkipNegativeEnergy=True, GhostScale=0.) - constitpjgalg = CompFactory.PseudoJetAlgorithm( - "pjgalg_LCTopo", - PJGetter = constitgetter) - - ghostgetter = CompFactory.PseudoJetGetter( - "pjg_Truth", + ghostpjgalg = CompFactory.PseudoJetAlgorithm( + "pjgalg_Truth", InputContainer = "TruthParticles", OutputContainer = "PseudoJetTruth", Label = "Truth", SkipNegativeEnergy=True, GhostScale=0.) - ghostpjgalg = CompFactory.PseudoJetAlgorithm( - "pjgalg_Truth", - PJGetter = ghostgetter) - - pjcs = [constitgetter.OutputContainer,ghostgetter.OutputContainer] + pjcs = [constitpjgalg.OutputContainer,ghostpjgalg.OutputContainer] # Add the algs to the sequence in the ComponentAccumulator inputcfg.addEventAlgo(constitpjgalg,sequencename) @@ -125,15 +118,11 @@ def JetBuildAlgCfg(ConfigFlags,buildjetsname): buildcfg.merge(inputcfg) # Create a merger to build the PseudoJetContainer for this specific jet collection - pjmerger = CompFactory.PseudoJetMerger( - "pjmerge_"+buildjetsname, + mergepjalg = CompFactory.PseudoJetMerger( + "pjmergealg_"+buildjetsname, InputPJContainers = pjcs, OutputContainer = "PseudoJetMerged_"+buildjetsname) - mergepjalg = CompFactory.PseudoJetAlgorithm( - "pjmergealg_"+buildjetsname, - PJGetter = pjmerger) - buildcfg.addEventAlgo(mergepjalg) # Create the JetClusterer, set some standard options diff --git a/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py b/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py index ed1dd7d89dbb0bb30c5903485f13be54ca16959f..3c8675d7cfa1d3ebc0ac1d6175293e5754d88963 100644 --- a/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py +++ b/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py @@ -17,7 +17,7 @@ from AthenaCommon import CfgMgr # In the midst of this migration, we can only cope with one pseudojet type # otherwise we end up trying to update an object in SG, which is not allowed # Needs JE's PseudojetContainer developments -emget = CfgMgr.PseudoJetGetter( +emget = CfgMgr.PseudoJetAlgorithm( "emget", InputContainer = "CaloCalTopoClusters", Label = "EMTopo", @@ -26,9 +26,8 @@ emget = CfgMgr.PseudoJetGetter( GhostScale = 0.0, # OutputLevel=VERBOSE, ) -ToolSvc += emget -topSequence += CfgMgr.PseudoJetAlgorithm("pjalg_EMTopo",PJGetter=emget) +topSequence += emget # Set up the jet finder JetFinder_AntiKt4 = CfgMgr.JetFinder("MTAntiKt4EMTopoJetsFinder", @@ -41,24 +40,17 @@ JetFinder_AntiKt4 = CfgMgr.JetFinder("MTAntiKt4EMTopoJetsFinder", #Then we setup a jet builder to calculate the areas needed for the rho subtraction # Actually, we don't really need the areas but we may as well use this one -from AthenaCommon.AppMgr import ToolSvc JetBuilder_AntiKt4 = CfgMgr.JetFromPseudojet("jblda", Attributes = ["ActiveArea", "ActiveArea4vec"], OutputLevel=VERBOSE) -ToolSvc += JetBuilder_AntiKt4 JetFinder_AntiKt4.JetBuilder = JetBuilder_AntiKt4 -ToolSvc += JetFinder_AntiKt4 #Now we setup a JetRecTool which will use the above JetFinder JetRecTool = CfgMgr.JetRecTool("MTAntiKt4EMTopoJets", OutputLevel=VERBOSE) JetRecTool.JetFinder = JetFinder_AntiKt4 -ToolSvc += JetRecTool JetRecTool.InputPseudoJets = [emget.OutputContainer] JetRecTool.OutputContainer = "MTAntiKt4EMTopoJets" -#jpjretriever = CfgMgr.JetPseudojetRetriever("jpjretriever") -#ToolSvc += jpjretriever - topSequence += CfgMgr.JetAlgorithm("MTJetAlg",Tools = [JetRecTool]) write_xAOD = True diff --git a/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..35a6ae6ea569579088fb0f2bf272cd6b6cc82131 --- /dev/null +++ b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx @@ -0,0 +1,94 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "JetRec/MuonSegmentExtractor.h" +#include "MuonSegmentPseudoJetAlgorithm.h" + +//********************************************************************** + +StatusCode MuonSegmentPseudoJetAlgorithm::initialize() { + ATH_MSG_INFO("Initializing " << name() << "..."); + + print(); + + if(m_incoll.key().empty() || m_outcoll.key().empty()) { + ATH_MSG_ERROR("Either input or output collection is empty!"); + return StatusCode::FAILURE; + } + + ATH_CHECK( m_incoll.initialize() ); + ATH_CHECK( m_outcoll.initialize() ); + + return StatusCode::SUCCESS; +} + +//********************************************************************** + +StatusCode MuonSegmentPseudoJetAlgorithm::execute(const EventContext& ctx) const { + ATH_MSG_VERBOSE("Executing " << name() << "..."); + + auto incoll = SG::makeHandle<xAOD::MuonSegmentContainer>(m_incoll,ctx); + if( !incoll.isValid() ) { + // Return SUCCESS to avoid crashing T0 jobs + ATH_MSG_WARNING("Failed to retrieve " << m_incoll.key() << " for PseudoJet creation!" ); + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG("Retrieved muon segment container " << m_incoll.key() ); + + std::vector<fastjet::PseudoJet> vpj = createPseudoJets(*incoll); + + // create an extractor (MuonSegmentExtractors are always ghost extractors) + auto extractor = std::make_unique<MuonSegmentExtractor>(incoll.cptr(), m_label); + ATH_MSG_DEBUG("Created extractor: " << extractor->toString(0)); + + // Put the PseudoJetContainer together + auto pjcont = std::make_unique<PseudoJetContainer>(extractor.release(), vpj); + + auto outcoll = SG::makeHandle<PseudoJetContainer>(m_outcoll,ctx); + ATH_CHECK(outcoll.record(std::move(pjcont))); + ATH_MSG_DEBUG("New PseudoJetContainer size " << pjcont->size()); + + return StatusCode::SUCCESS; +} + +//********************************************************************** + +std::vector<fastjet::PseudoJet> +MuonSegmentPseudoJetAlgorithm::createPseudoJets(const xAOD::MuonSegmentContainer& ms) const { + + std::vector<fastjet::PseudoJet> vpj; + int index=0; + for(const xAOD::MuonSegment* part: ms) { + double pt = m_pt; + double x = part->x(); + double y = part->y(); + double z = part->z(); + double xy = sqrt(x*x + y*y); + double r = sqrt(xy*xy + z*z); + double pfac = pt/xy; + double px = pfac*x; + double py = pfac*y; + double pz = pfac*z; + double e = pfac*r; + fastjet::PseudoJet psj(px, py, pz, e); + ATH_MSG_VERBOSE("Muon segment pseudojet y: " << psj.rap()); + vpj.push_back(psj); + vpj.back().set_user_index(index); // Set the index !! + index++; + } + + return vpj; +} + +//********************************************************************** + +void MuonSegmentPseudoJetAlgorithm::print() const { + ATH_MSG_INFO("Properties for MuonSegmentPseudoJetGetter " << name()); + ATH_MSG_INFO(" Label: " << m_label); + ATH_MSG_INFO(" Input container: " << m_incoll.key()); + ATH_MSG_INFO(" Output container: " << m_outcoll.key()); + ATH_MSG_INFO(" Pseudojet pT: " << m_pt); +} + +//********************************************************************** diff --git a/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.h b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..4de9244badb3e7cd70f7b542f7ee076a8898e0a1 --- /dev/null +++ b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// MuonSegmentPseudoJetAlgorithm.h + +/// A PseudoJetAlgorithm for muon segments (which are not IParticles) +/// +/// This is needed for the punchthrough calibration correction. +/// Due to the different configuration properties and limited +/// code sharing, this does not inherit from PseudoJetAlgorithm +/// or a common base. + +#ifndef MuonSegmentPseudoJetAlgorithm_H +#define MuonSegmentPseudoJetAlgorithm_H + +#include <memory> +#include "fastjet/PseudoJet.hh" +#include "JetRec/PseudoJetContainer.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "xAODMuon/MuonSegment.h" +#include "xAODMuon/MuonSegmentContainer.h" + +class MuonSegmentPseudoJetAlgorithm : public AthReentrantAlgorithm { + +public: + + // No need for a specialised constructor + using AthReentrantAlgorithm::AthReentrantAlgorithm; + + /// Athena algorithm's Hooks + virtual StatusCode initialize() override final; + + // Standard execute, forwards to createAndRecord + virtual StatusCode execute(const EventContext& ctx) const override final; + +private: + + std::vector<fastjet::PseudoJet> createPseudoJets(const xAOD::MuonSegmentContainer& ms) const; + + /// Dump to properties to the log. + virtual void print() const; + +private: + + /// Input collection name. + SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_incoll{this, "InputContainer", "MuonSegments", "The input MuonSegmentContainer name"}; + + /// Output collection name. + SG::WriteHandleKey<PseudoJetContainer> m_outcoll{this, "OutputContainer", "PseudoJetGhostMuonSegment", "The output PseudoJetContainer name"}; + + /// Label for the collection. + Gaudi::Property<std::string> m_label{this, "Label", "GhostMuonSegment", "String label identifying the pseudojet type"}; + + Gaudi::Property<float> m_pt{this, "Pt", 1.e-10, "The pT to set for the muon segments"}; + +}; + +#endif diff --git a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx index a7408a5781bc200824c68d09c364554d3f98f8f2..425f0a8464157613340296bd555b04e8ebcaf7c5 100644 --- a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx +++ b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx @@ -1,51 +1,115 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // PseudoJetAlgorithm.cxx #include "PseudoJetAlgorithm.h" -#include "JetInterface/IPseudoJetGetter.h" - -using std::string; +#include "JetRec/PseudoJetGetter.h" +#include "JetRec/IParticleExtractor.h" //********************************************************************** -PseudoJetAlgorithm::PseudoJetAlgorithm(const std::string& name, - ISvcLocator* pSvcLocator ) - : ::AthReentrantAlgorithm( name, pSvcLocator ),m_pjg(this) { - declareProperty( "PJGetter", m_pjg); -} +StatusCode PseudoJetAlgorithm::initialize() { + ATH_MSG_INFO("Initializing " << name() << "..."); -//********************************************************************** + // This is horrible, but still necessary for the time being + // PJG needs to know if this is the basic EMTopo cluster collection + // in order to change the cluster signal state. + if ( m_label == "EMTopo") m_emtopo = true; + // PFlow containers need to have PV matching applied + if ( std::string(m_label).find("PFlow") != std::string::npos ) m_pflow = true; -PseudoJetAlgorithm::~PseudoJetAlgorithm() { } + // "Ghost" in output collection name? If so is a ghost collection. + m_isGhost = (m_outcoll.key()).find("Ghost") != std::string::npos; -//********************************************************************** + print(); -StatusCode PseudoJetAlgorithm::initialize() { - ATH_MSG_INFO("Initializing " << name() << "..."); - ATH_MSG_INFO("Retrieving pseudojet getter " << m_pjg->name()); - ATH_CHECK( m_pjg.retrieve() ); - m_pjg->print(); - return StatusCode::SUCCESS; -} + if(m_incoll.key().empty() || m_outcoll.key().empty()) { + ATH_MSG_ERROR("Either input or output collection is empty!"); + return StatusCode::FAILURE; + } -//********************************************************************** + ATH_CHECK( m_incoll.initialize() ); + ATH_CHECK( m_outcoll.initialize() ); -StatusCode PseudoJetAlgorithm::finalize() { - ATH_MSG_INFO ("Finalizing " << name() << "..."); return StatusCode::SUCCESS; } + //********************************************************************** -StatusCode PseudoJetAlgorithm::execute(const EventContext& /*ctx*/) const { +StatusCode PseudoJetAlgorithm::execute(const EventContext& ctx) const { ATH_MSG_VERBOSE("Executing " << name() << "..."); - ATH_CHECK( m_pjg->createAndRecord() ); + // build and record the container + auto incoll = SG::makeHandle(m_incoll, ctx); + if( !incoll.isValid() ) { + // Return SUCCESS to avoid crashing T0 jobs + ATH_MSG_WARNING("Failed to retrieve " << m_incoll.key() << " for PseudoJet creation!" ); + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG("Retrieved xAOD container " << m_incoll.key() << "of size " << incoll->size() + << ", ghost scale=" << m_ghostscale + << ", isGhost=" << bool(m_ghostscale)); + + ATH_MSG_DEBUG("Creating PseudoJetContainer..."); + std::unique_ptr<PseudoJetContainer> pjcont( createPJContainer(*incoll) ); + + auto outcoll = SG::makeHandle(m_outcoll, ctx); + ATH_CHECK( outcoll.record(std::move(pjcont)) ); + + ATH_MSG_DEBUG("Created new PseudoJetContainer in event store: " + << m_outcoll.key()); return StatusCode::SUCCESS; } + +std::unique_ptr<PseudoJetContainer> PseudoJetAlgorithm::createPJContainer(const xAOD::IParticleContainer& cont) const { + // create PseudoJets + std::vector<fastjet::PseudoJet> vpj = createPseudoJets(cont); + + // create an extractor to attach to the PJContainer -- this will be used by clients + auto extractor = std::make_unique<IParticleExtractor>(&cont, m_label, m_isGhost); + ATH_MSG_DEBUG("Created extractor: " << extractor->toString(0)); + + // ghostify the pseudojets if necessary + if(m_isGhost){ + for(fastjet::PseudoJet& pj : vpj) {pj *= 1e-40;} + } + + // Put the PseudoJetContainer together + auto pjcont = std::make_unique<PseudoJetContainer>(extractor.release(), vpj); + ATH_MSG_DEBUG("New PseudoJetContainer size " << pjcont->size()); + + return std::move(pjcont); +} + + +std::vector<fastjet::PseudoJet> +PseudoJetAlgorithm::createPseudoJets(const xAOD::IParticleContainer& ips) const{ +#ifndef GENERATIONBASE + if (m_pflow) {return PseudoJetGetter::PFlowsToPJs(ips,m_skipNegativeEnergy);} + if (m_emtopo) {return PseudoJetGetter::EMToposToPJs(ips,m_skipNegativeEnergy);} +#endif + return PseudoJetGetter::IParticlesToPJs(ips,m_skipNegativeEnergy); +} + + +//********************************************************************** + +void PseudoJetAlgorithm::print() const { + std::string sskip = m_skipNegativeEnergy ? "true" : "false"; + // May want to change to DEBUG + ATH_MSG_INFO("Properties for PseudoJetGetter " << name()); + ATH_MSG_INFO(" Label: " << m_label); + ATH_MSG_INFO(" Input container: " << m_incoll.key()); + ATH_MSG_INFO(" Output container: " << m_outcoll.key()); + ATH_MSG_INFO(" Skip negative E: " << sskip); + ATH_MSG_INFO(" Is EMTopo: " << m_emtopo); + ATH_MSG_INFO(" Is PFlow: " << m_pflow); + ATH_MSG_INFO(" Treat negative E as ghost: " << m_negEnergyAsGhosts); +} + //********************************************************************** diff --git a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.h b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.h index 4d82f4f01fb3e97f43b81ec8d17f3c30ec722da5..760b743160e4febfbe800e00b38d6a36e752fdb1 100644 --- a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.h +++ b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.h @@ -1,41 +1,82 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // PseudoJetAlgorithm.h +/// PseudoJetAlgorithm retrieves and builds the pseudojet inputs used in jet finding +/// +/// Alg Properties: +/// - InputCollection: Name of the input collection. +/// - OutputCollection: Name of the output collection of pseudojets. +/// - Label: Label for the constituents. See note below. +/// - SkipNegativeEnergy: Flag indicating that inputs with negative energy +/// should be ignored. +/// - GhostScale : If nonzero, the pseudojets are labeled as ghosts and +/// their four-momenta are scaled by this factor. +/// +/// Note: The label is attached to the CUI (constituent user info) associated with +/// created pseudojet and is used to name jet moments that point to the PJs, +/// and in rare cases (EMTopo, PFlow) to toggle special treatments. + #ifndef PseudoJetAlgorithm_H #define PseudoJetAlgorithm_H -#include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" +#include <memory> +#include "fastjet/PseudoJet.hh" +#include "JetRec/PseudoJetContainer.h" -class IPseudoJetGetter; +#include "AthenaBaseComps/AthReentrantAlgorithm.h" class PseudoJetAlgorithm : public AthReentrantAlgorithm { public: - /// Constructor with parameters: - PseudoJetAlgorithm(const std::string& name, ISvcLocator* pSvcLocator); - - /// Destructor: - ~PseudoJetAlgorithm(); + // No need for a specialised constructor + using AthReentrantAlgorithm::AthReentrantAlgorithm; /// Athena algorithm's Hooks - virtual StatusCode initialize() override; - virtual StatusCode execute(const EventContext& ctx) const override; - virtual StatusCode finalize() override; + virtual StatusCode initialize() override final; + + // Standard execute, forwards to createAndRecord + virtual StatusCode execute(const EventContext& ctx) const override final; private: - /// Default constructor: - PseudoJetAlgorithm(); + /// Method to construct the PseudoJetContainer and record in StoreGate + virtual std::unique_ptr<PseudoJetContainer> createPJContainer(const xAOD::IParticleContainer& cont) const; + + /// Dump to properties to the log. + virtual void print() const; + + std::vector<fastjet::PseudoJet> + createPseudoJets(const xAOD::IParticleContainer&) const; private: - /// Athena configured tools - ToolHandle<IPseudoJetGetter> m_pjg; + /// Input collection name. + SG::ReadHandleKey<xAOD::IParticleContainer> m_incoll{this, "InputContainer", "", "The input IParticleContainer name"}; + + /// Output collection name. + SG::WriteHandleKey<PseudoJetContainer> m_outcoll{this, "OutputContainer", "", "The output PseudoJetContainer name"}; + + /// Label for the collection. + Gaudi::Property<std::string> m_label{this, "Label", "", "String label identifying the pseudojet type"}; + + /// Flag indicating to skip objects with E<0. + Gaudi::Property<bool> m_skipNegativeEnergy{this, "SkipNegativeEnergy", false, "Whether to skip negative energy inputs"}; + + /// Ghost scale factor. + Gaudi::Property<double> m_ghostscale{this, "GhostScale", 0.0, "Scale factor to convert PJs into ghosts that don't affect jet kinematics"}; + + /// Flag indicating to treat objects with E<0 as ghosts (useful for HI) + Gaudi::Property<bool> m_negEnergyAsGhosts{this, "TreatNegativeEnergyAsGhost", false, "Whether to convert negative energy inputs into ghosts"}; + + /// Internal steering flags + /// Set in initialize() + bool m_isGhost{false}; /// Determinines whether the PJs should be made ghosts + bool m_emtopo{false}; /// True if inputs are EM-scale topo clusters. + bool m_pflow{false}; /// True if inputs are PFlow }; diff --git a/Reconstruction/Jet/JetRec/Root/PseudoJetMerger.cxx b/Reconstruction/Jet/JetRec/src/PseudoJetMerger.cxx similarity index 62% rename from Reconstruction/Jet/JetRec/Root/PseudoJetMerger.cxx rename to Reconstruction/Jet/JetRec/src/PseudoJetMerger.cxx index c01b497128fdc5002ff6b91544a735a96d11edcb..fdf32d97889a127183db85ad7816f1ee14998adf 100644 --- a/Reconstruction/Jet/JetRec/Root/PseudoJetMerger.cxx +++ b/Reconstruction/Jet/JetRec/src/PseudoJetMerger.cxx @@ -1,16 +1,17 @@ /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "JetRec/PseudoJetMerger.h" - -PseudoJetMerger::PseudoJetMerger(const std::string& name) : AsgTool(name) { - -} +#include "PseudoJetMerger.h" StatusCode PseudoJetMerger::initialize() { ATH_MSG_DEBUG("Initializing..."); + if(m_inputPJC.empty() || m_outcoll.key().empty()) { + ATH_MSG_ERROR("Either input or output collection is empty!"); + return StatusCode::FAILURE; + } + ATH_CHECK( m_inputPJC.initialize() ); ATH_CHECK( m_outcoll.initialize() ); @@ -18,27 +19,21 @@ StatusCode PseudoJetMerger::initialize() { } -StatusCode PseudoJetMerger::createAndRecord() const { +StatusCode PseudoJetMerger::execute(const EventContext& ctx) const { auto allPseudoJets = std::make_unique<PseudoJetContainer>(); for (const auto& pjcKey : m_inputPJC) { - SG::ReadHandle<PseudoJetContainer> pjcHandle( pjcKey ); + SG::ReadHandle<PseudoJetContainer> pjcHandle( pjcKey, ctx ); if(!pjcHandle.isValid()){ ATH_MSG_ERROR("Can't retrieve PseudoJetContainer "<< pjcKey.key() ); return StatusCode::FAILURE; } allPseudoJets->append(pjcHandle.get() ); } - SG::WriteHandle<PseudoJetContainer> outHandle(m_outcoll); + SG::WriteHandle<PseudoJetContainer> outHandle(m_outcoll, ctx); ATH_CHECK( outHandle.record(std::move(allPseudoJets)) ); return StatusCode::SUCCESS; - } - -const PseudoJetVector* PseudoJetMerger::get() const { - - return nullptr; // not supposed to be used anymore (?) -} diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetMerger.h b/Reconstruction/Jet/JetRec/src/PseudoJetMerger.h similarity index 51% rename from Reconstruction/Jet/JetRec/JetRec/PseudoJetMerger.h rename to Reconstruction/Jet/JetRec/src/PseudoJetMerger.h index 8759df3bc5888615040767f487caffc7403b1a85..f77c165c7b8e95e368faea1891e51d457cf1e123 100644 --- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetMerger.h +++ b/Reconstruction/Jet/JetRec/src/PseudoJetMerger.h @@ -1,48 +1,49 @@ // this file is -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +// PseudoJetMerger.h + +/// PseudoJetMerger collects a set of PseudoJets into a group that can be +/// put together into a jet collection, combining the consituent collection +/// with a set of ghost collections. +/// +/// Alg Properties: +/// - InputPJContainers: Array of input collections to merge. +/// - OutputCollection: Name of the merged output pseudojet collection. +/// - Label: Label for the constituents. #ifndef JETREC_PSEUDOJETMERGER_H #define JETREC_PSEUDOJETMERGER_H -#include "AsgTools/AsgTool.h" +#include <memory> #include "JetRec/PseudoJetContainer.h" -#include "JetInterface/IPseudoJetGetter.h" #include "fastjet/PseudoJet.hh" #include "JetEDM/PseudoJetVector.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" class PseudoJetMerger -: public asg::AsgTool, - virtual public IPseudoJetGetter { - ASG_TOOL_CLASS(PseudoJetMerger, IPseudoJetGetter) + : public AthReentrantAlgorithm { public: typedef jet::PseudoJetVector PseudoJetVector; - /// Constructor from tool name. - PseudoJetMerger(const std::string& myname); + // No need for a specialised constructor + using AthReentrantAlgorithm::AthReentrantAlgorithm; /// Initialization. /// Can be skipped. virtual StatusCode initialize() override; - /// Method to construct the PseudoJetVector and record in StoreGate - virtual StatusCode createAndRecord() const override; - - // Kept for backward compatibity - virtual const PseudoJetVector* get() const override; - - /// Return the label for these pseudojets. - virtual std::string label() const override {return m_label;}; - + // Standard execute, forwards to createAndRecord + virtual StatusCode execute(const EventContext& ctx) const override final; -protected: // data +private: // data // Job options. diff --git a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx index fe281cd2d77b1e94bd6f1521886ef4ad5125b1f7..87ea18b902ceac02071a4eaa10fbbc5250129603 100644 --- a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx +++ b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx @@ -1,14 +1,15 @@ #include "../JetAlgorithm.h" #include "../JetRecAlg.h" #include "../JetViewAlg.h" -#include "../PseudoJetAlgorithm.h" #include "../JetTrimming.h" +#include "../PseudoJetMerger.h" +#include "../PseudoJetAlgorithm.h" +#include "../MuonSegmentPseudoJetAlgorithm.h" + #include "JetRec/JetToolRunner.h" #include "JetRec/JetRecTool.h" #include "JetRec/JetDumper.h" -#include "JetRec/PseudoJetGetter.h" -#include "JetRec/MuonSegmentPseudoJetGetter.h" #include "JetRec/JetFromPseudojet.h" #include "JetRec/JetFinder.h" #include "JetRec/JetByVertexFinder.h" @@ -17,7 +18,6 @@ #include "JetRec/JetPruner.h" #include "JetRec/JetReclusterer.h" #include "JetRec/FastJetInterfaceTool.h" -#include "JetRec/PseudoJetMerger.h" #include "JetRec/JetSorter.h" #include "JetRec/JetPseudojetRetriever.h" @@ -32,8 +32,6 @@ DECLARE_COMPONENT( JetToolRunner ) DECLARE_COMPONENT( JetRecTool ) DECLARE_COMPONENT( JetDumper ) -DECLARE_COMPONENT( PseudoJetGetter ) -DECLARE_COMPONENT( MuonSegmentPseudoJetGetter ) DECLARE_COMPONENT( JetFromPseudojet ) DECLARE_COMPONENT( JetFinder ) DECLARE_COMPONENT( JetByVertexFinder ) @@ -57,5 +55,6 @@ DECLARE_COMPONENT( JetAlgorithm ) DECLARE_COMPONENT( JetRecAlg ) DECLARE_COMPONENT( JetViewAlg ) DECLARE_COMPONENT( PseudoJetAlgorithm ) +DECLARE_COMPONENT( MuonSegmentPseudoJetAlgorithm ) DECLARE_COMPONENT( JetTrimming ) diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index b06e2c961ab3f66ac996cb4c2a16494c90883fef..6e6b4644279c1504f5886a818db622fe1c4d800f 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -65,19 +65,19 @@ def JetRecCfg(jetdef, configFlags, jetnameprefix="",jetnamesuffix="", jetnameove # will handle the details. Just merge the components. # # To facilitate running in serial mode, we also prepare - # the constituent PseudoJetGetter here (needed for rho) + # the constituent PseudoJetAlgorithm here (needed for rho) inputcomps = JetInputCfg(deps["inputs"], configFlags, sequenceName=jetsfullname) constitpjalg = inputcomps.getPrimary() - constitpjkey = constitpjalg.PJGetter.OutputContainer + constitpjkey = constitpjalg.OutputContainer components.merge(inputcomps) pjs = [constitpjkey] - # Schedule the ghost PseudoJetGetterAlgs + # Schedule the ghost PseudoJetAlgs for ghostdef in deps["ghosts"]: ghostpjalg = getGhostPJGAlg( ghostdef ) components.addEventAlgo( ghostpjalg, sequencename ) - ghostpjkey = ghostpjalg.PJGetter.OutputContainer + ghostpjkey = ghostpjalg.OutputContainer pjs.append( ghostpjkey ) # Generate a JetAlgorithm to run the jet finding and modifiers @@ -154,7 +154,7 @@ def resolveDependencies(jetdef): # Accumulate prerequisites of the ghost-associated types jetlog.info(" Full list of ghosts: ") - for ghostdef in sorted(list(ghostdefs)): + for ghostdef in sorted(list(ghostdefs), key=lambda g: g.inputtype): jetlog.info(" " + str(ghostdef)) gprereqs = getGhostPrereqs(ghostdef) prereqdict["input"].update( [req.split(':',1)[1] for req in gprereqs] ) @@ -263,14 +263,14 @@ def JetInputCfg(inputdeps, configFlags, sequenceName): jetlog.debug("Preparing Constit Mods for label {0} from {1}".format(constit.label,constit.inputname)) # May need to generate constituent modifier sequences to # produce the input collection - import ConstModHelpers + from . import ConstModHelpers constitalg = ConstModHelpers.getConstitModAlg(constit) if constitalg: components.addEventAlgo(constitalg) - # Schedule the constituent PseudoJetGetterAlg + # Schedule the constituent PseudoJetAlg constitpjalg = getConstitPJGAlg( constit ) - constitpjkey = constitpjalg.PJGetter.OutputContainer + constitpjkey = constitpjalg.OutputContainer # Mark the constit PJGAlg as the primary so that the caller # can access the output container name components.addEventAlgo( constitpjalg, primary=True ) @@ -338,7 +338,7 @@ def JetInputCfg(inputdeps, configFlags, sequenceName): return components ######################################################################## -# Functions for generating PseudoJetGetters, including determining +# Functions for generating PseudoJetAlgorithms, including determining # the prerequisites for their operation # def getConstitPrereqs(basedef): @@ -368,18 +368,15 @@ def getConstitPJGAlg(basedef): full_label = basedef.label if basedef.basetype == xAODType.Jet: full_label += "_"+basedef.inputname - getter = CompFactory.PseudoJetGetter("pjg_"+full_label, + + pjgalg = CompFactory.PseudoJetAlgorithm( + "pjgalg_"+basedef.label, InputContainer = basedef.inputname, OutputContainer = "PseudoJet"+full_label, Label = full_label, SkipNegativeEnergy=True, GhostScale=0. ) - - pjgalg = CompFactory.PseudoJetAlgorithm( - "pjgalg_"+basedef.label, - PJGetter = getter - ) return pjgalg def getGhostPJGAlg(ghostdef): @@ -391,10 +388,10 @@ def getGhostPJGAlg(ghostdef): "GhostScale": 1e-40 } - pjgclass = CompFactory.PseudoJetGetter + pjaclass = CompFactory.PseudoJetAlgorithm if ghostdef.inputtype=="MuonSegment": # Muon segments have a specialised type - pjgclass = CompFactory.MuonSegmentPseudoJetGetter + pjaclass = CompFactory.MuonSegmentPseudoJetAlgorithm kwargs = { "InputContainer":"MuonSegments", "OutputContainer":"PseudoJet"+label, @@ -411,11 +408,9 @@ def getGhostPJGAlg(ghostdef): else: raise ValueError("Unhandled ghost type {0} received!".format(ghostdef.inputtype)) - getter = pjgclass("pjg_"+label, **kwargs) - - pjgalg = CompFactory.PseudoJetAlgorithm( + pjgalg = pjaclass( "pjgalg_"+label, - PJGetter = getter + **kwargs ) return pjgalg diff --git a/Reconstruction/Jet/JetRecConfig/python/StandardJetDefs.py b/Reconstruction/Jet/JetRecConfig/python/StandardJetDefs.py index 4db5a37a93f12e50b8547684519447d802cfe6ee..a79186d6bac83c1b753cc137be7cfd2989f8155a 100644 --- a/Reconstruction/Jet/JetRecConfig/python/StandardJetDefs.py +++ b/Reconstruction/Jet/JetRecConfig/python/StandardJetDefs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ######################################################################## # # @@ -17,7 +17,7 @@ ######################################################################## # Typical jet constituents -from JetDefinition import xAODType, JetConstit +from .JetDefinition import xAODType, JetConstit from copy import deepcopy # Topoclusters with origin correction. @@ -53,7 +53,7 @@ TruthWZ = JetConstit(xAODType.TruthParticle,["NoWZ"]) # Typical jet algorithm definitions # Filter pts, ghost lists and modifier lists can be updated by the user, # though there is some risk of overwriting... -from JetDefinition import JetDefinition +from .JetDefinition import JetDefinition # Standard small-radius (0.4) AntiKt jets AntiKt4LCTopo = JetDefinition("AntiKt",0.4,LCTopoOrigin) diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/TrackExtractor.h b/Reconstruction/Jet/JetRecTools/JetRecTools/TrackExtractor.h deleted file mode 100644 index c519de26dd0daf02a70be904f60208bf5549741c..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRecTools/JetRecTools/TrackExtractor.h +++ /dev/null @@ -1,39 +0,0 @@ -// this file is -*- C++ -*- - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// TrackExtractor.h - -#ifndef TrackExtractor_H -#define TrackExtractor_H - -#include "JetRec/IConstituentExtractor.h" -#include "xAODJet/Jet.h" -#include "xAODTracking/TrackParticleContainer.h" -#include <string> - -class TrackExtractor : public IConstituentExtractor { - -public: - TrackExtractor(const xAOD::TrackParticleContainer* tps, - const std::string & label, - bool isGhost); - - virtual ~TrackExtractor(); - virtual TrackExtractor* clone() const override; - virtual TrackExtractor* ghostClone() const override; - virtual void - addToJet(xAOD::Jet&, const std::vector<int>& indices) const override; - virtual std::string toString(int level) const override; - virtual bool checkIntegrity() const override; - -private: - const xAOD::TrackParticleContainer* m_originalParticles; - std::string m_label; - bool m_isGhost; - -}; - -#endif diff --git a/Reconstruction/Jet/JetRecTools/JetRecTools/TrackPseudoJetGetter.h b/Reconstruction/Jet/JetRecTools/JetRecTools/TrackPseudoJetGetter.h deleted file mode 100644 index 17d882095157410509d0ac06864f94fb89dbef87..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRecTools/JetRecTools/TrackPseudoJetGetter.h +++ /dev/null @@ -1,53 +0,0 @@ -// emacs : this file is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef JETRECTOOLS_TRACKPSEUDOJETGETTER_H -#define JETRECTOOLS_TRACKPSEUDOJETGETTER_H -//////////////////////////////////////////// -/// \class TrackPseudoJetGetter -/// -/// Specialized PseudoJetGetter for TrackParticle -/// The only thing done here is to specialize the templated append method and -/// define a property for the TrackVertexAssociation -/// \author P-A Delsart -////////////////////////////////////////////////// - -#include "JetRec/PseudoJetGetter.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "JetRec/PseudoJetContainer.h" - -namespace jet{ - class TrackVertexAssociation; -} - -class TrackPseudoJetGetter : public PseudoJetGetter { - ASG_TOOL_CLASS(TrackPseudoJetGetter, IPseudoJetGetter) -public: - TrackPseudoJetGetter(const std::string &name); - - virtual StatusCode initialize() override; - - /// Method to construct the PseudoJetVector and record in StoreGate - virtual StatusCode createAndRecord() const override; - -protected: - /// This will identify the input tracks (and so is templated on TrackParticleContainer). - /// We do not declare it as a property to avoid duplication with the base PseudoJetGetter::m_incoll. Instead we'll copy the key from PseudoJetGetter::m_incoll during initialize() (See this function) - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_incolltrk; - - SG::ReadHandleKey<jet::TrackVertexAssociation> m_inTVA; - - -private: - - std::vector<fastjet::PseudoJet> - createPseudoJets(const xAOD::TrackParticleContainer*) const; - - const PseudoJetContainer* getC() const; - -}; - -#endif diff --git a/Reconstruction/Jet/JetRecTools/Root/TrackExtractor.cxx b/Reconstruction/Jet/JetRecTools/Root/TrackExtractor.cxx deleted file mode 100644 index 12e82f6e52246eb01650501e140a15d8fd57f078..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRecTools/Root/TrackExtractor.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// this file is -*- C++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// MuonSegmentExtractor.cxx - -#include "JetRecTools/TrackExtractor.h" -#include "JetRec/LineFormatter.h" // helper class for debug printing -#include "xAODJet/Jet.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "JetRec/setAssocObjectsSummary.h" -#include <vector> - -TrackExtractor::TrackExtractor(const xAOD::TrackParticleContainer* tps, - const std::string & label, - bool isGhost) : - m_originalParticles(tps), m_label(label), m_isGhost(isGhost){ -} - -TrackExtractor::~TrackExtractor(){} - -TrackExtractor* TrackExtractor::clone() const { - // to be deleted by caller - return new TrackExtractor(*this); -} - -TrackExtractor* TrackExtractor::ghostClone() const { - // to be deleted by caller - auto clone = new TrackExtractor(*this); - (*clone).m_isGhost = true; - return clone; -} - -void TrackExtractor::addToJet(xAOD::Jet& jet, - const std::vector<int>& indices) const{ - //Add a template specialisation for muon segments - - std::vector<const xAOD::TrackParticle*> constituents; - constituents.reserve(indices.size()); - for(auto i : indices){constituents.push_back((*m_originalParticles)[i]);} - - if(m_isGhost) { - - std::vector<const xAOD::IParticle*> constituents; - constituents.reserve(indices.size()); - for(auto i : indices){constituents.push_back((*m_originalParticles)[i]);} - - jet.setAssociatedObjects(m_label, constituents); - setAssocObjectsSummary(constituents, m_label, jet); - - } else { - // these are constituents - std::vector<const xAOD::TrackParticle*> constituents; - constituents.reserve(indices.size()); - for(auto i : indices){constituents.push_back((*m_originalParticles)[i]);} - - for(auto c: constituents) { - jet.addConstituent(c); - } - } -} - - - -bool TrackExtractor::checkIntegrity() const { - for(const auto ip: *m_originalParticles){ - try{ - ip->e(); - } catch(...) { - return false; - } - } - return true; -} - - -std::string TrackExtractor::toString(int level) const { - std::ostringstream oss{"", std::ios::ate}; - oss << "TrackExtractor dump level(" << level << ")" - << " label " << m_label - << " isGhost: " << std::boolalpha << m_isGhost - << " No of TrackParticles: " << m_originalParticles->size(); - - if (level > 0){ - oss << "\n TrackParticle energies\n"; - std::vector<float> energies; - energies.reserve(m_originalParticles->size()); - std::transform(m_originalParticles->begin(), - m_originalParticles->end(), - std::back_inserter(energies), - [](const xAOD::TrackParticle* p){return p->e();}); - - LineFormatter formatter(10); // 10 numbers/line - oss << formatter(energies); - } - - return oss.str(); -} - diff --git a/Reconstruction/Jet/JetRecTools/Root/TrackPseudoJetGetter.cxx b/Reconstruction/Jet/JetRecTools/Root/TrackPseudoJetGetter.cxx deleted file mode 100644 index eeac82f42f84367cc92e1cf77e6cbe3954c39905..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetRecTools/Root/TrackPseudoJetGetter.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "JetRecTools/TrackPseudoJetGetter.h" -#include "JetEDM/VertexIndexedConstituentUserInfo.h" - -#include "JetEDM/TrackVertexAssociation.h" - -#include "JetRec/PseudoJetContainer.h" -#include "JetRecTools/TrackExtractor.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "fastjet/PseudoJet.hh" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" - - -using fastjet::PseudoJet; - - -TrackPseudoJetGetter::TrackPseudoJetGetter(const std::string &name) - : PseudoJetGetter(name) , m_inTVA("JetTrackVtxAssoc") { - declareProperty("TrackVertexAssociation", m_inTVA, "SG key for the TrackVertexAssociation object"); -} - -//********************************************************************** -StatusCode TrackPseudoJetGetter::initialize() { - ATH_MSG_DEBUG("Initializing..."); - - ATH_CHECK( PseudoJetGetter::initialize() ); - ATH_CHECK( m_inTVA.initialize() ); - m_incolltrk = m_incoll.key(); - ATH_CHECK( m_incolltrk.initialize() ); - print(); - - return StatusCode::SUCCESS; -} - -//********************************************************************** - -StatusCode TrackPseudoJetGetter::createAndRecord() const { - // Use const pointer for now, but can change to unique pointer when - // we move to DataVector and when MR 2431 is complete: - // https://gitlab.cern.ch/atlas/athena/merge_requests/2431 - const PseudoJetContainer* pjc = this->getC(); - if (!pjc) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} - -//********************************************************************** -const PseudoJetContainer* TrackPseudoJetGetter::getC() const { - - ATH_MSG_DEBUG("Getting PseudoJetContainer in TrackPseudoJetGetter ..."); - - // build and record the container - const xAOD::TrackParticleContainer* cont; - auto handle_in = SG::makeHandle(m_incolltrk); - if ( handle_in.isValid() ) { - ATH_MSG_DEBUG("Retrieving xAOD container " << m_incolltrk.key() << ", ghost scale=" << m_ghostscale << ", isGhost=" << bool(m_ghostscale)); - // retrieve the input. - cont = handle_in.cptr(); - } else { - ATH_MSG_ERROR("Unable to find input collection: " << m_incolltrk.key()); - ATH_MSG_ERROR("Error creating pseudojets."); - return nullptr; - } - - SG::ReadHandle<jet::TrackVertexAssociation> h_tva(m_inTVA); - - std::vector<PseudoJet> vpj = createPseudoJets(cont); - - // "Ghost" in outout collection name? If so is a ghost collection. - bool isGhost = (m_outcoll.key()).find("Ghost") != std::string::npos; - - // create an extractor - TrackExtractor* extractor = new TrackExtractor(cont, m_label, isGhost); - - // ghostify the pseudojets if necessary - if(isGhost){ - for(PseudoJet& pj : vpj) {pj *= 1e-40;} - } - - // record - // to satisfy legacy code, need to return a bare pointer as well - // as write to storegate. so no calls to make_unique... - - SG::WriteHandle<PseudoJetContainer> handle_out(m_outcoll); - PseudoJetContainer* pjcont = new PseudoJetContainer(extractor, vpj); - - if(!handle_out.record(std::unique_ptr<PseudoJetContainer>(pjcont))){ - ATH_MSG_DEBUG("Error storing PseudoJetContainer in event " - << " at key " << m_outcoll.key()); - } else { - //ATH_MSG_DEBUG("PseudoJetContainer in event store with extractor: " - // << extractor->toString(0) - // << " at key " << m_outcoll.key()); - } - - return pjcont; - -} - -std::vector<PseudoJet> -TrackPseudoJetGetter::createPseudoJets(const xAOD::TrackParticleContainer* ips) const { - - std::vector<PseudoJet> vpj; - // create PseudoJets - int index=-1; - for(const xAOD::TrackParticle* part: *ips) { - index++; - - if ( part == 0 || (m_skipNegativeEnergy && part->e() <= 0.0) ) { - if ( part == 0 ) ATH_MSG_DEBUG("NUll object!"); - else ATH_MSG_VERBOSE("Skipping cluster with E = " << part->e()); - //++nskip; - continue; - } - - // Take momentum from TrackParticle. - fastjet::PseudoJet psj(part->p4()); - - // const xAOD::Vertex* vtx = h_tva->associatedVertex(part); - //jet::IConstituentUserInfo* pcui = this->buildCUI(trk, vtx, labidx, pli); - //psj.set_user_info(pcui); - - vpj.push_back( psj ); - vpj.back().set_user_index(index); // Set the index !! - } - - return vpj; -} - - diff --git a/Reconstruction/Jet/JetRecTools/src/components/JetRecTools_entries.cxx b/Reconstruction/Jet/JetRecTools/src/components/JetRecTools_entries.cxx index 25344aa54d8a03f55331388e5ebcd43c3f807ba5..8aabec619b260e0358a9bb68f08660464f98becf 100644 --- a/Reconstruction/Jet/JetRecTools/src/components/JetRecTools_entries.cxx +++ b/Reconstruction/Jet/JetRecTools/src/components/JetRecTools_entries.cxx @@ -2,8 +2,6 @@ #include "JetRecTools/JetTrackSelectionTool2.h" #include "JetRecTools/SimpleJetTrackSelectionTool.h" #include "JetRecTools/TrackVertexAssociationTool.h" -#include "JetRecTools/TrackPseudoJetGetter.h" -// #include "JetRecTools/PFlowPseudoJetGetter.h" #include "JetRecTools/JetConstituentModSequence.h" #include "JetRecTools/JetConstituentModifierBase.h" #include "JetRecTools/CaloClusterConstituentsOrigin.h" @@ -21,8 +19,6 @@ DECLARE_COMPONENT( JetTrackSelectionTool ) DECLARE_COMPONENT( JetTrackSelectionTool2 ) DECLARE_COMPONENT( SimpleJetTrackSelectionTool ) DECLARE_COMPONENT( TrackVertexAssociationTool ) -DECLARE_COMPONENT( TrackPseudoJetGetter ) -// DECLARE_COMPONENT( PFlowPseudoJetGetter ) DECLARE_COMPONENT( JetConstituentModSequence ) DECLARE_COMPONENT( JetConstituentModifierBase ) DECLARE_COMPONENT( CaloClusterConstituentsOrigin ) diff --git a/Reconstruction/Jet/JetSimTools/JetSimTools/TruthParticleExtractor.h b/Reconstruction/Jet/JetSimTools/JetSimTools/TruthParticleExtractor.h deleted file mode 100644 index 90613f611975b6b7386d219061657a0d4be5ed62..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetSimTools/JetSimTools/TruthParticleExtractor.h +++ /dev/null @@ -1,39 +0,0 @@ -// this file is -*- C++ -*- -// TruthParticleExtractor.h - - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TruthParticleExtractor_H -#define TruthParticleExtractor_H - -#include "JetRec/IConstituentExtractor.h" -#include "xAODJet/Jet.h" -#include "xAODTruth/TruthParticleContainer.h" -#include <string> - -class TruthParticleExtractor : public IConstituentExtractor { - -public: - TruthParticleExtractor(const xAOD::TruthParticleContainer* tps, - const std::string & label, - bool isGhost); - - virtual ~TruthParticleExtractor(); - virtual TruthParticleExtractor* clone() const override; - virtual TruthParticleExtractor* ghostClone() const override; - virtual void - addToJet(xAOD::Jet&, const std::vector<int>& indices) const override; - virtual std::string toString(int) const override; - virtual bool checkIntegrity() const override; - -private: - const xAOD::TruthParticleContainer* m_originalParticles; - std::string m_label; - bool m_isGhost; - -}; - -#endif diff --git a/Reconstruction/Jet/JetSimTools/JetSimTools/TruthPseudoJetGetter.h b/Reconstruction/Jet/JetSimTools/JetSimTools/TruthPseudoJetGetter.h deleted file mode 100644 index ae728fa9e80542429e0da4332cd0d125667e795d..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetSimTools/JetSimTools/TruthPseudoJetGetter.h +++ /dev/null @@ -1,43 +0,0 @@ -// emacs this file is -*- c++ -*- -// this file is -*- C++ -*- - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef JETSIMTOOLS_TRUTHPSEUDOJETGETTER_H -#define JETSIMTOOLS_TRUTHPSEUDOJETGETTER_H - -#include "GaudiKernel/ToolHandle.h" -#include "JetRec/PseudoJetGetter.h" -#include "JetSimTools/JetTruthParticleSelectorTool.h" -#include "xAODTruth/TruthParticleContainer.h" - -class TruthPseudoJetGetter : public PseudoJetGetter { - ASG_TOOL_CLASS(TruthPseudoJetGetter, IPseudoJetGetter) -public: - TruthPseudoJetGetter(const std::string &name); - - - virtual StatusCode initialize() override; - - /// Method to construct the PseudoJetVector and record in StoreGate - virtual StatusCode createAndRecord() const override; - - // Kept for backward compatibity - virtual const PseudoJetVector* get() const override; - - -protected: - - /// Input collection name. - SG::ReadHandleKey<xAOD::TruthParticleContainer> m_incolltruth; - - ToolHandle<JetTruthParticleSelectorTool> m_selector; - -private: - const PseudoJetContainer* getC() const; - -}; - -#endif diff --git a/Reconstruction/Jet/JetSimTools/Root/TruthParticleExtractor.cxx b/Reconstruction/Jet/JetSimTools/Root/TruthParticleExtractor.cxx deleted file mode 100644 index 6046c05e1febf15b128c2fa98a2304c731c16777..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetSimTools/Root/TruthParticleExtractor.cxx +++ /dev/null @@ -1,92 +0,0 @@ - -// this file is -*- C++ -*- - - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// TruthParticleExtractor.cxx - -#include "JetSimTools/TruthParticleExtractor.h" -#include "JetRec/LineFormatter.h" // helper class for debug printing -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODTruth/TruthParticle.h" -#include "JetRec/setAssocObjectsSummary.h" -#include <vector> -#include <string> - -TruthParticleExtractor::TruthParticleExtractor(const xAOD::TruthParticleContainer* tps, - const std::string & label, - bool isGhost) : - m_originalParticles(tps), m_label(label), m_isGhost(isGhost){ -} - -TruthParticleExtractor::~TruthParticleExtractor(){} - -TruthParticleExtractor* TruthParticleExtractor::clone() const { - return new TruthParticleExtractor(*this); -} - -TruthParticleExtractor* TruthParticleExtractor::ghostClone() const { - // caller to delete - auto clone = new TruthParticleExtractor(*this); - (*clone).m_isGhost = true; - return clone; -} - -void TruthParticleExtractor::addToJet(xAOD::Jet& jet, - const std::vector<int>& indices) const{ - //Add a template specialisation for muon segments - - std::vector<const xAOD::IParticle*> constituents; - constituents.reserve(indices.size()); - for(auto i : indices){constituents.push_back((*m_originalParticles)[i]);} - - if(m_isGhost) { - jet.setAssociatedObjects(m_label, constituents); - setAssocObjectsSummary(constituents, m_label, jet); - } else { - // these are constituents - for(auto c: constituents) { - jet.addConstituent(c); - } - } -} - - -std::string TruthParticleExtractor::toString(int level) const { - std::ostringstream oss{"", std::ios::ate}; - oss << "TruthParticleExtractor dump level (" << level << ")" - - << " label " << m_label - << " isGhost: " << std::boolalpha << m_isGhost - << " No of TruthParticles: " << m_originalParticles->size(); - - if (level > 0){ - oss << "\n TruthParticle energies\n"; - std::vector<float> energies; - energies.reserve(m_originalParticles->size()); - std::transform(m_originalParticles->begin(), - m_originalParticles->end(), - std::back_inserter(energies), - [](const xAOD::TruthParticle* p){return p->e();}); - - LineFormatter formatter(10); // 10 numbers/line - oss << formatter(energies); - } - - return oss.str(); -} - - -bool TruthParticleExtractor::checkIntegrity() const { - for(const auto tp: *m_originalParticles){ - try{ - tp->e(); - } catch(...) { - return false; - } - } - return true; -} diff --git a/Reconstruction/Jet/JetSimTools/Root/TruthPseudoJetGetter.cxx b/Reconstruction/Jet/JetSimTools/Root/TruthPseudoJetGetter.cxx deleted file mode 100644 index 24a1fd7404334c63f8852cc304394c3f1fe87df9..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetSimTools/Root/TruthPseudoJetGetter.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// TruthPseudoJetGetter.cxx - -#include "JetSimTools/TruthPseudoJetGetter.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "JetRec/PseudoJetContainer.h" -#include "JetSimTools/TruthParticleExtractor.h" - - -using fastjet::PseudoJet; - - -//********************************************************************** - -TruthPseudoJetGetter::TruthPseudoJetGetter(const std::string &name) -: PseudoJetGetter(name), - m_selector("JetTruthParticleSelectorTool") { - declareProperty("TruthSelector", m_selector); - declareProperty("InputContainer", m_incolltruth); - declareProperty("OutputContainer", m_outcoll); -} - -//********************************************************************** - -StatusCode TruthPseudoJetGetter::initialize() { - - StatusCode sc= m_selector.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR( "Unable to retrieve TruthSelector."); - return sc; - } - m_incolltruth = m_incoll.key(); - ATH_CHECK( m_incolltruth.initialize() ); - ATH_CHECK( m_outcoll.initialize() ); - - return StatusCode::SUCCESS; - -} - -//********************************************************************** - -const PseudoJetContainer* TruthPseudoJetGetter::getC() const { - ATH_MSG_DEBUG("Getting TruthPseudoJetContainer..."); - std::vector<PseudoJet> vpj; - const PseudoJetContainer * pjcont; - - // build and record the container - // retrieve the input. - const xAOD::TruthParticleContainer* cont; - auto handle_in = SG::makeHandle(m_incolltruth); - if ( handle_in.isValid() ) { - ATH_MSG_DEBUG("Retrieving xAOD container " << m_incolltruth.key()); - // retrieve the input. - cont = handle_in.cptr(); - } else { - ATH_MSG_ERROR("Unable to find input collection: " << m_incolltruth.key()); - ATH_MSG_ERROR("Error creating pseudojets."); - return nullptr; - } - - // create PseudoJets - int index=0; - for(const xAOD::TruthParticle* part: *cont) { - vpj.push_back( PseudoJet(part->p4())); - vpj.back().set_user_index(index); // Set the index !! - index++; - } - - - // "Ghost" in outout collection name? If so is a ghost collection. - bool isGhost = (m_outcoll.key()).find("Ghost") != std::string::npos; - - // create an extractor - TruthParticleExtractor* extractor = new TruthParticleExtractor(cont, - m_label, - isGhost); - - // ghostify the pseudojets if necessary - if(isGhost){ - for(PseudoJet& pj : vpj) {pj *= 1e-40;} - } - - // Put the PseudoJetContainer together : - pjcont = new PseudoJetContainer(extractor, vpj); - std::unique_ptr<const PseudoJetContainer> pjcont_ptr(pjcont); - - // record - SG::WriteHandle<PseudoJetContainer> handle_out(m_outcoll); - ATH_MSG_DEBUG("New PseudoJetContainer in event store with extractor: " - << extractor->toString(0)); - if ( ! handle_out.put(std::move(pjcont_ptr))) { - ATH_MSG_ERROR("Unable to write new PseudoJetContainer to event store collection: " << m_outcoll.key()); - } else { - ATH_MSG_DEBUG("Created new PseudoJetContainer in event store collection: " << m_outcoll.key()); - } - - return pjcont; - -} - - -StatusCode TruthPseudoJetGetter::createAndRecord() const { - // Use const pointer for now, but can change to unique pointer when - // we move to DataVector and when MR 2431 is complete: - // https://gitlab.cern.ch/atlas/athena/merge_requests/2431 - - // should rename getC createAndRecord once get() is removed. - const PseudoJetContainer* pjc = this->getC(); - if (!pjc) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} - - -const PseudoJetVector* TruthPseudoJetGetter::get() const { - // Kept for backward compatibity - ATH_MSG_DEBUG("Getting TruthPseudoJetContainer as PseudoJetVector ..."); - const PseudoJetContainer* cont = this->getC(); - const PseudoJetVector* vpj = cont->casVectorPseudoJet(); - return vpj; -} diff --git a/Reconstruction/Jet/JetSimTools/python/TruthPseudoJetGetterConfig.py b/Reconstruction/Jet/JetSimTools/python/TruthPseudoJetGetterConfig.py deleted file mode 100644 index 8f375b61bc9e25bfc9eabd49aaacf7681678c26d..0000000000000000000000000000000000000000 --- a/Reconstruction/Jet/JetSimTools/python/TruthPseudoJetGetterConfig.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from JetSimTools.JetSimToolsConf import TruthPseudoJetGetter, JetTruthParticleSelectorTool - -def getJetTruthParticleSelectorTool(selectionMode="StableNoMuonNoNu" , **options): - toolName = "JetTruthSelector"+selectionMode - selecTool = JetTruthParticleSelectorTool(toolName, - SelectionMode = selectionMode, - ) - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += selecTool - return selecTool - -from AthenaCommon.AppMgr import ToolSvc - -ToolSvc += JetTruthParticleSelectorTool("JetTruthSelectorStableNoMuonNoNu", - SelectionMode = "StableNoMuonNoNu" - ) - - -## def getTruthPseudoJetGetter(input, asGhost, **options): - -## inCont = "TruthParticle" - -## prefix = "Ghost" if asGhost else "" - -## outCont = prefix+"PseudoJet_"+inCont - - -## tool = TruthPseudoJetGetter( "PJGetter"+prefix+inCont, -## InputContainer = inCont, -## OutputContainer = outCont, -## TruthSelector = getJetTruthParticleSelectorTool(**options), -## SkipNegativeEnergy = True) - -## from AthenaCommon.AppMgr import ToolSvc -## ToolSvc += tool -## return tool diff --git a/Reconstruction/Jet/JetSimTools/src/components/JetSimTools_entries.cxx b/Reconstruction/Jet/JetSimTools/src/components/JetSimTools_entries.cxx index 39ef3db22945110569edfd7221708d3b38cf7dfa..ba8cd69467df9f9d4c1d827106490e7aa5afcdbd 100644 --- a/Reconstruction/Jet/JetSimTools/src/components/JetSimTools_entries.cxx +++ b/Reconstruction/Jet/JetSimTools/src/components/JetSimTools_entries.cxx @@ -1,8 +1,6 @@ #include "JetSimTools/JetTruthParticleSelectorTool.h" -#include "JetSimTools/TruthPseudoJetGetter.h" DECLARE_COMPONENT( JetTruthParticleSelectorTool ) -DECLARE_COMPONENT( TruthPseudoJetGetter ) diff --git a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h index a0b336d266f886d1b25cb815ac2ba2764364b68d..08eb6b14a985dcf608556b9ea7193765b9ee9afb 100644 --- a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h +++ b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h @@ -51,7 +51,7 @@ class MissingEtTruth : public MissingET virtual ~MissingEtTruth(); // add a cell - void addPart(const HepMC::GenParticle* aPart, double etaFull); + void addPart(const HepMC::GenParticlePtr aPart, double etaFull); // set Truth contributions void setExTruth(TruthIndex aTruth, double theEx); diff --git a/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx b/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx index 47996aff23040505705b9a0c7f1f2b318140b6de..a23dbc286618604486baf00404d89bee36c0bf98 100644 --- a/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx +++ b/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx @@ -48,7 +48,7 @@ MissingEtTruth::~MissingEtTruth() this->setup(); } -void MissingEtTruth::addPart(const HepMC::GenParticle* Part, double etaFull) +void MissingEtTruth::addPart(const HepMC::GenParticlePtr Part, double etaFull) { double weight = 1.; diff --git a/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h b/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h index 5385981b6dfe9dd083eb89be7103128944864c3e..456fdb1154b8ff3b2d90d88674f3e75e999cca3f 100755 --- a/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h +++ b/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef METMonTool_H @@ -17,6 +17,10 @@ #include "JetInterface/IJetSelector.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" #include <string> #include <vector> @@ -70,15 +74,18 @@ class METMonTool : public ManagedMonitorToolBase ToolHandle<GenericMonitoringTool> m_genTool{ this, "GenTool", "", "Generic monitoring tool" }; - Gaudi::Property<std::string> m_suffix{ this, "NameSuffix", "", "" }; + StringProperty m_suffix{ this, "NameSuffix", "", "" }; // TB this needs to be converted into the ReadHandles, for now doing c++11 move - std::vector<std::string> m_metKeys; - std::string m_metFinKey = "MET_RefFinal"; - std::string m_metCalKey = "MET_LocHadTopo"; - std::string m_metRegKey = ""; - std::string m_jetColKey = "AntiKt4LCTopoJets"; - std::string m_eleColKey = "Electrons"; - std::string m_muoColKey = "Muons"; + StringArrayProperty m_metKeys {this, "metKeys", {"MET_Base", "MET_Topo", "MET_Track"}}; + SG::ReadHandleKeyArray<xAOD::MissingETContainer> m_metKeysFull {this, "metKeysFull", {}, "Don't set this manually, please"}; + SG::ReadHandleKey<xAOD::MissingETContainer> m_metForCut {this, "metForCut", "MET_Reference_AntiKt4LCTopo", "MET object for cuts"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {this, "eventInfoKey", "EventInfo"}; + StringProperty m_metFinKey {this, "metFinKey", "MET_RefFinal"}; + StringProperty m_metCalKey {this, "metCalKey", "MET_Calo"}; + StringProperty m_metRegKey {this, "metRegKey", "", "Set to MET_TruthRegions if desired"}; + SG::ReadHandleKey<xAOD::JetContainer> m_jetColKey {this, "jetColKey", "AntiKt4LCTopoJets"}; + SG::ReadHandleKey<xAOD::ElectronContainer> m_eleColKey {this, "eleColKey", "Electrons"}; + SG::ReadHandleKey<xAOD::MuonContainer> m_muoColKey {this, "muoColKey", "Muons"}; diff --git a/Reconstruction/MissingETMonitoring/src/METMonTool.cxx b/Reconstruction/MissingETMonitoring/src/METMonTool.cxx index 3544071a592c09d616c44d1c6c0dfdb0325671e5..2b2cc4893241d3fc3e8fc60b7ae303fbc10d94c5 100755 --- a/Reconstruction/MissingETMonitoring/src/METMonTool.cxx +++ b/Reconstruction/MissingETMonitoring/src/METMonTool.cxx @@ -18,16 +18,12 @@ #include "xAODEventInfo/EventInfo.h" #include "xAODMissingET/MissingET.h" -#include "xAODMissingET/MissingETContainer.h" #include "xAODMissingET/MissingETComposition.h" #include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" #include "xAODEgamma/Electron.h" -#include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -77,23 +73,63 @@ static const std::map<std::string, std::pair<std::string, std::string> > key2Sub METMonTool::METMonTool(const std::string& type, const std::string& name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) -{ - // declare properties, this will disappear once moved data handles - // fill vector with Missing Et Sources - - declareProperty("metKeys", m_metKeys={"MET_Base", "MET_Topo", "MET_Track"}); - declareProperty("metFinKey", m_metFinKey); - declareProperty("metCalKey", m_metCalKey); - declareProperty("metRegKey", m_metRegKey); - declareProperty("jetColKey", m_jetColKey); - declareProperty("eleColKey", m_eleColKey); - declareProperty("muoColKey", m_muoColKey); -} +{} StatusCode METMonTool::initialize() { - + // If m_metFinKey is not empty then append it to m_metKeys + if (m_metFinKey != "") + { + std::vector<std::string>::iterator it = m_metKeys.begin(); + // Remove m_metFinKey from m_metKeys if it already exists + for (; it != m_metKeys.end();) + { + if ((*it) == m_metFinKey) it = m_metKeys.erase(it); + else it++; + } + m_metKeys.value().push_back(m_metFinKey); + } + + m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); + + // ...and debug + + ATH_MSG_DEBUG("Using the following keys:"); + ATH_MSG_DEBUG("metCalKey = " << m_metCalKey); + ATH_MSG_DEBUG("metRegKey = " << m_metRegKey); + ATH_MSG_DEBUG("metKeys = "); + std::vector<std::string>::iterator it = m_metKeys.begin(); + for (; it != m_metKeys.end(); it++) + { + ATH_MSG_DEBUG((*it)); + } + ATH_MSG_DEBUG(""); + + // what are the actual storegate keys? + std::unordered_set<std::string> realSGKeys; + for (const auto& k : m_metKeys) { + const auto itr = key2SubSkeyMap.find(k); + if (itr != key2SubSkeyMap.end()) { + realSGKeys.insert(itr->second.first); + } + } + for (const auto& k : std::vector<std::string>{ m_metCalKey, m_metRegKey }) { + const auto itr = key2SubSkeyMap.find(k); + if (itr != key2SubSkeyMap.end()) { + realSGKeys.insert(itr->second.first); + } + } + for (const auto& k : realSGKeys) { + m_metKeysFull.push_back(k); + } + + ATH_CHECK(m_metKeysFull.initialize()); + ATH_CHECK(m_metForCut.initialize()); + ATH_CHECK(m_eventInfoKey.initialize()); + ATH_CHECK(m_jetColKey.initialize(!m_jetColKey.empty())); + ATH_CHECK(m_eleColKey.initialize(!m_eleColKey.empty())); + ATH_CHECK(m_muoColKey.initialize(!m_muoColKey.empty())); //resize vector with number of WARNINGs already displayed for retrieval of a certain container m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); @@ -125,34 +161,6 @@ StatusCode METMonTool::bookHistograms() { ATH_MSG_DEBUG("in bookHistograms()"); - // If m_metFinKey is not empty then append it to m_metKeys - if (m_metFinKey != "") - { - std::vector<std::string>::iterator it = m_metKeys.begin(); - // Remove m_metFinKey from m_metKeys if it already exists - for (; it != m_metKeys.end();) - { - if ((*it) == m_metFinKey) it = m_metKeys.erase(it); - else it++; - } - m_metKeys.push_back(m_metFinKey); - } - - m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); - - // ...and debug - - ATH_MSG_DEBUG("Using the following keys:"); - ATH_MSG_DEBUG("metCalKey = " << m_metCalKey); - ATH_MSG_DEBUG("metRegKey = " << m_metRegKey); - ATH_MSG_DEBUG("metKeys = "); - std::vector<std::string>::iterator it = m_metKeys.begin(); - for (; it != m_metKeys.end(); it++) - { - ATH_MSG_DEBUG((*it)); - } - ATH_MSG_DEBUG(""); - // Check consistency between m_etrangeCalFactors and m_calIndices if (m_etrangeCalFactors.size() < m_calIndices) @@ -204,9 +212,9 @@ StatusCode METMonTool::bookHistograms() if (m_metFinKey != "" && i == nSources - 1) { bookSourcesHistograms(m_metKeys[i], met_summary, true).ignore(); - if (m_jetColKey != "") bookProfileHistograms(m_metKeys[i], "Jet", met_jets, &m_iJet).ignore(); - if (m_eleColKey != "") bookProfileHistograms(m_metKeys[i], "Ele", met_electrons, &m_iEle).ignore(); - if (m_muoColKey != "") bookProfileHistograms(m_metKeys[i], "Muo", met_muons, &m_iMuo).ignore(); + if (!m_jetColKey.empty()) bookProfileHistograms(m_metKeys[i], "Jet", met_jets, &m_iJet).ignore(); + if (!m_eleColKey.empty()) bookProfileHistograms(m_metKeys[i], "Ele", met_electrons, &m_iEle).ignore(); + if (!m_muoColKey.empty()) bookProfileHistograms(m_metKeys[i], "Muo", met_muons, &m_iMuo).ignore(); } else bookSourcesHistograms(m_metKeys[i], met_sources, false).ignore(); } @@ -777,10 +785,8 @@ StatusCode METMonTool::fillHistograms() { ATH_MSG_DEBUG("in fillHistograms()"); - const xAOD::EventInfo* thisEventInfo = 0; - StatusCode sc(evtStore()->retrieve(thisEventInfo)); - - if (sc != StatusCode::SUCCESS) + SG::ReadHandle<xAOD::EventInfo> thisEventInfo{m_eventInfoKey}; + if (!thisEventInfo.isValid()) ATH_MSG_DEBUG("No EventInfo object found! Can't access LAr event info status!"); else { @@ -807,12 +813,13 @@ StatusCode METMonTool::fillSourcesHistograms() ATH_MSG_DEBUG("in fillSourcesHistograms()"); const xAOD::JetContainer* xJetCollection = 0; - if (m_jetColKey != "") + if (!m_jetColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xJetCollection, "AntiKt4LCTopoJets")); + SG::ReadHandle<xAOD::JetContainer> xhJetCollection{m_jetColKey}; + xJetCollection = xhJetCollection.get(); if (!xJetCollection) { - ATH_MSG_WARNING("Unable to retrieve JetContainer: " << "AntiKt4LCTopoJets"); + ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key()); } else { @@ -856,12 +863,13 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::ElectronContainer* xElectrons = 0; const xAOD::Electron* xhEle = 0; - if (m_eleColKey != "") + if (!m_eleColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xElectrons, "Electrons")); + SG::ReadHandle<xAOD::ElectronContainer> rhElectrons{m_eleColKey}; + xElectrons = rhElectrons.get(); if (!xElectrons) { - ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << "Electrons"); + ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << m_eleColKey.key()); } else { @@ -879,12 +887,13 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::MuonContainer* xMuons = 0; const xAOD::Muon* xhMuon = 0; - if (m_muoColKey != "") + if (!m_muoColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xMuons, "Muons")); + SG::ReadHandle<xAOD::MuonContainer> rhMuons{m_muoColKey}; + xMuons = rhMuons.get(); if (!xMuons) { - ATH_MSG_WARNING("Unable to retrieve muon collection: " << "Muons"); + ATH_MSG_WARNING("Unable to retrieve muon collection: " << m_muoColKey.key()); m_ContainerWarnings_Muon++; } else @@ -907,9 +916,8 @@ StatusCode METMonTool::fillSourcesHistograms() bool doSummary = (m_metKeys.size() > 1); if (m_met_cut_80) { - if (evtStore()->contains<xAOD::MissingETContainer>("MET_Reference_AntiKt4LCTopo")) { - const xAOD::MissingETContainer* xMissEt_forCut = 0; - ATH_CHECK(evtStore()->retrieve(xMissEt_forCut, "MET_Reference_AntiKt4LCTopo")); + SG::ReadHandle<xAOD::MissingETContainer> xMissEt_forCut{m_metForCut}; + if (xMissEt_forCut.isValid()) { float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV; if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS; } @@ -942,11 +950,10 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::MissingETContainer* xMissEt = 0; - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>(xaod_key); + SG::ReadHandle<xAOD::MissingETContainer> xhMissEt{xaod_key}; - if (sc_exists) - { - ATH_CHECK(evtStore()->retrieve(xMissEt, xaod_key)); + if (xhMissEt.isValid()) { + xMissEt = xhMissEt.get(); if (!xMissEt) @@ -1033,23 +1040,19 @@ StatusCode METMonTool::fillCalosHistograms() bool doSummary = (m_calIndices > 1); const xAOD::MissingETContainer* xmetCal = 0; - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>("MET_Calo"); - if ( not sc_exists ) { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_Calo"); + SG::ReadHandle<xAOD::MissingETContainer> xhmetCal{m_metCalKey}; + if (! xhmetCal.isValid()) { + ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metCalKey); return StatusCode::SUCCESS; } - ATH_CHECK(evtStore()->retrieve(xmetCal, "MET_Calo")); + xmetCal = xhmetCal.get(); - ATH_MSG_DEBUG("Filling histograms per calorimeter subsystem with key " << m_metCalKey); - if (m_met_cut_80) { - if (evtStore()->contains<xAOD::MissingETContainer>("MET_Reference_AntiKt4LCTopo")) { - const xAOD::MissingETContainer* xMissEt_forCut = 0; - ATH_CHECK(evtStore()->retrieve(xMissEt_forCut, "MET_Reference_AntiKt4LCTopo")); + SG::ReadHandle<xAOD::MissingETContainer> xMissEt_forCut{m_metForCut}; + if (xMissEt_forCut.isValid()) { float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV; - if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS; } } @@ -1057,9 +1060,10 @@ StatusCode METMonTool::fillCalosHistograms() if (m_doJetcleaning && !m_badJets) { const xAOD::JetContainer* xJetCollection = 0; - ATH_CHECK(evtStore()->retrieve(xJetCollection, "AntiKt4LCTopoJets")); + SG::ReadHandle<xAOD::JetContainer> xhJetCollection{m_jetColKey}; + xJetCollection = xhJetCollection.get(); if ( xJetCollection == 0 ) { - ATH_MSG_WARNING("Unable to retrieve JetContainer: " << "AntiKt4LCTopoJets"); + ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key()); //return StatusCode::FAILURE; } else { @@ -1109,59 +1113,40 @@ StatusCode METMonTool::fillRegionsHistograms() bool doSummary = (m_regIndices > 1); - const xAOD::MissingETContainer* xmetReg = 0; - - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>("MET_TruthRegions"); - - if (sc_exists) - { - - ATH_CHECK(evtStore()->retrieve(xmetReg, "MET_TruthRegions")); - - if (!xmetReg) - { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_TruthRegions"); - } - else - { + SG::ReadHandle<xAOD::MissingETContainer> xmetReg{m_metRegKey}; + if (xmetReg.isValid()) { //s// ATH_MSG_DEBUG("Filling histograms per calorimeter region with key " << m_metRegKey); //s// metReg = missET->getRegions(); - for (unsigned int i = 0; i < m_regIndices; i++) - { - std::string xaod_truth_region = ""; - if (i == 0) xaod_truth_region = "Int_Central"; - else if (i == 1) xaod_truth_region = "Int_EndCap"; - else if (i == 2) xaod_truth_region = "Int_Forward"; - else xaod_truth_region = "Int_Central"; - - float ex = (*xmetReg)[xaod_truth_region]->mpx() / CLHEP::GeV; - float ey = (*xmetReg)[xaod_truth_region]->mpy() / CLHEP::GeV; - float et = sqrt(ex*ex + ey*ey); - float phi = atan2(ey, ex); - float sumet = (*xmetReg)[xaod_truth_region]->sumet() / CLHEP::GeV; - - if (et > 0.) - { - m_etReg[i]->Fill(et); - m_exReg[i]->Fill(ex); - m_eyReg[i]->Fill(ey); - m_phiReg[i]->Fill(phi); - m_sumetReg[i]->Fill(sumet); - // Mean summaries - if (doSummary) - { - m_exRegMean->Fill(i + 0.5, ex); - m_eyRegMean->Fill(i + 0.5, ey); - m_phiRegMean->Fill(i + 0.5, phi); - } - } - } + for (unsigned int i = 0; i < m_regIndices; i++) { + std::string xaod_truth_region = ""; + if (i == 0) xaod_truth_region = "Int_Central"; + else if (i == 1) xaod_truth_region = "Int_EndCap"; + else if (i == 2) xaod_truth_region = "Int_Forward"; + else xaod_truth_region = "Int_Central"; + + float ex = (*xmetReg)[xaod_truth_region]->mpx() / CLHEP::GeV; + float ey = (*xmetReg)[xaod_truth_region]->mpy() / CLHEP::GeV; + float et = sqrt(ex*ex + ey*ey); + float phi = atan2(ey, ex); + float sumet = (*xmetReg)[xaod_truth_region]->sumet() / CLHEP::GeV; + + if (et > 0.) { + m_etReg[i]->Fill(et); + m_exReg[i]->Fill(ex); + m_eyReg[i]->Fill(ey); + m_phiReg[i]->Fill(phi); + m_sumetReg[i]->Fill(sumet); + // Mean summaries + if (doSummary) { + m_exRegMean->Fill(i + 0.5, ex); + m_eyRegMean->Fill(i + 0.5, ey); + m_phiRegMean->Fill(i + 0.5, phi); } + } } - else - { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_TruthRegions"); - } + } else { + ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metRegKey); + } return StatusCode::SUCCESS; } diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/CMakeLists.txt b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/CMakeLists.txt index dee1b7f86d35c1af01f381d4f23b6dd169d9501e..5600adf499b0b784f82a17f627273126f8e86789 100644 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/CMakeLists.txt @@ -9,7 +9,6 @@ atlas_subdir( MuidCaloScatteringTools ) atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps GaudiKernel - MagneticField/MagFieldInterfaces Reconstruction/MuonIdentification/MuidInterfaces Tracking/TrkDetDescr/TrkDetDescrInterfaces Tracking/TrkDetDescr/TrkSurfaces @@ -22,7 +21,10 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkGeometry Tracking/TrkEvent/TrkMaterialOnTrack Tracking/TrkEvent/TrkTrack - Tracking/TrkExtrapolation/TrkExUtils ) + Tracking/TrkExtrapolation/TrkExUtils + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( Eigen ) @@ -34,7 +36,7 @@ atlas_add_component( MuidCaloScatteringTools src/MuidMaterialEffectsOnTrackProvider.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MagFieldInterfaces MuidInterfaces TrkDetDescrInterfaces TrkSurfaces TrkParameters TrkExInterfaces GeoPrimitives MuidEvent muonEvent TrkGeometry TrkMaterialOnTrack TrkTrack TrkExUtils ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MuidInterfaces TrkDetDescrInterfaces TrkSurfaces TrkParameters TrkExInterfaces GeoPrimitives MuidEvent muonEvent TrkGeometry TrkMaterialOnTrack TrkTrack TrkExUtils MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( MuidCaloScatteringTools ) diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h index 65ad0b3e3d06254cc16edabb9b48a20f828896da..e5ba69501f5e74437c42fee75aff70365a294c7a 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h @@ -23,7 +23,8 @@ //<<<<<< INCLUDES >>>>>> #include "AthenaBaseComps/AthAlgTool.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MuidInterfaces/IMuidCaloTrackStateOnSurface.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" @@ -90,9 +91,9 @@ private: ToolHandle<Rec::IMuidCaloEnergy> m_caloEnergyParam; ToolHandle<Rec::IMuidCaloMaterialParam> m_caloMaterialParam; Trk::MagneticFieldProperties* m_magFieldProperties; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvcHandle; - MagField::IMagFieldSvc* m_magFieldSvc; ToolHandle<Trk::IPropagator> m_propagator; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; // configurable cut-off values double m_minCaloRadius; diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx index c566ad669c050f1ba5f5040b79235ec77026fd0a..530444413cc199bc85df968883e5a371793ad962 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx @@ -47,8 +47,6 @@ MuidCaloTrackStateOnSurface::MuidCaloTrackStateOnSurface (const std::string& typ m_caloEnergyParam ("Rec::MuidCaloEnergyTool/MuidCaloEnergyToolParam", this), m_caloMaterialParam ("Rec::MuidCaloMaterialParam/MuidCaloMaterialParam", this), m_magFieldProperties (0), - m_magFieldSvcHandle ("MagField::AtlasFieldSvc/AtlasFieldSvc", name), - m_magFieldSvc (0), m_propagator ("Trk::IntersectorWrapper/IntersectorWrapper", this), m_minCaloRadius (0.4*Gaudi::Units::meter), m_minRemainingEnergy (0.5*Gaudi::Units::GeV), @@ -108,16 +106,8 @@ MuidCaloTrackStateOnSurface::initialize() { ATH_MSG_DEBUG( "Retrieved tool " << m_caloMaterialParam ); } - if (m_magFieldSvcHandle.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve service " << m_magFieldSvcHandle ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved service " << m_magFieldSvcHandle ); - m_magFieldSvc = &*m_magFieldSvcHandle; - } + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if (m_propagator.retrieve().isFailure()) { ATH_MSG_FATAL( "Failed to retrieve tool " << m_propagator ); @@ -162,6 +152,18 @@ MuidCaloTrackStateOnSurface::caloTSOS(const Trk::TrackParameters& parameters) co const Trk::TrackParameters* middleParams = 0; const Trk::TrackParameters* outerParams = 0; + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + // track to calo surfaces - first decide in or outwards bool trackOutwards = true; if (dynamic_cast<const Trk::PerigeeSurface*>(¶meters.associatedSurface())) @@ -218,7 +220,7 @@ MuidCaloTrackStateOnSurface::caloTSOS(const Trk::TrackParameters& parameters) co double correctedEnergy = innerParams->momentum().mag() - energyDeposit; // fail potential loopers - if (m_magFieldSvc->toroidOn() + if (fieldCache.toroidOn() && correctedEnergy < m_minRemainingEnergy) { delete middleTS; @@ -442,7 +444,7 @@ MuidCaloTrackStateOnSurface::innerTSOS (const Trk::TrackParameters& parameters) { ATH_MSG_DEBUG( " innerTSOS: extrapolation fails " ); delete extrapolation; - return 0; + return nullptr; } return m_caloMaterialParam->trackStateOnSurface(extrapolation); @@ -456,7 +458,7 @@ MuidCaloTrackStateOnSurface::outerTSOS (const Trk::TrackParameters& parameters) { ATH_MSG_DEBUG( " outerTSOS: extrapolation fails " ); delete extrapolation; - return 0; + return nullptr; } return m_caloMaterialParam->trackStateOnSurface(extrapolation); @@ -472,7 +474,7 @@ MuidCaloTrackStateOnSurface::middleTSOS (const Trk::TrackParameters& middleParam { ATH_MSG_DEBUG( " middleTSOS: extrapolation fails " ); delete extrapolation; - return 0; + return nullptr; } const Trk::TrackStateOnSurface* TSOS = 0; @@ -521,7 +523,7 @@ MuidCaloTrackStateOnSurface::innerParameters (const Trk::TrackParameters& parame oppositeDirection = Trk::alongMomentum; } } - if (! surface) return 0; + if (! surface) return nullptr; // extrapolate to calo surface (take care to get correct cylinder intersect) unsigned extrapolations = 0; @@ -544,14 +546,14 @@ MuidCaloTrackStateOnSurface::innerParameters (const Trk::TrackParameters& parame false, *m_magFieldProperties, Trk::nonInteracting); - if (! extrapolation) return 0; + if (! extrapolation) return nullptr; // phi flip means track has crossed beam-axis (so quit) double deltaPhi = std::abs(extrapolation->position().phi() - startingPhi); if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } // also quit wrong rz-direction in endcap @@ -563,7 +565,7 @@ MuidCaloTrackStateOnSurface::innerParameters (const Trk::TrackParameters& parame { ATH_MSG_VERBOSE( " wrong way in endcap " ); delete extrapolation; - return 0; + return nullptr; } } @@ -609,7 +611,7 @@ MuidCaloTrackStateOnSurface::innerParameters (const Trk::TrackParameters& parame if (oldParameters == ¶meters) { ATH_MSG_VERBOSE( " innerParameters: extrap fails " ); - return 0; + return nullptr; } if (restart) { @@ -645,7 +647,7 @@ MuidCaloTrackStateOnSurface::innerParameters (const Trk::TrackParameters& parame if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } ATH_MSG_VERBOSE( " innerParameters: success after " @@ -688,7 +690,7 @@ MuidCaloTrackStateOnSurface::middleParameters (const Trk::TrackParameters& param oppositeDirection = Trk::alongMomentum; } } - if (! surface) return 0; + if (! surface) return nullptr; // extrapolate to calo surface (take care to get correct cylinder intersect) unsigned extrapolations = 0; @@ -711,14 +713,14 @@ MuidCaloTrackStateOnSurface::middleParameters (const Trk::TrackParameters& param false, *m_magFieldProperties, Trk::nonInteracting); - if (! extrapolation) return 0; + if (! extrapolation) return nullptr; // phi flip means track has crossed beam-axis (so quit) double deltaPhi = std::abs(extrapolation->position().phi() - startingPhi); if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } // also quit wrong rz-direction in endcap @@ -730,7 +732,7 @@ MuidCaloTrackStateOnSurface::middleParameters (const Trk::TrackParameters& param { ATH_MSG_VERBOSE( " wrong way in endcap " ); delete extrapolation; - return 0; + return nullptr; } } @@ -776,7 +778,7 @@ MuidCaloTrackStateOnSurface::middleParameters (const Trk::TrackParameters& param if (oldParameters == ¶meters) { ATH_MSG_VERBOSE( " middleParameters: extrap fails " ); - return 0; + return nullptr; } // arbitrary choice for oscillating solutions (i.e. following restart) if (restart) @@ -813,7 +815,7 @@ MuidCaloTrackStateOnSurface::middleParameters (const Trk::TrackParameters& param if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } ATH_MSG_VERBOSE( " middleParameters: success after " @@ -856,7 +858,7 @@ MuidCaloTrackStateOnSurface::outerParameters (const Trk::TrackParameters& parame oppositeDirection = Trk::alongMomentum; } } - if (! surface) return 0; + if (! surface) return nullptr; // extrapolate to calo surface (take care to get correct cylinder intersect) unsigned extrapolations = 0; @@ -879,14 +881,14 @@ MuidCaloTrackStateOnSurface::outerParameters (const Trk::TrackParameters& parame false, *m_magFieldProperties, Trk::nonInteracting); - if (! extrapolation) return 0; + if (! extrapolation) return nullptr; // phi flip means track has crossed beam-axis (so quit) double deltaPhi = std::abs(extrapolation->position().phi() - startingPhi); if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } // also quit wrong rz-direction in endcap @@ -898,7 +900,7 @@ MuidCaloTrackStateOnSurface::outerParameters (const Trk::TrackParameters& parame { ATH_MSG_VERBOSE( " wrong way in endcap " ); delete extrapolation; - return 0; + return nullptr; } } @@ -944,7 +946,7 @@ MuidCaloTrackStateOnSurface::outerParameters (const Trk::TrackParameters& parame if (oldParameters == ¶meters) { ATH_MSG_VERBOSE( " outerParameters: extrap fails " ); - return 0; + return nullptr; } // arbitrary choice for oscillating solutions (i.e. following restart) if (restart) @@ -981,7 +983,7 @@ MuidCaloTrackStateOnSurface::outerParameters (const Trk::TrackParameters& parame if (deltaPhi > 0.5*M_PI && deltaPhi < 1.5*M_PI) { delete extrapolation; - return 0; + return nullptr; } ATH_MSG_VERBOSE( " outerParameters: success after " diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/CMakeLists.txt b/Reconstruction/MuonIdentification/MuidTrackBuilder/CMakeLists.txt index 1b4cb2cabdc3df9120e07989b430c689a71134bb..9278bf88b0f17bd1ebc90c578755ecf5a1785b65 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/CMakeLists.txt @@ -19,7 +19,6 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel Event/EventPrimitives InnerDetector/InDetRecEvent/InDetRIO_OnTrack - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonCompetingRIOsOnTrack @@ -41,7 +40,10 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkExtrapolation/TrkExUtils Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkFitter/TrkiPatFitterUtils - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( CLHEP ) @@ -55,7 +57,7 @@ atlas_add_component( MuidTrackBuilder src/OutwardsCombinedMuonTrackBuilder.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AtlasDetDescr GaudiKernel MuidInterfaces TrkDetDescrInterfaces TrkGeometry TrkParameters TrkTrack InDetRIO_OnTrack MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonRecHelperToolsLib MuonRecToolInterfaces MuonCombinedToolInterfaces muonEvent TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex TrkExInterfaces TrkExUtils TrkFitterInterfaces TrkiPatFitterUtils TrkToolInterfaces ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AtlasDetDescr GaudiKernel MuidInterfaces TrkDetDescrInterfaces TrkGeometry TrkParameters TrkTrack InDetRIO_OnTrack MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonRecHelperToolsLib MuonRecToolInterfaces MuonCombinedToolInterfaces muonEvent TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkPseudoMeasurementOnTrack TrkTrackSummary VxVertex TrkExInterfaces TrkExUtils TrkFitterInterfaces TrkiPatFitterUtils TrkToolInterfaces MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( MuidTrackBuilder ) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h index 851385e9283f70e2eda77e55e524e03fb2a9e4bc..32a3cc6e9ed3e8652617dfbf87ee2ed7e94e45e3 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h @@ -21,7 +21,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include "MuidInterfaces/IMuidCaloEnergy.h" #include "MuidInterfaces/IMuidCaloTrackStateOnSurface.h" @@ -91,7 +92,13 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon Trk::Track* standaloneRefit(const Trk::Track& combinedTrack, float bs_x, float bs_y, float bs_z) const; /** ITrackFitter interface: - refit a track */ + * + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + + /*refit a track */ Trk::Track* fit(const Trk::Track& track, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; @@ -151,7 +158,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon const std::vector<const Trk::TrackStateOnSurface*>& trackStateOnSurfaces, const Trk::RecVertex* vertex, const Trk::RecVertex* mbeamAxis, const Trk::PerigeeSurface* mperigeeSurface, - const Trk::Perigee* seedParameter = 0) const; + const Trk::Perigee* seedParameter = nullptr) const; Trk::Track* createIndetTrack(const Trk::TrackInfo& info, DataVector<const Trk::TrackStateOnSurface>::const_iterator begin, @@ -217,7 +224,8 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; ServiceHandle<Trk::ITrackingGeometrySvc> m_trackingGeometrySvc; // init with callback ServiceHandle<Trk::ITrackingVolumesSvc> m_trackingVolumesSvc; @@ -259,7 +267,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon const Trk::Volume* m_indetVolume; // constant initialized the first time it's needed - mutable std::atomic<const Trk::TrackingVolume*> m_spectrometerEntrance{0}; + mutable std::atomic<const Trk::TrackingVolume*> m_spectrometerEntrance{nullptr}; // vertex region and phi modularity for pseudo-measurement constraints Trk::RecVertex* m_beamAxis; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h index 41ff3afd839b5a9467d2d64b3da3f6b60b1c4834..5885f322e4754db98d602ef4241a36872e82dc19 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h @@ -79,9 +79,15 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb refit a track removing any indet measurements with optional addition of pseudoMeasurements according to original extrapolation */ Trk::Track* standaloneRefit(const Trk::Track& combinedTrack, float bs_x, float bs_y, float bs_z) const; - + /** ITrackFitter interface: - refit a track */ + * + * Bring in default impl with + * EventContext for now + */ + + using ITrackFitter::fit; + /** refit a track */ Trk::Track* fit(const Trk::Track& track, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; @@ -91,7 +97,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /**ITrackFitter interface: @@ -100,7 +106,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /** ITrackFitter interface: @@ -109,7 +115,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /** ITrackFitter interface: diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 4d5d4ef9cefc976de8134653d8801917b3b2a90d..bbeeef5eb042e93df0f9f5600f9e1942b97d045f 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -16,6 +16,8 @@ #include <cmath> #include <iomanip> +#include <memory> + #include "AthenaKernel/Units.h" #include "EventPrimitives/EventPrimitivesHelpers.h" @@ -75,7 +77,6 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_trackQuery("Rec::MuonTrackQuery/MuonTrackQuery", this), m_trackSummary("Trk::TrackSummaryTool/MuidTrackSummaryTool", this), m_materialUpdator("Trk::TrkMaterialProviderTool/TrkMaterialProviderTool", this), - m_magFieldSvc("AtlasFieldSvc", name), m_trackingGeometrySvc("TrackingGeometrySvc/AtlasTrackingGeometrySvc", name), m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc", name), m_magFieldProperties(Trk::FullField), @@ -104,12 +105,12 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_IDMS_rzSigma(1. * Gaudi::Units::mm), m_indetSlimming(false), m_inputSlimming(false), - m_calorimeterVolume(0), - m_indetVolume(0), - m_beamAxis(0), - m_perigeeSurface(0), + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), + m_beamAxis(nullptr), + m_perigeeSurface(nullptr), m_sigmaPhiSector(0), - m_vertex(0), + m_vertex(nullptr), m_countAcceptedStandaloneFit(0), m_countBeamAxis(0), m_countCombinedCleanerVeto(0), @@ -117,7 +118,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_countExtensionCleanerVeto(0), m_countStandaloneCleanerVeto(0), m_countVertexRegion(0), - m_messageHelper(0), + m_messageHelper(nullptr), m_updateWithCaloTG(false), m_useCaloTG(false), m_iterateCombinedTrackFit(false), @@ -171,8 +172,6 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons declareProperty("IDMS_xySigma", m_IDMS_xySigma); declareProperty("IDMS_rzSigma", m_IDMS_rzSigma); - declareProperty("MagFieldSvc", m_magFieldSvc); - // deprecated declareProperty("IndetSlimming", m_indetSlimming); declareProperty("InputSlimming", m_inputSlimming); @@ -294,8 +293,9 @@ CombinedMuonTrackBuilder::initialize() ATH_MSG_DEBUG("Retrieved tool " << m_idHelperSvc); ATH_CHECK(m_intersector.retrieve()); ATH_MSG_DEBUG("Retrieved tool " << m_intersector); - ATH_CHECK(m_magFieldSvc.retrieve()); - ATH_MSG_DEBUG("Retrieved service " << m_magFieldSvc); + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); + ATH_MSG_DEBUG("Setup handle for key " << m_fieldCacheCondObjInputKey); if (!m_materialAllocator.empty()) { ATH_CHECK(m_materialAllocator.retrieve()); @@ -414,11 +414,11 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!indetPerigee) { // missing MeasuredPerigee for indet track m_messageHelper->printWarning(0); - return 0; + return nullptr; } // take inner calorimeter scattering surface from extrapolated track - const Trk::Surface* surface = 0; + const Trk::Surface* surface = nullptr; if (m_trackQuery->isCaloAssociated(extrapolatedTrack)) { auto it = extrapolatedTrack.trackStateOnSurfaces()->begin(); @@ -440,8 +440,20 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T // match extrapolated indet track to inner calorimeter scattering surface // provided momentum defined (solenoid on) - if (surface && m_magFieldSvc->solenoidOn() && !m_updateWithCaloTG) { - const Trk::TrackStateOnSurface* innerTSOS = 0; + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (surface && fieldCache.solenoidOn() && !m_updateWithCaloTG) { + const Trk::TrackStateOnSurface* innerTSOS = nullptr; if (m_useCaloTG) { ATH_MSG_VERBOSE(" Retriving Calorimeter TSOS from " << __func__ << " at line " << __LINE__); @@ -465,7 +477,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!innerTSOS) { ATH_MSG_DEBUG(" indet track fails to intersect the calorimeter "); - return 0; + return nullptr; } // will re-associate the calorimeter if they are not the same surface @@ -480,16 +492,16 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T << "surface reference " << surface->globalReferencePoint() << " with offset " << surfaceOffset << "mm. Re-evaluate the caloTSOS "); - surface = 0; + surface = nullptr; } } - Trk::Track* muonTrack = 0; + Trk::Track* muonTrack = nullptr; - if (!m_magFieldSvc->toroidOn()) { + if (!fieldCache.toroidOn()) { ATH_MSG_VERBOSE(" SL MS track: Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = createMuonTrack( - indetTrack, indetTrack.perigeeParameters(), 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + indetTrack, indetTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else { // create a muon track without perigee in case of non-optimal precision - @@ -497,16 +509,16 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!surface) { // extrapolate outwards to associate calorimeter material effects ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = createMuonTrack( - extrapolatedTrack, indetTrack.perigeeParameters(), 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + extrapolatedTrack, indetTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else if (m_trackQuery->numberPseudoMeasurements(extrapolatedTrack) > 1) { // remove pseudo meas ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, 0, 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + muonTrack = createMuonTrack(extrapolatedTrack, nullptr, nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else { // otherwise can just copy the extrapolated track ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, extrapolatedTrack.perigeeParameters(), 0, + muonTrack = createMuonTrack(extrapolatedTrack, extrapolatedTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); @@ -514,7 +526,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T } // no combined muon when failure to intersect calo - if (!muonTrack) return 0; + if (!muonTrack) return nullptr; countAEOTs(muonTrack, " muonTrack track before fit "); @@ -560,18 +572,18 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!combinedTrack || !combinedTrack->fitQuality() || !haveMS || perigeeOutside) { - bool hasFitQ = combinedTrack ? (combinedTrack->fitQuality() != 0) : false; + bool hasFitQ = combinedTrack ? (combinedTrack->fitQuality() != nullptr) : false; ATH_MSG_DEBUG("combinedTrack fails with bad fit" << combinedTrack << " " << hasFitQ << " " << haveMS << " " << perigeeOutside); delete combinedTrack; delete muonTrack; - return 0; + return nullptr; } // Get parameters at calo position - const Trk::TrackParameters* combinedEnergyParameters = 0; - const Trk::TrackParameters* muonEnergyParameters = 0; + const Trk::TrackParameters* combinedEnergyParameters = nullptr; + const Trk::TrackParameters* muonEnergyParameters = nullptr; const CaloEnergy* caloEnergy = caloEnergyParameters(combinedTrack, muonTrack, combinedEnergyParameters, muonEnergyParameters); @@ -580,7 +592,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T m_messageHelper->printWarning(3); delete combinedTrack; delete muonTrack; - return 0; + return nullptr; } // if significant momentum change: re-evaluate calo energy and refit @@ -602,7 +614,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T Trk::Track* oldTrack = muonTrack; ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, combinedEnergyParameters, 0, combinedTSOS->begin(), + muonTrack = createMuonTrack(extrapolatedTrack, combinedEnergyParameters, nullptr, combinedTSOS->begin(), combinedTSOS->end(), combinedTSOS->size()); if (indetNewTrack && muonTrack) { @@ -641,7 +653,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T double energyBalance = combinedEnergyParameters->momentum().mag() + caloEnergy->deltaE() - indetMaxE; // get parametrised eloss if large energy imbalance and refit track - CaloEnergy* paramEnergy = 0; + CaloEnergy* paramEnergy = nullptr; if (indetMaxE > 0. && energyBalance > m_numberSigmaFSR * caloEnergy->sigmaMinusDeltaE()) { // parametrized energy deposition // run-2 schema, update default eloss with parametrised value @@ -671,7 +683,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T Trk::Track* oldTrack = muonTrack; ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = - createMuonTrack(extrapolatedTrack, 0, paramEnergy, oldTrack->trackStateOnSurfaces()->begin(), + createMuonTrack(extrapolatedTrack, nullptr, paramEnergy, oldTrack->trackStateOnSurfaces()->begin(), oldTrack->trackStateOnSurfaces()->end(), oldTrack->trackStateOnSurfaces()->size()); delete oldTrack; @@ -690,7 +702,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!combinedTrack) { // final combined track lost, this should not happen m_messageHelper->printWarning(4); - return 0; + return nullptr; } if (m_refineELossCombinedTrackFit) { @@ -788,19 +800,31 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, // fail when solenoid off and toroid on (as extrapolation from ID is not the correct strategy) ToolHandle<Trk::IPropagator> propagator = m_propagatorSL; - if (m_magFieldSvc->toroidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.toroidOn()) { // fail when solenoid off and toroid on - as extrapolation from ID is not the correct strategy // for material effects, fit starting value etc - if (!m_magFieldSvc->solenoidOn()) { + if (!fieldCache.solenoidOn()) { ATH_MSG_VERBOSE("indetExtension: method switched off when solenoid 'off' / toroid 'on'"); - return 0; + return nullptr; } propagator = m_propagator; } - const Trk::TrackParameters* frontParameters = 0; - const Trk::TrackParameters* backParameters = 0; + const Trk::TrackParameters* frontParameters = nullptr; + const Trk::TrackParameters* backParameters = nullptr; if (innerParameters) { if (innerParameters->associatedSurface() == spectrometerMeasurements.front()->associatedSurface()) { @@ -840,8 +864,8 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, } // find middle measurement - const Trk::TrackParameters* midParameters = 0; - const Trk::MeasurementBase* midMeasurement = 0; + const Trk::TrackParameters* midParameters = nullptr; + const Trk::MeasurementBase* midMeasurement = nullptr; if (middleParameters && innerParameters && outerParameters) { Amg::Vector3D direction = (outerParameters->position() - innerParameters->position()).unit(); @@ -866,9 +890,9 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, } // create muon track from spectrometer measurements - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MaterialEffectsOnTrack* materialEffects = 0; - const Trk::TrackParameters* trackParameters = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MaterialEffectsOnTrack* materialEffects = nullptr; + const Trk::TrackParameters* trackParameters = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typeM; typeM.set(Trk::TrackStateOnSurface::Measurement); std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typeP; @@ -887,7 +911,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, trackStateOnSurfaces->push_back( new const Trk::TrackStateOnSurface((**m).clone(), frontParameters, fitQoS, materialEffects, typeP)); - frontParameters = 0; + frontParameters = nullptr; } else if (*m == midMeasurement) { trackStateOnSurfaces->push_back( new const Trk::TrackStateOnSurface((**m).clone(), midParameters, fitQoS, materialEffects, typeP)); @@ -902,7 +926,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, Trk::TrackInfo trackInfo(Trk::TrackInfo::Unknown, Trk::muon); - Trk::Track muonTrack(trackInfo, trackStateOnSurfaces, 0); + Trk::Track muonTrack(trackInfo, trackStateOnSurfaces, nullptr); countAEOTs(&muonTrack, " in detExtension muonTrack "); // perform combined fit @@ -925,7 +949,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, // reject with insufficient MS measurements ATH_MSG_DEBUG("indetExtension:: reject with insufficient MS measurements"); delete combinedTrack; - combinedTrack = 0; + combinedTrack = nullptr; } else { countAEOTs(combinedTrack, " in detExtension final combinedTrack "); } @@ -941,9 +965,21 @@ Trk::Track* CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack, const Trk::Vertex* inputVertex, float bs_x, float bs_y, float bs_z) const { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + // no SA fit with vertex constraint for Toroid off data - if (m_trackQuery->isLineFit(inputSpectrometerTrack) && !m_magFieldSvc->toroidOn()) { - return 0; + if (m_trackQuery->isLineFit(inputSpectrometerTrack) && !fieldCache.toroidOn()) { + return nullptr; } if (msgLvl(MSG::DEBUG)) { @@ -1010,7 +1046,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (inputVertex && !vertex) { // input vertex fails dynamic_cast m_messageHelper->printWarning(6); - return 0; + return nullptr; } // fail input tracks with insufficient measurements or inconsistent structure @@ -1035,14 +1071,14 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (measurements < 4) { m_messageHelper->printWarning(48); ATH_MSG_VERBOSE(" SA::failed (1)"); - return 0; + return nullptr; } // inconsistent TSOS on input track if (fitQuality && measurements < fitQuality->numberDoF() + 4) { m_messageHelper->printWarning(49); ATH_MSG_VERBOSE(" SA::failed (2)"); - return 0; + return nullptr; } } @@ -1050,7 +1086,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!m_trackQuery->isExtrapolated(inputSpectrometerTrack) && !m_trackQuery->isProjective(inputSpectrometerTrack)) { ATH_MSG_VERBOSE(" SA::failed (3)"); - return 0; + return nullptr; } // possibly refit the spectrometer track with material reallocation @@ -1062,7 +1098,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack spectrometerFit = reallocateMaterial(inputSpectrometerTrack); if (!spectrometerFit) { ATH_MSG_VERBOSE(" SA::failed (4)"); - return 0; + return nullptr; } haveSpectrometerRefit = true; } @@ -1079,7 +1115,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (5)"); - return 0; + return nullptr; } // set measured momentum error and starting parameters @@ -1094,7 +1130,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_WARNING("standaloneFit: measuredPerigee has non-positive-definite covariance "); ATH_MSG_VERBOSE(" SA::failed (5.5)"); - return 0; + return nullptr; } double errorP = @@ -1104,15 +1140,15 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack std::unique_ptr<Trk::RecVertex> mbeamAxis = std::make_unique<Trk::RecVertex>(*m_beamAxis); std::unique_ptr<Trk::PerigeeSurface> mperigeeSurface = std::make_unique<Trk::PerigeeSurface>(*m_perigeeSurface); - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; if (vertex) { // vertex association only makes sense for magnet-on tracks with measured curvature - if (!m_magFieldSvc->toroidOn() || m_trackQuery->isLineFit(spectrometerTrack) || errorP > m_largeMomentumError) { + if (!fieldCache.toroidOn() || m_trackQuery->isLineFit(spectrometerTrack) || errorP > m_largeMomentumError) { ATH_MSG_VERBOSE("standaloneFit: vertex fit not attempted as curvature badly measured"); ATH_MSG_VERBOSE(" SA::failed (6)"); - return 0; + return nullptr; } parameters = new Trk::Perigee(*spectrometerTrack.perigeeParameters()); } else { @@ -1126,21 +1162,21 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack // recreate beamAxis and vertexRegion for constrained (projective) track fits Amg::Vector3D origin(bs_x, bs_y, bs_z); - mperigeeSurface.reset(new Trk::PerigeeSurface(origin)); + mperigeeSurface = std::make_unique<Trk::PerigeeSurface>(origin); AmgSymMatrix(3) beamAxisCovariance; beamAxisCovariance.setZero(); (beamAxisCovariance)(0, 0) = m_vertex2DSigmaRPhi * m_vertex2DSigmaRPhi; (beamAxisCovariance)(1, 1) = m_vertex2DSigmaRPhi * m_vertex2DSigmaRPhi; (beamAxisCovariance)(2, 2) = m_vertex2DSigmaZ * m_vertex2DSigmaZ; - mbeamAxis.reset(new Trk::RecVertex(origin, beamAxisCovariance)); + mbeamAxis = std::make_unique<Trk::RecVertex>(origin, beamAxisCovariance); AmgSymMatrix(3) vertexRegionCovariance; vertexRegionCovariance.setZero(); (vertexRegionCovariance)(0, 0) = m_vertex3DSigmaRPhi * m_vertex3DSigmaRPhi; (vertexRegionCovariance)(1, 1) = m_vertex3DSigmaRPhi * m_vertex3DSigmaRPhi; (vertexRegionCovariance)(2, 2) = m_vertex3DSigmaZ * m_vertex3DSigmaZ; - mvertex.reset(new Trk::RecVertex(origin, vertexRegionCovariance)); + mvertex = std::make_unique<Trk::RecVertex>(origin, vertexRegionCovariance); } parameters = @@ -1151,7 +1187,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (7)"); - return 0; + return nullptr; } // create the spectrometer TSOS's for the extrapolated fit @@ -1162,9 +1198,9 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (8)"); - return 0; + return nullptr; } - const Trk::TrackParameters* caloParameters = 0; + const Trk::TrackParameters* caloParameters = nullptr; const Trk::TrackParameters* spectrometerParameters = parameters; Trk::ParticleHypothesis particleHypothesis = Trk::muon; @@ -1185,7 +1221,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } // badly defined tracks use weak vertex constraint with prefit before calo association - Trk::Track* prefit = 0; + Trk::Track* prefit = nullptr; const Trk::RecVertex* vertexInFit = vertex; @@ -1200,7 +1236,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack // FIXME: missing prefit case for excessive spectrometer eloss WARNING // spot from line starting approx from vertex?? if (inCSCregion || m_trackQuery->numberPseudoMeasurements(spectrometerTrack) - || (m_magFieldSvc->toroidOn() + || (fieldCache.toroidOn() && (badlyDeterminedCurvature || errorPhi > m_largePhiError || measuredPerigee->momentum().mag() < m_lowMomentum))) { @@ -1235,7 +1271,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } } - const Trk::Perigee* prefitResult = 0; + const Trk::Perigee* prefitResult = nullptr; // prefit to stabilize calo look-up and/or provide trackParameters if (performPrefit) { @@ -1259,12 +1295,12 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!prefit || !prefit->fitQuality() || !prefit->perigeeParameters()) { ATH_MSG_DEBUG(" prefit failure "); delete prefit; - prefit = 0; + prefit = nullptr; } if (prefit) { dumpCaloEloss(prefit, " prefit "); - bool hasCov = prefit->perigeeParameters() ? (prefit->perigeeParameters()->covariance() != 0) : false; + bool hasCov = prefit->perigeeParameters() ? (prefit->perigeeParameters()->covariance() != nullptr) : false; ATH_MSG_VERBOSE(" got prefit " << m_printer->print(*prefit) << " hasCov " << hasCov); if (prefit->perigeeParameters()) { @@ -1296,7 +1332,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } else { // this shouldn't happen, but best be safe... delete prefit; - prefit = 0; + prefit = nullptr; // prefit: no parameter extrapolation to calo m_messageHelper->printWarning(9); } @@ -1313,7 +1349,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_VERBOSE(" SA::failed (9)"); delete prefitResult; - return 0; + return nullptr; } // create spectrometerTSOS corresponding to prefit @@ -1355,7 +1391,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!m_idHelperSvc->isMuon(id)) continue; - const Trk::RIO_OnTrack* updatedRot = 0; + const Trk::RIO_OnTrack* updatedRot = nullptr; if (!m_cscRotCreator.empty() && m_idHelperSvc->isCsc(id)) { updatedRot = m_cscRotCreator->correct(*rot->prepRawData(), *(**t).trackParameters()); } else if (!m_mdtRotCreator.empty() && m_idHelperSvc->isMdt(id)) { @@ -1371,7 +1407,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack type.set(Trk::TrackStateOnSurface::Outlier); } - *t = new const Trk::TrackStateOnSurface(updatedRot, (**t).trackParameters()->clone(), 0, 0, type); + *t = new const Trk::TrackStateOnSurface(updatedRot, (**t).trackParameters()->clone(), nullptr, nullptr, type); delete tsos; } } @@ -1381,7 +1417,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack particleHypothesis = Trk::muon; bool returnAfterCleaner = false; - if (!m_magFieldSvc->toroidOn()) returnAfterCleaner = true; + if (!fieldCache.toroidOn()) returnAfterCleaner = true; ATH_MSG_VERBOSE("Calling createExtrapolatedTrack from " << __func__ << " at line " << __LINE__); Trk::Track* extrapolated = @@ -1412,13 +1448,13 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (vertexInFit) type.set(Trk::TrackStateOnSurface::Measurement); trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface( - vertexInFit, extrapolated->perigeeParameters()->clone(), 0, 0, type)); + vertexInFit, extrapolated->perigeeParameters()->clone(), nullptr, nullptr, type)); for (++s; s != badfit->trackStateOnSurfaces()->end(); ++s) { trackStateOnSurfaces->push_back((**s).clone()); } - Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, nullptr); extrapolated = fit(*track, m_cleanStandalone, particleHypothesis); delete badfit; delete track; @@ -1451,12 +1487,12 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack mperigeeSurface.get(), prefitResult); delete prefit; - prefit = 0; + prefit = nullptr; returnAfterCleaner = true; } if (!extrapolated || !extrapolated->fitQuality()) { - bool hasFQ = extrapolated ? (extrapolated->fitQuality() != 0) : false; + bool hasFQ = extrapolated ? (extrapolated->fitQuality() != nullptr) : false; ATH_MSG_DEBUG("fail track as back extrapolation fit failed " << extrapolated << " hasFQ " << hasFQ); delete prefit; delete caloParameters; @@ -1469,14 +1505,14 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_VERBOSE(" SA::failed (10)"); delete prefitResult; - return 0; + return nullptr; } } } // delete prefitResult delete prefitResult; - prefitResult = 0; + prefitResult = nullptr; // keep statistics for successful fits ++m_countAcceptedStandaloneFit; @@ -1498,7 +1534,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } else { // pRatio is the ratio of fitted to start momentum value at calo exit // find parameters at calo exit - parameters = 0; + parameters = nullptr; while (!(**s).trackParameters() || m_calorimeterVolume->inside((**s).trackParameters()->position())) { if ((**s).trackParameters() && !(**s).type(Trk::TrackStateOnSurface::Perigee)) @@ -1545,7 +1581,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack double fitChi2 = normalizedChi2(*track); if (fitChi2 < m_badFitChi2 || fitChi2 < extrapChi2 + 0.5) { delete extrapolated; - extrapolated = 0; + extrapolated = nullptr; } } @@ -1567,7 +1603,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } ATH_MSG_VERBOSE(" SA::failed (12)"); - return 0; + return nullptr; } int improvementsFailed = 0; // count the number of times the fit fails after improvements @@ -1644,7 +1680,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ++m_countDegradedStandaloneFit; if (improvementsFailed == 2) { ATH_MSG_WARNING("reject track, quality degraded and improvements failed"); - return 0; + return nullptr; } } } @@ -1670,9 +1706,21 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float countAEOTs(&combinedTrack, " in standalone Refit input combinedTrack "); - if (!m_magFieldSvc->toroidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.toroidOn()) { // no standalone refit for Toroid off - return 0; + return nullptr; } if (msgLvl(MSG::DEBUG)) { @@ -1748,7 +1796,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float m_messageHelper->printWarning(13); delete trackStateOnSurfaces; delete vertex; - return 0; + return nullptr; } if ((**s).type(Trk::TrackStateOnSurface::CaloDeposit)) { haveCaloDeposit = true; @@ -1758,12 +1806,12 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // inner calo scatterer - keep scattering angles for vertex constraint // Amg::Vector3D direction; - const Trk::ScatteringAngles* innerScattering = 0; - Trk::TrackStateOnSurface* innerTSOS = 0; + const Trk::ScatteringAngles* innerScattering = nullptr; + Trk::TrackStateOnSurface* innerTSOS = nullptr; const Trk::MaterialEffectsBase* materialEffects = (**s).materialEffectsOnTrack(); - const Trk::TrackParameters* middleParameters = 0; - const Trk::TrackParameters* oldParameters = 0; - const Trk::ScatteringAngles* outerScattering = 0; + const Trk::TrackParameters* middleParameters = nullptr; + const Trk::TrackParameters* oldParameters = nullptr; + const Trk::ScatteringAngles* outerScattering = nullptr; const Trk::TrackParameters* parameters = (**s).trackParameters(); if (materialEffects && parameters && m_calorimeterVolume->inside(parameters->position())) { @@ -1778,7 +1826,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // innerScattering dynamic_cast failed m_messageHelper->printWarning(16); delete vertex; - return 0; + return nullptr; } innerScattering = meot->scatteringAngles(); @@ -1790,8 +1838,8 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (s == combinedTrack.trackStateOnSurfaces()->end()) { // no TSOS of type CaloDeposit found m_messageHelper->printWarning(17); - materialEffects = 0; - parameters = 0; + materialEffects = nullptr; + parameters = nullptr; } else { materialEffects = (**s).materialEffectsOnTrack(); parameters = (**s).trackParameters(); @@ -1811,7 +1859,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // middle calo scatterer (for energy deposit) double energyDeposit = 0.; - Trk::TrackStateOnSurface* middleTSOS = 0; + Trk::TrackStateOnSurface* middleTSOS = nullptr; if (materialEffects && parameters && m_calorimeterVolume->inside(parameters->position())) { middleTSOS = (**s).clone(); @@ -1824,8 +1872,8 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float materialEffects = (**s).materialEffectsOnTrack(); parameters = (**s).trackParameters(); } else { - materialEffects = 0; - parameters = 0; + materialEffects = nullptr; + parameters = nullptr; } } else { // no middle material or parameters @@ -1839,7 +1887,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float } // outer calo scatterer - Trk::TrackStateOnSurface* outerTSOS = 0; + Trk::TrackStateOnSurface* outerTSOS = nullptr; double pInner = 0.; double pOuter = 0.; @@ -1854,7 +1902,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // outerScattering dynamic_cast failed m_messageHelper->printWarning(24); delete vertex; - return 0; + return nullptr; } outerScattering = meot->scatteringAngles(); @@ -1867,7 +1915,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float } else { // otherwise extrapolate outer to middleSurface without scattering correction if (!middleTSOS) { - parameters = 0; + parameters = nullptr; // no outerScattering or CaloDeposit TSOS found m_messageHelper->printWarning(25); } else { @@ -1897,7 +1945,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float delete middleTSOS; delete outerTSOS; delete vertex; - return 0; + return nullptr; } // create perigee by back extrapolation from middleSurface via innerSurface @@ -1912,7 +1960,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float momentumUpdate(parameters, pInner, true, -innerScattering->deltaPhi(), -innerScattering->deltaTheta()); } - const Trk::Perigee* perigee = 0; + const Trk::Perigee* perigee = nullptr; if (parameters) { perigee = dynamic_cast<const Trk::Perigee*>(m_propagator->propagate( *parameters, *m_perigeeSurface, Trk::oppositeMomentum, false, m_magFieldProperties, Trk::nonInteracting)); @@ -1961,7 +2009,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float delete middleTSOS; delete outerTSOS; delete vertex; - return 0; + return nullptr; } if (outerScattering) { @@ -1985,7 +2033,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Perigee); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(0, perigee, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(nullptr, perigee, nullptr, nullptr, type)); // including vertex region pseudoMeas if requested: in r21, this is always requested std::unique_ptr<Trk::RecVertex> mbeamAxis = std::make_unique<Trk::RecVertex>(*m_beamAxis); @@ -1994,7 +2042,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); } @@ -2087,7 +2135,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); ATH_MSG_DEBUG(" add new TSOS for ID "); @@ -2122,7 +2170,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (t == combinedTrack.trackStateOnSurfaces()->end()) { ATH_MSG_WARNING("At end of TSOS vector"); delete vertex; - return 0; + return nullptr; } if (haveLeadingMaterial) appendSelectedTSOS(*trackStateOnSurfaces, s, ++t); @@ -2137,7 +2185,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float appendSelectedTSOS(*trackStateOnSurfaces, t, combinedTrack.trackStateOnSurfaces()->end()); // create track for refit - Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, nullptr); standaloneTrack->info().setPatternRecognitionInfo(Trk::TrackInfo::MuidStandaloneRefit); if (m_trackQuery->isCombined(*standaloneTrack)) { ATH_MSG_WARNING(" This should not happen standalone Track has ID hits "); @@ -2151,14 +2199,14 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (!checkTrack("standaloneRefit", refittedTrack, standaloneTrack)) { delete refittedTrack; delete vertex; - return 0; + return nullptr; } if (refittedTrack) { if (!refittedTrack->fitQuality()) { delete refittedTrack; delete vertex; - return 0; + return nullptr; } if (!m_trackQuery->isCaloAssociated(*refittedTrack)) { @@ -2166,7 +2214,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float m_messageHelper->printWarning(28); delete refittedTrack; delete vertex; - return 0; + return nullptr; } countAEOTs(refittedTrack, " standaloneRefit final refittedTrack "); @@ -2209,14 +2257,26 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(29, ss.str()); - return 0; + return nullptr; } // check if combined or subsystem track bool isCombined = m_trackQuery->isCombined(track); // select straightLine fitter when magnets downstream of leading measurement are off ToolHandle<Trk::ITrackFitter> fitter = m_fitter; - if (!m_magFieldSvc->toroidOn() && !(isCombined && m_magFieldSvc->solenoidOn())) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.toroidOn() && !(isCombined && fieldCache.solenoidOn())) { fitter = m_fitterSL; ATH_MSG_VERBOSE(" fit (track refit method): select SL fitter "); @@ -2227,7 +2287,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo // perform fit after ensuring calo is associated for combined tracks // calo association for combined tracks (WARN if missing from input) - Trk::Track* fittedTrack = 0; + Trk::Track* fittedTrack = nullptr; if (isCombined && particleHypothesis == Trk::muon && !m_trackQuery->isCaloAssociated(track)) { // about to add the TSOS's describing calorimeter association to a combined muon; @@ -2276,7 +2336,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo } } - Trk::Track* combinedTrack = new Trk::Track(track.info(), combinedTSOS, 0); + Trk::Track* combinedTrack = new Trk::Track(track.info(), combinedTSOS, nullptr); if (combinedTrack) countAEOTs(combinedTrack, " combinedTrack track before fit "); @@ -2304,11 +2364,11 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo } // quit if fit has failed - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; if (!checkTrack("fitInterface1", fittedTrack, fittedTrack)) { delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -2355,7 +2415,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo ATH_MSG_DEBUG(" cleaner veto A "); ++m_countStandaloneCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original standalone track despite cleaner veto "); } @@ -2395,12 +2455,24 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(31, ss.str()); - return 0; + return nullptr; } // select straightLine fitter when magnets downstream of leading measurement are off + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + ToolHandle<Trk::ITrackFitter> fitter = m_fitter; - if (!m_magFieldSvc->toroidOn() || std::abs(perigeeStartValue.position().z()) > m_zECToroid) { + if (!fieldCache.toroidOn() || std::abs(perigeeStartValue.position().z()) > m_zECToroid) { fitter = m_fitterSL; ATH_MSG_VERBOSE(" fit (track refit method): select SL fitter "); @@ -2413,7 +2485,7 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T // create Perigee if starting parameters given for a different surface type const Trk::TrackParameters* perigee = &perigeeStartValue; - Trk::PerigeeSurface* perigeeSurface = 0; + Trk::PerigeeSurface* perigeeSurface = nullptr; if (!dynamic_cast<const Trk::Perigee*>(perigee)) { Amg::Vector3D origin(perigeeStartValue.position()); @@ -2430,11 +2502,11 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T delete perigee; } - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; if (!checkTrack("fitInterface2", fittedTrack, fittedTrack)) { delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -2479,7 +2551,7 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T ATH_MSG_DEBUG(" cleaner veto B"); ++m_countExtensionCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original extension track despite cleaner veto "); } @@ -2516,12 +2588,24 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(32, ss.str()); - return 0; + return nullptr; } // select straightLine fitter when solenoid and toroid are off ToolHandle<Trk::ITrackFitter> fitter = m_fitter; - if (!m_magFieldSvc->toroidOn() && !m_magFieldSvc->solenoidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (!fieldCache.toroidOn() && !fieldCache.solenoidOn()) { fitter = m_fitterSL; ATH_MSG_VERBOSE(" fit (combined muon fit method): select SL fitter "); @@ -2548,7 +2632,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex Trk::Track* fittedTrack = fitter->fit(indetTrack, extrapolatedTrack, false, particleHypothesis); - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; // track cleaning if (runOutlier) { @@ -2587,7 +2671,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex ATH_MSG_DEBUG(" cleaner veto C"); ++m_countCombinedCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original combined track despite cleaner veto "); } @@ -2616,7 +2700,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex bool CombinedMuonTrackBuilder::optimizeErrors(Trk::Track* track) const { - const Trk::MuonTrackSummary* muonSummary = 0; + const Trk::MuonTrackSummary* muonSummary = nullptr; const Trk::TrackSummary* summary = track->trackSummary(); if (summary) { @@ -2834,7 +2918,7 @@ CombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); @@ -2866,7 +2950,7 @@ CombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const << " trackStateOnSurfaces found " << trackStateOnSurfaces->size()); - Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, 0); + Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, nullptr); if (newTrack) countAEOTs(newTrack, " add IDMS errors "); return newTrack; } @@ -2880,7 +2964,7 @@ CombinedMuonTrackBuilder::appendSelectedTSOS(DataVector<const Trk::TrackStateOnS // spectrometer measurement selection std::vector<const Trk::Surface*> measurementSurfaces; measurementSurfaces.reserve(trackStateOnSurfaces.size()); - const Trk::Surface* previousSurface = 0; + const Trk::Surface* previousSurface = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = begin; for (; s != end; ++s) { @@ -2945,11 +3029,11 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, const Trk::TrackParameters*& muonEnergyParameters) const { // will also set the caloEnergyParameters (from both combinedTrack and muonTrack) - combinedEnergyParameters = 0; - muonEnergyParameters = 0; + combinedEnergyParameters = nullptr; + muonEnergyParameters = nullptr; // quit if missing track - if (!combinedTrack || !muonTrack) return 0; + if (!combinedTrack || !muonTrack) return nullptr; // muonTrack: get parameters at CaloDeposit DataVector<const Trk::TrackStateOnSurface>::const_iterator s = muonTrack->trackStateOnSurfaces()->begin(); @@ -2958,7 +3042,7 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, if (++s == muonTrack->trackStateOnSurfaces()->end()) { // muonTrack without caloEnergy association m_messageHelper->printWarning(35); - return 0; + return nullptr; } } muonEnergyParameters = (**s).trackParameters(); @@ -2969,7 +3053,7 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, if (++s == combinedTrack->trackStateOnSurfaces()->end()) { // combinedTrack without caloEnergy association m_messageHelper->printWarning(36); - return 0; + return nullptr; } } @@ -2999,13 +3083,13 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp << parameters.position().z() << " cov " << parameters.covariance() << " muonfit " << (particleHypothesis == Trk::muon)); - std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = 0; - std::vector<const Trk::TrackStateOnSurface*>* leadingTSOS = 0; + std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = nullptr; + std::vector<const Trk::TrackStateOnSurface*>* leadingTSOS = nullptr; std::vector<const Trk::TrackStateOnSurface*>::const_iterator s; - const Trk::TrackParameters* trackParameters = 0; - const Trk::Perigee* perigee = 0; + const Trk::TrackParameters* trackParameters = nullptr; + const Trk::Perigee* perigee = nullptr; if (vertex && m_indetVolume->inside(parameters.position())) { perigee = dynamic_cast<const Trk::Perigee*>(¶meters); @@ -3059,7 +3143,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } const Trk::TrackParameters* correctedParameters = parameters.associatedSurface().createTrackParameters( parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], - parameterVector[Trk::theta], parameterVector[Trk::qOverP], 0); + parameterVector[Trk::theta], parameterVector[Trk::qOverP], nullptr); Trk::IMaterialAllocator::Garbage_t garbage; leadingTSOS = m_materialAllocator->leadingSpectrometerTSOS(*correctedParameters, garbage); @@ -3161,7 +3245,19 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp // if association OK, create perigee surface and back-track to it if (caloAssociated) { - if (m_magFieldSvc->toroidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + + if (fieldCache.toroidOn()) { const Trk::TrackParameters* oldParameters = caloTSOS->front()->trackParameters(); if (oldParameters && !oldParameters->covariance()) { @@ -3179,7 +3275,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (trackParameters && !m_indetVolume->inside(trackParameters->position())) { ATH_MSG_DEBUG(" back extrapolation problem: probably outside indet volume "); delete trackParameters; - trackParameters = 0; + trackParameters = nullptr; caloAssociated = false; } @@ -3205,7 +3301,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } delete caloTSOS; - caloTSOS = 0; + caloTSOS = nullptr; } // track out from vertex @@ -3232,7 +3328,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp caloTSOS->push_back(tsos); } else { delete trackParameters; - trackParameters = 0; + trackParameters = nullptr; } } } @@ -3266,7 +3362,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } ATH_MSG_DEBUG(" perigee back-extrapolation fails "); - return 0; + return nullptr; } } // if (perigee) { @@ -3300,7 +3396,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (trackParameters) { trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface( - 0, dynamic_cast<const Trk::Perigee*>(trackParameters), 0, 0, perigeeType)); + nullptr, dynamic_cast<const Trk::Perigee*>(trackParameters), nullptr, nullptr, perigeeType)); } // optionally append a pseudoMeasurement describing the vertex @@ -3313,7 +3409,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); } } @@ -3368,7 +3464,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } // create track - Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, nullptr); dumpCaloEloss(track, " createExtrapolatedTrack "); countAEOTs(track, " createExtrapolatedTrack before fit "); @@ -3398,7 +3494,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (fittedTrack->perigeeParameters() && !m_indetVolume->inside(fittedTrack->perigeeParameters()->position())) { ATH_MSG_DEBUG(" back extrapolation problem: fitted perigee outside indet volume "); delete fittedTrack; - return 0; + return nullptr; } // limit momentum for future energy loss allocation @@ -3449,7 +3545,7 @@ CombinedMuonTrackBuilder::createIndetTrack(const Trk::TrackInfo& // then append selected TSOS appendSelectedTSOS(*trackStateOnSurfaces, begin, end); - return new Trk::Track(info, trackStateOnSurfaces, 0); + return new Trk::Track(info, trackStateOnSurfaces, nullptr); } Trk::Track* @@ -3463,7 +3559,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk countAEOTs(&muonTrack, " createMuonTrack "); // set iterator to current TSOS on input track to be after the indet - const Trk::TrackParameters* lastIDtp = 0; + const Trk::TrackParameters* lastIDtp = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = begin; while ((**s).trackParameters() && (m_indetVolume->inside((**s).trackParameters()->position()) @@ -3518,7 +3614,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk delete caloTSOS; } delete trackStateOnSurfaces; - return 0; + return nullptr; } size += caloTSOS->size(); @@ -3551,8 +3647,8 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk (**s).trackParameters()->associatedSurface(), typePattern); // create TSOS - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MeasurementBase* measurementBase = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MeasurementBase* measurementBase = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::CaloDeposit); @@ -3584,7 +3680,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk } // add entrance TSOS if not already present - const Trk::TrackStateOnSurface* entranceTSOS = 0; + const Trk::TrackStateOnSurface* entranceTSOS = nullptr; if ((**s).type(Trk::TrackStateOnSurface::Perigee)) { hasAlreadyPerigee = true; @@ -3617,7 +3713,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk // then append selected TSOS from the extrapolated or spectrometer track appendSelectedTSOS(*trackStateOnSurfaces, s, end); - Trk::Track* newMuonTrack = new Trk::Track(muonTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* newMuonTrack = new Trk::Track(muonTrack.info(), trackStateOnSurfaces, nullptr); // Updates the calo TSOS with the ones from TG+corrections (if needed) if (m_updateWithCaloTG && !m_useCaloTG && redoCaloAssoc) { @@ -3643,7 +3739,7 @@ CombinedMuonTrackBuilder::createPhiPseudoMeasurement(const Trk::Track& track) co std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - const Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(pseudo, parameters, 0, 0, type); + const Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(pseudo, parameters, nullptr, nullptr, type); return tsos; } @@ -3657,7 +3753,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT if (!measuredPerigee || !measuredPerigee->covariance()) { // missing MeasuredPerigee for spectrometer track m_messageHelper->printWarning(38); - return 0; + return nullptr; } double errorPhi = sqrt((*measuredPerigee->covariance())(Trk::phi0, Trk::phi0)); @@ -3692,8 +3788,8 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT unsigned numberMaterial = 0; unsigned numberParameters = 0; - const Trk::Surface* previousSurface = 0; - const Trk::TrackStateOnSurface* previousTSOS = 0; + const Trk::Surface* previousSurface = nullptr; + const Trk::TrackStateOnSurface* previousTSOS = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = spectrometerTrack.trackStateOnSurfaces()->begin(); auto sEnd = spectrometerTrack.trackStateOnSurfaces()->end(); @@ -3781,7 +3877,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT } } else if (previousTSOS) { spectrometerTSOS->push_back(previousTSOS); - previousTSOS = 0; + previousTSOS = nullptr; } // trapezoid precedes rotatedTrapezoid @@ -3793,7 +3889,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT } else { spectrometerTSOS->push_back(previousTSOS); } - previousTSOS = 0; + previousTSOS = nullptr; } if (rotatedTrap) { @@ -3818,7 +3914,7 @@ const Trk::TrackStateOnSurface* CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters) const { // make sure the spectrometer entrance volume is available - if (!parameters) return 0; + if (!parameters) return nullptr; if (!m_spectrometerEntrance.load()) { if (!m_trackingGeometrySvc) { @@ -3832,19 +3928,19 @@ CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters } if (!m_spectrometerEntrance.load()) { - return 0; + return nullptr; } const Trk::TrackParameters* entranceParameters = m_extrapolator->extrapolateToVolume( *parameters, *m_spectrometerEntrance.load(), Trk::anyDirection, Trk::nonInteracting); - if (!entranceParameters) return 0; + if (!entranceParameters) return nullptr; Trk::PerigeeSurface surface(entranceParameters->position()); const Trk::TrackParameters* trackParameters = m_extrapolator->extrapolateDirectly(*entranceParameters, surface); delete entranceParameters; - if (!trackParameters) return 0; + if (!trackParameters) return nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> perigeeType; perigeeType.set(Trk::TrackStateOnSurface::Perigee); @@ -3853,7 +3949,7 @@ CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters new Trk::Perigee(trackParameters->position(), trackParameters->momentum(), trackParameters->charge(), surface); delete trackParameters; - return new const Trk::TrackStateOnSurface(0, perigee, 0, 0, perigeeType); + return new const Trk::TrackStateOnSurface(nullptr, perigee, nullptr, nullptr, perigeeType); } @@ -3868,7 +3964,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!measuredPerigee || !measuredPerigee->covariance()) { // missing MeasuredPerigee for spectrometer track m_messageHelper->printWarning(42); - return 0; + return nullptr; } // set starting parameters and measured momentum error @@ -3876,14 +3972,14 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!parameters || !parameters->covariance()) { // missing spectrometer parameters on spectrometer track m_messageHelper->printWarning(43); - return 0; + return nullptr; } double errorP = sqrt(measuredPerigee->momentum().mag2() * (*measuredPerigee->covariance())(Trk::qOverP, Trk::qOverP)); // corrected parameters ensure the track fitting starts with a projective approximation - const Trk::TrackParameters* correctedParameters = 0; + const Trk::TrackParameters* correctedParameters = nullptr; Amg::VectorX parameterVector = parameters->parameters(); double trackEnergy = 1. / std::abs(parameterVector[Trk::qOverP]); @@ -3898,7 +3994,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete parameters; parameters = correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; } // check if the track curvature is well determined (with sufficient energy to penetrate material) @@ -3906,7 +4002,18 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, bool curvatureOK = false; ToolHandle<Trk::IPropagator> propagator = m_propagator; - if (!m_magFieldSvc->toroidOn()) { + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("SCTSiLorentzAngleCondAlg : Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return 0; + } + fieldCondObj->getInitializedCache (fieldCache); + if (!fieldCache.toroidOn()) { curvatureOK = true; propagator = m_propagatorSL; } else if (std::abs(parameters->position().z()) < m_zECToroid @@ -3926,7 +4033,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete caloEnergy; delete parameters; - return 0; + return nullptr; } parameterVector[Trk::qOverP] = parameters->charge() / (trackEnergy + caloEnergy->deltaE()); @@ -3964,18 +4071,18 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; ATH_MSG_DEBUG("standaloneFit: excessive energy loss in spectrometer " << std::abs(spectrometerEnergyLoss / Units::GeV) << " GeV" << " in calo " << std::abs(caloEnergy->deltaE() / Units::GeV) << " GeV"); } delete caloEnergy; - caloEnergy = 0; + caloEnergy = nullptr; } // check perigee in indet volume when the curvature is well determined @@ -3989,18 +4096,18 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, ATH_MSG_DEBUG("standaloneFit: failed back extrapolation to perigee"); delete correctedParameters; delete parameters; - return 0; + return nullptr; } // large impact: set phi to be projective (note iteration) - if (std::abs(perigee->parameters()[Trk::d0]) < m_largeImpact || !m_magFieldSvc->toroidOn()) { + if (std::abs(perigee->parameters()[Trk::d0]) < m_largeImpact || !fieldCache.toroidOn()) { if (correctedParameters == parameters) { ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; } else { Amg::Vector3D position = correctedParameters->position(); @@ -4071,7 +4178,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (correctedParameters == parameters) { ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; @@ -4095,7 +4202,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete parameters; delete perigee; /// if (haveSpectrometerRefit) delete spectrometerFit; - return 0; + return nullptr; } } delete perigee; @@ -4132,7 +4239,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!parameters) { ATH_MSG_DEBUG("standaloneFit: failed back extrapolation to perigee"); - return 0; + return nullptr; } } @@ -4173,7 +4280,7 @@ CombinedMuonTrackBuilder::finalTrackBuild(Trk::Track*& track) const delete recoveredTrack; if (chi2Before > m_badFitChi2) { delete track; - track = 0; + track = nullptr; return; } } @@ -4203,7 +4310,7 @@ CombinedMuonTrackBuilder::interfaceNotImplemented() const { ATH_MSG_WARNING(" this ITrackFitter interface has not been implemented." << " It is not relevant for combined muon tracks"); - return 0; + return nullptr; } void @@ -4213,7 +4320,7 @@ CombinedMuonTrackBuilder::momentumUpdate(const Trk::TrackParameters*& parameters if (!parameters) return; const Trk::TrackParameters* originalParameters = parameters; - const Trk::TrackParameters* updatedParameters = 0; + const Trk::TrackParameters* updatedParameters = nullptr; // update for angle change Amg::Vector3D direction = parameters->momentum().unit(); @@ -4252,7 +4359,7 @@ CombinedMuonTrackBuilder::momentumUpdate(const Trk::TrackParameters*& parameters // create updated parameters double charge = parameters->charge(); Amg::Vector3D position = parameters->position(); - AmgSymMatrix(5)* covariance = parameters->covariance() ? new AmgSymMatrix(5)(*(parameters->covariance())) : 0; + AmgSymMatrix(5)* covariance = parameters->covariance() ? new AmgSymMatrix(5)(*(parameters->covariance())) : nullptr; const Trk::Surface* surface = &(parameters->associatedSurface()); updatedParameters = surface->createTrackParameters(position, momentum, charge, covariance); @@ -4286,7 +4393,7 @@ const Trk::Track* CombinedMuonTrackBuilder::reallocateMaterial(const Trk::Track& spectrometerTrack) const { // build MeasurementSet for the spectrometer - const Trk::TrackParameters* perigeeStartValue = 0; + const Trk::TrackParameters* perigeeStartValue = nullptr; double perigeeDistance = 0.; Trk::MeasurementSet spectrometerMeasurements; @@ -4323,7 +4430,7 @@ CombinedMuonTrackBuilder::reallocateMaterial(const Trk::Track& spectrometerTrack // FIXME: use spectrometerTrack.perigeeParameters() // null perigeeStartValue m_messageHelper->printWarning(46); - return 0; + return nullptr; } // fit with various recovery strategies @@ -4391,10 +4498,10 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const } // remove spectrometer material from track - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MaterialEffectsBase* materialEffects = 0; - const Trk::MeasurementBase* measurementBase = 0; - const Trk::TrackParameters* trackParameters = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MaterialEffectsBase* materialEffects = nullptr; + const Trk::MeasurementBase* measurementBase = nullptr; + const Trk::TrackParameters* trackParameters = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> defaultType; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type = defaultType; @@ -4446,7 +4553,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const if ((**s).measurementOnTrack()) { - materialEffects = 0; + materialEffects = nullptr; Amg::VectorX parameterVector = (**s).trackParameters()->parameters(); if (limitMomentum) { parameterVector[Trk::qOverP] = qOverP; @@ -4455,7 +4562,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], parameterVector[Trk::qOverP], (**s).trackParameters()->covariance() ? new AmgSymMatrix(5)(*(**s).trackParameters()->covariance()) - : 0); + : nullptr); type = defaultType; type.set(Trk::TrackStateOnSurface::Measurement); @@ -4475,8 +4582,8 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const } if (limitMomentum && (**s).trackParameters()) { - materialEffects = 0; - measurementBase = 0; + materialEffects = nullptr; + measurementBase = nullptr; Amg::VectorX parameterVector = (**s).trackParameters()->parameters(); parameterVector[Trk::qOverP] = qOverP; @@ -4484,7 +4591,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], parameterVector[Trk::qOverP], (**s).trackParameters()->covariance() ? new AmgSymMatrix(5)(*(**s).trackParameters()->covariance()) - : 0); + : nullptr); type = defaultType; @@ -4518,7 +4625,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const // replace track Trk::TrackInfo trackInfo = track->info(); - Trk::FitQuality* fitQuality = 0; + Trk::FitQuality* fitQuality = nullptr; if (track->fitQuality()) { fitQuality = new Trk::FitQuality(*track->fitQuality()); } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx index 4410e7a498ef124f830dc4ec38200cf023d0a4be..8a9c0c8aa7c7e6886ebc7316cb7feddc0ed745f2 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx @@ -97,7 +97,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac || indetTrack.perigeeParameters()->momentum().perp() < m_minPt) { - return 0; + return nullptr; } ++m_recoveryAttempts; @@ -107,23 +107,23 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac << " MS track " << m_printer->print(spectrometerTrack) << std::endl << m_printer->printStations(spectrometerTrack)); - const Trk::TrackParameters* lastIndetPars = 0; + const Trk::TrackParameters* lastIndetPars = nullptr; int index = static_cast<int>(indetTrack.trackParameters()->size()); while (!lastIndetPars && index > 0) { --index; - lastIndetPars = (*indetTrack.trackParameters())[index] ? (*indetTrack.trackParameters())[index] : 0; + lastIndetPars = (*indetTrack.trackParameters())[index] ? (*indetTrack.trackParameters())[index] : nullptr; } if (!lastIndetPars) { ATH_MSG_WARNING("ID track parameters don't have error matrix!"); - return 0; + return nullptr; } // track builder prefers estimate of inner, middle and outer spectrometer track parameters - const Trk::TrackParameters* innerParameters = 0; - const Trk::TrackParameters* middleParameters = 0; - const Trk::TrackParameters* outerParameters = 0; + const Trk::TrackParameters* innerParameters = nullptr; + const Trk::TrackParameters* middleParameters = nullptr; + const Trk::TrackParameters* outerParameters = nullptr; const Trk::TrackParameters* lastPars = lastIndetPars; std::vector<const Trk::TrackStateOnSurface*> stations; @@ -163,7 +163,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac continue; } - const Trk::TrackParameters* exPars = 0; + const Trk::TrackParameters* exPars = nullptr; if (lastPars->associatedSurface() == meas->associatedSurface()) { ATH_MSG_DEBUG("Using existing pars"); exPars = lastPars; @@ -193,7 +193,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac if (msgLvl(MSG::DEBUG)) { if (!m_idHelperSvc->measuresPhi(id)) { - const MuonGM::MuonReadoutElement* detEl = 0; + const MuonGM::MuonReadoutElement* detEl = nullptr; if (m_idHelperSvc->isMdt(id)) { const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(meas); @@ -253,11 +253,11 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac } } else { middleParameters = innerParameters; - innerParameters = 0; + innerParameters = nullptr; if (!middleParameters) { ATH_MSG_DEBUG("parameter extrapolation failed"); - return 0; + return nullptr; } } @@ -269,7 +269,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } if (badEtaIndices.size() == etaIndices.size()) { @@ -277,7 +277,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } Trk::MeasurementSet spectrometerMeasurements; @@ -305,11 +305,11 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } // fit the combined track - Trk::Track* combinedTrack = 0; + Trk::Track* combinedTrack = nullptr; if (!m_trackBuilder.empty()) { combinedTrack = m_trackBuilder->indetExtension(indetTrack, spectrometerMeasurements, innerParameters, middleParameters, outerParameters); diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx index c431faa251751a2b9545371e84645e6f67e4886c..d6f7ce12fa211474fa56171fae5d50c2fa95bbc2 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx @@ -20,7 +20,7 @@ namespace Rec { MuonMatchQuality::MuonMatchQuality(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), m_alignmentUncertainty(0) + : AthAlgTool(type, name, parent), m_alignmentUncertainty(nullptr) { declareInterface<IMuonMatchQuality>(this); } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx index 43d492aa387ce6fe4a966084fa47e972cce921dc..18c3ce6d9231c9965d816acf26e82a1bc10deed3 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx @@ -78,7 +78,7 @@ MuonTrackQuery::initialize() const CaloEnergy* MuonTrackQuery::caloEnergy(const Trk::Track& track) const { - const CaloEnergy* caloEnergy = 0; + const CaloEnergy* caloEnergy = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -126,8 +126,8 @@ MuonTrackQuery::caloEnergyDeposit(const Trk::Track& track) const return 0.; } - const Trk::TrackParameters* indetExitParameters = 0; - const Trk::TrackParameters* caloExitParameters = 0; + const Trk::TrackParameters* indetExitParameters = nullptr; + const Trk::TrackParameters* caloExitParameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -191,7 +191,7 @@ MuonTrackQuery::fieldIntegral(const Trk::Track& track) const Amg::Vector3D integratedMomentumKick = Amg::Vector3D(0., 0., 0.); - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; // loop over TSOS to integrate vector Bdl int hit = 1; @@ -643,8 +643,8 @@ MuonTrackQuery::momentumBalanceSignificance(const Trk::Track& track) const // compare parameters with those from previous TSOS double energyBalance = 0.; - const Trk::EnergyLoss* energyLoss = 0; - const Trk::TrackParameters* previousParameters = 0; + const Trk::EnergyLoss* energyLoss = nullptr; + const Trk::TrackParameters* previousParameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -778,7 +778,7 @@ MuonTrackQuery::scatteringAngleSignificance(const Trk::Track& track) const // provide refit for slimmed tracks const Trk::Track* fullTrack = &track; - const Trk::Track* refittedTrack = 0; + const Trk::Track* refittedTrack = nullptr; if (isSlimmed(track)) { if (!m_fitter.empty()) { @@ -908,12 +908,12 @@ MuonTrackQuery::spectrometerParameters(const Trk::Track& track) const if (!calorimeterVolume) { ATH_MSG_WARNING("Failed to retrieve Calo volume "); - return 0; + return nullptr; } // find parameters at innermost spectrometer measurement // clone perigee if track has been slimmed - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -963,8 +963,8 @@ MuonTrackQuery::spectrometerPhiQuality(const Trk::Track& track) const // quality 0 - no additional phi measurement needed // 1 - phi direction un- (or poorly) constrained // 2 - no phi hits on track - const Trk::TrackStateOnSurface* leadingPhiMeasurement = 0; - const Trk::TrackStateOnSurface* trailingPhiMeasurement = 0; + const Trk::TrackStateOnSurface* leadingPhiMeasurement = nullptr; + const Trk::TrackStateOnSurface* trailingPhiMeasurement = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -1045,12 +1045,12 @@ MuonTrackQuery::triggerStationParameters(const Trk::Track& track) const if (!calorimeterVolume) { ATH_MSG_WARNING("Failed to retrieve Calo volume "); - return 0; + return nullptr; } // find parameters at innermost trigger station measurement // fails if track has been slimmed - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -1068,7 +1068,7 @@ MuonTrackQuery::triggerStationParameters(const Trk::Track& track) const parameters = (**s).trackParameters(); } - if (!parameters) return 0; + if (!parameters) return nullptr; // if necessary, flip to outgoing parameters if (parameters->momentum().dot(parameters->position()) > 0.) { @@ -1086,7 +1086,7 @@ const Trk::TrackParameters* MuonTrackQuery::flippedParameters(const Trk::TrackParameters& parameters) const { // flip parameters - const Trk::TrackParameters* flippedParams = 0; + const Trk::TrackParameters* flippedParams = nullptr; double phi = parameters.parameters()[Trk::phi0]; if (phi > 0.) { @@ -1101,7 +1101,7 @@ MuonTrackQuery::flippedParameters(const Trk::TrackParameters& parameters) const flippedParams = surface->createTrackParameters( parameters.parameters()[Trk::d0], parameters.parameters()[Trk::z0], phi, theta, qOverP, - parameters.covariance() ? new AmgSymMatrix(5)(*parameters.covariance()) : 0); + parameters.covariance() ? new AmgSymMatrix(5)(*parameters.covariance()) : nullptr); return flippedParams; } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx index d9b838834deb93e8ea74188d20e0c849d654bfa7..5601441f387b03e62cd83f7f0e470ca18d7c4138 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx @@ -43,8 +43,8 @@ OutwardsCombinedMuonTrackBuilder::OutwardsCombinedMuonTrackBuilder(const std::st const IInterface* parent) : AthAlgTool(type, name, parent), m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc", name), - m_calorimeterVolume(0), - m_indetVolume(0), + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), m_allowCleanerVeto(true), m_cleanCombined(true), m_recoverCombined(false), @@ -184,12 +184,12 @@ OutwardsCombinedMuonTrackBuilder::indetExtension(const Trk::Track& inde // Only measurements so not needed // if(spectrometerMeas[i]->alignmentEffectsOnTrack()) continue; - Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(spectrometerMeas[i]->clone(), 0, 0, 0, typeM); + Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(spectrometerMeas[i]->clone(), nullptr, nullptr, nullptr, typeM); trajectory->push_back(tsos); } Trk::TrackInfo trackInfo(Trk::TrackInfo::Unknown, Trk::muon); - Trk::Track inputtrack2(trackInfo, trajectory, 0); + Trk::Track inputtrack2(trackInfo, trajectory, nullptr); Trk::Track* track = fit(indetTrack, inputtrack2, m_cleanCombined, Trk::muon); return track; @@ -202,7 +202,7 @@ Trk::Track* OutwardsCombinedMuonTrackBuilder::standaloneFit(const Trk::Track& /*spectrometerTrack*/, const Trk::Vertex* /*vertex*/, float /*bs_x*/, float /*bs_y*/, float /*bs_z*/) const { - return 0; + return nullptr; } @@ -257,7 +257,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac if (vertexInFit) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); ATH_MSG_DEBUG(" found Perigee and added vertex " << itsos); } } @@ -321,7 +321,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); } @@ -345,7 +345,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac ATH_MSG_DEBUG(" trackStateOnSurfaces found " << trackStateOnSurfaces->size() << " from total " << itsos); - Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, nullptr); standaloneTrack->info().setPatternRecognitionInfo(Trk::TrackInfo::MuidStandaloneRefit); Trk::Track* refittedTrack = fit(*standaloneTrack, false, Trk::muon); @@ -353,7 +353,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac if (!refittedTrack) { ATH_MSG_DEBUG(" OutwardsCombinedMuonTrackBuilder standaloneRefit FAILED "); - return 0; + return nullptr; } ATH_MSG_DEBUG(" OutwardsCombinedMuonTrackBuilder standaloneRefit OK "); @@ -372,14 +372,14 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOut if (particleHypothesis != Trk::muon && particleHypothesis != Trk::nonInteracting) { ATH_MSG_WARNING(" invalid particle hypothesis " << particleHypothesis << " requested. Must be 0 or 2 (nonInteracting or muon) "); - return 0; + return nullptr; } ToolHandle<Trk::ITrackFitter> fitter = m_fitter; // fit Trk::Track* fittedTrack = fitter->fit(track, false, particleHypothesis); - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; // track cleaning if (runOutlier) { @@ -403,7 +403,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOut if (m_allowCleanerVeto) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } } else if (!(*cleanTrack->perigeeParameters() == *fittedTrack->perigeeParameters())) { ATH_MSG_VERBOSE(" found and removed spectrometer outlier(s) "); @@ -431,7 +431,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& /*measurementSe const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; } @@ -445,7 +445,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (particleHypothesis != Trk::muon && particleHypothesis != Trk::nonInteracting) { ATH_MSG_WARNING(" invalid particle hypothesis " << particleHypothesis << " requested. Must be 0 or 2 (nonInteracting or muon) "); - return 0; + return nullptr; } ToolHandle<Trk::ITrackFitter> fitter = m_fitter; @@ -454,13 +454,13 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T Trk::Track* fittedTrack = fitter->fit(indetTrack, extrapolatedTrack, false, particleHypothesis); if (!fittedTrack) { - return 0; + return nullptr; } if (!fittedTrack->perigeeParameters()) { ATH_MSG_WARNING(" Fitter returned a track without perigee, failing fit"); delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -482,7 +482,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (m_allowCleanerVeto) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } } else if (!(*cleanTrack->perigeeParameters() == *fittedTrack->perigeeParameters())) { ATH_MSG_VERBOSE(" found and removed spectrometer outlier(s) "); @@ -534,7 +534,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (fittedTrack && !fittedTrack->perigeeParameters()) { ATH_MSG_WARNING(" Fitter returned a track without perigee, failing fit"); delete fittedTrack; - return 0; + return nullptr; } if (runOutlier && fittedTrack) { @@ -542,7 +542,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (fitqual > 5 || (fittedTrack->perigeeParameters()->pT() < 20000 && fitqual > 2.5)) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { DataVector<const Trk::TrackStateOnSurface>::const_iterator itStates = fittedTrack->trackStateOnSurfaces()->begin(); @@ -566,7 +566,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (pullphi > 7 || pulltheta > 7) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; break; } } @@ -729,7 +729,7 @@ OutwardsCombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); @@ -760,7 +760,7 @@ OutwardsCombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const << " trackStateOnSurfaces found " << trackStateOnSurfaces->size()); - Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, 0); + Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, nullptr); return newTrack; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt index b71f6720cf84f3f3ac056e5562130719f5b29347..3a3cae1250c7602c01bdc55c999171376f2964ed 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt @@ -23,7 +23,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODTracking Event/xAOD/xAODTruth GaudiKernel - MagneticField/MagFieldInterfaces MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonCompetingRIOsOnTrack @@ -56,7 +55,10 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrackSummary Tracking/TrkExtrapolation/TrkExInterfaces Tracking/TrkTools/TrkToolInterfaces - Generators/AtlasHepMC ) + Generators/AtlasHepMC + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( CLHEP ) @@ -67,5 +69,5 @@ atlas_add_component( MuonCombinedBaseTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent AthLinks AthenaBaseComps Identifier EventPrimitives FourMomUtils xAODCaloEvent xAODEventInfo xAODMuon xAODTracking xAODTruth GaudiKernel MagFieldInterfaces MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils MuonSelectorToolsLib ICaloTrkMuIdTools MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces muonEvent MuidEvent ParticleTruth RecoToolInterfaces TrackToCaloLib TrkGeometry TrkSurfaces TrkCaloExtension TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParametersIdentificationHelpers TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent AthLinks AthenaBaseComps Identifier EventPrimitives FourMomUtils xAODCaloEvent xAODEventInfo xAODMuon xAODTracking xAODTruth GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonSegmentMakerUtils MuonSelectorToolsLib ICaloTrkMuIdTools MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces muonEvent MuidEvent ParticleTruth RecoToolInterfaces TrackToCaloLib TrkGeometry TrkSurfaces TrkCaloExtension TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkParameters TrkParametersIdentificationHelpers TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData MagFieldElements MagFieldConditions ) diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx index 5480cc257ec02433908096222220becc934a2d49..1bdec7606a72b93c02798cd170ba12576dc4151d 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx @@ -39,7 +39,6 @@ #include "Identifier/Identifier.h" #include "TrkEventUtils/IdentifierExtractor.h" #include "TrkMaterialOnTrack/ScatteringAngles.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "xAODTracking/Vertex.h" namespace MuonCombined { @@ -57,7 +56,6 @@ namespace MuonCombined { m_muonRecovery(""), m_matchQuality("Rec::MuonMatchQuality/MuonMatchQuality", this), m_trackScoringTool("Muon::MuonTrackScoringTool/MuonTrackScoringTool"), - m_magFieldSvc("AtlasFieldSvc",name), m_DetID(0) { declareInterface<IMuonCombinedTagTool>(this); @@ -74,7 +72,6 @@ namespace MuonCombined { declareProperty("MomentumBalanceCut", m_momentumBalanceCut = 6.0); declareProperty("IndetPullCut", m_indetPullCut = 6.0); declareProperty("MatchChiSquaredCut", m_matchChiSquaredCut = 30.0); - declareProperty("MagFieldSvc", m_magFieldSvc); } MuonCombinedFitTagTool::~MuonCombinedFitTagTool() @@ -94,7 +91,8 @@ namespace MuonCombined { if(! m_muonRecovery.empty() ) ATH_CHECK(m_muonRecovery.retrieve()); ATH_CHECK(m_matchQuality.retrieve()); ATH_CHECK(m_trackScoringTool.retrieve()); - ATH_CHECK(m_magFieldSvc.retrieve()); + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); if (detStore()->retrieve(m_DetID, "AtlasID").isFailure()) { ATH_MSG_ERROR ("Could not get AtlasDetectorID helper" ); @@ -314,7 +312,7 @@ namespace MuonCombined { } delete combinedTrack; - return 0; + return nullptr; } @@ -385,7 +383,18 @@ namespace MuonCombined { bool dorefit = true; // no SA refit for Toroid off - if (!m_magFieldSvc->toroidOn()) dorefit = false; + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return nullptr; + } + fieldCondObj->getInitializedCache (fieldCache); + if (!fieldCache.toroidOn()) dorefit = false; float bs_x = 0.; float bs_y = 0.; @@ -393,7 +402,7 @@ namespace MuonCombined { const xAOD::Vertex* matchedVertex { nullptr }; if(!m_vertexKey.empty()){ - SG::ReadHandle<xAOD::VertexContainer> vertices { m_vertexKey }; + SG::ReadHandle<xAOD::VertexContainer> vertices { m_vertexKey, ctx }; if ( vertices.isValid() ) { for (const auto& vx : *vertices) diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h index b0c05ec4e0eb46414274d59d23715f6532cd1cd3..d299d68f194922f22763ce5f32fe4f085e9849e8 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h @@ -15,6 +15,8 @@ #include "TrkParameters/TrackParameters.h" #include "TrkSegment/SegmentCollection.h" #include "xAODTracking/VertexContainer.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include <vector> //<<<<<< CLASS DECLARATIONS >>>>>> @@ -36,10 +38,6 @@ namespace Muon class MuonEDMPrinterTool; } -namespace MagField { - class IMagFieldSvc; -} - namespace MuonCombined { class InDetCandidate; class MuonCandidate; @@ -94,7 +92,8 @@ namespace MuonCombined { ToolHandle<Rec::IMuidMuonRecovery> m_muonRecovery; ToolHandle<Rec::IMuonMatchQuality> m_matchQuality; ToolHandle<Trk::ITrackScoringTool> m_trackScoringTool; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; const AtlasDetectorID *m_DetID; SG::ReadHandleKey<xAOD::VertexContainer> m_vertexKey { this, "VertexContainer", "PrimaryVertices", "primary vertex container" }; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx index 7ea58d4cf291c1892d125cf1b43aa8676751a9a9..1559d252bd036c8229a9ba4410ff12940409336d 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx @@ -1,14 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -////////////////////////////////////////////////////////////////////////////// -// MuonDressingTool -// -// (c) ATLAS Combined Muon software -////////////////////////////////////////////////////////////////////////////// - -//<<<<<< INCLUDES >>>>>> #include "MuonDressingTool.h" #include "TrkTrack/Track.h" #include "TrkTrackSummary/TrackSummary.h" @@ -16,33 +9,17 @@ namespace MuonCombined { -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> - -MuonDressingTool::MuonDressingTool (const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), - m_hitSummaryTool("Muon::MuonHitSummaryTool/MuonHitSummaryTool"), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") - +MuonDressingTool::MuonDressingTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent), + m_hitSummaryTool("Muon::MuonHitSummaryTool/MuonHitSummaryTool") { declareInterface<xAOD::IMuonDressingTool>(this); declareProperty("MuonHitSummaryTool", m_hitSummaryTool ); - declareProperty("MuonIdHelperTool", m_idHelper ); } -MuonDressingTool::~MuonDressingTool() -{} - -//<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> - StatusCode MuonDressingTool::initialize() { - ATH_CHECK(m_hitSummaryTool.retrieve()); - ATH_CHECK(m_idHelper.retrieve()); - - return StatusCode::SUCCESS; -} - -StatusCode MuonDressingTool::finalize() { + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -261,12 +238,12 @@ void MuonDressingTool::addMuonHitSummary( xAOD::Muon& muon, const Trk::TrackSumm std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit_end = mts.chamberHitSummary().end(); for ( ; chit != chit_end; ++chit ) { const Identifier& chId = chit->chamberId(); - bool isMdt = m_idHelper->isMdt(chId); - bool isCsc = m_idHelper->isCsc(chId); - bool isMM = m_idHelper->isMM(chId); - bool issTgc = m_idHelper->issTgc(chId); + bool isMdt = m_idHelperSvc->isMdt(chId); + bool isCsc = m_idHelperSvc->isCsc(chId); + bool isMM = m_idHelperSvc->isMM(chId); + bool issTgc = m_idHelperSvc->issTgc(chId); if ( isMdt || isMM || isCsc || issTgc ) { - Muon::MuonStationIndex::ChIndex index = m_idHelper->chamberIndex(chId); + Muon::MuonStationIndex::ChIndex index = m_idHelperSvc->chamberIndex(chId); uint8_t* hits = 0; uint8_t* holes = 0; if ( index == Muon::MuonStationIndex::BIS || index == Muon::MuonStationIndex::EIS || index == Muon::MuonStationIndex::CSS ) { @@ -323,7 +300,7 @@ void MuonDressingTool::addMuonHitSummary( xAOD::Muon& muon, const Trk::TrackSumm uint8_t* phiHoles = 0; uint8_t* etaHits = 0; uint8_t* etaHoles = 0; - Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(chId); + Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(chId); if ( index == Muon::MuonStationIndex::BM1 || index == Muon::MuonStationIndex::T4 || index == Muon::MuonStationIndex::CSC || index == Muon::MuonStationIndex::STGC1 ) { phiHits = &phiLayer1Hits; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.h index 756f895d0a1a955d6baa929d32cb06b82baa526f..89dfd4c6de24c476b0ca1177e88c1a7bf05b1681 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.h @@ -1,15 +1,17 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCOMBINEDBASETOOLS_MUONDRESSINGTOOL_H #define MUONCOMBINEDBASETOOLS_MUONDRESSINGTOOL_H +#include "xAODMuonCnv/IMuonDressingTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "xAODMuonCnv/IMuonDressingTool.h" + #include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Trk { class TrackSummary; @@ -20,16 +22,15 @@ namespace MuonCombined { class MuonDressingTool: public AthAlgTool, virtual public xAOD::IMuonDressingTool { public: MuonDressingTool(const std::string& type, const std::string& name, const IInterface* parent); - ~MuonDressingTool(void); // destructor - + ~MuonDressingTool()=default; + StatusCode initialize(); - StatusCode finalize(); void addMuonHitSummary( xAOD::Muon& muon, const Trk::TrackSummary* summary = 0 ) const ; private: - ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx index e270e3624ec692ee9c76a191b5b4b45f7ea670b3..4ba31bc953e8efbb799e022007542993bd651320 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////// @@ -10,20 +10,13 @@ // (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// -//<<<<<< INCLUDES >>>>>> -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "RecoToolInterfaces/IParticleCaloExtensionTool.h" +#include "MuonSegmentTagTool.h" + #include "MuonCombinedToolInterfaces/IMuonCombinedTagTool.h" #include "MuonCombinedEvent/InDetCandidate.h" #include "MuonCombinedEvent/MuonCandidate.h" #include "MuonCombinedEvent/SegmentTag.h" -#include "MuonSegmentTagTool.h" - -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" #include "TrkParameters/TrackParameters.h" #include "TrkTrack/Track.h" @@ -49,11 +42,9 @@ #include <stdio.h> namespace MuonCombined { - - //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> - MuonSegmentTagTool::MuonSegmentTagTool (const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), + MuonSegmentTagTool::MuonSegmentTagTool (const std::string& type, const std::string& name, const IInterface* parent) : + AthAlgTool(type, name, parent), m_CutTheta(999.), m_CutPhi(999.), m_HitInfoFor2ndCoord(0.), @@ -61,12 +52,10 @@ namespace MuonCombined { m_doTable(false), m_doBidirectional(false), m_doPtDependentPullCut(true), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - p_MuTagMatchingTool ( "MuTagMatchingTool/MuTagMatchingTool" ) , - p_MuTagAmbiguitySolverTool ( "MuTagAmbiguitySolverTool/MuTagAmbiguitySolverTool" ) , - m_caloExtensionTool("Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", this), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), + p_MuTagMatchingTool("MuTagMatchingTool/MuTagMatchingTool") , + p_MuTagAmbiguitySolverTool("MuTagAmbiguitySolverTool/MuTagAmbiguitySolverTool") , + m_caloExtensionTool("Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", this), m_segmentSelector("Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"), m_hitSummaryTool("Muon::MuonSegmentHitSummaryTool/MuonSegmentHitSummaryTool"), m_surfaces(0), @@ -77,44 +66,35 @@ namespace MuonCombined { m_naccepted(0) { declareInterface<IMuonSegmentTagTool>(this); - declareProperty("CutTheta" , m_CutTheta = 3. ) ; - declareProperty("CutPhi" , m_CutPhi = 3. ) ; - + declareProperty("CutTheta" , m_CutTheta = 3.); + declareProperty("CutPhi" , m_CutPhi = 3.); //Option for determination of segment 2nd coordinate measurement - declareProperty("HitInfoFor2ndCoord" , m_HitInfoFor2ndCoord = 1 ) ; - - declareProperty("DoSegmentsFilter" , m_doSegmentsFilter = true ) ; - declareProperty("MuTagMatchingTool" , p_MuTagMatchingTool ) ; - declareProperty("MuTagAmbiguitySolverTool" , p_MuTagAmbiguitySolverTool ) ; - declareProperty("ParticleCaloExtensionTool",m_caloExtensionTool ); - - declareProperty("DoOverviewTable" , m_doTable = false ) ; - declareProperty("DoBidirectionalExtrapolation" , m_doBidirectional = false ) ; - declareProperty("DoPtDependentPullCut" , m_doPtDependentPullCut = false ) ; - declareProperty("Printer",m_printer ); - declareProperty( "RemoveLowPLowFieldRegion" , m_removeLowPLowFieldRegion = false); // remove tracks with momenta below 6 GeV in eta 1.4-17 region (low p and low field) - declareProperty("UseIDTrackSegmentPreSelect" , m_useSegmentPreselection = true ); - declareProperty("SegmentQualityCut" , m_segmentQualityCut = 1 ); - declareProperty("nmdtHits" , m_nmdtHits = 4 ); - declareProperty("nmdtHoles" , m_nmdtHoles = 3 ); - declareProperty("nmdtHitsML" , m_nmdtHitsML = 2 ); - declareProperty("TriggerHitCut" , m_triggerHitCut = true ); - declareProperty("MakeMuons" , m_makeMuons = false ); - declareProperty("IgnoreSiAssociatedCandidates" , m_ignoreSiAssocated = true ); - + declareProperty("HitInfoFor2ndCoord" , m_HitInfoFor2ndCoord = 1); + declareProperty("DoSegmentsFilter" , m_doSegmentsFilter = true); + declareProperty("MuTagMatchingTool" , p_MuTagMatchingTool); + declareProperty("MuTagAmbiguitySolverTool" , p_MuTagAmbiguitySolverTool); + declareProperty("ParticleCaloExtensionTool" , m_caloExtensionTool); + declareProperty("DoOverviewTable" , m_doTable = false); + declareProperty("DoBidirectionalExtrapolation" , m_doBidirectional = false); + declareProperty("DoPtDependentPullCut" , m_doPtDependentPullCut = false); + declareProperty("Printer" , m_printer); + declareProperty("RemoveLowPLowFieldRegion" , m_removeLowPLowFieldRegion = false); // remove tracks with momenta below 6 GeV in eta 1.4-17 region (low p and low field) + declareProperty("UseIDTrackSegmentPreSelect" , m_useSegmentPreselection = true); + declareProperty("SegmentQualityCut" , m_segmentQualityCut = 1); + declareProperty("nmdtHits" , m_nmdtHits = 4); + declareProperty("nmdtHoles" , m_nmdtHoles = 3); + declareProperty("nmdtHitsML" , m_nmdtHitsML = 2); + declareProperty("TriggerHitCut" , m_triggerHitCut = true); + declareProperty("MakeMuons" , m_makeMuons = false); + declareProperty("IgnoreSiAssociatedCandidates" , m_ignoreSiAssocated = true); } - MuonSegmentTagTool::~MuonSegmentTagTool() - {} - - //<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> - StatusCode MuonSegmentTagTool::initialize() { ATH_CHECK(m_printer.retrieve()); ATH_CHECK(p_MuTagMatchingTool.retrieve()); ATH_CHECK(p_MuTagAmbiguitySolverTool.retrieve()); - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_edmHelperSvc.retrieve()); ATH_CHECK(m_segmentSelector.retrieve()); if( !m_caloExtensionTool.empty() ) ATH_CHECK(m_caloExtensionTool.retrieve()); @@ -129,18 +109,13 @@ namespace MuonCombined { ATH_MSG_DEBUG( "= HitInfoFor2ndCoord " << m_HitInfoFor2ndCoord ); ATH_MSG_DEBUG( "================================ " ); - if(0!=m_HitInfoFor2ndCoord && 1!=m_HitInfoFor2ndCoord) - { - ATH_MSG_FATAL( "HitInfoFor2ndCoord=" << m_HitInfoFor2ndCoord - << " : Unacceptable value. MuTagIMO will not run." ); - return StatusCode::FAILURE; - } + if(0!=m_HitInfoFor2ndCoord && 1!=m_HitInfoFor2ndCoord) { + ATH_MSG_FATAL( "HitInfoFor2ndCoord=" << m_HitInfoFor2ndCoord << " : Unacceptable value. MuTagIMO will not run."); + return StatusCode::FAILURE; + } m_surfaces = new MSSurfaces(); - m_doTable= true; - - return StatusCode::SUCCESS; } @@ -153,11 +128,8 @@ namespace MuonCombined { ATH_MSG_INFO( "Total number of accepted ID tracks " << m_naccepted); for( unsigned int i=0;i<12;++i ){ double ratio = m_extrapolated[i] == 0 ? 0 : m_goodExtrapolated[i]/(double)m_extrapolated[i]; - ATH_MSG_INFO( "Layer " << i << " extrap " << m_extrapolated[i] << " good " << m_goodExtrapolated[i] - << " ratio " << ratio ); - + ATH_MSG_INFO( "Layer " << i << " extrap " << m_extrapolated[i] << " good " << m_goodExtrapolated[i] << " ratio " << ratio ); } - return StatusCode::SUCCESS; } @@ -206,10 +178,10 @@ namespace MuonCombined { } if( m_segmentQualityCut > 0 ){ Identifier chId = m_edmHelperSvc->chamberId(**itSeg); - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(chId); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId); if( !m_triggerHitCut && stIndex == Muon::MuonStationIndex::EM ){ // don't apply the TGC requirement for the first station as it sometimes has not trigger hits due to TGC acceptance - int stationEta = m_idHelper->stationEta(chId); + int stationEta = m_idHelperSvc->stationEta(chId); if( abs(stationEta) != 1 ){ // remove EM segments without trigger hits if( hitCounts.nphiTrigHitLayers == 0 && hitCounts.netaTrigHitLayers == 0 ) continue; @@ -249,13 +221,13 @@ namespace MuonCombined { { Identifier chId = m_edmHelperSvc->chamberId(**itSeg); - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(chId); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId); if( stIndex == Muon::MuonStationIndex::BI || stIndex == Muon::MuonStationIndex::BE ) hasSeg[0] = true; else if( stIndex == Muon::MuonStationIndex::BM ) hasSeg[1] = true; else if( stIndex == Muon::MuonStationIndex::BO ) hasSeg[2] = true; else{ - int stationEta = m_idHelper->stationEta(chId); + int stationEta = m_idHelperSvc->stationEta(chId); if( stationEta > 0 ){ if( stIndex == Muon::MuonStationIndex::EI ) hasSeg[4] = true; if( stIndex == Muon::MuonStationIndex::EM ) hasSeg[5] = true; @@ -333,14 +305,14 @@ namespace MuonCombined { hasAngleMatch = true; if( pID > 20000*(qID*etaID-2) ) { Identifier chId = m_edmHelperSvc->chamberId(**itSeg); - if( !m_idHelper->isCsc(chId) ) hasMatch = true; - Muon::MuonStationIndex::StIndex stIndex = m_idHelper->stationIndex(chId); + if( !m_idHelperSvc->isCsc(chId) ) hasMatch = true; + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId); if( stIndex == Muon::MuonStationIndex::BI || stIndex == Muon::MuonStationIndex::BE ) hasSeg[0] = true; else if( stIndex == Muon::MuonStationIndex::BM ) hasSeg[1] = true; else if( stIndex == Muon::MuonStationIndex::BO ) hasSeg[2] = true; else{ - int stationEta = m_idHelper->stationEta(chId); + int stationEta = m_idHelperSvc->stationEta(chId); if( stationEta > 0 ){ if( stIndex == Muon::MuonStationIndex::EI ) hasSeg[4] = true; if( stIndex == Muon::MuonStationIndex::EM ) hasSeg[5] = true; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.h index 5315a4ec4822f22dac6dd8d9168ba4257a81bae9..61068a058cf006a50762a83d87df7cadf259f10e 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.h @@ -1,38 +1,37 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCOMBINEDBASETOOLS_MUONSEGMENTTAGTOOL_H #define MUONCOMBINEDBASETOOLS_MUONSEGMENTTAGTOOL_H +#include "MuonCombinedToolInterfaces/IMuonSegmentTagTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonCombinedToolInterfaces/IMuonSegmentTagTool.h" + +#include "MSSurfaces.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCombinedEvent/InDetCandidateCollection.h" -#include <vector> #include "TrkParameters/TrackParameters.h" #include "MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h" #include "MuonSegmentTaggerToolInterfaces/IMuTagMatchingTool.h" -#include "MSSurfaces.h" #include "MuonSegmentTaggerToolInterfaces/IMuTagIMOTool.h" #include "MuonCombinedEvent/MuonSegmentInfo.h" #include "xAODMuon/MuonSegmentContainer.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "RecoToolInterfaces/IParticleCaloExtensionTool.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" #include <array> #include <atomic> #include <string> - -namespace Trk { - class IParticleCaloExtensionTool; -} +#include <vector> namespace Muon { class MuonSegment; - class MuonEDMPrinterTool; - class MuonIdHelperTool; - class IMuonSegmentSelectionTool; } namespace MuonCombined { @@ -42,7 +41,7 @@ namespace MuonCombined { using SegmentMap = std::map< const Muon::MuonSegment*, ElementLink<xAOD::MuonSegmentContainer> >; public: MuonSegmentTagTool(const std::string& type, const std::string& name, const IInterface* parent); - ~MuonSegmentTagTool(void); // destructor + ~MuonSegmentTagTool()=default; StatusCode initialize(); StatusCode finalize(); @@ -83,7 +82,7 @@ namespace MuonCombined { ToolHandle< IMuTagMatchingTool > p_MuTagMatchingTool ; //!< Pointer to MuTagMatching Tool ToolHandle< IMuTagAmbiguitySolverTool> p_MuTagAmbiguitySolverTool ; //!< Pointer to MuTagAmbiguitySolverTool ToolHandle <Trk::IParticleCaloExtensionTool> m_caloExtensionTool; //!< Tool to make the step-wise extrapolation - ToolHandle< Muon::MuonIdHelperTool > m_idHelper ; //!< Pointer to IPropagator + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< Pointer to IPropagator diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/CombinedMuonTrackSummary.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/CombinedMuonTrackSummary.py index 4ca97bef4c82297c433ee6e77e6fbeac63a816ab..43d625052d4f6288686b4365bfe940ec1537e98d 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/CombinedMuonTrackSummary.py +++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/CombinedMuonTrackSummary.py @@ -42,7 +42,6 @@ if muonCombinedRecFlags.useDetailedPixelHoleSearch(): ToolSvc += InDet__InDetTestPixelLayerTool( name = "CombinedMuonInDetTestPixelLayerTool", Extrapolator = atlasExtrapolator, - PixelSummaryTool = InDetPixelConditionsSummaryTool, CheckActiveAreas = True, CheckDeadRegions = True ) @@ -104,7 +103,6 @@ if DetFlags.haveRIO.pixel_on(): name = "CombinedMuonPixelToTPID") # set properties into public tools - ToolSvc.CombinedMuonIDHoleSearch.PixelSummaryTool = InDetPixelConditionsSummaryTool ToolSvc.CombinedMuonIDSummaryHelper.PixelToTPIDTool = ToolSvc.CombinedMuonPixelToTPID ToolSvc.CombinedMuonIDSummaryHelper.TestBLayerTool = ToolSvc.CombinedMuonTestBLayer ToolSvc.CombinedMuonTrackSummary.PixelToTPIDTool = ToolSvc.CombinedMuonPixelToTPID diff --git a/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt b/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt index f0d80a5c22d8f47f6abd5723ac29e71b504950f3..f98544c14cae7749ee5bb3e196aa3a40f9599ba6 100644 --- a/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt +++ b/Reconstruction/RecExample/RecExAlgs/CMakeLists.txt @@ -23,8 +23,4 @@ atlas_add_component( RecExAlgs # Install files from the package: atlas_install_headers( RecExAlgs ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Reconstruction/RecExample/RecExAlgs/share/SimpleCookedObjMaker_jobOptions.py b/Reconstruction/RecExample/RecExAlgs/share/SimpleCookedObjMaker_jobOptions.py index 081cfaafb3833b781457ac9fbe6ae7fbb2c5a7c9..d2cb925bb74e3b82db304609abad67af8af52af1 100755 --- a/Reconstruction/RecExample/RecExAlgs/share/SimpleCookedObjMaker_jobOptions.py +++ b/Reconstruction/RecExample/RecExAlgs/share/SimpleCookedObjMaker_jobOptions.py @@ -1,3 +1,5 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ## get a handle on the algsequence from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() diff --git a/Reconstruction/RecExample/RecExAlgs/share/SimpleRawObjMaker_jobOptions.py b/Reconstruction/RecExample/RecExAlgs/share/SimpleRawObjMaker_jobOptions.py index bc9b2935ba567fc52e9d4173f4ba0d53a00a4567..056daf12f8355dea2b85ac0594caad4d6976aaab 100755 --- a/Reconstruction/RecExample/RecExAlgs/share/SimpleRawObjMaker_jobOptions.py +++ b/Reconstruction/RecExample/RecExAlgs/share/SimpleRawObjMaker_jobOptions.py @@ -1,3 +1,5 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + ## get a handle on the algsequence from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() diff --git a/Reconstruction/RecExample/RecExCommon/CMakeLists.txt b/Reconstruction/RecExample/RecExCommon/CMakeLists.txt index 4f9bcb822dfadb3f5354411c1b0ac3201ae2de96..855b5133882ef2a3c75c9ef56355a0e416a40c99 100644 --- a/Reconstruction/RecExample/RecExCommon/CMakeLists.txt +++ b/Reconstruction/RecExample/RecExCommon/CMakeLists.txt @@ -9,5 +9,4 @@ atlas_subdir( RecExCommon ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( data/*.ascii.gz ) -atlas_install_scripts( share/RecExCommon_links_zc.sh share/RecExCommon_links_cern_zc.sh share/RecExCommon_links.sh share/RecExCommon_links.csh share/RecExCommon_runTimeFiles_zc.sh share/RecExCommon_dump.C Testing/manyrecotests.sh share/recexcommon-links.py share/qtest_run1.sh share/qtest_run2.sh ) - +atlas_install_scripts( share/RecExCommon_links.sh share/recexcommon-links.py share/qtest_run1.sh share/qtest_run2.sh ) diff --git a/Reconstruction/RecExample/RecExCommon/Testing/CompareFiles.sh b/Reconstruction/RecExample/RecExCommon/Testing/CompareFiles.sh deleted file mode 100755 index 098133a0cbc49dfee23e767bcdd377cf9cd7c770..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/CompareFiles.sh +++ /dev/null @@ -1,60 +0,0 @@ -echo " Compare output file with reference one " -# - cmt show path - TheRelease=`cmt show path | sed -n "s#.\+/\(.\+\)/AtlasProduction/.\+#\1#gp" | sed "s/\-Prod//"` - if [ -z $TheRelease ]; then - TheRelease=`cmt show path | sed -n "s#.\+/\(.\+\)/AtlasReconstruction/.\+#\1#gp"` - fi - echo "running in $TheRelease" - Result=0 - for TheFile in $* ; do - echo "-------->Comparing" $TheFile - if test ! -f $TheFile ; then - echo " Problem! Not existing file " $TheFile - else - TheFileReference="../Testing/Reference_${TheFile}" - if test -f /afs/cern.ch/user/r/rig/ReferenceFiles/RecExCommon/$TheRelease/Reference_${TheFile} ; then - TheFileReference="/afs/cern.ch/user/r/rig/ReferenceFiles/RecExCommon/$TheRelease/Reference_${TheFile}" - echo " Found Reference file for release $TheRelease in 'rig' area, using this one instead !" $TheFileReference - fi -# echo $TheFileReference - ThisFileReference=`basename $TheFileReference` - if test ! -f $TheFileReference ; then - echo " Problem! Not existing file " $TheFileReference - Result=2 - else -#only keep line with "error" or "warning" or "fatal" -#keep last message from Application Manger to checkfinalized successfull - /bin/rm -f TheDiff ${TheFile}_stripped ${TheFileReference}_stripped - grep -E "WARNING|ERROR|FATAL" $TheFile | grep -v " [Ss]unday conditions" > ${TheFile}_stripped - grep -Ei "Application Manager Finalized successfully" $TheFile >> ${TheFile}_stripped - grep -E "WARNING|ERROR|FATAL" $TheFileReference | grep -v " [Ss]unday conditions" > ${ThisFileReference}_stripped - grep -Ei "Application Manager Finalized successfully" $TheFileReference >> ${ThisFileReference}_stripped - echo "Current Job" > TheLogs - echo -n " INFO " >> TheLogs - grep " INFO " ${TheFile} | wc -l >> TheLogs - grep " INFO " ${TheFile} | gawk '{print $1 " " $2 }' | sort | uniq -c | sort -nr | head -10 >> TheLogs - grep " DEBUG " ${TheFile} >> TheLogs - grep " VERBOSE " ${TheFile} >> TheLogs - - diff ${ThisFileReference}_stripped ${TheFile}_stripped > TheDiff - if [ $? -ne 0 ] - then - echo " FAILURE Files differ " - cat TheDiff - Result=1 - else - echo " Ok" - fi - echo - echo - echo "count of INFO, DEBUG and VERBOSE messages:" - grep -A8000 "^Referencefile" $TheFileReference | diff -y TheLogs - -# /bin/rm -f TheDiff ${TheFile}_stripped ${TheFileReference}_stripped - fi - fi - done - return $Result -# - - diff --git a/Reconstruction/RecExample/RecExCommon/Testing/Reference_RecExCommonTesting.log b/Reconstruction/RecExample/RecExCommon/Testing/Reference_RecExCommonTesting.log deleted file mode 100755 index e96dd229e3df667b42d09b5974023a7488a46856..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/Reference_RecExCommonTesting.log +++ /dev/null @@ -1,521 +0,0 @@ -Py:ConfigurableDb WARNING Found 1 duplicates among the 10 genConfDb files : -Py:ConfigurableDb WARNING -------------------------------------------------- -Py:ConfigurableDb WARNING -<component name>: <module> - [ <duplicates> ] -Py:ConfigurableDb WARNING -------------------------------------------------- -Py:ConfigurableDb WARNING -LArDigits2Ntuple: LArCalibTools.LArCalibToolsConf - ['LArEventTest.LArEventTestConf'] -Py:ConfigurableDb WARNING Fix your cmt/requirements file !! -Py:DetStatusSvc_CondDB.py WARNING Use of DetStatusSvc DEPRECATED for Run 2; this file will go away soon -Py:SystemRec_config WARNING Could not access 'jobproperties.FastSimulation.doFatrasID'. Assume regular reco job -Py:CaloCellGetter::configure: WARNING Trigger is switched off. Can't run deadOTX correction. -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt4LCTopoJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt10LCTopoJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt4EMTopoJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt4PV0TrackJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt3PV0TrackJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt2PV0TrackJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt10TruthWZJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -Py:Configurable WARNING unlock() called on configurable "ToolSvc.AntiKt4TruthWZJets" in /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc6-gcc48-opt/20.1.5/AtlasReconstruction/20.1.5/InstallArea/jobOptions/BTagging/BTagging_jobOptions.py -ChronoAuditor WARNING Property CustomEventTypes is deprecated, use EventTypes instead -PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml via PathResolver, check your DATAPATH variable -AthenaPoolCnvSvc WARNING Files larger than 10GB are disallowed by ATLAS policy. -AthenaPoolCnvSvc WARNING They should only be produced for private use or in special cases. -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -TRT_StrawStatusSummarySvc WARNING TRT_StrawStatusSummarySvc::getStatusHT, strawstatusHTcontainer == 0, dead straws not set -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -TRT_StrawStatusSummarySvc WARNING TRT_StrawStatusSummarySvc::getStatusHT, strawstatusHTcontainer == 0, dead straws not set -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -TRT_StrawStatusSummarySvc WARNING TRT_StrawStatusSummarySvc::getStatusHT, strawstatusHTcontainer == 0, dead straws not set -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -TRT_StrawStatusSummarySvc WARNING TRT_StrawStatusSummarySvc::getStatusHT, strawstatusHTcontainer == 0, dead straws not set -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -TRT_StrawStatusSummarySvc WARNING TRT_StrawStatusSummarySvc::getStatusHT, strawstatusHTcontainer == 0, dead straws not set -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -DataProxy WARNING accessData: conversion failed for data object 1112780409//TRT/Cond/StatusHT -PixelDetectorManager WARNING Cannot set AlignableTransform for identifier [2.1.-4.0.0.0.0.0] at level 1 -PixelDetectorManager WARNING Subsequent WARNINGS will be printed at DEBUG level. -DetectorStore WARNING retrieve(non-const): No valid proxy for object I_LINE_CORR_updates of type CscInternalAlignmentMapContainer(CLID 1285567354) -DetectorStore WARNING record_impl: you are recording an object with key A_LINE_CORR_updates, type ALineMapContainer (CLID 1324994866) -DetectorStore WARNING record_impl: you are recording an object with key B_LINE_CORR_updates, type BLineMapContainer (CLID 1124991377) -MGM::MuonDetectorManager::updateAlignment WARNING Empty temporary A-line container - nothing to do here -DetectorStore WARNING record_impl: you are recording an object with key keyMDT, type MuonMDT_CablingMap (CLID 51038731) -StoreGateSvc WARNING retrieve(const): No valid proxy for object Lucid_Digits of type LUCID_DigitContainer(CLID 17191) -LUCID_DigitRawDataCnv WARNING BAD DATA!!! Input data does not include Lucid_Digits -ToolSvc.MuidRefitTool WARNING No sector selected -ToolSvc.TrackDepositInCaloTool WARNING Extrapolation to solenoid did not succeed! -StoreGateSvc WARNING retrieve(const): No valid proxy for object Lucid_Digits of type LUCID_DigitContainer(CLID 17191) -LUCID_DigitRawDataCnv WARNING BAD DATA!!! Input data does not include Lucid_Digits -StoreGateSvc WARNING retrieve(const): No valid proxy for object Lucid_Digits of type LUCID_DigitContainer(CLID 17191) -LUCID_DigitRawDataCnv WARNING BAD DATA!!! Input data does not include Lucid_Digits -ToolSvc.iPatFitter WARNING addMeasurements: skip measurement as fail to intersect associated surface from given starting parameters -ToolSvc.iPatFitter WARNING addMeasurements: skip measurement as fail to intersect associated surface from given starting parameters -StoreGateSvc WARNING retrieve(const): No valid proxy for object Lucid_Digits of type LUCID_DigitContainer(CLID 17191) -LUCID_DigitRawDataCnv WARNING BAD DATA!!! Input data does not include Lucid_Digits -AtRanluxGenSvc WARNING INITIALISING StauTool stream with DEFAULT seeds 3591 2309736 -StoreGateSvc WARNING retrieve(const): No valid proxy for object Lucid_Digits of type LUCID_DigitContainer(CLID 17191) -LUCID_DigitRawDataCnv WARNING BAD DATA!!! Input data does not include Lucid_Digits -ToolSvc.EMExtrapolationTools WARNING Could not create an extension for Track Pt 650.7 Track Eta -1.12469 Track Fitter 5 isTRT 0 Extrapolate From 0 -ToolSvc.EMExtrapolationTools WARNING Could not create an extension for Track Pt 650.7 Track Eta -1.12469 Track Fitter 5 isTRT 0 Extrapolate From 0 -ToolSvc.EMExtrapolationTools WARNING Could not create an extension for Track Pt 423.632 Track Eta 1.08711 Track Fitter 5 isTRT 0 Extrapolate From 0 -ToolSvc.iPatFitter WARNING addMeasurements: skip measurement as fail to intersect associated surface from given starting parameters -ToolSvc.iPatFitter WARNING addMeasurements: skip measurement as fail to intersect associated surface from given starting parameters -ToolSvc.iPatFitter WARNING addMeasurements: skip measurement as fail to intersect associated surface from given starting parameters -eflowEMCaloObjectBuilder.eflowTrackCaloExtensio...WARNING TrackExtension failed for track with pt and eta 650.7 and -1.12469 -IOVDbSvc WARNING Folder /PIXEL/DCS/FSMSTATE is requested but no data retrieved -IOVDbSvc WARNING Folder /PIXEL/DCS/FSMSTATUS is requested but no data retrieved -IOVDbSvc WARNING Folder /PIXEL/DCS/HV is requested but no data retrieved -IOVDbSvc WARNING Folder /PIXEL/DCS/TEMPERATURE is requested but no data retrieved -IOVDbSvc WARNING Folder /PIXEL/ReadoutSpeed is requested but no data retrieved -IOVDbSvc WARNING Folder /TILE/OFL02/NOISE/AUTOCR is requested but no data retrieved -IOVDbSvc WARNING Folder /TILE/OFL02/PULSESHAPE/PHY is requested but no data retrieved -IOVDbSvc WARNING Folder /TILE/ONL01/FILTER/OF2/PHY is requested but no data retrieved -IOVDbSvc WARNING Folder /TRT/Calib/PID is requested but no data retrieved -IOVDbSvc WARNING Folder /TRT/Calib/PID_RToT is requested but no data retrieved -IOVDbSvc WARNING Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBias is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBiasAverage is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Pedestal is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/fSampl is requested but no data retrieved -ToolSvc.iPatFitter INFO summary of WARNING occurences (maximum shown during job: 10): - AtRanluxGenSvc | WARNING | 1 - AthenaPoolCnvSvc | WARNING | 2 - ChronoAuditor | WARNING | 1 - DataProxy | WARNING | 416 - DetectorStore | WARNING | 4 - IOVDbSvc | WARNING | 18 - LUCID_DigitRawDataCnv | WARNING | 5 - MGM::MuonDetectorManager::updateAlignment| WARNING | 1 - PixelDetectorManager | WARNING | 2 - PoolSvc | WARNING | 1 - StoreGateSvc | WARNING | 5 - TRT_StrawStatusSummarySvc | WARNING | 5 - ToolSvc.EMExtrapolationTools| WARNING | 3 - ToolSvc.MuidRefitTool | WARNING | 1 - ToolSvc.TrackDepositInCaloTool| WARNING | 1 - ToolSvc.iPatFitter | WARNING | 5 - eflowEMCaloObjectBuilder.eflowTrackCaloExtensionTool| WARNING | 1 -ApplicationMgr INFO Application Manager Finalized successfully -Referencefile - INFO 16109 - 531 ToolSvc.egammaSwTool.CaloRunClusterCorrectionsE... INFO - 489 IOVDbSvc INFO - 361 ItemListSvc INFO - 291 Py:JobProperty :: - 189 ToolSvc.AntiKt4LCTopoJets INFO - 189 ToolSvc.AntiKt4EMTopoJets INFO - 187 ToolSvc.AntiKt10LCTopoJets INFO - 185 ToolSvc.CamKt12LCTopoJets INFO - 176 ToolSvc.AntiKt4EMPFlowJets INFO - 136 ToolSvc.AntiKt4PV0TrackJets INFO -TrackCollectionCnv VERBOSE TrackCollectionCnv::initialize() diff --git a/Reconstruction/RecExample/RecExCommon/Testing/Reference_result_check b/Reconstruction/RecExample/RecExCommon/Testing/Reference_result_check deleted file mode 100755 index db808c6da202014ea8fa71b9adf4dce1fa750aa1..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/Reference_result_check +++ /dev/null @@ -1,4 +0,0 @@ -*Running script_post_check.sh - Compare output file with reference one --------->Comparing RecExCommonTesting.log - Ok diff --git a/Reconstruction/RecExample/RecExCommon/Testing/commonconfig.py b/Reconstruction/RecExample/RecExCommon/Testing/commonconfig.py deleted file mode 100644 index 4308bf1f629a73988d43e7b6ce070253e597dc46..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/commonconfig.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -doiPatRec=False -doNameAuditor=True -doWriteESD=False -doAOD=False -doWriteAOD=False -doWriteTAG=False -doDumpPoolInputContent=True -doDumpProperties=True -doDumpTES=True -doDetailedAuditor=True -doCBNT=False - diff --git a/Reconstruction/RecExample/RecExCommon/Testing/makeNewRef.sh b/Reconstruction/RecExample/RecExCommon/Testing/makeNewRef.sh deleted file mode 100755 index 0ddf5db5e6c4505f249fb79b9623176108e6baa7..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/makeNewRef.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -gmake check - -cat ../run/RecExCommonTesting.log_stripped ../run/TheLogs | \ - sed "s/^Current Job/Referencefile/g" > ../run/newRef diff --git a/Reconstruction/RecExample/RecExCommon/Testing/many-reco-tests.py b/Reconstruction/RecExample/RecExCommon/Testing/many-reco-tests.py deleted file mode 100755 index 1c1364fc5e87963566dc86c203aba6dd767988e6..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/many-reco-tests.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__version__ = "$Revision: 270687 $" -__author__ = "Sebastien Binet" -__doc__ = "run many reco tests to prevent regressions" - -### imports ------------------------------------------------------------------- -import os -#import subprocess -import textwrap - -import ruffus -from PyUtils.bwdcompat import subprocess - -### functions ----------------------------------------------------------------- - -def run_athena(cmds, ctxt): - msg = ctxt['msg'] - msg.info(":"*80) - msg.info('running test: [%s]', ctxt['title']) - log_file = open("def_%(step_in)sto%(step_out)s_%(suffix)s.log" % ctxt, - 'w+b') - msg.info('logging into [%s]', log_file.name) - - call = subprocess.call - cmd = ["time", "athena.py", "-s", "-c"] - oneliner = [] - for c in cmds: - oneliner.append(c % ctxt) - cmd.append('\"'+"; ".join(oneliner)+'\"') - msg.info("starting... [%s]", subprocess.getoutput('date')) - - #print "==> %r" % cmd - rc = call(cmd, stdout=log_file, stderr=log_file) - log_file.flush() - log_file.seek(0) - stats = {'user_time': None, - 'sys_time': None, - 'real_time': None, - 'cpu_util': None} - - import re - pattern = re.compile(r'(?P<user_time>.*?)user ' - '(?P<sys_time>.*?)system ' - '(?P<real_time>.*?)elapsed ' - '(?P<cpu_util>.*?)CPU .*?') - for line in log_file: - m = re.match(pattern, line) - if m: - stats.update(m.groupdict()) - break - for k in ('user_time', 'sys_time', 'real_time',): - msg.info('%10s: %ss', k, stats[k]) - k = 'cpu_util' - msg.info('%10s: %s', k, stats[k]) - - log_file.close() - msg.info(":"*80) - return rc, stats - - -def main(): - suffix = os.environ.get('SUFF', 'test1') - nevts = int(os.environ.get('NEVT', '5')) - - import PyUtils.Logging as L - msg = L.logging.getLogger('reco-tests') - msg.setLevel(L.logging.INFO) - - msg.info('suffix used: [%s]', suffix) - msg.info('number of events reconstructed: [%s]', nevts) - - subprocess.check_call("setupLocalDBReplica_CERN.sh", - stdout=open('/dev/null','w')) - - run_athena( - cmds=textwrap.dedent( - """ - from RecExConfig.RecFlags import rec - rec.OutputSuffix='_%(suffix)s' - doDumpProperties = True - RootNtupleOutput = 'ntuple_def_%(step_in)sto%(step_out)s_%(suffix)s.root' - EvtMax = %(nevts)s - doNameAuditor = True - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf - acf.FilesInput = ['LFN:top_GEO-02-01-00_RDO_extract.pool'] - doWriteESD = True - doAOD = False - doWriteAOD = False - doWriteTAG = False - PoolESDOutput = 'def_%(step_in)sto%(step_out)s_%(suffix)s.ESD.pool.root' - doDumpPoolInputContent = True - doDumpTES = True - """).splitlines(), - ctxt={ - 'title' : 'default file write esd', - 'msg': msg, - 'step_in': 'rdo', - 'step_out': 'esd', - 'suffix': suffix, - 'nevts': nevts, - } - ) - - return 0 - -if __name__ == "__main__": - import sys - sys.exit(main()) - diff --git a/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests.sh b/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests.sh deleted file mode 100755 index ae309b7f9a86d7c14651ba4e5f28fdbb9f96507d..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests.sh +++ /dev/null @@ -1,95 +0,0 @@ -# set default value if not set -# using parameters substitution operator -export SUFF=${SUFF-_test1} -export NEVT=${NEVT-5} - - -echo "suffix used : " $SUFF -echo "number of events reconstructed : " $NEVT - - -echo " default file write esd" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['LFN:top_GEO-10-00-00_RDO_extract.pool'] ; doWriteESD=True ; doAOD=False ; doWriteAOD=False ; doWriteTAG=False ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_rdotoesd$SUFF.log - - -echo " default read esd write AOD " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_esdtoaod$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_rdotoesd$SUFF.ESD.pool.root'] ; doWriteTAG=False ; PoolAODOutput='def_esdtoaod$SUFF.AOD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_esdtoaod$SUFF.log - -echo " default read esd write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_esdtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_rdotoesd$SUFF.ESD.pool.root'] ; doAOD=False ; doWriteAOD=False ; doWriteTAG=False ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_esdtocbnt$SUFF.log - - - -echo " default read AOD write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_aodtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_esdtoaod$SUFF.AOD.pool.root'] ; doWriteTAG=False ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_aodtocbnt$SUFF.log - - - -echo " default read AOD write tag " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_aodtotag$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_esdtoaod$SUFF.AOD.pool.root'] ; PoolTAGOutput='def_aodtotag$SUFF.TAG.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_aodtotag$SUFF.log - - -echo " default read TAG (from AOD) write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_tagtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_aodtotag$SUFF.TAG.pool.root'] ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_tagtocbnt$SUFF.log - - - -echo " def do all " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_all$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['LFN:top_GEO-10-00-00_RDO_extract.pool'] ; rec.doAOD.set_Value_and_Lock(True) ; rec.doWriteTAG.set_Value_and_Lock(True) ; PoolESDOutput='def_all$SUFF.ESD.pool.root' ; PoolAODOutput='def_all$SUFF.AOD.pool.root' ; PoolTAGOutput='def_all$SUFF.TAG.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_all$SUFF.log - - -echo " default file RDO to BS" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['LFN:top_GEO-10-00-00_RDO_extract.pool'] ; doESD=False ; doCBNT=False ; doWriteRDO=False ; doESD=False ; doWriteESD=False ; doWriteAOD=False ; doAOD=False ; doWriteTAG=False ; doWriteBS=True ; doTrigger=True ; EvtMax=$NEVT ; doDumpTES=True ; BSRDOOutput='AppName=Athena$SUFF,' " >& def_rdotobs$SUFF.log - - -echo " default file read BS write ESD" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_bstoesd$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['data_test.00105200.Single_Stream.daq.RAW._lb0000._Athena$SUFF._0001.data'] ; PoolESDOutput='def_bstoesd$SUFF.ESD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_bstoesd$SUFF.log - -echo " default read esd from BS write AOD " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_bstoesdtoaod$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ; athenaCommonFlags.FilesInput=['def_bstoesd$SUFF.ESD.pool.root'] ; PoolAODOutput='def_bstoesdtoaod$SUFF.AOD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_bstoesdtoaod$SUFF.log - - - - -#time athena.py -s -c "RootNtupleOutput='ntuple_dc2_lumi10$SUFF.root' ; DetDescrVersion='DC2' ; EvtMax=2 ; from AthenaCommon.GlobalFlags import GlobalFlags ; GlobalFlags.Luminosity.set_high() ; PoolRDOInput = ['LFN:zmumu_highlumi_RDO.pool'] ; from AthenaCommon.DetFlags import DetFlags ; DetFlags.Muon_setOff() ; doWriteESD=True ; PoolESDOutput='dc2_lumi10$SUFF.ESD.pool.root'; PoolAODOutput='dc2_lumi10$SUFF.AOD.pool.root' ; PoolTAGOutput='dc2_lumi10$SUFF.TAG' ; doDumpPoolInputContent=True " >& dc2_lumi10$SUFF.log -#date - - -sumfile=summary$SUFF.txt -rm -f $sumfile -touch $sumfile - -grep -e "processing event" -e "leaving with" *$SUFF.log | tee -a $sumfile -echo "****************************************************" >> $sumfile -grep -B 5 -A 20 Traceback *$SUFF.log | tee -a $sumfile -echo "****************************************************" >> $sumfile -grep -B 1 " ERROR " *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile -grep -A 15 "unchecked return" *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile -grep -B 1 WARNING *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile - -grep -i virtual *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile - - - - -checklog.py *$SUFF.log >> $sumfile - -echo "Tests completed ! \a" -echo "\a" diff --git a/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests_noautoconf.sh b/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests_noautoconf.sh deleted file mode 100755 index 55b14e6703c3f6d65b73b6c0b907419d080733b9..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/manyrecotests_noautoconf.sh +++ /dev/null @@ -1,97 +0,0 @@ -# set default value if not set -# using parameters substitution operator -export SUFF=${SUFF-_test1} -export NEVT=${NEVT-5} - - -echo "suffix used : " $SUFF -echo "number of events reconstructed : " $NEVT - - -echo " default file write esd" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; doWriteESD=True ; doAOD=False ; doWriteAOD=False ; doWriteTAG=False ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_rdotoesd$SUFF.log - - -echo " default read esd write AOD " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_esdtoaod$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readESD=True ; doAOD=True ; doWriteAOD=True ; doWriteESD=False ; doWriteTAG=False ; PoolESDInput=['def_rdotoesd$SUFF.ESD.pool.root'] ; PoolAODOutput='def_esdtoaod$SUFF.AOD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_esdtoaod$SUFF.log - -echo " default read esd write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_esdtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readESD=True ; doAOD=False ; doWriteAOD=False ; doWriteESD=False ; doWriteTAG=False ; PoolESDInput=['def_rdotoesd$SUFF.ESD.pool.root'] ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_esdtocbnt$SUFF.log - - - - - -echo " default read AOD write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_aodtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readESD=False ; readAOD=True ; doAOD=False ; doWriteESD=False ; doWriteAOD=False ; doWriteTAG=False ; PoolAODInput=['def_esdtoaod$SUFF.AOD.pool.root'] ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_aodtocbnt$SUFF.log - - - -echo " default read AOD write tag " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_aodtotag$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readESD=False ; readAOD=True ; doAOD=False ; doWriteESD=False ; doWriteAOD=False ; doWriteTAG=True ; PoolAODInput=['def_esdtoaod$SUFF.AOD.pool.root'] ; PoolTAGOutput='def_aodtotag$SUFF.TAG.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_aodtotag$SUFF.log - - -echo " default read TAG (from AOD) write CBNT " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_tagtocbnt$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readAOD=True ; readTAG=True ; doAOD=False ; doWriteESD=False ; doWriteAOD=False ; doWriteTAG=False ; PoolTAGInput=['def_aodtotag$SUFF.TAG.pool.root'] ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_tagtocbnt$SUFF.log - - - -echo " def do all " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_all$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; PoolESDOutput='def_all$SUFF.ESD.pool.root' ; PoolAODOutput='def_all$SUFF.AOD.pool.root' ; PoolTAGOutput='def_all$SUFF.TAG.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_all$SUFF.log - - -echo " default file RDO to BS" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; doESD=False ; doCBNT=False ; doWriteRDO=False ; doESD=False ; doWriteESD=False ; doWriteAOD=False ; doAOD=False ; doWriteTAG=False ; doWriteBS=True ; doTrigger=True ; EvtMax=$NEVT ; doNameAuditor=True ; doDumpTES=True ; BSRDOOutput='AppName=Athena$SUFF,' " >& def_rdotobs$SUFF.log - - -echo " default file read BS write ESD" -date -# add to remove doShowSizeStatistics=True ; -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_bstoesd$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; doWriteESD=True ; doAOD=False ; doWriteRDO=False ; doWriteTAG=False ; from AthenaCommon.GlobalFlags import globalflags ; globalflags.InputFormat='bytestream' ; globalflags.ConditionsTag='OFLCOND-CSC-00-01-00' ; BSRDOInput=['data_test.00005200.Single_Stream.daq.RAW._lb0000._Athena$SUFF._0001.data'] ; PoolESDOutput='def_bstoesd$SUFF.ESD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_bstoesd$SUFF.log - -echo " default read esd from BS write AOD " -date -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_bstoesdtoaod$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; readESD=True ; doAOD=True ; doWriteAOD=True ; doWriteESD=False ; doWriteTAG=False ; PoolESDInput=['def_bstoesd$SUFF.ESD.pool.root'] ; PoolAODOutput='def_bstoesdtoaod$SUFF.AOD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True " >& def_bstoesdtoaod$SUFF.log - - - - -#time athena.py -s -c "RootNtupleOutput='ntuple_dc2_lumi10$SUFF.root' ; DetDescrVersion='DC2' ; EvtMax=2 ; from AthenaCommon.GlobalFlags import GlobalFlags ; GlobalFlags.Luminosity.set_high() ; PoolRDOInput = ['LFN:zmumu_highlumi_RDO.pool'] ; from AthenaCommon.DetFlags import DetFlags ; DetFlags.Muon_setOff() ; doWriteESD=True ; PoolESDOutput='dc2_lumi10$SUFF.ESD.pool.root'; PoolAODOutput='dc2_lumi10$SUFF.AOD.pool.root' ; PoolTAGOutput='dc2_lumi10$SUFF.TAG' ; doDumpPoolInputContent=True " >& dc2_lumi10$SUFF.log -#date - - -sumfile=summary$SUFF.txt -rm -f $sumfile -touch $sumfile - -grep -e "processing event" -e "leaving with" *$SUFF.log | tee -a $sumfile -echo "****************************************************" >> $sumfile -grep -B 5 -A 20 Traceback *$SUFF.log | tee -a $sumfile -echo "****************************************************" >> $sumfile -grep -B 1 " ERROR " *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile -grep -A 15 "unchecked return" *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile -grep -B 1 WARNING *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile - -grep -i virtual *$SUFF.log >> $sumfile -echo "****************************************************" >> $sumfile - - - - -checklog.py *$SUFF.log >> $sumfile - -echo "Tests completed ! \a" -echo "\a" diff --git a/Reconstruction/RecExample/RecExCommon/Testing/multirecodomain.sh b/Reconstruction/RecExample/RecExCommon/Testing/multirecodomain.sh deleted file mode 100755 index c656a487e7d3062b07b0c11dd3fb58e4640aadc8..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/multirecodomain.sh +++ /dev/null @@ -1,71 +0,0 @@ -export NEVT=5 -export COMMONSUFF="_noesd" - -cat commonconfig.py - -export SUFF=_nothing$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=False; rec.doInDet=False ; rec.doMuon=False ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - -export SUFF=_muon$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=False; rec.doInDet=False ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - - -export SUFF=_calo$COMMONSUFF -echo $SUFF -time athena.py -s -c " from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=False ; rec.doMuon=False ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - -export SUFF=_indet$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=False; rec.doInDet=True ; rec.doMuon=False ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - -export SUFF=_idmuon$COMMONSUFF -echo $SUFF -time athena.py -s -c " from RecExConfig.RecFlags import rec; rec.doCalo=False; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - -export SUFF=_idmuoncalo$COMMONSUFF -echo $SUFF -time athena.py -s -c "doiPatRec=False ; from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; doDumpProperties=True ; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; doNameAuditor=True ; doWriteESD=True ; doAOD=False ; doWriteAOD=False ; doWriteTAG=False ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' ; doDumpPoolInputContent=True ; doDumpTES=True ; doDetailedAuditor=True ; doCBNT=False " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - - -export SUFF=_idmuoncalomuoncombined$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=False ; rec.doMuonCombined=True ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - -export SUFF=_idmuoncaloegamma$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=True ; rec.doMuonCombined=False ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - - -export SUFF=_idmuoncaloegammamucomb$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=False ; rec.doEgamma=True ; rec.doMuonCombined=True ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - -export SUFF=_idmuoncaloegammamucombjet$COMMONSUFF -echo $SUFF -time athena.py -s -c " from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=True ; rec.doEgamma=True ; rec.doMuonCombined=True ; rec.doTau=False ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' ; " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - -export SUFF=_idmuoncaloegammamucombjettau$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=True ; rec.doEgamma=True ; rec.doMuonCombined=True ; rec.doTau=True ; rec.doTrigger=False ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' ; " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - -export SUFF=_idmuoncaloegammamucombjettautrig$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=True ; rec.doEgamma=True ; rec.doMuonCombined=True ; rec.doTau=True ; rec.doTrigger=True ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py myTopOptions.py >& def_rdotoesd$SUFF.log - - - -export SUFF=_all_plusesd$COMMONSUFF -echo $SUFF -time athena.py -s -c "from RecExConfig.RecFlags import rec; rec.doCalo=True; rec.doInDet=True ; rec.doMuon=True ; rec.doJetMissingETTag=True ; rec.doEgamma=True ; rec.doMuonCombined=True ; rec.doTau=True ; rec.doTrigger=True ; rec.OutputSuffix='$SUFF'; RootNtupleOutput='ntuple_def_rdotoesd$SUFF.root' ; EvtMax=$NEVT ; PoolESDOutput='def_rdotoesd$SUFF.ESD.pool.root' " commonconfig.py reenable.py myTopOptions.py >& def_rdotoesd$SUFF.log - - diff --git a/Reconstruction/RecExample/RecExCommon/Testing/reenable.py b/Reconstruction/RecExample/RecExCommon/Testing/reenable.py deleted file mode 100644 index f45b6b3ed37ea45916102d2c91901944fe2b2059..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/reenable.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -doWriteESD=True diff --git a/Reconstruction/RecExample/RecExCommon/Testing/script_post_check.sh b/Reconstruction/RecExample/RecExCommon/Testing/script_post_check.sh deleted file mode 100755 index 1c3474eca64aaea183ef3c463a8ae8e22554061c..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/script_post_check.sh +++ /dev/null @@ -1,15 +0,0 @@ -echo "Starting script_post_check.sh" -# -echo "Starting script_post_check.sh" -# - -# -echo "## Comparing : " -echo "> < Reference log file " -echo "> > New log file " -source ../Testing/CompareFiles.sh RecExCommonTesting.log -if [ $? -ne 0 ] ; then - echo "FAILURE log file differ significantly from reference log file " -else - echo "SUCCESS : log file does not differ significantly from reference log file " -fi \ No newline at end of file diff --git a/Reconstruction/RecExample/RecExCommon/Testing/script_pre_check.sh b/Reconstruction/RecExample/RecExCommon/Testing/script_pre_check.sh deleted file mode 100755 index 807fa90cd8b6d36c129302b79a356e670e03732b..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/script_pre_check.sh +++ /dev/null @@ -1,18 +0,0 @@ -# - echo "Starting script_pre_check.sh" -# -#Cleaning - -echo "## cleaning" - /bin/rm -f *stripped - /bin/rm -f RecExCommonTesting.log - - -echo "## setting up run time files" - RecExCommon_links.sh - -# - -echo "## ready to run" - -env > enviroment.log diff --git a/Reconstruction/RecExample/RecExCommon/Testing/trfmultirecodomain.sh b/Reconstruction/RecExample/RecExCommon/Testing/trfmultirecodomain.sh deleted file mode 100755 index b8cafd94525ee6ed8a5e26fea5903d0772d165af..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/Testing/trfmultirecodomain.sh +++ /dev/null @@ -1,93 +0,0 @@ - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" - -SUFF='nothing' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=False',,'rec.doInDet=False',,'rec.doMuon=False',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='id' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=False',,'rec.doInDet=True',,'rec.doMuon=False',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='calo' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doInDet=False',,'rec.doMuon=False',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='muon' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=False',,'rec.doInDet=False',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuon' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=False',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalo' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=False' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrig' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigmuoncombined' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=False',,'rec.doMuonCombined=True',,'rec.doTau=False',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegamma' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=True',,'rec.doMuonCombined=False',,'rec.doTau=False',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_idmuoncalotrigegamma.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegammamucomb' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=False',,'rec.doEgamma=True',,'rec.doMuonCombined=True',,'rec.doTau=False',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegammamucombjet' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=True',,'rec.doEgamma=True',,'rec.doMuonCombined=True',,'rec.doTau=False',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegammamucombjettau' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=True',,'rec.doEgamma=True',,'rec.doMuonCombined=True',,'rec.doTau=True',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py --ignoreunknown --athenaopts=-s > rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegammamucombjettaumon' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=True',,'rec.doEgamma=True',,'rec.doMuonCombined=True',,'rec.doTau=True',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py HIST=myMergedMonitoring.root --ignoreunknown --athenaopts=-s >! rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='idmuoncalotrigegammamucombjettaumonmuoncalib' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preExec='rec.doCalo=True',,'rec.doInDet=True',,'rec.doMuon=True',,'rec.doJetMissingETTag=True',,'rec.doEgamma=True',,'rec.doMuonCombined=True',,'rec.doTau=True',,'rec.doTrigger=True' preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py outputMuonCalibNtup=muonCalib.root HIST=myMergedMonitoring.root --ignoreunknown --athenaopts=-s >! rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log - -echo "\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" -SUFF='all' -echo $SUFF -time Reco_trf.py inputBSFile=/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data maxEvents=10 trigStream=IDCosmic autoConfiguration=FieldAndGeo,BeamType,ConditionsTag preInclude=RecExCommon/RecoUsefulFlags.py,RecExCommission/RecExCommissionRepro.py,RecExCommission/MinimalCommissioningSetup.py,RecJobTransforms/debugConfig.py,RecJobTransforms/UseOracle.py postInclude=RecJobTransforms/reducedRegionSelectorPostConfig.py outputESDFile=myESD.pool.root outputMuonCalibNtup=muonCalib.root HIST=myMergedMonitoring.root RAW_IDPROJCOMM=IDPROJCOMM._0001.data outputTAGComm=myTAGCOMM.root --ignoreunknown --athenaopts=-s >! rawtoesd_$SUFF.log -grep -e "so far" -e "Leaving with" -e "JobTransform completed" rawtoesd_$SUFF.log diff --git a/Reconstruction/RecExample/RecExCommon/doc/athenarec.sh b/Reconstruction/RecExample/RecExCommon/doc/athenarec.sh deleted file mode 100755 index 69b1d06ce9601a2ed9a7532ec572dfdb7dc9dab9..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/doc/athenarec.sh +++ /dev/null @@ -1,466 +0,0 @@ -#!/usr/local/bin/zsh -#################################################################### -# script to run athena reconstruction in batch -# David Rousseau, Dec 2002 -# distilled from examples by Jorgen Beck Hansen,Elzbieta Richter-Was, Samira Hassani. -# Modifications : -# DR May 2006 : Adapt to project build -# DR January 2005 : do not build anymore RecExCommon package -# DR April 2005 : cannot read zebra data anymore -# look for MUSTBEMODIFIED for mandatory modification -# This run the standard RecExCommon package, taken either directly -# from a release or from a user area (if USERAREA is defined). -# The code which is run is by default taken directly from the release -# but modified packages can be used if properly recompiled in -# a USERAREA -# New packages can also be used if USERAREA is defined. -# The data processed are either DC1 files taken directly from castor, -# only for geant3 !something similar to be done for geant4 (volunteer?) -# or any other data file if soft links are constructed by hand. -# It is possible to run on several files within the same job. -# -# Be careful that the script is loaded ONLY when the job starts, not -# when the job is submitted, so avoid to modify the script -# before the job starts. -# -# Note on timing: the time allocation for the queues are normalised -# to a 500Mhz machine (for more powerful machine it is scaled down -# by 500/<frequency>) (the frequency appear in the output) -# The time indicated at the beginning of the output: -#Resource usage summary: -# -# CPU time : 239.54 sec. -# is *NOT* normalized. -# -#The time indicated at the end of the output: -#CERN statistics: This job used 0:06:22 NCU hours (382 NCU seconds) -# *IS* normalised. -#The time indicated in athena output is *NOT* normalised -# -# -################################################################### -# Arguments : 1 string which will be append to ntuple and log file -# 2 string specifying where to take the data simul/lumi02/lumi10 -# 3,4,5 data set number, first and last file to process -#################################################################### -# Examples : -# run RecExCommon out of the box -# bsub -q 8nm -o athenarec.log -J athenarec athenarec.sh test1 -# run on DC1 data set 001003 files number 5 to 10 -#bsub -q 8nh -o athenarec.log -J athenarec athenarec.sh prod1 lumi02 001003 5 10 -# run on files specified in script (by default ZEBRA_HEEMM -#bsub -q 8nm -o athenarec.log -J athenarec athenarec.sh prod1 -# one can also use the subm.sh script: -# subm.sh 8nh athenarec prod1 lumi02 001003 1 10 -#################################################################### -# -# ------------------------------------------------------------ # -#set -x - - -unset USERAREA -unset VALGRIND -unset BUGFIX -unset VAL -#this line should be modified to point to the user area -export HOMEDIR=${HOME} - -#if USERAREA is set, packages checked out and possibly modified -# by the user will be used directly from batch (without recompilation). -# (They should have -# been compiled against the release being used and should not be -# modified when the job is running) -# export USERAREA=$HOMEDIR/maxi/test3 - -#output directory for ntuples, this can be castor -#export OUTPUTHIS=/castor/cern.ch/user/j/joe -#MUSTBEMODIFIED -export OUTPUTHIS=$HOMEDIR/scratch0/output/his -#output directory for log file, this can be castor -#MUSTBEMODIFIED -export OUTPUTLOG=$HOMEDIR/scratch0/output/log -# specify "project" or "replica" in castor (only for DC1 data) -#export PROREP=project -#export PROREP=replica -#specify release to be used - -#CANBEMODIFIED -# specify release 11.0.42 or 11.5.0 etc.... (automatically adapt to project build) -# can also be rel_0 rel_1 etc for nightly build -export RELEASE=13.0.30 -# uncomment if use production cache or pcache nightly -export PCACHE=13.0.30.1 -# uncomment for X.0.Y bugfix nightlies -#export BUGFIX=bugfix -# uncomment for X.0.Y bugfix nightlies -#export VAL=val - - - -#maximum number of event processed in the job (default is 10) -export EVTMAX=-1 -#export EVTMAX=5 - - -# on geant4 a non-tunable, mechanism is used to stop the job: -# if time left is less -# than 3 times the average time, the job is stopped - -# 1 if data file defined in this script -export SPECIALDATA=0 - -#if valgrind to be used (not recently tested) -# valgrind is a tool to find memory leaks and other run time error. -# it is rather slow so if switched on, it is suggested to run on a few events -# valgrind cannot run on castor, so it needs to be run on a file on disk -# so when valgrind is switched on : subm.sh 8nh athenarec test1 -#export VALGRIND=valgrind ; export EVTMAX=2 ; export SPECIALDATA=0 -# -#release directory -export DISTREL=/afs/cern.ch/atlas/software/dist -#cmt version - -export CMTVERSION=v1r20p20070720 - - -######################################################################### -# end of main modifiable area # -# look for "CANBEMODIFIED" for further possible modification # -######################################################################### - - - -if [ $# -eq 0 ] ; then - echo Input data files are specified directly in athena.sh - export JOBNAME=0 -elif [ $# -eq 1 ] ; then - echo Input data files are specified directly in athena.sh - export JOBNAME=$1 -elif [ $# -eq 5 ] ; then - export JOBNAME=$1_$2_$3_$4_$5 - unset DATASETNUM - export CASTORLOC=$2 - export DATASETNUM=$3 - export IFIRSTFILE=$4 - export ILASTFILE=$5 - -#directory where to take the data (obsolete) - echo CASTORLOC = $CASTORLOC - if [ $CASTORLOC = "simul" ] ; then - echo simul... - export INPUTDATA=/castor/cern.ch/atlas/$PROREP/dc1/simul/data/$DATASETNUM - elif [ $CASTORLOC = "lumi02" ] ; then - echo lumi02... - export INPUTDATA=/castor/cern.ch/atlas/$PROREP/dc1/lumi02/$DATASETNUM/data - elif [ $CASTORLOC = "lumi10" ] ; then - echo lumi10... - export INPUTDATA=/castor/cern.ch/atlas/$PROREP/dc1/lumi10/$DATASETNUM/data - else - echo Invalid value of CASTORLOC $CASTORLOC Stop. -# exit - fi - - - echo use dataset $INPUTDATA file $IFIRSTFILE to $ILASTFILE - - - -else - echo Invalid number of arguments. Stop. - exit -fi - - -# nightly build are project build - -PROJECTBUILD=1 -RELCUT=`echo $RELEASE | cut -c1-3` - -if [[ $RELCUT = "rel" ]] ; then -# nightly build are project build - NIGHTLY=1 -else - NIGHTLY=0 -fi - - - -# - -if [ $NIGHTLY -eq 0 ] ; then - TOPDIR=/afs/cern.ch/atlas/software/builds -else - TOPDIR=/afs/cern.ch/atlas/software/builds/nightlies/dev/ -fi - -FULLREL=$TOPDIR/AtlasOffline/$RELEASE - - -if [ -d "${FULLREL}" ] ; then - echo $FULLREL exists -else - echo $FULLREL does not exist. Stop. - exit -fi - - -# -echo "##working directory is:" -pwd - -#power of the processor -grep MHz /var/log/dmesg -#increase default limit for core dump -#limit coredumpsize 10M -#create clean working directory -if [ -d myjob ] ; then - echo "##delete already existing myjob directory" - rm -fR myjob -fi - -mkdir myjob -cd myjob - -# export WORKAREA=`pwd` - -mkdir cmtdir -cd cmtdir - - -rm -f requirements ; touch requirements - -echo "##set up cmt with requirements file" - - - cat <<EOF >|requirements -set CMTSITE CERN -set SITEROOT /afs/cern.ch -set ATLAS_DIST_AREA "${DISTREL}" -# do not append release number to test area -apply_tag oneTest -# -# -apply_tag setupCMT -# optimised by default -apply_tag opt -apply_tag 32 -apply_tag ${RELEASE} -use AtlasLogin AtlasLogin-* "${DISTREL}" -EOF - -if [ -n "$USERAREA" ] ; then - echo "## use user area $USERAREA" - echo 'macro ATLAS_TEST_AREA "${WORKAREA}"' >> thereq -else - echo "## do not use userarea" -fi - -if [ -n "$BUGFIX" ] ; then - echo "apply_tag $BUGFIX " >> thereq -fi - -# if pcache nightly -if [[ -n "$PCACHE" && $NIGHTLY -eq 1 ]] ; then - echo "apply_tag pcache " >> thereq -fi - -# if not using productin cache setup is done through requirements -if [[ -n "$PCACHE" && $NIGHTLY -eq 0 ]] ; then -else - echo "apply_tag setup " >> thereq -fi - -# if pcache nightly -if [ -n "$PCACHE" && $NIGHTLY -eq ]] ; then - echo "apply_tag pcache " >> thereq -fi - -if [ -n "$VAL" ] ; then - echo "apply_tag $VAL " >> thereq -fi - -echo "## main requirements file" -cat requirements - - - -CMTROOT=/afs/cern.ch/sw/contrib/CMT/$CMTVERSION; export CMTROOT -. ${CMTROOT}/mgr/setup.sh -which cmt -cmt config - -#intial cmt setup -#valgrind error message are more useful in debug mode -#otherwise use optimised (typically 4 times faster) -if [ ${(c)#VALGRIND} -eq 0 ] ; then - echo "## optimised mode" - source setup.sh -tag_add=opt -else - source setup.sh -tag_add=dbg -fi - -# set up to run on production cache -if [[ -n "$PCACHE" && $NIGHTLY -eq 0 ]] ; then - echo "## use production cache $PCACHE " - export CMTPATH=/afs/cern.ch/atlas/software/releases/$RELEASE/AtlasProduction/$PCACHE - if [ -n "$USERAREA" ] ; then - export CMTPATH=$USERAREA:$CMTPATH - fi - source /afs/cern.ch/atlas/software/releases/$RELEASE/AtlasProduction/$PCACHE/AtlasProductionRunTime/cmt/setup.sh -fi - - -echo "## CMTCONFIG=$CMTCONFIG" -echo "## CMTPATH=$CMTPATH" -cmt show path - -#back to top dir -cd .. - - - -#now fill run directory - -source RecExCommon_links.sh - - -## tune the joboptions.file -rm -f myTopOptions_tmp.py ; touch myTopOptions_tmp.py - - -## set the number of events by changing EvtMax -if [ ${(c)#EVTMAX} -ne 0 ] ; then - echo "##set EvtMax to $EVTMAX" - echo "EvtMax=$EVTMAX" >> myTopOptions_tmp.py -fi - - -## switch on LSFTimeKeeperSvc -echo "##set doTimeLimit to True" -echo "doTimeLimit=True" >> myTopOptions_tmp.py - - -#CANBEMODIFIED : change 0 to 1 if take existing joboption -if [ 0 -eq 1 ] ; then - # take existing topoption - cat ${HOMEDIR}/maxi/test2/Reconstruction/RecExample/RecExCommon/RecExCommon-00-02-62/run/nothing.py >> myTopOptions_tmp.py -else -#build joboption in the script -cat >> myTopOptions_tmp.py << EOF -# loop to give list of file number -filehint=[(1,4),(2,6),(3,4),(4,1),(5,13),(6,1),(7,4),(8,6),(9,12),(10,9)] -PoolRDOInput=[] -for t in filehint: - string0=str(t[0]) - while (len(string0)<5): - string0="0"+string0 - string1=str(t[1]) - filename="rfio:/castor/cern.ch/user/r/rtt/RTTdata/calib1_csc11.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000301/calib1_csc11.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000301_tid003138._%s.pool.root.%s" % (string0,string1) - PoolRDOInput+=["%s" % filename] - -#PoolRDOInput=[ "castor:/castor/cern.ch/user/r/rtt/RTTdata/calib1_csc11.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000301/calib1_csc11.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000301_tid003138._00001.pool.root.4" ] # input file - -#doTruth=False -#doESD=False -#doTrigger=False -#doWriteESD=False -doAOD=False -doWriteAOD=False -doWriteTAG=False -#include ("RecExCommon/RecExCommon_flags.py") -#DetFlags.Muon_setOff() -#DetFlags.ID_setOff() -#DetFlags.Calo_setOff() -include ("RecExCommon/RecExCommon_topOptions.py") -EOF -fi -## cat myTopOptions.py >> myTopOptions_tmp.py -mv -f myTopOptions_tmp.py myTopOptions.py - -#CANBEMODIFIED -#this is the place where run time files can be overwritten -# take my own topoption file -# rm -f myTopOptions.py -# -# the other option is to build directly myTopOptions.py as done below - - -echo "## myTopOptions.py:" -cat myTopOptions.py - - - -#echo "##use the following athena.py script" -#which athena.py -#echo "##PATH="$PATH -echo "##LD_LIBRARY_PATH="$LD_LIBRARY_PATH - -#echo "##list of shared libraries" -#ls -l ../$CMTCONFIG - -echo " " -echo "##now running" -echo " " - -if [ ${(c)#VALGRIND} -eq 0 ] ; then - # time athena.py -s <&- >& athena.out - time athena.py <&- >& athena.out -else - # magic line to fix oracle problem - source /afs/cern.ch/project/oracle/script/setoraenv.sh -s 10102gcc323 - time valgrind -v --leak-check=yes --leak-resolution=high --show-reachable=yes --num-callers=8 athena.py -s <&- >&! athena.out -fi - -#from John Baines allow to have traceback with gdb -#CORE=`ls core.*` -#if [ ! -z $CORE ]; then -# echo analysing core file $CORE -# export COMMAND="where -# info f -# bt -# q" -# gdb -q -n athena.exe $CORE <<<$COMMAND -# fi - - - - -echo "##list of files in run directory" -ls -l - -echo "##now copy back some files" - -if [ -z `echo $OUTPUTHIS | awk /castor/` ]; then - if [ ! -d $OUTPUTHIS ]; then - mkdir -p $OUTPUTHIS - fi -else - rfdir $OUTPUTHIS - if [ $? -ne 0 ]; then - rfmkdir -p $OUTPUTHIS - fi -fi - -if [ -z `echo $OUTPUTLOG | awk /castor/` ]; then - if [ ! -d $OUTPUTLOG ]; then - mkdir -p $OUTPUTLOG - fi -else - rfdir $OUTPUTLOG - if [ $? -ne 0 ]; then - rfmkdir -p $OUTPUTLOG - fi -fi - -echo $OUTPUTHIS/ntuple_$JOBNAME.root -rfcp ntuple.root $OUTPUTHIS/ntuple_$JOBNAME.root -echo $OUTPUTLOG/athena_$JOBNAME.log -rfcp athena.out $OUTPUTLOG/athena_$JOBNAME.log - - - -echo "## remove all files" -#rm -fR * - -# -#exit diff --git a/Reconstruction/RecExample/RecExCommon/doc/subm.sh b/Reconstruction/RecExample/RecExCommon/doc/subm.sh deleted file mode 100755 index 84a86a38579f72d2c1ebd4fb2a90fc06ba4bec7b..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/doc/subm.sh +++ /dev/null @@ -1,29 +0,0 @@ -#one line command to submit job -# submit to queue $1 script $2.sh with optional arguments $3 $4 $5 $6 $7 $8 -# job name and output is built from $2 $3 $4 $5 $6 -# requires -R " mem > 600 " to run on machine with more of 400 Mb memory -# examples -# subm.sh 8nm athenarec prod1 simul_001003 1 10 -#==> bsub -q 8nm -o athenarec_prod1_simul_001003_1_10 -Jathenarec_prod1_simul_001003_1_10 athenarec.sh prod1 simul 001003 1 10 -# subm.sh 8nm athenarec 3 -#==> bsub -q 8nm -o athenarec_3 -Jathenarec_3 athenarec.sh 3 -set -x -n=$# -if [ $n -eq 2 ] ; then - NAME=$2 -elif [ $n -eq 3 ] ; then - NAME=$2_$3 -elif [ $n -eq 4 ] ; then - NAME=$2_$3_$4 -elif [ $n -eq 5 ] ; then - NAME=$2_$3_$4_$5 -elif [ $n -ge 6 ] ; then - NAME=$2_$3_$4_$5_$6 -elif [ $n -ge 7 ] ; then - NAME=$2_$3_$4_$5_$6_$7 -elif [ $n -ge 7 ] ; then - NAME=$2_$3_$4_$5_$6_$7_$8 -fi -bsub -R " mem > 600 " -q $1 -o $NAME -J$NAME $2.sh $3 $4 $5 $6 $7 $8 - - diff --git a/Reconstruction/RecExample/RecExCommon/doc/submall.sh b/Reconstruction/RecExample/RecExCommon/doc/submall.sh deleted file mode 100755 index 19f9381d400b94d19809656ec64243ee0538e5cd..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/doc/submall.sh +++ /dev/null @@ -1,10 +0,0 @@ -#submit a set of job using subm.sh -export PRODNAME=prod1 -export DATASET=001003 -subm.sh 8nh athenarec $PRODNAME simul $DATASET 1 10 -subm.sh 8nh athenarec $PRODNAME simul $DATASET 11 20 -subm.sh 8nh athenarec $PRODNAME simul $DATASET 21 30 -subm.sh 8nh athenarec $PRODNAME simul $DATASET 31 40 -subm.sh 8nh athenarec $PRODNAME simul $DATASET 41 50 - - diff --git a/Reconstruction/RecExample/RecExCommon/share/BSRead_config.py b/Reconstruction/RecExample/RecExCommon/share/BSRead_config.py index 3fdb561d9715ab7282f07a2846ba6490e56ef465..84739a1f3bad0c1e7ac4cdad86e7cf246176081d 100644 --- a/Reconstruction/RecExample/RecExCommon/share/BSRead_config.py +++ b/Reconstruction/RecExample/RecExCommon/share/BSRead_config.py @@ -33,7 +33,7 @@ if rec.doMuon(): if DetFlags.readRDOBS.LAr_on(): from LArByteStream.LArByteStreamConf import LArRawDataReadingAlg - topSequence+=LArRawDataReadingAlg() #Default config ist fine + topSequence+=LArRawDataReadingAlg(FailOnCorruption=False) if DetFlags.readRDOBS.Tile_on(): svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_dump.C b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_dump.C deleted file mode 100755 index 0e557254bad4cbcfb62922e62eacd0c0d0e5c69b..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_dump.C +++ /dev/null @@ -1,182 +0,0 @@ -void RecExCommon_dump() -{ -dumpFile("ntuple.root"); - -} - - -void dumpFile (TString theFile) -{ - - // 1 if CBNTAA - int CBNTAA=1; - -// simplistic root macro to dump variables from combined ntuple -// to allow simle integrity checks - - -// change default style -// round filled marker - -gStyle->SetMarkerStyle(8); -gStyle->SetStatW(0.4); -//gStyle->SetStatFontSize(60); -gStyle->SetStatFontSize(0.12); -gStyle->SetLabelSize(0.06); -gStyle->SetOptStat(111110); -gStyle->SetCanvasBorderMode(0); -gStyle->SetPadBorderMode(0); -gStyle->SetPadColor(0); -gStyle->SetCanvasColor(0); -gStyle->SetTitleColor(0); -gStyle->SetStatColor(0); - - TString thePSFile=theFile+".ps"; - - std::cout << "thePSfile: " << thePSFile << std::endl; - - -// only 3 digits -TGaxis::SetMaxDigits(3); - -//gStyle->SetNoExponent(false); -//myHisto->GetYaxis() - - - //open file -TFile f(theFile); - - TTree *t3333=0; - - /// handle AA vs non AA - if (CBNTAA==1) { -// this is needed only if pure numeric ttree identifier is used - t3333=(TTree*) gDirectory->Get("CollectionTree"); - } else { - f.cd("CBNT") ; - t3333=(TTree*) gDirectory->Get("t3333"); - } -//use default style -t3333->UseCurrentStyle(); - - - - - -TCanvas *MyC1 = new TCanvas("MyC1","CBNT Dump ",1); - - -MyC1->Divide(2,2); - -MyC1->cd(1); -t3333->Draw("PtGen"); -MyC1->cd(2); -t3333->Draw("Trk_pt"); -MyC1->cd(3); -t3333->Draw("Trk_pt:PtGen[Trk_truthNt]","Trk_truthBarcode!=0"); -MyC1->cd(4); -t3333->Draw("vxp_vtx_z:ZV[IVPrimary]","NVer>0"); - -thePSFileOpen=thePSFile+"("; -MyC1->Print(thePSFileOpen); - -# - -TCanvas *MyC2 = new TCanvas("MyC2","CBNT Dump mu",1); - -MyC2->Divide(2,2); -MyC2->cd(1); -t3333->Draw("1./VT_PTInv"); -MyC2->cd(2); -t3333->Draw("1./Moore_ptir"); -MyC2->cd(3); -t3333->Draw("1./staco_qOverP"); -MyC2->cd(4); -t3333->Draw("1./Muid_pircb"); - - -//MyC2->Print("CBNTdump.ps"); -MyC2->Print(thePSFile); - - -TCanvas *MyC3 = new TCanvas("MyC3","CBNT Dump conv ele tau bt",1); - - - - -MyC3->Divide(2,2); -MyC3->cd(1); -t3333->Draw("sqrt(conv_vtx_x**2+conv_vtx_y**2)"); -MyC3->cd(2); -t3333->Draw("Ele_eta"); -MyC3->cd(3); -t3333->Draw("tau_eta"); -MyC3->cd(4); -t3333->Draw("pjWSV2"); - -//MyC3->Print("CBNTdump.ps"); -MyC3->Print(thePSFile); - - - -TCanvas *MyC4 = new TCanvas("MyC4","CBNT Dump MET",1); - - - - -MyC4->Divide(2,2); -MyC4->cd(1); -t3333->Draw("MET_EtSumFinal"); -MyC4->cd(2); -t3333->Draw("MET_EtSumTruthInt"); -MyC4->cd(3); -t3333->Draw("METSig_EtMissFinal"); - - -//MyC4->Print("CBNTdump.ps"); -MyC4->Print(thePSFile); - - - - -TCanvas *MyC5 = new TCanvas("MyC5","CBNT Dump jet",1); - - -MyC5->Divide(2,2); - - -MyC5->cd(1); -t3333->Draw("jetEtaC7H1TopoJets"); -MyC5->cd(2); -t3333->Draw("jetEtaCone7H1TowerJets"); -MyC5->cd(3); -t3333->Draw("jetEtaKt6H1TowerJets"); -MyC5->cd(4); -t3333->Draw("jetEtaC7McJets"); - - -MyC5->Print(thePSFile); - - - - -TCanvas *MyC6 = new TCanvas("MyC6","CBNT Dump soft",1); - - -MyC6->Divide(2,2); -MyC6->cd(1); -t3333->Draw("MemVSize:IEvent","MemVSize>0"); -MyC6->cd(2); -t3333->Draw("MemRSS:IEvent","MemVSize>0"); -MyC6->cd(3); -t3333->Draw("TimeTotal/1000"); -MyC6->cd(4); -t3333->Draw("(TimeTotal-TimeSum)/1000"); - - -thePSFileClose=thePSFile+")"; -MyC6->Print(thePSFileClose); - -//t3333->Browse() -} - diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links.csh b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links.csh deleted file mode 100755 index 6caf89e842b25cb6cd7ee40e64b04709f08dcca9..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links.csh +++ /dev/null @@ -1,6 +0,0 @@ -#setup links to all the necessary files to run RecExExample -#to be executed once in a given run directory - -# use the python version -recexcommon-links.py - diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_cern_zc.sh b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_cern_zc.sh deleted file mode 100755 index bd2404b4025dd27076aeaab219e0fe109328ae21..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_cern_zc.sh +++ /dev/null @@ -1,39 +0,0 @@ -echo "See https://twiki.cern.ch/twiki/bin/view/Atlas/RecoReferenceFiles for more info " - -echo "obsolete ! exiting now !" - -exit 0 -#OBSOLETE SHOULD USE ATLASGROUPDISK -# export STAGE_SVCCLASS=atlasgroupdisk -#echo "ATLAS-DC3-02 stream inclusive electron " -#pool_insertFileToCatalog.py rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004947.inclEle.digit.RDO.v12000399/streamtest.004947.inclEle.digit.RDO.v12000399._00002.pool.root.8 -#FCregisterLFN -p rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004947.inclEle.digit.RDO.v12000399/streamtest.004947.inclEle.digit.RDO.v12000399._00002.pool.root.8 -l streamInclEle_DC3-02_RDO.pool - -#echo "ATLAS-DC3-02 stream inclusive muon " -#pool_insertFileToCatalog.py rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004893.inclMuo.digit.RDO.v12000399/streamtest.004893.inclMuo.digit.RDO.v12000399._00001.pool.root.8 -#FCregisterLFN -p rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004893.inclMuo.digit.RDO.v12000399/streamtest.004893.inclMuo.digit.RDO.v12000399._00001.pool.root.8 -l streamInclMuo_DC3-02_RDO.pool - -#echo "ATLAS-DC3-02 stream inclusive jet " -#pool_insertFileToCatalog.py rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004946.inclJet.digit.RDO.v12000399/streamtest.004946.inclJet.digit.RDO.v12000399._00002.pool.root.8 -#FCregisterLFN -p rfio:/castor/cern.ch/grid/atlas/dq2/streamtest/streamtest.004946.inclJet.digit.RDO.v12000399/streamtest.004946.inclJet.digit.RDO.v12000399._00002.pool.root.8 -l streamInclJet_DC3-02_RDO.pool - - -#echo "ATLAS-DC3-07 top " -#pool_insertFileToCatalog.py rfio:/castor/cern.ch/atlas/csc/valiprod/sampleA/testIdeal_07/005200.T1_McAtNlo_Jimmy/digit/v12000201/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1 -#FCregisterLFN -p rfio:/castor/cern.ch/atlas/csc/valiprod/sampleA/testIdeal_07/005200.T1_McAtNlo_Jimmy/digit/v12000201/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1 -l top_DC3-07_RDO.pool - - - - - - - -#echo "Geant4 Rome-initial RDO castor files (only at cern)" -#pool_insertFileToCatalog rfio:/castor/cern.ch/user/d/drebuzzi/q02initialprod/dig9.0.4/forAOD/q02initialprod.0001.H_2e2mu.q02dig.etacut.0001.pool.root -#FCregisterLFN -p rfio:/castor/cern.ch/user/d/drebuzzi/q02initialprod/dig9.0.4/forAOD/q02initialprod.0001.H_2e2mu.q02dig.etacut.0001.pool.root -l heemm_initial_RDO.pool - - - -#echo bytestream file - -#ln -fs /castor/cern.ch/grid/atlas/datafiles/dc2/mixing/dc2.003621.mixing.all_phys/dc2_mixing_all_phys_0003621_file100002.data.1 dc2_mixing_all_phys_0003621_file100002.data diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_zc.sh b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_zc.sh deleted file mode 100755 index 4756c7aab664b9e9cf7bcb57a032656698802bb6..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_links_zc.sh +++ /dev/null @@ -1,8 +0,0 @@ -echo This will override all files copied in your run directory by -echo the one taken in RecExCommon/share package -echo In particular, myTopOptions.py will be replaced. -echo So, please save the files you have modified with a different name. - -echo "\n\n please use the recexcommon-links.py in future ! \n" - -recexcommon-links.py diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_runTimeFiles_zc.sh b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_runTimeFiles_zc.sh deleted file mode 100755 index 562d0e502cdfbb363dccf22ce611d1c766a9e0ff..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_runTimeFiles_zc.sh +++ /dev/null @@ -1,47 +0,0 @@ -# local database replica (script is protected against use outside CERN using SITEROOT) -setupLocalDBReplica_CERN.sh - -# ID det descr info -# get_files -symlink TrackingGeometryMaterialDescription.DC3.root -# pool_insertFileToCatalog TrackingGeometryMaterialDescription.DC3.root -# get_files -symlink TrackingGeometryMaterialDescription.RomeInitial.root -# pool_insertFileToCatalog TrackingGeometryMaterialDescription.RomeInitial.root - -#FIXME -#to be fixed source $TRIGGERRELEASEROOT/share/RecExCommon_trigger_links.sh - -# echo atlfast stuff -# now use PathResolver -#too many files to be taken one by one -#ln -fs $ATLFASTALGSROOT/share/Atlfast*.tab . -#ln -fs $ATLFASTALGSROOT/share/Atlfast*.dat . - -##echo btagging stuff not needed anymore -##get_files -symlink -data Sig_ref_xKal.root -##get_files -symlink -data Sig_ref_iPat.root -##get_files -symlink -data Bkg_ref_xKal.root -##get_files -symlink -data Bkg_ref_iPat.root - -#echo Eflow/atlfast stuff -# obsolete -#get_files -symlink -data FastShowerHistograms - - -#echo Moore stuff -#get_files -symlink -data "DeadMaterialMap*.data" -#get_files -symlink -data "Geantino*.data" -#get_files -symlink -data "DC2_*.dat" - - -##echo "xml Si description (need be copied)" not needed anymore -##get_files -symlink -data Materials.dtd -##get_files -symlink -data AGDD.dtd - -#still needed by PartPropSvc -#get_files -symlink -data PDGTABLE.MeV - -#for b tagging, not needed anymore -#get_files -symlink -data btagcal.data -#get_files -symlink -data btagcal_his.data -#get_files -symlink -data cal_his.data - diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py index d2b6b134d25fe685f72906d0bb6a214293240fc4..35d98527c10fe6f4d57fec0d9e9ab40391c70dc7 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py @@ -597,9 +597,11 @@ if globalflags.InputFormat.is_bytestream(): ### write mu values into xAOD::EventInfo if rec.doESD() and rec.readRDO(): if globalflags.DataSource()=='geant4': - include_muwriter = hasattr( condSeq, "xAODMaker::EventInfoCnvAlg" ) + include_muwriter = (globalflags.InputFormat.is_bytestream() or + hasattr( condSeq, "xAODMaker::EventInfoCnvAlg" ) or + objKeyStore.isInInput( "xAOD::EventInfo")) else: - include_muwriter = jobproperties.Beam.beamType()=="collisions" and not athenaCommonFlags.isOnline() + include_muwriter = not athenaCommonFlags.isOnline() if include_muwriter: try: diff --git a/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py b/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py index 2f3a2be9d14c8469c1d3368fe9f48f394f17bfb3..186eaf7e252db16eca66c583166967e996e24107 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecoUtils.py @@ -124,9 +124,12 @@ if rec.doPerfMon() : ####################### # ChronoStatSvc -#disable -#if hasattr(svcMgr, 'ChronoStatSvc'): -# svcMgr.ChronoStatSvc.AsciiStatsOutputFile = "chrono_"+OutFileName+".txt" +# Disable LOG printing +if hasattr(svcMgr, 'ChronoStatSvc'): + svcMgr.ChronoStatSvc.ChronoPrintOutTable = False + svcMgr.ChronoStatSvc.PrintUserTime = False + svcMgr.ChronoStatSvc.StatPrintOutTable = False + #svcMgr.ChronoStatSvc.AsciiStatsOutputFile = "chrono_"+OutFileName+".txt" ################# # Time limit diff --git a/Reconstruction/RecExample/RecExCommon/test/RecExCommon_TestConfiguration.xml b/Reconstruction/RecExample/RecExCommon/test/RecExCommon_TestConfiguration.xml deleted file mode 100755 index 95d5c7c011b311d52955cc8a93ca7b8ce982338f..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExCommon/test/RecExCommon_TestConfiguration.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> - -<unifiedTestConfiguration> - -<atn> - <TEST name="RecExCommon_warning_and_error" type="makecheck" suite="Examples"> - <timelimit>30</timelimit> - <mailto> seuster@cern.ch </mailto> - <expectations> - <errorMessage>FAILURE log file</errorMessage> - <returnValue>0</returnValue> - </expectations> - </TEST> -</atn> - -</unifiedTestConfiguration> diff --git a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_noAlgs_fromESD.py b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_noAlgs_fromESD.py index e8f01299e4e26a2cffda8c496c225ff08903129d..3cf91db127898659e21a680f54740ba2a55205c9 100644 --- a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_noAlgs_fromESD.py +++ b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_noAlgs_fromESD.py @@ -26,5 +26,9 @@ jobproperties.InDetJobProperties.doxAOD.set_Value_and_Lock(False) #Disables AllExecutedEvents rec.doFileMetaData.set_Value_and_Lock(False) +#Disables PFO Thnning - these cotnainers do not exist, unless you run jet finding +from ParticleBuilderOptions.AODFlags import AODFlags +AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False) + athenaCommonFlags.EvtMax=10 include ("RecExCommon/RecExCommon_topOptions.py") diff --git a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_refit_fromESD.py b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_refit_fromESD.py index 4b923757d2579c373cf118c1e35fe8eb9248f7b5..61cc4204b510e4d56caa32c2f5f1db30205fc0a2 100644 --- a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_refit_fromESD.py +++ b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_refit_fromESD.py @@ -142,6 +142,9 @@ InDetNewTrackingCuts.printInfo() include ("InDetRecExample/InDetRecConditionsAccess.py") include ("InDetRecExample/InDetRecLoadTools.py") +if not hasattr( topSequence, "LumiBlockMuWriter" ): + include ("LumiBlockComps/LumiBlockMuWriter_jobOptions.py") + # ToolSvc.InDetBroadInDetRotCreator.OutputLevel=VERBOSE from InDetRecExample.TrackingCommon import getInDetPRDtoTrackMapToolGangedPixels diff --git a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh index 88f88e739ff42d1edfe60bbd7acf183dd85d48c0..abfa1f3e0ade1614bbc024f0df094d73924c1eb7 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh @@ -2,7 +2,7 @@ echo "Creating new serial directory" mkdir serial; cd serial -Reco_tf.py --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaSerial.log +Reco_tf.py --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaSerial.log rc=${PIPESTATUS[0]} echo "art-result: $rc Serial" @@ -12,7 +12,7 @@ cd ../ echo "Creating new threadOne directory" mkdir threadOne; cd threadOne -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaOneThread.log +Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaOneThread.log rc1=${PIPESTATUS[0]} echo "art-result: $rc1 OneThread" @@ -33,7 +33,7 @@ cd ../ echo "Creating new threadTwo directory" mkdir threadTwo; cd threadTwo -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaTwoThreads.log +Reco_tf.py --athenaopts="--threads=2" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaTwoThreads.log rc2=${PIPESTATUS[0]} echo "art-result: $rc2 TwoThreads" @@ -50,7 +50,7 @@ cd ../ echo "Creating new threadFive directory" mkdir threadFive; cd threadFive -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' | tee athenaFiveThreads.log +Reco_tf.py --athenaopts="--threads=5" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaFiveThreads.log rc5=${PIPESTATUS[0]} echo "art-result: $rc5 FiveThreads" diff --git a/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py b/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py index 0286d27b0716013a6729ec1fcc0d12672beca521..702dd511c82d8862963296d5d321dbf3a49a6937 100644 --- a/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py +++ b/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py @@ -27,11 +27,6 @@ athenaCommonFlags.FilesInput = [ "/afs/cern.ch/atlas/project/rig/referencefiles/RTTinputFiles/MC15_13TeV/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r6699_10evt.pool.root" ] -if not hasJobPropertyBeenSet(athenaCommonFlags.FilesInput): - athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") -# assertCastorStager("castoratlast3","atlascerngroupdisk") -# athenaCommonFlags.FilesInput = MuonRecUtils.FileList.readDirectory("rfio:/castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/") - #-------------------------------------------------------------------------------- # Output #-------------------------------------------------------------------------------- diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_amitag_q122.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_amitag_q122.sh index 0847fbf3206b7b9539ff80c909684b7a0e53f9f9..6dd90c9614ad2b06a7632666c82d827d7df43233 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_amitag_q122.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_amitag_q122.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs with AMI configTag q122 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh index ccdfbe5abda4837536b415122334996d697bb9d4..f7ad3938e96bbf17f9be1e4b8439274c28989863 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on cosmics with all streams -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_7tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_7tev.sh index 1caf4441c114cbfcf9796cc76e41e9c25cdc212b..36a1902a8c9d7b32f9aca88bf1bd14a1d5025beb 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_7tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_7tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 7TeV collision data with all streams 2011 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_heavy_ion.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_heavy_ion.sh index 267271a6504ee4d00b657952f4e546495b44278c..759cdb28a00affd3379314079b5d54e279e07901 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_heavy_ion.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data11_heavy_ion.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: heavy ion reconstruction test from Andrzej Olszewski and Iwona Grabowska-Bold -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data12_8tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data12_8tev.sh index 4fa1f2722200ba072ab9dddf3a6b5d76e9a002c4..eb095c0a468318afbeece3bf490ddfd1e11950e4 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data12_8tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data12_8tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 8TeV collision data with all streams 2012 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_13tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_13tev.sh index d7ca6811ea2fcead298d48c0558188cdc80e1305..035eaf4432ea162b6ab0920cf9687346cf8a2ca4 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_13tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_13tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 13TeV collision data with all streams 2015 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_heavy_ion.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_heavy_ion.sh index 1d54fe6a7635d8f13e8a3d3d75ff207e11b51150..d4a9790c0fa18abddc054578cdd4eee0c79b46f5 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_heavy_ion.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data15_heavy_ion.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: heavy ion reconstruction test from Andrzej Olszewski and Iwona Grabowska-Bold -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data16_13tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data16_13tev.sh index 32f1eb419e1a20565148eba6ebea0d7971f00346..b87146c8c53f77e579c1f39546c171629021e276 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data16_13tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data16_13tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 13TeV collision data with all streams 2016 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev.sh index 5922068949a3b826bb2fca1d7e8ac9df8a552d94..54cf670c42e943b702ff6a4c59076b2fd2408798 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 13TeV collision data 2017, early data, A3 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev_fpe.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev_fpe.sh index 0ef045af991e3362377cad0db215dacd1746333a..a09d6d63cceec192137ce947e2599fec47340b83 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev_fpe.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data17_13tev_fpe.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on 13TeV collision data with floating point exception enabled 2017 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_digimreco_tf_fct_mc16.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_digimreco_tf_fct_mc16.sh index a076402b267790bf1f68616ab073706d7f922a44..9e1bff3be3c0b5548264cf96b3b6a0983e10f149 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_digimreco_tf_fct_mc16.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_digimreco_tf_fct_mc16.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Test of DigiMReco from HITS to AOD/TAG MC16a r10724 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc15_heavy_ion.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc15_heavy_ion.sh index 7e9d3cb7584dd8f1beb827008cc11a0cb16ac41d..435ea0bdebdcba5e4bb657999bf7add93e1fd000 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc15_heavy_ion.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc15_heavy_ion.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: heavy ion reconstruction test from Andrzej Olszewski and Iwona Grabowska-Bold -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16.sh index d6905564bb4ddb0eb9d1ac0c943b486aa7b3648d..f60e96f822025918ff8b31ddcc248e30dd1defed 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on mc16, based on recon tag r9364 MC16a -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_rdotobs.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_rdotobs.sh index e5b028fb0db9e42ee4952c287de9370661ac43c4..519f8af2dee978ebec6934e06a1ef0164b11759a 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_rdotobs.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_rdotobs.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: RDO to BS on tt mc16 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_trigsplit.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_trigsplit.sh index 2b7dcbc2c2ed59d31821f641bd8672e76d5a1b41..984824d217f953616bda7f30350ef9f39e3c54a6 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_trigsplit.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_mc16_trigsplit.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf with split trigger runs on mc16 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev.sh index bebd16c98db290ac5a4a72e8dd1f1851f99b1b8d..2e3249d8988837e39aa6acc30d35e4d2b1a6a3ef 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf for PhysVal, updated with q221 (2017-11-13) + pileup -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena @@ -10,7 +10,7 @@ # art-include: 21.9/Athena -export TRF_ECHO=True; Reco_tf.py --conditionsTag all:OFLCOND-MC16-SDR-17 --ignoreErrors 'False' --autoConfiguration='everything' --digiSeedOffset2 '1' --preExec 'all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.);from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.AODEDMSet="AODFULL"' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.overrideMetadata+=["PhysicsList"];' 'RAWtoESD:from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.triggerMenuSetup="MC_pp_v7";from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False;' --digiSeedOffset1 '1' --steering 'doRDO_TRIG' --DataRunNumber '222525' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root --outputHISTFile=myHIST.root --inputHITSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.410500.PowhegPythia8EvtGen_A14_ttbar_hdamp172p5_nonallhad.simul.HITS.e4797_s2726.50events.pool.root --inputHighPtMinbiasHitsFile='/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.361035.Pythia8EvtGen_A2MSTW2008LO_minbias_inelastic_high.merge.HITS.e3581_s2578_s2195/*' --inputLowPtMinbiasHitsFile='/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.361034.Pythia8EvtGen_A2MSTW2008LO_minbias_inelastic_low.merge.HITS.e3581_s2578_s2195/*' --numberOfCavernBkg="0" --numberOfHighPtMinBias="0.12268057" --numberOfLowPtMinBias="39.8773194" --pileupFinalBunch 6 --imf False --maxEvents '500' +export TRF_ECHO=True; Reco_tf.py --conditionsTag all:OFLCOND-RUN12-SDR-19 --ignoreErrors 'False' --autoConfiguration='everything' --digiSeedOffset2 '1' --preExec 'all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.);from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.AODEDMSet="AODFULL"' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.overrideMetadata+=["PhysicsList"];' 'RAWtoESD:from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.triggerMenuSetup="MC_pp_v7";from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False;' --digiSeedOffset1 '1' --steering 'doRDO_TRIG' --DataRunNumber '222525' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root --outputHISTFile=myHIST.root --inputHITSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.410500.PowhegPythia8EvtGen_A14_ttbar_hdamp172p5_nonallhad.simul.HITS.e4797_s2726.50events.pool.root --inputHighPtMinbiasHitsFile='/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.361035.Pythia8EvtGen_A2MSTW2008LO_minbias_inelastic_high.merge.HITS.e3581_s2578_s2195/*' --inputLowPtMinbiasHitsFile='/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.361034.Pythia8EvtGen_A2MSTW2008LO_minbias_inelastic_low.merge.HITS.e3581_s2578_s2195/*' --numberOfCavernBkg="0" --numberOfHighPtMinBias="0.12268057" --numberOfLowPtMinBias="39.8773194" --pileupFinalBunch 6 --imf False --maxEvents '500' RES=$? echo "art-result: $RES Reco" if [ $RES -ne 0 ];then diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup.sh index 805f6b1a4f65491e34a21cd7732c2fabb381556e..193b3769af960ecb4a52dea0ff18b4e2e5f3592b 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf for PhysVal, updated with q221 (2017-11-13), no pileup -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup_stdcmalloc.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup_stdcmalloc.sh index b440133817d4423866fff9fb64d572d4937c80dd..e445ef38514ecdc857d50e7913aec0df5bdee15a 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup_stdcmalloc.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_reco_mc15_13tev_nopileup_stdcmalloc.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf for PhysVal, updated with q221 (2017-11-13), no pileup, with stdcmalloc -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena @@ -10,7 +10,7 @@ # art-include: 21.9/Athena -export TRF_ECHO=True; Reco_tf.py --conditionsTag all:OFLCOND-MC16-SDR-17 --ignoreErrors 'False' --autoConfiguration='everything' --digiSeedOffset2 '1' --preExec 'all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.);from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.AODEDMSet="AODFULL"' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.overrideMetadata+=["PhysicsList"];' 'RAWtoESD:from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.triggerMenuSetup="MC_pp_v7";from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False;' --digiSeedOffset1 '1' --steering 'doRDO_TRIG' --DataRunNumber '222525' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root --outputHISTFile=myHIST.root --inputHITSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.410500.PowhegPythia8EvtGen_A14_ttbar_hdamp172p5_nonallhad.simul.HITS.e4797_s2726.50events.pool.root --imf False --maxEvents '500' --athenaopts="--stdcmalloc" +export TRF_ECHO=True; Reco_tf.py --conditionsTag all:OFLCOND-RUN12-SDR-19 --ignoreErrors 'False' --autoConfiguration='everything' --digiSeedOffset2 '1' --preExec 'all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.);from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.AODEDMSet="AODFULL"' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.overrideMetadata+=["PhysicsList"];' 'RAWtoESD:from TriggerJobOpts.TriggerFlags import TriggerFlags;TriggerFlags.triggerMenuSetup="MC_pp_v7";from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False;' --digiSeedOffset1 '1' --steering 'doRDO_TRIG' --DataRunNumber '222525' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root --outputHISTFile=myHIST.root --inputHITSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/mc15_13TeV.410500.PowhegPythia8EvtGen_A14_ttbar_hdamp172p5_nonallhad.simul.HITS.e4797_s2726.50events.pool.root --imf False --maxEvents '500' --athenaopts="--stdcmalloc" RES=$? echo "art-result: $RES Reco" diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_mc15_13tev.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_mc15_13tev.sh index 890195162c2fc79cbeb361afa5f9c768595f3272..cfa60a831e59a461b40188f448df4b8fc723457c 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_mc15_13tev.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_mc15_13tev.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Xiaohu Sun, Carl Gwilliam and Marie-Helene Genest -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_7teV_data.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_7teV_data.sh index a3737275f873778768d2921eb39cac2b206a992d..84facbf48fcc6b6dc6f703cefea34269392e5b94 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_7teV_data.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_7teV_data.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Jamie Boyd, Running on highmu Data at 7 TeV -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_8teV_data.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_8teV_data.sh index 6b6af1d6e0f404579e04370ffc493e1668e42039..f29183400662b702156844aae773d84206da6079 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_8teV_data.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_8teV_data.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Jamie Boyd, data12_8TeV reconstruction -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q220.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q220.sh index 110f8731e9a5877ab381271f9396547f9c488d5b..e0c647167a851b62c65d277a4322cf6d3a450d12 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q220.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q220.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: RIG convenors - q220 reconstruction -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q221.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q221.sh index 51f3fa90cf6038e73f9472537497c6d1876ad5dc..f37471dbfa6ad92ea0efa31f2660ab722ac4e93e 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q221.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q221.sh @@ -2,7 +2,7 @@ #!/bin/sh # # art-description: RIG convenors - q221 reconstruction -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q222.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q222.sh index 3006f91e008df6a8942b19e918b008d088cd175e..cc1e50caef2329e28cc254a41e96814b8b2990f7 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q222.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q222.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: RIG convenors - q222 reconstruction -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q223.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q223.sh index 5d222c44f2cf71f7bf6c31ab685517e99a4b0dda..904f55b2ed79252e887f0c194b7b15a5e6a0a859 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q223.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recoshift_recotf_q223.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: RIG convenors - q223 reconstruction -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_8teV_data_no.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_8teV_data_no.sh index 8a93fdd925c1621fabe0531ba3548497a1cc69d1..3168211d06a1239fc6d17e32be67ebe7e1312c02 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_8teV_data_no.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_8teV_data_no.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: David Rousseau, data12_8TeV reconstruction, all reco switched off -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_cosmic_data_2011.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_cosmic_data_2011.sh index e763bef828e5b8e64bc6d80d5bb66f474c648e13..fc0dbf98eaca7c4bce1f222d1e1d3321974e5872 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_cosmic_data_2011.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_cosmic_data_2011.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Jamie Boyd - should be updated for 2015 -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15.sh index 06111234b8edc5fe3851d32a59898d8fb0ad3e9b..13cf60a58847997f242a58f5267aa34245eb8e8a 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: David Rousseau -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15_no.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15_no.sh index 43b1e82eda3aa81b4de67ebcea5e63e97e3413f1..36541b24ed606aa555cf55f0a36bb9878dd86807 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15_no.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_recotf_mc15_no.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: David Rousseau -# art-memory: 6000 +# art-athena-mt: 4 # art-type: build # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_splash_events.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_splash_events.sh index 5f9b700f0b3e6af8e0113022caee073c9eb7f4fd..ee6d6ac0a6f057d7c93ea84880a79050bde7d531 100755 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_splash_events.sh +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_splash_events.sh @@ -1,7 +1,7 @@ #!/bin/sh # # art-description: Reco_tf runs on splash events with all streams -# art-memory: 6000 +# art-athena-mt: 4 # art-type: grid # art-include: 21.0/Athena # art-include: 21.0-TrigMC/Athena diff --git a/Reconstruction/RecoAlgs/CaloRingerAlgs/src/xAODRingSetConfWriter.cxx b/Reconstruction/RecoAlgs/CaloRingerAlgs/src/xAODRingSetConfWriter.cxx index a018816888000d2280b73a9d932bdebde205ff96..a1fcd1268b006ab7b8f6229c01a4886c0916c65f 100644 --- a/Reconstruction/RecoAlgs/CaloRingerAlgs/src/xAODRingSetConfWriter.cxx +++ b/Reconstruction/RecoAlgs/CaloRingerAlgs/src/xAODRingSetConfWriter.cxx @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODRingSetConfWriter.cxx 789607 2016-12-14 04:40:50Z ssnyder $ - // STL include(s) #include <algorithm> +#include <sstream> // Gaudi/Athena include(s): #include "AthenaKernel/errorcheck.h" @@ -16,7 +15,6 @@ // EDM include(s): #include "xAODCore/AuxInfoBase.h" #include "xAODCaloRings/RingSetConfAuxContainer.h" -#include "xAODCaloRings/tools/PrintHelperFcns.h" // Local include(s): #include "xAODRingSetConfWriter.h" @@ -109,7 +107,9 @@ StatusCode xAODRingSetConfWriter::initialize() { if ( nullptr != c ) { if ( msg().level() <= MSG::VERBOSE ) { for ( const auto& r : *c ){ - r->print( msg(), MSG::VERBOSE ); + std::ostringstream str; + r->print( str ); + ATH_MSG_VERBOSE( str.str() ); } } } else { @@ -199,12 +199,20 @@ StatusCode xAODRingSetConfWriter::copyKeyToStore( const std::string &key ) for ( const base_value_type* obj : *cont ) { ATH_MSG_VERBOSE("Original object:"); // Print-out object: - obj->print( msg(), MSG::VERBOSE ); + if( msgLevel() <= MSG::VERBOSE ) { + std::ostringstream str; + obj->print( str ); + ATH_MSG_VERBOSE( str.str() ); + } // Copy object value_type objCopy = new (base_value_type)( *obj ); // Print-out object: ATH_MSG_VERBOSE("Copied object:"); - objCopy->print( msg(), MSG::VERBOSE ); + if( msgLevel() <= MSG::VERBOSE ) { + std::ostringstream str; + objCopy->print( str ); + ATH_MSG_VERBOSE( str.str() ); + } // Add to container contCopy->push_back( objCopy ); } diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py index 2ae875b475893f34954b0a455b9ec264a2941088..64ca2286f62992615121a64fd2f7534a5408a553 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py @@ -41,8 +41,8 @@ if recAlgs.doEFlow() : name = "PFlowObjectsInConeTool") from JetRec.JetRecStandard import jtm - from JetRec.JetRecConf import PseudoJetGetter - emnpflowget = PseudoJetGetter( + from JetRec.JetRecConf import PseudoJetAlgorithm + emnpflowget = PseudoJetAlgorithm( name = "emnpflowget", Label = "EMNPFlow", InputContainer = "CHSNeutralParticleFlowObjects", @@ -50,13 +50,11 @@ if recAlgs.doEFlow() : SkipNegativeEnergy = True, ) jtm += emnpflowget - # PseudoJetGetters are now run in their own dedicated algs - from JetRec.JetRecConf import PseudoJetAlgorithm # EMTopo (non-origin corrected) clusters - if not hasattr(topSequence, "pjalg_"+jtm.emget.Label): - topSequence += PseudoJetAlgorithm("pjalg_"+jtm.emget.Label,PJGetter=jtm.emget) + if not hasattr(topSequence, jtm.emget.name()): + topSequence += jtm.emget # EM Neutral PFOs - topSequence += PseudoJetAlgorithm("pjalg_"+emnpflowget.Label,PJGetter=emnpflowget) + topSequence += emnpflowget # tool to collect topo clusters in cone from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool @@ -87,13 +85,12 @@ def configureEDCorrection(tool): try: from AthenaCommon.AppMgr import ToolSvc from JetRec.JetRecStandard import jtm - from JetRec.JetRecConf import PseudoJetAlgorithm from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # EMTopo (non-origin corrected) clusters - if not hasattr(topSequence, "pjalg_"+jtm.emget.Label): - topSequence += PseudoJetAlgorithm("pjalg_"+jtm.emget.Label,PJGetter=jtm.emget) + if not hasattr(topSequence, jtm.emget.name()): + topSequence += jtm.emget if not hasattr(topSequence,'EDtpIsoCentralAlg'): tccc = configEventDensityTool("EDtpIsoCentralTool", inputlabel = jtm.emget.Label, @@ -207,11 +204,8 @@ tit.TrackSelectionTool.CutLevel = "Loose" if not useVertices: tit.VertexLocation = '' -import ROOT, cppyy -# Need to be sure base dict is loaded first. -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso +# Import the xAOD isolation parameters. +from xAODPrimitives.xAODIso import xAODIso as isoPar # In fact the default isolations are the same for eg and muons : prepare the list here IsoTypes = [ diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/share/CustomTrackIsoGetter.py b/Reconstruction/RecoAlgs/IsolationAlgs/share/CustomTrackIsoGetter.py index dc3173a906b29bc0864d47ee4edb6210277ce8f3..1cf954f819cb9ca0eb249ebbcc99b2bd39ba06b9 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/share/CustomTrackIsoGetter.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/share/CustomTrackIsoGetter.py @@ -1,11 +1,11 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence from RecExConfig.RecFlags import rec -import ROOT, cppyy -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso +# Import the xAOD isolation parameters. +from xAODPrimitives.xAODIso import xAODIso as isoPar ptconeList = [[isoPar.ptcone40,isoPar.ptcone30,isoPar.ptcone20]] ## Put the new algs before egamma locker... (so right after default IsolationBuilder) diff --git a/Reconstruction/RecoTools/CaloRingerTools/src/CaloAsymRingsBuilder.cxx b/Reconstruction/RecoTools/CaloRingerTools/src/CaloAsymRingsBuilder.cxx index 47ac92d284903b1701b13ad2c67d6649180b0d3a..8483944421e4d7f8d630ed05f77ec594c2c4d04a 100644 --- a/Reconstruction/RecoTools/CaloRingerTools/src/CaloAsymRingsBuilder.cxx +++ b/Reconstruction/RecoTools/CaloRingerTools/src/CaloAsymRingsBuilder.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: CaloAsymRingsBuilder.cxx 732388 2016-03-25 03:38:54Z ssnyder $ // ================================================================================= #include "CaloAsymRingsBuilder.h" //#include "CaloRingsBuilder.h" @@ -33,6 +32,7 @@ #include <algorithm> #include <math.h> #include <cfloat> +#include <sstream> namespace Ringer { @@ -108,12 +108,18 @@ StatusCode CaloAsymRingsBuilder::initialize() } catch ( const std::runtime_error &e) { ATH_MSG_ERROR("Could not add collection bounderies due to: " << e.what() ); ATH_MSG_ERROR("RawConfCollection is: "); - xAOD::RingSetConf::print(m_rsRawConfCol, msg(), MSG::ERROR); + std::ostringstream str; + xAOD::RingSetConf::print(m_rsRawConfCol, str); + ATH_MSG_ERROR(str.str()); return StatusCode::FAILURE; } // Print our collection - xAOD::RingSetConf::print(m_rsRawConfCol, msg(), MSG::DEBUG); + if (msgLevel() <= MSG::DEBUG){ + std::ostringstream str; + xAOD::RingSetConf::print(m_rsRawConfCol, str); + ATH_MSG_DEBUG(str.str()); + } return StatusCode::SUCCESS; } diff --git a/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingerReaderUtils.h b/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingerReaderUtils.h index fc51a424df8d501c0c9d6bb80fd893832513e711..9706a2bfbff70eaca5b34d49962050b035a01a99 100644 --- a/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingerReaderUtils.h +++ b/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingerReaderUtils.h @@ -1,8 +1,7 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: CaloRingerReaderUtils.h 688728 2015-08-11 16:01:24Z ssnyder $ #ifndef CALORINGERTOOLS_CALORINGERREADERUTILS_H #define CALORINGERTOOLS_CALORINGERREADERUTILS_H @@ -14,6 +13,7 @@ // Athena framework include: #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/IDataHandleHolder.h" +#include "StoreGate/WriteDecorHandle.h" #include "StoreGate/WriteDecorHandleKey.h" #include "AthenaBaseComps/AthCheckMacros.h" #include "AthContainers/DataVector.h" @@ -110,7 +110,8 @@ class BuildCaloRingsFctor : public BuildCaloRingsFctorBase /// @brief Particle type that the functor will decorate the CaloRingsLinks typedef typename container_t::base_value_type particle_t; /// @brief CaloRings links decorator handle type - typedef typename ::xAOD::caloRingsDecoH_t< container_t > decor_t; + typedef typename SG::WriteDecorHandle< container_t, xAOD::CaloRingsLinks > + decor_t; private: typedef BuildCaloRingsFctorBase base_t; diff --git a/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingsBuilder.cxx b/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingsBuilder.cxx index 85f156d37c2633789b6c5bd2db52ef2e371ec2ba..3cb194fe6dc2f703ec3198d7b10e3d4aa69841c5 100644 --- a/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingsBuilder.cxx +++ b/Reconstruction/RecoTools/CaloRingerTools/src/CaloRingsBuilder.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: CaloRingsBuilder.cxx 787812 2016-12-02 05:42:32Z ssnyder $ // ================================================================================= #include "CaloRingsBuilder.h" @@ -32,6 +31,7 @@ #include <algorithm> #include <math.h> #include <cfloat> +#include <sstream> namespace Ringer { @@ -102,12 +102,18 @@ StatusCode CaloRingsBuilder::initialize() } catch ( const std::runtime_error &e) { ATH_MSG_ERROR("Could not add collection bounderies due to: " << e.what() ); ATH_MSG_ERROR("RawConfCollection is: "); - xAOD::RingSetConf::print(m_rsRawConfCol, msg(), MSG::ERROR); + std::ostringstream str; + xAOD::RingSetConf::print(m_rsRawConfCol, str); + ATH_MSG_ERROR(str.str()); return StatusCode::FAILURE; } // Print our collection - xAOD::RingSetConf::print(m_rsRawConfCol, msg(), MSG::DEBUG); + if (msgLevel() <= MSG::DEBUG){ + std::ostringstream str; + xAOD::RingSetConf::print(m_rsRawConfCol, str); + ATH_MSG_DEBUG(str.str()); + } // This will check that the properties were initialized properly // by job configuration. @@ -229,7 +235,11 @@ StatusCode CaloRingsBuilder::executeTemp( } // Print CaloRings with DEBUG level: - clRings->print( msg(), MSG::DEBUG ); + if (msgLevel() <= MSG::DEBUG){ + std::ostringstream str; + clRings->print(str); + ATH_MSG_DEBUG(str.str()); + } return StatusCode::SUCCESS; } diff --git a/Reconstruction/RecoTools/IsolationTool/share/AthTest_IsolationTool.py b/Reconstruction/RecoTools/IsolationTool/share/AthTest_IsolationTool.py index 8ad9fb90718e4f5421b4532411b1c2a287377184..0cd3b19c120a8962c6f21f4776b12ae7b60081f0 100644 --- a/Reconstruction/RecoTools/IsolationTool/share/AthTest_IsolationTool.py +++ b/Reconstruction/RecoTools/IsolationTool/share/AthTest_IsolationTool.py @@ -1,3 +1,5 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + # inputFile = '/net/s3_datac/dzhang/SAMPLES/R20/MC15/mc15_13TeV.402211.MGPy8EG_A14N_C1C1_800_10_LLE12k.merge.AOD.e4097_a766_a768_r6282/AOD.05819610._000001.pool.root.1' # # Input file @@ -34,10 +36,8 @@ CaloIsoTool.saveOnlyRequestedCorrections = True # CaloIsoTool.OutputLevel = 2 ToolSvc += CaloIsoTool -import ROOT, cppyy -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso +# Import the xAOD isolation parameters. +from xAODPrimitives.xAODIso import xAODIso as isoPar deco_ptcones = [isoPar.ptcone40, isoPar.ptcone30] deco_topoetcones = [isoPar.topoetcone40, isoPar.topoetcone20] diff --git a/Reconstruction/RecoTools/ParticlesInConeTools/CMakeLists.txt b/Reconstruction/RecoTools/ParticlesInConeTools/CMakeLists.txt index 9e4e419f53c90a2de1a0948b899b28cb04747ec1..81479af1b9cd5b4540c777acd1333f02185426e2 100644 --- a/Reconstruction/RecoTools/ParticlesInConeTools/CMakeLists.txt +++ b/Reconstruction/RecoTools/ParticlesInConeTools/CMakeLists.txt @@ -21,12 +21,16 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Reconstruction/PFlow/PFlowUtils ) +atlas_add_library( ParticlesInConeToolsLib + ParticlesInConeTools/*.h + INTERFACE + PUBLIC_HEADERS ParticlesInConeTools + LINK_LIBRARIES GaudiKernel xAODCaloEvent xAODTracking xAODTruth xAODPFlow AthLinks ) + # Component(s) in the package: atlas_add_component( ParticlesInConeTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthLinks xAODCaloEvent xAODPFlow xAODTracking xAODTruth GaudiKernel AthenaKernel AthContainers AsgTools AthenaBaseComps ) + LINK_LIBRARIES ParticlesInConeToolsLib AthenaKernel AthContainers AsgTools AthenaBaseComps PFlowUtilsLib ) -# Install files from the package: -atlas_install_headers( ParticlesInConeTools ) diff --git a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h index e408f7d0ef1340a9b5393ffa7556c50b5e9d7411..732d0086c1b310bde905b594033b6cf67e1d405e 100644 --- a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h +++ b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h @@ -50,6 +50,8 @@ #define ITRKTRACKPARTICLECALOEXTENSIONTOOL_H #include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "xAODBase/IParticle.h" #include "xAODBase/IParticleContainer.h" #include "xAODTracking/TrackParticle.h" @@ -72,17 +74,20 @@ public: * by the IParticle track or the IParticle itself * if it is neutral/TruthParticle * The memory ownership is handled by the unique_ptr + * @param ctx event context needed for multithreading + * @param particle reference to the Particle * @param particle reference to the Particle * @return unique_ptr to a CaloExtension */ - virtual std::unique_ptr<Trk::CaloExtension> caloExtension(const xAOD::IParticle& particle) const = 0; + virtual std::unique_ptr<Trk::CaloExtension> caloExtension(const EventContext& ctx, + const xAOD::IParticle& particle) const = 0; /** Method to return the calo layers crossed (CaloExtension) * by the IParticle track or the IParticle itself * if it is neutral/TruthParticle. * * An alg looping over a single collection of IParticles - * re-using them multiple times can use a local cache of + * re-using them multiple times can use a local cache of * the form * std::unordered_map<size_t,std::unique_ptr<Trk::CaloExtension>>. * The key is the value of IParticle::index() @@ -90,11 +95,13 @@ public: * This method adds the relevant extension to the cache look-up table * which retains ownership. * + * @param ctx event context needed for multithreading * @param particle reference to the Particle * @param cache the look-up table cache * @return ptr to a const CaloExtension (owned by the cache) */ - virtual const Trk::CaloExtension* caloExtension( const xAOD::IParticle& particle, + virtual const Trk::CaloExtension* caloExtension( const EventContext& ctx, + const xAOD::IParticle& particle, Cache& cache ) const = 0; @@ -121,24 +128,95 @@ public: * The Collection can then be used as such to retrieve the extensions * or manipulated and written to StoreGate. * + * @param ctx event context needed for multithreading * @param particles The input collection * @param mask contains true for the elements for which to permorm an extension, false otherwise * @return caloextension Output to be filled, * will contain unfilled CaloExtension where the mask was false, otherwise it contains the relevant * result. */ - virtual StatusCode caloExtensionCollection( const xAOD::IParticleContainer& particles, + virtual StatusCode caloExtensionCollection( const EventContext& ctx, + const xAOD::IParticleContainer& particles, const std::vector<bool>& mask, CaloExtensionCollection& caloextensions) const = 0; + /** + * Method returning a unique_ptr to the caloExtension given the relevant + * starting point parameters , direction and particle hypothesis + * + * @param ctx event context needed for multithreading + * @param startPars the starting track parameters + * @param propDir extrapolation direction + * @param particleType type of particle + */ + virtual std::unique_ptr<Trk::CaloExtension> caloExtension( const EventContext& ctx, + const TrackParameters& startPars, + PropDirection propDir, + ParticleHypothesis particleType ) const =0; + + + + /** old interfaces WITHOUT EventContext ------------------------------------------ */ + + /** Method returning the calo layers crossed + * by the IParticle track or the IParticle itself + * if it is neutral/TruthParticle + * The memory ownership is handled by the unique_ptr + * @param particle reference to the Particle + * @return unique_ptr to a CaloExtension + */ + virtual std::unique_ptr<Trk::CaloExtension> caloExtension(const xAOD::IParticle& particle) const; + + /** Method to return the calo layers crossed (CaloExtension) + * by the IParticle track or the IParticle itself + * if it is neutral/TruthParticle. + * + * An alg looping over a single collection of IParticles + * re-using them multiple times can use a local cache of + * the form + * std::unordered_map<size_t,std::unique_ptr<Trk::CaloExtension>>. + * The key is the value of IParticle::index() + * + * This method adds the relevant extension to the cache look-up table + * which retains ownership. + * + * @param particle reference to the Particle + * @param cache the look-up table cache + * @return ptr to a const CaloExtension (owned by the cache) + */ + virtual const Trk::CaloExtension* caloExtension( const xAOD::IParticle& particle, + Cache& cache ) const; + + + /** Method that can be used by algorithms that : + * A. Have an IParticleCollection + * B. Define a mask of the size of that collection + * C. Want back a Calo Extension Collection alligned with the input collection + * i.e 1 to 1 correspondance with the input collection. + * The Collection can then be used as such to retrieve the extensions + * or manipulated and written to StoreGate. + * + * @param particles The input collection + * @param mask contains true for the elements for which to permorm an extension, false otherwise + * @return caloextension Output to be filled, + * will contain unfilled CaloExtension where the mask was false, otherwise it contains the relevant + * result. + */ + virtual StatusCode caloExtensionCollection( const xAOD::IParticleContainer& particles, + const std::vector<bool>& mask, + CaloExtensionCollection& caloextensions) const; + /** * Method returning a unique_ptr to the caloExtension given the relevant * starting point parametes , direction and particle hypothesis */ virtual std::unique_ptr<Trk::CaloExtension> caloExtension( const TrackParameters& startPars, PropDirection propDir, - ParticleHypothesis particleType ) const =0; + ParticleHypothesis particleType ) const; + + + static const InterfaceID& interfaceID( ) ; }; @@ -148,4 +226,6 @@ inline const InterfaceID& Trk::IParticleCaloExtensionTool::interfaceID() { } // end of namespace +#include "RecoToolInterfaces/IParticleCaloExtensionTool.icc" + #endif diff --git a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.icc b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.icc new file mode 100644 index 0000000000000000000000000000000000000000..22fca6a13f3b0cabbace714bc6809538762fd0c8 --- /dev/null +++ b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.icc @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// IParticleCaloExtensionTool.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + + +/** old interfaces WITHOUT EventContext ------------------------------------------ */ + + /** Method returning the calo layers crossed + * by the IParticle track or the IParticle itself + * if it is neutral/TruthParticle + * The memory ownership is handled by the unique_ptr + * @param particle reference to the Particle + * @return unique_ptr to a CaloExtension + */ +inline std::unique_ptr<Trk::CaloExtension> Trk::IParticleCaloExtensionTool::caloExtension(const xAOD::IParticle& particle) const +{ + return caloExtension( Gaudi::Hive::currentContext(), particle); +} + + + /** Method to return the calo layers crossed (CaloExtension) + * by the IParticle track or the IParticle itself + * if it is neutral/TruthParticle. + * + * An alg looping over a single collection of IParticles + * re-using them multiple times can use a local cache of + * the form + * std::unordered_map<size_t,std::unique_ptr<Trk::CaloExtension>>. + * The key is the value of IParticle::index() + * + * This method adds the relevant extension to the cache look-up table + * which retains ownership. + * + * @param particle reference to the Particle + * @param cache the look-up table cache + * @return ptr to a const CaloExtension (owned by the cache) + */ +inline const Trk::CaloExtension* Trk::IParticleCaloExtensionTool::caloExtension( const xAOD::IParticle& particle, + Cache& cache ) const +{ + return caloExtension( Gaudi::Hive::currentContext(), particle, cache); +} + + + /** Method that can be used by algorithms that : + * A. Have an IParticleCollection + * B. Define a mask of the size of that collection + * C. Want back a Calo Extension Collection alligned with the input collection + * i.e 1 to 1 correspondance with the input collection. + * The Collection can then be used as such to retrieve the extensions + * or manipulated and written to StoreGate. + * + * @param particles The input collection + * @param mask contains true for the elements for which to permorm an extension, false otherwise + * @return caloextension Output to be filled, + * will contain unfilled CaloExtension where the mask was false, otherwise it contains the relevant + * result. + */ +inline StatusCode Trk::IParticleCaloExtensionTool::caloExtensionCollection( const xAOD::IParticleContainer& particles, + const std::vector<bool>& mask, + CaloExtensionCollection& caloextensions) const +{ + return caloExtensionCollection( Gaudi::Hive::currentContext(), particles, mask, caloextensions); +} + + /** + * Method returning a unique_ptr to the caloExtension given the relevant + * starting point parametes , direction and particle hypothesis + */ +inline std::unique_ptr<Trk::CaloExtension> Trk::IParticleCaloExtensionTool::caloExtension( const TrackParameters& startPars, + PropDirection propDir, + Trk::ParticleHypothesis particleType ) const +{ + return caloExtension( Gaudi::Hive::currentContext(), startPars, propDir, particleType); +} + + diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellCollector.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellCollector.cxx index 40ab7f69d093a213b770c0c4f90c8d18d2fbbe40..30df4a1e302b721973cdf71a9a3c60fa870395dd 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellCollector.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellCollector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrackToCalo/CaloCellCollector.h" @@ -210,7 +210,7 @@ Rec::CaloCellCollector::collectCells( const Trk::CaloExtension& extension, if(etot==0){ if(m_doDebug) std::cout<<"no energy depositions, so no cluster"<<std::endl; - return 0; + return nullptr; } float clusVecEta,clusVecPhi; clusVecEta=clusVec.eta(); diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorMinPerp.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorMinPerp.cxx index eba7154f683f48e01ac9fbbf8e403e976d2b0640..1891967bd4c52a873214d878f4a3ddea6687a645 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorMinPerp.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorMinPerp.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ namespace Trk { CaloCellSelectorMinPerp::CaloCellSelectorMinPerp(double coneSize ): - m_caloExtension(0), + m_caloExtension(nullptr), m_coneSize( coneSize ), m_perp2cut(0) { } diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorNearestdR.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorNearestdR.cxx index a26bd9722e0882270616512f79208774f0c5943a..101a4aaee30c73b5c6574b927fdd85017a96a699 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorNearestdR.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorNearestdR.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -39,11 +39,7 @@ namespace Trk Amg::Vector3D nearestPos,nearestMom; Utils::findNearestPoint( cellPos, m_caloExtension, nearestIdx, nearestPos, nearestMom); - if( Utils::deltaR2( nearestPos.eta(),dde->eta(),nearestPos.phi(),dde->phi()) < m_coneSize2){ - return true; - } - - return false; + return Utils::deltaR2( nearestPos.eta(),dde->eta(),nearestPos.phi(),dde->phi()) < m_coneSize2; } } // end of namespace diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorRoughdR.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorRoughdR.cxx index afd513ca24db8833398508eb9fb0d73b919f449b..4f3a00fe98e5a299c02102d269f5ca8a19b339b5 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorRoughdR.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloCellSelectorRoughdR.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -99,10 +99,7 @@ namespace Trk bool CaloCellSelectorRoughdR::select( const CaloCell& cell )const { const CaloDetDescrElement* dde = cell.caloDDE(); if(!dde) return false; - if( Utils::deltaR2( m_midEta,dde->eta(),m_midPhi,dde->phi()) < m_maxDiff){ - return true; - } - return false; + return Utils::deltaR2( m_midEta,dde->eta(),m_midPhi,dde->phi()) < m_maxDiff; } } // end of namespace diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx index 031e4d99167c5333a0ccd102d2f0195ddcab3335..d38034896abbe0b8eef716bf7ddf1316fd6e46c2 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************************** @@ -9,64 +9,70 @@ PACKAGE: offline/Reconstruction/RecoTools/TrackToCalo/CaloExtensionBuilderAlg Based on: offline/Reconstruction/egamma/egammaTrackTools/EMGSFCaloExtensionBuilder AUTHORS: Anastopoulos/Capriles -PURPOSE: Performs Calo Extension for all selected tracks +PURPOSE: Performs Calo Extension for all selected tracks **********************************************************************/ #include "CaloExtensionBuilderAlg.h" // -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/TrackParticleAuxContainer.h" -#include "xAODTracking/TrackParticle.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/TrackParticleContainer.h" #include "VxVertex/RecVertex.h" #include "VxVertex/VxCandidate.h" -#include "xAODTracking/VertexContainer.h" #include "xAODTracking/Vertex.h" +#include "xAODTracking/VertexContainer.h" -//std includes +// std includes #include <algorithm> #include <cmath> #include <memory> -StatusCode Trk::CaloExtensionBuilderAlg::initialize() +StatusCode +Trk::CaloExtensionBuilderAlg::initialize() { - - ATH_CHECK(m_TrkSelection.retrieve()); - ATH_CHECK(m_particleCaloExtensionTool.retrieve()); - - ATH_CHECK(m_ParticleCacheKey.initialize()); - ATH_CHECK(m_TrkPartContainerKey.initialize()); - - return StatusCode::SUCCESS; -} - -StatusCode Trk::CaloExtensionBuilderAlg::CaloExtensionBuilderAlg::finalize(){ - return StatusCode::SUCCESS; + + ATH_CHECK(m_TrkSelection.retrieve()); + ATH_CHECK(m_particleCaloExtensionTool.retrieve()); + + ATH_CHECK(m_ParticleCacheKey.initialize()); + ATH_CHECK(m_TrkPartContainerKey.initialize()); + + return StatusCode::SUCCESS; } -StatusCode Trk::CaloExtensionBuilderAlg::execute() -{ +StatusCode +Trk::CaloExtensionBuilderAlg::CaloExtensionBuilderAlg::finalize() +{ + return StatusCode::SUCCESS; +} + +StatusCode +Trk::CaloExtensionBuilderAlg::execute_r(const EventContext& ctx) const +{ - SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_TrkPartContainerKey); - if(!tracks.isValid()) { - ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "<< m_TrkPartContainerKey.key()); - return StatusCode::FAILURE; - } + SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_TrkPartContainerKey, ctx); + if (!tracks.isValid()) { + ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " << m_TrkPartContainerKey.key()); + return StatusCode::FAILURE; + } - // creating and saving the calo extension collection - SG::WriteHandle<CaloExtensionCollection> lastCache(m_ParticleCacheKey); - ATH_CHECK(lastCache.record(std::make_unique<CaloExtensionCollection>())); + // creating and saving the calo extension collection + SG::WriteHandle<CaloExtensionCollection> lastCache(m_ParticleCacheKey,ctx); + ATH_CHECK(lastCache.record(std::make_unique<CaloExtensionCollection>())); - const xAOD::TrackParticleContainer* ptrTracks=tracks.cptr(); - CaloExtensionCollection* ptrPart=lastCache.ptr(); - std::vector<bool> mask (ptrTracks->size(),false); - for (auto track: *tracks){ - if ( static_cast<bool>(m_TrkSelection->accept(*track, nullptr))) mask[track->index()] = true; - } + const xAOD::TrackParticleContainer* ptrTracks = tracks.cptr(); + CaloExtensionCollection* ptrPart = lastCache.ptr(); + std::vector<bool> mask(ptrTracks->size(), false); + for (auto track : *tracks) { + if (static_cast<bool>(m_TrkSelection->accept(*track, nullptr))) + mask[track->index()] = true; + } - ATH_CHECK(m_particleCaloExtensionTool->caloExtensionCollection(*ptrTracks,mask,*ptrPart)); + ATH_CHECK(m_particleCaloExtensionTool->caloExtensionCollection(ctx, *ptrTracks, mask, *ptrPart)); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } diff --git a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h index 8df034f49f869d026b47a68d290338239efde7f2..3c79ad3fbc282ba51502a3956ef4739b073a0330 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h +++ b/Reconstruction/RecoTools/TrackToCalo/src/CaloExtensionBuilderAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRK_CALOEXTENSIONBUILDERALG_H @@ -16,74 +16,115 @@ #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" -#include "TrkCaloExtension/CaloExtensionCollection.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" +#include "TrkCaloExtension/CaloExtensionCollection.h" #include "ITrackToVertex/ITrackToVertex.h" -#include "TrkToolInterfaces/ITrackSelectorTool.h" #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" +#include "TrkToolInterfaces/ITrackSelectorTool.h" -#include "xAODTracking/VertexContainer.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "TRT_ReadoutGeometry/TRT_DetElementContainer.h" -namespace Trk +namespace Trk { +/** +This algorithm creates a calo extension collection and stores it in a Gaudi Gate +named "ParticleCaloExtension" to be read by other algorithms. Clients who want +to use the stored extensions should know that the +Trk::IParticleCaloExtensionTool's function caloExtension(*track) returns a +unique pointer where as the stored extensions come from a +CaloExtensionCollection which is a vector of Trk::CaloExtension pointers. In +order to have access to these extrapolations and have the ability to calculate +extrapolations in case they are not stored in the gate one needs to do the +following: The original calo extension object should be renamed to denote that +it holds an unique pointer and will act as a helper pointer (this is important) +After creating a read handle, one can access the correct Trk::CaloExtension * +objects from the CaloExtensionCollection via the xAOD::TrackParticle's index() +method. The CaloExtensionCollection is indexed the same way as the +xAOD::TrackParticleContainer so if the client has a derived track class that +changes the index, it is important to get the index from the original +xAOD::TrackParticle rather than the derived class. + +For usage and compatibility, one should do the same as is done in +TauElectronVetoVariables.cxx, TauTrackFinder.cxx, or +eflowTrackCaloExtensionTool.cxx. In short, the following will work for tracks +that are extrapolated: `extension = (*particleCache)[index];` In the case that +the desired extension is not extrapolated by this algorithm, the following needs +to be done: `uniqueExtension = theTrackExtrapolatorTool->caloExtension(*track);` +`extension = uniqueExtension.get();` One should avoid the use of `extension = +theTrackExtrapolatorTool->caloExtension(*track).get();` as it has unpredictable +behavior. +*/ +class CaloExtensionBuilderAlg : public AthAlgorithm { - /** - This algorithm creates a calo extension collection and stores it in a Gaudi Gate named "ParticleCaloExtension" to be read by other algorithms. - Clients who want to use the stored extensions should know that the Trk::IParticleCaloExtensionTool's function caloExtension(*track) returns a unique pointer where as the stored extensions come from - a CaloExtensionCollection which is a vector of Trk::CaloExtension pointers. - In order to have access to these extrapolations and have the ability to calculate extrapolations in case they are not stored in the gate one needs to do the following: - The original calo extension object should be renamed to denote that it holds an unique pointer and will act as a helper pointer (this is important) - After creating a read handle, one can access the correct Trk::CaloExtension * objects from the CaloExtensionCollection via the xAOD::TrackParticle's index() method. - The CaloExtensionCollection is indexed the same way as the xAOD::TrackParticleContainer so if the client has a derived track class that changes the index, it is important to get - the index from the original xAOD::TrackParticle rather than the derived class. - - For usage and compatibility, one should do the same as is done in TauElectronVetoVariables.cxx, TauTrackFinder.cxx, or eflowTrackCaloExtensionTool.cxx. - In short, the following will work for tracks that are extrapolated: - `extension = (*particleCache)[index];` - In the case that the desired extension is not extrapolated by this algorithm, the following needs to be done: - `uniqueExtension = theTrackExtrapolatorTool->caloExtension(*track);` - `extension = uniqueExtension.get();` - One should avoid the use of `extension = theTrackExtrapolatorTool->caloExtension(*track).get();` as it has unpredictable behavior. - */ - class CaloExtensionBuilderAlg : public AthAlgorithm//, virtual public ITrackSelectorTool - { - public: +public: using AthAlgorithm::AthAlgorithm; virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; - private: +private: /** @brief the Calo Extension tool*/ - ToolHandle<Trk::IParticleCaloExtensionTool> m_particleCaloExtensionTool {this, - "LastCaloExtentionTool", "Trk::CaloExtensionBuilderTool"}; + ToolHandle<Trk::IParticleCaloExtensionTool> m_particleCaloExtensionTool{ + this, + "LastCaloExtentionTool", + "Trk::CaloExtensionBuilderTool" + }; - ///Manages the track selection. It should be able to handle both pflow and tau selections - ToolHandle<InDet::IInDetTrackSelectionTool> m_TrkSelection {this, - "TrkSelection", "TrkSelectionCaloExtensionBuilder", "Tool that handles the track selection"}; + /// Manages the track selection. It should be able to handle both pflow and + /// tau selections + ToolHandle<InDet::IInDetTrackSelectionTool> m_TrkSelection{ + this, + "TrkSelection", + "TrkSelectionCaloExtensionBuilder", + "Tool that handles the track selection" + }; - ///output particle calo extension collection - SG::WriteHandleKey<CaloExtensionCollection> m_ParticleCacheKey{this, - "ParticleCache", "ParticleCaloExtension", "Name of the particle measurement extrapolation cache"}; + /// output particle calo extension collection + SG::WriteHandleKey<CaloExtensionCollection> m_ParticleCacheKey{ + this, + "ParticleCache", + "ParticleCaloExtension", + "Name of the particle measurement extrapolation cache" + }; - ///input Track collection and vertex - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrkPartContainerKey {this, - "TrkPartContainerName", "InDetTrackParticles", "Container of tracks"}; + /// input Track collection and vertex + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrkPartContainerKey{ + this, + "TrkPartContainerName", + "InDetTrackParticles", + "Container of tracks" + }; // For P->T converters of ID tracks with Pixel - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, - "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}; + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_pixelDetEleCollKey{ this, + "PixelDetEleCollKey", + "PixelDetectorElementCollection", + "Key of SiDetectorElementCollection for Pixel" }; // For P->T converters of ID tracks with SCT - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, - "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_SCTDetEleCollKey{ this, + "SCTDetEleCollKey", + "SCT_DetectorElementCollection", + "Key of SiDetectorElementCollection for SCT" }; // For P->T converters of ID tracks with TRT - SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetEleContKey{this, "TRTDetEleContKey", "TRT_DetElementContainer", "Key of TRT_DetElementContainer"}; - + SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetEleContKey{ + this, + "TRTDetEleContKey", + "TRT_DetElementContainer", + "Key of TRT_DetElementContainer" }; +}; } #endif // diff --git a/Reconstruction/RecoTools/TrackToCalo/src/MuonCaloEnergyTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/MuonCaloEnergyTool.cxx index bfd795a841ee1469a034f3a431daa3429bfde90f..b93b74c4d2d39a0c34f7f61876258379af60d14e 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/MuonCaloEnergyTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/MuonCaloEnergyTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCaloEnergyTool.h" @@ -19,7 +19,7 @@ #include "xAODTracking/TrackingPrimitives.h" #include "GaudiKernel/SystemOfUnits.h" -#include <math.h> +#include <cmath> namespace Rec { @@ -98,7 +98,7 @@ namespace Rec { E_dead_exp = 0.; bool storeCells = false; - if(crossedCells!=0&&sigmaNoise_cell!=0&&E_exp_cell!=0) { + if(crossedCells!=nullptr&&sigmaNoise_cell!=nullptr&&E_exp_cell!=nullptr) { storeCells = true; crossedCells->clear(); sigmaNoise_cell->clear(); @@ -134,7 +134,7 @@ namespace Rec { // associate muon to calorimeter - const xAOD::TrackParticle* tp = 0; + const xAOD::TrackParticle* tp = nullptr; SG::ReadHandle<xAOD::TrackParticleContainer> indetTrackParticles(m_indetTrackParticleLocation); if(indetTrackParticles.isValid()){ @@ -170,7 +170,7 @@ namespace Rec { std::unique_ptr<const xAOD::TrackParticle> tpholder; if(!tp) { tpholder = std::unique_ptr<const xAOD::TrackParticle> - (m_particleCreator->createParticle(*trk, NULL, NULL, xAOD::muon) ); + (m_particleCreator->createParticle(*trk, nullptr, nullptr, xAOD::muon) ); tp = tpholder.get(); if(tp) ATH_MSG_DEBUG( " xAOD::TrackParticle created from scratch " << tp ); diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloCellAssociationTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloCellAssociationTool.cxx index 1c3319e7b70d638a027d54a2e18f5a3f841fc06c..cd37cc80bf6d45846112ec49a538741fe64f57eb 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloCellAssociationTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloCellAssociationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ParticleCaloCellAssociationTool.h" @@ -18,7 +18,7 @@ #include "CaloUtils/CaloCellList.h" #include "xAODTracking/TrackingPrimitives.h" -#include <math.h> +#include <cmath> #include <memory> namespace Rec { @@ -96,7 +96,7 @@ ParticleCaloCellAssociationTool::particleCellAssociation( const xAOD::IParticle& /*if not there , default ctor for unique_ptr (nullptr)*/ std::unique_ptr<ParticleCellAssociation>& association= cache[particle.index()]; - if (association.get()==nullptr){ + if (association==nullptr){ association=particleCellAssociation(particle,dr,container); } return association.get(); @@ -180,7 +180,7 @@ void ParticleCaloCellAssociationTool::getCellIntersections( const Trk::CaloExten double drMin = 100000.; int dscut = 1; if(!barrel) dscut = 0; - const CaloCell* cellFound = 0; + const CaloCell* cellFound = nullptr; for( auto celln : cells ){ if(cell==celln) continue; if(cell->caloDDE()->getSubCalo() == celln->caloDDE()->getSubCalo()) { @@ -225,7 +225,7 @@ void ParticleCaloCellAssociationTool::getCellIntersections( const Trk::CaloExten double dzMin = 100000.; int dscut = 1; if(barrel) dscut = 0; - const CaloCell* cellFound = 0; + const CaloCell* cellFound = nullptr; for( auto celln : cells ){ if(cell==celln) continue; if(cell->caloDDE()->getSubCalo() == celln->caloDDE()->getSubCalo()) { diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx index 40ac80418b8533710703252873f62b77470a17a2..bc87f568f39b487fd5c9eafbc51f6386a8f8f35f 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloClusterAssociationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ParticleCaloClusterAssociationTool.h" @@ -61,7 +61,7 @@ namespace Rec { ATH_MSG_DEBUG(" particleClusterAssociation: ptr " << &particle << " dr " << dr << " useCaching " << useCaching); // reset pointer - association = 0; + association = nullptr; // check if link is already there if( useCaching ){ if( particle.isAvailable< ParticleClusterAssociation* >("clusterAssociation") ){ @@ -88,7 +88,7 @@ namespace Rec { // get the extrapolation into the calo std::unique_ptr<Trk::CaloExtension> caloExtension = m_caloExtensionTool->caloExtension(particle); - if( caloExtension.get()==nullptr ) { + if( caloExtension==nullptr ) { ATH_MSG_DEBUG("Failed to get calo extension"); return false; } @@ -111,13 +111,13 @@ namespace Rec { association = new ParticleClusterAssociation( caloExtension.release(), std::move(clusters), dr, container ); // now add particle and CaloExtension to the container - IParticleToCaloExtensionMap * caloExtensionMap = 0; + IParticleToCaloExtensionMap * caloExtensionMap = nullptr; if(not evtStore()->contains<IParticleToCaloExtensionMap>(m_caloEntryMapName)) { caloExtensionMap = new IParticleToCaloExtensionMap(); if (evtStore()->record(caloExtensionMap, m_caloEntryMapName).isFailure()) { ATH_MSG_WARNING( "Failed to record output collection, will leak the ParticleCaloExtension"); delete caloExtensionMap; - caloExtensionMap = 0; + caloExtensionMap = nullptr; } } else { if(evtStore()->retrieve(caloExtensionMap,m_caloEntryMapName).isFailure()) { @@ -217,11 +217,11 @@ namespace Rec { const xAOD::CaloClusterContainer* ParticleCaloClusterAssociationTool::getClusterContainer() const { - const xAOD::CaloClusterContainer* container = 0; + const xAOD::CaloClusterContainer* container = nullptr; //retrieve the cell container if( evtStore()->retrieve(container, m_caloClusters).isFailure() || !container ) { ATH_MSG_WARNING( "Unable to retrieve the cluster container " << m_caloClusters << " container ptr " << container ); - return 0; + return nullptr; } if( container ) ATH_MSG_DEBUG("Retrieved cluster container " << container->size()); return container; diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx index 5dba197528791ee2bd1e0ae55808460b368c1997..512ba3a7994b6ae80f08263ca39f568c12f99d77 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ParticleCaloExtensionTool.h" @@ -49,41 +49,43 @@ StatusCode ParticleCaloExtensionTool::finalize() { } std::unique_ptr<Trk::CaloExtension> -ParticleCaloExtensionTool::caloExtension(const xAOD::IParticle& particle) const { +ParticleCaloExtensionTool::caloExtension(const EventContext& ctx, + const xAOD::IParticle& particle) const { if(particle.type()==xAOD::Type::TrackParticle){ const xAOD::TrackParticle* trackParticle = static_cast< const xAOD::TrackParticle*>(&particle); - return caloExtension(*trackParticle); + return caloExtension(ctx, *trackParticle); } - else if (particle.type()==xAOD::Type::TruthParticle){ + if (particle.type()==xAOD::Type::TruthParticle){ const xAOD::TruthParticle* truthParticle = static_cast< const xAOD::TruthParticle*>(&particle); - return caloExtension(*truthParticle); + return caloExtension(ctx, *truthParticle); } else if(particle.type()==xAOD::Type::Electron){ const xAOD::Electron* el = static_cast< const xAOD::Electron*>(&particle); if( el->trackParticle() ) { - return caloExtension(*(el->trackParticle())); + return caloExtension(ctx, *(el->trackParticle())); } } else if(particle.type()==xAOD::Type::Muon){ const xAOD::Muon* muon = static_cast< const xAOD::Muon*>(&particle); if( muon->primaryTrackParticle() ) { - return caloExtension(*(muon->primaryTrackParticle())); + return caloExtension(ctx, *(muon->primaryTrackParticle())); } } else if(particle.type()==xAOD::Type::NeutralParticle){ const xAOD::NeutralParticle* neutralParticle = static_cast< const xAOD::NeutralParticle*>(&particle); - return caloExtension(*neutralParticle); + return caloExtension(ctx, *neutralParticle); } ATH_MSG_WARNING("Unsupported IParticle type"); return nullptr; } -const Trk::CaloExtension* ParticleCaloExtensionTool::caloExtension( const xAOD::IParticle& particle, +const Trk::CaloExtension* ParticleCaloExtensionTool::caloExtension( const EventContext& ctx, + const xAOD::IParticle& particle, IParticleCaloExtensionTool::Cache& cache ) const{ /*if not there , default ctor for unique_ptr (nullptr)*/ std::unique_ptr<Trk::CaloExtension>& extension= cache[particle.index()]; - if (extension.get()==nullptr){ - extension=caloExtension(particle); + if (extension==nullptr){ + extension=caloExtension(ctx, particle); } return extension.get(); } @@ -98,7 +100,8 @@ const Trk::CaloExtension* ParticleCaloExtensionTool::caloExtension( const xAOD:: return nullptr; } -StatusCode ParticleCaloExtensionTool::caloExtensionCollection( const xAOD::IParticleContainer& particles, +StatusCode ParticleCaloExtensionTool::caloExtensionCollection( const EventContext& ctx, + const xAOD::IParticleContainer& particles, const std::vector<bool>& mask, CaloExtensionCollection& caloextensions) const{ const size_t numparticles=particles.size(); @@ -112,8 +115,8 @@ StatusCode ParticleCaloExtensionTool::caloExtensionCollection( const xAOD::IPart * i.e one with no intersections */ for (size_t i=0 ; i<numparticles; ++i){ - if (mask[i]==true){ - std::unique_ptr<Trk::CaloExtension> extension=caloExtension(*(particles[i])); + if (mask[i]){ + std::unique_ptr<Trk::CaloExtension> extension=caloExtension(ctx, *(particles[i])); caloextensions.push_back(std::move(extension)); } else{ @@ -124,14 +127,15 @@ StatusCode ParticleCaloExtensionTool::caloExtensionCollection( const xAOD::IPart } std::unique_ptr<Trk::CaloExtension> -ParticleCaloExtensionTool::caloExtension( const xAOD::TruthParticle& particle ) const { +ParticleCaloExtensionTool::caloExtension( const EventContext& ctx, + const xAOD::TruthParticle& particle ) const { ParticleHypothesis particleType = muon; if( abs(particle.pdgId()) == 11 ) {particleType = muon;} else if( abs(particle.pdgId()) == 13 ) {particleType = muon;} // get start parameters const xAOD::TruthVertex* pvtx = particle.prodVtx(); - if ( pvtx == 0 ) { + if ( pvtx == nullptr ) { return nullptr; } double charge = particle.charge(); @@ -145,27 +149,29 @@ ParticleCaloExtensionTool::caloExtension( const xAOD::TruthParticle& particle ) } Trk::CurvilinearParameters startPars(pos,mom,charge); // get extension - return caloExtension( startPars, alongMomentum, particleType ); + return caloExtension( ctx, startPars, alongMomentum, particleType ); } std::unique_ptr<Trk::CaloExtension> -ParticleCaloExtensionTool::caloExtension( const xAOD::NeutralParticle& particle ) const { +ParticleCaloExtensionTool::caloExtension( const EventContext& ctx, + const xAOD::NeutralParticle& particle ) const { // create start parameters const Trk::NeutralPerigee& perigee = particle.perigeeParameters(); double charge = 1.; - Amg::Vector3D pos( perigee.position() ); + const Amg::Vector3D& pos( perigee.position() ); Amg::Vector3D mom( perigee.momentum() ); // Aproximate neutral particles as charged with infinite momentum mom.normalize(); mom *= 1e10; Trk::CurvilinearParameters startPars(pos,mom,charge); // get extension - return caloExtension( startPars, alongMomentum, muon ); + return caloExtension( ctx, startPars, alongMomentum, muon ); } std::unique_ptr<Trk::CaloExtension> -ParticleCaloExtensionTool::caloExtension( const xAOD::TrackParticle& particle ) const { +ParticleCaloExtensionTool::caloExtension( const EventContext& ctx, + const xAOD::TrackParticle& particle ) const { /* * In principle we will extrapolate either from the perigee or @@ -190,7 +196,7 @@ ParticleCaloExtensionTool::caloExtension( const xAOD::TrackParticle& particle ) if(fabs(particle.perigeeParameters().position().z())>6700.) idExit = false; if(particle.perigeeParameters().position().perp()>4200.) idExit = false; PropDirection propDir = idExit ? alongMomentum : oppositeMomentum; - return caloExtension(particle.perigeeParameters(),propDir,particleType); + return caloExtension(ctx, particle.perigeeParameters(),propDir,particleType); } const Track& track = *particle.track(); @@ -199,8 +205,8 @@ ParticleCaloExtensionTool::caloExtension( const xAOD::TrackParticle& particle ) * ID and muon system */ ATH_MSG_DEBUG("trying to add calo layers" ); - const TrackParameters* idExitParamers = 0; - const TrackParameters* muonEntryParamers = 0; + const TrackParameters* idExitParamers = nullptr; + const TrackParameters* muonEntryParamers = nullptr; DataVector<const TrackStateOnSurface>::const_iterator itTSoS = track.trackStateOnSurfaces()->begin(); for ( ; itTSoS != track.trackStateOnSurfaces()->end(); ++itTSoS) { // select state with track parameters on a measurement @@ -224,12 +230,13 @@ ParticleCaloExtensionTool::caloExtension( const xAOD::TrackParticle& particle ) } PropDirection propDir = idExitParamers ? alongMomentum : oppositeMomentum; - return caloExtension(*startPars,propDir,particleType); + return caloExtension(ctx, *startPars,propDir,particleType); } std::unique_ptr<Trk::CaloExtension> -ParticleCaloExtensionTool::caloExtension( const TrackParameters& startPars, +ParticleCaloExtensionTool::caloExtension( const EventContext& ctx, + const TrackParameters& startPars, PropDirection propDir, ParticleHypothesis particleType ) const { @@ -247,7 +254,7 @@ ParticleCaloExtensionTool::caloExtension( const TrackParameters& startPars, */ const std::vector<std::pair<const Trk::TrackParameters *,int>>* caloParameters= - m_extrapolator->extrapolate(startPars, propDir, particleType, material, 3); + m_extrapolator->extrapolate(ctx, startPars, propDir, particleType, material, 3); if (material) { ATH_MSG_DEBUG("Got material " << material->size() ); for( auto& m : *material ) { @@ -268,8 +275,8 @@ ParticleCaloExtensionTool::caloExtension( const TrackParameters& startPars, TrackParametersIdHelper parsIdHelper; // create final object - const TrackParameters* caloEntry = 0; - const TrackParameters* muonEntry = 0; + const TrackParameters* caloEntry = nullptr; + const TrackParameters* muonEntry = nullptr; std::vector<const CurvilinearParameters*> caloLayers; caloLayers.reserve(caloParameters->size()-1); ATH_MSG_DEBUG( " Found calo parameters: " << caloParameters->size() ); @@ -289,7 +296,7 @@ ParticleCaloExtensionTool::caloExtension( const TrackParameters& startPars, else if( p.second == 3 && propDir == Trk::alongMomentum) {muonEntry = p.first;} else if( p.second == 4 && propDir == Trk::oppositeMomentum) {muonEntry = p.first;} else{ - bool isEntry = p.second > 0 ? true : false; + bool isEntry = p.second > 0; TrackParametersIdentifier id = parsIdHelper.encode( AtlasDetDescr::fFirstAtlasCaloTechnology, static_cast<CaloSampling::CaloSample>( abs(p.second)%1000 ), isEntry ); diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h index 34ff918792aac2c19c1cb230a78f1663a90d3ac0..8fee32cea601fe1c16055558ec53efe5e9541d04 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h @@ -39,6 +39,13 @@ class IExtrapolator; class ParticleCaloExtensionTool : virtual public IParticleCaloExtensionTool, public AthAlgTool { public: + /** This following "using" statements can be removed after the methods in IParticleCaloExtensionTool.h for the + * old interfaces WITHOUT EventContext are removed, i.e. only the new ones with EventContext are + * used throughout the sw */ + using IParticleCaloExtensionTool::caloExtension; + using IParticleCaloExtensionTool::caloExtensionCollection; + + ParticleCaloExtensionTool(const std::string&,const std::string&,const IInterface*); virtual ~ParticleCaloExtensionTool(); @@ -48,28 +55,35 @@ public: /* * Implement the IParticleCaloExtension methods */ - virtual std::unique_ptr<Trk::CaloExtension> caloExtension(const xAOD::IParticle& particle) const override final; + virtual std::unique_ptr<Trk::CaloExtension> caloExtension(const EventContext& ctx, + const xAOD::IParticle& particle) const override final; - virtual const Trk::CaloExtension* caloExtension( const xAOD::IParticle& particle, + virtual const Trk::CaloExtension* caloExtension( const EventContext& ctx, + const xAOD::IParticle& particle, IParticleCaloExtensionTool::Cache& cache ) const override final; virtual const Trk::CaloExtension* caloExtension( const xAOD::IParticle& particle, const CaloExtensionCollection& cache ) const override final; - virtual StatusCode caloExtensionCollection( const xAOD::IParticleContainer& particles, + virtual StatusCode caloExtensionCollection( const EventContext& ctx, + const xAOD::IParticleContainer& particles, const std::vector<bool>& mask, CaloExtensionCollection& caloextensions) const override final; - virtual std::unique_ptr<Trk::CaloExtension> caloExtension( const TrackParameters& startPars, + virtual std::unique_ptr<Trk::CaloExtension> caloExtension( const EventContext& ctx, + const TrackParameters& startPars, PropDirection propDir, ParticleHypothesis particleType ) const override final; private: - std::unique_ptr<Trk::CaloExtension> caloExtension( const xAOD::TruthParticle& particle ) const; - std::unique_ptr<Trk::CaloExtension> caloExtension( const xAOD::NeutralParticle& particle ) const; - std::unique_ptr<Trk::CaloExtension> caloExtension( const xAOD::TrackParticle& particle ) const; + std::unique_ptr<Trk::CaloExtension> caloExtension( const EventContext& ctx, + const xAOD::TruthParticle& particle ) const; + std::unique_ptr<Trk::CaloExtension> caloExtension( const EventContext& ctx, + const xAOD::NeutralParticle& particle ) const; + std::unique_ptr<Trk::CaloExtension> caloExtension( const EventContext& ctx, + const xAOD::TrackParticle& particle ) const; ToolHandle<Trk::IExtrapolator> m_extrapolator {this, "Extrapolator", ""}; Gaudi::Property<std::string> m_particleTypeName{this,"ParticleType","muon", diff --git a/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.cxx b/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.cxx index c16e32816f543f5fd4da6a0464a82538f64dadb9..6f589c3a03e631d2df5e39aa521b465dcc0ede68 100755 --- a/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "PathLengthUtils.h" @@ -483,7 +483,7 @@ double PathLengthUtils::get3DPathLength(const CaloCell& cell, const Amg::Vector3 return path; } -bool PathLengthUtils::crossingMatrix(Amg::MatrixX Matrix ,Amg::Vector3D entry, Amg::Vector3D& path) const { +bool PathLengthUtils::crossingMatrix(const Amg::MatrixX& Matrix ,const Amg::Vector3D& entry, Amg::Vector3D& path) const { // std::cout << " Matrix determinant " << Matrix.determinant() << std::endl; // std::cout << " Matrix " << std::endl; diff --git a/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.h b/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.h index 2ab26881e90c55baed3038f1a511f26c78af72d9..e362b5c753f2f05702d7ec4635d7786901b1546c 100755 --- a/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.h +++ b/Reconstruction/RecoTools/TrackToCalo/src/PathLengthUtils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -50,7 +50,7 @@ double getPathLengthInEta(const CaloCell& cell, double eta_entrance, double eta_exit) const; double getPathLengthInZ(double zMin, double zMax, double z_entrance, double z_exit) const; double getPathLengthInZ(const CaloCell& cell, double z_entrance, double z_exit) const; - bool crossingMatrix(Amg::MatrixX Matrix ,Amg::Vector3D entry, Amg::Vector3D& path) const; + bool crossingMatrix(const Amg::MatrixX& Matrix ,const Amg::Vector3D& entry, Amg::Vector3D& path) const; }; inline double PathLengthUtils::phiMean(double a, double b) const { return 0.5*(a+b) + (a*b < 0)*M_PI; } diff --git a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx index 14b557d20e2beaccad16419db2f038456d8c1826..ab072e6d8d55019909e8f921e84aed4f544926e2 100755 --- a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx +++ b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx @@ -27,11 +27,9 @@ const Amg::Vector3D Reco::TrackToVertex::s_origin(0.,0.,0.); // constructor Reco::TrackToVertex::TrackToVertex(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_extrapolator("Trk::Extrapolator/AtlasExtrapolator", this) + m_extrapolator{this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"} { declareInterface<ITrackToVertex>(this); - // the extrapolatr and the BeamCondSvc - declareProperty("Extrapolator", m_extrapolator); declareProperty("ForceBeamSpotZero", m_ForceBeamSpotZero); } diff --git a/Reconstruction/eflowRec/CMakeLists.txt b/Reconstruction/eflowRec/CMakeLists.txt index 1e8d71b96d53da2c80eb5eb827038d1e53df4ebf..e41d112abd606f5064de59bce8d38e1558cecb81 100644 --- a/Reconstruction/eflowRec/CMakeLists.txt +++ b/Reconstruction/eflowRec/CMakeLists.txt @@ -47,7 +47,7 @@ atlas_add_component( eflowRec src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives xAODCaloEvent xAODEgamma xAODMuon xAODPFlow xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry TrackVertexAssociationToolLib Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib SGtests FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloEvent CaloIdentifier CaloRecLib AthContainers AthLinks AthenaBaseComps CxxUtils AthenaKernel GeoPrimitives xAODCaloEvent xAODEgamma xAODMuon xAODPFlow xAODTracking GaudiKernel InDetReadoutGeometry TRT_ReadoutGeometry TrackVertexAssociationToolLib Particle RecoToolInterfaces TrkParameters CaloDetDescrLib CaloUtilsLib StoreGateLib SGtests FourMomUtils PathResolver TrkCaloExtension TrkParametersIdentificationHelpers InDetTrackSelectionToolLib AthenaMonitoringKernelLib ) # Install files from the package: atlas_install_headers( eflowRec ) diff --git a/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h index 44619047eb9a4235f857b952c2a756e90b4ad4d0..d428d9dfe86b43fd8fc1e76b55d2a715cbf65998 100644 --- a/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h +++ b/Reconstruction/eflowRec/eflowRec/PFAlgorithm.h @@ -7,6 +7,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "StoreGate/DataHandle.h" +#include "AthenaMonitoringKernel/Monitored.h" #include "eflowRec/eflowCaloObject.h" #include "eflowRec/eflowRecTrack.h" @@ -50,7 +51,10 @@ private: /** WriteHandleKey for eflowCaloObjectContainer to be written out */ SG::WriteHandleKey<eflowCaloObjectContainer> m_eflowCaloObjectsWriteHandleKey{this,"eflowCaloObjectsOutputName","eflowCaloObjects","WriteHandleKey for eflowCaloObjectContainer to be written out"}; - + + /** Online monitoring tool for recording histograms of the alg in action */ + ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; + /** Funciton to print out list of tools if in VERBOSE mode */ void printTools(); diff --git a/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h b/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h index c4ee1336b31f387ad5f93bc1b52f2d01a7aeb298..064d6f2ba70a86571464b1dcbf50a76da02054ac 100644 --- a/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h +++ b/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h @@ -9,6 +9,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "StoreGate/DataHandle.h" #include "StoreGate/ReadCondHandleKey.h" +#include "AthenaMonitoringKernel/Monitored.h" #include "eflowRec/eflowRecTrack.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" @@ -74,5 +75,7 @@ private: /** Upper limit on track Pt for input tracks */ Gaudi::Property<float> m_upperTrackPtCut{this,"upperTrackPtCut",100.0,"Upper limit on track Pt for input tracks"}; + /** Online monitoring tool for recording histograms of the alg in action */ + ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"}; }; #endif diff --git a/Reconstruction/eflowRec/python/PFHLTConfig.py b/Reconstruction/eflowRec/python/PFHLTConfig.py index d1b0c06c510a3ab75bb0bce1dc705234a2127f25..82920efa765d190c9c5c83fdd6bc872f75f903c1 100644 --- a/Reconstruction/eflowRec/python/PFHLTConfig.py +++ b/Reconstruction/eflowRec/python/PFHLTConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -16,8 +16,7 @@ def TrackingGeoCfg(inputFlags): result.merge(MuonGeoModelCfg(inputFlags)) from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg - acc, geom_svc = TrackingGeometrySvcCfg(inputFlags) - result.merge(acc) + result.merge(TrackingGeometrySvcCfg(inputFlags)) from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg result.merge(MagneticFieldSvcCfg(inputFlags)) @@ -99,9 +98,16 @@ def PFCfg(inputFlags): calogeocfg = CaloGeoAndNoiseCfg(inputFlags) result.merge(calogeocfg) - result.addEventAlgo( getHLTPFTrackSelector(inputFlags, + PFTrackSelector = getHLTPFTrackSelector(inputFlags, inputFlags.eflowRec.TrackColl, - inputFlags.eflowRec.VertexColl) ) + inputFlags.eflowRec.VertexColl) + + # Add monitoring tool + from eflowRec import PFOnlineMon + monTool = PFOnlineMon.getMonTool_PFTrackSelector() + PFTrackSelector.MonTool = monTool + + result.addEventAlgo( PFTrackSelector ) #---------------------------------------------------------------------------------# # PFlowAlgorithm -- subtraction steps @@ -124,6 +130,9 @@ def PFCfg(inputFlags): pfmoments.CaloClusterMomentsMaker.MomentsNames = ["CENTER_MAG"] PFAlgorithm.BaseToolList = [pfmoments] + monTool = PFOnlineMon.getMonTool_PFAlgorithm() + PFAlgorithm.MonTool = monTool + result.addEventAlgo(PFAlgorithm) #---------------------------------------------------------------------------------# @@ -167,7 +176,7 @@ if __name__=="__main__": cfg=MainServicesCfg(cfgFlags) from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg - tccfg = CaloTopoClusterCfg(cfgFlags) + tccfg = CaloTopoClusterCfg(cfgFlags,doLCCalib=True) tcalg = tccfg.getPrimary() tcalg.ClustersOutputName = "CaloCalTopoClustersNew" cfg.merge(tccfg) @@ -178,7 +187,7 @@ if __name__=="__main__": cfg.merge(PFCfg(cfgFlags)) - cfg.printConfig(summariseProps=True) + cfg.printConfig()# (summariseProps=True) outputlist = [ "xAOD::CaloClusterContainer#CaloCalTopoClusters*", @@ -191,6 +200,8 @@ if __name__=="__main__": from pprint import pprint pprint( cfg.getEventAlgo("OutputStreamxAOD").ItemList ) + histSvc = CompFactory.THistSvc(Output = ["EXPERT DATAFILE='expert-monitoring.root', OPT='RECREATE'"]) + cfg.addService(histSvc) cfg.getService("StoreGateSvc").Dump = True diff --git a/Reconstruction/eflowRec/python/PFHLTSequence.py b/Reconstruction/eflowRec/python/PFHLTSequence.py index 3586a211f56d114964cbf546fce69b689000218d..146426e762fe4062e5d2f25262cd2eee250222fc 100644 --- a/Reconstruction/eflowRec/python/PFHLTSequence.py +++ b/Reconstruction/eflowRec/python/PFHLTSequence.py @@ -3,6 +3,9 @@ from __future__ import print_function from eflowRec import eflowRecConf from InDetTrackSelectionTool import InDetTrackSelectionToolConf +from AthenaCommon.Logging import logging +log = logging.getLogger('PFHLTSequence') + # Use the appropriate containers based on what config is desired trackvtxcontainers = { "offline": ("InDetTrackParticles","PrimaryVertices"), @@ -47,6 +50,10 @@ def getPFTrackSel(tracktype): PFTrackSelector.tracksName = tracksin PFTrackSelector.VertexContainer = verticesin + from eflowRec import PFOnlineMon + monTool = PFOnlineMon.getMonTool_PFTrackSelector() + PFTrackSelector.MonTool = monTool + return PFTrackSelector # PFAlgorithm @@ -113,6 +120,10 @@ def getPFAlg(clustersin,tracktype): SubtractionToolList = [PFCellLevelSubtractionTool,PFRecoverSplitShowersTool], BaseToolList = [PFMomentCalculatorTool] ) + + from eflowRec import PFOnlineMon + monTool = PFOnlineMon.getMonTool_PFAlgorithm() + PFAlgorithm.MonTool = monTool return PFAlgorithm @@ -145,6 +156,6 @@ def PFHLTSequence(dummyflags,clustersin,tracktype): pfSequence = parOR("HLTPFlow_"+tracktype, [PFTrkSel,PFAlg,PFCCreator,PFNCreator]) pfoPrefix = "HLT_"+tracktype - print (pfSequence) + log.debug("Created sequence:\n%s", pfSequence) return pfSequence, pfoPrefix diff --git a/Reconstruction/eflowRec/python/PFOnlineMon.py b/Reconstruction/eflowRec/python/PFOnlineMon.py new file mode 100644 index 0000000000000000000000000000000000000000..ec071ead7346304301b5462375d0eac2687688ec --- /dev/null +++ b/Reconstruction/eflowRec/python/PFOnlineMon.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +def getMonTool_PFAlgorithm(): + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + monTool = GenericMonitoringTool('MonTool') + + #monTool.HistPath = 'MyGroup/MySubDir' # default is the parent name of MonTool + monTool.defineHistogram( 'TIME_execute', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=1000 ) + monTool.defineHistogram( 'TIME_subtract', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=1000 ) + monTool.defineHistogram( 'N_efrTracks', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=1000 ) + monTool.defineHistogram( 'N_efrClusters', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=2000 ) + return monTool + +def getMonTool_PFTrackSelector(): + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + monTool = GenericMonitoringTool('MonTool') + + #monTool.HistPath = 'MyGroup/MySubDir' # default is the parent name of MonTool + monTool.defineHistogram( 'TIME_execute', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=1000 ) + monTool.defineHistogram( 'TIME_track', path='EXPERT', type='TH1F', title='Counts', + xbins=50, xmin=0, xmax=50 ) + monTool.defineHistogram( 'N_tracks', path='EXPERT', type='TH1F', title='Counts', + xbins=100, xmin=0, xmax=500 ) + return monTool diff --git a/Reconstruction/eflowRec/share/jetAlgs.py b/Reconstruction/eflowRec/share/jetAlgs.py index 8e97510190fde9548a4fc259e09cfbc6e7b67ae1..98b2e68df4d2bbda365541fc8b8a7f34e8ca2439 100644 --- a/Reconstruction/eflowRec/share/jetAlgs.py +++ b/Reconstruction/eflowRec/share/jetAlgs.py @@ -1,5 +1,8 @@ #Run PFlow jet finding from JetRec.JetRecStandard import jtm -jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 10000, calibOpt="arj:pflow") +jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow_reduced", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 10000, calibOpt="arj:pflow") from JetRec.JetAlgorithm import addJetRecoToAlgSequence addJetRecoToAlgSequence(eventShapeTools=["empflow"]) + +if not hasattr( topSequence, "LumiBlockMuWriter" ): + include ("LumiBlockComps/LumiBlockMuWriter_jobOptions.py") diff --git a/Reconstruction/eflowRec/src/PFAlgorithm.cxx b/Reconstruction/eflowRec/src/PFAlgorithm.cxx index 222e2f82eec3e39db02b049510ed038935d5a13e..7cef16fe370d0e4028a7dcc553ffc02978ae52f4 100644 --- a/Reconstruction/eflowRec/src/PFAlgorithm.cxx +++ b/Reconstruction/eflowRec/src/PFAlgorithm.cxx @@ -22,12 +22,19 @@ StatusCode PFAlgorithm::initialize(){ ATH_CHECK(m_eflowCaloObjectsWriteHandleKey.initialize()); ATH_CHECK(m_caloClustersWriteHandleKey.initialize()); + if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve()); + printTools(); return StatusCode::SUCCESS; } StatusCode PFAlgorithm::execute(){ + // Define monitored quantities + auto t_exec = Monitored::Timer<std::chrono::milliseconds>( "TIME_execute" ); + auto t_subtract = Monitored::Timer<std::chrono::milliseconds>( "TIME_subtract" ); + auto N_efrTracks = Monitored::Scalar( "N_efrTracks", 0 ); + auto N_efrClusters = Monitored::Scalar( "N_efrClusters", 0 ); ATH_MSG_DEBUG("Executing"); @@ -49,25 +56,34 @@ StatusCode PFAlgorithm::execute(){ xAOD::CaloClusterContainer& theCaloClusterContainerReference = *(caloClustersWriteHandle.ptr()); ATH_CHECK(m_IPFClusterSelectorTool->execute(theEFlowRecClusterContainerReference,theCaloClusterContainerReference)); - + + // Explicitly start/stop the timer around the subtraction tool calls + t_subtract.start(); /* Run the SubtractionTools */ for (auto thisIPFSubtractionTool : m_IPFSubtractionTools){ thisIPFSubtractionTool->execute(theElowCaloObjectContainer,&localEFlowRecTrackContainer,&theEFlowRecClusterContainerReference); } + t_subtract.stop(); - for (auto thisEFTrack : localEFlowRecTrackContainer){ - ATH_MSG_DEBUG("This efRecTrack has E,pt,eta and phi of " << thisEFTrack->getTrack()->e() << ", " << thisEFTrack->getTrack()->pt() << ", " << thisEFTrack->getTrack()->eta() << " and " << thisEFTrack->getTrack()->phi()); - } + if(msgLvl(MSG::DEBUG)) { + for (auto thisEFTrack : localEFlowRecTrackContainer){ + msg() << "This efRecTrack has E,pt,eta and phi of " << thisEFTrack->getTrack()->e() << ", " << thisEFTrack->getTrack()->pt() << ", " << thisEFTrack->getTrack()->eta() << " and " << thisEFTrack->getTrack()->phi() << endmsg; + } - for (auto thisEFCluster : *(eflowRecClustersWriteHandle.ptr()) ){ - ATH_MSG_DEBUG("This efRecCluster has E,pt,eta and phi of " << thisEFCluster->getCluster()->e() << "," << thisEFCluster->getCluster()->pt() << ", " << thisEFCluster->getCluster()->eta() << " and " << thisEFCluster->getCluster()->phi()); + for (auto thisEFCluster : *(eflowRecClustersWriteHandle.ptr()) ){ + msg() << "This efRecCluster has E,pt,eta and phi of " << thisEFCluster->getCluster()->e() << "," << thisEFCluster->getCluster()->pt() << ", " << thisEFCluster->getCluster()->eta() << " and " << thisEFCluster->getCluster()->phi() << endmsg; + } } + N_efrTracks = localEFlowRecTrackContainer.size(); + N_efrClusters = theEFlowRecClusterContainerReference.size(); + /* Run the other AglTools */ for (auto thisIPFBaseTool : m_IPFBaseTools){ thisIPFBaseTool->execute(*theElowCaloObjectContainer); } - + + auto mon = Monitored::Group(m_monTool, t_exec, t_subtract, N_efrTracks, N_efrClusters); return StatusCode::SUCCESS; } diff --git a/Reconstruction/eflowRec/src/PFTrackSelector.cxx b/Reconstruction/eflowRec/src/PFTrackSelector.cxx index dea0c0f82c8fbd1c77e4f6115e2de28f3982a82d..e07e2781433624088b8893fafcff568caaec35ec 100644 --- a/Reconstruction/eflowRec/src/PFTrackSelector.cxx +++ b/Reconstruction/eflowRec/src/PFTrackSelector.cxx @@ -33,11 +33,16 @@ StatusCode PFTrackSelector::initialize(){ ATH_CHECK(m_eflowRecTracksWriteHandleKey.initialize()); + if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve()); + return StatusCode::SUCCESS; } StatusCode PFTrackSelector::execute(){ + // Monitor the time taken to execute the alg + auto t_exec = Monitored::Timer<std::chrono::milliseconds>( "TIME_execute" ); + auto N_tracks = Monitored::Scalar( "N_tracks", 0 ); SG::WriteHandle<eflowRecTrackContainer> eflowRecTracksWriteHandle(m_eflowRecTracksWriteHandleKey); ATH_CHECK(eflowRecTracksWriteHandle.record(std::make_unique<eflowRecTrackContainer>())); @@ -70,16 +75,22 @@ StatusCode PFTrackSelector::execute(){ ATH_MSG_DEBUG("rejectTrack is " << rejectTrack); if (!rejectTrack) { + // Monitor the time per selected track + auto t_track = Monitored::Timer<std::chrono::milliseconds>( "TIME_track" ); /* Create the eflowRecCluster and put it in the container */ std::unique_ptr<eflowRecTrack> thisEFRecTrack = std::make_unique<eflowRecTrack>(ElementLink<xAOD::TrackParticleContainer>(*tracksReadHandle, trackIndex), m_theTrackExtrapolatorTool); thisEFRecTrack->setTrackId(trackIndex); eflowRecTracksWriteHandle->push_back(std::move(thisEFRecTrack)); + // Fill histogram + auto mon_trktime = Monitored::Group(m_monTool, t_track); } trackIndex++; } std::sort(eflowRecTracksWriteHandle->begin(), eflowRecTracksWriteHandle->end(), eflowRecTrack::SortDescendingPt()); + N_tracks = eflowRecTracksWriteHandle->size(); + auto mon_exectime = Monitored::Group(m_monTool, t_exec, N_tracks); return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaAlgs/python/EMBremCollectionBuilder.py b/Reconstruction/egamma/egammaAlgs/python/EMBremCollectionBuilder.py index ac8c48cee01ae38a3fed346f32bef2245e396e9b..97a1a5657977208a22b2b794a05121861002654a 100644 --- a/Reconstruction/egamma/egammaAlgs/python/EMBremCollectionBuilder.py +++ b/Reconstruction/egamma/egammaAlgs/python/EMBremCollectionBuilder.py @@ -1,22 +1,23 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "ToolFactory to instantiate egammaBremCollectionBuilder with default configuration" +__doc__ = """ToolFactory to instantiate egammaBremCollectionBuilder +with default configuration""" __author__ = "Christos" -# default configuration of the EMBremCollectionBuilder -from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools -from InDetRecExample.InDetKeys import InDetKeys -from AthenaCommon.Logging import logging +import InDetRecExample.TrackingCommon as TrackingCommon from AthenaCommon.DetFlags import DetFlags -from RecExConfig.RecFlags import rec -from InDetRecExample.InDetJobProperties import InDetFlags +from AthenaCommon.Logging import logging # import base class from egammaAlgs import egammaAlgsConf -from egammaTools.egammaExtrapolators import egammaExtrapolator -from egammaRec.Factories import AlgFactory from egammaRec import egammaKeys - -import InDetRecExample.TrackingCommon as TrackingCommon +from egammaRec.Factories import AlgFactory +from egammaTools.egammaExtrapolators import (AtlasPublicExtrapolator, + egammaExtrapolator) +# default configuration of the EMBremCollectionBuilder +from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools +from InDetRecExample.InDetJobProperties import InDetFlags +from InDetRecExample.InDetKeys import InDetKeys +from RecExConfig.RecFlags import rec class egammaBremCollectionBuilder (egammaAlgsConf.EMBremCollectionBuilder): @@ -28,97 +29,103 @@ class egammaBremCollectionBuilder (egammaAlgsConf.EMBremCollectionBuilder): super(egammaBremCollectionBuilder, self).__init__(name, **kw) - # Extrapolator to be used for GSF import egammaRec.EMCommonRefitter - GSFBuildInDetExtrapolator = egammaExtrapolator() - # Some of the InDet tool need the extrapolator to be passed - # to be public. We can remove this part if this becomes - # not needed - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += GSFBuildInDetExtrapolator + # Extrapolator to be used for GSF (private) + GSFBuildInDetExtrapolator = egammaExtrapolator() + # GsfReffiter (private not in ToolSvc) from egammaTrackTools.egammaTrackToolsConf import egammaTrkRefitterTool - GSFRefitterTool = egammaTrkRefitterTool(name='GSFRefitterTool', - FitterTool=egammaRec.EMCommonRefitter.getGSFTrackFitter(), - useBeamSpot=False, - Extrapolator=GSFBuildInDetExtrapolator, - ReintegrateOutliers=True) - # - # Association tool from Inner Detector to handle pixel ganged ambiguities - # - GSFBuildInDetPrdAssociationTool = TrackingCommon.getInDetPrdAssociationTool( - name="GSFBuildInDetPrdAssociationTool") + GSFRefitterTool = egammaTrkRefitterTool( + name='GSFRefitterTool', + FitterTool=egammaRec.EMCommonRefitter.getGSFTrackFitter(), + useBeamSpot=False, + Extrapolator=GSFBuildInDetExtrapolator, + ReintegrateOutliers=True) # - # BLayer and Pixel Related Tools + # BLayer and Pixel Related Tools (private = True) # GSFBuildTestBLayerTool = None GSFBuildPixelToTPIDTool = None if DetFlags.haveRIO.pixel_on(): - - GSFPixelConditionsSummaryTool = TrackingCommon.getInDetPixelConditionsSummaryTool() + GSFPixelConditionsSummaryTool = ( + TrackingCommon.getInDetPixelConditionsSummaryTool()) if InDetFlags.usePixelDCS(): GSFPixelConditionsSummaryTool.IsActiveStates = [ 'READY', 'ON', 'UNKNOWN', 'TRANSITION', 'UNDEFINED'] GSFPixelConditionsSummaryTool.IsActiveStatus = [ 'OK', 'WARNING', 'ERROR', 'FATAL'] - GSFBuildTestBLayerTool = TrackingCommon.getInDetRecTestBLayerTool(name="GSFBuildTestBLayerTool", - PixelSummaryTool=GSFPixelConditionsSummaryTool, - Extrapolator=GSFBuildInDetExtrapolator) + GSFBuildTestBLayerTool = TrackingCommon.getInDetRecTestBLayerTool( + name="GSFBuildTestBLayerTool", + PixelSummaryTool=GSFPixelConditionsSummaryTool, + Extrapolator=GSFBuildInDetExtrapolator, + private=True) GSFBuildPixelToTPIDTool = TrackingCommon.getInDetPixelToTPIDTool( - name="GSFBuildPixelToTPIDTool") - + name="GSFBuildPixelToTPIDTool", + private=True) # - # TRT_ElectronPidTool + # TRT_ElectronPidTool (private =True) # GSFBuildTRT_ElectronPidTool = None - if DetFlags.haveRIO.TRT_on() and not InDetFlags.doSLHC() and not InDetFlags.doHighPileup(): - GSFBuildTRT_ElectronPidTool = TrackingCommon.getInDetTRT_ElectronPidTool( - name="GSFBuildTRT_ElectronPidTool") - - # - # InDet Track Summary Helper - # - from InDetTrackSummaryHelperTool.InDetTrackSummaryHelperToolConf import InDet__InDetTrackSummaryHelperTool - GSFBuildTrackSummaryHelperTool = InDet__InDetTrackSummaryHelperTool(name="GSFBuildTrackSummaryHelperTool", - AssoTool=GSFBuildInDetPrdAssociationTool, - PixelToTPIDTool=GSFBuildPixelToTPIDTool, - TestBLayerTool=GSFBuildTestBLayerTool, - DoSharedHits=False, - usePixel=DetFlags.haveRIO.pixel_on(), - useSCT=DetFlags.haveRIO.SCT_on(), - useTRT=DetFlags.haveRIO.TRT_on()) - # - # TrkTrackSummaryTool: no shared hits and avoid repeat of hole search - # - from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool - GSFBuildInDetTrackSummaryTool = Trk__TrackSummaryTool(name="GSFBuildInDetTrackSummaryTool", - InDetSummaryHelperTool=GSFBuildTrackSummaryHelperTool, - doSharedHits=False, - doHolesInDet=False, - TRT_ElectronPidTool=GSFBuildTRT_ElectronPidTool, - PixelToTPIDTool=GSFBuildPixelToTPIDTool) - - ToolSvc += GSFBuildInDetTrackSummaryTool - # - # Track Particle Creator tool - # - from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool - GSFBuildInDetParticleCreatorTool = Trk__TrackParticleCreatorTool(name="GSFBuildInDetParticleCreatorTool", - KeepParameters=True, - Extrapolator=GSFBuildInDetExtrapolator, - TrackSummaryTool=GSFBuildInDetTrackSummaryTool, - UseTrackSummaryTool=False) - # - # do track slimming - # - from TrkTrackSlimmingTool.TrkTrackSlimmingToolConf import Trk__TrackSlimmingTool as ConfigurableTrackSlimmingTool - GSFBuildInDetTrkSlimmingTool = ConfigurableTrackSlimmingTool(name="GSFBuildInDetTrackSlimmingTool", - KeepParameters=False, - KeepOutliers=True) + if DetFlags.haveRIO.TRT_on() and not InDetFlags.doSLHC( + ) and not InDetFlags.doHighPileup(): + GSFBuildTRT_ElectronPidTool = ( + TrackingCommon.getInDetTRT_ElectronPidTool( + name="GSFBuildTRT_ElectronPidTool", + private=True)) + + # + # InDet Track Summary Helper, no Association and no hole + # as we do not redo them (private = true) + # + GSFBuildTrackSummaryHelperTool = TrackingCommon.getInDetSummaryHelper( + name="GSFBuildTrackSummaryHelperTool", + AssoTool=None, + HoleSearch=None, + PixelToTPIDTool=GSFBuildPixelToTPIDTool, + TestBLayerTool=GSFBuildTestBLayerTool, + DoSharedHits=False, + private=True) + + # + # TrkTrackSummaryTool: no shared hits no hole search + # still public due to TrackParticleCreatorTool + # + GSFBuildInDetTrackSummaryTool = ( + TrackingCommon.getInDetTrackSummaryTool( + name="GSFBuildInDetTrackSummaryTool", + InDetSummaryHelperTool=GSFBuildTrackSummaryHelperTool, + doSharedHits=False, + doHolesInDet=False, + TRT_ElectronPidTool=GSFBuildTRT_ElectronPidTool, + PixelToTPIDTool=GSFBuildPixelToTPIDTool) + ) + + # + # Track Particle Creator tool (private not in ToolSvc) + # But needs a public extrapolator and + # InDetTrackSummaryTool still... + from TrkParticleCreator.TrkParticleCreatorConf import ( + Trk__TrackParticleCreatorTool) + + GSFBuildInDetParticleCreatorTool = Trk__TrackParticleCreatorTool( + name="GSFBuildInDetParticleCreatorTool", + KeepParameters=True, + Extrapolator=AtlasPublicExtrapolator(), + TrackSummaryTool=GSFBuildInDetTrackSummaryTool, + UseTrackSummaryTool=False) + # + # Track slimming (private not in ToolSvc) + # + from TrkTrackSlimmingTool.TrkTrackSlimmingToolConf import ( + Trk__TrackSlimmingTool as ConfigurableTrackSlimmingTool) + GSFBuildInDetTrkSlimmingTool = ConfigurableTrackSlimmingTool( + name="GSFBuildInDetTrackSlimmingTool", + KeepParameters=False, + KeepOutliers=True) # # Default Configuration # @@ -128,13 +135,14 @@ class egammaBremCollectionBuilder (egammaAlgsConf.EMBremCollectionBuilder): self.TrackSummaryTool = GSFBuildInDetTrackSummaryTool -EMBremCollectionBuilder = AlgFactory(egammaBremCollectionBuilder, - name='EMBremCollectionBuilder', - ExtrapolationTool=EMExtrapolationTools, - TrackParticleContainerName=InDetKeys.xAODTrackParticleContainer(), - OutputTrkPartContainerName=egammaKeys.outputTrackParticleKey(), - OutputTrackContainerName=egammaKeys.outputTrackKey(), - DoTruth=rec.doTruth(), - usePixel=DetFlags.haveRIO.pixel_on(), - useSCT=DetFlags.haveRIO.SCT_on() - ) +EMBremCollectionBuilder = AlgFactory( + egammaBremCollectionBuilder, + name='EMBremCollectionBuilder', + ExtrapolationTool=EMExtrapolationTools, + TrackParticleContainerName=InDetKeys.xAODTrackParticleContainer(), + OutputTrkPartContainerName=egammaKeys.outputTrackParticleKey(), + OutputTrackContainerName=egammaKeys.outputTrackKey(), + DoTruth=rec.doTruth(), + usePixel=DetFlags.haveRIO.pixel_on(), + useSCT=DetFlags.haveRIO.SCT_on() +) diff --git a/Reconstruction/egamma/egammaAlgs/python/EMVertexBuilder.py b/Reconstruction/egamma/egammaAlgs/python/EMVertexBuilder.py index f3f351ba4ddece2ce60ca0316ed2bf5b82211c79..b4fd2393605026d468974e8c8e3303427af156f4 100644 --- a/Reconstruction/egamma/egammaAlgs/python/EMVertexBuilder.py +++ b/Reconstruction/egamma/egammaAlgs/python/EMVertexBuilder.py @@ -1,77 +1,69 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __doc__ = "ToolFactory to instantiate EMVertexBuilder with default configuration" __author__ = "Bruno Lenzi" +import InDetRecExample.TrackingCommon as TrackingCommon from egammaAlgs import egammaAlgsConf -from egammaRec.Factories import FcnWrapper, AlgFactory, PublicToolFactory +from egammaRec.Factories import FcnWrapper, AlgFactory from egammaRec import egammaKeys from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools -from egammaTools.egammaExtrapolators import egammaExtrapolator +from egammaTools.egammaExtrapolators import AtlasPublicExtrapolator class VertexFinderToolInstance(FcnWrapper): def __call__(self): - ################################################################# - # egamma InDet summary tool to be used conversion finding - # - # load association tool from Inner Detector to handle pixel ganged - # ambiguities - from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels - egammaInDetPrdAssociationTool = PublicToolFactory(InDet__InDetPRD_AssociationToolGangedPixels, - name="egammaInDetPrdAssociationTool", - PixelClusterAmbiguitiesMapName='PixelClusterAmbiguitiesMap') - # Loading Configurable HoleSearchTool - # - from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool - egammaInDetHoleSearchTool = PublicToolFactory(InDet__InDetTrackHoleSearchTool, - name="egammaInDetHoleSearchTool", - Extrapolator=egammaExtrapolator) - # + egammaInDetHoleSearchTool = TrackingCommon.getInDetHoleSearchTool( + name="egammaInDetHoleSearchTool", + Extrapolator=AtlasPublicExtrapolator() + ) + # Load the InDetTrackSummaryHelperTool - # - from AthenaCommon.DetFlags import DetFlags - from InDetTrackSummaryHelperTool.InDetTrackSummaryHelperToolConf import InDet__InDetTrackSummaryHelperTool - egammaInDetTrackSummaryHelperTool = PublicToolFactory(InDet__InDetTrackSummaryHelperTool, - name="egammaInDetSummaryHelper", - AssoTool=egammaInDetPrdAssociationTool, - DoSharedHits=False, - HoleSearch=egammaInDetHoleSearchTool, - usePixel=DetFlags.haveRIO.pixel_on(), - useSCT=DetFlags.haveRIO.SCT_on(), - useTRT=DetFlags.haveRIO.TRT_on()) + egammaInDetTrackSummaryHelperTool = ( + TrackingCommon.getInDetSummaryHelper( + name="egammaInDetSummaryHelper", + AssoTool=None, + DoSharedHits=False, + HoleSearch=egammaInDetHoleSearchTool, + private=True)) # - from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool - egammaInDetTrackSummaryTool = PublicToolFactory(Trk__TrackSummaryTool, - name="egammaInDetTrackSummaryTool", - InDetSummaryHelperTool=egammaInDetTrackSummaryHelperTool, - doSharedHits=False, - doHolesInDet=True) + egammaInDetTrackSummaryTool = ( + TrackingCommon.getInDetTrackSummaryTool( + name="egammaInDetTrackSummaryTool", + InDetSummaryHelperTool=egammaInDetTrackSummaryHelperTool, + doSharedHits=False, + doHolesInDet=True)) # # Configured conversion vertex reconstruction cuts # - from InDetRecExample.ConfiguredSecondaryVertexCuts import ConfiguredSecondaryVertexCuts + from InDetRecExample.ConfiguredSecondaryVertexCuts import ( + ConfiguredSecondaryVertexCuts) + egammaConversionVertexCuts = ConfiguredSecondaryVertexCuts( mode="EGammaPileUp") - from InDetRecExample.ConfiguredSecVertexFinding import ConfiguredSecVertexFinding - theemvertexfindertool = ConfiguredSecVertexFinding(prefix="egammaConversion", - VertexCuts=egammaConversionVertexCuts, - TrackParticles=egammaKeys.outputTrackParticleKey(), - SecVertices=egammaKeys.outputConversionKey(), - Extrapolator=egammaExtrapolator(), - TrackSummaryTool=egammaInDetTrackSummaryTool(), - printConfig=False) + from InDetRecExample.ConfiguredSecVertexFinding import ( + ConfiguredSecVertexFinding) + + theemvertexfindertool = ConfiguredSecVertexFinding( + prefix="egammaConversion", + VertexCuts=egammaConversionVertexCuts, + TrackParticles=egammaKeys.outputTrackParticleKey(), + SecVertices=egammaKeys.outputConversionKey(), + Extrapolator=AtlasPublicExtrapolator(), + TrackSummaryTool=egammaInDetTrackSummaryTool, + printConfig=False) return theemvertexfindertool.toolInstance() -EMVertexBuilder = AlgFactory(egammaAlgsConf.EMVertexBuilder, - InputTrackParticleContainerName=egammaKeys.outputTrackParticleKey(), - OutputConversionContainerName=egammaKeys.outputConversionKey(), - VertexFinderTool=VertexFinderToolInstance(), - ExtrapolationTool=EMExtrapolationTools) +EMVertexBuilder = AlgFactory( + egammaAlgsConf.EMVertexBuilder, + InputTrackParticleContainerName=egammaKeys.outputTrackParticleKey(), + OutputConversionContainerName=egammaKeys.outputConversionKey(), + VertexFinderTool=VertexFinderToolInstance(), + ExtrapolationTool=EMExtrapolationTools) diff --git a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx index 97c9ed8e97f2cbb37fbc2cb6aaedcd80302d3ec1..16ca1b03c981f25d4dbb7ad24f801d1b7a765166 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.cxx @@ -1,17 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/******************************************************************** -NAME: EMBremCollectionBuilder -PACKAGE: offline/Reconstruction/egamma/egammaTrackTools/EMBremCollectionBuilder +/** + @class EMBremCollectionBuilder + @brief Implementation file for EMBremCollectionBuilder + @author Christos Anastopoulos,Anthony Morley + */ -AUTHORS: Anastopoulos -CREATED: - -PURPOSE: Performs Brem refit for silicon tracks, copies over TRT-standalone -UPDATE : - **********************************************************************/ #include "EMBremCollectionBuilder.h" // #include "TrkTrack/Track.h" @@ -34,10 +30,9 @@ UPDATE : #include <algorithm> #include <memory> - -EMBremCollectionBuilder::EMBremCollectionBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) +EMBremCollectionBuilder::EMBremCollectionBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) { } @@ -47,6 +42,8 @@ StatusCode EMBremCollectionBuilder::initialize() { ATH_CHECK(m_trackParticleContainerKey.initialize()); ATH_CHECK(m_OutputTrkPartContainerKey.initialize()); ATH_CHECK(m_OutputTrackContainerKey.initialize()); + ATH_CHECK(m_TruthParticlesLinkKey.initialize(m_doTruth)); + /* retrieve the track refitter tool*/ ATH_CHECK(m_trkRefitTool.retrieve()); /* Get the particle creation tool */ @@ -70,48 +67,55 @@ StatusCode EMBremCollectionBuilder::EMBremCollectionBuilder::finalize(){ return StatusCode::SUCCESS; } -StatusCode EMBremCollectionBuilder::execute() +StatusCode +EMBremCollectionBuilder::execute_r(const EventContext& ctx) const { /* * Read in the input * All TrackParticles and the selected view */ - SG::ReadHandle<xAOD::TrackParticleContainer> trackTES(m_trackParticleContainerKey); + SG::ReadHandle<xAOD::TrackParticleContainer> trackTES(m_trackParticleContainerKey,ctx); if(!trackTES.isValid()) { - ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "<< m_trackParticleContainerKey.key()); + ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " + << m_trackParticleContainerKey.key()); return StatusCode::FAILURE; } - SG::ReadHandle<xAOD::TrackParticleContainer> selectedTracks(m_selectedTrackParticleContainerKey); + SG::ReadHandle<xAOD::TrackParticleContainer> selectedTracks(m_selectedTrackParticleContainerKey,ctx); if(!selectedTracks.isValid()) { - ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "<< m_selectedTrackParticleContainerKey.key()); + ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " + << m_selectedTrackParticleContainerKey.key()); return StatusCode::FAILURE; } /* * Create the final containers to be written out */ - SG::WriteHandle<xAOD::TrackParticleContainer> finalTrkPartContainer(m_OutputTrkPartContainerKey); - ATH_CHECK(finalTrkPartContainer.record(std::make_unique<xAOD::TrackParticleContainer>(), - std::make_unique<xAOD::TrackParticleAuxContainer>())); - xAOD::TrackParticleContainer* cPtrTrkPart=finalTrkPartContainer.ptr(); - - SG::WriteHandle<TrackCollection> finalTracks(m_OutputTrackContainerKey); - ATH_CHECK(finalTracks.record(std::make_unique<TrackCollection>())); - TrackCollection* cPtrTracks=finalTracks.ptr(); + SG::WriteHandle<xAOD::TrackParticleContainer> finalTrkPartContainer( + m_OutputTrkPartContainerKey, ctx); + + ATH_CHECK(finalTrkPartContainer.record( + std::make_unique<xAOD::TrackParticleContainer>(), + std::make_unique<xAOD::TrackParticleAuxContainer>())); + + xAOD::TrackParticleContainer* cPtrTrkPart = finalTrkPartContainer.ptr(); + + SG::WriteHandle<TrackCollection> finalTracks(m_OutputTrackContainerKey, ctx); + ATH_CHECK(finalTracks.record(std::make_unique<TrackCollection>())); + TrackCollection* cPtrTracks = finalTracks.ptr(); /* * Split TRT-alone from silicon ones * For the TRT we can get all the info already */ std::vector<const xAOD::TrackParticle*> siliconTrkTracks; - siliconTrkTracks.reserve(8); + siliconTrkTracks.reserve(16); std::vector<TrackWithIndex> trtAloneTrkTracks; - trtAloneTrkTracks.reserve(8); + trtAloneTrkTracks.reserve(16); for(const xAOD::TrackParticle* track : *selectedTracks){ const Trk::Track* trktrack{nullptr}; if ( track->trackLink().isValid() ){ trktrack =track->track(); } else{ - ATH_MSG_ERROR ("TrackParticle has not Track -- are you running on AOD?"); + ATH_MSG_ERROR("TrackParticle has not Track -- are you running on AOD?"); return StatusCode::FAILURE; } int nSiliconHits_trk =0; @@ -141,7 +145,7 @@ StatusCode EMBremCollectionBuilder::execute() /* * Do the refit and get all the info */ - ATH_CHECK(refitTracks(Gaudi::Hive::currentContext(),siliconTrkTracks,refitted,failedfit)); + ATH_CHECK(refitTracks(ctx,siliconTrkTracks,refitted,failedfit)); siliconTrkTracks.clear(); /* * Fill the final collections @@ -157,10 +161,13 @@ StatusCode EMBremCollectionBuilder::execute() return StatusCode::SUCCESS; } -StatusCode EMBremCollectionBuilder::refitTracks(const EventContext& ctx, - const std::vector<const xAOD::TrackParticle*>& input, - std::vector<TrackWithIndex>& refitted, - std::vector<TrackWithIndex>& failedfit) const { +StatusCode +EMBremCollectionBuilder::refitTracks( + const EventContext& ctx, + const std::vector<const xAOD::TrackParticle*>& input, + std::vector<TrackWithIndex>& refitted, + std::vector<TrackWithIndex>& failedfit) const +{ for (const xAOD::TrackParticle* in:input){ const Trk::Track* track =in->track(); IegammaTrkRefitterTool::Cache cache{}; @@ -182,15 +189,18 @@ StatusCode EMBremCollectionBuilder::refitTracks(const EventContext& ctx, ); } } - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } -StatusCode EMBremCollectionBuilder::createCollections(const std::vector<TrackWithIndex>& refitted, - const std::vector<TrackWithIndex>& failedfit, - const std::vector<TrackWithIndex>& trtAlone, - TrackCollection* finalTracks, - xAOD::TrackParticleContainer* finalTrkPartContainer, - const xAOD::TrackParticleContainer* AllTracks) const { +StatusCode +EMBremCollectionBuilder::createCollections( + const std::vector<TrackWithIndex>& refitted, + const std::vector<TrackWithIndex>& failedfit, + const std::vector<TrackWithIndex>& trtAlone, + TrackCollection* finalTracks, + xAOD::TrackParticleContainer* finalTrkPartContainer, + const xAOD::TrackParticleContainer* AllTracks) const +{ /* * Refitted are new tracks (not copied/cloned) * so need to update the summary @@ -211,15 +221,15 @@ StatusCode EMBremCollectionBuilder::createCollections(const std::vector<TrackWit ATH_CHECK(createNew(Info,finalTracks,finalTrkPartContainer,AllTracks)); } return StatusCode::SUCCESS; -} - - +} -StatusCode EMBremCollectionBuilder::createNew(const TrackWithIndex& Info, - TrackCollection* finalTracks, - xAOD::TrackParticleContainer* finalTrkPartContainer, - const xAOD::TrackParticleContainer* AllTracks - ) const{ +StatusCode +EMBremCollectionBuilder::createNew( + const TrackWithIndex& Info, + TrackCollection* finalTracks, + xAOD::TrackParticleContainer* finalTrkPartContainer, + const xAOD::TrackParticleContainer* AllTracks) const +{ Trk::Track* track= Info.track.get(); size_t origIndex = Info.origIndex; @@ -227,23 +237,26 @@ StatusCode EMBremCollectionBuilder::createNew(const TrackWithIndex& Info, /* * Create TrackParticle it should be now owned by finalTrkPartContainer */ - xAOD::TrackParticle* aParticle=m_particleCreatorTool->createParticle(*track, - finalTrkPartContainer, - nullptr, - xAOD::electron); + xAOD::TrackParticle* aParticle = m_particleCreatorTool->createParticle( + *track, finalTrkPartContainer, nullptr, xAOD::electron); + if (!aParticle){ ATH_MSG_WARNING("Could not create TrackParticle!!! for Track: " << *track); return StatusCode::SUCCESS; } - //Add an element link back to original Track Particle collection - static const SG::AuxElement::Accessor<ElementLink<xAOD::TrackParticleContainer>>tP ("originalTrackParticle"); + //Add an element link back to original Track Particle collection + static const SG::AuxElement::Accessor< + ElementLink<xAOD::TrackParticleContainer>> + tP("originalTrackParticle"); ElementLink<xAOD::TrackParticleContainer> linkToOriginal(*AllTracks,origIndex); tP(*aParticle) = linkToOriginal; if(m_doTruth){ //Add Truth decorations. Copy from the original. - static const SG::AuxElement::Accessor< ElementLink<xAOD::TruthParticleContainer> > tPL ("truthParticleLink"); + static const SG::AuxElement::Accessor< + ElementLink<xAOD::TruthParticleContainer>> + tPL("truthParticleLink"); if(tPL.isAvailable(*original)){ ElementLink<xAOD::TruthParticleContainer> linkToTruth= tPL(*original); tPL(*aParticle) = linkToTruth; @@ -296,11 +309,14 @@ StatusCode EMBremCollectionBuilder::createNew(const TrackWithIndex& Info, return StatusCode::SUCCESS; } -void EMBremCollectionBuilder::updateGSFTrack(const TrackWithIndex& Info, - const xAOD::TrackParticleContainer* AllTracks) const { +void +EMBremCollectionBuilder::updateGSFTrack( + const TrackWithIndex& Info, + const xAOD::TrackParticleContainer* AllTracks) const +{ //update the summary of the non-const track without hole search - m_summaryTool->updateTrackNoHoleSearch(*(Info.track)); + m_summaryTool->updateRefittedTrack(*(Info.track)); //Get the summary so as to add info to it Trk::TrackSummary* summary = Info.track->trackSummary(); @@ -317,9 +333,12 @@ void EMBremCollectionBuilder::updateGSFTrack(const TrackWithIndex& Info, int nPixOutliersRefitted = summary->get(Trk::numberOfPixelOutliers); int nPixHitsOriginal = original->summaryValue(dummy,xAOD::numberOfPixelHits) ? dummy:-1; int nPixHolesOriginal = original->summaryValue(dummy,xAOD::numberOfPixelHoles)? dummy:-1; + int nPixOutliersOriginal = original->summaryValue(dummy,xAOD::numberOfPixelOutliers)? dummy:-1; - summary->update(Trk::numberOfPixelHoles, nPixHitsOriginal+nPixHolesOriginal+nPixOutliersOriginal - -nPixOutliersRefitted-nPixHitsRefitted); + summary->update(Trk::numberOfPixelHoles, + nPixHitsOriginal + nPixHolesOriginal + + nPixOutliersOriginal - nPixOutliersRefitted - + nPixHitsRefitted); } if (m_doSCT) { uint8_t deadSCT= original->summaryValue(dummy,xAOD::numberOfSCTDeadSensors)?dummy:0; @@ -334,16 +353,18 @@ void EMBremCollectionBuilder::updateGSFTrack(const TrackWithIndex& Info, int nSCTHolesOriginal = original->summaryValue(dummy,xAOD::numberOfSCTHoles) ? dummy:-1; int nSCTOutliersOriginal = original->summaryValue(dummy,xAOD::numberOfSCTOutliers) ? dummy:-1; - summary->update(Trk::numberOfSCTHoles, nSCTHitsOriginal+nSCTHolesOriginal+nSCTOutliersOriginal - -nSCTOutliersRefitted-nSCTHitsRefitted); - + summary->update(Trk::numberOfSCTHoles, + nSCTHitsOriginal + nSCTHolesOriginal + + nSCTOutliersOriginal - nSCTOutliersRefitted - + nSCTHitsRefitted); } int nTRTHitsRefitted = summary->get(Trk::numberOfTRTHits); int nTRTOutliersRefitted = summary->get(Trk::numberOfTRTOutliers); int nTRTHitsOriginal = original->summaryValue(dummy,xAOD::numberOfTRTHits) ? dummy:-1; int nTRTHolesOriginal = original->summaryValue(dummy,xAOD::numberOfTRTHoles) ? dummy:-1; int nTRTOutliersOriginal = original->summaryValue(dummy,xAOD::numberOfTRTOutliers) ? dummy:-1; - summary->update(Trk::numberOfTRTHoles, nTRTHitsOriginal+nTRTHolesOriginal+nTRTOutliersOriginal - -nTRTOutliersRefitted-nTRTHitsRefitted); + summary->update(Trk::numberOfTRTHoles, + nTRTHitsOriginal + nTRTHolesOriginal + nTRTOutliersOriginal - + nTRTOutliersRefitted - nTRTHitsRefitted); } diff --git a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.h b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.h index 06f2f87f1d9858b55af8339afa2c26a1a256cdfb..d9af48a6a4409eac8459b57131d1191bef99eabc 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/EMBremCollectionBuilder.h @@ -1,12 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EMBREMCOLLECTIONBUILDER_H #define EGAMMAALGS_EMBREMCOLLECTIONBUILDER_H /** @class EMBremCollectionBuilder - Algorithm which creates new brem-refitted tracks + @brief Algorithm which creates new brem-refitted tracks + @author Christos Anastopoulos,Anthony Morley */ #include "egammaInterfaces/IegammaTrkRefitterTool.h" @@ -17,7 +18,9 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" #include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadDecorHandleKey.h" #include "StoreGate/WriteHandleKey.h" #include "TrkTrack/TrackCollection.h" @@ -36,13 +39,23 @@ public: virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; - struct TrackWithIndex{ - TrackWithIndex(std::unique_ptr<Trk::Track>intrack, - size_t index):track(std::move(intrack)), origIndex(index){} - + struct TrackWithIndex + { + + TrackWithIndex(std::unique_ptr<Trk::Track> intrack, size_t index) + : track(std::move(intrack)) + , origIndex(index) + {} + TrackWithIndex(const TrackWithIndex&) = delete; TrackWithIndex(TrackWithIndex&&) = default; TrackWithIndex& operator=(const TrackWithIndex&) = delete; @@ -54,25 +67,25 @@ public: }; private: - StatusCode refitTracks(const EventContext& ctx, - const std::vector<const xAOD::TrackParticle*>& input, - std::vector<TrackWithIndex>& refitted, - std::vector<TrackWithIndex>& failedfit)const; - - StatusCode createCollections(const std::vector<TrackWithIndex>& refitted, - const std::vector<TrackWithIndex>& failedfit, - const std::vector<TrackWithIndex>& trtAlone, - TrackCollection* finalTracks, - xAOD::TrackParticleContainer* finalTrkPartContainer, - const xAOD::TrackParticleContainer* AllTracks)const; - - StatusCode createNew(const TrackWithIndex& Info, - TrackCollection* finalTracks, - xAOD::TrackParticleContainer* finalTrkPartContainer, + const std::vector<const xAOD::TrackParticle*>& input, + std::vector<TrackWithIndex>& refitted, + std::vector<TrackWithIndex>& failedfit) const; + + StatusCode createCollections( + const std::vector<TrackWithIndex>& refitted, + const std::vector<TrackWithIndex>& failedfit, + const std::vector<TrackWithIndex>& trtAlone, + TrackCollection* finalTracks, + xAOD::TrackParticleContainer* finalTrkPartContainer, + const xAOD::TrackParticleContainer* AllTracks) const; + + StatusCode createNew(const TrackWithIndex& Info, + TrackCollection* finalTracks, + xAOD::TrackParticleContainer* finalTrkPartContainer, const xAOD::TrackParticleContainer* AllTracks) const; - void updateGSFTrack(const TrackWithIndex& Info, + void updateGSFTrack(const TrackWithIndex& Info, const xAOD::TrackParticleContainer* AllTracks) const; /** @brief The track refitter */ @@ -106,33 +119,65 @@ private: /** @brief Option to do truth*/ Gaudi::Property<bool> m_doPix {this, "usePixel", false, "do Pix"}; - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey {this, - "TrackParticleContainerName", "InDetTrackParticles", "Input InDet TrackParticles"}; + /** @Cut on minimum silicon hits*/ + Gaudi::Property<int> m_MinNoSiHits{ this, + "minNoSiHits", + 4, + "Minimum number of silicon hits on track " + "before it is allowed to be refitted" }; + + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey{ + this, + "TrackParticleContainerName", + "InDetTrackParticles", + "Input InDet TrackParticles" + }; /** @brief Names of input output collections */ - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_selectedTrackParticleContainerKey {this, - "SelectedTrackParticleContainerName", "egammaSelectedTrackParticles", "Input of Selected TrackParticles"}; - - SG::WriteHandleKey<xAOD::TrackParticleContainer> m_OutputTrkPartContainerKey {this, - "OutputTrkPartContainerName", "GSFTrackParticles", "Output GSF TrackParticles"}; + SG::ReadHandleKey<xAOD::TrackParticleContainer> + m_selectedTrackParticleContainerKey{ this, + "SelectedTrackParticleContainerName", + "egammaSelectedTrackParticles", + "Input of Selected TrackParticles" }; + + SG::WriteHandleKey<xAOD::TrackParticleContainer> m_OutputTrkPartContainerKey{ + this, + "OutputTrkPartContainerName", + "GSFTrackParticles", + "Output GSF TrackParticles" + }; - SG::WriteHandleKey<TrackCollection> m_OutputTrackContainerKey {this, - "OutputTrackContainerName", "GSFTracks", "Output GSF Trk::Tracks"}; + SG::WriteHandleKey<TrackCollection> m_OutputTrackContainerKey{ + this, + "OutputTrackContainerName", + "GSFTracks", + "Output GSF Trk::Tracks" + }; - /** @Cut on minimum silicon hits*/ - Gaudi::Property<int> m_MinNoSiHits {this, "minNoSiHits", 4, - "Minimum number of silicon hits on track before it is allowed to be refitted"}; + SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> m_TruthParticlesLinkKey{ + this, + "TrackParticleTruthDecorationName", + "InDetTrackParticles.truthParticleLink", + "Truth Decoration of input track particles" + }; // For P->T converters of ID tracks with Pixel - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, - "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}; - // For P->T converters of ID tracks with SCT - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, - "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; - //counters - mutable std::atomic_uint m_FailedFitTracks{0}; - mutable std::atomic_uint m_RefittedTracks{0}; - mutable std::atomic_uint m_FailedSiliconRequirFit{0}; + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_pixelDetEleCollKey{ this, + "PixelDetEleCollKey", + "PixelDetectorElementCollection", + "Key of SiDetectorElementCollection for Pixel" }; + // For P->T converters of ID tracks with SCT + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_SCTDetEleCollKey{ this, + "SCTDetEleCollKey", + "SCT_DetectorElementCollection", + "Key of SiDetectorElementCollection for SCT" }; + + // counters for final statistics + mutable std::atomic_uint m_FailedFitTracks{ 0 }; + mutable std::atomic_uint m_RefittedTracks{ 0 }; + mutable std::atomic_uint m_FailedSiliconRequirFit{ 0 }; }; #endif // diff --git a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx index 12a2942d4d8fd59a8d0f3ad78e5de3791a68cb45..dc8706d2c5d305545adee1eece8e8524c98e460e 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************************** @@ -7,77 +7,80 @@ NAME: EMGSFCaloExtensionBuilder PACKAGE: offline/Reconstruction/egamma/egammaTrackTools/EMGSFCaloExtensionBuilder AUTHORS: Anastopoulos -PURPOSE: Performs Calo Extension for all GSF tracks +PURPOSE: Performs Calo Extension for all GSF tracks **********************************************************************/ #include "EMGSFCaloExtensionBuilder.h" #include "xAODEgamma/EgammaxAODHelpers.h" // -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/TrackParticleAuxContainer.h" -#include "xAODTracking/TrackParticle.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/TrackParticleContainer.h" -//std includes +// std includes #include <algorithm> #include <cmath> #include <memory> -EMGSFCaloExtensionBuilder::EMGSFCaloExtensionBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) -{ -} +EMGSFCaloExtensionBuilder::EMGSFCaloExtensionBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) +{} -StatusCode EMGSFCaloExtensionBuilder::initialize() +StatusCode +EMGSFCaloExtensionBuilder::initialize() { ATH_CHECK(m_GSFPerigeeCacheKey.initialize()); ATH_CHECK(m_GSFLastCacheKey.initialize()); ATH_CHECK(m_GSFTrkPartContainerKey.initialize()); - if(m_perigeeParticleCaloExtensionTool.retrieve().isFailure()){ + if (m_perigeeParticleCaloExtensionTool.retrieve().isFailure()) { ATH_MSG_ERROR("initialize: Cannot retrieve " << m_perigeeParticleCaloExtensionTool); return StatusCode::FAILURE; } - if(m_lastParticleCaloExtensionTool.retrieve().isFailure()){ + if (m_lastParticleCaloExtensionTool.retrieve().isFailure()) { ATH_MSG_ERROR("initialize: Cannot retrieve " << m_lastParticleCaloExtensionTool); return StatusCode::FAILURE; } return StatusCode::SUCCESS; -} +} -StatusCode EMGSFCaloExtensionBuilder::EMGSFCaloExtensionBuilder::finalize(){ +StatusCode +EMGSFCaloExtensionBuilder::EMGSFCaloExtensionBuilder::finalize() +{ return StatusCode::SUCCESS; } -StatusCode EMGSFCaloExtensionBuilder::execute() +StatusCode +EMGSFCaloExtensionBuilder::execute_r(const EventContext& ctx) const { - SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_GSFTrkPartContainerKey); + SG::ReadHandle<xAOD::TrackParticleContainer> tracks(m_GSFTrkPartContainerKey, ctx); - if(!tracks.isValid()) { - ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "<< m_GSFTrkPartContainerKey.key()); + if (!tracks.isValid()) { + ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " << m_GSFTrkPartContainerKey.key()); return StatusCode::FAILURE; } - SG::WriteHandle<CaloExtensionCollection> perigeeCache(m_GSFPerigeeCacheKey); + SG::WriteHandle<CaloExtensionCollection> perigeeCache(m_GSFPerigeeCacheKey, ctx); ATH_CHECK(perigeeCache.record(std::make_unique<CaloExtensionCollection>())); - SG::WriteHandle<CaloExtensionCollection> lastCache(m_GSFLastCacheKey); + SG::WriteHandle<CaloExtensionCollection> lastCache(m_GSFLastCacheKey,ctx); ATH_CHECK(lastCache.record(std::make_unique<CaloExtensionCollection>())); - const xAOD::TrackParticleContainer* ptrTracks=tracks.cptr(); - CaloExtensionCollection* ptrPerigee=perigeeCache.ptr(); - CaloExtensionCollection* ptrLast=lastCache.ptr(); - std::vector<bool> mask (ptrTracks->size(),true); - for (auto trkIt : *ptrTracks) { - //If we have TRT-SA tracks we don't extrapolate + const xAOD::TrackParticleContainer* ptrTracks = tracks.cptr(); + CaloExtensionCollection* ptrPerigee = perigeeCache.ptr(); + CaloExtensionCollection* ptrLast = lastCache.ptr(); + std::vector<bool> mask(ptrTracks->size(), true); + for (auto trkIt : *ptrTracks) { + // If we have TRT-SA tracks we don't extrapolate if (xAOD::EgammaHelpers::numberOfSiHits(trkIt) < 4) { mask[trkIt->index()] = false; } } - ATH_CHECK(m_perigeeParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks,mask,*ptrPerigee)); - ATH_CHECK(m_lastParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks,mask,*ptrLast)); + ATH_CHECK( + m_perigeeParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks, mask, *ptrPerigee)); + ATH_CHECK(m_lastParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks, mask, *ptrLast)); return StatusCode::SUCCESS; } - diff --git a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.h b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.h index 09bde0a5b8a100dca526cd17b11214b6af23760a..501353144e7928623f361bd7cb2ecf6096cca109 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EMGSFCALOEXTENSIONBUILDER_H @@ -10,14 +10,15 @@ Track Particles */ #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/EventContext.h" #include "GaudiKernel/ToolHandle.h" +#include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" #include "TrkCaloExtension/CaloExtensionCollection.h" #include "xAODTracking/TrackParticleContainerFwd.h" -#include "RecoToolInterfaces/IParticleCaloExtensionTool.h" -class EMGSFCaloExtensionBuilder : public AthAlgorithm +class EMGSFCaloExtensionBuilder : public AthAlgorithm { public: /** @brief Default constructor*/ @@ -25,26 +26,47 @@ public: virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; + virtual StatusCode execute() override final { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; private: /** @brief the Calo Extension tool*/ - ToolHandle<Trk::IParticleCaloExtensionTool> m_lastParticleCaloExtensionTool {this, - "LastCaloExtensionTool", "Trk::ParticleCaloExtensionTool/EMLastCaloExtensionTool"}; - - ToolHandle<Trk::IParticleCaloExtensionTool> m_perigeeParticleCaloExtensionTool {this, - "PerigeeCaloExtensionTool", "Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool"}; + ToolHandle<Trk::IParticleCaloExtensionTool> m_lastParticleCaloExtensionTool{ + this, + "LastCaloExtensionTool", + "Trk::ParticleCaloExtensionTool/EMLastCaloExtensionTool" + }; - //Cache collections for GSF Track Particle extrapolation Perigee - SG::WriteHandleKey<CaloExtensionCollection> m_GSFPerigeeCacheKey{this, - "GSFPerigeeCache", "GSFPerigeeCaloExtension", "Name of GSF Perigee extrapolation cache"}; - SG::WriteHandleKey<CaloExtensionCollection> m_GSFLastCacheKey{this, - "GSFLastCache", "GSFLastCaloExtension", "Name of GSF Last measurement extrapolation cache"}; + ToolHandle<Trk::IParticleCaloExtensionTool> m_perigeeParticleCaloExtensionTool{ + this, + "PerigeeCaloExtensionTool", + "Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool" + }; - //input GSF Track collection - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_GSFTrkPartContainerKey {this, - "GFFTrkPartContainerName", "GSFTrackParticles", - "GSF TrackParticles"}; + // Cache collections for GSF Track Particle extrapolation Perigee + SG::WriteHandleKey<CaloExtensionCollection> m_GSFPerigeeCacheKey{ + this, + "GSFPerigeeCache", + "GSFPerigeeCaloExtension", + "Name of GSF Perigee extrapolation cache" + }; + SG::WriteHandleKey<CaloExtensionCollection> m_GSFLastCacheKey{ + this, + "GSFLastCache", + "GSFLastCaloExtension", + "Name of GSF Last measurement extrapolation cache" + }; + // input GSF Track collection + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_GSFTrkPartContainerKey{ + this, + "GFFTrkPartContainerName", + "GSFTrackParticles", + "GSF TrackParticles" + }; }; #endif // diff --git a/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx index 9c54c46bf48a4f1740a0c293e8b04fd946261b90..13a693671b99c9067fb31bccea9d8edd52b5a659 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx @@ -42,17 +42,17 @@ StatusCode EMVertexBuilder::initialize() { if ( m_vertexFinderTool.retrieve().isFailure() ) { ATH_MSG_FATAL("Failed to retrieve vertex finder tool " << m_vertexFinderTool); return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG( "Retrieved tool " << m_vertexFinderTool); - } + // Retrieve EMExtrapolationTool if(m_EMExtrapolationTool.retrieve().isFailure()){ ATH_MSG_FATAL("Cannot retrieve extrapolationTool " << m_EMExtrapolationTool); return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG("Retrieved extrapolationTool " << m_EMExtrapolationTool); - } + ATH_MSG_DEBUG( "Initialization successful"); diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx index 38cc4fd7521681495fb9ce71f418f64db47004f4..b9d6a7bb435adf00d0e4e43316eee947007f3e1d 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx @@ -50,7 +50,7 @@ and eventually conversions. // INCLUDE GAUDI HEADER FILES: #include <algorithm> -#include <math.h> +#include <cmath> // END OF HEADER FILES INCLUDE @@ -142,7 +142,7 @@ StatusCode egammaBuilder::RetrieveEMTrackMatchBuilder(){ ATH_MSG_ERROR("Unable to retrieve "<<m_trackMatchBuilder); return StatusCode::FAILURE; } - else ATH_MSG_DEBUG("Retrieved Tool "<<m_trackMatchBuilder); + ATH_MSG_DEBUG("Retrieved Tool "<<m_trackMatchBuilder); return StatusCode::SUCCESS; } @@ -167,7 +167,7 @@ StatusCode egammaBuilder::RetrieveEMConversionBuilder(){ ATH_MSG_ERROR("Unable to retrieve "<<m_conversionBuilder); return StatusCode::FAILURE; } - else ATH_MSG_DEBUG("Retrieved Tool "<<m_conversionBuilder); + ATH_MSG_DEBUG("Retrieved Tool "<<m_conversionBuilder); return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx index 09f74c0214a7592d700ed9d0e423a2c5d7f7883e..22999a96e12786a868829e8c6f9b02e636b87a78 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx @@ -8,6 +8,7 @@ #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODCaloEvent/CaloCluster.h" +#include "CaloDetDescr/CaloDetDescrManager.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronAuxContainer.h" @@ -17,18 +18,10 @@ #include "PATCore/AcceptData.h" #include <algorithm> -#include <math.h> +#include <cmath> - -// END OF HEADER FILES INCLUDE - -///////////////////////////////////////////////////////////////// - -// CONSTRUCTOR: - egammaForwardBuilder::egammaForwardBuilder(const std::string& name, ISvcLocator* pSvcLocator): - AthReentrantAlgorithm(name, pSvcLocator), - m_timingProfile("ChronoStatSvc", name) + AthReentrantAlgorithm(name, pSvcLocator) { } @@ -36,20 +29,11 @@ egammaForwardBuilder::egammaForwardBuilder(const std::string& name, ISvcLocator* // ================================================================ egammaForwardBuilder::~egammaForwardBuilder() { - // - // destructor - // } // ================================================================= StatusCode egammaForwardBuilder::initialize() { - // - // initialize method - // - - ATH_MSG_DEBUG(" Initializing egammaForwardBuilder "); - // the data handle keys ATH_CHECK(m_topoClusterKey.initialize()); ATH_CHECK(m_electronOutputKey.initialize()); @@ -61,7 +45,6 @@ StatusCode egammaForwardBuilder::initialize() if (!m_objectQualityTool.empty()) { ATH_CHECK(m_objectQualityTool.retrieve()); } else { - ATH_MSG_DEBUG("egammaOQFlagsBuilder is disabled"); m_objectQualityTool.disable(); } @@ -78,31 +61,25 @@ StatusCode egammaForwardBuilder::initialize() ATH_MSG_ERROR("The number of selectors does not match the number of given fwd-electron selector names"); return StatusCode::FAILURE; } - - if (m_doChrono) ATH_CHECK( m_timingProfile.retrieve() ); ATH_MSG_DEBUG("Initialization completed successfully"); return StatusCode::SUCCESS; } -// ==================================================================== StatusCode egammaForwardBuilder::finalize() { return StatusCode::SUCCESS; } -// ====================================================================== StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const { - ATH_MSG_DEBUG("Executing egammaForwardBuilder "); // create an egamma container and register it SG::WriteHandle<xAOD::ElectronContainer> xaodFrwd(m_electronOutputKey, ctx); ATH_CHECK(xaodFrwd.record(std::make_unique<xAOD::ElectronContainer>(), std::make_unique<xAOD::ElectronAuxContainer>())); - ATH_MSG_DEBUG( "Recorded Electrons with key: " << m_electronOutputKey.key() ); //cluster SG::WriteHandle<xAOD::CaloClusterContainer> outClusterContainer(m_outClusterContainerKey, ctx); @@ -121,7 +98,6 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const return StatusCode::FAILURE; } - //loop over cluster container xAOD::CaloClusterContainer::const_iterator clus_begin = cluster->begin(); xAOD::CaloClusterContainer::const_iterator clus_end = cluster->end(); @@ -171,7 +147,6 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const } } - // Now finalize the cluster: based on code in CaloClusterStoreHelper::finalizeClusters // Note: I don't specifically set the IProxyDict, since I also don't set it when I create // data handles, either. @@ -180,8 +155,6 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const cl->setLink(outClusterContainerCellLink.ptr(), sg); } - ATH_MSG_VERBOSE("egammaForward execute completed successfully"); - return StatusCode::SUCCESS; } @@ -194,19 +167,11 @@ StatusCode egammaForwardBuilder::ExecObjectQualityTool(const EventContext& ctx, // protection in case tool is not available // return success as algorithm may be able to run without it // in degraded mode - if (m_objectQualityTool.name().empty()) return StatusCode::SUCCESS; - // setup chrono for this tool - std::string chronoName=this->name()+"_"+m_objectQualityTool->name() ; - if (m_doChrono) m_timingProfile->chronoStart(chronoName); + const CaloDetDescrManager* calodetdescrmgr = nullptr; + ATH_CHECK(detStore()->retrieve(calodetdescrmgr, "CaloMgr")); // execute the tool - StatusCode sc = m_objectQualityTool->execute(ctx, eg); - if ( sc.isFailure() ) { - ATH_MSG_DEBUG("failure returned by object quality tool"); - } - if (m_doChrono) m_timingProfile->chronoStop(chronoName); - - return sc; + return m_objectQualityTool->execute(ctx, *calodetdescrmgr,*eg); } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h index 4a2c58e51e73549e4740b068dc5d359c12dadd6a..dd83d9dfa974424b8a969cc88d43e8c71875eeed 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h @@ -24,7 +24,6 @@ // #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/IChronoStatSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/EventContext.h" @@ -39,6 +38,7 @@ #include "xAODEgamma/Egamma.h" #include "xAODEgamma/ElectronContainer.h" +#include "egammaInterfaces/IegammaOQFlagsBuilder.h" #include "egammaInterfaces/IegammaBaseTool.h" #include "egammaInterfaces/IEMFourMomBuilder.h" #include "EgammaAnalysisInterfaces/IAsgForwardElectronIsEMSelector.h" @@ -69,7 +69,7 @@ class egammaForwardBuilder : public AthReentrantAlgorithm StatusCode ExecObjectQualityTool(const EventContext &ctx, xAOD::Egamma *eg) const; /** @brief Tool to perform object quality*/ - ToolHandle<IegammaBaseTool> m_objectQualityTool {this, + ToolHandle<IegammaOQFlagsBuilder> m_objectQualityTool {this, "ObjectQualityTool", "", "Name of the object quality tool (empty tool name ignored)"}; @@ -102,11 +102,6 @@ class egammaForwardBuilder : public AthReentrantAlgorithm /** @brief eta cut */ Gaudi::Property<double> m_etacut {this, "EtaCut", 2.5, "eta cut"}; - /** @brief do chrono service */ - Gaudi::Property<bool> m_doChrono {this, "doChrono", false, "do Chrono Service"}; - - // to measure speed of the algorithm - ServiceHandle<IChronoStatSvc> m_timingProfile; protected: /** Handle to the selectors */ ToolHandleArray<IAsgForwardElectronIsEMSelector> m_forwardElectronIsEMSelectors {this, diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.cxx index 8c22f2864e24fe83f16380a6c345fef2a274cb4f..ea3aeb6e4eb4b15473334b6b6fd9de4142f63490 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.cxx @@ -1,39 +1,33 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "egammaRecBuilder.h" -#include "smallChrono.h" - #include "AthenaKernel/errorcheck.h" #include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/ServiceHandle.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" - -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "egammaRecEvent/egammaRecContainer.h" -#include "egammaInterfaces/IEMTrackMatchBuilder.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "egammaInterfaces/IEMConversionBuilder.h" +#include "egammaInterfaces/IEMTrackMatchBuilder.h" #include "egammaInterfaces/IegammaCheckEnergyDepositTool.h" +#include "egammaRecEvent/egammaRecContainer.h" #include "egammaUtils/egammaDuplicateRemoval.h" -#include "CaloUtils/CaloClusterStoreHelper.h" +#include "xAODCaloEvent/CaloClusterContainer.h" // INCLUDE GAUDI HEADER FILES: -#include <algorithm> +#include <algorithm> #include <cmath> -egammaRecBuilder::egammaRecBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_timingProfile("ChronoStatSvc", name) -{ -} +egammaRecBuilder::egammaRecBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) +{} // ================================================================= -StatusCode egammaRecBuilder::initialize() +StatusCode +egammaRecBuilder::initialize() { // initialize method @@ -45,21 +39,18 @@ StatusCode egammaRecBuilder::initialize() ////////////////////////////////////////////////// // retrieve track match builder - CHECK( RetrieveEMTrackMatchBuilder() ); + CHECK(RetrieveEMTrackMatchBuilder()); // retrieve conversion builder - CHECK( RetrieveEMConversionBuilder() ); - - - ATH_MSG_DEBUG("Doing time profiling :" << m_doChrono); - // retrieve timing profile - if (m_doChrono) CHECK (m_timingProfile.retrieve()); + CHECK(RetrieveEMConversionBuilder()); ATH_MSG_DEBUG("Initialization completed successfully"); return StatusCode::SUCCESS; } // ==================================================================== -StatusCode egammaRecBuilder::RetrieveEMTrackMatchBuilder(){ +StatusCode +egammaRecBuilder::RetrieveEMTrackMatchBuilder() +{ // retrieve EMTrackMatchBuilder tool if (!m_doTrackMatching) { m_trackMatchBuilder.disable(); @@ -67,23 +58,26 @@ StatusCode egammaRecBuilder::RetrieveEMTrackMatchBuilder(){ } if (m_trackMatchBuilder.empty()) { - ATH_MSG_ERROR("EMTrackMatchBuilder is empty, but track matching is enabled"); + ATH_MSG_ERROR( + "EMTrackMatchBuilder is empty, but track matching is enabled"); return StatusCode::FAILURE; - } - - if(m_trackMatchBuilder.retrieve().isFailure()) { - ATH_MSG_ERROR("Unable to retrieve "<<m_trackMatchBuilder); + } + + if (m_trackMatchBuilder.retrieve().isFailure()) { + ATH_MSG_ERROR("Unable to retrieve " << m_trackMatchBuilder); return StatusCode::FAILURE; } - else ATH_MSG_DEBUG("Retrieved Tool "<<m_trackMatchBuilder); + ATH_MSG_DEBUG("Retrieved Tool " << m_trackMatchBuilder); return StatusCode::SUCCESS; } -StatusCode egammaRecBuilder::RetrieveEMConversionBuilder(){ +StatusCode +egammaRecBuilder::RetrieveEMConversionBuilder() +{ // // retrieve EMConversionBuilder tool - // + // if (!m_doConversions) { m_conversionBuilder.disable(); return StatusCode::SUCCESS; @@ -91,63 +85,67 @@ StatusCode egammaRecBuilder::RetrieveEMConversionBuilder(){ if (m_conversionBuilder.empty()) { ATH_MSG_ERROR("EMConversionBuilder is empty"); return StatusCode::FAILURE; - } - if(m_conversionBuilder.retrieve().isFailure()) { - ATH_MSG_ERROR("Unable to retrieve "<<m_conversionBuilder); + } + if (m_conversionBuilder.retrieve().isFailure()) { + ATH_MSG_ERROR("Unable to retrieve " << m_conversionBuilder); return StatusCode::FAILURE; } - else ATH_MSG_DEBUG("Retrieved Tool "<<m_conversionBuilder); + ATH_MSG_DEBUG("Retrieved Tool " << m_conversionBuilder); return StatusCode::SUCCESS; } -StatusCode egammaRecBuilder::finalize(){ +StatusCode +egammaRecBuilder::finalize() +{ // finalize method return StatusCode::SUCCESS; } -StatusCode egammaRecBuilder::execute(){ +StatusCode +egammaRecBuilder::execute_r(const EventContext& ctx) const +{ // athena execute method ATH_MSG_DEBUG("Executing egammaRecBuilder"); - - // Chrono name for each Tool - std::string chronoName; - SG::ReadHandle<xAOD::CaloClusterContainer> topoclusters(m_inputTopoClusterContainerKey); + SG::ReadHandle<xAOD::CaloClusterContainer> topoclusters( + m_inputTopoClusterContainerKey, ctx); - // validity check is only really needed for serial running. Remove when MT is only way. + // validity check is only really needed for serial running. Remove when MT is + // only way. if (!topoclusters.isValid()) { - ATH_MSG_ERROR("Could not retrieve cluster container:" << m_inputTopoClusterContainerKey.key()); + ATH_MSG_ERROR("Could not retrieve cluster container:" + << m_inputTopoClusterContainerKey.key()); return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG("Retrieved input cluster container"); - } + - //Build the initial egamma Rec objects for all copied Topo Clusters - SG::WriteHandle<EgammaRecContainer> egammaRecs(m_egammaRecContainerKey); + // Build the initial egamma Rec objects for all copied Topo Clusters + SG::WriteHandle<EgammaRecContainer> egammaRecs(m_egammaRecContainerKey, ctx); ATH_CHECK(egammaRecs.record(std::make_unique<EgammaRecContainer>())); - + for (size_t i(0); i < topoclusters->size(); i++) { - const ElementLink< xAOD::CaloClusterContainer > clusterLink( *topoclusters, i ); - const std::vector< ElementLink<xAOD::CaloClusterContainer> > ClusterLink {clusterLink}; + const ElementLink<xAOD::CaloClusterContainer> clusterLink(*topoclusters, i); + const std::vector<ElementLink<xAOD::CaloClusterContainer>> ClusterLink{ + clusterLink + }; auto egRec = std::make_unique<egammaRec>(); - egRec->setCaloClusters( ClusterLink ); - egammaRecs->push_back( std::move(egRec) ); + egRec->setCaloClusters(ClusterLink); + egammaRecs->push_back(std::move(egRec)); } - ///Append track Matching information - if (m_doTrackMatching){ - smallChrono timer(*m_timingProfile, this->name()+"_"+m_trackMatchBuilder->name()+"_AllClusters", m_doChrono); - ATH_CHECK(m_trackMatchBuilder->executeRec(Gaudi::Hive::currentContext(),egammaRecs.ptr())); + /// Append track Matching information + if (m_doTrackMatching) { + ATH_CHECK(m_trackMatchBuilder->executeRec(ctx, egammaRecs.ptr())); } - //Do the conversion matching - if (m_doConversions){ - ATH_MSG_DEBUG("Running ConversionBuilder"); - smallChrono timer(*m_timingProfile, this->name()+"_"+m_conversionBuilder->name()+"_AllClusters", m_doChrono); + // Do the conversion matching + if (m_doConversions) { + ATH_MSG_DEBUG("Running ConversionBuilder"); for (auto egRec : *egammaRecs) { - if (m_conversionBuilder->executeRec(Gaudi::Hive::currentContext(),egRec).isFailure()){ + if (m_conversionBuilder->executeRec(ctx, egRec).isFailure()) { ATH_MSG_ERROR("Problem executing " << m_conversionBuilder); - return StatusCode::FAILURE; + return StatusCode::FAILURE; } } } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.h index 2449fe0e6da2b00fffb6b0f879a1447695c76193..9a45787f9563d5cd74628f2be31420cb88c6076e 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaRecBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EGAMMARECBUILDER_H @@ -14,11 +14,9 @@ // INCLUDE HEADER FILES: #include <vector> - #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/IChronoStatSvc.h" -#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/EventContext.h" #include "xAODCaloEvent/CaloClusterContainer.h" #include "StoreGate/ReadHandleKey.h" @@ -40,8 +38,15 @@ class egammaRecBuilder : public AthAlgorithm /** @brief finalize method*/ StatusCode finalize() override final; /** @brief execute method*/ - StatusCode execute() override final; - + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; + + private: /** @brief retrieve EMTrackMatchBuilder **/ @@ -82,12 +87,6 @@ class egammaRecBuilder : public AthAlgorithm /** @brief private member flag to do the conversion matching */ Gaudi::Property<bool> m_doConversions {this, "doConversions", true, "Boolean to do conversion matching"}; - // - // Other properties. - // - ServiceHandle<IChronoStatSvc> m_timingProfile; - /** @brief private member flag to do chrono service */ - Gaudi::Property<bool> m_doChrono {this, "doChrono", false, "do Chrono Service"}; }; diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx index 8ef83094a4dfbd475824e5933ffe1779fd69701c..73ed8b4558816fe289b062ee63e0852c70ce817b 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx @@ -34,7 +34,8 @@ UPDATE : 25/06/2018 #include <stdexcept> #include <vector> -egammaSelectedTrackCopy::egammaSelectedTrackCopy(const std::string& name, ISvcLocator* pSvcLocator) +egammaSelectedTrackCopy::egammaSelectedTrackCopy(const std::string& name, + ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) , m_AllClusters{} , m_SelectedClusters{} @@ -84,26 +85,34 @@ egammaSelectedTrackCopy::egammaSelectedTrackCopy::finalize() } StatusCode -egammaSelectedTrackCopy::execute() +egammaSelectedTrackCopy::execute_r(const EventContext& ctx) const { - SG::ReadHandle<xAOD::CaloClusterContainer> clusterTES(m_clusterContainerKey); + SG::ReadHandle<xAOD::CaloClusterContainer> clusterTES(m_clusterContainerKey, + ctx); if (!clusterTES.isValid()) { - ATH_MSG_FATAL("Failed to retrieve cluster container: " << m_clusterContainerKey.key()); + ATH_MSG_FATAL( + "Failed to retrieve cluster container: " << m_clusterContainerKey.key()); return StatusCode::FAILURE; } - SG::ReadHandle<xAOD::TrackParticleContainer> trackTES(m_trackParticleContainerKey); + SG::ReadHandle<xAOD::TrackParticleContainer> trackTES( + m_trackParticleContainerKey, ctx); + if (!trackTES.isValid()) { - ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " << m_trackParticleContainerKey.key()); + ATH_MSG_FATAL("Failed to retrieve TrackParticle container: " + << m_trackParticleContainerKey.key()); return StatusCode::FAILURE; } - SG::WriteHandle<ConstDataVector<xAOD::TrackParticleContainer>> outputTrkPartContainer(m_OutputTrkPartContainerKey); + SG::WriteHandle<ConstDataVector<xAOD::TrackParticleContainer>> + outputTrkPartContainer(m_OutputTrkPartContainerKey,ctx); /* * Here it just needs to be a view copy , * i.e the collection of selected trackParticles * we create does not really own its elements */ - auto viewCopy = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(SG::VIEW_ELEMENTS); + auto viewCopy = + std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>( + SG::VIEW_ELEMENTS); // Local counters auto allClusters = m_AllClusters.buffer(); @@ -154,7 +163,7 @@ egammaSelectedTrackCopy::execute() check if it the track is selected due to this cluster. If not continue to next cluster */ - if (!Select(Gaudi::Hive::currentContext(), cluster, track, cache, isTRT)) { + if (!Select(ctx, cluster, track, cache, isTRT)) { continue; } viewCopy->push_back(track); diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h index 60da2773bd2a33b938388ba67b4d89c7f2cd4805..1457745db97f25b5093e0f723861b63efe8a2099 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EGAMMASELECTEDTRACKCOPY_H @@ -14,16 +14,16 @@ #include "egammaInterfaces/IEMExtrapolationTools.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ToolHandle.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" -#include "xAODTracking/TrackParticleFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" -#include "xAODCaloEvent/CaloClusterFwd.h" -#include "xAODCaloEvent/CaloClusterContainer.h" #include "AthContainers/ConstDataVector.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "xAODCaloEvent/CaloClusterFwd.h" +#include "xAODTracking/TrackParticleContainerFwd.h" +#include "xAODTracking/TrackParticleFwd.h" #include "egammaInterfaces/IegammaCaloClusterSelector.h" #include <Gaudi/Accumulators.h> @@ -33,7 +33,7 @@ class CaloCluster; -class egammaSelectedTrackCopy : public AthAlgorithm +class egammaSelectedTrackCopy : public AthAlgorithm { public: /** @brief Default constructor*/ @@ -41,78 +41,133 @@ public: virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; private: - /** @brief broad track selection */ bool Select(const EventContext& ctx, const xAOD::CaloCluster* cluster, const xAOD::TrackParticle* track, IEMExtrapolationTools::Cache& cache, bool trkTRT) const; - + /** @brief Tool for extrapolation */ - ToolHandle<IEMExtrapolationTools> m_extrapolationTool {this, - "ExtrapolationTool", "EMExtrapolationTools", "Extrapolation tool"}; + ToolHandle<IEMExtrapolationTools> m_extrapolationTool{ this, + "ExtrapolationTool", + "EMExtrapolationTools", + "Extrapolation tool" }; /** @brief Tool for extrapolation */ - ToolHandle<IEMExtrapolationTools> m_extrapolationToolCommonCache {this, - "ExtrapolationToolCommonCache", "EMExtrapolationToolsCommonCache", - "Extrapolation tool using the ATLAS common cache"}; + ToolHandle<IEMExtrapolationTools> m_extrapolationToolCommonCache{ + this, + "ExtrapolationToolCommonCache", + "EMExtrapolationToolsCommonCache", + "Extrapolation tool using the ATLAS common cache" + }; /** @brief Tool to filter the calo clusters */ - ToolHandle<IegammaCaloClusterSelector> m_egammaCaloClusterSelector {this, - "egammaCaloClusterSelector", "egammaCaloClusterSelector", - "Tool that makes the cluster selection"}; + ToolHandle<IegammaCaloClusterSelector> m_egammaCaloClusterSelector{ + this, + "egammaCaloClusterSelector", + "egammaCaloClusterSelector", + "Tool that makes the cluster selection" + }; /** @brief Names of input output collections */ - SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerKey {this, - "ClusterContainerName", "egammaTopoCluster", "Input calo cluster for seeding"}; - - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey {this, - "TrackParticleContainerName", "InDetTrackParticles", - "Input TrackParticles to select from"}; - - SG::WriteHandleKey< ConstDataVector<xAOD::TrackParticleContainer> > m_OutputTrkPartContainerKey {this, - "OutputTrkPartContainerName", "egammaSelectedTrackParticles", - "Output selected TrackParticles"}; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerKey{ + this, + "ClusterContainerName", + "egammaTopoCluster", + "Input calo cluster for seeding" + }; + + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey{ + this, + "TrackParticleContainerName", + "InDetTrackParticles", + "Input TrackParticles to select from" + }; + + SG::WriteHandleKey<ConstDataVector<xAOD::TrackParticleContainer>> + m_OutputTrkPartContainerKey{ this, + "OutputTrkPartContainerName", + "egammaSelectedTrackParticles", + "Output selected TrackParticles" }; /** @Cut on minimum silicon hits*/ - Gaudi::Property<int> m_MinNoSiHits {this, "minNoSiHits", 4, - "Minimum number of silicon hits on track before it is allowed to be refitted"}; + Gaudi::Property<int> m_MinNoSiHits{ this, + "minNoSiHits", + 4, + "Minimum number of silicon hits on track " + "before it is allowed to be refitted" }; /** @brief broad cut on deltaEta*/ - Gaudi::Property<double> m_broadDeltaEta {this, "broadDeltaEta", 0.2, - "Value of broad cut for delta eta"}; + Gaudi::Property<double> m_broadDeltaEta{ this, + "broadDeltaEta", + 0.2, + "Value of broad cut for delta eta" }; /** @brief broad cut on deltaPhi*/ - Gaudi::Property<double> m_broadDeltaPhi {this, "broadDeltaPhi", 0.3, - "Value of broad cut for delta phi"}; + Gaudi::Property<double> m_broadDeltaPhi{ this, + "broadDeltaPhi", + 0.3, + "Value of broad cut for delta phi" }; /** @narrow windows*/ - Gaudi::Property<double> m_narrowDeltaEta {this, "narrowDeltaEta", 0.05, - "Value of narrow cut for delta eta"}; - - Gaudi::Property<double> m_narrowDeltaPhi {this, "narrowDeltaPhi", 0.05, - "Value of narrow cut for delta phi"}; - - Gaudi::Property<double> m_narrowDeltaPhiBrem {this, "narrowDeltaPhiBrem", 0.2, - "Value of the narrow cut for delta phi in the brem direction"}; - - Gaudi::Property<double> m_narrowRescale {this, "narrowDeltaPhiRescale", 0.05, - "Value of the narrow cut for delta phi Rescale"}; - - Gaudi::Property<double> m_narrowRescaleBrem {this, "narrowDeltaPhiRescaleBrem", 0.1, - "Value of the narrow cut for delta phi Rescale Brem"}; + Gaudi::Property<double> m_narrowDeltaEta{ + this, + "narrowDeltaEta", + 0.05, + "Value of narrow cut for delta eta" + }; + + Gaudi::Property<double> m_narrowDeltaPhi{ + this, + "narrowDeltaPhi", + 0.05, + "Value of narrow cut for delta phi" + }; + + Gaudi::Property<double> m_narrowDeltaPhiBrem{ + this, + "narrowDeltaPhiBrem", + 0.2, + "Value of the narrow cut for delta phi in the brem direction" + }; + + Gaudi::Property<double> m_narrowRescale{ + this, + "narrowDeltaPhiRescale", + 0.05, + "Value of the narrow cut for delta phi Rescale" + }; + + Gaudi::Property<double> m_narrowRescaleBrem{ + this, + "narrowDeltaPhiRescaleBrem", + 0.1, + "Value of the narrow cut for delta phi Rescale Brem" + }; // For P->T converters of ID tracks with Pixel - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, - "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}; + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_pixelDetEleCollKey{ this, + "PixelDetEleCollKey", + "PixelDetectorElementCollection", + "Key of SiDetectorElementCollection for Pixel" }; // For P->T converters of ID tracks with SCT - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, - "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; - + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> + m_SCTDetEleCollKey{ this, + "SCTDetEleCollKey", + "SCT_DetectorElementCollection", + "Key of SiDetectorElementCollection for SCT" }; + mutable Gaudi::Accumulators::Counter<unsigned long> m_AllClusters; mutable Gaudi::Accumulators::Counter<unsigned long> m_SelectedClusters; mutable Gaudi::Accumulators::Counter<unsigned long> m_AllTracks; @@ -122,4 +177,4 @@ private: mutable Gaudi::Accumulators::Counter<unsigned long> m_AllTRTTracks; mutable Gaudi::Accumulators::Counter<unsigned long> m_SelectedTRTTracks; }; -#endif +#endif diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx index 3a0d51777247aa0d769857dedc7140b51771e9cf..ba468e06acc04cfcaf441b65a8dcd913641c6c3a 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.cxx @@ -4,47 +4,52 @@ #include "egammaSuperClusterBuilder.h" // -#include "CaloUtils/CaloClusterStoreHelper.h" #include "CaloUtils/CaloCellList.h" +#include "CaloUtils/CaloClusterStoreHelper.h" #include "CaloUtils/CaloLayerCalculator.h" // -#include "xAODCaloEvent/CaloClusterAuxContainer.h" +#include "egammaRecEvent/egammaRecContainer.h" #include "xAODCaloEvent/CaloCluster.h" +#include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODCaloEvent/CaloClusterKineHelper.h" -#include "egammaRecEvent/egammaRecContainer.h" #include "xAODEgamma/EgammaEnums.h" -#include "xAODEgamma/PhotonxAODHelpers.h" #include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODTracking/Vertex.h" +#include "xAODEgamma/PhotonxAODHelpers.h" #include "xAODTracking/TrackParticle.h" +#include "xAODTracking/Vertex.h" // -#include "FourMomUtils/P4Helpers.h" #include "CaloGeoHelpers/proxim.h" +#include "FourMomUtils/P4Helpers.h" -#include <vector> #include <cmath> +#include <vector> namespace { - /** - * Duplicate code - * @brief Return eta/phi ranges encompassing +- 1 cell. - * @param eta Central eta value. - * @param phi Central phi value. - * @param sampling The sampling to use. - * @param[out] deta Range in eta. - * @param[out] dphi Range in phi. - * - * This can be a little tricky due to misalignments and the fact - * that cells have different sizes in different regions. Also, - * CaloLayerCalculator takes only a symmetric eta range. - * We try to find the neighboring cells by starting from the center - * cell and looking a little bit more than half its width in either - * direction, and finding the centers of those cells. Then we use - * the larger of these for the symmetric range. - */ -void etaphi_range(const CaloDetDescrManager& dd_man, double eta, double phi, - CaloCell_ID::CaloSample sampling, double& deta, - double& dphi) { +/** + * Duplicate code + * @brief Return eta/phi ranges encompassing +- 1 cell. + * @param eta Central eta value. + * @param phi Central phi value. + * @param sampling The sampling to use. + * @param[out] deta Range in eta. + * @param[out] dphi Range in phi. + * + * This can be a little tricky due to misalignments and the fact + * that cells have different sizes in different regions. Also, + * CaloLayerCalculator takes only a symmetric eta range. + * We try to find the neighboring cells by starting from the center + * cell and looking a little bit more than half its width in either + * direction, and finding the centers of those cells. Then we use + * the larger of these for the symmetric range. + */ +void +etaphi_range(const CaloDetDescrManager& dd_man, + double eta, + double phi, + CaloCell_ID::CaloSample sampling, + double& deta, + double& dphi) +{ deta = 0; dphi = 0; // Get the DD element for the central cell. @@ -56,15 +61,13 @@ void etaphi_range(const CaloDetDescrManager& dd_man, double eta, double phi, constexpr double eps = 0.001; // Now look in the negative eta direction. - const CaloDetDescrElement* elt_l = - dd_man.get_element_raw(sampling, eta - elt->deta() - eps, phi); + const CaloDetDescrElement* elt_l = dd_man.get_element_raw(sampling, eta - elt->deta() - eps, phi); double deta_l = 0; // Eta difference on the low (left) side. if (elt_l) { deta_l = std::abs(eta - elt_l->eta_raw()) + eps; } // Now look in the positive eta direction. - const CaloDetDescrElement* elt_r = - dd_man.get_element_raw(sampling, eta + elt->deta() + eps, phi); + const CaloDetDescrElement* elt_r = dd_man.get_element_raw(sampling, eta + elt->deta() + eps, phi); double deta_r = 0; // Eta difference on the high (right) side. if (elt_r) { deta_r = std::abs(eta - elt_r->eta_raw()) + eps; @@ -77,16 +80,16 @@ void etaphi_range(const CaloDetDescrManager& dd_man, double eta, double phi, // Thus we have to look again at the adjacent eta cells, and // take the largest variation. // Now look in the negative eta direction. - elt_l = dd_man.get_element_raw(sampling, eta - elt->deta() - eps, - CaloPhiRange::fix(phi - elt->dphi() - eps)); + elt_l = dd_man.get_element_raw( + sampling, eta - elt->deta() - eps, CaloPhiRange::fix(phi - elt->dphi() - eps)); double dphi_l = 0; // Phi difference on the low-eta () side. if (elt_l) { dphi_l = std::abs(CaloPhiRange::fix(phi - elt_l->phi_raw())) + eps; } // Now look in the positive eta direction. - elt_r = dd_man.get_element_raw(sampling, eta + elt->deta() + eps, - CaloPhiRange::fix(phi - elt->dphi() - eps)); + elt_r = dd_man.get_element_raw( + sampling, eta + elt->deta() + eps, CaloPhiRange::fix(phi - elt->dphi() - eps)); double dphi_r = 0; // Phi difference on the positive (down) side. if (elt_r) { dphi_r = std::abs(CaloPhiRange::fix(phi - elt_r->phi_raw())) + eps; @@ -96,17 +99,16 @@ void etaphi_range(const CaloDetDescrManager& dd_man, double eta, double phi, } } - ////////////////////////////////////////////////////////////////////////////// -//Athena interfaces. +// Athena interfaces. ////////////////////////////////////////////////////////////////////////////// -//Constructor. -egammaSuperClusterBuilder::egammaSuperClusterBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) +// Constructor. +egammaSuperClusterBuilder::egammaSuperClusterBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) { - + m_searchWindowPhiBarrel = m_searchWindowPhiCellsBarrel * s_cellPhiSize * 0.5; m_searchWindowEtaBarrel = m_searchWindowEtaCellsBarrel * s_cellEtaSize * 0.5; m_searchWindowPhiEndcap = m_searchWindowPhiCellsEndcap * s_cellPhiSize * 0.5; @@ -116,13 +118,14 @@ egammaSuperClusterBuilder::egammaSuperClusterBuilder(const std::string& name, m_addCellsWindowEtaBarrel = m_addCellsWindowEtaCellsBarrel * s_cellEtaSize * 0.5; m_addCellsWindowPhiEndcap = m_addCellsWindowPhiCellsEndcap * s_cellPhiSize * 0.5; m_addCellsWindowEtaEndcap = m_addCellsWindowEtaCellsEndcap * s_cellEtaSize * 0.5; - - // the +1 is to account for the offset in the centers of the clusters - m_extraL0L1PhiSize= m_extraL0L1PhiSizeCells * s_cellPhiSize; + // the +1 is to account for the offset in the centers of the clusters + m_extraL0L1PhiSize = m_extraL0L1PhiSizeCells * s_cellPhiSize; } -StatusCode egammaSuperClusterBuilder::initialize() { +StatusCode +egammaSuperClusterBuilder::initialize() +{ ATH_MSG_DEBUG(" Initializing egamma SuperClusterBuilder"); m_searchWindowPhiBarrel = m_searchWindowPhiCellsBarrel * s_cellPhiSize * 0.5; m_searchWindowEtaBarrel = m_searchWindowEtaCellsBarrel * s_cellEtaSize * 0.5; @@ -137,11 +140,10 @@ StatusCode egammaSuperClusterBuilder::initialize() { // the +1 is to account for the offset in the centers of the clusters m_extraL0L1PhiSize = m_extraL0L1PhiSizeCells * s_cellPhiSize; - if (m_addCellsWindowPhiCellsBarrel % 2 == 0 || - m_addCellsWindowPhiCellsEndcap % 2 == 0 || - m_addCellsWindowEtaCellsBarrel % 2 == 0 || - m_addCellsWindowEtaCellsEndcap % 2 == 0) { - ATH_MSG_FATAL("For adding cells relative to the hottest cell to be symmetric, the AddCells window size needs to be odd"); + if (m_addCellsWindowPhiCellsBarrel % 2 == 0 || m_addCellsWindowPhiCellsEndcap % 2 == 0 || + m_addCellsWindowEtaCellsBarrel % 2 == 0 || m_addCellsWindowEtaCellsEndcap % 2 == 0) { + ATH_MSG_FATAL("For adding cells relative to the hottest cell to be symmetric, the AddCells " + "window size needs to be odd"); return StatusCode::FAILURE; } @@ -149,7 +151,7 @@ StatusCode egammaSuperClusterBuilder::initialize() { ATH_CHECK(m_MVACalibSvc.retrieve()); if (!m_egammaCheckEnergyDepositTool.empty()) { - ATH_CHECK( m_egammaCheckEnergyDepositTool.retrieve() ); + ATH_CHECK(m_egammaCheckEnergyDepositTool.retrieve()); } else { m_egammaCheckEnergyDepositTool.disable(); } @@ -157,39 +159,40 @@ StatusCode egammaSuperClusterBuilder::initialize() { return StatusCode::SUCCESS; } -bool egammaSuperClusterBuilder::matchesInWindow(const xAOD::CaloCluster *ref, - const xAOD::CaloCluster *clus) const +bool +egammaSuperClusterBuilder::matchesInWindow(const xAOD::CaloCluster* ref, + const xAOD::CaloCluster* clus) const { - //First the case where we are both endcap and barrel, i.e in the crack - //Check around both measurements of the seed + // First the case where we are both endcap and barrel, i.e in the crack + // Check around both measurements of the seed if (ref->hasSampling(CaloSampling::EMB2) && ref->hasSampling(CaloSampling::EME2)) { - float dEta(fabs(ref->eta()-clus->eta())); + float dEta(fabs(ref->eta() - clus->eta())); float dPhi(fabs(P4Helpers::deltaPhi(ref->phi(), clus->phi()))); // - float dEtaBarrel (fabs(ref->etaSample(CaloSampling::EMB2)-clus->eta())); - float dPhiBarrel (fabs(P4Helpers::deltaPhi(ref->phiSample(CaloSampling::EMB2),clus->phi()))); + float dEtaBarrel(fabs(ref->etaSample(CaloSampling::EMB2) - clus->eta())); + float dPhiBarrel(fabs(P4Helpers::deltaPhi(ref->phiSample(CaloSampling::EMB2), clus->phi()))); // - float dEtaEndcap (fabs(ref->etaSample(CaloSampling::EME2)-clus->eta())); - float dPhiEndcap (fabs(P4Helpers::deltaPhi(ref->phiSample(CaloSampling::EME2),clus->phi()))); - //Matches any in case of split - return ( (dEta < m_searchWindowEtaBarrel && dPhi < m_searchWindowPhiBarrel) || - (dEta < m_searchWindowEtaEndcap && dPhi < m_searchWindowPhiEndcap) || - (dEtaBarrel < m_searchWindowEtaBarrel && dPhiBarrel < m_searchWindowPhiBarrel) || - (dEtaEndcap < m_searchWindowEtaEndcap && dPhiEndcap < m_searchWindowPhiEndcap)); - } - else if (xAOD::EgammaHelpers::isBarrel(clus)) { - float dEta(fabs(ref->eta()-clus->eta())); + float dEtaEndcap(fabs(ref->etaSample(CaloSampling::EME2) - clus->eta())); + float dPhiEndcap(fabs(P4Helpers::deltaPhi(ref->phiSample(CaloSampling::EME2), clus->phi()))); + // Matches any in case of split + return ((dEta < m_searchWindowEtaBarrel && dPhi < m_searchWindowPhiBarrel) || + (dEta < m_searchWindowEtaEndcap && dPhi < m_searchWindowPhiEndcap) || + (dEtaBarrel < m_searchWindowEtaBarrel && dPhiBarrel < m_searchWindowPhiBarrel) || + (dEtaEndcap < m_searchWindowEtaEndcap && dPhiEndcap < m_searchWindowPhiEndcap)); + } if (xAOD::EgammaHelpers::isBarrel(clus)) { + float dEta(fabs(ref->eta() - clus->eta())); float dPhi(fabs(P4Helpers::deltaPhi(ref->phi(), clus->phi()))); return (dEta < m_searchWindowEtaBarrel && dPhi < m_searchWindowPhiBarrel); } else { - float dEta(fabs(ref->eta()-clus->eta())); + float dEta(fabs(ref->eta() - clus->eta())); float dPhi(fabs(P4Helpers::deltaPhi(ref->phi(), clus->phi()))); return (dEta < m_searchWindowEtaEndcap && dPhi < m_searchWindowPhiEndcap); } } std::unique_ptr<xAOD::CaloCluster> -egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCluster*>& clusters, +egammaSuperClusterBuilder::createNewCluster(const EventContext& ctx, + const std::vector<const xAOD::CaloCluster*>& clusters, const CaloDetDescrManager& mgr, xAOD::EgammaParameters::EgammaType egType) const { @@ -214,7 +217,7 @@ egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCl // these are the same as the reference but in calo frame (after the processing below) CentralPosition cp0 = cpRef; - //Get the hotest in raw co-ordinates + // Get the hotest in raw co-ordinates if (cp0.emaxB > 0) { CaloCell_ID::CaloSample xsample = CaloCell_ID::EMB2; const CaloDetDescrElement* dde = mgr.get_element(xsample, cpRef.etaB, cpRef.phiB); @@ -222,7 +225,8 @@ egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCl cp0.etaB = dde->eta_raw(); cp0.phiB = dde->phi_raw(); } else { - ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = " << cpRef.etaB << ", phi = " << cpRef.phiB); + ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = " + << cpRef.etaB << ", phi = " << cpRef.phiB); } } if (cp0.emaxEC > 0) { @@ -232,12 +236,12 @@ egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCl cp0.etaEC = dde->eta_raw(); cp0.phiEC = dde->phi_raw(); } else { - ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = " << cpRef.etaEC - << ", phi = " << cpRef.phiEC); + ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for eta = " + << cpRef.etaEC << ", phi = " << cpRef.phiEC); } } - //Set the eta0/phi0 based on the references, but in raw coordinates + // Set the eta0/phi0 based on the references, but in raw coordinates if (cp0.emaxB >= cp0.emaxEC) { newCluster->setEta0(cp0.etaB); newCluster->setPhi0(cp0.phiB); @@ -246,65 +250,68 @@ egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCl newCluster->setPhi0(cp0.phiEC); } - //Need a vector of element Links to the constituent Cluster - std::vector< ElementLink< xAOD::CaloClusterContainer > > constituentLinks; - static const SG::AuxElement::Accessor < ElementLink < xAOD::CaloClusterContainer > > sisterCluster("SisterCluster"); + // Need a vector of element Links to the constituent Cluster + std::vector<ElementLink<xAOD::CaloClusterContainer>> constituentLinks; + static const SG::AuxElement::Accessor<ElementLink<xAOD::CaloClusterContainer>> sisterCluster( + "SisterCluster"); // Now add the cluster cells (other than L1 and PS) for (size_t i = 0; i < acSize; i++) { - //Add te EM cells of the accumulated to the cluster - if (addEMCellsToCluster(newCluster.get(),clusters[i], cp0).isFailure()) { - ATH_MSG_DEBUG( - "There was problem adding the topocluster cells to the the cluster: potentially no L2 or L3 cells in cluster"); + // Add te EM cells of the accumulated to the cluster + if (addEMCellsToCluster(newCluster.get(), clusters[i], cp0).isFailure()) { + ATH_MSG_DEBUG("There was problem adding the topocluster cells to the the cluster: " + "potentially no L2 or L3 cells in cluster"); return nullptr; } - //Set the element Link to the constitents + // Set the element Link to the constitents if (sisterCluster.isAvailable(*clusters[i])) { constituentLinks.push_back(sisterCluster(*clusters[i])); - }else{ + } else { ATH_MSG_WARNING("No sister Link available"); } } // Now calculate the cluster size; use that for restricting the L1 cells - PhiSize phiSize = findPhiSize(cp0,newCluster.get()); + PhiSize phiSize = findPhiSize(cp0, newCluster.get()); // now add L1 cells for (size_t i = 0; i < acSize; i++) { - //Add te EM cells of the accumulated to the cluster - if (addL0L1EMCellsToCluster(newCluster.get(),clusters[i], cp0, phiSize).isFailure()) { - ATH_MSG_WARNING("There was problem adding the topocluster PS and L1 cells to the the cluster"); + // Add te EM cells of the accumulated to the cluster + if (addL0L1EMCellsToCluster(newCluster.get(), clusters[i], cp0, phiSize).isFailure()) { + ATH_MSG_WARNING( + "There was problem adding the topocluster PS and L1 cells to the the cluster"); return nullptr; } } // Apply SW-style summation of TileGap3 cells (if necessary). - if (addTileGap3CellsinWindow(newCluster.get(),mgr).isFailure()) { + if (addTileGap3CellsinWindow(newCluster.get(), mgr).isFailure()) { ATH_MSG_ERROR("Problem with the input cluster when running AddTileGap3CellsinWindow?"); return nullptr; } - //Set the link from the super cluster to the constituents (accumulated) clusters used. - static const SG::AuxElement::Accessor < std::vector< ElementLink< xAOD::CaloClusterContainer > > > caloClusterLinks("constituentClusterLinks"); + // Set the link from the super cluster to the constituents (accumulated) clusters used. + static const SG::AuxElement::Accessor<std::vector<ElementLink<xAOD::CaloClusterContainer>>> + caloClusterLinks("constituentClusterLinks"); caloClusterLinks(*newCluster) = constituentLinks; - ///Calculate the kinematics of the new cluster, after all cells are added + /// Calculate the kinematics of the new cluster, after all cells are added CaloClusterKineHelper::calculateKine(newCluster.get(), true, true); - //If adding all EM cells we are somehow below the seed threshold then remove - if(newCluster->et()<m_EtThresholdCut ){ + // If adding all EM cells we are somehow below the seed threshold then remove + if (newCluster->et() < m_EtThresholdCut) { return nullptr; } - //Check to see if cluster pases basic requirements. If not, kill it. - if( !m_egammaCheckEnergyDepositTool.empty() && - !m_egammaCheckEnergyDepositTool->checkFractioninSamplingCluster( newCluster.get() ) ) { + // Check to see if cluster pases basic requirements. If not, kill it. + if (!m_egammaCheckEnergyDepositTool.empty() && + !m_egammaCheckEnergyDepositTool->checkFractioninSamplingCluster(newCluster.get())) { ATH_MSG_DEBUG("Cluster failed sample check: dont make ROI"); return nullptr; } // Apply correction calibration - if (calibrateCluster(newCluster.get(), mgr, egType).isFailure()) { + if (calibrateCluster(ctx, newCluster.get(), mgr, egType).isFailure()) { ATH_MSG_WARNING("There was problem calibrating the object"); return nullptr; } @@ -312,9 +319,11 @@ egammaSuperClusterBuilder::createNewCluster(const std::vector<const xAOD::CaloCl return newCluster; } -StatusCode egammaSuperClusterBuilder::addEMCellsToCluster(xAOD::CaloCluster *newCluster, - const xAOD::CaloCluster *ref, - const egammaSuperClusterBuilder::CentralPosition& cp0) const +StatusCode +egammaSuperClusterBuilder::addEMCellsToCluster( + xAOD::CaloCluster* newCluster, + const xAOD::CaloCluster* ref, + const egammaSuperClusterBuilder::CentralPosition& cp0) const { if (!newCluster || !ref) { ATH_MSG_ERROR("Invalid input in AddEMCellsToCluster"); @@ -323,65 +332,69 @@ StatusCode egammaSuperClusterBuilder::addEMCellsToCluster(xAOD::CaloCluster *new // xAOD::CaloCluster::const_cell_iterator cell_itr = ref->begin(); xAOD::CaloCluster::const_cell_iterator cell_end = ref->end(); - //Loop over cells - for (; cell_itr != cell_end; ++cell_itr) { - - //sanity check on the cell - const CaloCell* cell = *cell_itr; - if (!cell){ + // Loop over cells + for (; cell_itr != cell_end; ++cell_itr) { + + // sanity check on the cell + const CaloCell* cell = *cell_itr; + if (!cell) { continue; } bool addCell = false; - + // lets remove from consideration if outside the range if (cp0.emaxB > 0) { // has cells in the barrel if (fabs(cp0.etaB - cell->caloDDE()->eta_raw()) < m_addCellsWindowEtaBarrel && - fabs(P4Helpers::deltaPhi(cp0.phiB, cell->caloDDE()->phi_raw())) < m_addCellsWindowPhiBarrel) { + fabs(P4Helpers::deltaPhi(cp0.phiB, cell->caloDDE()->phi_raw())) < + m_addCellsWindowPhiBarrel) { addCell = true; } } if (cp0.emaxEC > 0) { // has cells in the endcap if (fabs(cp0.etaEC - cell->caloDDE()->eta_raw()) < m_addCellsWindowEtaEndcap && - fabs(P4Helpers::deltaPhi(cp0.phiEC, cell->caloDDE()->phi_raw())) < m_addCellsWindowPhiEndcap) { + fabs(P4Helpers::deltaPhi(cp0.phiEC, cell->caloDDE()->phi_raw())) < + m_addCellsWindowPhiEndcap) { addCell = true; } } - if (!addCell) continue; - - const CaloDetDescrElement *dde = cell->caloDDE(); - if(!dde){ + if (!addCell) + continue; + + const CaloDetDescrElement* dde = cell->caloDDE(); + if (!dde) { continue; } auto sampling = dde->getSampling(); - // skip if sampling is L1 or presample, since that is a separate step + // skip if sampling is L1 or presample, since that is a separate step if (CaloCell_ID::EMB1 == sampling || CaloCell_ID::EME1 == sampling || CaloCell_ID::PreSamplerB == sampling || CaloCell_ID::PreSamplerE == sampling) { continue; } - //For the cells we have not skipped either because TileGap, bounds, or L1 + // For the cells we have not skipped either because TileGap, bounds, or L1 if (dde->getSubCalo() == CaloCell_ID::LAREM) { - //Avoid summing inner wheel Endcap cells - if(! (dde->is_lar_em_endcap_inner()) ){ + // Avoid summing inner wheel Endcap cells + if (!(dde->is_lar_em_endcap_inner())) { newCluster->addCell(cell_itr.index(), cell_itr.weight()); } } - }//Loop over cells - if (newCluster->size()==0){ + } // Loop over cells + if (newCluster->size() == 0) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; } - -StatusCode egammaSuperClusterBuilder::addL0L1EMCellsToCluster(xAOD::CaloCluster *newCluster, - const xAOD::CaloCluster *ref, - const egammaSuperClusterBuilder::CentralPosition& cp0, - const egammaSuperClusterBuilder::PhiSize& phiSize) const +StatusCode +egammaSuperClusterBuilder::addL0L1EMCellsToCluster( + xAOD::CaloCluster* newCluster, + const xAOD::CaloCluster* ref, + const egammaSuperClusterBuilder::CentralPosition& cp0, + const egammaSuperClusterBuilder::PhiSize& phiSize) const { if (!newCluster || !ref) { ATH_MSG_ERROR("Invalid input in addL0L1EMCellsToCluster"); @@ -401,34 +414,37 @@ StatusCode egammaSuperClusterBuilder::addL0L1EMCellsToCluster(xAOD::CaloCluster // xAOD::CaloCluster::const_cell_iterator cell_itr = ref->begin(); xAOD::CaloCluster::const_cell_iterator cell_end = ref->end(); - //Loop over cells - for (; cell_itr != cell_end; ++cell_itr) { - - //sanity check on the cell - const CaloCell* cell = *cell_itr; - if (!cell){ + // Loop over cells + for (; cell_itr != cell_end; ++cell_itr) { + + // sanity check on the cell + const CaloCell* cell = *cell_itr; + if (!cell) { continue; } bool addCell = false; - + // lets remove from consideration if outside the range if (cp0.emaxB > 0) { // has cells in the barrel if (fabs(cp0.etaB - cell->caloDDE()->eta_raw()) < m_addCellsWindowEtaBarrel && - fabs(P4Helpers::deltaPhi(cp0.phiB, cell->caloDDE()->phi_raw())) < m_addCellsWindowPhiBarrel) { + fabs(P4Helpers::deltaPhi(cp0.phiB, cell->caloDDE()->phi_raw())) < + m_addCellsWindowPhiBarrel) { addCell = true; } } if (cp0.emaxEC > 0) { // has cells in the endcap if (fabs(cp0.etaEC - cell->caloDDE()->eta_raw()) < m_addCellsWindowEtaEndcap && - fabs(P4Helpers::deltaPhi(cp0.phiEC, cell->caloDDE()->phi_raw())) < m_addCellsWindowPhiEndcap) { + fabs(P4Helpers::deltaPhi(cp0.phiEC, cell->caloDDE()->phi_raw())) < + m_addCellsWindowPhiEndcap) { addCell = true; } } - if (!addCell) continue; - const CaloDetDescrElement *dde = cell->caloDDE(); - if(!dde){ + if (!addCell) + continue; + const CaloDetDescrElement* dde = cell->caloDDE(); + if (!dde) { continue; } @@ -455,120 +471,130 @@ StatusCode egammaSuperClusterBuilder::addL0L1EMCellsToCluster(xAOD::CaloCluster return StatusCode::SUCCESS; } +StatusCode +egammaSuperClusterBuilder::calibrateCluster(const EventContext& ctx, + xAOD::CaloCluster* newCluster, + const CaloDetDescrManager& mgr, + const xAOD::EgammaParameters::EgammaType egType) const +{ -StatusCode egammaSuperClusterBuilder::calibrateCluster(xAOD::CaloCluster* newCluster, - const CaloDetDescrManager& mgr, - const xAOD::EgammaParameters::EgammaType egType) const{ - - ATH_CHECK(refineEta1Position(newCluster,mgr)); - //Save the state before the corrections + ATH_CHECK(refineEta1Position(newCluster, mgr)); + // Save the state before the corrections newCluster->setAltE(newCluster->e()); newCluster->setAltEta(newCluster->eta()); newCluster->setAltPhi(newCluster->phi()); // first do the corrections - ATH_CHECK(m_clusterCorrectionTool->execute(Gaudi::Hive::currentContext(),newCluster, - egType,xAOD::EgammaHelpers::isBarrel(newCluster))); + ATH_CHECK(m_clusterCorrectionTool->execute( + ctx, newCluster, egType, xAOD::EgammaHelpers::isBarrel(newCluster))); newCluster->setRawE(newCluster->e()); newCluster->setRawEta(newCluster->eta()); newCluster->setRawPhi(newCluster->phi()); // - ATH_CHECK(fillPositionsInCalo(newCluster,mgr)); - //At this point we do not have the final tracks vertices attached on the cluster/ new egamma Rec Object. - //So We will need at the end to do the final update in the EMClusterTool - //For now apply just cluster info only calibration. - ATH_CHECK(m_MVACalibSvc->execute(*newCluster,egType)); - + ATH_CHECK(fillPositionsInCalo(newCluster, mgr)); + // At this point we do not have the final tracks vertices attached on the cluster/ new egamma Rec + // Object. So We will need at the end to do the final update in the EMClusterTool For now apply + // just cluster info only calibration. + ATH_CHECK(m_MVACalibSvc->execute(*newCluster, egType)); + return StatusCode::SUCCESS; } // ========================================================================== -StatusCode egammaSuperClusterBuilder::fillPositionsInCalo(xAOD::CaloCluster* cluster, - const CaloDetDescrManager& mgr ) const { +StatusCode +egammaSuperClusterBuilder::fillPositionsInCalo(xAOD::CaloCluster* cluster, + const CaloDetDescrManager& mgr) const +{ const bool isBarrel = xAOD::EgammaHelpers::isBarrel(cluster); CaloCell_ID::CaloSample sample = isBarrel ? CaloCell_ID::EMB2 : CaloCell_ID::EME2; // eta and phi of the cluster in the calorimeter frame double eta; double phi; - m_caloCellDetPos.getDetPosition(mgr, sample, cluster->eta(), cluster->phi(), eta, phi); - cluster->insertMoment(xAOD::CaloCluster::ETACALOFRAME,eta); - cluster->insertMoment(xAOD::CaloCluster::PHICALOFRAME,phi); + m_caloCellDetPos.getDetPosition(mgr, sample, cluster->eta(), cluster->phi(), eta, phi); + cluster->insertMoment(xAOD::CaloCluster::ETACALOFRAME, eta); + cluster->insertMoment(xAOD::CaloCluster::PHICALOFRAME, phi); // eta in the second sampling - m_caloCellDetPos.getDetPosition(mgr,sample, cluster->etaBE(2), cluster->phiBE(2), eta, phi); - cluster->insertMoment(xAOD::CaloCluster::ETA2CALOFRAME,eta); - cluster->insertMoment(xAOD::CaloCluster::PHI2CALOFRAME,phi); - // eta in the first sampling + m_caloCellDetPos.getDetPosition(mgr, sample, cluster->etaBE(2), cluster->phiBE(2), eta, phi); + cluster->insertMoment(xAOD::CaloCluster::ETA2CALOFRAME, eta); + cluster->insertMoment(xAOD::CaloCluster::PHI2CALOFRAME, phi); + // eta in the first sampling sample = isBarrel ? CaloCell_ID::EMB1 : CaloCell_ID::EME1; - m_caloCellDetPos.getDetPosition(mgr,sample, cluster->etaBE(1), cluster->phiBE(1),eta, phi); - cluster->insertMoment(xAOD::CaloCluster::ETA1CALOFRAME,eta); - cluster->insertMoment(xAOD::CaloCluster::PHI1CALOFRAME,phi); + m_caloCellDetPos.getDetPosition(mgr, sample, cluster->etaBE(1), cluster->phiBE(1), eta, phi); + cluster->insertMoment(xAOD::CaloCluster::ETA1CALOFRAME, eta); + cluster->insertMoment(xAOD::CaloCluster::PHI1CALOFRAME, phi); return StatusCode::SUCCESS; } -StatusCode egammaSuperClusterBuilder::refineEta1Position(xAOD::CaloCluster* cluster, - const CaloDetDescrManager& mgr) const { - +StatusCode +egammaSuperClusterBuilder::refineEta1Position(xAOD::CaloCluster* cluster, + const CaloDetDescrManager& mgr) const +{ + // This only makes sense if we have cells there - if (!cluster->hasSampling(CaloSampling::EMB1) && !cluster->hasSampling(CaloSampling::EME1)) { + if (!cluster->hasSampling(CaloSampling::EMB1) && !cluster->hasSampling(CaloSampling::EME1)) { ATH_MSG_DEBUG("No layer sampling - skipping refine eta "); return StatusCode::SUCCESS; } - //Now calculare the position using cells in barrel or endcap or both - const double aeta=fabs(cluster->etaBE(2)); - if(aeta<1.6 && cluster->hasSampling(CaloSampling::EMB1)){ - ATH_CHECK(makeCorrection1(cluster,mgr,CaloSampling::EMB1)); + // Now calculare the position using cells in barrel or endcap or both + const double aeta = fabs(cluster->etaBE(2)); + if (aeta < 1.6 && cluster->hasSampling(CaloSampling::EMB1)) { + ATH_CHECK(makeCorrection1(cluster, mgr, CaloSampling::EMB1)); } - if(aeta>1.3 && cluster->hasSampling(CaloSampling::EME1)){ - ATH_CHECK(makeCorrection1(cluster,mgr,CaloSampling::EME1)); + if (aeta > 1.3 && cluster->hasSampling(CaloSampling::EME1)) { + ATH_CHECK(makeCorrection1(cluster, mgr, CaloSampling::EME1)); } return StatusCode::SUCCESS; - } -StatusCode egammaSuperClusterBuilder::makeCorrection1(xAOD::CaloCluster* cluster, - const CaloDetDescrManager& mgr, - const CaloSampling::CaloSample sample) const { +StatusCode +egammaSuperClusterBuilder::makeCorrection1(xAOD::CaloCluster* cluster, + const CaloDetDescrManager& mgr, + const CaloSampling::CaloSample sample) const +{ - //Protections. - ATH_MSG_DEBUG("Hottest cell in layer 1 ATLAS co-ordinates (eta,phi): (" << cluster->etamax(sample) - << " , " << cluster->phimax(sample) << ")"); - if (cluster->etamax(sample)==-999. || cluster->phimax(sample)==-999.) { + // Protections. + ATH_MSG_DEBUG("Hottest cell in layer 1 ATLAS co-ordinates (eta,phi): (" + << cluster->etamax(sample) << " , " << cluster->phimax(sample) << ")"); + if (cluster->etamax(sample) == -999. || cluster->phimax(sample) == -999.) { return StatusCode::SUCCESS; } - if (fabs(cluster->etamax(sample))<1E-6 && fabs(cluster->phimax(sample))<1E-6) { + if (fabs(cluster->etamax(sample)) < 1E-6 && fabs(cluster->phimax(sample)) < 1E-6) { return StatusCode::SUCCESS; } - //Get the hotest in raw co-ordinates + // Get the hotest in raw co-ordinates // - //We have two kinds of enums ... - CaloCell_ID::CaloSample xsample = (sample == CaloSampling::EMB1) ? CaloCell_ID::EMB1 :CaloCell_ID::EME1; + // We have two kinds of enums ... + CaloCell_ID::CaloSample xsample = + (sample == CaloSampling::EMB1) ? CaloCell_ID::EMB1 : CaloCell_ID::EME1; // - const CaloDetDescrElement* dde = mgr.get_element (xsample, cluster->etamax(sample), cluster->phimax(sample)); + const CaloDetDescrElement* dde = + mgr.get_element(xsample, cluster->etamax(sample), cluster->phimax(sample)); if (!dde) { - ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for: cluster->etamax(sample): " - << cluster->etamax(sample) <<" cluster->phimax(sample): " << cluster->phimax(sample) << - " will not refine the position in layer1"); + ATH_MSG_WARNING("Couldn't get CaloDetDescrElement from mgr for: cluster->etamax(sample): " + << cluster->etamax(sample) << " cluster->phimax(sample): " + << cluster->phimax(sample) << " will not refine the position in layer1"); return StatusCode::SUCCESS; } // double etamax = dde->eta_raw(); - double phimax = dde->phi_raw(); - ATH_MSG_DEBUG("Hottest cell in layer 1 Calo co-ordinates (eta,phi): (" << etamax << " , " << phimax << ")"); - // - //now Locate the +-1 range + double phimax = dde->phi_raw(); + ATH_MSG_DEBUG("Hottest cell in layer 1 Calo co-ordinates (eta,phi): (" << etamax << " , " + << phimax << ")"); + // + // now Locate the +-1 range double detastr(-999); double dphistr(-999); - //Raw co-ordinates used here - etaphi_range(mgr,etamax, phimax,xsample,detastr, dphistr); + // Raw co-ordinates used here + etaphi_range(mgr, etamax, phimax, xsample, detastr, dphistr); // - //Given the range refine the position employing the smaller window + // Given the range refine the position employing the smaller window if (detastr > 0 && dphistr > 0) { CaloLayerCalculator helper; const auto cellLink = cluster->getCellLinks(); helper.fill(cellLink->begin(), cellLink->end(), etamax, phimax, detastr, dphistr, sample); - //Here is where we (re-)fill the eta in the 1st sampling - if(helper.etam()!=-999.) { - //This is "real" atlas co-ordinates + // Here is where we (re-)fill the eta in the 1st sampling + if (helper.etam() != -999.) { + // This is "real" atlas co-ordinates cluster->setEta(sample, helper.etam()); ATH_MSG_DEBUG("Refined Eta layer 1: " << cluster->etaSample(sample)); } @@ -576,49 +602,53 @@ StatusCode egammaSuperClusterBuilder::makeCorrection1(xAOD::CaloCluster* cluster return StatusCode::SUCCESS; } -StatusCode egammaSuperClusterBuilder::addTileGap3CellsinWindow(xAOD::CaloCluster *myCluster, - const CaloDetDescrManager& mgr) const{ - +StatusCode +egammaSuperClusterBuilder::addTileGap3CellsinWindow(xAOD::CaloCluster* myCluster, + const CaloDetDescrManager& mgr) const +{ + if (!myCluster) { ATH_MSG_ERROR("Invalid input in addRemainingCellsToCluster"); return StatusCode::FAILURE; } - static const double searchWindowEta = 0.2; - static const double searchWindowPhi = 2*M_PI/64.0 + M_PI/64 ; // ~ 0.15 rad + static const double searchWindowPhi = 2 * M_PI / 64.0 + M_PI / 64; // ~ 0.15 rad std::vector<const CaloCell*> cells; cells.reserve(16); - const CaloCellContainer* inputcells=myCluster->getCellLinks()->getCellContainer(); + const CaloCellContainer* inputcells = myCluster->getCellLinks()->getCellContainer(); if (!inputcells) { ATH_MSG_ERROR("No cell container in addRemainingCellsToCluster?"); - return StatusCode::FAILURE; + return StatusCode::FAILURE; } CaloCellList myList(inputcells); - const std::vector<CaloSampling::CaloSample> samples = {CaloSampling::TileGap3}; - for ( auto samp : samples ) { - myList.select(mgr,myCluster->eta0(), myCluster->phi0(), searchWindowEta, searchWindowPhi,samp); + const std::vector<CaloSampling::CaloSample> samples = { CaloSampling::TileGap3 }; + for (auto samp : samples) { + myList.select( + mgr, myCluster->eta0(), myCluster->phi0(), searchWindowEta, searchWindowPhi, samp); cells.insert(cells.end(), myList.begin(), myList.end()); } - for ( auto cell : cells ) { - if( !cell || !cell->caloDDE() ) { + for (auto cell : cells) { + if (!cell || !cell->caloDDE()) { continue; } - if ( (CaloCell_ID::TileGap3 == cell->caloDDE()->getSampling()) && - (std::abs(cell->caloDDE()->eta_raw()) > 1.4 && std::abs(cell->caloDDE()->eta_raw()) < 1.6)) { + if ((CaloCell_ID::TileGap3 == cell->caloDDE()->getSampling()) && + (std::abs(cell->caloDDE()->eta_raw()) > 1.4 && + std::abs(cell->caloDDE()->eta_raw()) < 1.6)) { int index = inputcells->findIndex(cell->caloDDE()->calo_hash()); myCluster->addCell(index, 1.); - } - } + } + } return StatusCode::SUCCESS; } egammaSuperClusterBuilder::CentralPosition -egammaSuperClusterBuilder::findCentralPosition(const std::vector<const xAOD::CaloCluster*>& clusters) const +egammaSuperClusterBuilder::findCentralPosition( + const std::vector<const xAOD::CaloCluster*>& clusters) const { CentralPosition cp; @@ -649,18 +679,18 @@ egammaSuperClusterBuilder::findPhiSize(const egammaSuperClusterBuilder::CentralP { PhiSize phiSize; - + auto cell_itr = cluster->cell_cbegin(); - auto cell_end = cluster->cell_cend(); - - for (; cell_itr != cell_end; ++cell_itr) { - const CaloCell* cell = *cell_itr; - if (!cell){ + auto cell_end = cluster->cell_cend(); + + for (; cell_itr != cell_end; ++cell_itr) { + const CaloCell* cell = *cell_itr; + if (!cell) { continue; - } - - const CaloDetDescrElement *dde = cell->caloDDE(); - if(!dde){ + } + + const CaloDetDescrElement* dde = cell->caloDDE(); + if (!dde) { continue; } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h index 5d4b6aec326418592c2361323241820ad79c7ffa..87de0d6277ca7391252240d7673698524e3f0542 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSuperClusterBuilder.h @@ -2,25 +2,25 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef EGAMMAALGS_EGAMMASUPERCLUSTERBUILDER_H #define EGAMMAALGS_EGAMMASUPERCLUSTERBUILDER_H // INCLUDE HEADER FILES: -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/SystemOfUnits.h" #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/SystemOfUnits.h" +#include "GaudiKernel/ToolHandle.h" -//Fwd declarations -#include "xAODCaloEvent/CaloClusterFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" -#include "egammaRecEvent/egammaRecContainer.h" +// Fwd declarations #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloUtils/CaloCellDetPos.h" -#include "xAODEgamma/EgammaEnums.h" -#include "egammaInterfaces/IegammaSwTool.h" -#include "egammaInterfaces/IegammaMVASvc.h" #include "egammaInterfaces/IegammaCheckEnergyDepositTool.h" +#include "egammaInterfaces/IegammaMVASvc.h" +#include "egammaInterfaces/IegammaSwTool.h" +#include "egammaRecEvent/egammaRecContainer.h" +#include "xAODCaloEvent/CaloClusterFwd.h" +#include "xAODEgamma/EgammaEnums.h" +#include "xAODTracking/TrackParticleContainerFwd.h" #include <memory> @@ -29,95 +29,110 @@ class CaloDetDescrManager; * The inheritance should be private. This class should never be instantiated * by itself, and hence has no interface class **/ -class egammaSuperClusterBuilder : public AthAlgorithm { +class egammaSuperClusterBuilder : public AthAlgorithm +{ protected: - /** Protected constructor since this class should not be instantiated by itself */ + /** Protected constructor since this class should not be instantiated by + * itself */ egammaSuperClusterBuilder(const std::string& name, ISvcLocator* pSvcLocator); /** should be called by the derived class in the initialize phase */ virtual StatusCode initialize() override; /** Is clus in window center around ref? */ - bool matchesInWindow(const xAOD::CaloCluster *ref, - const xAOD::CaloCluster *clus) const; + bool matchesInWindow(const xAOD::CaloCluster* ref, + const xAOD::CaloCluster* clus) const; /** Creates a new supercluster out of the input cluster */ // not const because it calls CalibrateCluster - std::unique_ptr<xAOD::CaloCluster> - createNewCluster(const std::vector<const xAOD::CaloCluster*>& clusters, - const CaloDetDescrManager& mgr, - xAOD::EgammaParameters::EgammaType egType) const; + std::unique_ptr<xAOD::CaloCluster> createNewCluster( + const EventContext& ctx, + const std::vector<const xAOD::CaloCluster*>& clusters, + const CaloDetDescrManager& mgr, + xAOD::EgammaParameters::EgammaType egType) const; // some constants to use static constexpr float s_cellEtaSize = 0.025; - static constexpr float s_cellPhiSize = M_PI/128.; + static constexpr float s_cellPhiSize = M_PI / 128.; /** @brief Seed selection requirements */ - Gaudi::Property<float> m_EtThresholdCut {this, - "EtThresholdCut", 1.5*Gaudi::Units::GeV, - "The minimum EM Et required of SEED clusters (not applied to secondaries)"}; - + Gaudi::Property<float> m_EtThresholdCut{ + this, + "EtThresholdCut", + 1.5 * Gaudi::Units::GeV, + "The minimum EM Et required of SEED clusters (not applied to secondaries)" + }; // these are calculated search window values - float m_searchWindowEtaBarrel; //!< half of search window size, converted to units of eta - float m_searchWindowPhiBarrel; //!< half of search window size, converted to units of phi - float m_searchWindowEtaEndcap; //!< half of search window size, converted to units of eta - float m_searchWindowPhiEndcap; //!< half of search window size, converted to units of phi + float m_searchWindowEtaBarrel; //!< half of search window size, converted to + //!< units of eta + float m_searchWindowPhiBarrel; //!< half of search window size, converted to + //!< units of phi + float m_searchWindowEtaEndcap; //!< half of search window size, converted to + //!< units of eta + float m_searchWindowPhiEndcap; //!< half of search window size, converted to + //!< units of phi // private: - - struct CentralPosition { + struct CentralPosition + { float etaB = 999; float phiB = 999; - float emaxB = -999*Gaudi::Units::GeV; + float emaxB = -999 * Gaudi::Units::GeV; float etaEC = 999; float phiEC = 999; - float emaxEC = -999*Gaudi::Units::GeV; + float emaxEC = -999 * Gaudi::Units::GeV; }; - - /** Find the reference position (eta, phi) relative to which cells are restricted. - The return value is whether it succeeded in finding a positive energy max value. - (If rv = false, the output variables are passed as arguments are not updated.) + + /** Find the reference position (eta, phi) relative to which cells are + restricted. The return value is whether it succeeded in finding a positive + energy max value. (If rv = false, the output variables are passed as + arguments are not updated.) */ - CentralPosition findCentralPosition(const std::vector<const xAOD::CaloCluster*>& clusters) const; + CentralPosition findCentralPosition( + const std::vector<const xAOD::CaloCluster*>& clusters) const; - struct PhiSize { + struct PhiSize + { float plusB = 0; float minusB = 0; float plusEC = 0; float minusEC = 0; }; - - /** Find the size of the cluster */ + + /** Find the size of the cluster */ PhiSize findPhiSize(const CentralPosition& cp0, const xAOD::CaloCluster* cluster) const; - - /** Add the EM cells from reference cluster to self; eta and phi are the ones to use for limiting size. - This excludes L1 (which is done as a separate step). note, use raw eta and phi! */ + /** Add the EM cells from reference cluster to self; eta and phi are the ones + to use for limiting size. This excludes L1 (which is done as a separate + step). note, use raw eta and phi! */ StatusCode addEMCellsToCluster(xAOD::CaloCluster* newCluster, const xAOD::CaloCluster* ref, const CentralPosition& cp0) const; - /** Add the preshower and L1 EM cells from reference cluster to self; note, use raw eta and phi! */ + /** Add the preshower and L1 EM cells from reference cluster to self; note, + * use raw eta and phi! */ StatusCode addL0L1EMCellsToCluster(xAOD::CaloCluster* newCluster, - const xAOD::CaloCluster* ref, - const CentralPosition& cp0, - const PhiSize& phiSize) const; - + const xAOD::CaloCluster* ref, + const CentralPosition& cp0, + const PhiSize& phiSize) const; + /** functions to add all tile Gap 3 cells in a window*/ - StatusCode addTileGap3CellsinWindow(xAOD::CaloCluster *myCluster, + StatusCode addTileGap3CellsinWindow(xAOD::CaloCluster* myCluster, const CaloDetDescrManager& mgr) const; /** function to calibrate the new clusters energy */ - StatusCode calibrateCluster(xAOD::CaloCluster* newCluster, - const CaloDetDescrManager& mgr, - const xAOD::EgammaParameters::EgammaType egType) const ; + StatusCode calibrateCluster( + const EventContext& ctx, + xAOD::CaloCluster* newCluster, + const CaloDetDescrManager& mgr, + const xAOD::EgammaParameters::EgammaType egType) const; /** function to decorate the calo cluster with position variables */ StatusCode fillPositionsInCalo(xAOD::CaloCluster* cluster, - const CaloDetDescrManager& mgr) const ; + const CaloDetDescrManager& mgr) const; // above can't be const because m_caloCellDetPos acceses are not const /** functions to refine position in eta1*/ @@ -127,75 +142,121 @@ private: const CaloDetDescrManager& mgr, const CaloSampling::CaloSample sample) const; - // these are calculated window values for the windows in which cells of topoclusters are edded - float m_addCellsWindowEtaBarrel; //!< half of addCells window size, converted to units of eta - float m_addCellsWindowPhiBarrel; //!< half of addCells window size, converted to units of phi - float m_addCellsWindowEtaEndcap; //!< half of addCells window size, converted to units of eta - float m_addCellsWindowPhiEndcap; //!< half of addCells window size, converted to units of phi - float m_extraL0L1PhiSize; //!< calculated value of cells to add in units of phi + // these are calculated window values for the windows in which cells of + // topoclusters are edded + float m_addCellsWindowEtaBarrel; //!< half of addCells window size, converted + //!< to units of eta + float m_addCellsWindowPhiBarrel; //!< half of addCells window size, converted + //!< to units of phi + float m_addCellsWindowEtaEndcap; //!< half of addCells window size, converted + //!< to units of eta + float m_addCellsWindowPhiEndcap; //!< half of addCells window size, converted + //!< to units of phi + float + m_extraL0L1PhiSize; //!< calculated value of cells to add in units of phi /** @brief Size of topocluster search window in eta for the barrel */ - Gaudi::Property<int> m_searchWindowEtaCellsBarrel {this, - "SearchWindowEtaCellsBarrel", 5, - "Number of cells in eta of window in which to search for topoclusters"}; + Gaudi::Property<int> m_searchWindowEtaCellsBarrel{ + this, + "SearchWindowEtaCellsBarrel", + 5, + "Number of cells in eta of window in which to search for topoclusters" + }; /** @brief Size of topocluster search window in phi for the barrel */ - Gaudi::Property<int> m_searchWindowPhiCellsBarrel {this, - "SearchWindowPhiCellsBarrel", 5, - "Number of cells in phi of window in which to search for topoclusters"}; + Gaudi::Property<int> m_searchWindowPhiCellsBarrel{ + this, + "SearchWindowPhiCellsBarrel", + 5, + "Number of cells in phi of window in which to search for topoclusters" + }; /** @brief Size of topocluster search window in eta for the end-cap*/ - Gaudi::Property<int> m_searchWindowEtaCellsEndcap {this, - "SearchWindowEtaCellsEndcap", 5, - "Number of cells in eta of window in which to search for topoclusters"}; + Gaudi::Property<int> m_searchWindowEtaCellsEndcap{ + this, + "SearchWindowEtaCellsEndcap", + 5, + "Number of cells in eta of window in which to search for topoclusters" + }; /** @brief Size of topocluster search window in phi for the end-cap*/ - Gaudi::Property<int> m_searchWindowPhiCellsEndcap {this, - "SearchWindowPhiCellsEndcap", 5, - "Number of cells in phi of window in which to search for topoclusters"}; - - /** @brief Size of windows et eta in which cells of topoclusters are edded for the barrel */ - Gaudi::Property<int> m_addCellsWindowEtaCellsBarrel {this, - "AddCellsWindowEtaCellsBarrel", 3, - "Number of cells in eta of window around topocluster center to add cells"}; - - /** @brief Size of windows et phi in which cells of topoclusters are edded for the barrel */ - Gaudi::Property<int> m_addCellsWindowPhiCellsBarrel {this, - "AddCellsWindowPhiCellsBarrel", 999 , - "Number of cells in phi of window around topocluster center to add cells"}; - - /** @brief Size of windows et eta in which cells of topoclusters are edded for the endcap */ - Gaudi::Property<int> m_addCellsWindowEtaCellsEndcap {this, - "AddCellsWindowEtaCellsEndcap", 5, - "Number of cells in eta of window around topocluster center to add cells"}; - - /** @brief Size of windows et phi in which cells of topoclusters are edded for the endcap */ - Gaudi::Property<int> m_addCellsWindowPhiCellsEndcap {this, - "AddCellsWindowPhiCellsEndcap", 999, - "Number of cells in phi of window around topocluster center to add cells"}; - - /** @brief "When adding L0 (PS) and L1 cells, how much wider than L2 is the acceptance */ - Gaudi::Property<int> m_extraL0L1PhiSizeCells {this, - "ExtraL0L1PhiSize", 1, - "When adding L0 (PS) and L1 cells, how much wider than L2 (in L2 cells units) is the acceptance"}; - + Gaudi::Property<int> m_searchWindowPhiCellsEndcap{ + this, + "SearchWindowPhiCellsEndcap", + 5, + "Number of cells in phi of window in which to search for topoclusters" + }; + + /** @brief Size of windows et eta in which cells of topoclusters are edded for + * the barrel */ + Gaudi::Property<int> m_addCellsWindowEtaCellsBarrel{ + this, + "AddCellsWindowEtaCellsBarrel", + 3, + "Number of cells in eta of window around topocluster center to add cells" + }; + + /** @brief Size of windows et phi in which cells of topoclusters are edded for + * the barrel */ + Gaudi::Property<int> m_addCellsWindowPhiCellsBarrel{ + this, + "AddCellsWindowPhiCellsBarrel", + 999, + "Number of cells in phi of window around topocluster center to add cells" + }; + + /** @brief Size of windows et eta in which cells of topoclusters are edded for + * the endcap */ + Gaudi::Property<int> m_addCellsWindowEtaCellsEndcap{ + this, + "AddCellsWindowEtaCellsEndcap", + 5, + "Number of cells in eta of window around topocluster center to add cells" + }; + + /** @brief Size of windows et phi in which cells of topoclusters are edded for + * the endcap */ + Gaudi::Property<int> m_addCellsWindowPhiCellsEndcap{ + this, + "AddCellsWindowPhiCellsEndcap", + 999, + "Number of cells in phi of window around topocluster center to add cells" + }; + + /** @brief "When adding L0 (PS) and L1 cells, how much wider than L2 is the + * acceptance */ + Gaudi::Property<int> m_extraL0L1PhiSizeCells{ + this, + "ExtraL0L1PhiSize", + 1, + "When adding L0 (PS) and L1 cells, how much wider than L2 (in L2 cells " + "units) is the acceptance" + }; + /** @brief Handle to the MVA calibration service **/ - ServiceHandle<IegammaMVASvc> m_MVACalibSvc {this, - "MVACalibSvc", "egammaMVASvc", "calibration service"}; - + ServiceHandle<IegammaMVASvc> m_MVACalibSvc{ this, + "MVACalibSvc", + "egammaMVASvc", + "calibration service" }; + /** @brief Tool to handle cluster corrections */ - ToolHandle<IegammaSwTool> m_clusterCorrectionTool {this, - "ClusterCorrectionTool", "egammaSwTool/egammaswtool", - "tool that applies cluster corrections"}; + ToolHandle<IegammaSwTool> m_clusterCorrectionTool{ + this, + "ClusterCorrectionTool", + "egammaSwTool/egammaswtool", + "tool that applies cluster corrections" + }; /** @brief Pointer to the egammaCheckEnergyDepositTool*/ - ToolHandle<IegammaCheckEnergyDepositTool> m_egammaCheckEnergyDepositTool {this, - "egammaCheckEnergyDepositTool", "", - "Optional tool that performs basic checks of viability of cluster"}; + ToolHandle<IegammaCheckEnergyDepositTool> m_egammaCheckEnergyDepositTool{ + this, + "egammaCheckEnergyDepositTool", + "", + "Optional tool that performs basic checks of viability of cluster" + }; - /** @brief Position in Calo frame**/ + /** @brief Position in Calo frame**/ CaloCellDetPos m_caloCellDetPos; - }; #endif diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.cxx index 20152b9599de958f6cf3e25c9b97cd5a1c583b3a..deb24cfa42a12d0176cdb8c4fa97cf3f1ccfbd32 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.cxx @@ -2,11 +2,10 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "egammaTruthAssociationAlg.h" #include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" #include "StoreGate/WriteDecorHandle.h" +#include "StoreGate/WriteHandle.h" #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/PhotonContainer.h" @@ -14,22 +13,20 @@ #include <memory> typedef ElementLink<xAOD::TruthParticleContainer> TruthLink_t; -typedef ElementLink<xAOD::CaloClusterContainer> ClusterLink_t; -typedef ElementLink<xAOD::ElectronContainer> ElectronLink_t; -typedef ElementLink<xAOD::PhotonContainer> PhotonLink_t; - - -// ============================================================= -egammaTruthAssociationAlg::egammaTruthAssociationAlg(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) -{ -} +typedef ElementLink<xAOD::CaloClusterContainer> ClusterLink_t; +typedef ElementLink<xAOD::ElectronContainer> ElectronLink_t; +typedef ElementLink<xAOD::PhotonContainer> PhotonLink_t; + +egammaTruthAssociationAlg::egammaTruthAssociationAlg(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) +{} egammaTruthAssociationAlg::~egammaTruthAssociationAlg() {} -// ============================================================= -StatusCode egammaTruthAssociationAlg::initialize() { +StatusCode +egammaTruthAssociationAlg::initialize() +{ ATH_MSG_DEBUG("Initializing " << name() << "..."); @@ -57,57 +54,61 @@ StatusCode egammaTruthAssociationAlg::initialize() { m_clusterDecKeys.clear(); } - if (m_matchForwardElectrons){ + if (m_matchForwardElectrons) { ATH_CHECK(initializeDecorKeys(m_fwdElectronDecKeys, m_fwdElectronDecName)); } else { m_fwdElectronDecKeys.clear(); } - CHECK( m_mcTruthClassifier.retrieve() ); + CHECK(m_mcTruthClassifier.retrieve()); ATH_MSG_DEBUG("Retrieved tool " << m_mcTruthClassifier); ATH_MSG_DEBUG("Initialization successful"); return StatusCode::SUCCESS; } -// ========================================================================= -StatusCode egammaTruthAssociationAlg::finalize() { +StatusCode +egammaTruthAssociationAlg::finalize() +{ return StatusCode::SUCCESS; } -// ========================================================================= -StatusCode egammaTruthAssociationAlg::execute() { +StatusCode +egammaTruthAssociationAlg::execute_r(const EventContext& ctx) const +{ SG::WriteHandle<xAOD::TruthParticleContainer> egammaTruthContainer; - if (m_doEgammaTruthContainer){ + if (m_doEgammaTruthContainer) { - egammaTruthContainer = SG::WriteHandle<xAOD::TruthParticleContainer>(m_egammaTruthParticleContainerKey); + egammaTruthContainer = + SG::WriteHandle<xAOD::TruthParticleContainer>(m_egammaTruthParticleContainerKey, ctx); ATH_CHECK(egammaTruthContainer.record(std::make_unique<xAOD::TruthParticleContainer>(), - std::make_unique<xAOD::TruthParticleAuxContainer>())); - + std::make_unique<xAOD::TruthParticleAuxContainer>())); // Add a copy of electrons and photons to the truth egamma container - SG::ReadHandle<xAOD::TruthEventContainer> truthEvtContainer(m_truthEventContainerKey); + SG::ReadHandle<xAOD::TruthEventContainer> truthEvtContainer(m_truthEventContainerKey, ctx); - //only for serial running. Can remove check later - if (!truthEvtContainer.isValid() || truthEvtContainer->empty() ){ - ATH_MSG_WARNING("Could not retrieve " << m_truthEventContainerKey.key() << - " or container empty, returning"); + // only for serial running. Can remove check later + if (!truthEvtContainer.isValid() || truthEvtContainer->empty()) { + ATH_MSG_WARNING("Could not retrieve " << m_truthEventContainerKey.key() + << " or container empty, returning"); return StatusCode::SUCCESS; } - for (const auto& truthParticleLink : truthEvtContainer->front()->truthParticleLinks() ){ - if (!truthParticleLink.isValid()) continue; + for (const auto& truthParticleLink : truthEvtContainer->front()->truthParticleLinks()) { + if (!truthParticleLink.isValid()) + continue; const xAOD::TruthParticle* truthParticle = *truthParticleLink; - if (!isPromptEgammaParticle(truthParticle)) continue; + if (!isPromptEgammaParticle(truthParticle)) + continue; getNewTruthParticle(*egammaTruthContainer, truthParticle, truthParticleLink.getDataPtr()); - } + } } // Decorate containers with truth info, including links to truth particles // Decorate the truth particles with links to the reco ones // note that in multithreading this must be valid; can't just fail with success. - SG::ReadHandle<xAOD::TruthParticleContainer> truthParticles(m_truthParticleContainerKey); + SG::ReadHandle<xAOD::TruthParticleContainer> truthParticles(m_truthParticleContainerKey, ctx); // accessors static const SG::AuxElement::Accessor<ClusterLink_t> accClusLink("recoClusterLink"); @@ -116,56 +117,63 @@ StatusCode egammaTruthAssociationAlg::execute() { if (m_matchElectrons) { ATH_MSG_DEBUG("About to match electrons"); - ATH_CHECK( match(*truthParticles, m_electronDecKeys, accElLink, egammaTruthContainer.ptr()) ); + ATH_CHECK(match(*truthParticles, m_electronDecKeys, accElLink, egammaTruthContainer.ptr())); } if (m_matchPhotons) { ATH_MSG_DEBUG("About to match photons"); - ATH_CHECK( match(*truthParticles, m_photonDecKeys, accPhLink, egammaTruthContainer.ptr()) ); + ATH_CHECK(match(*truthParticles, m_photonDecKeys, accPhLink, egammaTruthContainer.ptr())); } if (m_matchClusters) { ATH_MSG_DEBUG("About to match clusters"); - ATH_CHECK( match(*truthParticles, m_clusterDecKeys, accClusLink, egammaTruthContainer.ptr()) ); + ATH_CHECK(match(*truthParticles, m_clusterDecKeys, accClusLink, egammaTruthContainer.ptr())); } - if (m_matchForwardElectrons){ + if (m_matchForwardElectrons) { ATH_MSG_DEBUG("About to match fwd electrons"); - ATH_CHECK( match(*truthParticles, m_fwdElectronDecKeys, accElLink, egammaTruthContainer.ptr()) ); + ATH_CHECK(match(*truthParticles, m_fwdElectronDecKeys, accElLink, egammaTruthContainer.ptr())); } return StatusCode::SUCCESS; } -// ========================================================================== -bool egammaTruthAssociationAlg::isPromptEgammaParticle(const xAOD::TruthParticle *truth) { +bool +egammaTruthAssociationAlg::isPromptEgammaParticle(const xAOD::TruthParticle* truth) const +{ + + if ((truth->pdgId() != 22 && abs(truth->pdgId()) != 11) || truth->status() == 2 || + truth->status() == 3 || truth->barcode() > m_barcodeOffset || truth->pt() < m_minPt){ + return false; + } - if ((truth->pdgId() != 22 && abs(truth->pdgId()) != 11) || - truth->status() == 2 || truth->status() == 3 || - truth->barcode() > m_barcodeOffset || - truth->pt() < m_minPt) return false; - auto type = m_mcTruthClassifier->particleTruthClassifier(truth); // Isolated electron or photon - if(type.first==MCTruthPartClassifier::IsoElectron || - type.first==MCTruthPartClassifier::IsoPhoton) return true; - + if (type.first == MCTruthPartClassifier::IsoElectron || + type.first == MCTruthPartClassifier::IsoPhoton) { + return true; + } + // FSR photon - if (type.first == MCTruthPartClassifier::NonIsoPhoton && + if (type.first == MCTruthPartClassifier::NonIsoPhoton && type.second == MCTruthPartClassifier::FSRPhot && - truth->pt() > m_minPtFSR) return true; - + truth->pt() > m_minPtFSR) { + return true; + } + return false; } - -// ========================================================================== -void egammaTruthAssociationAlg::getNewTruthParticle(xAOD::TruthParticleContainer& egammaTruthContainer, - const xAOD::TruthParticle *truth, - const xAOD::TruthParticleContainer *oldContainer) { + +void +egammaTruthAssociationAlg::getNewTruthParticle( + xAOD::TruthParticleContainer& egammaTruthContainer, + const xAOD::TruthParticle* truth, + const xAOD::TruthParticleContainer* oldContainer) const +{ ATH_MSG_DEBUG("In getNewTruthParticle"); xAOD::TruthParticle* truthParticle = new xAOD::TruthParticle(); - egammaTruthContainer.push_back( truthParticle ); + egammaTruthContainer.push_back(truthParticle); truthParticle->setPdgId(truth->pdgId()); truthParticle->setBarcode(truth->barcode()); truthParticle->setStatus(truth->status()); @@ -174,9 +182,9 @@ void egammaTruthAssociationAlg::getNewTruthParticle(xAOD::TruthParticleContainer truthParticle->setPz(truth->pz()); truthParticle->setE(truth->e()); truthParticle->setM(truth->m()); - truthParticle->setProdVtxLink( truth->prodVtxLink() ); - truthParticle->setDecayVtxLink( truth->decayVtxLink() ); - + truthParticle->setProdVtxLink(truth->prodVtxLink()); + truthParticle->setDecayVtxLink(truth->decayVtxLink()); + static const SG::AuxElement::Accessor<ClusterLink_t> accClusLink("recoClusterLink"); static const SG::AuxElement::Accessor<ElectronLink_t> accElLink("recoElectronLink"); static const SG::AuxElement::Accessor<PhotonLink_t> accPhLink("recoPhotonLink"); @@ -188,38 +196,40 @@ void egammaTruthAssociationAlg::getNewTruthParticle(xAOD::TruthParticleContainer accClusLink(*truthParticle) = ClusterLink_t(); } accElLink(*truthParticle) = ElectronLink_t(); - accPhLink(*truthParticle) = PhotonLink_t(); + accPhLink(*truthParticle) = PhotonLink_t(); accTruthLink(*truthParticle) = TruthLink_t(truth, *oldContainer); accTruthLink(*truthParticle).toPersistent(); - ATH_MSG_DEBUG("Decorating truth particle with link to old truth, index = " - << accTruthLink(*truthParticle).index() ); + ATH_MSG_DEBUG("Decorating truth particle with link to old truth, index = " + << accTruthLink(*truthParticle).index()); // MCTruthClassifier info auto info = m_mcTruthClassifier->particleTruthClassifier(truth); - accType(*truthParticle) = static_cast<int>( info.first ); - accOrigin(*truthParticle) = static_cast<int>( info.second ); + accType(*truthParticle) = static_cast<int>(info.first); + accOrigin(*truthParticle) = static_cast<int>(info.second); ATH_MSG_DEBUG("Exiting getNewTruthParticle"); } -// ========================================================================== -xAOD::TruthParticle* -egammaTruthAssociationAlg::getEgammaTruthParticle(const xAOD::TruthParticle *truth, - xAOD::TruthParticleContainer& egammaTruthContainer) const{ - if (!truth) return nullptr; - +xAOD::TruthParticle* +egammaTruthAssociationAlg::getEgammaTruthParticle( + const xAOD::TruthParticle* truth, + xAOD::TruthParticleContainer& egammaTruthContainer) const +{ + if (!truth){ + return nullptr; + } // Find the original truth particle for electrons from conversions - for (unsigned int i = 0; i < 100 && truth && truth->barcode() > 200e3; ++i){ - if (truth->prodVtx() && truth->prodVtx()->nIncomingParticles()){ + for (unsigned int i = 0; i < 100 && truth && truth->barcode() > 200e3; ++i) { + if (truth->prodVtx() && truth->prodVtx()->nIncomingParticles()) { truth = truth->prodVtx()->incomingParticle(0); - } - else{ + } else { break; } } - //In case truth became null in the above loop - if (!truth) return nullptr; - - for (auto egammaTruth : egammaTruthContainer) { + // In case truth became null in the above loop + if (!truth){ + return nullptr; + } + for (auto egammaTruth : egammaTruthContainer) { if (truth->barcode() == egammaTruth->barcode()) { return egammaTruth; } @@ -228,18 +238,16 @@ egammaTruthAssociationAlg::getEgammaTruthParticle(const xAOD::TruthParticle *tru } //// The templated functions - -// ========================================================================== -template<class T> -StatusCode -egammaTruthAssociationAlg::initializeDecorKeys(SG::WriteDecorHandleKeyArray<T>& keys, - const std::string& name) +template<class T> +StatusCode +egammaTruthAssociationAlg::initializeDecorKeys(SG::WriteDecorHandleKeyArray<T>& keys, + const std::string& name) { if (!keys.empty()) { ATH_MSG_FATAL("The WriteDecorHandle should not be configured directly."); return StatusCode::FAILURE; } - + keys.emplace_back(name + ".truthParticleLink"); keys.emplace_back(name + ".truthType"); keys.emplace_back(name + ".truthOrigin"); @@ -247,20 +255,20 @@ egammaTruthAssociationAlg::initializeDecorKeys(SG::WriteDecorHandleKeyArray<T>& return StatusCode::SUCCESS; } -// ========================================================================== // constructor -template<class T> -egammaTruthAssociationAlg::writeDecorHandles<T>::writeDecorHandles(const SG::WriteDecorHandleKeyArray<T>& hkeys) : - el(hkeys.at(0)), - type(hkeys.at(1)), - origin(hkeys.at(2)) +template<class T> +egammaTruthAssociationAlg::writeDecorHandles<T>::writeDecorHandles( + const SG::WriteDecorHandleKeyArray<T>& hkeys) + : el(hkeys.at(0)) + , type(hkeys.at(1)) + , origin(hkeys.at(2)) +{} + +template<class T> +egammaTruthAssociationAlg::MCTruthInfo_t +egammaTruthAssociationAlg::particleTruthClassifier(const T* particle, + Cache* extrapolationCache) const { -} - - -// ========================================================================== -template<class T> egammaTruthAssociationAlg::MCTruthInfo_t -egammaTruthAssociationAlg::particleTruthClassifier(const T* particle, Cache *extrapolationCache) { MCTruthInfo_t info; IMCTruthClassifier::Info mcinfo; mcinfo.extrapolationCache = extrapolationCache; @@ -270,18 +278,22 @@ egammaTruthAssociationAlg::particleTruthClassifier(const T* particle, Cache *ext info.second = ret.second; return info; } -/** Template specialisation for electrons: + +/** Template specialisation for electrons: * second pass based on the cluster to find true photons **/ -template<> egammaTruthAssociationAlg::MCTruthInfo_t -egammaTruthAssociationAlg::particleTruthClassifier<xAOD::Electron>(const xAOD::Electron* electron, Cache *extrapolationCache) { +template<> +egammaTruthAssociationAlg::MCTruthInfo_t +egammaTruthAssociationAlg::particleTruthClassifier<xAOD::Electron>(const xAOD::Electron* electron, + Cache* extrapolationCache) const +{ MCTruthInfo_t info; IMCTruthClassifier::Info mcinfo; mcinfo.extrapolationCache = extrapolationCache; auto ret = m_mcTruthClassifier->particleTruthClassifier(electron, &mcinfo); if (ret.first == MCTruthPartClassifier::Unknown && - !xAOD::EgammaHelpers::isFwdElectron(electron) && electron->caloCluster()){ + !xAOD::EgammaHelpers::isFwdElectron(electron) && electron->caloCluster()) { ATH_MSG_DEBUG("Trying cluster-based truth classification for electron"); - ret = m_mcTruthClassifier->particleTruthClassifier( electron->caloCluster(), &mcinfo); + ret = m_mcTruthClassifier->particleTruthClassifier(electron->caloCluster(), &mcinfo); } info.genPart = mcinfo.genPart; info.first = ret.first; @@ -289,19 +301,20 @@ egammaTruthAssociationAlg::particleTruthClassifier<xAOD::Electron>(const xAOD::E return info; } -// ========================================================================== -template<class T, class L> -StatusCode egammaTruthAssociationAlg::match(const xAOD::TruthParticleContainer& truthParticles, - const SG::WriteDecorHandleKeyArray<T>& hkeys, - const SG::AuxElement::Accessor<L>& linkAccess, - xAOD::TruthParticleContainer* egammaTruthContainer) { +template<class T, class L> +StatusCode +egammaTruthAssociationAlg::match(const xAOD::TruthParticleContainer& truthParticles, + const SG::WriteDecorHandleKeyArray<T>& hkeys, + const SG::AuxElement::Accessor<L>& linkAccess, + xAOD::TruthParticleContainer* egammaTruthContainer) const +{ writeDecorHandles<T> decoHandles(hkeys); - //Extrapolation Cache + // Extrapolation Cache Cache extrapolationCache{}; - for (auto particle : *decoHandles.readHandle()){ + for (auto particle : *decoHandles.readHandle()) { MCTruthInfo_t info = particleTruthClassifier(particle, &extrapolationCache); @@ -315,37 +328,40 @@ StatusCode egammaTruthAssociationAlg::match(const xAOD::TruthParticleContainer& } decoHandles.el(*particle).toPersistent(); ATH_MSG_DEBUG("truthType = " << info.first << " truthOrigin = " << info.second); - decoHandles.type(*particle) = static_cast<int>( info.first ); - decoHandles.origin(*particle) = static_cast<int>( info.second ); + decoHandles.type(*particle) = static_cast<int>(info.first); + decoHandles.origin(*particle) = static_cast<int>(info.second); // Decorate the corresponding truth particle with the link to the reco if (m_doEgammaTruthContainer) { if (!egammaTruthContainer) { - ATH_MSG_ERROR("The egammaTruthContainer needs to be valid"); - return StatusCode::FAILURE; + ATH_MSG_ERROR("The egammaTruthContainer needs to be valid"); + return StatusCode::FAILURE; } - const xAOD::TruthParticle *truth = xAOD::TruthHelpers::getTruthParticle(*particle); + const xAOD::TruthParticle* truth = xAOD::TruthHelpers::getTruthParticle(*particle); if (truth) { - xAOD::TruthParticle *truthEgamma = getEgammaTruthParticle(truth, *egammaTruthContainer); - if (truthEgamma) { - // we found a truthEgamma object we should annotate if this is the best link - bool annotateLink = true; // by default we annotate - const auto link = linkAccess(*truthEgamma); // what already exists - if (link.isValid()) { - auto oldPart = *link; - if (oldPart && truthEgamma->e() > 0 && - std::abs( oldPart->e()/truthEgamma->e()-1 ) < std::abs( particle->e()/truthEgamma->e()-1 ) ){ - ATH_MSG_DEBUG(truthEgamma << ": " << " already set to a better matched particle: " << particle); - annotateLink = false; - } - } - - if (annotateLink) { - L link(particle, *decoHandles.readHandle()); - linkAccess(*truthEgamma) = link; - linkAccess(*truthEgamma).toPersistent(); - } - } + xAOD::TruthParticle* truthEgamma = getEgammaTruthParticle(truth, *egammaTruthContainer); + if (truthEgamma) { + // we found a truthEgamma object we should annotate if this is the best link + bool annotateLink = true; // by default we annotate + const auto link = linkAccess(*truthEgamma); // what already exists + if (link.isValid()) { + auto oldPart = *link; + if (oldPart && truthEgamma->e() > 0 && + std::abs(oldPart->e() / truthEgamma->e() - 1) < + std::abs(particle->e() / truthEgamma->e() - 1)) { + ATH_MSG_DEBUG(truthEgamma + << ": " + << " already set to a better matched particle: " << particle); + annotateLink = false; + } + } + + if (annotateLink) { + L link(particle, *decoHandles.readHandle()); + linkAccess(*truthEgamma) = link; + linkAccess(*truthEgamma).toPersistent(); + } + } } } } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.h b/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.h index 3af2367b6737b2b00323b7a50de8461a56880251..f695fba988b8a67ef664ed4abaefb0b0536bf83b 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaTruthAssociationAlg.h @@ -1,31 +1,32 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H #define EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/EventContext.h" #include "GaudiKernel/ToolHandle.h" -#include "MCTruthClassifier/MCTruthClassifierDefs.h" #include "MCTruthClassifier/IMCTruthClassifier.h" +#include "MCTruthClassifier/MCTruthClassifierDefs.h" #include "xAODEgamma/EgammaContainer.h" +#include "xAODEgamma/EgammaxAODHelpers.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/PhotonContainer.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthEventContainer.h" -#include "xAODTruth/xAODTruthHelpers.h" #include "xAODTruth/TruthParticle.h" #include "xAODTruth/TruthParticleAuxContainer.h" +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/xAODTruthHelpers.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" -#include "StoreGate/ReadHandleKey.h" #include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandleKey.h" -#include "StoreGate/WriteDecorHandleKeyArray.h" +#include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteDecorHandle.h" +#include "StoreGate/WriteDecorHandleKeyArray.h" +#include "StoreGate/WriteHandleKey.h" #include <string> @@ -33,179 +34,251 @@ @class egammaTruthAssociationAlg Decorate egamma object with truth information during reconstruction Creates egammaTruth collection with links to reco objects - - @author B. Lenzi + + @author B. Lenzi J. Mitrevski C. Anastopoulos */ -class egammaTruthAssociationAlg : public AthAlgorithm { +class egammaTruthAssociationAlg : public AthAlgorithm +{ public: - typedef Trk::IParticleCaloExtensionTool::Cache Cache; /** @brief constructor */ egammaTruthAssociationAlg(const std::string& name, ISvcLocator* pSvcLocator); - + /** @brief destructor */ virtual ~egammaTruthAssociationAlg(); /** @brief initialize method */ virtual StatusCode initialize() override final; - /** @brief execute on container */ - virtual StatusCode execute() override final; /** @brief finalize method */ virtual StatusCode finalize() override final; - + + /** @brief execute on container */ + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; + private: - - struct MCTruthInfo_t { + struct MCTruthInfo_t + { MCTruthPartClassifier::ParticleType first; MCTruthPartClassifier::ParticleOrigin second; const xAOD::TruthParticle* genPart; }; - - /// A function that initializes the decor handles, but also checks the naming convention - template<class T> StatusCode initializeDecorKeys(SG::WriteDecorHandleKeyArray<T>& keys, - const std::string& name); - + + /// A function that initializes the decor handles, but also checks the naming + /// convention + template<class T> + StatusCode initializeDecorKeys(SG::WriteDecorHandleKeyArray<T>& keys, + const std::string& name); + /** @brief helper class to contain write decoration handles */ - template<class T> struct writeDecorHandles { - writeDecorHandles(const SG::WriteDecorHandleKeyArray<T>& keys); // constructor + template<class T> + struct writeDecorHandles + { + writeDecorHandles( + const SG::WriteDecorHandleKeyArray<T>& keys); // constructor - SG::WriteDecorHandle<T, ElementLink<xAOD::TruthParticleContainer> > el; - SG::WriteDecorHandle<T, int > type; - SG::WriteDecorHandle<T, int > origin; + SG::WriteDecorHandle<T, ElementLink<xAOD::TruthParticleContainer>> el; + SG::WriteDecorHandle<T, int> type; + SG::WriteDecorHandle<T, int> origin; // any of the handles should function as a read handle, choice is arbitrary SG::ReadHandle<T>& readHandle() { return type; }; - }; - - - /** @brief Loop over elements in the reco container, decorate them with truth info and - * decorate the truth particles with links to the reco ones (reco<typeName>Link) **/ - template<class T, class L> StatusCode match(const xAOD::TruthParticleContainer& truthParticles, - const SG::WriteDecorHandleKeyArray<T>& hkeys, - const SG::AuxElement::Accessor<L>& linkAccess, - xAOD::TruthParticleContainer* egammaTruthContainer) ; + + /** @brief Loop over elements in the reco container, decorate them with truth + * info and decorate the truth particles with links to the reco ones + * (reco<typeName>Link) **/ + template<class T, class L> + StatusCode match(const xAOD::TruthParticleContainer& truthParticles, + const SG::WriteDecorHandleKeyArray<T>& hkeys, + const SG::AuxElement::Accessor<L>& linkAccess, + xAOD::TruthParticleContainer* egammaTruthContainer) const; /** @brief return the result of MCTruthClassifier::particleTruthClassifier - * or do a second pass for electrons based on the cluster to find true photons **/ - template<class T> MCTruthInfo_t particleTruthClassifier(const T*, Cache *) ; - - /** @brief Create a copy a truth particle, add it to the new container and decorate it - * with a link to the original particle **/ + * or do a second pass for electrons based on the cluster to find true photons + * **/ + template<class T> + MCTruthInfo_t particleTruthClassifier(const T*, Cache*) const; + + /** @brief Create a copy a truth particle, add it to the new container and + * decorate it with a link to the original particle **/ void getNewTruthParticle(xAOD::TruthParticleContainer& egammaTruthContainer, - const xAOD::TruthParticle *truth, - const xAOD::TruthParticleContainer *oldContainer) ; + const xAOD::TruthParticle* truth, + const xAOD::TruthParticleContainer* oldContainer) const; - /** @brief Return true if the truth particle is a prompt electron or photon **/ - bool isPromptEgammaParticle(const xAOD::TruthParticle *truth) ; + /** @brief Return true if the truth particle is a prompt electron or photon + * **/ + bool isPromptEgammaParticle(const xAOD::TruthParticle* truth) const; - - /** @brief Return the truth particle in the egamma truth container that corresponds - * to the given truth particle (egammaTruthContainer is non-const reference because - * returning non-const pointer) **/ - xAOD::TruthParticle* getEgammaTruthParticle(const xAOD::TruthParticle *truth, - xAOD::TruthParticleContainer& egammaTruthContainer) const; + /** @brief Return the truth particle in the egamma truth container that + * corresponds to the given truth particle (egammaTruthContainer is non-const + * reference because returning non-const pointer) **/ + xAOD::TruthParticle* getEgammaTruthParticle( + const xAOD::TruthParticle* truth, + xAOD::TruthParticleContainer& egammaTruthContainer) const; - /** @brief Create egamma truth container? **/ - Gaudi::Property<bool> m_doEgammaTruthContainer {this, - "CreateEgammaTruthContainer", true, - "Create egammaTruthContainer?"}; - + Gaudi::Property<bool> m_doEgammaTruthContainer{ + this, + "CreateEgammaTruthContainer", + true, + "Create egammaTruthContainer?" + }; + /** @brief Match electrons? **/ - Gaudi::Property<bool> m_matchElectrons {this, - "MatchElectrons", true, - "Match (central) electrons?"}; + Gaudi::Property<bool> m_matchElectrons{ this, + "MatchElectrons", + true, + "Match (central) electrons?" }; /** @brief Match photons? **/ - Gaudi::Property<bool> m_matchPhotons {this, - "MatchPhotons", true, - "Match photons?"}; + Gaudi::Property<bool> m_matchPhotons{ this, + "MatchPhotons", + true, + "Match photons?" }; /** @brief Match fwd electrons? **/ - Gaudi::Property<bool> m_matchForwardElectrons {this, - "MatchForwardElectrons", true, - "Match forward electrons?"}; + Gaudi::Property<bool> m_matchForwardElectrons{ this, + "MatchForwardElectrons", + true, + "Match forward electrons?" }; /** @brief Match clusters? **/ - Gaudi::Property<bool> m_matchClusters {this, "MatchClusters", false, - "Match clusters?"}; - + Gaudi::Property<bool> m_matchClusters{ this, + "MatchClusters", + false, + "Match clusters?" }; + /** @brief The egamma cluster decor handle key array **/ - SG::WriteDecorHandleKeyArray<xAOD::CaloClusterContainer> m_clusterDecKeys {this, - "DoNotSet_ClusterContainerName", {}, - "Do not set; configuration via the string property"}; - - /** @brief The egamma cluster name property used to initialize the WriteDecorHandleKeyArray **/ - Gaudi::Property<std::string> m_clusterDecName {this, - "ClusterContainerName", "", - "Name of the egamma cluster container"}; - + SG::WriteDecorHandleKeyArray<xAOD::CaloClusterContainer> m_clusterDecKeys{ + this, + "DoNotSet_ClusterContainerName", + {}, + "Do not set; configuration via the string property" + }; + + /** @brief The egamma cluster name property used to initialize the + * WriteDecorHandleKeyArray **/ + Gaudi::Property<std::string> m_clusterDecName{ + this, + "ClusterContainerName", + "", + "Name of the egamma cluster container" + }; + /** @brief The electron container decor handle key array **/ - SG::WriteDecorHandleKeyArray<xAOD::ElectronContainer> m_electronDecKeys {this, - "DoNotSet_ElectronContainerName", {}, - "Do not set; configuration via the string property"}; + SG::WriteDecorHandleKeyArray<xAOD::ElectronContainer> m_electronDecKeys{ + this, + "DoNotSet_ElectronContainerName", + {}, + "Do not set; configuration via the string property" + }; - /** @brief The electron container name property used to initialize the WriteDecorHandleKeyArray **/ - Gaudi::Property<std::string> m_electronDecName {this, - "ElectronContainerName", "", - "Name of the input electron container"}; + /** @brief The electron container name property used to initialize the + * WriteDecorHandleKeyArray **/ + Gaudi::Property<std::string> m_electronDecName{ + this, + "ElectronContainerName", + "", + "Name of the input electron container" + }; /** @brief The fwd electron container decor handle key array **/ - SG::WriteDecorHandleKeyArray<xAOD::ElectronContainer> m_fwdElectronDecKeys {this, - "DoNotSet_FwdElectronContainerName", {}, - "Do not set; configuration via the string property"}; - - /** @brief The fwd electron name property used to initialize the WriteDecorHandleKeyArray **/ - Gaudi::Property<std::string> m_fwdElectronDecName {this, - "FwdElectronContainerName", "", - "Name of the input fwd electron container"}; - + SG::WriteDecorHandleKeyArray<xAOD::ElectronContainer> m_fwdElectronDecKeys{ + this, + "DoNotSet_FwdElectronContainerName", + {}, + "Do not set; configuration via the string property" + }; + + /** @brief The fwd electron name property used to initialize the + * WriteDecorHandleKeyArray **/ + Gaudi::Property<std::string> m_fwdElectronDecName{ + this, + "FwdElectronContainerName", + "", + "Name of the input fwd electron container" + }; + /** @brief The photon container decor handle key array **/ - SG::WriteDecorHandleKeyArray<xAOD::PhotonContainer> m_photonDecKeys {this, - "DoNotSet_PhotonContainerName", {}, - "Do not set; configuration via the string property"}; - - /** @brief The photon container name property used to initialize the WriteDecorHandleKeyArray **/ - Gaudi::Property<std::string> m_photonDecName {this, - "PhotonContainerName", "", - "Name of the input photon container"}; - + SG::WriteDecorHandleKeyArray<xAOD::PhotonContainer> m_photonDecKeys{ + this, + "DoNotSet_PhotonContainerName", + {}, + "Do not set; configuration via the string property" + }; + + /** @brief The photon container name property used to initialize the + * WriteDecorHandleKeyArray **/ + Gaudi::Property<std::string> m_photonDecName{ + this, + "PhotonContainerName", + "", + "Name of the input photon container" + }; + /** @brief Name of the truth event container **/ - SG::ReadHandleKey<xAOD::TruthEventContainer> m_truthEventContainerKey {this, - "TruthEventContainerName", "", - "Name of the truth event container"}; + SG::ReadHandleKey<xAOD::TruthEventContainer> m_truthEventContainerKey{ + this, + "TruthEventContainerName", + "", + "Name of the truth event container" + }; /** @brief Name of the truth particle container **/ - SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainerKey {this, - "TruthParticleContainerName", "", - "Name of the truth particle container"}; + SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainerKey{ + this, + "TruthParticleContainerName", + "", + "Name of the truth particle container" + }; /** @brief Name of the output egamma truth container **/ - SG::WriteHandleKey<xAOD::TruthParticleContainer> m_egammaTruthParticleContainerKey {this, - "EgammaTruthContainerName", "", - "Name of the output egamma truth particle container"}; - + SG::WriteHandleKey<xAOD::TruthParticleContainer> + m_egammaTruthParticleContainerKey{ + this, + "EgammaTruthContainerName", + "", + "Name of the output egamma truth particle container" + }; + /** @brief Minimum Pt to enter egamma truth particle container **/ - Gaudi::Property<float> m_minPt {this, "MinPtEgammaTruth", 10, - "Minimum Pt to enter egamma truth particle container"}; + Gaudi::Property<float> m_minPt{ + this, + "MinPtEgammaTruth", + 10, + "Minimum Pt to enter egamma truth particle container" + }; /** @brief Minimum Pt for FSR to enter egamma truth particle container **/ - Gaudi::Property<float> m_minPtFSR {this, "MinPtEgammaTruthFSR", 1e3, - "Minimum Pt for FSR to enter egamma truth particle container"}; + Gaudi::Property<float> m_minPtFSR{ + this, + "MinPtEgammaTruthFSR", + 1e3, + "Minimum Pt for FSR to enter egamma truth particle container" + }; /** Barcode offset for G4 particles **/ - Gaudi::Property<int> m_barcodeOffset {this, "SimBarcodeOffset", 200e3, - "Barcode offset for G4 particles"}; - + Gaudi::Property<int> m_barcodeOffset{ this, + "SimBarcodeOffset", + 200e3, + "Barcode offset for G4 particles" }; + /** @brief MCTruthClassifier **/ - ToolHandle<IMCTruthClassifier> m_mcTruthClassifier {this, - "MCTruthClassifier", "EMMCTruthClassifier", "Handle of MCTruthClassifier"}; - + ToolHandle<IMCTruthClassifier> m_mcTruthClassifier{ + this, + "MCTruthClassifier", + "EMMCTruthClassifier", + "Handle of MCTruthClassifier" + }; }; - #endif // EGAMMAALGS_EGAMMATRUTHASSOCIATIONALG_H diff --git a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx index 48a92a96d1d0d076b02f1dc370ee08c68af70e6c..2297cf933cc7d71a1d3d36f717c0047000e5d13d 100644 --- a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.cxx @@ -5,38 +5,39 @@ #include "electronSuperClusterBuilder.h" // #include "CaloDetDescr/CaloDetDescrManager.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODCaloEvent/CaloClusterAuxContainer.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" #include "FourMomUtils/P4Helpers.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" +#include "xAODCaloEvent/CaloCluster.h" +#include "xAODCaloEvent/CaloClusterAuxContainer.h" +#include "xAODEgamma/Egamma.h" +#include "xAODEgamma/EgammaxAODHelpers.h" +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" #include <memory> - -electronSuperClusterBuilder::electronSuperClusterBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - egammaSuperClusterBuilder(name, pSvcLocator) +electronSuperClusterBuilder::electronSuperClusterBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : egammaSuperClusterBuilder(name, pSvcLocator) { - //Additional Window we search in + // Additional Window we search in m_maxDelPhi = m_maxDelPhiCells * s_cellPhiSize * 0.5; m_maxDelEta = m_maxDelEtaCells * s_cellEtaSize * 0.5; } -StatusCode electronSuperClusterBuilder::initialize() { +StatusCode +electronSuperClusterBuilder::initialize() +{ ATH_MSG_DEBUG(" Initializing electronSuperClusterBuilder"); - //Call initialize of base + // Call initialize of base ATH_CHECK(egammaSuperClusterBuilder::initialize()); // the data handle keys ATH_CHECK(m_inputEgammaRecContainerKey.initialize()); ATH_CHECK(m_electronSuperRecCollectionKey.initialize()); ATH_CHECK(m_outputElectronSuperClustersKey.initialize()); - //Additional Window we search in + // Additional Window we search in m_maxDelPhi = m_maxDelPhiCells * s_cellPhiSize * 0.5; m_maxDelEta = m_maxDelEtaCells * s_cellEtaSize * 0.5; @@ -47,195 +48,200 @@ StatusCode electronSuperClusterBuilder::initialize() { return StatusCode::SUCCESS; } -StatusCode electronSuperClusterBuilder::finalize() { +StatusCode +electronSuperClusterBuilder::finalize() +{ return StatusCode::SUCCESS; } -StatusCode electronSuperClusterBuilder::execute(){ +StatusCode +electronSuperClusterBuilder::execute_r(const EventContext& ctx) const +{ - SG::ReadHandle<EgammaRecContainer> egammaRecs(m_inputEgammaRecContainerKey); + SG::ReadHandle<EgammaRecContainer> egammaRecs(m_inputEgammaRecContainerKey, ctx); // check is only used for serial running; remove when MT scheduler used - if(!egammaRecs.isValid()) { - ATH_MSG_ERROR("Failed to retrieve "<< m_inputEgammaRecContainerKey.key()); + if (!egammaRecs.isValid()) { + ATH_MSG_ERROR("Failed to retrieve " << m_inputEgammaRecContainerKey.key()); return StatusCode::FAILURE; } - //Have to register cluster container in order to properly get cluster links. - SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer(m_outputElectronSuperClustersKey); + // Have to register cluster container in order to properly get cluster links. + SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( + m_outputElectronSuperClustersKey, ctx); + ATH_CHECK(outputClusterContainer.record(std::make_unique<xAOD::CaloClusterContainer>(), std::make_unique<xAOD::CaloClusterAuxContainer>())); - - //Create the new Electron Super Cluster based EgammaRecContainer - SG::WriteHandle<EgammaRecContainer> newEgammaRecs(m_electronSuperRecCollectionKey); + // Create the new Electron Super Cluster based EgammaRecContainer + SG::WriteHandle<EgammaRecContainer> newEgammaRecs(m_electronSuperRecCollectionKey, ctx); ATH_CHECK(newEgammaRecs.record(std::make_unique<EgammaRecContainer>())); - //The calo Det Descr manager + // The calo Det Descr manager const CaloDetDescrManager* calodetdescrmgr = nullptr; - ATH_CHECK( detStore()->retrieve(calodetdescrmgr,"CaloMgr") ); - - //Reserve a vector to keep track of what is used - std::vector<bool> isUsed (egammaRecs->size(),0); - std::vector<bool> isUsedRevert(egammaRecs->size(),0); - //Loop over input egammaRec objects, build superclusters. - for (std::size_t i = 0 ; i < egammaRecs->size();++i) { - - //Used to reset back status of selected - //in case we fail to form a supercluster - isUsedRevert=isUsed; - - //Check if used - auto egRec=egammaRecs->at(i); - if(isUsed.at(i)){ - continue; + ATH_CHECK(detStore()->retrieve(calodetdescrmgr, "CaloMgr")); + + // Reserve a vector to keep track of what is used + std::vector<bool> isUsed(egammaRecs->size(), 0); + std::vector<bool> isUsedRevert(egammaRecs->size(), 0); + // Loop over input egammaRec objects, build superclusters. + for (std::size_t i = 0; i < egammaRecs->size(); ++i) { + + // Used to reset back status of selected + // in case we fail to form a supercluster + isUsedRevert = isUsed; + + // Check if used + auto egRec = egammaRecs->at(i); + if (isUsed.at(i)) { + continue; } // Seed selections - const xAOD::CaloCluster* clus= egRec->caloCluster(); - //The seed should have 2nd sampling - if (!clus->hasSampling(CaloSampling::EMB2) && !clus->hasSampling(CaloSampling::EME2)){ + const xAOD::CaloCluster* clus = egRec->caloCluster(); + // The seed should have 2nd sampling + if (!clus->hasSampling(CaloSampling::EMB2) && !clus->hasSampling(CaloSampling::EME2)) { continue; } const double eta2 = fabs(clus->etaBE(2)); - if(eta2>10){ + if (eta2 > 10) { continue; - } - //Accordeon Energy samplings 1 to 3 - const double EMAccEnergy= clus->energyBE(1)+clus->energyBE(2)+clus->energyBE(3); - const double EMAccEt = EMAccEnergy/cosh(eta2); - //Require minimum energy for supercluster seeding. - if (EMAccEt < m_EtThresholdCut){ + } + // Accordeon Energy samplings 1 to 3 + const double EMAccEnergy = clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3); + const double EMAccEt = EMAccEnergy / cosh(eta2); + // Require minimum energy for supercluster seeding. + if (EMAccEt < m_EtThresholdCut) { continue; } - //We need tracks - if (egRec->getNumberOfTrackParticles()==0) { + // We need tracks + if (egRec->getNumberOfTrackParticles() == 0) { continue; } - //with possible pixel + // with possible pixel uint8_t nPixelHits(0); uint8_t uint8_value(0); - if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfPixelDeadSensors)){ - nPixelHits+=uint8_value; + if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfPixelDeadSensors)) { + nPixelHits += uint8_value; } - if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfPixelHits)){ - nPixelHits+=uint8_value; - } - if (nPixelHits<m_numberOfPixelHits){ + if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfPixelHits)) { + nPixelHits += uint8_value; + } + if (nPixelHits < m_numberOfPixelHits) { continue; } - //and with silicon (add SCT to pixel) - uint8_t nSiHits=nPixelHits; - if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfSCTHits)){ - nSiHits += uint8_value; + // and with silicon (add SCT to pixel) + uint8_t nSiHits = nPixelHits; + if (egRec->trackParticle(0)->summaryValue(uint8_value, xAOD::numberOfSCTHits)) { + nSiHits += uint8_value; } - if (nSiHits < m_numberOfSiHits){ + if (nSiHits < m_numberOfSiHits) { continue; - } - ATH_MSG_DEBUG("Creating supercluster egammaRec electron using cluster Et = " - << egRec->caloCluster()->et() << " eta " << egRec->caloCluster()->eta() - << " phi "<< egRec->caloCluster()->phi() << - " EM Accordeon Et " << EMAccEt - <<" pixel hits " << static_cast<unsigned int> (nPixelHits) - <<" silicon hits " << static_cast<unsigned int> (nSiHits)); - //Mark seed as used - isUsed.at(i)=true; - - //Add the seed as the 1st entry in the secondaries list + } + ATH_MSG_DEBUG("Creating supercluster egammaRec electron using cluster Et = " + << egRec->caloCluster()->et() << " eta " << egRec->caloCluster()->eta() << " phi " + << egRec->caloCluster()->phi() << " EM Accordeon Et " << EMAccEt << " pixel hits " + << static_cast<unsigned int>(nPixelHits) << " silicon hits " + << static_cast<unsigned int>(nSiHits)); + // Mark seed as used + isUsed.at(i) = true; + + // Add the seed as the 1st entry in the secondaries list std::vector<const xAOD::CaloCluster*> accumulatedClusters; accumulatedClusters.push_back(egRec->caloCluster()); - //Now we find all the secondary cluster for this seed - const std::vector<std::size_t> secondaryIndices = searchForSecondaryClusters(i, - egammaRecs.cptr(), - isUsed); - for(const auto& secIndex : secondaryIndices){ + // Now we find all the secondary cluster for this seed + const std::vector<std::size_t> secondaryIndices = + searchForSecondaryClusters(i, egammaRecs.cptr(), isUsed); + for (const auto& secIndex : secondaryIndices) { const auto secRec = egammaRecs->at(secIndex); accumulatedClusters.push_back(secRec->caloCluster()); } ATH_MSG_DEBUG("Total clusters " << accumulatedClusters.size()); - //Take the full list of cluster and add their cells together - std::unique_ptr<xAOD::CaloCluster> newClus = createNewCluster(accumulatedClusters, - *calodetdescrmgr, - xAOD::EgammaParameters::electron); + // Take the full list of cluster and add their cells together + std::unique_ptr<xAOD::CaloCluster> newClus = createNewCluster( + ctx, accumulatedClusters, *calodetdescrmgr, xAOD::EgammaParameters::electron); if (!newClus) { isUsed = isUsedRevert; continue; } - //Push back the new cluster into the output container. + // Push back the new cluster into the output container. outputClusterContainer->push_back(std::move(newClus)); - ElementLink< xAOD::CaloClusterContainer > clusterLink(*outputClusterContainer, outputClusterContainer->size() - 1); - std::vector< ElementLink<xAOD::CaloClusterContainer> > elClusters {clusterLink}; + ElementLink<xAOD::CaloClusterContainer> clusterLink(*outputClusterContainer, + outputClusterContainer->size() - 1); + std::vector<ElementLink<xAOD::CaloClusterContainer>> elClusters{ clusterLink }; - //Make egammaRec object, and push it back into output container. + // Make egammaRec object, and push it back into output container. auto newEgRec = std::make_unique<egammaRec>(*egRec); - newEgRec->setCaloClusters (elClusters); + newEgRec->setCaloClusters(elClusters); newEgammaRecs->push_back(std::move(newEgRec)); - } //End loop on egammaRecs - - //Redo track matching given the super cluster - if (m_doTrackMatching){ - ATH_CHECK(m_trackMatchBuilder->executeRec(Gaudi::Hive::currentContext(),newEgammaRecs.ptr())); + } // End loop on egammaRecs + + // Redo track matching given the super cluster + if (m_doTrackMatching) { + ATH_CHECK(m_trackMatchBuilder->executeRec(ctx, newEgammaRecs.ptr())); } return StatusCode::SUCCESS; } -std::vector<std::size_t> +std::vector<std::size_t> electronSuperClusterBuilder::searchForSecondaryClusters(const std::size_t electronIndex, const EgammaRecContainer* egammaRecs, - std::vector<bool>& isUsed){ - std::vector<std::size_t> secondaryClusters; + std::vector<bool>& isUsed) const +{ + std::vector<std::size_t> secondaryClusters; if (!egammaRecs) { return secondaryClusters; } const auto seedEgammaRec = egammaRecs->at(electronIndex); - const xAOD::CaloCluster *seedCluster = seedEgammaRec->caloCluster(); + const xAOD::CaloCluster* seedCluster = seedEgammaRec->caloCluster(); - const xAOD::TrackParticle* seedTrackParticle =seedEgammaRec->trackParticle(); + const xAOD::TrackParticle* seedTrackParticle = seedEgammaRec->trackParticle(); - for (std::size_t i = 0 ; i < egammaRecs->size();++i) { + for (std::size_t i = 0; i < egammaRecs->size(); ++i) { - //if already used continue - if(isUsed.at(i)){ + // if already used continue + if (isUsed.at(i)) { continue; } - //if not retrieve the relevant info + // if not retrieve the relevant info const auto egRec = egammaRecs->at(i); const xAOD::CaloCluster* clus = egRec->caloCluster(); float seedSecdEta(fabs(seedCluster->eta() - clus->eta())); float seedSecdPhi(fabs(P4Helpers::deltaPhi(seedCluster->phi(), clus->phi()))); /* add the cluster if - * 1.matches the seed in a narrow window + * 1.matches the seed in a narrow window * OR * 2.Is inside the range for additonal criteria - * AND matches the same track + * AND matches the same track */ - bool addCluster = (matchesInWindow(seedCluster,clus) || - ((seedSecdEta<m_maxDelEta && seedSecdPhi<m_maxDelPhi) && - (matchSameTrack(*seedTrackParticle,*egRec))) - ); - //Add it to the list of secondary clusters if it matches. + bool addCluster = (matchesInWindow(seedCluster, clus) || + ((seedSecdEta < m_maxDelEta && seedSecdPhi < m_maxDelPhi) && + (matchSameTrack(*seedTrackParticle, *egRec)))); + // Add it to the list of secondary clusters if it matches. if (addCluster) { - secondaryClusters.push_back(i); - isUsed.at(i)=1; + secondaryClusters.push_back(i); + isUsed.at(i) = 1; } } - ATH_MSG_DEBUG("Found: " << secondaryClusters.size()<< " secondaries"); + ATH_MSG_DEBUG("Found: " << secondaryClusters.size() << " secondaries"); return secondaryClusters; } -bool electronSuperClusterBuilder::matchSameTrack(const xAOD::TrackParticle& seedTrack, - const egammaRec& sec) const{ +bool +electronSuperClusterBuilder::matchSameTrack(const xAOD::TrackParticle& seedTrack, + const egammaRec& sec) const +{ bool matchesSameTrack(false); - const xAOD::TrackParticle *secTrack = sec.trackParticle(); + const xAOD::TrackParticle* secTrack = sec.trackParticle(); if (secTrack) { - //Check that the tracks are the same. - matchesSameTrack=(seedTrack.index()==secTrack->index()); + // Check that the tracks are the same. + matchesSameTrack = (seedTrack.index() == secTrack->index()); } return matchesSameTrack; } diff --git a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h index 815464afb5891a92a9db059b2ad1d283997b6700..cc4b46c976179ec0fb55e92eabd730dd9cab0a79 100644 --- a/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/electronSuperClusterBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_ELECTRONSUPERCLUSTERBUILDER_H @@ -8,75 +8,111 @@ // INCLUDE HEADER FILES: #include "egammaSuperClusterBuilder.h" +#include "GaudiKernel/EventContext.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" -//Fwd declarations -#include "xAODCaloEvent/CaloClusterFwd.h" +// Fwd declarations +#include "egammaInterfaces/IEMTrackMatchBuilder.h" #include "egammaRecEvent/egammaRecContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" -#include "egammaInterfaces/IEMTrackMatchBuilder.h" +#include "xAODCaloEvent/CaloClusterFwd.h" -class electronSuperClusterBuilder : public egammaSuperClusterBuilder { +class electronSuperClusterBuilder : public egammaSuperClusterBuilder +{ - public: - //Constructor/destructor. - electronSuperClusterBuilder(const std::string& name, ISvcLocator* pSvcLocator); +public: + // Constructor/destructor. + electronSuperClusterBuilder(const std::string& name, + ISvcLocator* pSvcLocator); - //Tool standard routines. + // Tool standard routines. virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; - - private: + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; +private: bool matchSameTrack(const xAOD::TrackParticle& seedTrack, const egammaRec& sec) const; - std::vector<std::size_t> searchForSecondaryClusters(const size_t i, - const EgammaRecContainer*, - std::vector<bool>& isUsed); - + std::vector<std::size_t> searchForSecondaryClusters( + const size_t i, + const EgammaRecContainer*, + std::vector<bool>& isUsed) const; + /** @brief Size of maximum search window in eta */ - Gaudi::Property<int> m_maxDelEtaCells {this, - "MaxWindowDelEtaCells", 5, - "Size of maximum search window in eta"}; - /** @brief Size of maximum search window in phi */ - Gaudi::Property<int> m_maxDelPhiCells {this, - "MaxWindowDelPhiCells", 12, - "Size of maximum search window in phi"}; - + Gaudi::Property<int> m_maxDelEtaCells{ + this, + "MaxWindowDelEtaCells", + 5, + "Size of maximum search window in eta" + }; + /** @brief Size of maximum search window in phi */ + Gaudi::Property<int> m_maxDelPhiCells{ + this, + "MaxWindowDelPhiCells", + 12, + "Size of maximum search window in phi" + }; + float m_maxDelEta; float m_maxDelPhi; - Gaudi::Property<std::size_t> m_numberOfPixelHits {this, - "NumberOfReqPixelHits", 1, "Number of required pixel hits for electrons"}; + Gaudi::Property<std::size_t> m_numberOfPixelHits{ + this, + "NumberOfReqPixelHits", + 1, + "Number of required pixel hits for electrons" + }; - Gaudi::Property<std::size_t> m_numberOfSiHits {this, - "NumberOfReqSiHits", 7, "Number of required silicon hits for electrons"}; + Gaudi::Property<std::size_t> m_numberOfSiHits{ + this, + "NumberOfReqSiHits", + 7, + "Number of required silicon hits for electrons" + }; /** @brief Key for input egammaRec container */ - SG::ReadHandleKey<EgammaRecContainer> m_inputEgammaRecContainerKey {this, - "InputEgammaRecContainerName", "egammaRecCollection", - "input egammaRec container"}; - + SG::ReadHandleKey<EgammaRecContainer> m_inputEgammaRecContainerKey{ + this, + "InputEgammaRecContainerName", + "egammaRecCollection", + "input egammaRec container" + }; + /** @brief Key for output egammaRec container */ - SG::WriteHandleKey<EgammaRecContainer> m_electronSuperRecCollectionKey {this, - "SuperElectronRecCollectionName", "ElectronSuperRecCollection", - "output egammaRec container"}; - + SG::WriteHandleKey<EgammaRecContainer> m_electronSuperRecCollectionKey{ + this, + "SuperElectronRecCollectionName", + "ElectronSuperRecCollection", + "output egammaRec container" + }; + /** @brief Key for output clusters */ - SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputElectronSuperClustersKey {this, - "SuperClusterCollestionName", "ElectronSuperClusters", - "output calo cluster container"}; + SG::WriteHandleKey<xAOD::CaloClusterContainer> + m_outputElectronSuperClustersKey{ this, + "SuperClusterCollestionName", + "ElectronSuperClusters", + "output calo cluster container" }; /** @brief Tool to perform track matching*/ - ToolHandle<IEMTrackMatchBuilder> m_trackMatchBuilder {this, - "TrackMatchBuilderTool", "EMTrackMatchBuilder", - "Tool that matches tracks to egammaRecs"}; + ToolHandle<IEMTrackMatchBuilder> m_trackMatchBuilder{ + this, + "TrackMatchBuilderTool", + "EMTrackMatchBuilder", + "Tool that matches tracks to egammaRecs" + }; /** @brief private member flag to do the track matching */ - Gaudi::Property<bool> m_doTrackMatching {this, "doTrackMatching", true, - "Boolean to do track matching"}; + Gaudi::Property<bool> m_doTrackMatching{ this, + "doTrackMatching", + true, + "Boolean to do track matching" }; }; #endif diff --git a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx index 6180a6ac226168b22eb49d1174e238e4f59f4156..ae573e4b9019100c733812e45e775ea37a7657bd 100644 --- a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.cxx @@ -5,15 +5,15 @@ #include "photonSuperClusterBuilder.h" // #include "CaloDetDescr/CaloDetDescrManager.h" -#include "xAODCaloEvent/CaloClusterAuxContainer.h" +#include "egammaRecEvent/egammaRecContainer.h" #include "xAODCaloEvent/CaloCluster.h" +#include "xAODCaloEvent/CaloClusterAuxContainer.h" #include "xAODCaloEvent/CaloClusterKineHelper.h" -#include "egammaRecEvent/egammaRecContainer.h" #include "xAODEgamma/EgammaEnums.h" -#include "xAODEgamma/PhotonxAODHelpers.h" #include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODTracking/Vertex.h" +#include "xAODEgamma/PhotonxAODHelpers.h" #include "xAODTracking/TrackParticle.h" +#include "xAODTracking/Vertex.h" // #include "FourMomUtils/P4Helpers.h" @@ -24,17 +24,18 @@ #include <vector> ////////////////////////////////////////////////////////////////////////////// -//Athena interfaces. +// Athena interfaces. ////////////////////////////////////////////////////////////////////////////// -//Constructor. -photonSuperClusterBuilder::photonSuperClusterBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - egammaSuperClusterBuilder(name, pSvcLocator) -{ -} +// Constructor. +photonSuperClusterBuilder::photonSuperClusterBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : egammaSuperClusterBuilder(name, pSvcLocator) +{} -StatusCode photonSuperClusterBuilder::initialize() { +StatusCode +photonSuperClusterBuilder::initialize() +{ ATH_MSG_DEBUG(" Initializing photonSuperClusterBuilder"); // the data handle keys @@ -44,93 +45,90 @@ StatusCode photonSuperClusterBuilder::initialize() { // retrieve conversion builder if (m_doConversions) { - ATH_CHECK( m_conversionBuilder.retrieve() ); + ATH_CHECK(m_conversionBuilder.retrieve()); } return egammaSuperClusterBuilder::initialize(); } -StatusCode photonSuperClusterBuilder::finalize() { +StatusCode +photonSuperClusterBuilder::finalize() +{ return StatusCode::SUCCESS; } +StatusCode +photonSuperClusterBuilder::execute_r(const EventContext& ctx) const +{ -////////////////////////////////////////////////////////////////////////////// -//Functional routines. -////////////////////////////////////////////////////////////////////////////// - -StatusCode photonSuperClusterBuilder::execute(){ - - //Retrieve input egammaRec container. - SG::ReadHandle<EgammaRecContainer> egammaRecs(m_inputEgammaRecContainerKey); + // Retrieve input egammaRec container. + SG::ReadHandle<EgammaRecContainer> egammaRecs(m_inputEgammaRecContainerKey, ctx); // check is only used for serial running; remove when MT scheduler used - if(!egammaRecs.isValid()) { - ATH_MSG_ERROR("Failed to retrieve "<< m_inputEgammaRecContainerKey.key()); + if (!egammaRecs.isValid()) { + ATH_MSG_ERROR("Failed to retrieve " << m_inputEgammaRecContainerKey.key()); return StatusCode::FAILURE; } - //Have to register cluster container in order to properly get cluster links. - SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer(m_outputPhotonSuperClustersKey); + // Have to register cluster container in order to properly get cluster links. + SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer( + m_outputPhotonSuperClustersKey,ctx); ATH_CHECK(outputClusterContainer.record(std::make_unique<xAOD::CaloClusterContainer>(), - std::make_unique<xAOD::CaloClusterAuxContainer>())); - + std::make_unique<xAOD::CaloClusterAuxContainer>())); - //Create the new Photon Super Cluster based EgammaRecContainer - SG::WriteHandle<EgammaRecContainer> newEgammaRecs(m_photonSuperRecCollectionKey); + // Create the new Photon Super Cluster based EgammaRecContainer + SG::WriteHandle<EgammaRecContainer> newEgammaRecs(m_photonSuperRecCollectionKey,ctx); ATH_CHECK(newEgammaRecs.record(std::make_unique<EgammaRecContainer>())); - //The calo Det Descr manager + // The calo Det Descr manager const CaloDetDescrManager* calodetdescrmgr = nullptr; - ATH_CHECK( detStore()->retrieve(calodetdescrmgr,"CaloMgr") ); + ATH_CHECK(detStore()->retrieve(calodetdescrmgr, "CaloMgr")); + // Loop over input egammaRec objects, build superclusters. + std::vector<bool> isUsed(egammaRecs->size(), 0); - //Loop over input egammaRec objects, build superclusters. - std::vector<bool> isUsed (egammaRecs->size(),0); - - for (std::size_t i = 0 ; i < egammaRecs->size();++i) { - //Used to revert status of topos - //in case we fail to make a supercluser. + for (std::size_t i = 0; i < egammaRecs->size(); ++i) { + // Used to revert status of topos + // in case we fail to make a supercluser. std::vector<bool> isUsedRevert(isUsed); - const auto egRec=egammaRecs->at(i); + const auto egRec = egammaRecs->at(i); const auto clus = egRec->caloCluster(); - //First some basic seed cuts - if(isUsed.at(i)){ - continue; + // First some basic seed cuts + if (isUsed.at(i)) { + continue; } - //The seed should have 2nd sampling - if (!clus->hasSampling(CaloSampling::EMB2) && !clus->hasSampling(CaloSampling::EME2)){ + // The seed should have 2nd sampling + if (!clus->hasSampling(CaloSampling::EMB2) && !clus->hasSampling(CaloSampling::EME2)) { continue; } const double eta2 = fabs(clus->etaBE(2)); - if(eta2>10){ + if (eta2 > 10) { continue; - } - //Accordeon Energy samplings 1 to 3 - const double EMAccEnergy= clus->energyBE(1)+clus->energyBE(2)+clus->energyBE(3); - const double EMAccEt = EMAccEnergy/cosh(eta2); - //Require minimum energy for supercluster seeding. - if (EMAccEt < m_EtThresholdCut){ + } + // Accordeon Energy samplings 1 to 3 + const double EMAccEnergy = clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3); + const double EMAccEt = EMAccEnergy / cosh(eta2); + // Require minimum energy for supercluster seeding. + if (EMAccEt < m_EtThresholdCut) { continue; } - //Passed preliminary custs - ATH_MSG_DEBUG("Creating supercluster egammaRec photon object "<< 'n' - << "Using cluster Et = " << clus->et() - << " EM Accordeon Et " << EMAccEt); - //So it is used - isUsed.at(i)=1; - //Start accumulating - std::vector<const xAOD::CaloCluster*> accumulatedClusters; + // Passed preliminary custs + ATH_MSG_DEBUG("Creating supercluster egammaRec photon object " + << 'n' << "Using cluster Et = " << clus->et() << " EM Accordeon Et " << EMAccEt); + // So it is used + isUsed.at(i) = 1; + // Start accumulating + std::vector<const xAOD::CaloCluster*> accumulatedClusters; accumulatedClusters.push_back(clus); - //Core Logic goes here + // Core Logic goes here ATH_MSG_DEBUG("Find secondary clusters"); // for stats int nWindowClusters = 0; int nExtraClusters = 0; - const std::vector<std::size_t> secondaryClusters = + const std::vector<std::size_t> secondaryClusters = searchForSecondaryClusters(i, egammaRecs.cptr(), isUsed, nWindowClusters, nExtraClusters); for (auto secClus : secondaryClusters) { @@ -138,54 +136,55 @@ StatusCode photonSuperClusterBuilder::execute(){ accumulatedClusters.push_back(secRec->caloCluster()); // no need to add vertices } - //End of core Logic + // End of core Logic - //Create the new cluster + // Create the new cluster ATH_MSG_DEBUG("Set up new Cluster"); - auto egType = (egRec->getNumberOfVertices() > 0) ? - xAOD::EgammaParameters::convertedPhoton : - xAOD::EgammaParameters::unconvertedPhoton; + auto egType = (egRec->getNumberOfVertices() > 0) ? xAOD::EgammaParameters::convertedPhoton + : xAOD::EgammaParameters::unconvertedPhoton; - std::unique_ptr<xAOD::CaloCluster> newCluster = createNewCluster(accumulatedClusters, *calodetdescrmgr, egType); + std::unique_ptr<xAOD::CaloCluster> newCluster = + createNewCluster(ctx, accumulatedClusters, *calodetdescrmgr, egType); if (!newCluster) { ATH_MSG_DEBUG("Creating a new cluster failed"); - //Revert status of constituent clusters. + // Revert status of constituent clusters. isUsed = isUsedRevert; continue; } ATH_MSG_DEBUG("window clusters: " << nWindowClusters); ATH_MSG_DEBUG("extra clusters: " << nExtraClusters); - - //push back the new photon super cluster + + // push back the new photon super cluster outputClusterContainer->push_back(std::move(newCluster)); - //Add the cluster link to the super cluster - ElementLink< xAOD::CaloClusterContainer > clusterLink(*outputClusterContainer, outputClusterContainer->size() - 1); - std::vector< ElementLink<xAOD::CaloClusterContainer> > phCluster {clusterLink}; + // Add the cluster link to the super cluster + ElementLink<xAOD::CaloClusterContainer> clusterLink(*outputClusterContainer, + outputClusterContainer->size() - 1); + std::vector<ElementLink<xAOD::CaloClusterContainer>> phCluster{ clusterLink }; /////////////////////////////////////////////////////// - //Now create the new eg Rec + // Now create the new eg Rec auto newEgRec = std::make_unique<egammaRec>(*egRec); if (newEgRec) { newEgRec->setCaloClusters(phCluster); - //push it back + // push it back newEgammaRecs->push_back(std::move(newEgRec)); ATH_MSG_DEBUG("Finished making photon egammaRec object"); } else { ATH_MSG_FATAL("Couldn't make an egammaRec object"); return StatusCode::FAILURE; } - } //End loop on egammaRecs + } // End loop on egammaRecs - //Redo conversion matching given the super cluster + // Redo conversion matching given the super cluster if (m_doConversions) { for (auto egRec : *newEgammaRecs) { - if (m_conversionBuilder->executeRec(Gaudi::Hive::currentContext(),egRec).isFailure()){ - ATH_MSG_ERROR("Problem executing conversioBuilder on photonSuperRecs"); - return StatusCode::FAILURE; + if (m_conversionBuilder->executeRec(ctx, egRec).isFailure()) { + ATH_MSG_ERROR("Problem executing conversioBuilder on photonSuperRecs"); + return StatusCode::FAILURE; } } } @@ -193,12 +192,12 @@ StatusCode photonSuperClusterBuilder::execute(){ return StatusCode::SUCCESS; } -std::vector<std::size_t> +std::vector<std::size_t> photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd, - const EgammaRecContainer *egammaRecs, - std::vector<bool>& isUsed, - int& nWindowClusters, - int& nExtraClusters) const + const EgammaRecContainer* egammaRecs, + std::vector<bool>& isUsed, + int& nWindowClusters, + int& nExtraClusters) const { std::vector<std::size_t> secondaryClusters; @@ -218,7 +217,7 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd, std::vector<const xAOD::Vertex*> seedVertices; std::vector<xAOD::EgammaParameters::ConversionType> seedVertexType; std::vector<const xAOD::TrackParticle*> seedVertexTracks; // tracks from conversion vertex - + auto numVertices = seedPhoton->getNumberOfVertices(); if (m_useOnlyLeadingVertex && numVertices > 0) { numVertices = 1; @@ -229,11 +228,10 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd, const auto convType = xAOD::EgammaHelpers::conversionType(vertex); seedVertices.push_back(vertex); seedVertexType.push_back(convType); - const bool addTracks = !m_useOnlySi || - convType == xAOD::EgammaParameters::singleSi || - convType == xAOD::EgammaParameters::doubleSi; + const bool addTracks = !m_useOnlySi || convType == xAOD::EgammaParameters::singleSi || + convType == xAOD::EgammaParameters::doubleSi; if (addTracks) { - for (unsigned int tp=0; tp < vertex->nTrackParticles(); ++tp){ + for (unsigned int tp = 0; tp < vertex->nTrackParticles(); ++tp) { seedVertexTracks.push_back(vertex->trackParticle(tp)); } } @@ -241,32 +239,29 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd, // Now loop over the potential secondary clusters for (std::size_t i = 0; i < egammaRecs->size(); ++i) { - - //First some basic seed cuts - if(isUsed.at(i)){ - continue; + + // First some basic seed cuts + if (isUsed.at(i)) { + continue; } - + const auto egRec = egammaRecs->at(i); const auto caloClus = egRec->caloCluster(); if (!caloClus) { ATH_MSG_WARNING("The potentially secondary egammaRec does not have a cluster"); continue; - } + } // Now perform a number of tests to see if the cluster should be added bool addCluster = false; - if (m_addClustersInWindow && - matchesInWindow(seedCaloClus, caloClus)) { - ATH_MSG_DEBUG("Cluster with Et : " << caloClus->et()<< " matched in window"); + if (m_addClustersInWindow && matchesInWindow(seedCaloClus, caloClus)) { + ATH_MSG_DEBUG("Cluster with Et : " << caloClus->et() << " matched in window"); nWindowClusters++; addCluster = true; - } else if (m_addClustersMatchingVtx && - matchesVtx(seedVertices, seedVertexType, egRec)) { + } else if (m_addClustersMatchingVtx && matchesVtx(seedVertices, seedVertexType, egRec)) { ATH_MSG_DEBUG("conversion vertices match"); addCluster = true; nExtraClusters++; - } else if (m_addClustersMatchingVtxTracks && - matchesVtxTrack(seedVertexTracks, egRec)) { + } else if (m_addClustersMatchingVtxTracks && matchesVtxTrack(seedVertexTracks, egRec)) { ATH_MSG_DEBUG("conversion track match"); addCluster = true; nExtraClusters++; @@ -274,15 +269,17 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd, if (addCluster) { secondaryClusters.push_back(i); isUsed[i] = true; - } + } } - ATH_MSG_DEBUG("Found: " << secondaryClusters.size()<< " secondaries"); + ATH_MSG_DEBUG("Found: " << secondaryClusters.size() << " secondaries"); return secondaryClusters; } -bool photonSuperClusterBuilder::matchesVtx(const std::vector<const xAOD::Vertex*>& seedVertices, - const std::vector<xAOD::EgammaParameters::ConversionType>& seedVertexType, - const egammaRec *egRec) const +bool +photonSuperClusterBuilder::matchesVtx( + const std::vector<const xAOD::Vertex*>& seedVertices, + const std::vector<xAOD::EgammaParameters::ConversionType>& seedVertexType, + const egammaRec* egRec) const { auto numTestVertices = egRec->getNumberOfVertices(); @@ -290,10 +287,9 @@ bool photonSuperClusterBuilder::matchesVtx(const std::vector<const xAOD::Vertex* numTestVertices = 1; } for (size_t seedVx = 0; seedVx < seedVertices.size(); ++seedVx) { - if (!m_useOnlySi || - seedVertexType[seedVx] == xAOD::EgammaParameters::singleSi || + if (!m_useOnlySi || seedVertexType[seedVx] == xAOD::EgammaParameters::singleSi || seedVertexType[seedVx] == xAOD::EgammaParameters::doubleSi) { - + for (size_t testVx = 0; testVx < numTestVertices; ++testVx) { if (seedVertices[seedVx] == egRec->vertex(testVx)) { return true; @@ -304,8 +300,10 @@ bool photonSuperClusterBuilder::matchesVtx(const std::vector<const xAOD::Vertex* return false; } -bool photonSuperClusterBuilder::matchesVtxTrack(const std::vector<const xAOD::TrackParticle*>& seedVertexTracks, - const egammaRec *egRec) const +bool +photonSuperClusterBuilder::matchesVtxTrack( + const std::vector<const xAOD::TrackParticle*>& seedVertexTracks, + const egammaRec* egRec) const { auto numTestTracks = egRec->getNumberOfTrackParticles(); if (m_useOnlyLeadingTrack && numTestTracks > 0) { diff --git a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h index b1483e1864566ef8dc11a0c669d2e8a2f9a35300..b5408a0c199e5375640ba1b2e39b13fba9fc506d 100644 --- a/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/photonSuperClusterBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_PHOTONSUPERCLUSTERBUILDER_H @@ -10,98 +10,141 @@ #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" +#include "GaudiKernel/EventContext.h" -//Fwd declarations +// Fwd declarations +#include "egammaInterfaces/IEMConversionBuilder.h" #include "egammaRecEvent/egammaRecContainer.h" -#include "xAODEgamma/EgammaEnums.h" #include "xAODCaloEvent/CaloClusterContainer.h" -#include "egammaInterfaces/IEMConversionBuilder.h" - -class photonSuperClusterBuilder : public egammaSuperClusterBuilder { +#include "xAODEgamma/EgammaEnums.h" - public: +class photonSuperClusterBuilder : public egammaSuperClusterBuilder +{ - //Constructor/destructor. +public: + // Constructor/destructor. photonSuperClusterBuilder(const std::string& name, ISvcLocator* pSvcLocator); - //Tool standard routines. + // Tool standard routines. virtual StatusCode initialize() override final; virtual StatusCode finalize() override final; - virtual StatusCode execute() override final; - - private: + virtual StatusCode execute() override final + { + return execute_r(Algorithm::getContext()); + } + // This will become the normal execute when + // inheriting from AthReentrantAlgorithm + StatusCode execute_r(const EventContext& ctx) const; + +private: /** Return extra clusters that can be added to make supercluster */ - std::vector<std::size_t> - searchForSecondaryClusters(std::size_t photonInd, - const EgammaRecContainer *egammaRecs, - std::vector<bool>& isUsed, - int& nWindowClusters, - int& nExtraClusters) const; + std::vector<std::size_t> searchForSecondaryClusters( + std::size_t photonInd, + const EgammaRecContainer* egammaRecs, + std::vector<bool>& isUsed, + int& nWindowClusters, + int& nExtraClusters) const; /** Does the cluster share conversion vertex? */ - bool matchesVtx(const std::vector<const xAOD::Vertex*>& seedVertices, - const std::vector<xAOD::EgammaParameters::ConversionType>& seedVertexType, - const egammaRec *egRec) const; + bool matchesVtx( + const std::vector<const xAOD::Vertex*>& seedVertices, + const std::vector<xAOD::EgammaParameters::ConversionType>& seedVertexType, + const egammaRec* egRec) const; /** Does the cluster match a conversion vertex track with the seed? */ - bool matchesVtxTrack(const std::vector<const xAOD::TrackParticle*>& seedVertexTracks, - const egammaRec *egRec) const; + bool matchesVtxTrack( + const std::vector<const xAOD::TrackParticle*>& seedVertexTracks, + const egammaRec* egRec) const; ///////////////////////////////////////////////////////////////////// - //internal variables + // internal variables /** @brief Key for input egammaRec container */ - SG::ReadHandleKey<EgammaRecContainer> m_inputEgammaRecContainerKey {this, - "InputEgammaRecContainerName", "egammaRecCollection", - "input egammaRec container"}; + SG::ReadHandleKey<EgammaRecContainer> m_inputEgammaRecContainerKey{ + this, + "InputEgammaRecContainerName", + "egammaRecCollection", + "input egammaRec container" + }; /** @brief Key for output egammaRec container */ - SG::WriteHandleKey<EgammaRecContainer> m_photonSuperRecCollectionKey {this, - "SuperPhotonRecCollectionName", "PhotonSuperRecCollection", - "output egammaRec container"}; + SG::WriteHandleKey<EgammaRecContainer> m_photonSuperRecCollectionKey{ + this, + "SuperPhotonRecCollectionName", + "PhotonSuperRecCollection", + "output egammaRec container" + }; /** @brief Key for output clusters */ - SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputPhotonSuperClustersKey {this, - "SuperClusterCollestionName", "PhotonSuperClusters", - "output calo cluster container"}; + SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputPhotonSuperClustersKey{ + this, + "SuperClusterCollestionName", + "PhotonSuperClusters", + "output calo cluster container" + }; /** @brief Tool to retrieve the conversions*/ - ToolHandle<IEMConversionBuilder> m_conversionBuilder {this, - "ConversionBuilderTool", "EMConversionBuilder", - "Tool that matches conversion vertices to egammaRecs"}; + ToolHandle<IEMConversionBuilder> m_conversionBuilder{ + this, + "ConversionBuilderTool", + "EMConversionBuilder", + "Tool that matches conversion vertices to egammaRecs" + }; // options for how to build superclusters /** @brief add the topoclusters in window */ - Gaudi::Property<bool> m_addClustersInWindow {this, - "AddClustersInWindow", true, "add the topoclusters in window"}; + Gaudi::Property<bool> m_addClustersInWindow{ + this, + "AddClustersInWindow", + true, + "add the topoclusters in window" + }; /** @brief add the topoclusters matching conversion vertex */ - Gaudi::Property<bool> m_addClustersMatchingVtx {this, - "AddClustersMatchingVtx", true, - "add the topoclusters matching conversion vertex"}; + Gaudi::Property<bool> m_addClustersMatchingVtx{ + this, + "AddClustersMatchingVtx", + true, + "add the topoclusters matching conversion vertex" + }; /** @brief use only the leading vertex for matching */ - Gaudi::Property<bool> m_useOnlyLeadingVertex {this, - "UseOnlyLeadingVertex", true, - "use only the leading vertex for matching"}; + Gaudi::Property<bool> m_useOnlyLeadingVertex{ + this, + "UseOnlyLeadingVertex", + true, + "use only the leading vertex for matching" + }; /** @brief use only vertices/tracks with silicon tracks */ - Gaudi::Property<bool> m_useOnlySi {this, "UseOnlySi", true, - "use only vertices/tracks with silicon tracks for adding sec. clusters (Mix not considered Si)"}; - + Gaudi::Property<bool> m_useOnlySi{ + this, + "UseOnlySi", + true, + "use only vertices/tracks with silicon tracks for adding sec. clusters " + "(Mix not considered Si)" + }; + /** @brief add the topoclusters matching conversion vertex tracks */ - Gaudi::Property<bool> m_addClustersMatchingVtxTracks {this, - "AddClustrsMatchingVtxTracks", true, - "add the topoclusters matching conversion vertex tracks"}; + Gaudi::Property<bool> m_addClustersMatchingVtxTracks{ + this, + "AddClustrsMatchingVtxTracks", + true, + "add the topoclusters matching conversion vertex tracks" + }; /** @brief use only the leading track for matching */ - Gaudi::Property<bool> m_useOnlyLeadingTrack {this, - "UseOnlyLeadingTrack", true, - "use only the leading track for matching"}; + Gaudi::Property<bool> m_useOnlyLeadingTrack{ + this, + "UseOnlyLeadingTrack", + true, + "use only the leading track for matching" + }; /** @brief private member flag to do the conversion building and matching */ - Gaudi::Property<bool> m_doConversions {this, "doConversions", true, - "Boolean to do conversion matching"}; - + Gaudi::Property<bool> m_doConversions{ this, + "doConversions", + true, + "Boolean to do conversion matching" }; }; #endif diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx index 1a0e3818e05da6bdf1f59ffd103494a7d5defb2f..ffcf15bbd734994bcb5cbef86934c634ee853660 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx @@ -3,191 +3,190 @@ */ #include "topoEgammaBuilder.h" -#include "smallChrono.h" #include "AthenaKernel/errorcheck.h" +#include "GaudiKernel/EventContext.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/EventContext.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "xAODEgamma/EgammaContainer.h" -#include "xAODEgamma/ElectronAuxContainer.h" -#include "xAODEgamma/PhotonAuxContainer.h" #include "egammaRecEvent/egammaRecContainer.h" +#include "xAODEgamma/EgammaContainer.h" #include "xAODEgamma/Electron.h" +#include "xAODEgamma/ElectronAuxContainer.h" +#include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/Photon.h" - +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" // INCLUDE GAUDI HEADER FILES: -#include <algorithm> +#include <algorithm> #include <cmath> +topoEgammaBuilder::topoEgammaBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) +{} -topoEgammaBuilder::topoEgammaBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthReentrantAlgorithm(name, pSvcLocator), - m_timingProfile("ChronoStatSvc", name) -{ -} - -StatusCode topoEgammaBuilder::initialize() +StatusCode +topoEgammaBuilder::initialize() { - - ATH_MSG_DEBUG("Initializing topoEgammaBuilder"); - // the data handle keys ATH_CHECK(m_electronSuperClusterRecContainerKey.initialize(m_doElectrons)); ATH_CHECK(m_photonSuperClusterRecContainerKey.initialize(m_doPhotons)); ATH_CHECK(m_electronOutputKey.initialize()); ATH_CHECK(m_photonOutputKey.initialize()); // retrieve tools - ATH_MSG_DEBUG("Retrieving " << m_egammaTools.size() << " tools for egamma objects"); - ATH_CHECK( m_clusterTool.retrieve() ); - ATH_CHECK( m_ShowerTool.retrieve() ); - ATH_CHECK( m_egammaTools.retrieve() ); - - if ( m_doElectrons ){ - ATH_MSG_DEBUG("Retrieving " << m_electronTools.size() << " tools for electrons"); - ATH_CHECK( m_electronTools.retrieve() ); + ATH_CHECK(m_clusterTool.retrieve()); + ATH_CHECK(m_ShowerTool.retrieve()); + ATH_CHECK(m_egammaTools.retrieve()); + + if (m_doElectrons) { + ATH_CHECK(m_electronTools.retrieve()); } - if ( m_doPhotons ){ - ATH_MSG_DEBUG("Retrieving " << m_photonTools.size() << " tools for photons"); - ATH_CHECK( m_photonTools.retrieve() ); + if (m_doPhotons) { + ATH_CHECK(m_photonTools.retrieve()); + } + m_doOQ = !m_egammaOQTool.empty(); + if (m_doOQ) { + ATH_CHECK(m_egammaOQTool.retrieve()); + }else{ + m_egammaOQTool.disable(); } - if ( m_doElectrons && m_doPhotons ){ - ATH_MSG_DEBUG("Retrieving ambiguity tool"); - if (not m_ambiguityTool.isSet()) { - ATH_MSG_DEBUG("Ambiguity tool IS NOT set. Not using it"); - } - else { - ATH_CHECK( m_ambiguityTool.retrieve() ); - } + //do we actually do ambiguity + m_doAmbiguity = !m_ambiguityTool.empty(); + if (m_doElectrons && m_doPhotons && m_doAmbiguity) { + ATH_CHECK(m_ambiguityTool.retrieve()); + }else{ + m_ambiguityTool.disable(); } - - // retrieve timing profile - if (m_doChrono) CHECK( m_timingProfile.retrieve() ); - ATH_MSG_DEBUG("Initialization completed successfully"); return StatusCode::SUCCESS; } -StatusCode topoEgammaBuilder::finalize(){ +StatusCode +topoEgammaBuilder::finalize() +{ return StatusCode::SUCCESS; } -StatusCode topoEgammaBuilder::execute(const EventContext& ctx) const{ +StatusCode +topoEgammaBuilder::execute(const EventContext& ctx) const +{ // Chrono name for each Tool const EgammaRecContainer* inputElRecs = nullptr; const EgammaRecContainer* inputPhRecs = nullptr; xAOD::ElectronContainer* electrons = nullptr; xAOD::PhotonContainer* photons = nullptr; - /* - * From here one if a Read/Write handle is retrieved the above will be != nullptr - * for electron or photons or both + /* + * From here one if a Read/Write handle is retrieved the above will be != + * nullptr for electron or photons or both */ - if (m_doElectrons){ + if (m_doElectrons) { SG::ReadHandle<EgammaRecContainer> electronSuperRecs(m_electronSuperClusterRecContainerKey, ctx); - inputElRecs=electronSuperRecs.ptr(); + inputElRecs = electronSuperRecs.ptr(); } - if (m_doPhotons){ + if (m_doPhotons) { SG::ReadHandle<EgammaRecContainer> photonSuperRecs(m_photonSuperClusterRecContainerKey, ctx); - inputPhRecs=photonSuperRecs.ptr(); + inputPhRecs = photonSuperRecs.ptr(); } - + SG::WriteHandle<xAOD::ElectronContainer> electronContainer(m_electronOutputKey, ctx); + ATH_CHECK(electronContainer.record(std::make_unique<xAOD::ElectronContainer>(), - std::make_unique<xAOD::ElectronAuxContainer>())); + std::make_unique<xAOD::ElectronAuxContainer>())); - SG::WriteHandle<xAOD::PhotonContainer> photonContainer(m_photonOutputKey, ctx); + SG::WriteHandle<xAOD::PhotonContainer> photonContainer(m_photonOutputKey,ctx); + ATH_CHECK(photonContainer.record(std::make_unique<xAOD::PhotonContainer>(), std::make_unique<xAOD::PhotonAuxContainer>())); - electrons=electronContainer.ptr(); - photons=photonContainer.ptr(); + + electrons = electronContainer.ptr(); + photons = photonContainer.ptr(); /* * Now fill the electrons and photons - */ - if (m_doElectrons){ - for (const egammaRec* electronRec : *inputElRecs) { - //in case for some reasons we reach here with no trackparticles - if(electronRec->getNumberOfTrackParticles()==0){ + */ + if (m_doElectrons) { + for (const egammaRec* electronRec : *inputElRecs) { + // in case for some reasons we reach here with no trackparticles + if (electronRec->getNumberOfTrackParticles() == 0) { continue; } unsigned int author = xAOD::EgammaParameters::AuthorElectron; - xAOD::AmbiguityTool::AmbiguityType type= xAOD::AmbiguityTool::electron; - if(m_doPhotons){ + xAOD::AmbiguityTool::AmbiguityType type = xAOD::AmbiguityTool::electron; + if (m_doPhotons) { // get the hottest cell - const xAOD::CaloCluster *const elClus = electronRec->caloCluster(); + const xAOD::CaloCluster* const elClus = electronRec->caloCluster(); const double elEta0 = elClus->eta0(); const double elPhi0 = elClus->phi0(); for (const egammaRec* photonRec : *inputPhRecs) { - const xAOD::CaloCluster *const phClus = photonRec->caloCluster(); - //See if they have the same hottest cell + const xAOD::CaloCluster* const phClus = photonRec->caloCluster(); + // See if they have the same hottest cell if (elEta0 == phClus->eta0() && elPhi0 == phClus->phi0()) { - if (m_ambiguityTool.isSet()) { // should be the default - author = m_ambiguityTool->ambiguityResolve(elClus, - photonRec->vertex(), - electronRec->trackParticle(), - type); - } - else { // in case the ambiguity tool is not set ambiguity is not resolved + if (m_doAmbiguity) { // should be the default + author = + m_ambiguityTool->ambiguityResolve(elClus, + photonRec->vertex(), + electronRec->trackParticle(), + type); + } else { // in case the ambiguity tool is not set ambiguity is not + // resolved author = xAOD::EgammaParameters::AuthorAmbiguous; } break; } } } - //Create Electron xAOD objects - if (author == xAOD::EgammaParameters::AuthorElectron || - author == xAOD::EgammaParameters::AuthorAmbiguous){ - if ( !getElectron(electronRec, electrons, author,type) ){ + // Create Electron xAOD objects + if (author == xAOD::EgammaParameters::AuthorElectron || + author == xAOD::EgammaParameters::AuthorAmbiguous) { + if (!getElectron(electronRec, electrons, author, type)) { return StatusCode::FAILURE; } } } } - if (m_doPhotons){ + if (m_doPhotons) { for (const egammaRec* photonRec : *inputPhRecs) { unsigned int author = xAOD::EgammaParameters::AuthorPhoton; - xAOD::AmbiguityTool::AmbiguityType type= xAOD::AmbiguityTool::photon; - if (m_doElectrons){ + xAOD::AmbiguityTool::AmbiguityType type = xAOD::AmbiguityTool::photon; + if (m_doElectrons) { // get the hottest cell - const xAOD::CaloCluster *const phClus = photonRec->caloCluster(); + const xAOD::CaloCluster* const phClus = photonRec->caloCluster(); const double phEta0 = phClus->eta0(); const double phPhi0 = phClus->phi0(); for (const egammaRec* electronRec : *inputElRecs) { - const xAOD::CaloCluster *const elClus = electronRec->caloCluster(); - //See if they have the same hottest cell + const xAOD::CaloCluster* const elClus = electronRec->caloCluster(); + // See if they have the same hottest cell if (phEta0 == elClus->eta0() && phPhi0 == elClus->phi0()) { - if (m_ambiguityTool.isSet()) { // should be the default - author = m_ambiguityTool->ambiguityResolve(elClus, - photonRec->vertex(), - electronRec->trackParticle(), - type); - } - else { // in case the ambiguity tool is not set ambiguity is not resolved + if (m_doAmbiguity) { // should be the default + author = + m_ambiguityTool->ambiguityResolve(elClus, + photonRec->vertex(), + electronRec->trackParticle(), + type); + } else { // in case the ambiguity tool is not set ambiguity is not + // resolved author = xAOD::EgammaParameters::AuthorAmbiguous; } break; } } } - //Create Photon xAOD objects - if (author == xAOD::EgammaParameters::AuthorPhoton || - author == xAOD::EgammaParameters::AuthorAmbiguous){ - if ( !getPhoton(photonRec, photons, author,type) ){ + // Create Photon xAOD objects + if (author == xAOD::EgammaParameters::AuthorPhoton || + author == xAOD::EgammaParameters::AuthorAmbiguous) { + if (!getPhoton(photonRec, photons, author, type)) { return StatusCode::FAILURE; } } @@ -195,109 +194,123 @@ StatusCode topoEgammaBuilder::execute(const EventContext& ctx) const{ } const CaloDetDescrManager* calodetdescrmgr = nullptr; - ATH_CHECK( detStore()->retrieve(calodetdescrmgr,"CaloMgr") ); + ATH_CHECK(detStore()->retrieve(calodetdescrmgr, "CaloMgr")); - - /* - * Shower Shapes - */ - if(m_doElectrons){ - for (xAOD::Electron* electron : *electronContainer){ - ATH_CHECK(m_ShowerTool->execute(ctx,*calodetdescrmgr,electron)); + // Shower Shapes + if (m_doElectrons) { + for (xAOD::Electron* electron : *electronContainer) { + ATH_CHECK(m_ShowerTool->execute(ctx, *calodetdescrmgr, electron)); } } - if(m_doPhotons){ - for (xAOD::Photon* photon : *photonContainer){ - ATH_CHECK(m_ShowerTool->execute(ctx,*calodetdescrmgr,photon)); + if (m_doPhotons) { + for (xAOD::Photon* photon : *photonContainer) { + ATH_CHECK(m_ShowerTool->execute(ctx, *calodetdescrmgr, photon)); } } - /* - * Calibration - */ - if ( m_clusterTool->contExecute(ctx, *calodetdescrmgr,electrons , photons).isFailure() ){ - ATH_MSG_ERROR("Problem executing the " << m_clusterTool<<" tool"); + + // Object Quality + if (m_doOQ) { + if (m_doElectrons) { + for (xAOD::Electron* electron : *electronContainer) { + ATH_CHECK(m_egammaOQTool->execute(ctx, *calodetdescrmgr, *electron)); + } + } + if (m_doPhotons) { + for (xAOD::Photon* photon : *photonContainer) { + ATH_CHECK(m_egammaOQTool->execute(ctx, *calodetdescrmgr, *photon)); + } + } + } + + // Calibration + if (m_clusterTool->contExecute(ctx, *calodetdescrmgr, electrons, photons) + .isFailure()) { + ATH_MSG_ERROR("Problem executing the " << m_clusterTool << " tool"); return StatusCode::FAILURE; } - /* - * Tools for ToolHandleArrays - */ - /* First common photon/electron tools*/ - for (auto& tool : m_egammaTools){ - ATH_CHECK( CallTool(ctx, tool, electrons,photons) ); + + // Tools for ToolHandleArrays + // First common photon/electron tools*/ + for (auto& tool : m_egammaTools) { + ATH_CHECK(CallTool(ctx, tool, electrons, photons)); } - /* Tools for only electrons*/ - if(m_doElectrons){ - /* egammaBaseTools*/ - for (auto& tool : m_electronTools){ - ATH_CHECK( CallTool(ctx, tool, electrons, nullptr) ); + // Tools for only electrons + if (m_doElectrons) { + for (auto& tool : m_electronTools) { + ATH_CHECK(CallTool(ctx, tool, electrons, nullptr)); } } - /* Tools for only photons*/ - if(m_doPhotons){ - /* egammaBaseTools*/ - for (auto& tool : m_photonTools){ - ATH_CHECK( CallTool(ctx, tool, nullptr, photons) ); + // Tools for only photons + if (m_doPhotons) { + for (auto& tool : m_photonTools) { + ATH_CHECK(CallTool(ctx, tool, nullptr, photons)); } } - //Do the ambiguity Links - if (m_doElectrons && m_doPhotons){ - ATH_CHECK(doAmbiguityLinks (electrons,photons)); + // Do the ambiguity Links + if (m_doElectrons && m_doPhotons) { + ATH_CHECK(doAmbiguityLinks(electrons, photons)); } return StatusCode::SUCCESS; } +StatusCode +topoEgammaBuilder::doAmbiguityLinks( + xAOD::ElectronContainer* electronContainer, + xAOD::PhotonContainer* photonContainer) const +{ -StatusCode topoEgammaBuilder::doAmbiguityLinks(xAOD::ElectronContainer *electronContainer, - xAOD::PhotonContainer *photonContainer) const { - - ///Needs the same logic as the ambiguity after building the objects (make sure they are all valid) - static const SG::AuxElement::Accessor < std::vector< - ElementLink< xAOD::CaloClusterContainer > > > caloClusterLinks("constituentClusterLinks"); - static const SG::AuxElement::Accessor<ElementLink<xAOD::EgammaContainer> > ELink ("ambiguityLink"); - ElementLink<xAOD::EgammaContainer> dummylink; - for (auto && photonIndex : *photonContainer) { + /// Needs the same logic as the ambiguity after building the objects (make + /// sure they are all valid) + static const SG::AuxElement::Accessor< + std::vector<ElementLink<xAOD::CaloClusterContainer>>> + caloClusterLinks("constituentClusterLinks"); - xAOD::Photon* photon = photonIndex; - ELink(*photon)=dummylink; + static const SG::AuxElement::Accessor<ElementLink<xAOD::EgammaContainer>> + ELink("ambiguityLink"); - if(photon->author()!= xAOD::EgammaParameters::AuthorAmbiguous){ + ElementLink<xAOD::EgammaContainer> dummylink; + for (xAOD::Photon* photon : *photonContainer) { + ELink(*photon) = dummylink; + if (photon->author() != xAOD::EgammaParameters::AuthorAmbiguous) { continue; - } + } - for (size_t electronIndex=0; electronIndex < electronContainer->size() ; ++electronIndex) { + for (size_t electronIndex = 0; electronIndex < electronContainer->size(); + ++electronIndex) { - xAOD::Electron* electron = electronContainer->at(electronIndex); - if(electron->author()!= xAOD::EgammaParameters::AuthorAmbiguous){ + xAOD::Electron* electron = electronContainer->at(electronIndex); + if (electron->author() != xAOD::EgammaParameters::AuthorAmbiguous) { continue; } - if(caloClusterLinks(*(electron->caloCluster())).at(0) == - caloClusterLinks(*(photon->caloCluster())).at(0)){ - ElementLink<xAOD::EgammaContainer> link (*electronContainer,electronIndex); - ELink(*photon)=link; + if (caloClusterLinks(*(electron->caloCluster())).at(0) == + caloClusterLinks(*(photon->caloCluster())).at(0)) { + ElementLink<xAOD::EgammaContainer> link(*electronContainer, + electronIndex); + ELink(*photon) = link; break; } } } - for (auto && electronIndex : *electronContainer) { - xAOD::Electron* electron = electronIndex; - ELink(*electron)=dummylink; - if(electron->author()!= xAOD::EgammaParameters::AuthorAmbiguous){ + for (xAOD::Electron* electron : *electronContainer) { + ELink(*electron) = dummylink; + if (electron->author() != xAOD::EgammaParameters::AuthorAmbiguous) { continue; - } - for (size_t photonIndex=0; photonIndex < photonContainer->size() ; ++photonIndex) { + } + for (size_t photonIndex = 0; photonIndex < photonContainer->size(); + ++photonIndex) { - xAOD::Photon* photon = photonContainer->at(photonIndex); - if(photon->author()!= xAOD::EgammaParameters::AuthorAmbiguous){ + xAOD::Photon* photon = photonContainer->at(photonIndex); + if (photon->author() != xAOD::EgammaParameters::AuthorAmbiguous) { continue; } - if(caloClusterLinks(*(electron->caloCluster())).at(0) == - caloClusterLinks(*(photon->caloCluster())).at(0)){ - ElementLink<xAOD::EgammaContainer> link (*photonContainer,photonIndex); - ELink(*electron)=link; + if (caloClusterLinks(*(electron->caloCluster())).at(0) == + caloClusterLinks(*(photon->caloCluster())).at(0)) { + ElementLink<xAOD::EgammaContainer> link(*photonContainer, photonIndex); + ELink(*electron) = link; break; } } @@ -305,125 +318,145 @@ StatusCode topoEgammaBuilder::doAmbiguityLinks(xAOD::ElectronContainer *electron return StatusCode::SUCCESS; } -StatusCode topoEgammaBuilder::CallTool(const EventContext& ctx, - const ToolHandle<IegammaBaseTool>& tool, - xAOD::ElectronContainer *electronContainer /* = 0*/, - xAOD::PhotonContainer *photonContainer /* = 0*/) const{ - - - smallChrono timer(*m_timingProfile,this->name()+"_"+tool->name(), m_doChrono); +StatusCode +topoEgammaBuilder::CallTool( + const EventContext& ctx, + const ToolHandle<IegammaBaseTool>& tool, + xAOD::ElectronContainer* electronContainer /* = 0*/, + xAOD::PhotonContainer* photonContainer /* = 0*/) const +{ - if (electronContainer){ - for (xAOD::Electron* electron : *electronContainer){ - if (tool->execute(ctx, electron).isFailure() ){ + if (electronContainer) { + for (xAOD::Electron* electron : *electronContainer) { + if (tool->execute(ctx, electron).isFailure()) { ATH_MSG_ERROR("Problem executing tool on electrons: " << tool); return StatusCode::FAILURE; } } } - if (photonContainer){ - for (xAOD::Photon* photon : *photonContainer){ - if (tool->execute(ctx, photon).isFailure() ){ + if (photonContainer) { + for (xAOD::Photon* photon : *photonContainer) { + if (tool->execute(ctx, photon).isFailure()) { ATH_MSG_ERROR("Problem executing tool on photons: " << tool); return StatusCode::FAILURE; } } - } + } return StatusCode::SUCCESS; } -bool topoEgammaBuilder::getElectron(const egammaRec* egRec, - xAOD::ElectronContainer *electronContainer, - const unsigned int author, - const uint8_t type) const{ +bool +topoEgammaBuilder::getElectron(const egammaRec* egRec, + xAOD::ElectronContainer* electronContainer, + const unsigned int author, + const uint8_t type) const +{ - if (!egRec || !electronContainer) return false; + if (!egRec || !electronContainer){ + return false; + } - xAOD::Electron *electron = new xAOD::Electron(); - electronContainer->push_back( electron ); - electron->setAuthor( author ); + xAOD::Electron* electron = new xAOD::Electron(); + electronContainer->push_back(electron); + electron->setAuthor(author); static const SG::AuxElement::Accessor<uint8_t> acc("ambiguityType"); acc(*electron) = type; - std::vector< ElementLink< xAOD::CaloClusterContainer > > clusterLinks; - for (size_t i = 0 ; i < egRec->getNumberOfClusters(); ++i){ - clusterLinks.push_back( egRec->caloClusterElementLink(i) ); + std::vector<ElementLink<xAOD::CaloClusterContainer>> clusterLinks; + for (size_t i = 0; i < egRec->getNumberOfClusters(); ++i) { + clusterLinks.push_back(egRec->caloClusterElementLink(i)); } - electron->setCaloClusterLinks( clusterLinks ); + electron->setCaloClusterLinks(clusterLinks); - std::vector< ElementLink< xAOD::TrackParticleContainer > > trackLinks; - for (size_t i = 0 ; i < egRec->getNumberOfTrackParticles(); ++i){ - trackLinks.push_back( egRec->trackParticleElementLink(i) ); + std::vector<ElementLink<xAOD::TrackParticleContainer>> trackLinks; + for (size_t i = 0; i < egRec->getNumberOfTrackParticles(); ++i) { + trackLinks.push_back(egRec->trackParticleElementLink(i)); } - electron->setTrackParticleLinks( trackLinks ); + electron->setTrackParticleLinks(trackLinks); electron->setCharge(electron->trackParticle()->charge()); - //Set DeltaEta, DeltaPhi , DeltaPhiRescaled - std::array<double,4> deltaEta = egRec->deltaEta(); - std::array<double,4> deltaPhi = egRec->deltaPhi(); - std::array<double,4> deltaPhiRescaled = egRec->deltaPhiRescaled(); - - electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[0]),xAOD::EgammaParameters::deltaEta0); - electron->setTrackCaloMatchValue(static_cast<float> (deltaPhi[0]),xAOD::EgammaParameters::deltaPhi0 ); - electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[0]), xAOD::EgammaParameters::deltaPhiRescaled0); - - electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[1]), xAOD::EgammaParameters::deltaEta1); - electron->setTrackCaloMatchValue(static_cast<float> (deltaPhi[1]),xAOD::EgammaParameters::deltaPhi1 ); - electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[1]), xAOD::EgammaParameters::deltaPhiRescaled1); - - electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[2]), xAOD::EgammaParameters::deltaEta2); - electron->setTrackCaloMatchValue(static_cast<float> (deltaPhi[2]),xAOD::EgammaParameters::deltaPhi2 ); - electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[2]), xAOD::EgammaParameters::deltaPhiRescaled2); - - electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[3]), xAOD::EgammaParameters::deltaEta3); - electron->setTrackCaloMatchValue(static_cast<float> (deltaPhi[3]),xAOD::EgammaParameters::deltaPhi3 ); - electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[3]), xAOD::EgammaParameters::deltaPhiRescaled3); - - float deltaPhiLast = static_cast<float>(egRec->deltaPhiLast ()); - electron->setTrackCaloMatchValue(deltaPhiLast,xAOD::EgammaParameters::deltaPhiFromLastMeasurement ); - + // Set DeltaEta, DeltaPhi , DeltaPhiRescaled + std::array<double, 4> deltaEta = egRec->deltaEta(); + std::array<double, 4> deltaPhi = egRec->deltaPhi(); + std::array<double, 4> deltaPhiRescaled = egRec->deltaPhiRescaled(); + + electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[0]), + xAOD::EgammaParameters::deltaEta0); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhi[0]), + xAOD::EgammaParameters::deltaPhi0); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[0]), + xAOD::EgammaParameters::deltaPhiRescaled0); + + electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[1]), + xAOD::EgammaParameters::deltaEta1); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhi[1]), + xAOD::EgammaParameters::deltaPhi1); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[1]), + xAOD::EgammaParameters::deltaPhiRescaled1); + + electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[2]), + xAOD::EgammaParameters::deltaEta2); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhi[2]), + xAOD::EgammaParameters::deltaPhi2); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[2]), + xAOD::EgammaParameters::deltaPhiRescaled2); + + electron->setTrackCaloMatchValue(static_cast<float>(deltaEta[3]), + xAOD::EgammaParameters::deltaEta3); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhi[3]), + xAOD::EgammaParameters::deltaPhi3); + electron->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[3]), + xAOD::EgammaParameters::deltaPhiRescaled3); + + float deltaPhiLast = static_cast<float>(egRec->deltaPhiLast()); + electron->setTrackCaloMatchValue( + deltaPhiLast, xAOD::EgammaParameters::deltaPhiFromLastMeasurement); return true; } -bool topoEgammaBuilder::getPhoton(const egammaRec* egRec, - xAOD::PhotonContainer *photonContainer, - const unsigned int author, - const uint8_t type) const{ - if (!egRec || !photonContainer) return false; +bool +topoEgammaBuilder::getPhoton(const egammaRec* egRec, + xAOD::PhotonContainer* photonContainer, + const unsigned int author, + const uint8_t type) const +{ + if (!egRec || !photonContainer){ + return false; + } - xAOD::Photon *photon = new xAOD::Photon(); - photonContainer->push_back( photon ); - photon->setAuthor( author ); + xAOD::Photon* photon = new xAOD::Photon(); + photonContainer->push_back(photon); + photon->setAuthor(author); static const SG::AuxElement::Accessor<uint8_t> acc("ambiguityType"); - acc(*photon)=type; + acc(*photon) = type; // Transfer the links to the clusters - std::vector< ElementLink< xAOD::CaloClusterContainer > > clusterLinks; - for (size_t i = 0 ; i < egRec->getNumberOfClusters(); ++i){ - clusterLinks.push_back( egRec->caloClusterElementLink(i) ); + std::vector<ElementLink<xAOD::CaloClusterContainer>> clusterLinks; + for (size_t i = 0; i < egRec->getNumberOfClusters(); ++i) { + clusterLinks.push_back(egRec->caloClusterElementLink(i)); } - photon->setCaloClusterLinks( clusterLinks ); + photon->setCaloClusterLinks(clusterLinks); - // Transfer the links to the vertices - std::vector< ElementLink< xAOD::VertexContainer > > vertexLinks; - for (size_t i = 0 ; i < egRec->getNumberOfVertices(); ++i){ - vertexLinks.push_back( egRec->vertexElementLink(i) ); + // Transfer the links to the vertices + std::vector<ElementLink<xAOD::VertexContainer>> vertexLinks; + for (size_t i = 0; i < egRec->getNumberOfVertices(); ++i) { + vertexLinks.push_back(egRec->vertexElementLink(i)); } - photon->setVertexLinks( vertexLinks ); + photon->setVertexLinks(vertexLinks); // Transfer deltaEta/Phi info float deltaEta = egRec->deltaEtaVtx(); float deltaPhi = egRec->deltaPhiVtx(); - if (!photon->setVertexCaloMatchValue( deltaEta, - xAOD::EgammaParameters::convMatchDeltaEta1) ){ + if (!photon->setVertexCaloMatchValue( + deltaEta, xAOD::EgammaParameters::convMatchDeltaEta1)) { ATH_MSG_WARNING("Could not transfer deltaEta to photon"); return false; } - if (!photon->setVertexCaloMatchValue( deltaPhi, - xAOD::EgammaParameters::convMatchDeltaPhi1) ){ + if (!photon->setVertexCaloMatchValue( + deltaPhi, xAOD::EgammaParameters::convMatchDeltaPhi1)) { ATH_MSG_WARNING("Could not transfer deltaPhi to photon"); return false; } diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h index 1f27c77ef35c63d4fe1642a185f9d001bb3eba33..d3208e296c61b60acbea28e439df3858980a16c0 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.h @@ -33,6 +33,7 @@ #include "EgammaAnalysisInterfaces/IEGammaAmbiguityTool.h" #include "egammaInterfaces/IEMClusterTool.h" #include "egammaInterfaces/IEMShowerBuilder.h" +#include "egammaInterfaces/IegammaOQFlagsBuilder.h" #include "egammaInterfaces/IegammaBaseTool.h" class egammaRec; @@ -51,6 +52,30 @@ public: StatusCode execute(const EventContext& ctx) const override final; private: + /** Given an egammaRec object, a pointer to the electron container and the author, + * create and dress an electron, pushing it back to the container and + * calling the relevant tools **/ + + bool getElectron(const egammaRec* egRec, xAOD::ElectronContainer *electronContainer, + const unsigned int author, const uint8_t type) const; + + /** Given an egammaRec object, a pointer to the photon container and the author, + * create and dress a photon, pushing it back to the container and + * calling the relevant tools **/ + bool getPhoton(const egammaRec* egRec, xAOD::PhotonContainer *photonContainer, + const unsigned int author, uint8_t type) const; + + + /** @brief Do the final ambiguity **/ + StatusCode doAmbiguityLinks(xAOD::ElectronContainer *electronContainer, + xAOD::PhotonContainer *photonContainer) const ; + + /** @brief Call a tool using contExecute and electrons, photon containers if given **/ + StatusCode CallTool(const EventContext& ctx, + const ToolHandle<IegammaBaseTool>& tool, + xAOD::ElectronContainer *electronContainer = nullptr, + xAOD::PhotonContainer *photonContainer = nullptr) const; + /** @brief Vector of tools for dressing electrons and photons **/ ToolHandleArray<IegammaBaseTool> m_egammaTools {this, @@ -76,33 +101,15 @@ private: /** @brief Tool to resolve electron/photon ambiguity */ ToolHandle<IEGammaAmbiguityTool> m_ambiguityTool {this, - "AmbiguityTool", "egammaTools/EGammaAmbiguityTool", + "AmbiguityTool", "ElectronPhotonSelectorTools/EGammaAmbiguityTool", "Tool that does electron/photon ambiguity resolution"}; + /** @brief Tool to resolve electron/photon ambiguity */ + ToolHandle<IegammaOQFlagsBuilder> m_egammaOQTool {this, + "ObjectQualityTool", {}, + "Tool that adds electron/photon Object Quality info"}; - /** Given an egammaRec object, a pointer to the electron container and the author, - * create and dress an electron, pushing it back to the container and - * calling the relevant tools **/ - - bool getElectron(const egammaRec* egRec, xAOD::ElectronContainer *electronContainer, - const unsigned int author, const uint8_t type) const; - - /** Given an egammaRec object, a pointer to the photon container and the author, - * create and dress a photon, pushing it back to the container and - * calling the relevant tools **/ - bool getPhoton(const egammaRec* egRec, xAOD::PhotonContainer *photonContainer, - const unsigned int author, uint8_t type) const; - - - /** @brief Do the final ambiguity **/ - StatusCode doAmbiguityLinks(xAOD::ElectronContainer *electronContainer, - xAOD::PhotonContainer *photonContainer) const ; - /** @brief Call a tool using contExecute and electrons, photon containers if given **/ - StatusCode CallTool(const EventContext& ctx, - const ToolHandle<IegammaBaseTool>& tool, - xAOD::ElectronContainer *electronContainer = nullptr, - xAOD::PhotonContainer *photonContainer = nullptr) const; /** @brief Name of the electron output collection*/ SG::WriteHandleKey<xAOD::ElectronContainer> m_electronOutputKey {this, @@ -128,11 +135,10 @@ private: // // Other properties. // - // others: - ServiceHandle<IChronoStatSvc> m_timingProfile; - Gaudi::Property<bool> m_doChrono {this, "doChrono", false, "do Chrono Service"}; Gaudi::Property<bool> m_doPhotons {this, "doPhotons", true, "Run the Photon reconstruction"}; Gaudi::Property<bool> m_doElectrons {this, "doElectrons", true, "Run the Electron reconstruction"}; + bool m_doAmbiguity; + bool m_doOQ; }; #endif diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaBackShape.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaBackShape.h index e7a9981683f4619d2f7f6cebeaf3013e00726a92..031ded974d3a9f01772d644804de33c597839537 100755 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaBackShape.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaBackShape.h @@ -2,22 +2,18 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// IegammaBackShape.h, (c) ATLAS Detector software 2009 -/////////////////////////////////////////////////////////////////// #ifndef EGAMMAINTERFACES_IEGAMMABACKSHAPE_H #define EGAMMAINTERFACES_IEGAMMABACKSHAPE_H -/// @class IegammaBackShape -/// @brief Interface for the Reconstruction/egamma/egammaCaloTools/egammaBackrShape -/// -/// @author Frederic Derue derue@lpnhe.in2p3.fr -/// @author Christos Anastopoulos -/// -/// $Revision:$ -/// $Date: 2014-02-11 17:40:48 +0100 (Tue, 11 Feb 2014) $ -/// +/* + * @name IegammaBackShape.h, (c) ATLAS Detector software 2009 + * @class IegammaBackShape + * @brief Interface for the Reconstruction/egamma/egammaCaloTools/egammaBackShape + * + * @author Frederic Derue derue@lpnhe.in2p3.fr + * @author Christos Anastopoulos + */ // Gaudi #include "GaudiKernel/IAlgTool.h" diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaOQFlagsBuilder.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaOQFlagsBuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..e3e6dd3c8bd281045312ee05c7f37c9bea2b6328 --- /dev/null +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IegammaOQFlagsBuilder.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EGAMMAINTERFACES_IEGAMMABACKSHAPE_H +#define EGAMMAINTERFACES_IEGAMMABACKSHAPE_H + +/* + * @name IegammaOQFlagsBuilder.h, (c) ATLAS Detector software 2009 + * @class IegammaOQFlagsBuilder + * @brief Interface for the + * Reconstruction/egamma/egammaTools/egammaOQFlagsBuilder + * + * @author Christos Anastopoulos + */ + +// Gaudi +#include "GaudiKernel/IAlgTool.h" + +#include "GaudiKernel/EventContext.h" +// Forward declarations +#include "xAODEgamma/EgammaFwd.h" +class CaloDetDescrManager; +static const InterfaceID IID_IegammaOQFlagsBuilder("IegammaOQFlagsBuilder", + 1, + 0); + +class IegammaOQFlagsBuilder : virtual public IAlgTool +{ + +public: + /** @brief Virtual destructor */ + virtual ~IegammaOQFlagsBuilder(){}; + + /** @brief AlgTool interface methods */ + static const InterfaceID& interfaceID(); + + /** @brief AlgTool method.*/ + virtual StatusCode execute(const EventContext& ctx, + const CaloDetDescrManager& cmgr, + xAOD::Egamma& egamma) const = 0; +}; + +inline const InterfaceID& +IegammaOQFlagsBuilder::interfaceID() +{ + return IID_IegammaOQFlagsBuilder; +} + +#endif // EGAMMAINTERFACES_IEGAMMABACKSHAPE_H diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/egammaInterfacesDict.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/egammaInterfacesDict.h index 0bc7fb62cf60b88284af65172fae6cddb273a0b3..8a46b57f925ecb76dc94eec1fbdf73609c22faee 100644 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/egammaInterfacesDict.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/egammaInterfacesDict.h @@ -33,4 +33,5 @@ #include "egammaInterfaces/IegammaSwTool.h" #include "egammaInterfaces/IegammaTrkRefitterTool.h" #include "egammaInterfaces/IegammaMVASvc.h" +#include "egammaInterfaces/IegammaOQFlagsBuilder.h" #endif // EGAMMAINTERFACES_EGAMMAINTERFACESDICT_H diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/selection.xml b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/selection.xml index 93e1b04344fb2457b78f85b1ba8c01837d23cfa3..1969394b3f9918c86191b6bd27d781c177b9c00b 100644 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/selection.xml +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/selection.xml @@ -17,5 +17,6 @@ <class name="IegammaSwTool" /> <class name="IegammaTrkRefitterTool" /> <class name="IegammaMVASvc" /> + <class name="IegammaOQFlagsBuilder" /> </lcgdict> diff --git a/Reconstruction/egamma/egammaPerformance/CMakeLists.txt b/Reconstruction/egamma/egammaPerformance/CMakeLists.txt index c1fb31975b963a88be30bbd80569738a7e1401b5..c0fac89a050c734b6c0e0333190a264b252a9bfa 100644 --- a/Reconstruction/egamma/egammaPerformance/CMakeLists.txt +++ b/Reconstruction/egamma/egammaPerformance/CMakeLists.txt @@ -20,17 +20,11 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) -# Component(s) in the package: -atlas_add_library( egammaPerformanceLib - src/*.cxx - PUBLIC_HEADERS egammaPerformance - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} xAODEgamma xAODEventInfo GaudiKernel TrigParticle TrigSteeringEvent AthenaMonitoringLib StoreGateLib SGtests TrigDecisionToolLib ) - atlas_add_component( egammaPerformance + src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib StoreGateLib SGtests xAODEgamma xAODEventInfo GaudiKernel TrigDecisionToolLib TrigParticle TrigSteeringEvent egammaPerformanceLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib StoreGateLib SGtests xAODEgamma xAODEventInfo GaudiKernel TrigDecisionToolLib TrigParticle TrigSteeringEvent ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx index 0774cfe1982847ac2276a2912e99a1b939f779aa..4f7d23655bd723cde357bcf85087b86d12c77679 100755 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorElectronAlgorithm.h" +#include "MonitorElectronAlgorithm.h" MonitorElectronAlgorithm::MonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx index cb13efe3e84659b46bb9b4f09289038315e9ae16..4566d70901bcde3329e07d318f44a6928fd06ae5 100644 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorFwdElectronAlgorithm.h" +#include "MonitorFwdElectronAlgorithm.h" MonitorFwdElectronAlgorithm::MonitorFwdElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorFwdElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorFwdElectronAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx index 0bb0c05d48e5b92e61426bc125e1675e0f993e18..77ed7c5d1efa8f90594c496ac75ad55ab0814c7f 100755 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorPhotonAlgorithm.h" +#include "MonitorPhotonAlgorithm.h" MonitorPhotonAlgorithm::MonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx index 95cf12f768acc93a061c8d91755c00971937f31c..62465c2326eb58457f8e069c3ff248d7d95778fe 100644 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx @@ -5,7 +5,7 @@ Author : B. Laforge (laforge@lpnhe.in2p3.fr) 4 May 2020 */ -#include "egammaPerformance/MonitorTnPAlgorithm.h" +#include "MonitorTnPAlgorithm.h" MonitorTnPAlgorithm::MonitorTnPAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) { diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorTnPAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorTnPAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx index 642284c93d2becab63573102135b47238805c439..3557c51416000574bd21f7d4db988056f6598d52 100755 --- a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx @@ -15,7 +15,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/ZeeTaPMonTool.h" +#include "ZeeTaPMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -58,7 +58,6 @@ ZeeTaPMonTool::ZeeTaPMonTool(const std::string & type, const std::string & name, m_hLB_N(nullptr) { // Name of the electron collection - declareProperty("ElectronContainer", m_ElectronContainer = "Electrons", "Name of the electron collection" ); declareProperty("massPeak", m_MassPeak = 91188, "Resonance peak position" ); declareProperty("electronEtCut",m_ElectronEtCut = 15*GeV, "Et cut for electrons"); declareProperty("massLowerCut", m_MassLowerCut = 70*GeV,"Lower mass cut"); @@ -74,6 +73,13 @@ ZeeTaPMonTool::~ZeeTaPMonTool() { } +StatusCode ZeeTaPMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode ZeeTaPMonTool::bookHistograms() { ATH_MSG_DEBUG("ZeeTaPMonTool::bookHistograms()"); @@ -165,15 +171,8 @@ StatusCode ZeeTaPMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -184,11 +183,10 @@ StatusCode ZeeTaPMonTool::fillHistograms() } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); - return sc; + return StatusCode::FAILURE; } xAOD::ElectronContainer::const_iterator e_iter = electron_container->begin(); diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.h similarity index 86% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.h index 4b899a5ff1267421d265283dea34e9f2cceeffcf..e34197ddc443c9fb4daa0c829c1cdbf692afabe6 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef ZeeTaPMonTool_H #define ZeeTaPMonTool_H -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" class ZeeTaPMonTool : public egammaMonToolBase @@ -23,9 +23,10 @@ class ZeeTaPMonTool : public egammaMonToolBase virtual ~ZeeTaPMonTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; private: void fillElectronProbe(const xAOD::Electron *el, bool isTight, bool isIso, double mass); @@ -33,7 +34,7 @@ class ZeeTaPMonTool : public egammaMonToolBase protected: // Properties - std::string m_ElectronContainer; // Container name for electrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ElectronContainer{this, "ElectronContainer", "Electrons", "Name of the electron collection"}; // Container name for electrons float m_MassPeak; float m_ElectronEtCut; float m_MassLowerCut; diff --git a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx index af0888d573667cd9cb225721b9b66865fb0c3354..e9e3ac713b75307d10f87a60aff02fc23e188928 100644 --- a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx @@ -4,15 +4,15 @@ // New Run 3 algorithms -#include "egammaPerformance/MonitorElectronAlgorithm.h" -#include "egammaPerformance/MonitorPhotonAlgorithm.h" -#include "egammaPerformance/MonitorFwdElectronAlgorithm.h" -#include "egammaPerformance/MonitorTnPAlgorithm.h" +#include "../MonitorElectronAlgorithm.h" +#include "../MonitorPhotonAlgorithm.h" +#include "../MonitorFwdElectronAlgorithm.h" +#include "../MonitorTnPAlgorithm.h" // Run 2 algorithms -#include "egammaPerformance/photonMonTool.h" -#include "egammaPerformance/electronMonTool.h" -#include "egammaPerformance/forwardElectronMonTool.h" -#include "egammaPerformance/ZeeTaPMonTool.h" +#include "../photonMonTool.h" +#include "../electronMonTool.h" +#include "../forwardElectronMonTool.h" +#include "../ZeeTaPMonTool.h" // Run 2 Algorithms diff --git a/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx index 9c779277cad57f78e541faeea414e3f7d880c742..f4ebbe1d87d99d6967b3f0ceaa941fc41f2e6ecb 100644 --- a/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx @@ -13,7 +13,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -80,9 +80,22 @@ StatusCode egammaMonToolBase::initialize() } } + ATH_CHECK( m_EventInfoKey.initialize() ); + return sc; } +unsigned int egammaMonToolBase::getCurrentLB() +{ + SG::ReadHandle<xAOD::EventInfo> evtInfo{m_EventInfoKey}; + if (evtInfo.isValid()) { + return evtInfo->lumiBlock(); + } else { + ATH_MSG_ERROR("couldn't retrieve event info"); + return -1; + } +} + StatusCode egammaMonToolBase::bookHistograms() { ATH_MSG_DEBUG("egammaMonToolBase::bookHistograms()"); diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h similarity index 88% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h rename to Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h index 4f28d7639cc9a3df507860fe9113e814f933c4c2..29b0852b726971c0fc7a8a49cabeed6169895f97 100644 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h +++ b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h @@ -31,10 +31,10 @@ class egammaMonToolBase : public ManagedMonitorToolBase virtual ~egammaMonToolBase(); - virtual StatusCode initialize(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; protected: @@ -52,6 +52,7 @@ class egammaMonToolBase : public ManagedMonitorToolBase void fillTH2FperRegion(std::vector<TH2*> &vhist, unsigned int ir, float x, float y); void fillEfficiencies(TH1* h, TH1* href); bool hasGoodTrigger(const std::string& comment); + unsigned int getCurrentLB(); // Data members StoreGateSvc * m_storeGate; @@ -63,6 +64,7 @@ class egammaMonToolBase : public ManagedMonitorToolBase std::string m_GroupExtension; unsigned int m_currentLB; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; private: std::vector<std::string> m_region; diff --git a/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx index 5ec769498afec587c8bcc55ac44d2d744953e20f..94e9e819e4888371c545da1173c1802a4080cf33 100755 --- a/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx @@ -72,7 +72,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/electronMonTool.h" +#include "electronMonTool.h" electronMonTool::electronMonTool(const std::string & type, const std::string & name, const IInterface* parent) : egammaMonToolBase(type,name,parent), @@ -81,10 +81,6 @@ electronMonTool::electronMonTool(const std::string & type, const std::string & n m_electronIdGroup(nullptr), m_electronLBGroup(nullptr) { - - // Name of the electron collection - declareProperty("ElectronContainer", m_ElectronContainer = "Electrons", "Name of the electron collection" ); - bool WithFullHistList = true; bool WithLimitedHistList = false; @@ -138,6 +134,13 @@ electronMonTool::~electronMonTool() } +StatusCode electronMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode electronMonTool::bookHistogramsForOneElectronType(electronHist& myHist) { @@ -529,15 +532,8 @@ StatusCode electronMonTool::fillHistograms() { //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -558,9 +554,8 @@ StatusCode electronMonTool::fillHistograms() { } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); return StatusCode::FAILURE; } @@ -675,9 +670,3 @@ StatusCode electronMonTool::fillHistograms() { return StatusCode::SUCCESS; } - - -StatusCode electronMonTool::procHistograms() -{ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.h similarity index 93% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/electronMonTool.h index 80858f4daedba5eec49b0c6d6e38cee1ce7f9094..55cdb1cb59ccc1b49a11332ec168dacf1dfcfb52 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.h @@ -18,7 +18,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TH1F.h" #include "TH2F.h" -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronxAODHelpers.h" @@ -126,20 +126,20 @@ class electronMonTool : public egammaMonToolBase virtual ~electronMonTool(); - virtual StatusCode bookHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; virtual StatusCode bookHistogramsForOneElectronType(electronHist& myHist); - virtual StatusCode fillHistograms(); + virtual StatusCode fillHistograms() override; virtual StatusCode fillHistogramsForOneElectron(xAOD::ElectronContainer::const_iterator e_iter, electronHist& myHist); - virtual StatusCode procHistograms(); private: protected: // Properties - std::string m_ElectronContainer; // Container name for electrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ElectronContainer{this, "ElectronContainer", "Electrons", "Name of the electron collection"}; // Container name for electrons // LH Loose electrons histograms electronHist *m_LhLooseElectrons; diff --git a/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx index aec9fb057e35711f05ae889ededcac4af8a45248..79b02d36aa2c2832c3fa179b6534858a22dd84b7 100644 --- a/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx @@ -69,7 +69,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/forwardElectronMonTool.h" +#include "forwardElectronMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -97,9 +97,6 @@ forwardElectronMonTool::forwardElectronMonTool(const std::string & type, const s m_hLB_N(nullptr), m_nForwardElectrons(0) { - // Name of the electron collection - declareProperty("ForwardElectronContainer", m_ForwardElectronContainer = "egammaForwardCollection", "Name of the forward electron collection" ); - m_lumiBlockNumber = 0; m_nForwardElectronsInCurrentLB = 0; m_nForwardElectronsPerLumiBlock.clear(); @@ -110,6 +107,13 @@ forwardElectronMonTool::~forwardElectronMonTool() { } +StatusCode forwardElectronMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ForwardElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode forwardElectronMonTool::bookHistograms() { ATH_MSG_DEBUG("forwardElectronMonTool::bookHistograms()"); @@ -197,15 +201,8 @@ StatusCode forwardElectronMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -216,9 +213,8 @@ StatusCode forwardElectronMonTool::fillHistograms() } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ForwardElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ForwardElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); return StatusCode::FAILURE; } @@ -363,5 +359,5 @@ StatusCode forwardElectronMonTool::fillHistograms() //} } - return sc; + return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h similarity index 90% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h index f1844ba855ebfc0758476ef9215f522dc6ef1a9d..ac8f778182351d7b6de399110560914e20a2542d 100644 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h @@ -11,7 +11,7 @@ #ifndef forwardElectronMonTool_H #define forwardElectronMonTool_H -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" class forwardElectronMonTool : public egammaMonToolBase { @@ -21,14 +21,15 @@ class forwardElectronMonTool : public egammaMonToolBase virtual ~forwardElectronMonTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; private: protected: // Properties - std::string m_ForwardElectronContainer; // Container name for forwardElectrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ForwardElectronContainer{this, "ForwardElectronContainer", "egammaForwardCollection", "Name of the forward electron collection"}; // Container name for forwardElectrons // Loose electrons histograms TH1 * m_hN; // Histogram for number of electrons diff --git a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx index 03ca696df49d0ec979a707d358cd799d561b771c..e5a2dfe12b944859ffb7d23551aa74c4e62b4d7e 100755 --- a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx @@ -69,7 +69,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/photonMonTool.h" +#include "photonMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -90,9 +90,6 @@ photonMonTool::photonMonTool(const std::string & type, const std::string & name, m_photonRegionGroup(nullptr), m_photonLBGroup(nullptr) { - // Name of the photon collection - declareProperty("PhotonContainer", m_PhotonContainer = "PhotonCollection", "Name of the photon collection"); - m_CbTightPhotons = new photonHist(std::string("CbTight")); m_CbTightPhotons->m_lumiBlockNumber = 0; m_CbTightPhotons->m_nPhotonsInCurrentLB = 0; @@ -120,6 +117,13 @@ photonMonTool::~photonMonTool() ATH_MSG_DEBUG("photonMonTool ::: m_CbTightPhotons deleted"); } +StatusCode photonMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_PhotonContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode photonMonTool::bookHistogramsForOnePhotonType(photonHist& myHist) { @@ -633,15 +637,8 @@ StatusCode photonMonTool::fillHistograms() { //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -685,9 +682,8 @@ StatusCode photonMonTool::fillHistograms() { } // Get photon container - const xAOD::PhotonContainer* photon_container=nullptr; - sc = m_storeGate->retrieve(photon_container, m_PhotonContainer); - if(sc.isFailure() || !photon_container){ + SG::ReadHandle<xAOD::PhotonContainer> photon_container{m_PhotonContainer}; + if(!photon_container.isValid()){ ATH_MSG_VERBOSE("no photon container found in TDS"); return StatusCode::FAILURE; } @@ -771,9 +767,3 @@ StatusCode photonMonTool::fillHistograms() { return StatusCode::SUCCESS; } - - -StatusCode photonMonTool::procHistograms() -{ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.h similarity index 95% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/photonMonTool.h index cbd3187025f8705f34188603b93615b0aecb2152..b439c791c6cbdbb464b81ee19f147044d3fc601d 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.h @@ -18,7 +18,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TH1F.h" #include "TH2F.h" -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronxAODHelpers.h" @@ -178,19 +178,19 @@ class photonMonTool : public egammaMonToolBase photonMonTool(const std::string& type, const std::string& name, const IInterface* parent); virtual ~photonMonTool(); - virtual StatusCode bookHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; virtual StatusCode bookHistogramsForOnePhotonType(photonHist& myHist); - virtual StatusCode fillHistograms(); + virtual StatusCode fillHistograms() override; virtual StatusCode fillHistogramsForOnePhoton(xAOD::PhotonContainer::const_iterator g_iter, photonHist& myHist); - virtual StatusCode procHistograms(); private: protected: // Properties - std::string m_PhotonContainer; // Container name for photons + SG::ReadHandleKey<xAOD::PhotonContainer> m_PhotonContainer{this, "PhotonContainer", "PhotonCollection", "Name of the photon collection"}; // Container name for photons // Loose cut based photons histograms photonHist *m_CbLoosePhotons; diff --git a/Reconstruction/egamma/egammaRec/python/EMCommonRefitter.py b/Reconstruction/egamma/egammaRec/python/EMCommonRefitter.py index 31bdb5d007ebc1e36bea711e4d2fb24b1f9b8171..da9368ef829acb9f176dcbe44ebb57fa003aeaa6 100644 --- a/Reconstruction/egamma/egammaRec/python/EMCommonRefitter.py +++ b/Reconstruction/egamma/egammaRec/python/EMCommonRefitter.py @@ -5,51 +5,71 @@ from InDetRecExample import TrackingCommon as TrackingCommon print("EMCommonRefitter.py") + def getGSFTrackFitter(): - egRotCreator = TrackingCommon.getInDetRotCreator(name='egRotCreator') - TrackingCommon.createAndAddCondAlg(TrackingCommon.getRIO_OnTrackErrorScalingCondAlg, - 'RIO_OnTrackErrorScalingCondAlg') + egRotCreator = TrackingCommon.getInDetRotCreator( + name='egRotCreator', + private=True) + TrackingCommon.createAndAddCondAlg( + TrackingCommon.getRIO_OnTrackErrorScalingCondAlg, + 'RIO_OnTrackErrorScalingCondAlg') # get Rk propagator - from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator + from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import ( + Trk__RungeKuttaPropagator as Propagator) + egTrkPropagator = Propagator(name='egTrkPropagator') egTrkPropagator.AccuracyParameter = 0.0001 # Setup the Navigator (default) - from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc + from TrkDetDescrSvc.AtlasTrackingGeometrySvc import ( + AtlasTrackingGeometrySvc) + from TrkExTools.TrkExToolsConf import Trk__Navigator - egTrkNavigator = Trk__Navigator(name='egTrkNavigator', - TrackingGeometrySvc=AtlasTrackingGeometrySvc) + egTrkNavigator = Trk__Navigator( + name='egTrkNavigator', + TrackingGeometrySvc=AtlasTrackingGeometrySvc) # Set up the GSF - from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfMaterialMixtureConvolution - GsfMaterialUpdator = Trk__GsfMaterialMixtureConvolution(name='GsfMaterialUpdator', - MaximumNumberOfComponents=12) - - from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfExtrapolator - GsfExtrapolator = Trk__GsfExtrapolator(name='GsfExtrapolator', - Propagators=[egTrkPropagator], - SearchLevelClosestParameters=10, - StickyConfiguration=True, - Navigator=egTrkNavigator, - GsfMaterialConvolution=GsfMaterialUpdator, - SurfaceBasedMaterialEffects=False) - - from TrkMeasurementUpdator.TrkMeasurementUpdatorConf import Trk__KalmanUpdatorAmg as ConfiguredKalmanUpdator + from TrkGaussianSumFilter.TrkGaussianSumFilterConf import ( + Trk__GsfMaterialMixtureConvolution) + + GsfMaterialUpdator = Trk__GsfMaterialMixtureConvolution(name='GsfMaterialUpdator',MaximumNumberOfComponents=12) + + from TrkGaussianSumFilter.TrkGaussianSumFilterConf import ( + Trk__GsfExtrapolator) + + GsfExtrapolator = Trk__GsfExtrapolator( + name='GsfExtrapolator', + Propagators=[egTrkPropagator], + SearchLevelClosestParameters=10, + StickyConfiguration=True, + Navigator=egTrkNavigator, + GsfMaterialConvolution=GsfMaterialUpdator, + SurfaceBasedMaterialEffects=False) + + from TrkMeasurementUpdator.TrkMeasurementUpdatorConf import ( + Trk__KalmanUpdatorAmg as ConfiguredKalmanUpdator) + egTrkUpdator = ConfiguredKalmanUpdator('egTrkUpdator') - from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfMeasurementUpdator - GsfMeasurementUpdator = Trk__GsfMeasurementUpdator(name='GsfMeasurementUpdator', - Updator=egTrkUpdator) - - from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GaussianSumFitter - GSFTrackFitter = Trk__GaussianSumFitter(name='GSFTrackFitter', - ToolForExtrapolation=GsfExtrapolator, - MeasurementUpdatorType=GsfMeasurementUpdator, - ReintegrateOutliers=True, - MakePerigee=True, - RefitOnMeasurementBase=True, - DoHitSorting=True, - ToolForROTCreation=egRotCreator) + from TrkGaussianSumFilter.TrkGaussianSumFilterConf import ( + Trk__GsfMeasurementUpdator) + + GsfMeasurementUpdator = Trk__GsfMeasurementUpdator( + name='GsfMeasurementUpdator', + Updator=egTrkUpdator) + + from TrkGaussianSumFilter.TrkGaussianSumFilterConf import ( + Trk__GaussianSumFitter) + GSFTrackFitter = Trk__GaussianSumFitter( + name='GSFTrackFitter', + ToolForExtrapolation=GsfExtrapolator, + MeasurementUpdatorType=GsfMeasurementUpdator, + ReintegrateOutliers=True, + MakePerigee=True, + RefitOnMeasurementBase=True, + DoHitSorting=True, + ToolForROTCreation=egRotCreator) # --- end of fitter loading return GSFTrackFitter diff --git a/Reconstruction/egamma/egammaRec/python/Factories.py b/Reconstruction/egamma/egammaRec/python/Factories.py index 5d199c39957f70cba77a45a54c75ef0bf02070a4..5d079aaa94271bbd69172f6bedd88f099b2aafd6 100644 --- a/Reconstruction/egamma/egammaRec/python/Factories.py +++ b/Reconstruction/egamma/egammaRec/python/Factories.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -7,265 +7,303 @@ __authors__ = "Bruno Lenzi, Christos Anastopoulos, Jovan Mitrevski" from AthenaCommon.Logging import logging from AthenaCommon.Resilience import treatException -def factoriesInfo ( log): - logFactories = logging.getLogger( 'Factories' ) - logFactories.info(log) + +def factoriesInfo(log): + logFactories = logging.getLogger('Factories') + logFactories.info(log) # tools -def isAlreadyInToolSvc( name ): - "isAlreadyInToolSvc ( name of the tool ) --> check if the tool with name is already in the service" - from AthenaCommon.AppMgr import ToolSvc - if hasattr(ToolSvc, name): - return True - else: - return False - -def getFromToolSvc( name ): - "getFromToolSvc ( name of the tool ) --> Get the tool from toolSvc by name " - from AthenaCommon.AppMgr import ToolSvc - return getattr (ToolSvc,name) - -def addToToolSvc( tool ): - "addToToolSvc( tool ) --> add tool to ToolSvc" - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += tool - return tool + + +def isAlreadyInToolSvc(name): + """isAlreadyInToolSvc (name of the tool) + --> check if the tool with name is already in the service""" + from AthenaCommon.AppMgr import ToolSvc + if hasattr(ToolSvc, name): + return True + else: + return False + + +def getFromToolSvc(name): + """getFromToolSvc (name of the tool) + --> Get the tool from toolSvc by name """ + from AthenaCommon.AppMgr import ToolSvc + return getattr(ToolSvc, name) + + +def addToToolSvc(tool): + """addToToolSvc(tool) + --> add tool to ToolSvc""" + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += tool + return tool # services -def isAlreadyInServiceMgr( name ): - "isAlreadyInServiceMgr ( mane of the service ) --> check if the service with name is already in the manager" - from AthenaCommon.AppMgr import ServiceMgr - if hasattr(ServiceMgr, name): - return True - else: - return False - -def getFromServiceMgr( name ): - "getFromServiceMgr ( name of the service ) --> Get the service from manager by name " - from AthenaCommon.AppMgr import ServiceMgr - return getattr (ServiceMgr,name) - -def addToServiceMgr( service ): - "addToServiceMgr( service ) --> add service to ServiceMgr" - from AthenaCommon.AppMgr import ServiceMgr - ServiceMgr += service - return service + + +def isAlreadyInServiceMgr(name): + """isAlreadyInServiceMgr (name of the service) + --> check if the service with name is already in the manager""" + from AthenaCommon.AppMgr import ServiceMgr + if hasattr(ServiceMgr, name): + return True + else: + return False + + +def getFromServiceMgr(name): + """getFromServiceMgr (name of the service) + --> Get the service from manager by name """ + from AthenaCommon.AppMgr import ServiceMgr + return getattr(ServiceMgr, name) + + +def addToServiceMgr(service): + """addToServiceMgr( service ) + --> add service to ServiceMgr""" + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr += service + return service # algs -def isAlreadyInTopSequence( name ): - "isAlreadyInTopSequence ( mane of the alg ) --> check if the alg with name is already in the Alg sequence" - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - if hasattr(topSequence, name): - return True - else: - return False - -def getFromTopSequence( name ): - "getFromTopSequence ( name of the alg ) --> Get the alg from TopSequence by name " - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - return getattr (topSequence,name) - -def addToTopSequence( alg ): - "addToTopSequence( alg ) --> add alg to TopSequence" - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence += alg - return alg + + +def isAlreadyInTopSequence(name): + """isAlreadyInTopSequence ( mane of the alg ) + --> check if the alg with name is already in the Alg sequence""" + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + if hasattr(topSequence, name): + return True + else: + return False + + +def getFromTopSequence(name): + """getFromTopSequence (name of the alg) + --> Get the alg from TopSequence by name """ + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + return getattr(topSequence, name) + + +def addToTopSequence(alg): + "addToTopSequence(alg) --> add alg to TopSequence" + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + topSequence += alg + return alg + def getPropertyValue(tool, property): - """getPropertyValue( tool, property) --> return the set value or the default value - of the given property for the given tool or alg""" - try: - return getattr(tool, property) - except AttributeError: - return tool.getDefaultProperty(property) + """getPropertyValue(tool, property) + --> return the set value or the default value + of the given property for the given tool or alg""" + try: + return getattr(tool, property) + except AttributeError: + return tool.getDefaultProperty(property) + class FcnWrapper: - """A simple wrapper to call a function with no arguments""" - def __init__(self, fcn = None): - self.fcn = fcn - - def __call__(self): - return self.fcn() + """A simple wrapper to call a function with no arguments""" + + def __init__(self, fcn=None): + self.fcn = fcn + + def __call__(self): + return self.fcn() + class Factory: - """Factory: base class of ToolFactory and AlgFactory. - Allows to "lazy" instantiate tools/algs/services. Properties are set in the c-tor , - and can include other factories,tools. One can also define preInit/postInit methods. - The end result is that the configuration can be defined/formed/composed before the actual instantiation - which happens when needed, i.e at demand via () (__call__()) method. - - # Definition - from MyPkg import MyPkgConf - MyTool1 = ToolFactory(MyPkgConf.MyTool1) # does not set any default - - # set default via value and pass a method that will be called after instantiation - def setPropertyX(tool): tool.propertyX = 'x' - MyTool2 = ToolFactory(MyPkgConf.MyTool2, postInit=[setPropertyX], name='MyTool2a', PropertyY = 'y') - - # default via FcnWrapper or ToolFactory instance, called when the tool is instantiated - def getNameOfTool2(): return MyTool2().getFullName() - MyTool3 = ToolFactory(MyPkgConf.MyTool3, - Tool1 = MyTool1, # ToolFactory instance, not actual tool instance - NameOfTool2 = FcnWrapper(getNameOfTool2), # could have used FullNameWrapper( MyTool2 ) - ) - - # Actual tool instantiation at demand - MyTool1() # create tool instance with default values - MyTool2(propertyY = 'xx') # create a tool instance overriding default propertyY. At this point setPropertyX will be called - MyTool3() # create default instance, will all try to instantiate MyTool1 (effect depends on Private/Public usage) - tool2a = MyTool2('myTool2a') # create another factory instance with the same properties as MyTool2 above ('x') - tool3a = MyTool3('myTool3a', Tool1 = MyTool1('myTool1a', propertyA = 'B'),NameOfTool2 = 'myTool2a') - # create another factory instance overriding both properties set above for MyTool3 - """ - - def __init__(self, iclass, **defaults ): - """ - @param iclass Tool / Alg class - @param defaults default values for configurables, can be overridden at instantiation. - Special parameters: - - preInit: list of functions to be called before tool/alg instantiation, take no arguments - - preInit: list of functions to be called after tool/alg instantiation, take tool/alg as argument - - doAdd: add tool (alg) to ToolSvc (TopSequence) (default: True) - - doPrint: print tool/alg after instantiation (default: False) + """Factory: base class of ToolFactory and AlgFactory. + Allows to "lazy" instantiate the configuration of tools/algs/services. + Properties are set in the c-tor, + and can include other factories,tools. + One can also define preInit/postInit methods. + The end result is that the configuration + can be defined/formed/composed before + before its actual instantiation which happens at demand + via the () (__call__()) method. """ - self.iclass = iclass - self.defaults = defaults - - def copy(self, name, **kw): - "copy(self, name, **kw) --> return a new instance of the factory with new name and defaults" - kw['name'] = name - deflt = self.defaults.copy() - deflt.update(kw) - return self.__class__(self.iclass, **deflt ) - - def __call__(self, name = '', **kw ): - """Call preInit functions, instantiate tool (alg), call postInit functions and add - to ToolSvc (TopSequence)""" - params=self.defaults.copy() - params.update(kw) - params['name'] = name or params.get('name', self.iclass.__name__) - del name, kw # to avoid silly mistakes - - # Get special parameters (or default values) and remove them from dictionary - preInit = params.pop('preInit', []) - postInit = params.pop('postInit', []) - doAdd = params.pop('doAdd', True) - doPrint = params.pop('doPrint', False) - - # Call preInit functions - for fcn in preInit: - try: - fcn() - except: - treatException('calling preInit function %s on %s instantiation\n' % (fcn.__name__, params['name'])) - raise - - # Instantiate the Factory parameters or call the Function wrappers. - # (if they are inside a list -->ToolHandleArray loop over them) - classes = (FcnWrapper, ToolFactory, PublicToolFactory, ServiceFactory) - for paramName, value in params.items(): - if isinstance(value, classes) or \ - (isinstance(value, list) and any(isinstance(v, classes) for v in value) ): + + def __init__(self, iclass, **defaults): + """ + @param iclass Tool / Alg class + @param defaults default values for configurables, + can be overridden at instantiation. + Special parameters: + - preInit: list of functions to be called before tool/alg + instantiation, take no arguments + - preInit: list of functions to be called after tool/alg + instantiation, take tool/alg as argument + - doAdd: add tool (alg) to ToolSvc (TopSequence) (default: True) + - doPrint: print tool/alg after instantiation (default: False) + """ + self.iclass = iclass + self.defaults = defaults + + def copy(self, name, **kw): + """copy(self, name, **kw) + --> return a new instance of the factory with new name and defaults""" + kw['name'] = name + deflt = self.defaults.copy() + deflt.update(kw) + return self.__class__(self.iclass, **deflt) + + def __call__(self, name='', **kw): + """Call preInit functions, instantiate tool (alg), + call postInit functions and add to ToolSvc (TopSequence)""" + params = self.defaults.copy() + params.update(kw) + params['name'] = name or params.get('name', self.iclass.__name__) + del name, kw # to avoid silly mistakes + + # Get special parameters (or default values) + # and remove them from dictionary + preInit = params.pop('preInit', []) + postInit = params.pop('postInit', []) + doAdd = params.pop('doAdd', True) + doPrint = params.pop('doPrint', False) + + # Call preInit functions + for fcn in preInit: + try: + fcn() + except Exception: + treatException( + 'calling preInit function %s on %s instantiation\n' + % (fcn.__name__, params['name'])) + raise + + # Instantiate the Factory parameters or call the Function wrappers. + # (if they are inside a list -->ToolHandleArray loop over them) + classes = (FcnWrapper, ToolFactory, PublicToolFactory, ServiceFactory) + for paramName, value in params.items(): + if isinstance(value, classes) or \ + (isinstance(value, list) and + any(isinstance(v, classes) for v in value)): + try: + params[paramName] = value() \ + if not isinstance(value, list) else \ + [v() if isinstance(v, classes) else v for v in value] + except Exception: + treatException('setting property %s :: %s\n' % + (params['name'], paramName)) + raise + + # Instantiate tool / alg try: - params[paramName] = value() if not isinstance(value, list) else \ - [v() if isinstance(v, classes) else v for v in value] - except: - treatException('setting property %s :: %s\n' % (params['name'], paramName)) - raise - - # Instantiate tool / alg - try: - obj = self.iclass(**params) - except Exception: - treatException( 'instantiating %s, args: %s\n' % (self.iclass.__name__, params)) - raise - - # Call postInit methods - for fcn in postInit: - try: - fcn(obj) - except: - treatException('calling postInit function %s on %s instantiation\n' % (fcn.__name__, params['name'])) - raise - - # Add to ToolSvc or TopSequence - if doAdd: - self.add(obj) - - # Print, perhaps at some point could use a functio so as to override the behavioue - if doPrint: - print (obj) - - return obj - - def add(self,obj): - pass - -class ToolFactory( Factory ): - """ToolFactory: to instantiate tools. Does not add in ToolSvc (private tools). See Factory""" - - def __init__(self, iclass, **defaults ): - self.iclass = iclass - self.defaults={'doAdd': False} - self.defaults.update(defaults) - - def add(self, obj): - factoriesInfo("Tool with name ==> %s is a Private Tool, will not be added in ToolSvc" % obj.getFullName() ) - pass - - def copyPublic(self, name, **kw): - "copy(self, name, **kw) --> return a new instance of the factory as a puclic tool with new name and defaults" - deflt = self.defaults.copy() - deflt.update(kw) - deflt['name'] = name - deflt['doAdd'] = True - return PublicToolFactory(self.iclass, **deflt ) - -class PublicToolFactory( Factory ): - """ToolFactory: to instantiate tools. Adds in ToolSvc (public tools). See Factory""" - def __init__(self, iclass, **defaults ): - self.iclass = iclass - self.defaults={'doAdd': True} - self.defaults.update(defaults) - - def add(self, obj): - if not isAlreadyInToolSvc(obj.getName()): - factoriesInfo("Adding new Public Tool ===> %s" % obj.getFullName()) - addToToolSvc(obj) - else : - factoriesInfo("Public Tool with name ==> %s already in ToolSvc, using existing instance" % obj.getFullName() ) - -class ServiceFactory( Factory ): - """ServiceFactory: to instantiate services. Adds to ServiceMgr. See Factory""" - - def __init__(self, iclass, **defaults ): - self.iclass = iclass - self.defaults={'doAdd': True} - self.defaults.update(defaults) - - def add(self, obj): - if not isAlreadyInServiceMgr(obj.getName()): - factoriesInfo("Adding new Service ===> %s" % obj.getFullName()) - addToServiceMgr(obj) - else : - factoriesInfo("Service with name ==> %s already in ServiceMgr, using existing instance" % obj.getFullName() ) - -class AlgFactory( Factory ): - """AlgFactory: to instantiate algs and add them to TopSequence. See Factory""" - def __init__(self, iclass, **defaults ): - self.iclass = iclass - self.defaults={'doAdd': True} - self.defaults.update(defaults) - - def add(self, obj): - factoriesInfo("Adding new Algorithm ==> %s " %obj.getFullName()) - addToTopSequence(obj) - -def instantiateAll(module = None): - """Instantiate all tools/algs defined by Factories in a given module. - WARNING: in alphabetical order, not in the order they are defined""" - return [obj() for obj in vars(module).values() if isinstance(obj, Factory)] + obj = self.iclass(**params) + except Exception: + treatException('instantiating %s, args: %s\n' % + (self.iclass.__name__, params)) + raise + + # Call postInit methods + for fcn in postInit: + try: + fcn(obj) + except Exception: + treatException( + 'calling postInit function %s on %s instantiation\n' % ( + fcn.__name__, params['name'])) + raise + + # Add to ToolSvc or TopSequence + if doAdd: + self.add(obj) + + # Print + if doPrint: + print(obj) + + return obj + + def add(self, obj): + pass + + +class ToolFactory(Factory): + """ToolFactory: to instantiate tools. + Does not add in ToolSvc (private tools). See Factory""" + + def __init__(self, iclass, **defaults): + self.iclass = iclass + self.defaults = {'doAdd': False} + self.defaults.update(defaults) + + def add(self, obj): + factoriesInfo( + "Tool with name ==> %s is a Private Tool," + "will not be added in ToolSvc" % obj.getFullName()) + pass + + def copyPublic(self, name, **kw): + """copy(self, name, **kw) + --> return a new instance of the factory + as a puclic tool with new name and defaults""" + deflt = self.defaults.copy() + deflt.update(kw) + deflt['name'] = name + deflt['doAdd'] = True + return PublicToolFactory(self.iclass, **deflt) + + +class PublicToolFactory(Factory): + """ToolFactory: to instantiate tools. + Adds in ToolSvc (public tools). See Factory""" + + def __init__(self, iclass, **defaults): + self.iclass = iclass + self.defaults = {'doAdd': True} + self.defaults.update(defaults) + + def add(self, obj): + if not isAlreadyInToolSvc(obj.getName()): + factoriesInfo("Adding new Public Tool ===> %s" % obj.getFullName()) + addToToolSvc(obj) + else: + factoriesInfo( + "Public Tool with name == > % s already " + "in ToolSvc using existing instance" % obj.getFullName()) + + +class ServiceFactory(Factory): + """ServiceFactory: to instantiate services. + Adds to ServiceMgr. See Factory""" + + def __init__(self, iclass, **defaults): + self.iclass = iclass + self.defaults = {'doAdd': True} + self.defaults.update(defaults) + + def add(self, obj): + if not isAlreadyInServiceMgr(obj.getName()): + factoriesInfo("Adding new Service ===> %s" % obj.getFullName()) + addToServiceMgr(obj) + else: + factoriesInfo( + "Service with name ==> %s already in ServiceMgr," + "using existing instance" % obj.getFullName()) + + +class AlgFactory(Factory): + """AlgFactory: to instantiate algs and + add them to TopSequence. See Factory""" + + def __init__(self, iclass, **defaults): + self.iclass = iclass + self.defaults = {'doAdd': True} + self.defaults.update(defaults) + + def add(self, obj): + factoriesInfo("Adding new Algorithm ==> %s " % obj.getFullName()) + addToTopSequence(obj) + +def instantiateAll(module=None): + """Instantiate all tools/algs defined by Factories in a given module. + WARNING: in alphabetical order, not in the order they are defined""" + return [obj() for obj in vars(module).values() if isinstance(obj, Factory)] diff --git a/Reconstruction/egamma/egammaRec/python/egammaTruthAssociationAlg.py b/Reconstruction/egamma/egammaRec/python/egammaTruthAssociationAlg.py index 9efccebe12821a506daea0fc51cec8f731a5e11b..9b67c639e73118a75fc3d1ff17f3a5f9c340d66d 100644 --- a/Reconstruction/egamma/egammaRec/python/egammaTruthAssociationAlg.py +++ b/Reconstruction/egamma/egammaRec/python/egammaTruthAssociationAlg.py @@ -1,65 +1,71 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from __future__ import print_function - from RecExConfig.Configured import Configured from egammaRec import egammaKeys from egammaAlgs import egammaAlgsConf -from egammaRec.Factories import ToolFactory, PublicToolFactory, AlgFactory, FcnWrapper -from AthenaCommon.BeamFlags import jobproperties +from egammaRec.Factories import ( + ToolFactory, AlgFactory, FcnWrapper) from egammaRec import egammaRecFlags as egRecFlags -egammaRecFlags = egRecFlags.jobproperties.egammaRecFlags from egammaTools.egammaExtrapolators import egammaCaloExtrapolator -from MCTruthClassifier import MCTruthClassifierConf import AthenaCommon.CfgMgr as CfgMgr +from MCTruthClassifier import MCTruthClassifierConf +egammaRecFlags = egRecFlags.jobproperties.egammaRecFlags + def getSimBarcodeOffset(): - # "Return the simulation barcode offset for G4 particles from metadata" - from PyUtils.MetaReaderPeeker import metadata + # "Return the simulation barcode offset for G4 particles from metadata" + from PyUtils.MetaReaderPeeker import metadata + + offset = 200e3 + try: + return int(metadata['SimBarcodeOffset']) + except Exception: + print('Could not retrieve SimBarcodeOffset from' + '/Simulation/Parameters, leaving at 200k') - offset = 200e3 - try: - return int(metadata['SimBarcodeOffset']) + return int(offset) - except: - print ('Could not retrieve SimBarcodeOffset from /Simulation/Parameters, leaving at 200k') - return int(offset) def getSimBarcodeOffset1(): - "Return the simulation barcode offset for G4 particles from metadata + 1" - return getSimBarcodeOffset() + 1 + "Return the simulation barcode offset for G4 particles from metadata + 1" + return getSimBarcodeOffset() + 1 -EMClassifierParticleCaloExtensionTool = PublicToolFactory (CfgMgr.Trk__ParticleCaloExtensionTool, - name="EMClassifierParticleCaloExtensionTool", - Extrapolator = egammaCaloExtrapolator) -EMMCTruthClassifier = ToolFactory( MCTruthClassifierConf.MCTruthClassifier, name = 'EMMCTruthClassifier', - ParticleCaloExtensionTool=EMClassifierParticleCaloExtensionTool, - barcodeG4Shift = FcnWrapper( getSimBarcodeOffset1 ) ) +EMClassifierParticleCaloExtensionTool = ToolFactory( + CfgMgr.Trk__ParticleCaloExtensionTool, + name="EMClassifierParticleCaloExtensionTool", + Extrapolator=egammaCaloExtrapolator) +EMMCTruthClassifier = ToolFactory( + MCTruthClassifierConf.MCTruthClassifier, + name='EMMCTruthClassifier', + ParticleCaloExtensionTool=EMClassifierParticleCaloExtensionTool, + barcodeG4Shift=FcnWrapper(getSimBarcodeOffset1)) -egammaTruthAssociationAlg = AlgFactory( egammaAlgsConf.egammaTruthAssociationAlg, - ClusterContainerName = egammaKeys.outputClusterKey(), - ElectronContainerName = egammaKeys.outputElectronKey(), - PhotonContainerName = egammaKeys.outputPhotonKey(), - FwdElectronContainerName = egammaKeys.outputFwdElectronKey(), - TruthEventContainerName = egammaKeys.truthEventKey(), - TruthParticleContainerName = egammaKeys.truthParticleKey(), - EgammaTruthContainerName = egammaKeys.outputTruthKey(), - MCTruthClassifier = EMMCTruthClassifier, - MatchForwardElectrons = egammaRecFlags.doEgammaForwardSeeded(), - MatchClusters = False, - SimBarcodeOffset = FcnWrapper( getSimBarcodeOffset ) - ) +egammaTruthAssociationAlg = AlgFactory( + egammaAlgsConf.egammaTruthAssociationAlg, + ClusterContainerName=egammaKeys.outputClusterKey(), + ElectronContainerName=egammaKeys.outputElectronKey(), + PhotonContainerName=egammaKeys.outputPhotonKey(), + FwdElectronContainerName=egammaKeys.outputFwdElectronKey(), + TruthEventContainerName=egammaKeys.truthEventKey(), + TruthParticleContainerName=egammaKeys.truthParticleKey(), + EgammaTruthContainerName=egammaKeys.outputTruthKey(), + MCTruthClassifier=EMMCTruthClassifier, + MatchForwardElectrons=egammaRecFlags.doEgammaForwardSeeded(), + MatchClusters=False, + SimBarcodeOffset=FcnWrapper(getSimBarcodeOffset) +) -class egammaTruthAssociationGetter ( Configured ) : + +class egammaTruthAssociationGetter (Configured): def configure(self): from AthenaCommon.Logging import logging - mlog = logging.getLogger ('egammaTruthAssociationGetter::configure:') + mlog = logging.getLogger('egammaTruthAssociationGetter::configure:') mlog.info('entering') - # configure egammaTruthAssociation here: try: @@ -73,4 +79,3 @@ class egammaTruthAssociationGetter ( Configured ) : def egammaTruthAssociationHandle(self): return self._egammaTruthAssociationHandle - diff --git a/Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py b/Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py index 0578b26cff77101da1ab44cab4a8252581b357f5..587be57d93839acce138a2079c72fbb62d26e1fe 100644 --- a/Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py +++ b/Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py @@ -1,50 +1,45 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function +from egammaTools.egammaToolsFactories import \ + EMClusterTool, EMFourMomBuilder, EMShowerBuilder, egammaOQFlagsBuilder, \ + ElectronPIDBuilder, PhotonPIDBuilder # specifies standard (supercluster) egamma. from AthenaCommon.Logging import logging -from AthenaCommon.SystemOfUnits import * -from AthenaCommon.Constants import * - from AthenaCommon.DetFlags import DetFlags from RecExConfig.Configured import Configured -# -from egammaRec import egammaKeys -from egammaAlgs import egammaAlgsConf -from egammaRec.Factories import AlgFactory, FcnWrapper +from egammaRec.Factories import FcnWrapper from egammaRec import egammaRecFlags as egRecFlags egammaRecFlags = egRecFlags.jobproperties.egammaRecFlags -#Some handy flags -def doConversions() : - return DetFlags.detdescr.ID_on() and egammaRecFlags.doConversions() -################ +def doConversions(): + return DetFlags.detdescr.ID_on() and egammaRecFlags.doConversions() + +# The tools used to add properties -# Import the tool factories -from egammaTools.egammaToolsFactories import \ - EMClusterTool, EMFourMomBuilder, EMShowerBuilder, egammaOQFlagsBuilder, \ - ElectronPIDBuilder, PhotonPIDBuilder -#The tools used to add properties def egammaDecorationTools(): - "Return a list with the tools that decorate both electrons and photons" - return [ EMFourMomBuilder(), egammaOQFlagsBuilder()] + "Return a list with the tools that decorate both electrons and photons" + return [EMFourMomBuilder()] + def electronDecorationTools(): - "Return a list with the tools that decorate only electrons" - return [ ElectronPIDBuilder() ] + "Return a list with the tools that decorate only electrons" + return [ElectronPIDBuilder()] + def photonDecorationTools(): - "Return a list with the tools that decorate only photons" - return [ PhotonPIDBuilder() ] + "Return a list with the tools that decorate only photons" + return [PhotonPIDBuilder()] # -class topoEgammaGetter ( Configured ) : + +class topoEgammaGetter (Configured): def configure(self): - mlog = logging.getLogger ('topoEgammaGetter.py::configure:') + mlog = logging.getLogger('topoEgammaGetter.py::configure:') mlog.info('entering') # # the egammaTopoClusterCopier @@ -58,52 +53,51 @@ class topoEgammaGetter ( Configured ) : # return False # print self._egammaTopoClusterCopierHandle - # the egammaRecBuilder from egammaAlgs.egammaRecBuilder import egammaRecBuilder try: - self._egammaRecBuilder = egammaRecBuilder(doTrackMatching = DetFlags.detdescr.ID_on(), - doConversions = doConversions()) + self._egammaRecBuilder = egammaRecBuilder(doTrackMatching=DetFlags.detdescr.ID_on(), + doConversions=doConversions()) except Exception: mlog.error("could not get handle to egammaRecBuilder") import traceback traceback.print_exc() return False - print (self._egammaRecBuilder) + print(self._egammaRecBuilder) # the supercluster builders from egammaAlgs.egammaSuperClusterBuilder import \ electronSuperClusterBuilder, photonSuperClusterBuilder try: - self._electronSuperClusterBuilder = electronSuperClusterBuilder( - doTrackMatching = DetFlags.detdescr.ID_on()) - self._photonSuperClusterBuilder = photonSuperClusterBuilder( - doConversions = doConversions()) + self._electronSuperClusterBuilder = electronSuperClusterBuilder( + doTrackMatching=DetFlags.detdescr.ID_on()) + self._photonSuperClusterBuilder = photonSuperClusterBuilder( + doConversions=doConversions()) except Exception: mlog.error("could not get handle to supcluster builders") import traceback traceback.print_exc() return False - print (self._electronSuperClusterBuilder) - print (self._photonSuperClusterBuilder) - + print(self._electronSuperClusterBuilder) + print(self._photonSuperClusterBuilder) # the topoEgammaBuilder (the part that puts everything together from egammaAlgs.topoEgammaBuilder import topoEgammaBuilder try: - self._topoEgammaBuilder = topoEgammaBuilder( - EMClusterTool=EMClusterTool, - EMShowerTool=EMShowerBuilder, - # Decoration tools - egammaTools = FcnWrapper(egammaDecorationTools), - ElectronTools = FcnWrapper(electronDecorationTools), - PhotonTools = FcnWrapper(photonDecorationTools) - ) + self._topoEgammaBuilder = topoEgammaBuilder( + EMClusterTool=EMClusterTool, + EMShowerTool=EMShowerBuilder, + ObjectQualityTool=egammaOQFlagsBuilder, + # Decoration tools + egammaTools=FcnWrapper(egammaDecorationTools), + ElectronTools=FcnWrapper(electronDecorationTools), + PhotonTools=FcnWrapper(photonDecorationTools) + ) except Exception: mlog.error("could not get handle to topoEgammaBuilder") import traceback traceback.print_exc() return False - print (self._topoEgammaBuilder) + print(self._topoEgammaBuilder) # the egammaLargeClusterMaker (Which chooses the cells to store in the AOD) from egammaAlgs.egammaLargeClusterMakerAlg import egammaLargeClusterMakerAlg @@ -114,7 +108,6 @@ class topoEgammaGetter ( Configured ) : import traceback traceback.print_exc() return False - print (self._egammaLargeClusterMaker) + print(self._egammaLargeClusterMaker) return True - diff --git a/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py b/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py index 131beba797bbc0b02b440fd2bb22762edf27cef8..d5578eed80d1bb336ca6c6bcd7621bb7028b5536 100755 --- a/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py +++ b/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py @@ -1,81 +1,87 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # default configuration of the EMPIDBuilder +from ROOT import LikeEnum +from ROOT import egammaPID from AthenaCommon.Logging import logging -from AthenaCommon.DetFlags import DetFlags - -import traceback -from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import electronPIDmenu -from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu - -#import base class +# import base class from egammaTools.egammaToolsConf import EMPIDBuilder +# Eventually we need to get rid of this import cppyy cppyy.loadDictionary('ElectronPhotonSelectorToolsDict') -from ROOT import egammaPID -from ROOT import LikeEnum -class EMPIDBuilderElectronBase ( EMPIDBuilder ) : + +class EMPIDBuilderElectronBase (EMPIDBuilder): __slots__ = () def __init__(self, name="EMPIDBuilderElectronBase"): - EMPIDBuilder.__init__(self,name) + EMPIDBuilder.__init__(self, name) mlog = logging.getLogger(name+'::__init__') mlog.debug("entering") - # Electron Selectors - try: - # Cut based - from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector - LooseElectronSelector = ConfiguredAsgElectronIsEMSelector("LooseElectronSelector", egammaPID.ElectronIDLoosePP) - MediumElectronSelector = ConfiguredAsgElectronIsEMSelector("MediumElectronSelector", egammaPID.ElectronIDMediumPP) - TightElectronSelector = ConfiguredAsgElectronIsEMSelector("TightElectronSelector", egammaPID.ElectronIDTightPP) - - # Likelihood - from ElectronPhotonSelectorTools.ConfiguredAsgElectronLikelihoodTools import ConfiguredAsgElectronLikelihoodTool - LooseLHSelector = ConfiguredAsgElectronLikelihoodTool("LooseLHSelector", LikeEnum.Loose) - LooseLHSelector.primaryVertexContainer="PrimaryVertices" - MediumLHSelector = ConfiguredAsgElectronLikelihoodTool("MediumLHSelector", LikeEnum.Medium) - MediumLHSelector.primaryVertexContainer="PrimaryVertices" - TightLHSelector = ConfiguredAsgElectronLikelihoodTool("TightLHSelector", LikeEnum.Tight) - TightLHSelector.primaryVertexContainer="PrimaryVertices" - - # Multi Lepton - from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronMultiLeptonSelector - MultiLeptonSelector=AsgElectronMultiLeptonSelector("MultiLeptonSelector") - - except: - mlog.error("could not get configure tools") - traceback.print_exc() - return False - - self.electronIsEMselectors = [LooseElectronSelector, MediumElectronSelector, TightElectronSelector] + # Cut based + from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors \ + import ConfiguredAsgElectronIsEMSelector + + LooseElectronSelector = ConfiguredAsgElectronIsEMSelector( + "LooseElectronSelector", egammaPID.ElectronIDLoosePP) + MediumElectronSelector = ConfiguredAsgElectronIsEMSelector( + "MediumElectronSelector", egammaPID.ElectronIDMediumPP) + TightElectronSelector = ConfiguredAsgElectronIsEMSelector( + "TightElectronSelector", egammaPID.ElectronIDTightPP) + + # Likelihood + from ElectronPhotonSelectorTools.ConfiguredAsgElectronLikelihoodTools \ + import ConfiguredAsgElectronLikelihoodTool + LooseLHSelector = ConfiguredAsgElectronLikelihoodTool( + "LooseLHSelector", LikeEnum.Loose) + LooseLHSelector.primaryVertexContainer = "PrimaryVertices" + MediumLHSelector = ConfiguredAsgElectronLikelihoodTool( + "MediumLHSelector", LikeEnum.Medium) + MediumLHSelector.primaryVertexContainer = "PrimaryVertices" + TightLHSelector = ConfiguredAsgElectronLikelihoodTool( + "TightLHSelector", LikeEnum.Tight) + TightLHSelector.primaryVertexContainer = "PrimaryVertices" + + # Multi Lepton + from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf \ + import AsgElectronMultiLeptonSelector + MultiLeptonSelector = AsgElectronMultiLeptonSelector( + "MultiLeptonSelector") + + self.electronIsEMselectors = [ + LooseElectronSelector, + MediumElectronSelector, + TightElectronSelector] + self.electronIsEMselectorResultNames = ["Loose", "Medium", "Tight"] - self.electronLHselectors = [LooseLHSelector, MediumLHSelector, TightLHSelector] - self.electronLHselectorResultNames= ["LHLoose","LHMedium","LHTight"] - self.genericIsEMselectors =[MultiLeptonSelector] - self.genericIsEMselectorResultNames=["MultiLepton"] + self.electronLHselectors = [ + LooseLHSelector, MediumLHSelector, TightLHSelector] + self.electronLHselectorResultNames = ["LHLoose", "LHMedium", "LHTight"] + self.genericIsEMselectors = [MultiLeptonSelector] + self.genericIsEMselectorResultNames = ["MultiLepton"] + self.LuminosityTool = None + -class EMPIDBuilderPhotonBase ( EMPIDBuilder ) : +class EMPIDBuilderPhotonBase (EMPIDBuilder): __slots__ = () def __init__(self, name="EMPIDBuilderPhotonBase"): - EMPIDBuilder.__init__(self,name) + EMPIDBuilder.__init__(self, name) mlog = logging.getLogger(name+'::__init__') mlog.debug("entering") # photon Selectors - try: - from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector - LoosePhotonSelector = ConfiguredAsgPhotonIsEMSelector("LoosePhotonSelector", egammaPID.PhotonIDLoose) - TightPhotonSelector = ConfiguredAsgPhotonIsEMSelector("TightPhotonSelector", egammaPID.PhotonIDTight) - - except: - mlog.error("could not get configure tools") - traceback.print_exc() - return False - - self.photonIsEMselectors= [LoosePhotonSelector,TightPhotonSelector] - self.photonIsEMselectorResultNames = ["Loose","Tight"] + + from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors \ + import ConfiguredAsgPhotonIsEMSelector + LoosePhotonSelector = ConfiguredAsgPhotonIsEMSelector( + "LoosePhotonSelector", egammaPID.PhotonIDLoose) + TightPhotonSelector = ConfiguredAsgPhotonIsEMSelector( + "TightPhotonSelector", egammaPID.PhotonIDTight) + + self.photonIsEMselectors = [LoosePhotonSelector, TightPhotonSelector] + self.photonIsEMselectorResultNames = ["Loose", "Tight"] + self.LuminosityTool = None diff --git a/Reconstruction/egamma/egammaTools/python/EMShowerBuilder.py b/Reconstruction/egamma/egammaTools/python/EMShowerBuilder.py index 9b79a278e072527887c50a880bec9879dda04b8d..5c42732602af43a1515207392eed0463be3426e1 100644 --- a/Reconstruction/egamma/egammaTools/python/EMShowerBuilder.py +++ b/Reconstruction/egamma/egammaTools/python/EMShowerBuilder.py @@ -1,32 +1,22 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "ToolFactory to instantiate all EMShowerBuilder with default configuration" +__doc__ = """ToolFactory to instantiate all EMShowerBuilder +with default configuration""" __author__ = "Bruno Lenzi" -from AthenaCommon.Constants import INFO # OutputLevel + from egammaTools import egammaToolsConf -from egammaRec.Factories import ToolFactory, getPropertyValue +from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys -from egammaCaloTools.egammaCaloToolsFactories import egammaShowerShape, \ - egammaIso - -import ROOT, cppyy -# Need to be sure base dict is loaded first. -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -EgammaParameters = ROOT.xAOD.Iso - -from CaloIdentifier import SUBCALO -from RecExConfig.RecFlags import rec +from egammaCaloTools.egammaCaloToolsFactories import ( + egammaShowerShape, egammaIso) +from CaloIdentifier import SUBCALO -# TODO: not needed ? -# from CaloDetDescr.CaloDepthToolBase import CaloDepthToolFactory -# theCaloDepthTool=CaloDepthToolFactory(depth='showerdefault') - -EMShowerBuilder = ToolFactory( egammaToolsConf.EMShowerBuilder, - CellsName = egammaKeys.caloCellKey(), - CaloNums = [SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.TILE], - ShowerShapeTool = egammaShowerShape, - HadronicLeakageTool = egammaIso, - Print = False) +EMShowerBuilder = ToolFactory( + egammaToolsConf.EMShowerBuilder, + CellsName=egammaKeys.caloCellKey(), + CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.TILE], + ShowerShapeTool=egammaShowerShape, + HadronicLeakageTool=egammaIso, + Print=False) diff --git a/Reconstruction/egamma/egammaTools/python/EMTrackMatchBuilder.py b/Reconstruction/egamma/egammaTools/python/EMTrackMatchBuilder.py index 1baa10747f10cf7a11e11123e754e7f7033f5a6a..5dab286d0120f3edfccb6a58b2f7dcdcb4174dc7 100644 --- a/Reconstruction/egamma/egammaTools/python/EMTrackMatchBuilder.py +++ b/Reconstruction/egamma/egammaTools/python/EMTrackMatchBuilder.py @@ -1,23 +1,25 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "ToolFactory to instantiate EMTrackMatchBuilder with default configuration" +__doc__ = """ToolFactory to instantiate +EMTrackMatchBuilder with default configuration""" __author__ = "Bruno Lenzi" from egammaTools import egammaToolsConf -from egammaRec.Factories import FcnWrapper, ToolFactory +from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys -from RecExConfig.RecFlags import rec from AthenaCommon.BeamFlags import jobproperties -from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools, EMExtrapolationToolsCache +from egammaTrackTools.egammaTrackToolsFactories import ( + EMExtrapolationToolsCache) -EMTrackMatchBuilder = ToolFactory( egammaToolsConf.EMTrackMatchBuilder, - TrackParticlesName = egammaKeys.outputTrackParticleKey(), - ExtrapolationTool = EMExtrapolationToolsCache, - broadDeltaEta = 0.1, #candidate match is done in 2 times this so +- 0.2 - broadDeltaPhi = 0.15, #candidate match is done in 2 times this so +- 0.3 - useCandidateMatch = True, - useScoring = True, - SecondPassRescale = True, - UseRescaleMetric = True, - isCosmics = (jobproperties.Beam.beamType()=="cosmics") +EMTrackMatchBuilder = ToolFactory( + egammaToolsConf.EMTrackMatchBuilder, + TrackParticlesName=egammaKeys.outputTrackParticleKey(), + ExtrapolationTool=EMExtrapolationToolsCache, + broadDeltaEta=0.1, # candidate match is done in 2 times this so +- 0.2 + broadDeltaPhi=0.15, # candidate match is done in 2 times this so +- 0.3 + useCandidateMatch=True, + useScoring=True, + SecondPassRescale=True, + UseRescaleMetric=True, + isCosmics=(jobproperties.Beam.beamType() == "cosmics") ) diff --git a/Reconstruction/egamma/egammaTools/python/egammaExtrapolators.py b/Reconstruction/egamma/egammaTools/python/egammaExtrapolators.py index c199205e9233f9bf946480109cc8241e1caf9947..e3ef3242e0b6b6ffd5264cda005d1b1dc7ad3aa4 100644 --- a/Reconstruction/egamma/egammaTools/python/egammaExtrapolators.py +++ b/Reconstruction/egamma/egammaTools/python/egammaExtrapolators.py @@ -1,85 +1,89 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from egammaRec.Factories import ToolFactory, PublicToolFactory +from TrkExTools.AtlasExtrapolator import AtlasExtrapolator __doc__ = "ToolFactories to instantiate InDet tools for egamma with default configuration" __author__ = "Bruno Lenzi" -from egammaRec.Factories import FcnWrapper, ToolFactory, PublicToolFactory - # Tools for extrapolating to the calo -def configureExtrapolator( egammaExtrapolator ): - - from AthenaCommon.AppMgr import ToolSvc - # this turns off dynamic calculation of eloss in calorimeters - egammaExtrapolator.DoCaloDynamic = False - - # all left to MaterialEffects/EnergyLossUpdators - from TrkExTools.TrkExToolsConf import Trk__MaterialEffectsUpdator as MaterialEffectsUpdator - egammaMaterialEffectsUpdator = MaterialEffectsUpdator(name = 'egammaMaterialEffectsUpdator') - egammaNoElossMaterialEffectsUpdator = MaterialEffectsUpdator(name = 'egammaNoElossMaterialEffectsUpdator') - egammaNoElossMaterialEffectsUpdator.EnergyLoss = False - - if not hasattr(ToolSvc,'egammaMaterialEffectsUpdator'): - ToolSvc += egammaMaterialEffectsUpdator - if not hasattr(ToolSvc,'egammaNoElossMaterialEffectsUpdator'): - ToolSvc += egammaNoElossMaterialEffectsUpdator - - MyUpdators = [] - MyUpdators += [egammaMaterialEffectsUpdator] - MyUpdators += [egammaNoElossMaterialEffectsUpdator] - - MySubUpdators = [] - MySubUpdators += [ egammaMaterialEffectsUpdator.name() ] # for Global - MySubUpdators += [ egammaMaterialEffectsUpdator.name() ] # for ID - MySubUpdators += [ egammaMaterialEffectsUpdator.name() ] # for BeamPipe - MySubUpdators += [ egammaNoElossMaterialEffectsUpdator.name() ] # for Calo - MySubUpdators += [ egammaNoElossMaterialEffectsUpdator.name() ] # for muon spectrometer - MySubUpdators += [ egammaMaterialEffectsUpdator.name() ] # for cavern - - #egamma RungeKutta Propagator - from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as RkPropagator - egammaRungeKuttaPropagator = RkPropagator(name = 'egammaRungeKuttaPropagator') - - #egamma STEP_Propagator with no material effects - from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator as STEP_Propagator - egammaNoMatSTEP_Propagator = STEP_Propagator(name = 'egammaNoMatSTEP_Propagator') - egammaNoMatSTEP_Propagator.MaterialEffects=False - - if not hasattr(ToolSvc,'egammaRungeKuttaPropagator'): - ToolSvc += egammaRungeKuttaPropagator - if not hasattr(ToolSvc,'egammaNoMatSTEP_Propagator'): - ToolSvc += egammaNoMatSTEP_Propagator - - myPropagators = [] - myPropagators += [egammaRungeKuttaPropagator] - myPropagators += [egammaNoMatSTEP_Propagator] - - MySubPropagators = [] - MySubPropagators += [ egammaRungeKuttaPropagator.name() ] # for Global - MySubPropagators += [ egammaRungeKuttaPropagator.name() ] # for ID - MySubPropagators += [ egammaRungeKuttaPropagator.name()] # for BeamPipe - MySubPropagators += [ egammaRungeKuttaPropagator.name() ] # for Calo - MySubPropagators += [ egammaNoMatSTEP_Propagator.name() ] # for MS - MySubPropagators += [ egammaRungeKuttaPropagator.name() ] # for cavern - - egammaExtrapolator.MaterialEffectsUpdators = MyUpdators - egammaExtrapolator.SubMEUpdators = MySubUpdators - egammaExtrapolator.Propagators = myPropagators - egammaExtrapolator.SubPropagators = MySubPropagators - #egamma STEP with no eloss for calo intersections - egammaExtrapolator.STEP_Propagator=egammaNoMatSTEP_Propagator -############### -from TrkExTools.AtlasExtrapolator import AtlasExtrapolator -#The general use extrapolator now same as ATLAS default -egammaExtrapolator = ToolFactory(AtlasExtrapolator, - name = 'egammaExtrapolator') +def configureExtrapolator(egammaExtrapolator): + + # this turns off dynamic calculation of eloss in calorimeters + egammaExtrapolator.DoCaloDynamic = False + + # all left to MaterialEffects/EnergyLossUpdators + from TrkExTools.TrkExToolsConf import ( + Trk__MaterialEffectsUpdator as MaterialEffectsUpdator) + + egammaMaterialEffectsUpdator = MaterialEffectsUpdator( + name='egammaMaterialEffectsUpdator') + egammaNoElossMaterialEffectsUpdator = MaterialEffectsUpdator( + name='egammaNoElossMaterialEffectsUpdator') + egammaNoElossMaterialEffectsUpdator.EnergyLoss = False + + MyUpdators = [] + MyUpdators += [egammaMaterialEffectsUpdator] + MyUpdators += [egammaNoElossMaterialEffectsUpdator] + + MySubUpdators = [] + MySubUpdators += [egammaMaterialEffectsUpdator.name()] # for Global + MySubUpdators += [egammaMaterialEffectsUpdator.name()] # for ID + MySubUpdators += [egammaMaterialEffectsUpdator.name()] # for BeamPipe + MySubUpdators += [egammaNoElossMaterialEffectsUpdator.name()] # for Calo + # for muon spectrometer + MySubUpdators += [egammaNoElossMaterialEffectsUpdator.name()] + MySubUpdators += [egammaMaterialEffectsUpdator.name()] # for cavern + + # egamma RungeKutta Propagator + from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import ( + Trk__RungeKuttaPropagator as RkPropagator) + egammaRungeKuttaPropagator = RkPropagator( + name='egammaRungeKuttaPropagator') + + # egamma STEP_Propagator with no material effects + from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import ( + Trk__STEP_Propagator as STEP_Propagator) + egammaNoMatSTEP_Propagator = STEP_Propagator( + name='egammaNoMatSTEP_Propagator') + egammaNoMatSTEP_Propagator.MaterialEffects = False + + myPropagators = [] + myPropagators += [egammaRungeKuttaPropagator] + myPropagators += [egammaNoMatSTEP_Propagator] + + MySubPropagators = [] + MySubPropagators += [egammaRungeKuttaPropagator.name()] # for Global + MySubPropagators += [egammaRungeKuttaPropagator.name()] # for ID + MySubPropagators += [egammaRungeKuttaPropagator.name()] # for BeamPipe + MySubPropagators += [egammaRungeKuttaPropagator.name()] # for Calo + MySubPropagators += [egammaNoMatSTEP_Propagator.name()] # for MS + MySubPropagators += [egammaRungeKuttaPropagator.name()] # for cavern + + egammaExtrapolator.MaterialEffectsUpdators = MyUpdators + egammaExtrapolator.SubMEUpdators = MySubUpdators + egammaExtrapolator.Propagators = myPropagators + egammaExtrapolator.SubPropagators = MySubPropagators + # egamma STEP with no eloss for calo intersections + egammaExtrapolator.STEP_Propagator = egammaNoMatSTEP_Propagator + +############### -#Specialized for e/gamma calo extrapolations i.e ignore material effect -#that are not that relevant in the calo side -egammaCaloExtrapolator = ToolFactory(AtlasExtrapolator, - postInit=[configureExtrapolator], - name = 'egammaCaloExtrapolator') +# The general use extrapolator same as ATLAS default +egammaExtrapolator = ToolFactory( + AtlasExtrapolator, + name='egammaExtrapolator') +# The general use extrapolator same as ATLAS default public +AtlasPublicExtrapolator = PublicToolFactory( + AtlasExtrapolator, + name='AtlasPublicExtrapolator') +# Specialized for e/gamma calo extrapolations i.e ignore material effect +# that are not that relevant in the calo side +egammaCaloExtrapolator = ToolFactory( + AtlasExtrapolator, + postInit=[configureExtrapolator], + name='egammaCaloExtrapolator') diff --git a/Reconstruction/egamma/egammaTools/python/egammaOQFlagsBuilder.py b/Reconstruction/egamma/egammaTools/python/egammaOQFlagsBuilder.py index 66d363b557ca5269ceb2bbdf56d60470bce337ee..5f381654c9276edb832b04bb56fbd3079385ea74 100644 --- a/Reconstruction/egamma/egammaTools/python/egammaOQFlagsBuilder.py +++ b/Reconstruction/egamma/egammaTools/python/egammaOQFlagsBuilder.py @@ -1,18 +1,19 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from egammaTools import egammaToolsConf -from egammaRec.Factories import FcnWrapper, ToolFactory +from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys from CaloTools.CaloToolsConf import CaloAffectedTool -egammaOQFlagsBuilder = ToolFactory( egammaToolsConf.egammaOQFlagsBuilder, - QCellCut = 4000., - QCellHECCut = 60000., - QCellSporCut = 4000., - LArQCut = 0.8, - TCut = 10., - TCutVsE = 2., - RcellCut = 0.8, - CellsName = egammaKeys.caloCellKey(), - affectedTool = CaloAffectedTool()) +egammaOQFlagsBuilder = ToolFactory( + egammaToolsConf.egammaOQFlagsBuilder, + QCellCut=4000., + QCellHECCut=60000., + QCellSporCut=4000., + LArQCut=0.8, + TCut=10., + TCutVsE=2., + RcellCut=0.8, + CellsName=egammaKeys.caloCellKey(), + affectedTool=CaloAffectedTool()) diff --git a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py index c0397adeeef91e2f64365f8e11338bee0c7594cc..c7dc2ab67b0e5dc93388d9c37eb03c03146e0989 100644 --- a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py +++ b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py @@ -1,106 +1,143 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "ToolFactories to instantiate all egammaTools with default configuration" +__doc__ = """ToolFactories to instantiate +all egammaTools with default configuration""" __author__ = "Bruno Lenzi" + +from ROOT import egammaPID +import cppyy +from ElectronPhotonSelectorTools.ConfiguredAsgForwardElectronIsEMSelectors \ + import ConfiguredAsgForwardElectronIsEMSelector +from .EMPIDBuilderBase import EMPIDBuilderPhotonBase +from .EMPIDBuilderBase import EMPIDBuilderElectronBase +from ElectronPhotonSelectorTools import ElectronPhotonSelectorToolsConf +from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools +from egammaMVACalib.egammaMVACalibFactories import egammaMVASvc + + from egammaTools import egammaToolsConf -from egammaRec.Factories import FcnWrapper, ToolFactory +from egammaRec.Factories import ToolFactory from egammaRec import egammaKeys -from egammaRec.egammaRecFlags import jobproperties # to set jobproperties.egammaRecFlags -from RecExConfig.RecFlags import rec +# to set jobproperties.egammaRecFlags +from egammaRec.egammaRecFlags import jobproperties import six + def configureClusterCorrections(swTool): - "Add attributes ClusterCorrectionToolsXX to egammaSwTool object" - from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1, \ - etaoff_b2,etaoff_e2,phioff_b2,phioff_e2,update,time,listBadChannel - from CaloRec.CaloRecMakers import _process_tools - - clusterTypes = dict( - Ele35='ele35', Ele55='ele55', Ele37='ele37', - Gam35='gam35_unconv', Gam55='gam55_unconv',Gam37='gam37_unconv', - Econv35='gam35_conv', Econv55='gam55_conv', Econv37='gam37_conv' - ) - for attrName, clName in six.iteritems (clusterTypes): - x = 'ClusterCorrectionTools' + attrName - if not hasattr(swTool, x) or getattr(swTool, x): - continue - y = make_CaloSwCorrections(clName, suffix='EG', - version = jobproperties.egammaRecFlags.clusterCorrectionVersion(), - cells_name=egammaKeys.caloCellKey() ) - setattr(swTool, x, _process_tools (swTool, y) ) - - #Super cluster position only corrections - if jobproperties.egammaRecFlags.doSuperclusters(): - for attrName, clName in six.iteritems (clusterTypes): - n = 'ClusterCorrectionToolsSuperCluster' + attrName - if not hasattr(swTool, n) or getattr(swTool, n): - continue - - setattr(swTool, n ,_process_tools(swTool, - make_CaloSwCorrections(clName, suffix ='EGSuperCluster', - corrlist=[[rfac,'v5'],[etaoff_b1,'v5'],[etaoff_e1,'v5'], - [etaoff_b2,'v5'],[etaoff_e2,'v5'], [phioff_b2, 'v5data'], - [phioff_e2, 'v5data'], [update], [time], [listBadChannel]], - cells_name=egammaKeys.caloCellKey() ))) - #End of super cluster position only corrections -#------------------------- + "Add attributes ClusterCorrectionToolsXX to egammaSwTool object" + from CaloClusterCorrection.CaloSwCorrections import ( + make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1, + etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update, + time, listBadChannel) + from CaloRec.CaloRecMakers import _process_tools + + clusterTypes = dict( + Ele35='ele35', Ele55='ele55', Ele37='ele37', + Gam35='gam35_unconv', Gam55='gam55_unconv', Gam37='gam37_unconv', + Econv35='gam35_conv', Econv55='gam55_conv', Econv37='gam37_conv' + ) + for attrName, clName in six.iteritems(clusterTypes): + x = 'ClusterCorrectionTools' + attrName + if not hasattr(swTool, x) or getattr(swTool, x): + continue + y = make_CaloSwCorrections( + clName, + suffix='EG', + version=jobproperties.egammaRecFlags.clusterCorrectionVersion(), + cells_name=egammaKeys.caloCellKey()) + setattr(swTool, x, _process_tools(swTool, y)) + + # Super cluster position only corrections + if jobproperties.egammaRecFlags.doSuperclusters(): + for attrName, clName in six.iteritems(clusterTypes): + n = 'ClusterCorrectionToolsSuperCluster' + attrName + if not hasattr(swTool, n) or getattr(swTool, n): + continue + + setattr(swTool, n, _process_tools( + swTool, + make_CaloSwCorrections( + clName, + suffix='EGSuperCluster', + corrlist=[ + [rfac, 'v5'], + [etaoff_b1, 'v5'], + [etaoff_e1, 'v5'], + [etaoff_b2, 'v5'], + [etaoff_e2, 'v5'], + [phioff_b2, 'v5data'], + [phioff_e2, 'v5data'], + [update], + [time], + [listBadChannel]], + cells_name=egammaKeys.caloCellKey()))) + # End of super cluster position only corrections + egammaSwTool = ToolFactory(egammaToolsConf.egammaSwTool, postInit=[configureClusterCorrections]) -from egammaMVACalib.egammaMVACalibFactories import egammaMVASvc - -EMClusterTool = ToolFactory(egammaToolsConf.EMClusterTool, - OutputClusterContainerName = egammaKeys.outputClusterKey(), - OutputTopoSeededClusterContainerName = egammaKeys.outputTopoSeededClusterKey(), - ClusterCorrectionTool = egammaSwTool, - doSuperCluster = jobproperties.egammaRecFlags.doSuperclusters(), - MVACalibSvc = egammaMVASvc - ) - -from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools +EMClusterTool = ToolFactory( + egammaToolsConf.EMClusterTool, + OutputClusterContainerName=egammaKeys.outputClusterKey(), + OutputTopoSeededClusterContainerName=egammaKeys.outputTopoSeededClusterKey(), + ClusterCorrectionTool=egammaSwTool, + doSuperCluster=jobproperties.egammaRecFlags.doSuperclusters(), + MVACalibSvc=egammaMVASvc +) -EMConversionBuilder = ToolFactory( egammaToolsConf.EMConversionBuilder, - ConversionContainerName = egammaKeys.outputConversionKey(), - ExtrapolationTool = EMExtrapolationTools) +EMConversionBuilder = ToolFactory( + egammaToolsConf.EMConversionBuilder, + ConversionContainerName=egammaKeys.outputConversionKey(), + ExtrapolationTool=EMExtrapolationTools) -from ElectronPhotonSelectorTools import ElectronPhotonSelectorToolsConf -EGammaAmbiguityTool = ToolFactory( ElectronPhotonSelectorToolsConf.EGammaAmbiguityTool ) +EGammaAmbiguityTool = ToolFactory( + ElectronPhotonSelectorToolsConf.EGammaAmbiguityTool) -EMFourMomBuilder = ToolFactory( egammaToolsConf.EMFourMomBuilder) +EMFourMomBuilder = ToolFactory(egammaToolsConf.EMFourMomBuilder) -egammaLargeClusterMakerTool = ToolFactory( egammaToolsConf.egammaLargeClusterMaker, - name = "egammaLCMakerTool", - InputClusterCollection = egammaKeys.ClusterKey(), - CellsName = egammaKeys.caloCellKey() - ) +egammaLargeClusterMakerTool = ToolFactory( + egammaToolsConf.egammaLargeClusterMaker, + name="egammaLCMakerTool", + InputClusterCollection=egammaKeys.ClusterKey(), + CellsName=egammaKeys.caloCellKey() +) # Electron Selectors -from .EMPIDBuilderBase import EMPIDBuilderElectronBase -ElectronPIDBuilder = ToolFactory( EMPIDBuilderElectronBase, name = "ElectronPIDBuilder") +ElectronPIDBuilder = ToolFactory( + EMPIDBuilderElectronBase, + name="ElectronPIDBuilder") # Photon Selectors -from .EMPIDBuilderBase import EMPIDBuilderPhotonBase -PhotonPIDBuilder = ToolFactory( EMPIDBuilderPhotonBase, name = "PhotonPIDBuilder") +PhotonPIDBuilder = ToolFactory( + EMPIDBuilderPhotonBase, + name="PhotonPIDBuilder") # ForwardElectron Selectors -from ElectronPhotonSelectorTools.ConfiguredAsgForwardElectronIsEMSelectors import ConfiguredAsgForwardElectronIsEMSelector -import cppyy +# Eventually we want to get rid of cppyy here cppyy.loadDictionary('ElectronPhotonSelectorToolsDict') -from ROOT import egammaPID - -LooseForwardElectronSelector = ToolFactory( ConfiguredAsgForwardElectronIsEMSelector, name="LooseForwardElectronSelector", quality = egammaPID.ForwardElectronIDLoose ) -MediumForwardElectronSelector = ToolFactory( ConfiguredAsgForwardElectronIsEMSelector, name="MediumForwardElectronSelector", quality = egammaPID.ForwardElectronIDMedium ) -TightForwardElectronSelector = ToolFactory( ConfiguredAsgForwardElectronIsEMSelector, name="TightForwardElectronSelector", quality = egammaPID.ForwardElectronIDTight ) -#------------------------- +LooseForwardElectronSelector = ToolFactory( + ConfiguredAsgForwardElectronIsEMSelector, + name="LooseForwardElectronSelector", + quality=egammaPID.ForwardElectronIDLoose) +MediumForwardElectronSelector = ToolFactory( + ConfiguredAsgForwardElectronIsEMSelector, + name="MediumForwardElectronSelector", + quality=egammaPID.ForwardElectronIDMedium) +TightForwardElectronSelector = ToolFactory( + ConfiguredAsgForwardElectronIsEMSelector, + name="TightForwardElectronSelector", + quality=egammaPID.ForwardElectronIDTight) + +# ------------------------- # Import the factories that are not defined here -from .EMShowerBuilder import EMShowerBuilder -from .egammaOQFlagsBuilder import egammaOQFlagsBuilder from .EMTrackMatchBuilder import EMTrackMatchBuilder +from .egammaOQFlagsBuilder import egammaOQFlagsBuilder +from .EMShowerBuilder import EMShowerBuilder diff --git a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx index 1a1b2022a73a6574bd70dd7f0dafd45125c8f4e6..47293e26ebba3c80acb081d880fc000347a8bf10 100644 --- a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx @@ -15,30 +15,17 @@ EMPIDBuilder::EMPIDBuilder(const std::string& type, const IInterface* parent) : egammaBaseTool(type, name, parent) { - // - // constructor - // - // declare interface declareInterface<IegammaBaseTool>(this); } -// =============================================================== EMPIDBuilder::~EMPIDBuilder() { - // - // destructor - // } -// ================================================================== StatusCode EMPIDBuilder::initialize() { - // - // initialize method - // - ATH_MSG_DEBUG(" Initializing EMPIDBuilder"); ATH_CHECK(m_electronIsEMselectors.retrieve()); @@ -70,31 +57,25 @@ StatusCode EMPIDBuilder::initialize() } if (m_UselumiBlockMuTool) { - // retrieve the lumi tool - if (m_lumiBlockMuTool.retrieve().isFailure()) { + std::cout << "enabling lumiBlockMuTool" <<std::endl; + if (m_lumiBlockMuTool.retrieve().isFailure()) { ATH_MSG_FATAL("Unable to retrieve Luminosity Tool"); return StatusCode::FAILURE; } else { ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool"); } } else { + std::cout << "disabling lumiBlockMuTool" <<std::endl; m_lumiBlockMuTool.disable(); } return StatusCode::SUCCESS; } -// ==================================================================== StatusCode EMPIDBuilder::finalize() { - // - // finalize method - // - return StatusCode::SUCCESS; } - -// ===================================================================== StatusCode EMPIDBuilder::execute(const EventContext& ctx, xAOD::Egamma* eg) const { @@ -155,11 +136,13 @@ StatusCode EMPIDBuilder::execute(const EventContext& ctx, xAOD::Egamma* eg) cons //save the bool result eg->setPassSelection(static_cast<bool>(accept), m_electronLHselectorResultNames[i]); //save the isem - eg->setSelectionisEM(static_cast<unsigned int> (accept.getCutResultInverted()), "isEM"+m_electronLHselectorResultNames[i]); + eg->setSelectionisEM(static_cast<unsigned int>(accept.getCutResultInverted()), + "isEM" + m_electronLHselectorResultNames[i]); //save the LHValue only once if(i==0){ - eg->setLikelihoodValue(static_cast<float>(m_electronLHselectors[i]->calculate(ctx,eg,avg_mu)), m_LHValueName); + eg->setLikelihoodValue( + static_cast<float>(m_electronLHselectors[i]->calculate(ctx, eg, avg_mu)),m_LHValueName); } } @@ -169,12 +152,11 @@ StatusCode EMPIDBuilder::execute(const EventContext& ctx, xAOD::Egamma* eg) cons //save the bool result eg->setPassSelection(static_cast<bool>(accept), m_genericIsEMselectorResultNames[i]); //save the isem - eg->setSelectionisEM(static_cast<unsigned int> (accept.getCutResultInverted()), "isEM"+m_genericIsEMselectorResultNames[i]); + eg->setSelectionisEM(static_cast<unsigned int>(accept.getCutResultInverted()), + "isEM" + m_genericIsEMselectorResultNames[i]); } return StatusCode::SUCCESS; } - - diff --git a/Reconstruction/egamma/egammaTools/src/egammaBaseTool.cxx b/Reconstruction/egamma/egammaTools/src/egammaBaseTool.cxx index 24ada195be4454c68c14c4147bdd143ab49e726e..addb54a1a8e0a379e91fa9862ece823f3e8bbe28 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaBaseTool.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaBaseTool.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "egammaBaseTool.h" -// INCLUDE Header Files: -// ==================================================================================== egammaBaseTool::egammaBaseTool(const std::string& type, const std::string& name, const IInterface* parent): @@ -15,16 +13,13 @@ egammaBaseTool::egammaBaseTool(const std::string& type, declareInterface<IegammaBaseTool>(this); } -// ==================================================================================== egammaBaseTool::~egammaBaseTool() { } -// ==================================================================================== StatusCode egammaBaseTool::initialize() { return StatusCode::SUCCESS; } -// ========================================================================================= StatusCode egammaBaseTool::finalize(){ return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaTools/src/egammaBaseTool.h b/Reconstruction/egamma/egammaTools/src/egammaBaseTool.h index 6de053386d381c5bfa2245c2533e2c7e7ec9e580..7108ec7992698619dd9325553ac25214389fe2b0 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaBaseTool.h +++ b/Reconstruction/egamma/egammaTools/src/egammaBaseTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMATOOLS_EGAMMABASETOOL_H @@ -8,32 +8,37 @@ /** @class egammaBaseTool Base Tool for all egamma tool that require - an egamma object as its input. Hence the specific versions + an egamma object as its input. Hence the specific versions will have access to all the framework services in addition of being passed an 'egamma' object. The derived - tool must implement an execute(egamma*) method. + tools must implement + execute(const EventContext& ctx, xAOD::Egamma* eg). + Used typically for constucting ToolHandleArrays of + egammaTools @author F. Derue, A. Kaczmarska */ // INCLUDE HEADER FILES: #include "AthenaBaseComps/AthAlgTool.h" #include "egammaInterfaces/IegammaBaseTool.h" - -class egammaBaseTool : public AthAlgTool, virtual public IegammaBaseTool{ - public: +class egammaBaseTool + : public AthAlgTool + , virtual public IegammaBaseTool +{ + +public: /** @brief Default constructor*/ - egammaBaseTool(const std::string& name, const std::string& description, - const IInterface* parent); - /** @brief destructor*/ - virtual ~egammaBaseTool(); + egammaBaseTool(const std::string& name, + const std::string& description, + const IInterface* parent); + /** @brief destructor*/ + virtual ~egammaBaseTool(); - /** @brief initialize method*/ - StatusCode initialize() override; - /** @brief finalize method*/ - StatusCode finalize() override; - - + /** @brief initialize method*/ + StatusCode initialize() override; + /** @brief finalize method*/ + StatusCode finalize() override; }; #endif // EGAMMATOOLS_EGAMMABASETOOL_H diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx index fbb8be357cf3c3f841710ac01745da86db8dfba8..449164fb2356e3bf3fd5e4a22cf9f267d9ed4563 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx @@ -4,127 +4,124 @@ // INCLUDE HEADER FILES: #include "egammaOQFlagsBuilder.h" +#include "xAODCaloEvent/CaloCluster.h" #include "xAODEgamma/Egamma.h" #include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODCaloEvent/CaloCluster.h" -#include <algorithm> -#include <math.h> +#include <algorithm> +#include <cmath> +#include <vector> -#include "StoreGate/StoreGateSvc.h" +#include "CLHEP/Units/SystemOfUnits.h" #include "CaloConditions/CaloAffectedRegionInfoVec.h" -#include "Identifier/HWIdentifier.h" -#include "CaloIdentifier/LArEM_ID.h" #include "CaloIdentifier/CaloCell_ID.h" -#include "CLHEP/Units/SystemOfUnits.h" +#include "CaloIdentifier/LArEM_ID.h" #include "FourMomUtils/P4Helpers.h" +#include "Identifier/HWIdentifier.h" #include "StoreGate/ReadHandle.h" -// END OF HEADER FILES INCLUDE +#include "StoreGate/StoreGateSvc.h" using CLHEP::GeV; - -// =========================================================================== -egammaOQFlagsBuilder::egammaOQFlagsBuilder(const std::string& type, - const std::string& name, - const IInterface* parent) - : egammaBaseTool(type, name, parent), - m_emHelper(nullptr) +namespace { +bool +isbadtilecell(CaloCellList& ccl, + const CaloDetDescrManager& cmgr, + const float clusterEta, + const float clusterPhi, + const double sizeEta, + const double sizePhi, + const CaloSampling::CaloSample sample) { - // - // constructor - // - // declare interface - declareInterface<IegammaBaseTool>(this); + bool isbadtilecell = false; + ccl.select(cmgr,clusterEta, clusterPhi, sizeEta, sizePhi, sample); + CaloCellList::list_iterator cclIter = ccl.begin(); + CaloCellList::list_iterator cclIterEnd = ccl.end(); + for (; cclIter != cclIterEnd; cclIter++) { + const CaloCell* cell = (*cclIter); + if (cell->badcell()) { // check of bad tile cell + isbadtilecell = true; + break; + } + } + return isbadtilecell; +} +} +egammaOQFlagsBuilder::egammaOQFlagsBuilder(const std::string& type, + const std::string& name, + const IInterface* parent) + : AthAlgTool(type, name, parent) + , m_emHelper(nullptr) +{ + declareInterface<IegammaOQFlagsBuilder>(this); m_calocellId = nullptr; } -// =============================================================== -egammaOQFlagsBuilder::~egammaOQFlagsBuilder() -{ - // - // destructor - // -} +egammaOQFlagsBuilder::~egammaOQFlagsBuilder() {} -// ================================================================== -StatusCode egammaOQFlagsBuilder::initialize() +StatusCode +egammaOQFlagsBuilder::initialize() { - // - // initialize method - // - - ATH_MSG_DEBUG(" Initializing egammaOQFlagsBuilder"); - ATH_CHECK(m_cellsKey.initialize()); ATH_CHECK(m_bcContKey.initialize()); ATH_CHECK(m_affKey.initialize()); - //Get CaloAffectedTool + // Get CaloAffectedTool StatusCode sc = m_affectedTool.retrieve(); - if (sc.isFailure()){ - msg(MSG::ERROR) << "Could not retrieve CaloAffectedTool " << m_affectedTool << endmsg; + if (sc.isFailure()) { + ATH_MSG_ERROR( "Could not retrieve CaloAffectedTool " << m_affectedTool); return StatusCode::FAILURE; - } else { - //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "CaloAffectedTool" << m_affectedTool << " retrieved" << endmsg; } - - sc=detStore()->retrieve(m_calocellId, "CaloCell_ID"); - if(sc.isFailure()){ - msg(MSG::WARNING) << "Cannot retrieve online_id" << endmsg; + sc = detStore()->retrieve(m_calocellId, "CaloCell_ID"); + if (sc.isFailure()) { + ATH_MSG_WARNING("Cannot retrieve online_id"); return StatusCode::FAILURE; - } else { - //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "CaloCell_ID" << m_calocellId << " retrieved" << endmsg; } - - sc=detStore()->retrieve(m_emHelper); - if(sc.isFailure()){ - msg(MSG::WARNING) << "Cannot retrieve online_id" << endmsg; + + sc = detStore()->retrieve(m_emHelper); + if (sc.isFailure()) { + ATH_MSG_WARNING("Cannot retrieve online_id"); return StatusCode::FAILURE; - } else { - //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "CaloCell_ID retrieved" << endmsg; } - return StatusCode::SUCCESS; } -// ==================================================================== -StatusCode egammaOQFlagsBuilder::finalize() +StatusCode +egammaOQFlagsBuilder::finalize() { - // - // finalize method - // - return StatusCode::SUCCESS; } - - -// =============================================================== -bool egammaOQFlagsBuilder::findCentralCell(const xAOD::CaloCluster* cluster, - Identifier& cellCentrId) const { +bool +egammaOQFlagsBuilder::findCentralCell(const xAOD::CaloCluster* cluster, + Identifier& cellCentrId) const +{ bool thereIsACentrCell = false; - //LOOP OVER CLUSTER TO FIND THE CENTRAL CELL IN S2 - xAOD::CaloCluster::const_cell_iterator cellIter = cluster->cell_begin(); - xAOD::CaloCluster::const_cell_iterator cellIterEnd = cluster->cell_end(); + // LOOP OVER CLUSTER TO FIND THE CENTRAL CELL IN S2 + xAOD::CaloCluster::const_cell_iterator cellIter = cluster->cell_begin(); + xAOD::CaloCluster::const_cell_iterator cellIterEnd = cluster->cell_end(); float clusEta = cluster->eta(); float clusPhi = cluster->phi(); float energymax = -999999.; - for( ;cellIter!=cellIterEnd;cellIter++) { + for (; cellIter != cellIterEnd; cellIter++) { const CaloCell* cell = (*cellIter); - if (!cell) continue; + if (!cell) + continue; float eta = cell->eta(); float phi = cell->phi(); float energy = cell->energy(); - CaloSampling::CaloSample layer = cell->caloDDE()->getSampling() ; - if(fabs(eta - clusEta)<0.025 && fabs(P4Helpers::deltaPhi(phi, clusPhi))<0.025 && (layer==CaloSampling::EMB2 || layer==CaloSampling::EME2) && (energy>energymax)) { - energymax=energy; + CaloSampling::CaloSample layer = cell->caloDDE()->getSampling(); + if (fabs(eta - clusEta) < 0.025 && + fabs(P4Helpers::deltaPhi(phi, clusPhi)) < 0.025 && + (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) && + (energy > energymax)) { + energymax = energy; cellCentrId = cellIter->ID(); thereIsACentrCell = true; } @@ -132,334 +129,436 @@ bool egammaOQFlagsBuilder::findCentralCell(const xAOD::CaloCluster* cluster, return thereIsACentrCell; } -// =============================================================== -bool egammaOQFlagsBuilder::isCore(const Identifier Id, const std::vector<IdentifierHash>& neighbourList) const { +bool +egammaOQFlagsBuilder::isCore( + const Identifier Id, + const std::vector<IdentifierHash>& neighbourList) const +{ const IdentifierHash hashId = m_calocellId->calo_cell_hash(Id); - std::vector<IdentifierHash>::const_iterator it=std::find(neighbourList.begin(),neighbourList.end(),hashId); - return (it!=neighbourList.end()); + std::vector<IdentifierHash>::const_iterator it = + std::find(neighbourList.begin(), neighbourList.end(), hashId); + return (it != neighbourList.end()); } - -// =============================================================== -std::vector<IdentifierHash> egammaOQFlagsBuilder::findNeighbours(const Identifier cellCentrId) const{ +std::vector<IdentifierHash> +egammaOQFlagsBuilder::findNeighbours(const Identifier cellCentrId) const +{ std::vector<IdentifierHash> neighbourList; const IdentifierHash hashId = m_calocellId->calo_cell_hash(cellCentrId); - m_emHelper->get_neighbours(hashId, LArNeighbours::all2D, neighbourList); - return neighbourList; + m_emHelper->get_neighbours(hashId, LArNeighbours::all2D, neighbourList); + return neighbourList; } -// ===================================================================== -StatusCode egammaOQFlagsBuilder::execute(const EventContext& ctx, xAOD::Egamma* eg) const -{ +StatusCode +egammaOQFlagsBuilder::execute(const EventContext& ctx, + const CaloDetDescrManager& cmgr, + xAOD::Egamma& eg) const +{ // Protection against bad pointers - if (eg==nullptr) return StatusCode::SUCCESS; - const xAOD::CaloCluster* cluster = eg->caloCluster(); - if (!cluster) return StatusCode::SUCCESS; - if (cluster->size()==0) return StatusCode::SUCCESS; - + const xAOD::CaloCluster* cluster = eg.caloCluster(); + if (!cluster) { + return StatusCode::SUCCESS; + } + if (cluster->size() == 0) { + return StatusCode::SUCCESS; + } // const float clusterEta = cluster->eta(); const float clusterPhi = cluster->phi(); // - //In case we have the sizes set during the cluster construction. - int etaSize=cluster->getClusterEtaSize(); - int phiSize=cluster->getClusterPhiSize(); - //If no proper size could be found automatically, deduce by hand - //for the known std cases - if (etaSize==0 && phiSize==0) { - bool isBarrel = xAOD::EgammaHelpers::isBarrel(cluster); - if (xAOD::EgammaHelpers::isElectron(eg)){ - etaSize= (isBarrel ? 3 : 5); - phiSize= (isBarrel ? 7 : 5); - } - else if (xAOD::EgammaHelpers::isConvertedPhoton(eg)){ - etaSize= (isBarrel ? 3 : 5); - phiSize= (isBarrel ? 7 : 5); - } - else{//unconverted photons - etaSize= (isBarrel ? 3 : 5); - phiSize= (isBarrel ? 7 : 5); + // In case we have the sizes set during the cluster construction. + int etaSize = cluster->getClusterEtaSize(); + int phiSize = cluster->getClusterPhiSize(); + // If no proper size could be found automatically, deduce by hand + // for the known std cases + if (etaSize == 0 && phiSize == 0) { + bool isBarrel = xAOD::EgammaHelpers::isBarrel(cluster); + if (xAOD::EgammaHelpers::isElectron(&eg)) { + etaSize = (isBarrel ? 3 : 5); + phiSize = (isBarrel ? 7 : 5); + } else if (xAOD::EgammaHelpers::isConvertedPhoton(&eg)) { + etaSize = (isBarrel ? 3 : 5); + phiSize = (isBarrel ? 7 : 5); + } else { // unconverted photons + etaSize = (isBarrel ? 3 : 5); + phiSize = (isBarrel ? 7 : 5); } } - + unsigned int iflag = 0; - - //Find the central cell in the middle layer + + // Find the central cell in the middle layer Identifier cellCentrId; - bool foundCentralCell = egammaOQFlagsBuilder::findCentralCell(cluster,cellCentrId); - - //=================== Set timing bit ===================================================// - const double absEnergyGeV = fabs(cluster->e()*(1./GeV)); - if(absEnergyGeV != 0 && fabs(cluster->time()) > m_TCut + m_TCutVsE/absEnergyGeV) { - iflag |= ( 0x1 << xAOD::EgammaParameters::OutTime); + bool foundCentralCell = + egammaOQFlagsBuilder::findCentralCell(cluster, cellCentrId); + + // Set timing bit + const double absEnergyGeV = fabs(cluster->e() * (1. / GeV)); + if (absEnergyGeV != 0 && + fabs(cluster->time()) > m_TCut + m_TCutVsE / absEnergyGeV) { + iflag |= (0x1 << xAOD::EgammaParameters::OutTime); } - //======================================================================================// - //Declare totE and badE for LarQ cleaning - double totE=0; - double badE=0; - double energyCellMax=0; + // Declare totE and badE for LarQ cleaning + double totE = 0; + double badE = 0; + double energyCellMax = 0; if (foundCentralCell) { - //Find the list of neighbours cells, to define the 3x3 cluster core + // Find the list of neighbours cells, to define the 3x3 cluster core std::vector<IdentifierHash> neighbourList = findNeighbours(cellCentrId); - //Get Bad-channel info for this event - SG::ReadCondHandle<LArBadChannelCont> larBadChanHdl{m_bcContKey,ctx}; - const LArBadChannelCont* larBadChanCont=*larBadChanHdl; - - //Loop over all the Lar cluster cells - xAOD::CaloCluster::const_cell_iterator cellIter = cluster->cell_begin(); + // Get Bad-channel info for this event + SG::ReadCondHandle<LArBadChannelCont> larBadChanHdl{ m_bcContKey, ctx }; + const LArBadChannelCont* larBadChanCont = *larBadChanHdl; + + // Loop over all the Lar cluster cells + xAOD::CaloCluster::const_cell_iterator cellIter = cluster->cell_begin(); xAOD::CaloCluster::const_cell_iterator cellIterEnd = cluster->cell_end(); - for( ;cellIter!=cellIterEnd;cellIter++) { + for (; cellIter != cellIterEnd; cellIter++) { const CaloCell* cell = (*cellIter); - if(!cell) { - continue; + if (!cell) { + continue; } - //Check we are not tile + // Check we are not tile if (cell->caloDDE()->is_tile()) { - continue; + continue; } - //Find cell parameters and properties + // Find cell parameters and properties float eta = cell->eta(); // float phi = cell->phi(); // no longer used float qual = cell->quality(); - CaloSampling::CaloSample layer = cell->caloDDE()->getSampling() ; - - //Calculate badE et totE - if( (cell->provenance() & 0x2000) &&!(cell->provenance() & 0x0800 )) { - totE += cell->e(); - if(cell->e() > energyCellMax ) energyCellMax = cell->e(); - if(cell->quality() > m_QCellCut ) badE += cell->e(); - } - bool isACoreCell = false; - isACoreCell = isCore(cell->ID(),neighbourList); - + CaloSampling::CaloSample layer = cell->caloDDE()->getSampling(); + + // Calculate badE et totE + if ((cell->provenance() & 0x2000) && !(cell->provenance() & 0x0800)) { + totE += cell->e(); + if (cell->e() > energyCellMax) + energyCellMax = cell->e(); + if (cell->quality() > m_QCellCut) + badE += cell->e(); + } + bool isACoreCell = false; + isACoreCell = isCore(cell->ID(), neighbourList); + bool isStripCoreCell = false; - if ( (layer==CaloSampling::EMB1 || layer==CaloSampling::EME1) && fabs(eta-clusterEta)<0.025/2.) { - isStripCoreCell = true; + if ((layer == CaloSampling::EMB1 || layer == CaloSampling::EME1) && + fabs(eta - clusterEta) < 0.025 / 2.) { + isStripCoreCell = true; } - - //======================= Set HEC bit ============================================// - if (layer>=CaloSampling::HEC0 && layer<=CaloSampling::HEC3 && qual>m_QCellHECCut) { - iflag |= ( 0x1 << xAOD::EgammaParameters::HECHighQ); + + // Set HEC bit + if (layer >= CaloSampling::HEC0 && layer <= CaloSampling::HEC3 && + qual > m_QCellHECCut) { + iflag |= (0x1 << xAOD::EgammaParameters::HECHighQ); } - //==================================================================================// - //======================== Set LAr bits ============================================================// - // - const LArBadChannel bc = larBadChanCont-> offlineStatus(cell->ID()); + // Set LAr bits + const LArBadChannel bc = larBadChanCont->offlineStatus(cell->ID()); // - if(isACoreCell) { - if((cell->provenance() & 0x0A00) == 0x0A00) { - iflag |= ( 0x1 << xAOD::EgammaParameters::MissingFEBCellCore); - } - if((cell->provenance() & 0x0A00) == 0x0800) { - iflag |= ( 0x1 << xAOD::EgammaParameters::MaskedCellCore); - } - if(bc.sporadicBurstNoise() && qual<m_QCellSporCut) { - iflag |= ( 0x1 << xAOD::EgammaParameters::SporadicNoiseLowQCore); - } - if(bc.deadCalib() || bc.lowNoiseHG() || bc.lowNoiseMG() || - bc.lowNoiseLG() || bc.distorted() || bc.unstable() || - bc.unstableNoiseHG() || bc.unstableNoiseMG() || - bc.unstableNoiseLG() || bc.peculiarCalibrationLine() - || bc.almostDead() || bc.shortProblem()) { - iflag |= ( 0x1 << xAOD::EgammaParameters::AffectedCellCore); - } - if (qual>=4000) { - iflag |= ( 0x1 << xAOD::EgammaParameters::HighQCore); - } - }else{ - if((cell->provenance() & 0x0A00) == 0x0A00) { - if( layer==CaloSampling::PreSamplerB || layer==CaloSampling::PreSamplerE) { - iflag |= ( 0x1 << xAOD::EgammaParameters::MissingFEBCellEdgePS); - } - if( layer==CaloSampling::EMB1 || layer==CaloSampling::EME1) { - iflag |= ( 0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS1); - if (isStripCoreCell) iflag |= ( 0x1 << xAOD::EgammaParameters::BadS1Core); - } - if( layer==CaloSampling::EMB2 || layer==CaloSampling::EME2) iflag |= ( 0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS2); - if( layer==CaloSampling::EMB3 || layer==CaloSampling::EME3) iflag |= ( 0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS3); - } - if((cell->provenance() & 0x0A00) == 0x0800) { - if( layer==CaloSampling::PreSamplerB || layer==CaloSampling::PreSamplerE){ - iflag |= ( 0x1 << xAOD::EgammaParameters::MaskedCellEdgePS); - } - if( layer==CaloSampling::EMB1 || layer==CaloSampling::EME1) { - iflag |= ( 0x1 << xAOD::EgammaParameters::MaskedCellEdgeS1); - if (isStripCoreCell) iflag |= ( 0x1 << xAOD::EgammaParameters::BadS1Core); - } - if( layer==CaloSampling::EMB2 || layer==CaloSampling::EME2) iflag |= ( 0x1 << xAOD::EgammaParameters::MaskedCellEdgeS2); - if( layer==CaloSampling::EMB3 || layer==CaloSampling::EME3) iflag |= ( 0x1 << xAOD::EgammaParameters::MaskedCellEdgeS3); - } - if(bc.sporadicBurstNoise() && qual<m_QCellSporCut) { - iflag |= ( 0x1 << xAOD::EgammaParameters::SporadicNoiseLowQEdge); - } - if(bc.deadCalib() || bc.lowNoiseHG() || bc.lowNoiseMG() || - bc.lowNoiseLG() || bc.distorted() || bc.unstable() || - bc.unstableNoiseHG() || bc.unstableNoiseMG() || - bc.unstableNoiseLG() || bc.peculiarCalibrationLine() - || bc.almostDead() || bc.shortProblem()) { - if( layer==CaloSampling::PreSamplerB || layer==CaloSampling::PreSamplerE) { - iflag |= ( 0x1 << xAOD::EgammaParameters::AffectedCellEdgePS); - } - if( layer==CaloSampling::EMB1 || layer==CaloSampling::EME1) iflag |= ( 0x1 << xAOD::EgammaParameters::AffectedCellEdgeS1); - if( layer==CaloSampling::EMB2 || layer==CaloSampling::EME2) iflag |= ( 0x1 << xAOD::EgammaParameters::AffectedCellEdgeS2); - if( layer==CaloSampling::EMB3 || layer==CaloSampling::EME3) iflag |= ( 0x1 << xAOD::EgammaParameters::AffectedCellEdgeS3); - } - if (qual>=4000) { - iflag |= ( 0x1 << xAOD::EgammaParameters::HighQEdge); - } + if (isACoreCell) { + if ((cell->provenance() & 0x0A00) == 0x0A00) { + iflag |= (0x1 << xAOD::EgammaParameters::MissingFEBCellCore); + } + if ((cell->provenance() & 0x0A00) == 0x0800) { + iflag |= (0x1 << xAOD::EgammaParameters::MaskedCellCore); + } + if (bc.sporadicBurstNoise() && qual < m_QCellSporCut) { + iflag |= (0x1 << xAOD::EgammaParameters::SporadicNoiseLowQCore); + } + if (bc.deadCalib() || bc.lowNoiseHG() || bc.lowNoiseMG() || + bc.lowNoiseLG() || bc.distorted() || bc.unstable() || + bc.unstableNoiseHG() || bc.unstableNoiseMG() || + bc.unstableNoiseLG() || bc.peculiarCalibrationLine() || + bc.almostDead() || bc.shortProblem()) { + iflag |= (0x1 << xAOD::EgammaParameters::AffectedCellCore); + } + if (qual >= 4000) { + iflag |= (0x1 << xAOD::EgammaParameters::HighQCore); + } + } else { + if ((cell->provenance() & 0x0A00) == 0x0A00) { + if (layer == CaloSampling::PreSamplerB || + layer == CaloSampling::PreSamplerE) { + iflag |= (0x1 << xAOD::EgammaParameters::MissingFEBCellEdgePS); + } + if (layer == CaloSampling::EMB1 || layer == CaloSampling::EME1) { + iflag |= (0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS1); + if (isStripCoreCell) + iflag |= (0x1 << xAOD::EgammaParameters::BadS1Core); + } + if (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) + iflag |= (0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS2); + if (layer == CaloSampling::EMB3 || layer == CaloSampling::EME3) + iflag |= (0x1 << xAOD::EgammaParameters::MissingFEBCellEdgeS3); + } + if ((cell->provenance() & 0x0A00) == 0x0800) { + if (layer == CaloSampling::PreSamplerB || + layer == CaloSampling::PreSamplerE) { + iflag |= (0x1 << xAOD::EgammaParameters::MaskedCellEdgePS); + } + if (layer == CaloSampling::EMB1 || layer == CaloSampling::EME1) { + iflag |= (0x1 << xAOD::EgammaParameters::MaskedCellEdgeS1); + if (isStripCoreCell) + iflag |= (0x1 << xAOD::EgammaParameters::BadS1Core); + } + if (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) + iflag |= (0x1 << xAOD::EgammaParameters::MaskedCellEdgeS2); + if (layer == CaloSampling::EMB3 || layer == CaloSampling::EME3) + iflag |= (0x1 << xAOD::EgammaParameters::MaskedCellEdgeS3); + } + if (bc.sporadicBurstNoise() && qual < m_QCellSporCut) { + iflag |= (0x1 << xAOD::EgammaParameters::SporadicNoiseLowQEdge); + } + if (bc.deadCalib() || bc.lowNoiseHG() || bc.lowNoiseMG() || + bc.lowNoiseLG() || bc.distorted() || bc.unstable() || + bc.unstableNoiseHG() || bc.unstableNoiseMG() || + bc.unstableNoiseLG() || bc.peculiarCalibrationLine() || + bc.almostDead() || bc.shortProblem()) { + if (layer == CaloSampling::PreSamplerB || + layer == CaloSampling::PreSamplerE) { + iflag |= (0x1 << xAOD::EgammaParameters::AffectedCellEdgePS); + } + if (layer == CaloSampling::EMB1 || layer == CaloSampling::EME1) + iflag |= (0x1 << xAOD::EgammaParameters::AffectedCellEdgeS1); + if (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) + iflag |= (0x1 << xAOD::EgammaParameters::AffectedCellEdgeS2); + if (layer == CaloSampling::EMB3 || layer == CaloSampling::EME3) + iflag |= (0x1 << xAOD::EgammaParameters::AffectedCellEdgeS3); + } + if (qual >= 4000) { + iflag |= (0x1 << xAOD::EgammaParameters::HighQEdge); + } } - }// end loop over LAr cells - //====================================================================================================================// - //==== Set LArQCleaning bit ===============// - double egammaLArQCleaning=0; - if(totE !=0) egammaLArQCleaning=badE/totE; - if(egammaLArQCleaning>m_LArQCut){ + } // end loop over LAr cells + + //Set LArQCleaning bit + double egammaLArQCleaning = 0; + if (totE != 0) + egammaLArQCleaning = badE / totE; + if (egammaLArQCleaning > m_LArQCut) { iflag |= (0x1 << xAOD::EgammaParameters::LArQCleaning); } - //=========================================// - //==== Set HighRcell bit ===============// - double ratioCell=0; - if(totE !=0) ratioCell=energyCellMax/totE; - if(ratioCell>m_RcellCut){ + //Set HighRcell bit// + double ratioCell = 0; + if (totE != 0) + ratioCell = energyCellMax / totE; + if (ratioCell > m_RcellCut) { iflag |= (0x1 << xAOD::EgammaParameters::HighRcell); } - //=========================================// - } //close if found central cell - - //========================= Check the HV components ===================================================// - float deta=0; - float dphi=0; - CaloSampling::CaloSample layer; + } // close if found central cell + + //Check the HV components + float deta = 0; + float dphi = 0; + + // Get affected info for this event + SG::ReadCondHandle<CaloAffectedRegionInfoVec> affHdl{ m_affKey, ctx }; + const CaloAffectedRegionInfoVec* affCont = *affHdl; + if (!affCont) { + ATH_MSG_WARNING("Do not have affected regions info, is this expected ?"); + } //--------------> PRE SAMPLER - deta=0.5*0.025*etaSize; - dphi=0.5*0.025*phiSize; - layer=CaloSampling::PreSamplerE; - - //Get affected info for this event - SG::ReadCondHandle<CaloAffectedRegionInfoVec> affHdl{m_affKey,ctx}; - const CaloAffectedRegionInfoVec* affCont=*affHdl; - if(!affCont) { - ATH_MSG_WARNING("Do not have affected regions info, is this expected ?"); + deta = 0.5 * 0.025 * etaSize; + dphi = 0.5 * 0.025 * phiSize; + + bool isNonNominalHVPS = (m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::PreSamplerE, + CaloSampling::PreSamplerE, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::PreSamplerB, + CaloSampling::PreSamplerB, + 1)); + if (isNonNominalHVPS){ + iflag |= (0x1 << xAOD::EgammaParameters::NonNominalHVPS); } - - bool checkNNHV_PSE = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_PSE = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::PreSamplerB; - bool checkNNHV_PSB = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_PSB = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - if(checkNNHV_PSE || checkNNHV_PSB) iflag |= ( 0x1 << xAOD::EgammaParameters::NonNominalHVPS); - if(checkDEADHV_PSE || checkDEADHV_PSB) iflag |= ( 0x1 << xAOD::EgammaParameters::DeadHVPS); + bool isDeadHVPS = (m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::PreSamplerE, + CaloSampling::PreSamplerE, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::PreSamplerB, + CaloSampling::PreSamplerB, + 2)); + if (isDeadHVPS){ + iflag |= (0x1 << xAOD::EgammaParameters::DeadHVPS); + } //---------------> SAMPLING 2 : CLUSTER CORE - layer=CaloSampling::EMB2; - // deta=0.; - // dphi=0.; - deta=0.5*0.025*3.; - dphi=0.5*0.025*3.; - bool checkDEADHV_CORE_B = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EME2; - bool checkDEADHV_CORE_E = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - if(checkDEADHV_CORE_B || checkDEADHV_CORE_E) iflag |= ( 0x1 << xAOD::EgammaParameters::DeadHVS1S2S3Core); - + deta = 0.5 * 0.025 * 3.; + dphi = 0.5 * 0.025 * 3.; + bool isDeadHVS2Core = (m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB2, + CaloSampling::EMB2, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME2, + CaloSampling::EME2, + 2)); + + if (isDeadHVS2Core) { + iflag |= (0x1 << xAOD::EgammaParameters::DeadHVS1S2S3Core); + } //----------------> SAMPLINGS 1,2,3 : CLUSTER EDGE - deta=0.5*0.025*etaSize; - dphi=0.5*0.025*phiSize; - layer=CaloSampling::EMB1; - - bool checkNNHV_EMB1 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EMB1 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EMB2; - - bool checkNNHV_EMB2 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EMB2 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EMB3; - - bool checkNNHV_EMB3 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EMB3 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EME1; - - bool checkNNHV_EME1 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EME1 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EME2; - - bool checkNNHV_EME2 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EME2 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - layer=CaloSampling::EME3; - - bool checkNNHV_EME3 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,1) ; //nnHVPS - bool checkDEADHV_EME3 = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,2) ; //deadHVPS - if(checkNNHV_EMB1 || checkNNHV_EME1 || checkNNHV_EMB2 || checkNNHV_EME2 ||checkNNHV_EMB3 || checkNNHV_EME3) - iflag |= ( 0x1 << xAOD::EgammaParameters::NonNominalHVS1S2S3); - if(checkDEADHV_EMB1 || checkDEADHV_EME1 || checkDEADHV_EMB2 || checkDEADHV_EME2 ||checkDEADHV_EMB3 || checkDEADHV_EME3) - iflag |= ( 0x1 << xAOD::EgammaParameters::DeadHVS1S2S3Edge); - //========================================================================================================================// - - //==================== Check the tile component ==================================// - //Get CaloCellContainer + deta = 0.5 * 0.025 * etaSize; + dphi = 0.5 * 0.025 * phiSize; + + bool isNonNominalHVS1S2S3 = (m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB1, + CaloSampling::EMB1, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB2, + CaloSampling::EMB2, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB3, + CaloSampling::EMB3, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME1, + CaloSampling::EME1, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME2, + CaloSampling::EME2, + 1) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME3, + CaloSampling::EME3, + 1)); + if (isNonNominalHVS1S2S3) { + iflag |= (0x1 << xAOD::EgammaParameters::NonNominalHVS1S2S3); + } + + bool isDeadHVS1S2S3Edge = (m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB1, + CaloSampling::EMB1, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB2, + CaloSampling::EMB2, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EMB3, + CaloSampling::EMB3, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME1, + CaloSampling::EME1, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME2, + CaloSampling::EME2, + 2) || + m_affectedTool->isAffected(cluster, + affCont, + deta, + dphi, + CaloSampling::EME3, + CaloSampling::EME3, + 2)); + + if (isDeadHVS1S2S3Edge) { + iflag |= (0x1 << xAOD::EgammaParameters::DeadHVS1S2S3Edge); + } + + // Check the tile component + // Get CaloCellContainer SG::ReadHandle<CaloCellContainer> cellcoll(m_cellsKey, ctx); // check is only used for serial running; remove when MT scheduler used - if(!cellcoll.isValid()) { - ATH_MSG_ERROR("Failed to retrieve cell container: "<< m_cellsKey.key()); + if (!cellcoll.isValid()) { + ATH_MSG_ERROR("Failed to retrieve cell container: " << m_cellsKey.key()); return StatusCode::FAILURE; } - CaloCell_ID::SUBCALO HADCal = static_cast<CaloCell_ID::SUBCALO>(CaloCell_ID::TILE); - CaloCellList ccl(cellcoll.cptr(),HADCal); + CaloCell_ID::SUBCALO HADCal = + static_cast<CaloCell_ID::SUBCALO>(CaloCell_ID::TILE); + CaloCellList ccl(cellcoll.cptr(), HADCal); double size = 0.12; - //------------------------ TileBar0 --------------------------------// - bool isbadtilebar0cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileBar0); - //------------------------ TileExt0 --------------------------------// - bool isbadtileext0cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileExt0); - //----------------------------------------------------------------// - - if( isbadtilebar0cell || isbadtileext0cell ){ - iflag |= (0x1 << xAOD::EgammaParameters::DeadCellTileS0); + // TileBar0 or TileExt0 + bool isDeadCellTileS0 = + (isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileBar0) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileExt0)); + + if (isDeadCellTileS0) { + iflag |= (0x1 << xAOD::EgammaParameters::DeadCellTileS0); } - //---------------------- TileBar1 ----------------------------------// - bool isbadtilebar1cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileBar1); - //---------------------- TileExt1 ----------------------------------// - bool isbadtileext1cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileExt1); - //---------------------- TileGap1 ----------------------------------// - bool isbadtilegap1cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileGap1); - //---------------------- TileBar2 ----------------------------------// - bool isbadtilebar2cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileBar2); - //---------------------- TileExt2 ---------------------------------// - bool isbadtileext2cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileExt2); - //---------------------- TileGap2 ----------------------------------// - bool isbadtilegap2cell=isbadtilecell(ccl,clusterEta,clusterPhi,size,size,CaloSampling::TileGap2); - //---------------------------------------------------------------// - if( isbadtilebar1cell || isbadtilebar2cell || - isbadtileext1cell || isbadtileext2cell || - isbadtilegap1cell || isbadtilegap2cell ){ - iflag |= (0x1 << xAOD::EgammaParameters::DeadCellTileS1S2); + // TileBar1 TileExt1 TileGap1 TileBar2 TileExt2 TileGap2 + bool isDeadCellTileS1S2 = + (isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileBar1) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileExt1) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileGap1) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileBar2) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileExt2) || + isbadtilecell( + ccl, cmgr, clusterEta, clusterPhi, size, size, CaloSampling::TileGap2)); + if (isDeadCellTileS1S2) { + iflag |= (0x1 << xAOD::EgammaParameters::DeadCellTileS1S2); } - //=================================================================================// - eg->setOQ(iflag); + eg.setOQ(iflag); ATH_MSG_DEBUG("Executing egammaOQFlagsBuilder::execute"); return StatusCode::SUCCESS; } -bool egammaOQFlagsBuilder::isbadtilecell ( CaloCellList& ccl, const float clusterEta, - const float clusterPhi, - const double sizeEta, const double sizePhi , - const CaloSampling::CaloSample sample) const { - - bool isbadtilecell = false; - ccl.select(clusterEta,clusterPhi,sizeEta,sizePhi,sample); - CaloCellList::list_iterator cclIter = ccl.begin(); - CaloCellList::list_iterator cclIterEnd = ccl.end(); - for( ;cclIter!=cclIterEnd;cclIter++) { - const CaloCell* cell = (*cclIter); - if(cell->badcell()){//check of bad tile cell - isbadtilecell = true; - break; - } - } - return isbadtilecell; -} diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h index 0bed898ff8326c13cc78e04aba6110065c451e33..201c9b8b59382b127aca750b4aedbfc3b5811db1 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h @@ -6,15 +6,22 @@ #define EGAMMATOOLS_EGAMMAOQFLAGSBUILDER_H /** @class egammaOQFlagsBuilder - egamma Object Quality flags data object builder : - - This tool checks if any cell of the cluster associated to the egamma object is affected by a detector problem: non nominal or dead high voltage, readout problems, missing FEBs, high quality factor, timing, etc.... If this is the case, then a bit corresponding to a specific problem is filled ( see egammaEvent/egammaEvent/egammaPIDdefs.h for bits definition). -Most of the informations are given separately for each layer of the EM calorimeter. They are also separately stored for the core (3x3 central cells in the middle layer of the EM calorimeter) and the edge (all the other cells) of the cluster. + egamma Object Quality flags data object builder : + - This tool checks if any cell of the cluster associated to the egamma +object is affected by a detector problem: non nominal or dead high voltage, +readout problems, missing FEBs, high quality factor, timing, etc.... If this is +the case, then a bit corresponding to a specific problem is filled ( see +egammaEvent/egammaEvent/egammaPIDdefs.h for bits definition). Most of the +informations are given separately for each layer of the EM calorimeter. They are +also separately stored for the core (3x3 central cells in the middle layer of +the EM calorimeter) and the edge (all the other cells) of the cluster. @author Frederic Derue derue@lpnhe.in2p3.fr @author Francesco Polci polci@lpsc.in2p3.fr @author Quentin Buat quentin.buat@lpsc.in2p3.fr */ // INCLUDE HEADER FILES: +#include "egammaInterfaces/IegammaOQFlagsBuilder.h" #include "egammaBaseTool.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/EventContext.h" @@ -37,65 +44,77 @@ class HWIdentifier; class LArEM_ID; class CaloCell_ID; -class egammaOQFlagsBuilder : public egammaBaseTool +class egammaOQFlagsBuilder + : public AthAlgTool + , virtual public IegammaOQFlagsBuilder { public: /** @brief Default constructor*/ - egammaOQFlagsBuilder(const std::string& type, - const std::string& name, - const IInterface* parent); - - /** @brief Destructor*/ - ~egammaOQFlagsBuilder(); - /** @brief initialize method*/ - StatusCode initialize(); - /** @brief standard execute method */ - virtual StatusCode execute(const EventContext& ctx, xAOD::Egamma*) const; - /** @brief finalize method*/ - StatusCode finalize(); + egammaOQFlagsBuilder(const std::string& type, + const std::string& name, + const IInterface* parent); + + /** @brief Destructor*/ + ~egammaOQFlagsBuilder(); + /** @brief initialize method*/ + StatusCode initialize(); + /** @brief standard execute method */ + virtual StatusCode execute(const EventContext& ctx, + const CaloDetDescrManager& cmgr, + xAOD::Egamma& egamma) const; + /** @brief finalize method*/ + StatusCode finalize(); private: - /** Handle to bad-channel CDO */ - SG::ReadCondHandleKey<LArBadChannelCont> m_bcContKey{this, - "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO"}; - - SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey{this, - "LArAffectedRegionKey", "LArAffectedRegionInfo", "SG key for affected regions cond object"}; - - ToolHandle<ICaloAffectedTool> m_affectedTool {this, - "affectedTool", "CaloAffectedTool", "CaloAffectedTool"}; - - const LArEM_ID* m_emHelper; - const CaloCell_ID* m_calocellId; - - SG::ReadHandleKey<CaloCellContainer> m_cellsKey {this, - "CellsName", "AllCalo","Names of container which contain cells"}; - - // IToolSvc* m_toolSvc; - bool isCore(const Identifier Id, const std::vector<IdentifierHash>& neighbourList) const; - std::vector<IdentifierHash> findNeighbours( const Identifier cellCentrId) const; - bool isbadtilecell (CaloCellList& ccl, float clusterEta, float clusterPhi, - double sizeEta, double sizePhi, CaloSampling::CaloSample sample) const ; - - bool findCentralCell(const xAOD::CaloCluster* cluster, Identifier& cellCentrId) const; - - Gaudi::Property<double> m_QCellCut {this, "QCellCut", 4000.}; - Gaudi::Property<double> m_QCellHECCut {this, "QCellHECCut", 60000.}; - Gaudi::Property<double> m_QCellSporCut {this, "QCellSporCut", 4000.}; - Gaudi::Property<double> m_LArQCut {this, "LArQCut", 0.8}; - Gaudi::Property<double> m_TCut {this, "TCut", 10.0}; - Gaudi::Property<double> m_TCutVsE {this, "TCutVsE", 2.0}; - Gaudi::Property<double> m_RcellCut {this, "RcellCut", 0.8}; + /** Handle to bad-channel CDO */ + SG::ReadCondHandleKey<LArBadChannelCont> m_bcContKey{ + this, + "LArBadChannelKey", + "LArBadChannel", + "Key of the LArBadChannelCont CDO" + }; + + SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey{ + this, + "LArAffectedRegionKey", + "LArAffectedRegionInfo", + "SG key for affected regions cond object" + }; + + ToolHandle<ICaloAffectedTool> m_affectedTool{ this, + "affectedTool", + "CaloAffectedTool", + "CaloAffectedTool" }; + + const LArEM_ID* m_emHelper; + const CaloCell_ID* m_calocellId; + + SG::ReadHandleKey<CaloCellContainer> m_cellsKey{ + this, + "CellsName", + "AllCalo", + "Names of container which contain cells" + }; + + // IToolSvc* m_toolSvc; + bool isCore(const Identifier Id, + const std::vector<IdentifierHash>& neighbourList) const; + + std::vector<IdentifierHash> findNeighbours( + const Identifier cellCentrId) const; + + bool findCentralCell(const xAOD::CaloCluster* cluster, + Identifier& cellCentrId) const; + + Gaudi::Property<double> m_QCellCut{ this, "QCellCut", 4000. }; + Gaudi::Property<double> m_QCellHECCut{ this, "QCellHECCut", 60000. }; + Gaudi::Property<double> m_QCellSporCut{ this, "QCellSporCut", 4000. }; + Gaudi::Property<double> m_LArQCut{ this, "LArQCut", 0.8 }; + Gaudi::Property<double> m_TCut{ this, "TCut", 10.0 }; + Gaudi::Property<double> m_TCutVsE{ this, "TCutVsE", 2.0 }; + Gaudi::Property<double> m_RcellCut{ this, "RcellCut", 0.8 }; }; #endif - - - - - - - - diff --git a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsConfig.py b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsConfig.py index ecd2d788313fcbf3352662e32b4be86b2c531097..675f29ae6fdd0e183c62e2e6373329de5e4fbf22 100644 --- a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsConfig.py +++ b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsConfig.py @@ -1,20 +1,26 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "Tool configuration to instantiate all egammaCaloTools with default configuration" +__doc__ = """Tool configuration to instantiate all + egammaCaloTools with default configuration""" from AthenaCommon.Logging import logging from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg -EMExtrapolationTools=CompFactory.EMExtrapolationTools +EMExtrapolationTools = CompFactory.EMExtrapolationTools + +# The extrapolator is not quite correct +# we need to able to set the particular +# egamma ones. + def EMExtrapolationToolsCfg(flags, **kwargs): mlog = logging.getLogger('EMExtrapolationTools') mlog.debug('Start configuration') - acc=ComponentAccumulator() + acc = ComponentAccumulator() if "Extrapolator" not in kwargs: extrapAcc = AtlasExtrapolatorCfg(flags) @@ -22,24 +28,25 @@ def EMExtrapolationToolsCfg(flags, **kwargs): acc.merge(extrapAcc) if "PerigeeCaloExtensionTool" not in kwargs: - perigeeCaloExtrapAcc = ParticleCaloExtensionToolCfg(flags, - name="PerigeeCaloExtensionTool", - Extrapolator = kwargs["Extrapolator"], - ParticleType = "electron", - StartFromPerigee = True) - kwargs["PerigeeCaloExtensionTool"] = perigeeCaloExtrapAcc.popPrivateTools() + perigeeCaloExtrapAcc = ParticleCaloExtensionToolCfg( + flags, + name="PerigeeCaloExtensionTool", + Extrapolator=kwargs["Extrapolator"], + ParticleType="electron", + StartFromPerigee=True) + kwargs["PerigeeCaloExtensionTool"] = ( + perigeeCaloExtrapAcc.popPrivateTools()) acc.merge(perigeeCaloExtrapAcc) if "LastCaloExtensionTool" not in kwargs: - lastCaloExtrapAcc = ParticleCaloExtensionToolCfg(flags, - name="LastCaloExtensionTool", - ParticleType = "electron", - Extrapolator = kwargs["Extrapolator"]) + lastCaloExtrapAcc = ParticleCaloExtensionToolCfg( + flags, + name="LastCaloExtensionTool", + ParticleType="electron", + Extrapolator=kwargs["Extrapolator"]) kwargs["LastCaloExtensionTool"] = lastCaloExtrapAcc.popPrivateTools() acc.merge(lastCaloExtrapAcc) - - emExtrapolationTools = EMExtrapolationTools(**kwargs) acc.setPrivateTools(emExtrapolationTools) @@ -53,8 +60,8 @@ def EMExtrapolationToolsCacheCfg(flags, **kwargs): return EMExtrapolationToolsCfg(flags, **kwargs) -# egammaTrkRefitterTool also needs a config, but depends on some tracking that is not ready - +# egammaTrkRefitterTool also needs a config, but depends on some +# tracking that is not ready # CaloCluster_OnTrackBuilder is currently not used at all @@ -68,7 +75,8 @@ if __name__ == "__main__": log.setLevel(DEBUG) ConfigFlags.Input.isMC = True - ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/myRDO.pool.root"] + ConfigFlags.Input.Files = [ + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/myRDO.pool.root"] ConfigFlags.lock() cfg = ComponentAccumulator() diff --git a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py index 8610373bf69c9dd4753fb427e59c088a20d08572..25c865f183685ea9662bc9d45721625ccaf589dd 100644 --- a/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py +++ b/Reconstruction/egamma/egammaTrackTools/python/egammaTrackToolsFactories.py @@ -1,53 +1,58 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -__doc__ = "ToolFactories to instantiate all egammaCaloTools with default configuration" +__doc__ = """ToolFactories to instantiate all +egammaCaloTools with default configuration""" __author__ = "Bruno Lenzi , Christos Anastopoulos" -from egammaRec.Factories import ToolFactory +from egammaRec.Factories import ToolFactory from egammaTrackTools import egammaTrackToolsConf -from egammaRec import egammaKeys -from egammaTools.egammaExtrapolators import egammaCaloExtrapolator,egammaExtrapolator +from egammaTools.egammaExtrapolators import ( + egammaCaloExtrapolator, egammaExtrapolator) import AthenaCommon.CfgMgr as CfgMgr -EMLastCaloExtensionTool = ToolFactory (CfgMgr.Trk__ParticleCaloExtensionTool, - name="EMLastCaloExtensionTool", - Extrapolator = egammaCaloExtrapolator, - ParticleType = "electron") - -EMParticleCaloExtensionTool = ToolFactory (CfgMgr.Trk__ParticleCaloExtensionTool, - name="EMParticleCaloExtensionTool", - Extrapolator = egammaCaloExtrapolator, - ParticleType="electron", - StartFromPerigee = True) - - -EMExtrapolationTools = ToolFactory( egammaTrackToolsConf.EMExtrapolationTools, - name ="EMExtrapolationTools", - LastCaloExtensionTool=EMLastCaloExtensionTool, - PerigeeCaloExtensionTool = EMParticleCaloExtensionTool, - Extrapolator=egammaExtrapolator, - useCaching=False, - useLastCaching=False - ) - - -EMExtrapolationToolsCache = ToolFactory( egammaTrackToolsConf.EMExtrapolationTools, - name ="EMExtrapolationToolsCache", - LastCaloExtensionTool=EMLastCaloExtensionTool, - PerigeeCaloExtensionTool = EMParticleCaloExtensionTool, - Extrapolator=egammaExtrapolator, - PerigeeCache='GSFPerigeeCaloExtension', - LastCache='GSFLastCaloExtension', - useCaching=True, - useLastCaching=True - ) - -EMExtrapolationToolsCommonCache = ToolFactory( egammaTrackToolsConf.EMExtrapolationTools, - name ="EMExtrapolationToolsCommonCache", - LastCaloExtensionTool=EMLastCaloExtensionTool, - PerigeeCaloExtensionTool = EMParticleCaloExtensionTool, - Extrapolator=egammaExtrapolator, - LastCache='ParticleCaloExtension', - useCaching=False, - useLastCaching=True - ) - +EMLastCaloExtensionTool = ToolFactory( + CfgMgr.Trk__ParticleCaloExtensionTool, + name="EMLastCaloExtensionTool", + Extrapolator=egammaCaloExtrapolator, + ParticleType="electron") + +EMParticleCaloExtensionTool = ToolFactory( + CfgMgr.Trk__ParticleCaloExtensionTool, + name="EMParticleCaloExtensionTool", + Extrapolator=egammaCaloExtrapolator, + ParticleType="electron", + StartFromPerigee=True) + + +EMExtrapolationTools = ToolFactory( + egammaTrackToolsConf.EMExtrapolationTools, + name="EMExtrapolationTools", + LastCaloExtensionTool=EMLastCaloExtensionTool, + PerigeeCaloExtensionTool=EMParticleCaloExtensionTool, + Extrapolator=egammaExtrapolator, + useCaching=False, + useLastCaching=False +) + + +EMExtrapolationToolsCache = ToolFactory( + egammaTrackToolsConf.EMExtrapolationTools, + name="EMExtrapolationToolsCache", + LastCaloExtensionTool=EMLastCaloExtensionTool, + PerigeeCaloExtensionTool=EMParticleCaloExtensionTool, + Extrapolator=egammaExtrapolator, + PerigeeCache='GSFPerigeeCaloExtension', + LastCache='GSFLastCaloExtension', + useCaching=True, + useLastCaching=True +) + +EMExtrapolationToolsCommonCache = ToolFactory( + egammaTrackToolsConf.EMExtrapolationTools, + name="EMExtrapolationToolsCommonCache", + LastCaloExtensionTool=EMLastCaloExtensionTool, + PerigeeCaloExtensionTool=EMParticleCaloExtensionTool, + Extrapolator=egammaExtrapolator, + LastCache='ParticleCaloExtension', + useCaching=False, + useLastCaching=True +) diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx index b61d42bbb62c7f52a4ae84aa2d720b694c4e324c..053c0291cc56f7de23a4342b8a2542190141f5ed 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx @@ -24,7 +24,7 @@ #include <algorithm> -#include <math.h> +#include <cmath> #include <vector> @@ -166,29 +166,26 @@ StatusCode egammaTrkRefitterTool::refitTrack(const EventContext& ctx, cache.originalTrack, cache.electron); if(collect.m_measurements.size()>4){ - cache.refittedTrack.reset(m_ITrackFitter->fit(collect.m_measurements, - *cache.originalTrack->perigeeParameters(), - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = + m_ITrackFitter->fit(ctx, + collect.m_measurements, + *cache.originalTrack->perigeeParameters(), + m_runOutlier, + m_ParticleHypothesis); }else { ATH_MSG_WARNING("Could **NOT** add BeamSpot information into Vector, refitting without BS"); - cache.refittedTrack.reset( - m_ITrackFitter->fit(*cache. - originalTrack, - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = m_ITrackFitter->fit( + ctx, *cache.originalTrack, m_runOutlier, m_ParticleHypothesis); } } else { std::vector<const Trk::MeasurementBase*> measurements = getIDHits(cache.originalTrack); if(measurements.size()>4){ - cache.refittedTrack.reset( - m_ITrackFitter->fit(measurements, - *cache.originalTrack->perigeeParameters(), - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = + m_ITrackFitter->fit(ctx, + measurements, + *cache.originalTrack->perigeeParameters(), + m_runOutlier, + m_ParticleHypothesis); } else { ATH_MSG_DEBUG("Not enough measurements on tracks"); cache.refittedTrack=nullptr; diff --git a/Reconstruction/tauMonitoring/CMakeLists.txt b/Reconstruction/tauMonitoring/CMakeLists.txt index 3883a2972e4522ab797861979ac746bcf0f6e853..6386f5efc0e69b2eceb3f76bd84b831399a608e2 100644 --- a/Reconstruction/tauMonitoring/CMakeLists.txt +++ b/Reconstruction/tauMonitoring/CMakeLists.txt @@ -26,6 +26,5 @@ atlas_add_component( tauMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib xAODTau GaudiKernel xAODEventInfo xAODTracking TrigDecisionToolLib ) # Install files from the package: -atlas_install_headers( tauMonitoring ) atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx b/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx index 862f5b18869dfd057eaf2bf00ba96fdd02805362..629ff8320d8625b697d282b24b4af5928b19d8bc 100644 --- a/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx +++ b/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx @@ -1,5 +1,5 @@ -#include "tauMonitoring/tauMonTool.h" -#include "tauMonitoring/tauMonitorAlgorithm.h" +#include "../tauMonTool.h" +#include "../tauMonitorAlgorithm.h" DECLARE_COMPONENT( tauMonTool ) DECLARE_COMPONENT( tauMonitorAlgorithm ) diff --git a/Reconstruction/tauMonitoring/src/tauMonTool.cxx b/Reconstruction/tauMonitoring/src/tauMonTool.cxx index 315f666b0a6ad729ddb85dfea9315b67362dd83a..d209255a18f54f27818fde3dc591df44184a7738 100644 --- a/Reconstruction/tauMonitoring/src/tauMonTool.cxx +++ b/Reconstruction/tauMonitoring/src/tauMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //********************************************************************* @@ -11,7 +11,7 @@ // Lianyou SHAN ( update for run2 ) //********************************************************************* -#include "tauMonitoring/tauMonTool.h" +#include "tauMonTool.h" #include "xAODEventInfo/EventInfo.h" #include "xAODTracking/TrackParticle.h" #include "TrigDecisionTool/TrigDecisionTool.h" @@ -28,7 +28,6 @@ using Gaudi::Units::GeV; tauMonTool::tauMonTool( const std::string & type, const std::string & name, const IInterface* parent ) :ManagedMonitorToolBase( type, name, parent ), - m_tauJetKey("TauJets"), m_doTrigger(false), m_maxNLB(1000) // m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") @@ -41,6 +40,13 @@ tauMonTool::tauMonTool( const std::string & type, tauMonTool::~tauMonTool() {} +StatusCode tauMonTool::initialize() { + ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_tauJetKey.initialize() ); + ATH_CHECK( m_eventInfoKey.initialize() ); + return StatusCode::SUCCESS; +} + //-------------------------------------------------------------------------------- // Book Histograms //-------------------------------------------------------------------------------- @@ -146,8 +152,8 @@ StatusCode tauMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - if ( (evtStore()->retrieve(evtInfo)) . isFailure()) { + SG::ReadHandle<xAOD::EventInfo> evtInfo{m_eventInfoKey}; + if (!evtInfo.isValid()) { ATH_MSG_ERROR("couldn't retrieve event info"); return StatusCode::FAILURE; } @@ -207,9 +213,9 @@ StatusCode tauMonTool::fillHistograms() //-------------------- //Get Tau container //-------------------- - const xAOD::TauJetContainer *tau_container; - if ( (evtStore()->retrieve(tau_container,m_tauJetKey)).isFailure() ) { - ATH_MSG_WARNING("Cannot retrieve " << m_tauJetKey); + SG::ReadHandle<xAOD::TauJetContainer> tau_container{m_tauJetKey}; + if ( !tau_container.isValid() ) { + ATH_MSG_WARNING("Cannot retrieve " << m_tauJetKey.key()); return StatusCode::FAILURE; } diff --git a/Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h b/Reconstruction/tauMonitoring/src/tauMonTool.h similarity index 93% rename from Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h rename to Reconstruction/tauMonitoring/src/tauMonTool.h index 38d048bf4760d498197e098023ffa8eb797fc539..9298bf7e3ffda2b6a36dc7470d51d7b619b272d8 100644 --- a/Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h +++ b/Reconstruction/tauMonitoring/src/tauMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TAUMONTOOL_H @@ -18,7 +18,7 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "xAODTau/TauDefs.h" -#include "xAODTau/TauJet.h" +#include "xAODTau/TauJetContainer.h" class tauMonTool : public ManagedMonitorToolBase { @@ -28,14 +28,16 @@ public: // destructor virtual ~tauMonTool(); - StatusCode bookHistograms(); - StatusCode fillHistograms(); - StatusCode procHistograms(); + StatusCode initialize() override; + StatusCode bookHistograms() override; + StatusCode fillHistograms() override; + StatusCode procHistograms() override; StatusCode Book1DHist(TH1 ** hist, MonGroup * monName, std::string histName, std::string histTitle, int NBins, double lowBin, double highBin); StatusCode Book2DHist(TH2 ** hist, MonGroup * monName, std::string histName, std::string histTitle, int NXBins, double lowXBin, double highXBin, int NYBins, double lowYBin, double highYBin); protected: - std::string m_tauJetKey; + SG::ReadHandleKey<xAOD::TauJetContainer> m_tauJetKey{this, "tauJetKey", "TauJets"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo"}; bool m_doTrigger; int m_maxNLB; diff --git a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx index 32e17fc9a1ff684f143441b75df88b7282ca65b1..07e39297516a446d35092f0aff4b8a2fc26f1867 100644 --- a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx +++ b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "tauMonitoring/tauMonitorAlgorithm.h" +#include "tauMonitorAlgorithm.h" #include "GaudiKernel/SystemOfUnits.h" #include "xAODCore/ShallowCopy.h" diff --git a/Reconstruction/tauMonitoring/tauMonitoring/tauMonitorAlgorithm.h b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.h similarity index 100% rename from Reconstruction/tauMonitoring/tauMonitoring/tauMonitorAlgorithm.h rename to Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.h diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index b9f731698046c08f224997084d304f7220cb0b60..b2df3e552273b18f7f6e78a6d8f0419d4eeb9abe 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -77,7 +77,8 @@ def getTauAxis(): from tauRecTools.tauRecToolsConf import TauAxisSetter TauAxisSetter = TauAxisSetter( name = _name, ClusterCone = 0.2, - VertexCorrection = True) + VertexCorrection = True, + IncShowerSubtr = tauFlags.useShowerSubClusters() ) cached_instances[_name] = TauAxisSetter return TauAxisSetter @@ -311,7 +312,8 @@ def getTauSubstructure(): # parameters for CaloIsoCorrected variable maxPileUpCorrection = 4000., #MeV pileUpAlpha = 1.0, - VertexCorrection = True + VertexCorrection = True, + IncShowerSubtr = tauFlags.useShowerSubClusters() ) cached_instances[_name] = TauSubstructureVariables @@ -388,7 +390,8 @@ def getPi0ClusterCreator(): from tauRecTools.tauRecToolsConf import TauPi0ClusterCreator TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name, - Key_Pi0ClusterContainer="TauPi0SubtractedClusters" + Key_Pi0ClusterContainer="TauPi0SubtractedClusters", + IncShowerSubtr = tauFlags.useShowerSubClusters() ) cached_instances[_name] = TauPi0ClusterCreator diff --git a/Reconstruction/tauRec/python/tauRecFlags.py b/Reconstruction/tauRec/python/tauRecFlags.py index 6fa5ff40ea81830db741115fbfbdd50a8d725b17..fef5f98b99b6b5e7fbf646d50b3c6b9a62cacc70 100644 --- a/Reconstruction/tauRec/python/tauRecFlags.py +++ b/Reconstruction/tauRec/python/tauRecFlags.py @@ -193,7 +193,7 @@ class useOldVertexFitterAPI(JobProperty): class useShowerSubClusters(JobProperty): """ switch on use of shower subtracted clusters """ - statusOn=False + statusOn=True allowedTypes=['bool'] StoredValue=False diff --git a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx index 59e14070850d7821e0a61a42ecfbf18b8261ef2b..c78183810d0b34f07005840b4875236b530151fa 100644 --- a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx +++ b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx @@ -3,6 +3,7 @@ */ #include "tauRecTools/CaloClusterVariables.h" +#include "tauRecTools/HelperFunctions.h" #include <cmath> const double CaloClusterVariables::DEFAULT = -1111.; @@ -21,7 +22,8 @@ m_totMass(DEFAULT), m_effMass(DEFAULT), m_totEnergy(DEFAULT), m_effEnergy(DEFAULT), -m_doVertexCorrection(false) { +m_doVertexCorrection(false), +m_incShowerSubtr(true){ } //******************************************* @@ -33,18 +35,15 @@ bool CaloClusterVariables::update(const xAOD::TauJet& pTau) { const xAOD::Jet* pSeed = *pTau.jetLink(); if(!pSeed) return false; - xAOD::JetConstituentVector::const_iterator nav_it = pSeed->getConstituents().begin(); - xAOD::JetConstituentVector::const_iterator nav_itE = pSeed->getConstituents().end(); - const xAOD::CaloCluster* pCluster; - - std::vector<CaloVertexedClusterType> constituents; - for (; nav_it != nav_itE; ++nav_it) { - pCluster = dynamic_cast<const xAOD::CaloCluster*> ( (*nav_it)->rawConstituent() ); - if (!pCluster) continue; + // Loop through jets, get links to clusters + std::vector<const xAOD::CaloCluster*> clusterList; + StatusCode sc = tauRecTools::GetJetClusterList(pSeed, clusterList, m_incShowerSubtr); + std::vector<CaloVertexedClusterType> constituents; + for (auto pCluster : clusterList){ // correct cluster if (pTau.vertexLink() && m_doVertexCorrection) - constituents.emplace_back (*pCluster, (*pTau.vertexLink())->position()); + constituents.emplace_back (*pCluster, (*pTau.vertexLink())->position()); else constituents.emplace_back (*pCluster); } diff --git a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx index bed43d1062c169fef5f4a6ea5257862fa610eb37..890c326a52d60d0a1c2877fe09d19a05db1a6e74 100644 --- a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx +++ b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx @@ -195,7 +195,7 @@ float tauRecTools::TRTBDT::GetResponse(){ return this->bdt->GetResponse(); } -const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted){ +const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted, TLorentzVector dRVector, double dRCut){ using namespace tauRecTools::msgHelperFunction; // If using subtracted clusters, need to store unmodified to check if charged are duplicates @@ -206,44 +206,62 @@ const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vecto for(auto jCon : jVec){ ANA_MSG_DEBUG("JetConstituent: "); ANA_MSG_DEBUG("eta: " << jCon->eta() << " phi: " << jCon->phi() << " e: " << jCon->e()); - if( jCon->type() == xAOD::Type::CaloCluster ) { - const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( jCon->rawConstituent() ); - ANA_MSG_DEBUG("CaloCluster: "); - ANA_MSG_DEBUG("eta: " << cluster->eta() << " phi: " << cluster->phi() << " e: " << cluster->e()); - ANA_MSG_DEBUG("rawEta: " << cluster->rawEta() << " rawPhi: " << cluster->rawPhi() << " rawE: " << cluster->rawE()); - ANA_MSG_DEBUG("calEta: " << cluster->calEta() << " calPhi: " << cluster->calPhi() << " calE: " << cluster->calE()); - clusterList.push_back(cluster); + + // do deltaR check against jet constituent + bool PassdR = true; + if (dRCut > 0){ + TLorentzVector tempClusterVector; + tempClusterVector.SetPtEtaPhiE( jCon->pt(), jCon->eta(), jCon->phi(), jCon->e() ); + ANA_MSG_DEBUG("Apply dR cut on JetConstituent: " << dRCut ); + ANA_MSG_DEBUG("JetConstituent Pt: " << tempClusterVector.Pt() << ", Eta: " << tempClusterVector.Eta() << ", Phi: " << tempClusterVector.Phi()); + ANA_MSG_DEBUG("dR " << dRVector.DeltaR(tempClusterVector)); + if (dRVector.DeltaR(tempClusterVector) > dRCut){ + ANA_MSG_DEBUG("Failed dR Cut "); + PassdR = false; + } } - else if( jCon->type() == xAOD::Type::ParticleFlow ) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( jCon->rawConstituent() ); - if( !pfo->isCharged() ){ - if( pfo->nCaloCluster()==1 ){ - - if (incShowerSubtracted){ - ElementLink<xAOD::CaloClusterContainer> subClusLink; - pfo->attribute("PFOShowerSubtractedClusterLink", subClusLink); - if ( !subClusLink.isValid() ){ - ANA_MSG_ERROR("Tau HelperFunctions: Found invalid link to shower subtracted cluster"); - return StatusCode::FAILURE; + + if (PassdR){ + if( jCon->type() == xAOD::Type::CaloCluster ) { + const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( jCon->rawConstituent() ); + ANA_MSG_DEBUG("CaloCluster: "); + ANA_MSG_DEBUG("eta: " << cluster->eta() << " phi: " << cluster->phi() << " e: " << cluster->e()); + ANA_MSG_DEBUG("rawEta: " << cluster->rawEta() << " rawPhi: " << cluster->rawPhi() << " rawE: " << cluster->rawE()); + ANA_MSG_DEBUG("calEta: " << cluster->calEta() << " calPhi: " << cluster->calPhi() << " calE: " << cluster->calE()); + + clusterList.push_back(cluster); + } + else if( jCon->type() == xAOD::Type::ParticleFlow ) { + const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( jCon->rawConstituent() ); + if( !pfo->isCharged() ){ + if( pfo->nCaloCluster()==1 ){ + + if (incShowerSubtracted){ + ElementLink<xAOD::CaloClusterContainer> subClusLink; + pfo->attribute("PFOShowerSubtractedClusterLink", subClusLink); + if ( !subClusLink.isValid() ){ + ANA_MSG_ERROR("Tau HelperFunctions: Found invalid link to shower subtracted cluster"); + return StatusCode::FAILURE; + } + else { + clusterList.push_back( (*subClusLink) ); + dupList.push_back( pfo->cluster(0) ); + } } else { - clusterList.push_back( (*subClusLink) ); - dupList.push_back( pfo->cluster(0) ); + clusterList.push_back(pfo->cluster(0)); } - } - else { - clusterList.push_back(pfo->cluster(0)); - } - } - else ANA_MSG_WARNING("Neutral PFO has " << std::to_string(pfo->nCaloCluster()) << " clusters, expected exactly 1!\n"); + } + else ANA_MSG_WARNING("Neutral PFO has " << std::to_string(pfo->nCaloCluster()) << " clusters, expected exactly 1!\n"); - }// neutral PFO check - } - else{ - ANA_MSG_ERROR("GetJetConstCluster: Seed jet constituent type not supported!"); - return StatusCode::FAILURE; - } + }// neutral PFO check + } + else{ + ANA_MSG_ERROR("GetJetConstCluster: Seed jet constituent type not supported!"); + return StatusCode::FAILURE; + } + }// dR check } // Get clusters from charged PFOs @@ -252,21 +270,38 @@ const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vecto else checkList = clusterList; for(auto jCon : jVec){ + if( jCon->type() == xAOD::Type::ParticleFlow ) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( jCon->rawConstituent() ); - if( pfo->isCharged() ){ - - // loop through clusters linked to charged PFO - for (u_int cc=0; cc<pfo->nCaloCluster(); cc++){ - const xAOD::CaloCluster* cluster = pfo->cluster(cc); - // check it is not duplicate of one in neutral list - if ( std::find(checkList.begin(), checkList.end(), cluster) == checkList.end() ){ - clusterList.push_back(cluster); - checkList.push_back(cluster); - } - } + bool PassdR = true; + if (dRCut > 0){ + TLorentzVector tempClusterVector; + tempClusterVector.SetPtEtaPhiE( jCon->pt(), jCon->eta(), jCon->phi(), jCon->e() ); + ANA_MSG_DEBUG("Apply dR cut on JetConstituent: " << dRCut ); + ANA_MSG_DEBUG("JetConstituent Pt: " << tempClusterVector.Pt() << ", Eta: " << tempClusterVector.Eta() << ", Phi: " << tempClusterVector.Phi()); + ANA_MSG_DEBUG("dR " << dRVector.DeltaR(tempClusterVector)); + if (dRVector.DeltaR(tempClusterVector) > dRCut){ + ANA_MSG_DEBUG("Failed dR Cut "); + PassdR = false; + } } + + if (PassdR){ + const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( jCon->rawConstituent() ); + if( pfo->isCharged() ){ + + // loop through clusters linked to charged PFO + for (u_int cc=0; cc<pfo->nCaloCluster(); cc++){ + const xAOD::CaloCluster* cluster = pfo->cluster(cc); + // check it is not duplicate of one in neutral list + if ( std::find(checkList.begin(), checkList.end(), cluster) == checkList.end() ){ + clusterList.push_back(cluster); + checkList.push_back(cluster); + } + } + + } + }// dR check } }// loop through jet constituents diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index f19fbc769a82cf82abe5836cd2af3355c13762ee..f9f839c0c392b8c0cee64cef8a95b5de827495dd 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -33,7 +33,7 @@ StatusCode MvaTESVariableDecorator::finalize() { } //_____________________________________________________________________________ -StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) { +StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { // Decorate event info // need to check mu can be retrieved via EventInfo for Run3 trigger @@ -84,15 +84,16 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) { TLorentzVector clusters_had_P4; clusters_had_P4.SetPtEtaPhiM(0,0,0,0); + TLorentzVector LC_P4; + LC_P4.SetPtEtaPhiM(xTau.ptDetectorAxis(), xTau.etaDetectorAxis(), xTau.phiDetectorAxis(), xTau.m()); + // Loop through jets, get links to clusters std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jet_seed, clusterList, m_incShowerSubtr)); + ATH_CHECK(tauRecTools::GetJetClusterList(jet_seed, clusterList, m_incShowerSubtr, LC_P4, 0.2)); // Loop through clusters and jet constituents for (auto cl : clusterList){ - if (xTau.p4(xAOD::TauJetParameters::DetectorAxis).DeltaR(cl->p4()) > 0.2) continue; - clE = cl->calE(); Etot += clE; diff --git a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx index ad9a55c15b9cea9fff16cee48c17fe263d2394b6..6e41e948f5a4426573ad6f9462a4593eb4d65135 100644 --- a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx +++ b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx @@ -132,7 +132,7 @@ StatusCode TauCalibrateLC::initialize() { } /********************************************************************/ -StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) +StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) const { // energy calibration depends on number of tracks - 1p or Mp int prongBin = 1; //Mp diff --git a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx index 423f7dc08ed3899b4395d89f8200ad42f1615a38..a69c9f87a354ff8a843f08afeab2c883754d7737 100644 --- a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx +++ b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx @@ -56,7 +56,7 @@ StatusCode TauCommonCalcVars::finalize() { //----------------------------------------------------------------------------- // Execution //----------------------------------------------------------------------------- -StatusCode TauCommonCalcVars::execute(xAOD::TauJet& pTau) { +StatusCode TauCommonCalcVars::execute(xAOD::TauJet& pTau) const { ///////////////////////////////////////////////// // Calculate variables that are always valid diff --git a/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx b/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx index 8add49ef121c27474f47814ec9dd483c61fd1549..c3f01225741f45880bc9a585ca98f3a47ee91ad2 100644 --- a/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/TauEleOLRDecorator.cxx @@ -47,7 +47,7 @@ StatusCode TauEleOLRDecorator::initialize() return StatusCode::SUCCESS; } -StatusCode TauEleOLRDecorator::execute(xAOD::TauJet& tau) +StatusCode TauEleOLRDecorator::execute(xAOD::TauJet& tau) const { // get electron container SG::ReadHandle<xAOD::ElectronContainer> electronInHandle( m_electronInputContainer ); @@ -102,7 +102,7 @@ StatusCode TauEleOLRDecorator::finalize() return StatusCode::SUCCESS; } -float TauEleOLRDecorator::getCutVal(float fEta, float fPt) +float TauEleOLRDecorator::getCutVal(float fEta, float fPt) const { if(fPt>1900) fPt=1900; if(std::abs(fEta)>2.465) fEta=2.465; diff --git a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx index de9c8deaabf552a4c0b43f02e608d1da7b356451..d005725d7004b89136b81518046ba7fd711b8434 100644 --- a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx +++ b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx @@ -31,7 +31,7 @@ StatusCode TauIDVarCalculator::initialize() return StatusCode::SUCCESS; } -StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) +StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const { int nVtx = 0; if(!inTrigger()){ diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx index 069a006b53ccb0dbe434b86c745b52c4a6cc3529..3c26d243719529bc3c37806ab09eeba6b169e80e 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx @@ -112,7 +112,7 @@ StatusCode TauJetRNNEvaluator::initialize() { return StatusCode::SUCCESS; } -StatusCode TauJetRNNEvaluator::execute(xAOD::TauJet &tau) { +StatusCode TauJetRNNEvaluator::execute(xAOD::TauJet &tau) const { // Output variable accessor const SG::AuxElement::Accessor<float> output(m_output_varname); @@ -156,7 +156,7 @@ TauJetRNN *TauJetRNNEvaluator::get_rnn_3p() { } StatusCode TauJetRNNEvaluator::get_tracks( - const xAOD::TauJet &tau, std::vector<const xAOD::TauTrack *> &out) { + const xAOD::TauJet &tau, std::vector<const xAOD::TauTrack *> &out) const { auto tracks = tau.allTracks(); // Sort by descending pt @@ -175,7 +175,7 @@ StatusCode TauJetRNNEvaluator::get_tracks( } StatusCode TauJetRNNEvaluator::get_clusters( - const xAOD::TauJet &tau, std::vector<const xAOD::CaloCluster *> &out) { + const xAOD::TauJet &tau, std::vector<const xAOD::CaloCluster *> &out) const { const xAOD::Jet *jet_seed = *tau.jetLink(); if (!jet_seed) { diff --git a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx index e7017156772b598e98b57d3bc4a2b2c657fdc1d0..bb42ed93834101d2ea4bf72432c09d651f88554b 100644 --- a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx +++ b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx @@ -9,6 +9,12 @@ #include "TEnv.h" #include "THashList.h" +#include <sys/types.h> +#include <unistd.h> +#include <string> +#include <sstream> +#include <cstdlib> + //________________________________________ std::string TauRecToolBase::find_file(const std::string& fname) const { std::string full_path; @@ -138,7 +144,7 @@ StatusCode TauRecToolBase::eventInitialize(){ } //________________________________________ -StatusCode TauRecToolBase::execute(xAOD::TauJet&){ +StatusCode TauRecToolBase::execute(xAOD::TauJet&) const { ATH_MSG_ERROR("function not implemented"); return StatusCode::FAILURE; } diff --git a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx index 17bfc4df285418953777b4f82b1ff76b2b499dc1..1d5fdd5d5edbd88f79fc76c6f8ff3ea657d9d2d9 100644 --- a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx +++ b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx @@ -20,6 +20,7 @@ #include "tauRecTools/TauSubstructureVariables.h" #include "tauRecTools/KineUtils.h" +#include "tauRecTools/HelperFunctions.h" #define GeV 1000 const double TauSubstructureVariables::DEFAULT = -1111.; @@ -33,6 +34,7 @@ TauSubstructureVariables::TauSubstructureVariables( const std::string& name ) declareProperty("maxPileUpCorrection", m_maxPileUpCorrection = 4 * GeV); declareProperty("pileUpAlpha", m_pileUpAlpha = 1.0); declareProperty("VertexCorrection", m_doVertexCorrection = false); + declareProperty("IncShowerSubtr", m_incShowerSubtr = true); } @@ -65,7 +67,7 @@ StatusCode TauSubstructureVariables::finalize() { // Execute method //************************************ -StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { +StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) const { const xAOD::Jet* taujetseed = (*pTau.jetLink()); if (!taujetseed) { @@ -79,6 +81,7 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { CaloClusterVariables CaloClusterVariablesTool; CaloClusterVariablesTool.setVertexCorrection(m_doVertexCorrection); + CaloClusterVariablesTool.setIncSub(m_incShowerSubtr); bool isFilled = CaloClusterVariablesTool.update(pTau); @@ -132,8 +135,6 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { float dr(0.); unsigned int num_clusters(0); - const xAOD::CaloCluster* incluster; - std::vector<const xAOD::CaloCluster*> vClusters; TLorentzVector leadClusVec; TLorentzVector subLeadClusVec; @@ -141,18 +142,12 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { double clusELead = -1111.0; double clusESubLead = -1111.0; - // loop over all clusters of the jet seed - xAOD::JetConstituentVector jcv = taujetseed->getConstituents(); - xAOD::JetConstituentVector::const_iterator nav_it = jcv.begin(); - xAOD::JetConstituentVector::const_iterator nav_itE = jcv.end(); - for (; nav_it != nav_itE; ++nav_it) { - ++num_clusters; - - incluster = dynamic_cast<const xAOD::CaloCluster*>( (*nav_it)->rawConstituent() ); - if (!incluster) continue; + // Loop through jets, get links to clusters + std::vector<const xAOD::CaloCluster*> vClusters; + ATH_CHECK(tauRecTools::GetJetClusterList(taujetseed, vClusters, m_incShowerSubtr)); - // save all clusters of jet seed - vClusters.push_back(incluster); + for (auto incluster : vClusters){ + ++num_clusters; // calc total energy totalEnergy += incluster->e(); @@ -200,10 +195,10 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { if (clusESubLead > 0.) { approxSubstructure4Vec += subLeadClusVec; } - + // now sort cluster by energy std::sort(vClusters.begin(), vClusters.end(), DefCaloClusterCompare()); - + // determine energy sum of leading 2 and leading 3 clusters float sum2LeadClusterE(0.); float sum3LeadClusterE(0.); @@ -276,7 +271,6 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { pTau.setDetail(xAOD::TauJetParameters::ChPiEMEOverCaloEME, static_cast<float>(fChPIEMEOverCaloEME)); pTau.setDetail(xAOD::TauJetParameters::EMPOverTrkSysP, static_cast<float>(fEMPOverTrkSysP)); - // jvf and sumPtTrk are now a vector and the old run1-type jvf value is stored in the 0-th element // sumPtTrk is calculated wrt Vertices diff --git a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx index cc04d313f44dea2eefaf2e54f1f803e33e7d8854..04fd8719b09beabaacaed80e73be60f0466a8768 100644 --- a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx +++ b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx @@ -63,7 +63,7 @@ StatusCode TauTrackClassifier::finalize() //______________________________________________________________________________ -StatusCode TauTrackClassifier::execute(xAOD::TauJet& xTau) +StatusCode TauTrackClassifier::execute(xAOD::TauJet& xTau) const { // Get track container via link from tau - instead of using read handle (not written to store yet) // Check that size > 0 diff --git a/Reconstruction/tauRecTools/Root/TauTrackRNNClassifier.cxx b/Reconstruction/tauRecTools/Root/TauTrackRNNClassifier.cxx index e47b3855e7c6f35761a4934835b0a5f472f570a5..7845aec15cbc45b568b2f91b6d6e898536011cef 100644 --- a/Reconstruction/tauRecTools/Root/TauTrackRNNClassifier.cxx +++ b/Reconstruction/tauRecTools/Root/TauTrackRNNClassifier.cxx @@ -46,7 +46,7 @@ StatusCode TauTrackRNNClassifier::initialize() } //______________________________________________________________________________ -StatusCode TauTrackRNNClassifier::execute(xAOD::TauJet& xTau) +StatusCode TauTrackRNNClassifier::execute(xAOD::TauJet& xTau) const { // Get track container via link from tau - instead of using read handle (not written to store yet) // Check that size > 0 diff --git a/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx b/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx index 138ecbac632dbf568508d28b7eaa6e6a061d0293..c5a3c6ff842de5a2b53b97461c078d8c56f8c6e6 100644 --- a/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/TauWPDecorator.cxx @@ -114,7 +114,7 @@ StatusCode TauWPDecorator::storeLimits(int nProng) { return StatusCode::SUCCESS; } -double TauWPDecorator::transformScore(double score, double cut_lo, double eff_lo, double cut_hi, double eff_hi) { +double TauWPDecorator::transformScore(double score, double cut_lo, double eff_lo, double cut_hi, double eff_hi) const { double newscore = 1. - eff_lo - (score - cut_lo)/(cut_hi - cut_lo) * (eff_hi - eff_lo); return newscore; } @@ -143,7 +143,7 @@ StatusCode TauWPDecorator::initialize() { } /********************************************************************/ -StatusCode TauWPDecorator::execute(xAOD::TauJet& pTau) +StatusCode TauWPDecorator::execute(xAOD::TauJet& pTau) const { float mu = 0; @@ -189,8 +189,8 @@ StatusCode TauWPDecorator::execute(xAOD::TauJet& pTau) ATH_MSG_VERBOSE("mu before " << y_var); // Implement limits - pt = TMath::Min(m_xmax[nProng], TMath::Max(m_xmin[nProng], pt)); - y_var = TMath::Min(m_ymax[nProng], TMath::Max(m_ymin[nProng], y_var)); + pt = TMath::Min(m_xmax.at(nProng), TMath::Max(m_xmin.at(nProng), pt)); + y_var = TMath::Min(m_ymax.at(nProng), TMath::Max(m_ymin.at(nProng), y_var)); ATH_MSG_VERBOSE("pT after " << pt); ATH_MSG_VERBOSE("mu after " << y_var); diff --git a/Reconstruction/tauRecTools/src/JetSeedBuilder.cxx b/Reconstruction/tauRecTools/src/JetSeedBuilder.cxx index e62e972e8db4350e0ea551d17751519f08dc5dfc..cf349446aa11f0dae3b0b2cac4b9da378a55feb4 100644 --- a/Reconstruction/tauRecTools/src/JetSeedBuilder.cxx +++ b/Reconstruction/tauRecTools/src/JetSeedBuilder.cxx @@ -3,109 +3,77 @@ */ #ifndef XAOD_ANALYSIS -/******************************************************************** -NAME: JetSeedBuilder.cxx -PACKAGE: offline/Reconstruction/tauRec -AUTHORS: N. Meyer -CREATED: Nov 27 2007 -17/03/2010: AK: change to P4Helpers -16/05/2011: FF: fix rare case if no jet_seed found at all (coverity 21744) - Dec 2011: FF: changes for tauRec4 - ********************************************************************/ +#include "JetSeedBuilder.h" #include "xAODJet/Jet.h" #include "xAODJet/JetContainer.h" - #include "xAODTau/TauJetContainer.h" #include "xAODTau/TauJetAuxContainer.h" #include "xAODTau/TauJet.h" -#include "JetSeedBuilder.h" -//------------------------------------------------------------------------- -// Constructor -//------------------------------------------------------------------------- JetSeedBuilder::JetSeedBuilder(const std::string& name) : TauRecToolBase(name) { } -//------------------------------------------------------------------------- -// Destructor -//------------------------------------------------------------------------- + JetSeedBuilder::~JetSeedBuilder() { } -//------------------------------------------------------------------------- -// initialize -//------------------------------------------------------------------------- + StatusCode JetSeedBuilder::initialize() { - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } -//------------------------------------------------------------------------- -// finalize -//------------------------------------------------------------------------- + StatusCode JetSeedBuilder::finalize() { - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } -//------------------------------------------------------------------------- -// execute -//------------------------------------------------------------------------- - -StatusCode JetSeedBuilder::execute(xAOD::TauJet& pTau) { - - ATH_MSG_DEBUG("Starting execute"); - - const xAOD::Jet* pJetSeed = nullptr; - if (pTau.jetLink().isValid()) pJetSeed = * pTau.jetLink(); - else { - ATH_MSG_ERROR("seed is not a jet -> tau will not be reconstructed"); - return StatusCode::FAILURE; - } - - ATH_MSG_DEBUG("seed is Jet with" - << " pt=" << pJetSeed->pt() - << " eta=" << pJetSeed->eta() - << " phi=" << pJetSeed->phi() - ); - - - ///XXX need to decide whether to remove this, because there's no author flag in xAOD::TauJet - - //*********************************************************************** - // set author to both-seeded because we don't want to break any analysis - // most of the analyses are using author==3 or author==1 - // so setting author=3 should be safe for everybody - // calo seeded tau - // pTau.setAuthor(TauJetParameters::tauRec); - // // track seeded tau - // pTau.setAuthor(TauJetParameters::tau1P3P); - //*********************************************************************** - - if (inTrigger() && pJetSeed->e() < 0) { - // SL/SX trigger mode with negative jet_seed - do not set TauJet eta and phi in JetSeedBuilder - ATH_MSG_DEBUG("TauJet eta/phi will be set in Level2 Trigger for negative energy jet"); - pTau.setP4(pJetSeed->pt(),pTau.eta(),pTau.phi(),0.0); - - } else { - - if ( pJetSeed->pt() > 1e-7) - pTau.setP4(static_cast<float>( pJetSeed->pt() ) ,static_cast<float>( pJetSeed->eta() ) ,static_cast<float>( pJetSeed->phi() ) ,0.0 ); - else - pTau.setP4(static_cast<float>( 1e-7 ) ,static_cast<float>( pJetSeed->eta() ) ,static_cast<float>( pJetSeed->phi() ) , 0.0 ); - - //store 4-vector of seed - pTau.setP4( xAOD::TauJetParameters::JetSeed, pJetSeed->pt(), pJetSeed->eta(), pJetSeed->phi(), pJetSeed->m() ); - } - - return StatusCode::SUCCESS; -} +StatusCode JetSeedBuilder::execute(xAOD::TauJet& pTau) const { + + ATH_MSG_DEBUG("Starting execute"); + + const xAOD::Jet* jetSeed = nullptr; + if (pTau.jetLink().isValid()) { + jetSeed = * pTau.jetLink(); + } + else { + ATH_MSG_ERROR("seed is not a jet -> tau will not be reconstructed"); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("seed is Jet with" + << " pt=" << jetSeed->pt() + << " eta=" << jetSeed->eta() + << " phi=" << jetSeed->phi()); + + // Do not set eta phi for negative energy jet in trigger + // For other case, pt is reset to be at least 1e-7. + if (inTrigger() && jetSeed->e() < 0) { + ATH_MSG_DEBUG("TauJet eta/phi will be set in Level2 Trigger for negative energy jet"); + pTau.setP4(jetSeed->pt(),pTau.eta(),pTau.phi(),0.0); + } + else { + if ( jetSeed->pt() > 1e-7) { + pTau.setP4(jetSeed->pt(), jetSeed->eta(), jetSeed->phi(), 0.0); + } + else { + pTau.setP4(static_cast<float>(1e-7), jetSeed->eta(), jetSeed->phi(), 0.0); + } + + pTau.setP4(xAOD::TauJetParameters::JetSeed, jetSeed->pt(), jetSeed->eta(), jetSeed->phi(), jetSeed->m()); + } + + return StatusCode::SUCCESS; +} + #endif + diff --git a/Reconstruction/tauRecTools/src/JetSeedBuilder.h b/Reconstruction/tauRecTools/src/JetSeedBuilder.h index 97ac8dbfcf500fa391ffb05bada741ec37c44a56..ea014e431d1246640c93ee81c3ef6539714ea955 100644 --- a/Reconstruction/tauRecTools/src/JetSeedBuilder.h +++ b/Reconstruction/tauRecTools/src/JetSeedBuilder.h @@ -9,28 +9,31 @@ /** - * @brief Class to build tauRec seeds from topojets. - * - * Sets the jet ElementLink and basic kinematic variables in TauJet by searching a matching jet to the tau direction. - * Also the mass of the tau is set to 0. - * With tauRec4 the JetSeedBuilder method is the only one to search for a tau candidates. - * The author of the tau candidate is set 1 (former calo-only seeded) and 3 (former calo+track-seeded) to keep backwards compatibility. - * + * @brief Class to build tau jet seed. * @author N.Meyer <nicom@cern.ch> * @author Felix Friedrich */ class JetSeedBuilder : public TauRecToolBase { -public: - JetSeedBuilder(const std::string& name); + + public: + ASG_TOOL_CLASS2( JetSeedBuilder, TauRecToolBase, ITauToolBase ) + /** @brief Constructor */ + JetSeedBuilder(const std::string& name); + + /** @brief Destructor */ virtual ~JetSeedBuilder(); + /** @brief Initialization of this tool */ virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + + /** @brief Executation of this tool */ + virtual StatusCode execute(xAOD::TauJet& pTau) const override; + + /** @brief Finalization of this tool */ virtual StatusCode finalize() override; - }; #endif /* JETSEEDBUILDER_H */ diff --git a/Reconstruction/tauRecTools/src/TauAxisSetter.cxx b/Reconstruction/tauRecTools/src/TauAxisSetter.cxx index 726845458ce9d701030cf7f6bb3f10b908130963..4ed82d2f0d16ae17547f4e66e86cdd9f1d1a0098 100644 --- a/Reconstruction/tauRecTools/src/TauAxisSetter.cxx +++ b/Reconstruction/tauRecTools/src/TauAxisSetter.cxx @@ -10,6 +10,7 @@ #include "CaloUtils/CaloVertexedCluster.h" #include "TauAxisSetter.h" +#include "tauRecTools/HelperFunctions.h" /********************************************************************/ TauAxisSetter::TauAxisSetter(const std::string& name) : @@ -26,7 +27,7 @@ StatusCode TauAxisSetter::initialize() } /********************************************************************/ -StatusCode TauAxisSetter::execute(xAOD::TauJet& pTau) +StatusCode TauAxisSetter::execute(xAOD::TauJet& pTau) const { const xAOD::Jet* pJetSeed = (*pTau.jetLink()); @@ -89,21 +90,16 @@ StatusCode TauAxisSetter::execute(xAOD::TauJet& pTau) if(m_doVertexCorrection) { TLorentzVector tauInterAxis; - - for (cItr = pJetSeed->getConstituents().begin(); cItr != cItrE; ++cItr) { - tempClusterVector.SetPtEtaPhiE( (*cItr)->pt(), (*cItr)->eta(), (*cItr)->phi(), (*cItr)->e() ); - if (BaryCenter.DeltaR(tempClusterVector) > m_clusterCone) - continue; - - const xAOD::CaloCluster* cluster = dynamic_cast<const xAOD::CaloCluster*>( (*cItr)->rawConstituent() ); - if (!cluster) continue; - + + std::vector<const xAOD::CaloCluster*> clusterList; + ATH_CHECK(tauRecTools::GetJetClusterList(pJetSeed, clusterList, m_incShowerSubtr, BaryCenter, m_clusterCone)); + for (auto cluster : clusterList){ if (pTau.vertexLink()) tauInterAxis += xAOD::CaloVertexedCluster(*cluster, (*pTau.vertexLink())->position()).p4(); else tauInterAxis += xAOD::CaloVertexedCluster(*cluster).p4(); } - + // save values for intermediate axis ATH_MSG_DEBUG("tau axis:" << tauInterAxis.Pt()<< " " << tauInterAxis.Eta() << " " << tauInterAxis.Phi() << " " << tauInterAxis.E() ); pTau.setP4(tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), pTau.m()); diff --git a/Reconstruction/tauRecTools/src/TauAxisSetter.h b/Reconstruction/tauRecTools/src/TauAxisSetter.h index b2d5d9cb0553203af77bb5e7ab978f793eaf9164..836aaed929c99e7d4962af20cb3a784d6461058a 100644 --- a/Reconstruction/tauRecTools/src/TauAxisSetter.h +++ b/Reconstruction/tauRecTools/src/TauAxisSetter.h @@ -29,13 +29,14 @@ public: ~TauAxisSetter(); virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode finalize() override; private: Gaudi::Property<double> m_clusterCone {this, "ClusterCone", 0.2, "cone of tau candidate"}; Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; + Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"}; }; #endif diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.cxx b/Reconstruction/tauRecTools/src/TauCellVariables.cxx index c9419af81a0ab7f479bd9f8581092a0713af1ddf..f43b65e91fd8a67107e5e363de34eae07e4c28cd 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauCellVariables.cxx @@ -40,7 +40,7 @@ StatusCode TauCellVariables::initialize() { -StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) { +StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { const xAOD::Jet* pJetSeed = (*pTau.jetLink()); if (!pJetSeed) { diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.h b/Reconstruction/tauRecTools/src/TauCellVariables.h index fe87194280e39f6e54cfe5a86bbfb3cf3158a7a7..13119d343b6a79ee91afac4f6783d5b62baab14b 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.h +++ b/Reconstruction/tauRecTools/src/TauCellVariables.h @@ -32,7 +32,7 @@ class TauCellVariables : public TauRecToolBase { virtual StatusCode finalize() override; /** @brief Perform the calculation of cell variables for each tau candidate */ - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; private: diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx index ae3218fce8596e2d36d861f52aa6f060d31356e1..6f2eccd2cd574e6f8818c20cabb0106fe802b158 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx @@ -76,7 +76,7 @@ StatusCode TauElectronVetoVariables::initialize() //------------------------------------------------------------------------- // Execution //------------------------------------------------------------------------- -StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) +StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const { if (pTau.nTracks() < 1) { return StatusCode::SUCCESS; diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h index d002a49e04037a8625cb0dcc8853302ae6641fa1..d239719254f93975e1b5353826ac117ed7ff4899 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h @@ -29,7 +29,7 @@ public: ASG_TOOL_CLASS2(TauElectronVetoVariables, TauRecToolBase, ITauToolBase); virtual ~TauElectronVetoVariables(); - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode initialize() override; virtual StatusCode finalize() override; diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx index 8cbfcfa25b0639916c1786b528410f1cb24962d8..13441c7a25c78d95af132fbfdda0c8c05914f37b 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx @@ -16,7 +16,7 @@ #include "xAODJet/Jet.h" #include "TauPi0ClusterCreator.h" - +#include "tauRecTools/HelperFunctions.h" using std::vector; using std::string; @@ -421,18 +421,17 @@ bool TauPi0ClusterCreator::setHadronicClusterPFOs(xAOD::TauJet& pTau, xAOD::PFOC ATH_MSG_ERROR("Could not retrieve tau jet seed"); return false; } - xAOD::JetConstituentVector::const_iterator clusterItr = tauJetSeed->getConstituents().begin(); - xAOD::JetConstituentVector::const_iterator clusterItrE = tauJetSeed->getConstituents().end(); - for (; clusterItr != clusterItrE; ++clusterItr){ + std::vector<const xAOD::CaloCluster*> clusterList; + + StatusCode sc = tauRecTools::GetJetClusterList(tauJetSeed, clusterList, m_incShowerSubtr); + if (!sc) return false; + + for (auto cluster : clusterList){ // Procedure: // - Calculate cluster energy in Hcal. This is to treat -ve energy cells correctly // - Then set 4momentum via setP4(E/cosh(eta), eta, phi, m). This forces the PFO to have the correct energy and mass // - Ignore clusters outside 0.2 cone and those with overall negative energy or negative energy in Hcal - // Get xAOD::CaloClusters from jet constituent - const xAOD::CaloCluster* cluster = dynamic_cast<const xAOD::CaloCluster*>( (*clusterItr)->rawConstituent() ); - if (!cluster) continue; - // Don't create PFOs for clusters with overall (Ecal+Hcal) negative energy (noise) if(cluster->e()<=0.) continue; diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h index 2c33180d00d324206403e79e68bd7306e2f624e5..3e42bd24b5cf666794b669324447bd50f8be6d8d 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h @@ -65,6 +65,8 @@ private: /** @brief pt threshold for pi0 candidate clusters */ Gaudi::Property<double> m_clusterEtCut {this, "ClusterEtCut", 0.5 * Gaudi::Units::GeV, "Et threshould for pi0 candidate clusters"}; + Gaudi::Property<bool> m_incShowerSubtr {this, "IncShowerSubtr", true, "use shower subtracted clusters in calo calculations"}; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_pi0ClusterInputContainer{this,"Key_Pi0ClusterContainer", "TauPi0SubtractedClusters", "input pi0 cluster"}; }; diff --git a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h index c8294413bdc9d9affd06c45792347d98583e07fe..32fc490e512f4fd88040c3de0cd910bd59182294 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h +++ b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h @@ -33,6 +33,7 @@ public: bool update(const xAOD::TauJet& pTau); //!< update the internal variables for the given tau void setVertexCorrection(bool flag) {m_doVertexCorrection=flag;} + void setIncSub(bool flag) {m_incShowerSubtr=flag;} // ID Variables unsigned int numConstituents() { return (unsigned int) m_numConstit; } @@ -61,14 +62,16 @@ private: double m_totEnergy; double m_effEnergy; - /** Calculate the geometrical center of the tau constituents */ + // Calculate the geometrical center of the tau constituents TLorentzVector calculateTauCentroid(int nConst, const std::vector<CaloVertexedClusterType>& constituents); - - /** - * Enable cell origin correction. - * Eta and phi of the cells are corrected wrt to the origin of the tau vertex - */ + + // Enable cell origin correction. + // Eta and phi of the cells are corrected wrt to the origin of the tau vertex bool m_doVertexCorrection; + + // use shower subtracted clusters with PFlow jet seeds + bool m_incShowerSubtr; + }; //------------------------------------------------------------------------- diff --git a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h index 8ae83f9fa25a4432b7f425df966704000e8fc742..74b37635195e2faa21b9b940db79310c24832548 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h +++ b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h @@ -27,13 +27,9 @@ public: CombinedP4FromRecoTaus(const std::string& name="CombinedP4FromRecoTaus"); //function where variables are computed and decorated - StatusCode initialize() override; + virtual StatusCode initialize() override; - StatusCode execute(xAOD::TauJet& xTau) override - { - return static_cast<const CombinedP4FromRecoTaus*>(this)->execute(xTau); - } - StatusCode execute(xAOD::TauJet& xTau) const; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; bool getUseCaloPtFlag(const xAOD::TauJet* tau) const; diff --git a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h index d394f7c7b9715ec537ac36548a2e53c60519fe05..66121ed93af97a5340128302d827f4aaf0dde2cd 100644 --- a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h +++ b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h @@ -22,7 +22,7 @@ namespace tauRecTools { ANA_MSG_HEADER(msgHelperFunction) - const StatusCode GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted); + const StatusCode GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool incShowerSubtracted, TLorentzVector dRVector = TLorentzVector(0.,0.,0.,0.), double dRCut = -1); xAOD::TauTrack::TrackFlagType isolateClassifiedBits(xAOD::TauTrack::TrackFlagType flag); bool sortTracks(const ElementLink<xAOD::TauTrackContainer> &l1, const ElementLink<xAOD::TauTrackContainer> &l2); diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h index 410e566330773aa300b72e9d4a5769e4850bfbb1..3ff40cd127951d44b9a1941a6f794b69b8455d0e 100644 --- a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h @@ -42,7 +42,7 @@ class ITauToolBase : virtual public asg::IAsgTool //----------------------------------------------------------------- //! Execute - called for each tau candidate //----------------------------------------------------------------- - virtual StatusCode execute(xAOD::TauJet& pTau) = 0; + virtual StatusCode execute(xAOD::TauJet& pTau) const = 0; virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau, const xAOD::VertexContainer* vertexContainer = nullptr, const xAOD::TrackParticleContainer* trackContainer = nullptr) = 0; diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h index 53b1f570d2a52b001e1b70741d66e9fe3a610872..9278fce1243eb80a241db5742d52beb12a4429c8 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESEvaluator.h @@ -21,13 +21,9 @@ class MvaTESEvaluator MvaTESEvaluator(const std::string& name="MvaTESEvaluator"); virtual ~MvaTESEvaluator(); - StatusCode initialize() override; - StatusCode execute(xAOD::TauJet& xTau) override - { - return static_cast<const MvaTESEvaluator*>(this)->execute(xTau); - } - StatusCode execute(xAOD::TauJet& xTau) const; - StatusCode finalize() override { return StatusCode::SUCCESS; } + virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; + virtual StatusCode finalize() override { return StatusCode::SUCCESS; } private: // MVA input variables (provide all variables in float) diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h index dbc8ac68a3148961ceb84f0b562091722b67c1bc..e9da780ce01fb0ffb78f162e9eeea52ebdbd341b 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h @@ -22,9 +22,9 @@ class MvaTESVariableDecorator MvaTESVariableDecorator(const std::string& name="MvaTESVariableDecorator"); virtual ~MvaTESVariableDecorator(); - StatusCode initialize() override; - StatusCode execute(xAOD::TauJet& xTau) override; - StatusCode finalize() override; + virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; + virtual StatusCode finalize() override; private: diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h index 27f761daed835ed60264521c35d7cfec05df94ef..70af47185a207b942b8ee0f35d934ac6305218b0 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h @@ -32,7 +32,7 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; private: diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h b/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h index ce0f24bfc4f170bdcbb413a3c2fdaa23a620bb6a..78080de6cb94ab3a6dd6bed3597814a6df2e3c37 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCommonCalcVars.h @@ -27,7 +27,7 @@ public: ~TauCommonCalcVars(); virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode finalize() override; private: diff --git a/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h b/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h index 0ee9de03dfbcc3dd9abd883b6bf6fa30473770e3..ed65691fe12b40e87d4148e2508e4bd59cdf2532 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauEleOLRDecorator.h @@ -30,11 +30,11 @@ class TauEleOLRDecorator: virtual public TauRecToolBase virtual ~TauEleOLRDecorator(); virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet&) override; + virtual StatusCode execute(xAOD::TauJet&) const override; virtual StatusCode finalize() override; private: - float getCutVal(float fEta, float fPt); + float getCutVal(float fEta, float fPt) const; std::string m_sEleOLRFilePath; SG::ReadHandleKey<xAOD::ElectronContainer> m_electronInputContainer{this,"Key_electronInputContainer", "Electrons", "input electron container key"}; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h index c4624608a57ae10dbfcb38e72aa942bf15d77583..d92c9183b6efbff5466c37f354eee287e63ffe4c 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h @@ -28,7 +28,7 @@ class TauIDVarCalculator: public TauRecToolBase virtual ~TauIDVarCalculator() {} virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet&) override; + virtual StatusCode execute(xAOD::TauJet&) const override; virtual StatusCode finalize() override; static const float LOW_NUMBER; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h index 2dfd4c945a15ee341547532e1ba4ef1889d8439b..60498a34e217b2fc3b0ae57bfebf086579239bc1 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetBDTEvaluator.h @@ -27,13 +27,9 @@ class TauJetBDTEvaluator TauJetBDTEvaluator(const std::string& name="TauJetBDTEvaluator"); virtual ~TauJetBDTEvaluator() { } - StatusCode initialize() override; - StatusCode execute(xAOD::TauJet& xTau) override - { - return static_cast<const TauJetBDTEvaluator*>(this)->execute(xTau); - } - StatusCode execute(xAOD::TauJet& xTau) const; - StatusCode finalize() override; + virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; + virtual StatusCode finalize() override; private: std::unique_ptr<tauRecTools::BDTHelper> m_mvaBDT; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h index 66125f8f0b523fc58a3db185ebc987adb368f9ff..a75615f5bd43c0ae64bbeaa096f8882b84843f58 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h @@ -32,8 +32,8 @@ public: TauJetRNNEvaluator(const std::string &name = "TauJetRNNEvaluator"); virtual ~TauJetRNNEvaluator(); - StatusCode initialize() override; - StatusCode execute(xAOD::TauJet &tau) override; + virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet &tau) const override; // Getter for the underlying RNN implementation TauJetRNN *get_rnn_0p(); TauJetRNN *get_rnn_1p(); @@ -42,11 +42,11 @@ public: private: // Selects tracks to be used as input to the network StatusCode get_tracks(const xAOD::TauJet &tau, - std::vector<const xAOD::TauTrack *> &out); + std::vector<const xAOD::TauTrack *> &out) const; // Selects clusters to be used as input to the network StatusCode get_clusters(const xAOD::TauJet &tau, - std::vector<const xAOD::CaloCluster *> &out); + std::vector<const xAOD::CaloCluster *> &out) const; private: std::string m_output_varname; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h index 0e7657c42d2985c318b8eb068a2f9811239ea4c0..58a8b232ed77addec60a1467e594656d779a7f6e 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h @@ -39,7 +39,7 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { //----------------------------------------------------------------- //! Execute - called for each tau candidate //----------------------------------------------------------------- - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau, const xAOD::VertexContainer* vertexContainer = nullptr, const xAOD::TrackParticleContainer* trackContainer = nullptr) override; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h b/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h index a6038c22f3e4fb428f5e84a0bb09e9cf0df59616..5e2a31aaacc0b9e1ffdae84a219080471ba1f1d8 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauSubstructureVariables.h @@ -26,22 +26,23 @@ class TauSubstructureVariables : public TauRecToolBase ~TauSubstructureVariables(); - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode initialize() override; virtual StatusCode finalize() override; private: - /** Maximal pile up correction in GeV for a tau candidate. - * Used for the caloIso corrected variable. - */ - double m_maxPileUpCorrection; + // Maximal pile up correction in GeV for a tau candidate. + // Used for the caloIso corrected variable. + double m_maxPileUpCorrection; double m_pileUpAlpha; //!< slope of the pileup correction - /** - * enable cell origin correction - * eta and phi of the cells are corrected wrt to the origin of the tau vertex - */ - bool m_doVertexCorrection; + // enable cell origin correction + // eta and phi of the cells are corrected wrt to the origin of the tau vertex + bool m_doVertexCorrection; + + // use shower subtracted clusters with PFlow jet seeds + bool m_incShowerSubtr; + }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h b/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h index 89124def597809035224ff641a8ead38414bb2df..5d37f45e3230d507997d8fad191161eb118abe10 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauTrackClassifier.h @@ -42,7 +42,7 @@ public: ~TauTrackClassifier(); virtual StatusCode initialize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode finalize() override; private: diff --git a/Reconstruction/tauRecTools/tauRecTools/TauTrackRNNClassifier.h b/Reconstruction/tauRecTools/tauRecTools/TauTrackRNNClassifier.h index 267b64ccb85c1d8b7f1a6272d3a7d1dcff12f07f..18bfa0c59cccf3d76f802dc407799298fa836234 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauTrackRNNClassifier.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauTrackRNNClassifier.h @@ -53,7 +53,7 @@ public: // retrieve all track classifier sub tools virtual StatusCode initialize() override; // pass all tracks in the tau cone to all track classifier sub tools - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; private: ToolHandleArray<TrackRNN> m_vClassifier {this, "Classifiers", {}}; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h index b8524ccfc0a29e372d0efa496efded0bebe43ee5..476458a2eb898e1c1f34c788f2fd340e84531817 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauWPDecorator.h @@ -34,11 +34,11 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode execute(xAOD::TauJet& pTau) override; + virtual StatusCode execute(xAOD::TauJet& pTau) const override; virtual StatusCode retrieveHistos(int nProng); virtual StatusCode storeLimits(int nProng); - virtual double transformScore(double score, double cut_lo, double eff_lo, double cut_hi, double eff_hi); + virtual double transformScore(double score, double cut_lo, double eff_lo, double cut_hi, double eff_hi) const; private: std::string m_file0P; diff --git a/Simulation/Digitization/test/DigitizationComparisonNew_test.py b/Simulation/Digitization/test/DigitizationComparisonNew_test.py index a6433510b93b715279143fc3e571af7aa87bc4fb..c3141dbe7338a8d69c6927be6507b3fec60842b4 100755 --- a/Simulation/Digitization/test/DigitizationComparisonNew_test.py +++ b/Simulation/Digitization/test/DigitizationComparisonNew_test.py @@ -49,6 +49,7 @@ ConfigFlags.Digitization.TruthOutput = True ConfigFlags.Digitization.RandomSeedOffset = 170 ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Concurrency.NumThreads = 1 +ConfigFlags.Concurrency.NumConcurrentEvents = 1 ConfigFlags.Tile.BestPhaseFromCOOL = False ConfigFlags.Tile.correctTime = False ConfigFlags.lock() diff --git a/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py b/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py index 5361aea9c0dd45419b87810a833ee3dde4535e38..850c6f54371ea8dd1941762bd974501136a8a915 100755 --- a/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py +++ b/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py @@ -264,7 +264,7 @@ class TestDigitizationMC16a(unittest.TestCase): def test___TRTDigitizationTool_properties(self): tested_configurable_name = 'StandardSignalOnlyTruthPileUpToolsAlg.TRTDigitizationTool' - expected_property_list = ['DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'HardScatterSplittingMode', 'InDetTRTCalDbTool', 'InDetTRTStrawStatusSummaryTool', 'LastXing', 'MagFieldSvc', 'MergeSvc', 'OutputObjectName', 'OutputSDOName', 'Override_TrtRangeCutProperty', 'PAI_Tool_Ar', 'PAI_Tool_Kr', 'PAI_Tool_Xe', 'RandomSeedOffset', 'RndmSvc', 'SimDriftTimeTool', 'TRT_StrawNeighbourSvc'] + expected_property_list = ['DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'HardScatterSplittingMode', 'InDetTRTCalDbTool', 'InDetTRTStrawStatusSummaryTool', 'LastXing', 'MergeSvc', 'OutputObjectName', 'OutputSDOName', 'Override_TrtRangeCutProperty', 'PAI_Tool_Ar', 'PAI_Tool_Kr', 'PAI_Tool_Xe', 'RandomSeedOffset', 'RndmSvc', 'SimDriftTimeTool', 'TRT_StrawNeighbourSvc'] expected_nonstring_properties = {'LastXing': '50', 'FirstXing': '-50'} expected_string_properties = {'OutputObjectName': 'TRT_RDOs', 'OutputSDOName': 'TRT_SDO_Map'} # No Input name property self._detailed_ConfigurablePropertiesCheck( @@ -302,7 +302,7 @@ class TestDigitizationMC16a(unittest.TestCase): def test___CscDigitizationTool_properties(self): tested_configurable_name = 'StandardSignalOnlyTruthPileUpToolsAlg.CscDigitizationTool' - expected_property_list = ['CSCSimDataCollectionOutputName', 'DetStore', 'DriftVelocity', 'ElectronEnergy', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'InputObjectName', 'LastXing', 'NewDigitEDM', 'OutputObjectName', 'PileUpMergeSvc', 'RndmSvc', 'WindowLowerOffset', 'WindowUpperOffset', 'amplification', 'cscCalibTool', 'idHelper', 'isPileUp', 'pedestal'] + expected_property_list = ['CSCSimDataCollectionOutputName', 'DetStore', 'DriftVelocity', 'ElectronEnergy', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'InputObjectName', 'LastXing', 'MuonIdHelperSvc', 'NewDigitEDM', 'OutputObjectName', 'PileUpMergeSvc', 'RndmSvc', 'WindowLowerOffset', 'WindowUpperOffset', 'amplification', 'cscCalibTool', 'isPileUp', 'pedestal'] expected_nonstring_properties = {'LastXing': '175', 'FirstXing': '-375'} expected_string_properties = {'InputObjectName': 'CSC_Hits', 'OutputObjectName': 'CSC_DIGITS'} self._detailed_ConfigurablePropertiesCheck( diff --git a/Simulation/FastShower/FastCaloSim/CMakeLists.txt b/Simulation/FastShower/FastCaloSim/CMakeLists.txt index 4a606b4fe66d4d994e7866fd76eb7136133ba76f..a1a7948c7310f1fb91d46e22cbf3b15a7a99b896 100644 --- a/Simulation/FastShower/FastCaloSim/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSim/CMakeLists.txt @@ -97,7 +97,7 @@ atlas_install_joboptions( share/*.py ) atlas_add_test( FastShowerCellBuilderTool_test SCRIPT test/FastShowerCellBuilderTool_test.sh PROPERTIES TIMEOUT 600 - LOG_IGNORE_PATTERN "Reading file|FastCaloSimFactory|FileName|default:|DATAPATH|Cache alignment|map from|Database being retired|Resolved path|^Domain|HepPDT Version|from file|AtlasTracking.* INFO|CaloTra.* INFO|TrackingGeometrySvc|INFO finalize|INFO Disconnecting from|INFO.*10-bit|Py:Athena +INFO|AtlasField|IOVDbFolder" ) + LOG_SELECT_PATTERN "ERROR|error|WARNING [^U]|FATAL|processing|TestAlg|xxx" ) atlas_add_test( AddNoiseCellBuilderToolConfigTest_test diff --git a/Simulation/FastShower/FastCaloSim/share/FastShowerCellBuilderTool_test.ref b/Simulation/FastShower/FastCaloSim/share/FastShowerCellBuilderTool_test.ref index 54f86525d832bfeb6d0890e701df36184554a0a5..3ba146767511a7f4a0b1fc82fe3def28604939de 100644 --- a/Simulation/FastShower/FastCaloSim/share/FastShowerCellBuilderTool_test.ref +++ b/Simulation/FastShower/FastCaloSim/share/FastShowerCellBuilderTool_test.ref @@ -348,7 +348,6 @@ PartPropSvc INFO No table format type specified for "PDGTABLE.MeV". Ass found 298 particles AthRNGSvc INFO Creating engine ToolSvc.tool1/FastCaloSimRnd ClassIDSvc INFO getRegistryEntries: read 933 CLIDRegistry entries for module ALL -ToolSvc.AtlasRu... INFO initialize() init key: fieldCondObj AtlasFieldSvc INFO initialize() ... AtlasFieldSvc INFO maps will be chosen reading COOL folder /GLOBAL/BField/Maps AtlasFieldSvc INFO magnet currents will be read from COOL folder /EXT/DCS/MAGNETS/SENSORDATA @@ -677,7 +676,6 @@ ToolSvc.CaloVol... INFO finalize() successful AtlasTrackingGe... INFO finalize() successful ToolSvc.NIMatEf... INFO finalize() successful ToolSvc.AtlasNa... INFO finalize() successful -ToolSvc.AtlasRu... INFO ToolSvc.AtlasRungeKuttaPropagator finalize() successful ToolSvc.TimedEx... INFO finalize() successful ToolSvc.Trackin... INFO finalize() successful ToolSvc.AtlasMu... INFO finalize() successful diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx index b6a8cc65f23aa47a4c98954c772a81c3590c8433..c4965904212d5a6e05efb570a4f65cac28c72278 100755 --- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx +++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx @@ -2091,7 +2091,6 @@ void MC_init_particle_simul_state(MCdo_simul_state& do_simul_state,const MCparti void MC_recursive_remove_out_particles(MCdo_simul_state& do_simul_state,HepMC::GenVertex* ver,FastShowerCellBuilderTool::flag_simul_sate simul_state) { if(ver) { - // if(do_simul_state[ver->barcode()]<=0) return; do_simul_state[ver->barcode()]=simul_state; for(HepMC::GenVertex::particles_out_const_iterator pout=ver->particles_out_const_begin();pout!=ver->particles_out_const_end();++pout) { const HepMC::GenParticle* par=*pout; @@ -2106,7 +2105,6 @@ void MC_recursive_remove_in_particles(MCdo_simul_state& do_simul_state,HepMC::Ge { if(ver) { if(do_simul_state[ver->barcode()]==simul_state) { - //log << MSG::DEBUG<<"ver: bc="<<ver->barcode()<<" : loop in MC_recursive_remove_in_particles, returning"<<endmsg; return; } do_simul_state[ver->barcode()]=simul_state; @@ -2119,72 +2117,6 @@ void MC_recursive_remove_in_particles(MCdo_simul_state& do_simul_state,HepMC::Ge } } -/* - void print_MC_info(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles,MsgStream& log) - { - log << MSG::VERBOSE <<"print_MC_info: begin"<< endmsg; - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; - - if(log.level()<=MSG::DEBUG) { - std::string reason="---"; - if(do_simul_state[par->barcode()]<=0) { - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::out_of_ID) reason="-ID"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::non_EM_vertex) reason="-EM"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::heavy_ion) reason="-HI"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::pdg_id_unkown) reason="-PI"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::invisibleArray) reason="-IA"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::invisibleTruthHelper) reason="-IT"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::mother_particle) reason="-MO"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::v14_truth_brems) reason="-BR"; - if(do_simul_state[par->barcode()]==FastShowerCellBuilderTool::v14_truth_conv) reason="-CO"; - } else { - reason="+OK"; - } - log << MSG::DEBUG<<reason; - - log <<": "<<"bc="<<par->barcode()<<" id="<<par->pdg_id()<<" stat="<<par->status()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi(); - HepMC::GenVertex* inver =par->production_vertex(); - HepMC::GenVertex* outver =par->end_vertex(); - if(inver) { - double inr=inver->position().perp(); - double inz=inver->position().z(); - log<<" ; r="<<inr<<" z="<<inz<<" phi="<<inver->position().phi()<<" ; "; - bool sep=false; - for(HepMC::GenVertex::particles_in_const_iterator pin=inver->particles_in_const_begin();pin!=inver->particles_in_const_end();++pin) { - const HepMC::GenParticle* invpar=*pin; - if(invpar) { - if(sep) log<<","; - log<<invpar->barcode(); - if(do_simul_state[invpar->barcode()]<=0) log<<"-"; - else log<<"+"; - sep=true; - } - } - } - log<<"->"<<par->barcode(); - if(outver) { - log<<"->"; - bool sep=false; - for(HepMC::GenVertex::particles_out_const_iterator pout=outver->particles_out_const_begin();pout!=outver->particles_out_const_end();++pout) { - const HepMC::GenParticle* outpar=*pout; - if(outpar) { - if(sep) log<<","; - log<<outpar->barcode(); - if(do_simul_state[outpar->barcode()]<=0) log<<"-"; - else log<<"+"; - sep=true; - } - } - } - log<<endmsg; - } - } - - log << MSG::VERBOSE <<"print_MC_info: end"<< endmsg; - } -*/ void FastShowerCellBuilderTool::MC_remove_out_of_ID(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const { @@ -2384,13 +2316,11 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, for(unsigned int i=0;i<m_invisibles.size();++i) { if(abs(par->pdg_id())==m_invisibles[i]) { do_simul_state[par->barcode()]=invisibleArray; - //log << MSG::DEBUG <<"INVISIBLE by ARRAY: id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<par->barcode()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi()<<endmsg; break; } if(m_invisibles[i]==0) { if(MC::isNonInteracting(par)) { do_simul_state[par->barcode()]=invisibleTruthHelper; - //log << MSG::DEBUG <<"INVISIBLE by TruthHelper: id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<par->barcode()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi()<<endmsg; break; } } diff --git a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt index 7108e6e2ac96442492537b76a83d01ce385b092e..44163416e8927a8a1de4ebb7686e235f0672d43b 100644 --- a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt @@ -44,8 +44,4 @@ atlas_add_component( FastCaloSimHit # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Simulation/G4Atlas/G4AtlasTools/src/G4FieldManagerToolBase.cxx b/Simulation/G4Atlas/G4AtlasTools/src/G4FieldManagerToolBase.cxx index 081f5edfd56360269776c7b61b69bd949b394fe1..55a8fdd60993a70660d952f29a13de1937577d34 100644 --- a/Simulation/G4Atlas/G4AtlasTools/src/G4FieldManagerToolBase.cxx +++ b/Simulation/G4Atlas/G4AtlasTools/src/G4FieldManagerToolBase.cxx @@ -7,8 +7,12 @@ // CLHEP includes #include "CLHEP/Units/SystemOfUnits.h" -using CLHEP::perThousand; -using CLHEP::perMillion; + +// Some geant headers erroneously expect these to be in the global namespace. +// Don't use using, so as not to trigger warnings from the namespace +// static checker. +static constexpr double perThousand = CLHEP::perThousand; +static constexpr double perMillion = CLHEP::perMillion; // Geant4 steppers #include "G4AtlasRK4.hh" diff --git a/Simulation/G4Extensions/RHadrons/CMakeLists.txt b/Simulation/G4Extensions/RHadrons/CMakeLists.txt index d7747133edf8b3d0207d5342e90b104c648c0951..1b73c7d2fc0b943f237c37ffb010ca64462d6fa9 100644 --- a/Simulation/G4Extensions/RHadrons/CMakeLists.txt +++ b/Simulation/G4Extensions/RHadrons/CMakeLists.txt @@ -32,8 +32,4 @@ endif() # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.cxx b/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.cxx index c41686afbad5c9daec62496c9b6d98f2586df4ba..ad54159744536d19aff0923086336ab5b46f6264 100644 --- a/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.cxx +++ b/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.cxx @@ -7,7 +7,6 @@ #include "LArWheelSliceSolid.h" #include "LArWheelSolidDDProxy.h" -#include "GeoSpecialShapes/LArCustomShape.h" #include "GeoModelKernel/GeoShape.h" #include "GeoModelKernel/GeoBox.h" @@ -27,6 +26,7 @@ #include "GeoModelKernel/GeoShapeShift.h" #include "GeoModelKernel/GeoShapeUnion.h" #include "GeoModelKernel/GeoShapeIntersection.h" +#include "GeoModelKernel/GeoUnidentifiedShape.h" #include "GeoModelKernel/GeoShapeSubtraction.h" #include "AthenaBaseComps/AthMsgStreamMacros.h" @@ -520,29 +520,33 @@ G4VSolid *Geo2G4SolidFactory::Build(const GeoShape* geoShape, std::string name) // // Custom Shapes (presently LAr shapes only) // - else if(geoShape->typeID() == LArCustomShape::getClassTypeID()) + else if(geoShape->typeID() == GeoUnidentifiedShape::getClassTypeID()) { - const LArCustomShape* customShape = dynamic_cast<const LArCustomShape*> (geoShape); + const GeoUnidentifiedShape* customShape = dynamic_cast<const GeoUnidentifiedShape*> (geoShape); if (nullptr==customShape) throw std::runtime_error("TypeID did not match cast for custom shape"); - std::string customName = customShape->name(); - customSolidMap::const_iterator it = customSolids.find(customName); - if(it!=customSolids.end()) - theSolid = it->second; - else - { - theSolid = nullptr; - if(customName.find("Slice") != std::string::npos){ - theSolid = createLArWheelSliceSolid(customShape); - } else { - theSolid = createLArWheelSolid(customName, s_lwsTypes.at(customName) ); // map.at throws std::out_of_range exception on unknown shape name - } - if ( nullptr == theSolid ) { - std::string error = std::string("Can't create LArWheelSolid for name ") + customName + " in Geo2G4SolidFactory::Build"; - throw std::runtime_error(error); - } - - if(theSolid != nullptr) customSolids[customName] = theSolid; - } + if (customShape->name()=="LArCustomShape") { + + std::string customName = customShape->asciiData(); + + customSolidMap::const_iterator it = customSolids.find(customName); + if(it!=customSolids.end()) + theSolid = it->second; + else + { + theSolid = nullptr; + if(customName.find("Slice") != std::string::npos){ + theSolid = createLArWheelSliceSolid(customShape); + } else { + theSolid = createLArWheelSolid(customName, s_lwsTypes.at(customName) ); // map.at throws std::out_of_range exception on unknown shape name + } + if ( nullptr == theSolid ) { + std::string error = std::string("Can't create LArWheelSolid for name ") + customName + " in Geo2G4SolidFactory::Build"; + throw std::runtime_error(error); + } + + if(theSolid != nullptr) customSolids[customName] = theSolid; + } + } } // // Catch All @@ -574,9 +578,9 @@ G4VSolid* Geo2G4SolidFactory::createLArWheelSolid(const std::string& name, const return theLWS; } -G4VSolid* Geo2G4SolidFactory::createLArWheelSliceSolid(const LArCustomShape* customShape) const +G4VSolid* Geo2G4SolidFactory::createLArWheelSliceSolid(const GeoUnidentifiedShape* customShape) const { - LArWheelSliceSolid *theLWS = new LArWheelSliceSolid(customShape->name(), customShape->calculator()); + LArWheelSliceSolid *theLWS = new LArWheelSliceSolid(customShape->asciiData()); LArWheelSolidDDProxy *theLWS_p = new LArWheelSolidDDProxy(theLWS); // ownership is passed to detStore diff --git a/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.h b/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.h index 2ad5b024c61796ecffcea0543e45facb361d6882..b592e43c03254c3cfd0c113177a53b98d4c5bb47 100644 --- a/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.h +++ b/Simulation/G4Utilities/Geo2G4/src/Geo2G4SolidFactory.h @@ -17,8 +17,7 @@ class G4VSolid; class GeoShape; -class LArCustomShape; - +class GeoUnidentifiedShape; class Geo2G4SolidFactory { public: @@ -39,7 +38,7 @@ public: StoreGateSvc_t& detStore() const; private: G4VSolid* createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const; - G4VSolid* createLArWheelSliceSolid(const LArCustomShape* ) const; + G4VSolid* createLArWheelSliceSolid(const GeoUnidentifiedShape* ) const; static const LArWheelSolid_typemap s_lwsTypes; diff --git a/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolid.h b/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolid.h index 4fd5af43219c6955c2302e05380fee574f450276..74974ddcd0bb23e6fa3a288c37c89a9f7335fb6c 100644 --- a/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolid.h +++ b/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolid.h @@ -49,7 +49,7 @@ class LArWheelSliceSolid : public G4VSolid G4int zside = 1, const LArWheelCalculator *calc = 0 ); - LArWheelSliceSolid(const G4String& name, const LArWheelCalculator *calc); + LArWheelSliceSolid(const G4String& name); virtual ~LArWheelSliceSolid(){} // Mandatory for custom solid Geant4 functions diff --git a/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolidInit.cxx b/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolidInit.cxx index c5f56934a4bb219c14fc332d48a32a8398a479af..7743e599a3a9172e562d63cfbf934ab70cc8d302 100644 --- a/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolidInit.cxx +++ b/Simulation/G4Utilities/Geo2G4/src/LArWheelSliceSolidInit.cxx @@ -37,8 +37,8 @@ LArWheelSliceSolid::LArWheelSliceSolid( createSolid(name, zside, slice); } -LArWheelSliceSolid::LArWheelSliceSolid(const G4String& name, const LArWheelCalculator *calc) - : G4VSolid(name), m_Calculator(calc), m_msg("LArWSS") +LArWheelSliceSolid::LArWheelSliceSolid(const G4String& name) + : G4VSolid(name), m_Calculator(0), m_msg("LArWSS") { if(name.find("::Inner") != G4String::npos) m_Pos = Inner; else if(name.find("::Outer") != G4String::npos) m_Pos = Outer; diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py index 1240c2853966f8c2a8c34ca332f827c1b7885105..c759bbb958f8e222eff5798130760525151c232a 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py +++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py @@ -498,9 +498,9 @@ def getKernel_ATLFASTIIF(name="ISF_Kernel_ATLFASTIIF", **kwargs): def getKernel_ATLFASTIIF_G4MS(name="ISF_Kernel_ATLFASTIIF_G4MS", **kwargs): kwargs.setdefault("BeamPipeSimulationSelectors" , [ 'ISF_DefaultParticleKillerSelector' ] ) kwargs.setdefault("IDSimulationSelectors" , [ 'ISF_DefaultFatrasSelector' ] ) - kwargs.setdefault("CaloSimulationSelectors" , [ 'ISF_MuonAFIIGeant4Selector', + kwargs.setdefault("CaloSimulationSelectors", [ 'ISF_MuonFatrasSelector', 'ISF_EtaGreater5ParticleKillerSimSelector', - 'ISF_DefaultLegacyAFIIFastCaloSimSelector' ]) + 'ISF_DefaultFastCaloSimSelector']) kwargs.setdefault("MSSimulationSelectors" , [ 'ISF_DefaultAFIIGeant4Selector' ] ) kwargs.setdefault("CavernSimulationSelectors" , [ 'ISF_DefaultParticleKillerSelector' ] ) # set the simFlags accordingly (TODO: is this even needed?) diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx index dedd061406f439f7f28f8d7f33c806586e64971e..a012c1c5c77aaeaf1a9f4a3156ec16f0fc74be00 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx @@ -46,6 +46,7 @@ // CLHEP includes #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Geometry/Vector3D.h" +#include "CLHEP/Units/SystemOfUnits.h" // HepPDT #include "HepPDT/ParticleID.hh" #include "HepPDT/DecayData.hh" @@ -244,6 +245,18 @@ ISF::InputConverter::convertParticle(HepMC::GenParticle* genPartPtr, EBC_EVCOLL const auto& pMomentum(genPart.momentum()); const Amg::Vector3D mom(pMomentum.px(), pMomentum.py(), pMomentum.pz()); const double pMass = this->getParticleMass(genPart); + + double e=pMomentum.e(); + if(e>1) { //only test for >1 MeV in momentum + double px=pMomentum.px(); + double py=pMomentum.py(); + double pz=pMomentum.pz(); + double teste=sqrt(px*px + py*py + pz*pz + pMass*pMass); + if(std::abs(e-teste)/e>0.01) { + ATH_MSG_WARNING("Difference in energy for: " << genPart<<" Morg="<<pMomentum.m()<<" Mmod="<<pMass<<" Eorg="<<e<<" Emod="<<teste); + } + } + const int pPdgId = genPart.pdg_id(); const double charge = HepPDT::ParticleID(pPdgId).charge(); const double pTime = pVertex->position().t() / Gaudi::Units::c_light; @@ -556,13 +569,54 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const ISF::ISFParti } g4particle->SetDaughter( daughterG4Particle ); } - } // particle had an end vertex - //Code copied from TruthHepMCEventConverter::TransformHepMCParticle + } // particle had an end vertex + + double px,py,pz; + const double pmass = g4particle->GetMass(); CLHEP::Hep3Vector gpv = g4particle->GetMomentum(); - double pmass = g4particle->GetMass(); - const double pe = sqrt(gpv.mag2() + pmass*pmass); // this does only change for boosts, etc. - genpart->set_momentum(CLHEP::HepLorentzVector(gpv.x(),gpv.y(),gpv.z(),pe)); - //End of code copied from TruthHepMCEventConverter::TransformHepMCParticle + double g4px=g4particle->GetMomentum().x(); + double g4py=g4particle->GetMomentum().y(); + double g4pz=g4particle->GetMomentum().z(); + if(useHepMC) { + //Code adapted from TruthHepMCEventConverter::TransformHepMCParticle + px=g4px; + py=g4py; + pz=g4pz; + } else { + //Take mass from g4particle, put keep momentum as in genpart + px=genpart->momentum().px(); + py=genpart->momentum().py(); + pz=genpart->momentum().pz(); + //Now a dirty hack to keep backward compatibility in the truth: + //When running AtlasG4 or FullG4 between 21.0.41 and 21.0.111, the genpart 3-momentum and mass was reset to the values from the g4particle + //together with the mass of the g4particle after the 1st initialization of the g4particle from the genevent. This is done for a consistent mass + //value in the truth record compared to the used g4 mass. Since g4particles don't store the 3-momentum directly, but rather a + //unit direction vector, the mass and the kinetic energy, this reduces the numeric accuracy. + //For backward compatibility, if all 3-momentum components agree to the g4particle momentum within 1 keV, we keep + //this old method. This comparison is needed, since in ISF this code could be rerun after the ID or CALO simulation, where + //real energy was lost in previous detectors and hence genpart should NOT be changed to some g4particle values! + //TODO: find a way to implement this in a backward compatible way in ISF::InputConverter::convertParticle(HepMC::GenParticle* genPartPtr, int bcid) + if(std::abs(px-g4px)<CLHEP::keV && std::abs(py-g4py)<CLHEP::keV && std::abs(pz-g4pz)<CLHEP::keV) { + px=g4px; + py=g4py; + pz=g4pz; + } + } + const double mag2=px*px + py*py + pz*pz; + const double pe = std::sqrt(mag2 + pmass*pmass); // this does only change for boosts, etc. + + double originalEnergy=genpart->momentum().e(); + if(originalEnergy>0.01) { //only test for >1 MeV in momentum + if((originalEnergy-pe)/originalEnergy>0.01) { + double genpx=genpart->momentum().px(); + double genpy=genpart->momentum().py(); + double genpz=genpart->momentum().pz(); + double genp=sqrt(genpx*genpx + genpy*genpy + genpz*genpz); + ATH_MSG_WARNING("Truth change in energy for: " << genpart<<" Morg="<<genpart->momentum().m()<<" Mmod="<<pmass<<" Eorg="<<originalEnergy<<" Emod="<<pe<<" porg="<<genp<<" pmod="<<gpv.mag()); + } + } + + genpart->set_momentum(CLHEP::HepLorentzVector(px,py,pz,pe)); } // Truth was detected ATH_MSG_VERBOSE("PrimaryParticleInformation:"); diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt index 2f91b7358c52efab6cde78292de43295569fbd96..5edaa73a11bfaf2b178e81181cfdc120cb6444e5 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt @@ -94,7 +94,7 @@ atlas_add_root_dictionary( ISF_FastCaloSimEvent _dictSource atlas_add_library( ISF_FastCaloSimEvent ISF_FastCaloSimEvent/*.h ${_dictSource} src/*.cxx PUBLIC_HEADERS ISF_FastCaloSimEvent - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${LWTNN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} CaloGeoHelpers TileSimEvent diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx index e9b0da415f84c220122fd9de681caa73929fde0f..84d2c5af687203657dce7dcf49cddb6ffd1ebedb 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx @@ -21,7 +21,7 @@ TFCSEnergyRenormalization::~TFCSEnergyRenormalization() FCSReturnCode TFCSEnergyRenormalization::simulate(TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const { - std::vector< float > energies(CaloCell_ID_FCS::MaxSample,0); + std::vector< double > energies(CaloCell_ID_FCS::MaxSample,0); //Loop over all cells and sum up energies for(const auto& iter : simulstate.cells()) { diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py index 7da03c6ebf00c084a41a5d9c89190c04b1223fc6..17398d1204ebac51913aa0ed138d898d969ebb33 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import argparse import logging @@ -26,3 +26,6 @@ def addFCS_NtupArgs(parser): parser.add_argument('--saveAllBranches', type=argFactory(argBool), help='Flag to turn on extra branches for Hits and G4hits', group='FCS_Ntup_tf') + parser.add_argument('--NTruthParticles', + type=argFactory(argInt), + help='Option to select number of truth particles copied to ntuples', group='FCS_Ntup_tf') diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py index 15f51e0ca815ef0887674b22a8ab900d23bff7a5..09c68c74ec2f61a9978c53f96d73597f7f4dbb87 100755 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Run HITS file and produce histograms. @@ -40,7 +40,7 @@ def getTransform(): executorSet.add(athenaExecutor(name = 'FCS_Ntup', skeletonFile = 'ISF_FastCaloSimParametrization/skeleton.ESDtoNTUP_FCS.py', inData = ['ESD'], outData = ['NTUP_FCS'],)) - trf = transform(executor = executorSet, description = 'FastCaloSim V2 Parametrization ntuple transform. Inputs must be ESD. Outputs must bentuple files.') + trf = transform(executor = executorSet, description = 'FastCaloSim V2 Parametrization ntuple transform. Inputs must be ESD. Outputs must be ntuple files.') addAthenaArguments(trf.parser) addFCS_NtupArgs(trf.parser) return trf diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py index 4e0ee523c06a416b9a6219ae4b39251abaf07d6e..7c21248a6021e829d869ed1878e5fe00a7935a9d 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py @@ -41,7 +41,7 @@ ISF_HitAnalysis.GeoFileName = 'ISF_Geometry' ISF_HitAnalysis.CaloBoundaryR = 1148.0 ISF_HitAnalysis.CaloBoundaryZ = 3550.0 #before: 3475.0 ISF_HitAnalysis.CaloMargin=100 #=10cm -ISF_HitAnalysis.NTruthParticles = 1 # Copy only one truth particle to the ntuples for now +ISF_HitAnalysis.NTruthParticles = NTruthParticles ISF_HitAnalysis.SaveAllBranches = saveAllBranches ISF_HitAnalysis.DoAllCells = False ISF_HitAnalysis.DoLayers = True diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py index 0edf23c1d8c572a90a68cca6c521d9fee367e1cd..ba648ab2c18aa8111b0d8caa2ef4367a3c21f497 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py @@ -59,6 +59,12 @@ if hasattr(runArgs, "saveAllBranches"): else: saveAllBranches = False +## Sets the number of truth particles copied to ntuples +if hasattr(runArgs, "NTruthParticles"): + NTruthParticles = runArgs.NTruthParticles; +else: + NTruthParticles = 1 + #============================================================== # Job Configuration parameters: #============================================================== diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt index 97b1ed3eeda7df1ad3e932057b62858f3e1ec6af..0181ab4307f7a8273f31283f53dc6429fc40f95c 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt @@ -41,9 +41,4 @@ atlas_add_component( ISF_FatrasDetDescrTools # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) - +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h index 6ab84d9e027c19ab1eb35c6934c4d70476cc89d8..b54338d59bca49f82aba31a467a1a2df4aac044d 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h @@ -68,44 +68,51 @@ namespace iFatras { virtual ~PlanarClusterOnTrack(); /** Pseudo-constructor : needed to avoid excessive RTTI*/ - virtual PlanarClusterOnTrack* clone() const; + virtual PlanarClusterOnTrack* clone() const override ; /** returns the surface for the local to global transformation - fullfills Trk::MeasurementBase interface*/ - const Trk::Surface& associatedSurface() const; + virtual const Trk::Surface& associatedSurface() const override; /** returns the PrepRawData - fullfills Trk::RIO_OnTrack interface*/ - const PlanarCluster* prepRawData() const; + virtual const PlanarCluster* prepRawData() const override; /** returns the detector element, assoicated with the PRD of this class - fullfills Trk::RIO_OnTrack interface*/ - const iFatras::PlanarDetElement* detectorElement() const; + virtual const iFatras::PlanarDetElement* detectorElement() const override; /** returns global position (gathered through Surface constraint) - fullfills Trk::MeasurementBase interface */ - const Amg::Vector3D& globalPosition() const; + virtual const Amg::Vector3D& globalPosition() const override; /** returns global position (gathered through Surface constraint) - fullfills Trk::MeasurementBase interface */ const Amg::Vector3D* globalPositionPtr() const; + /** checks RIO Type + - fullfills Trk::RIO_OnTrack interface */ + virtual bool rioType(Trk::RIO_OnTrackType::Type type) const override + { + return (type == Trk::RIO_OnTrackType::MdtDriftCircle); + } + /** returns the DE hashID* - fullfills Trk::RIO_OnTrack interface */ - IdentifierHash idDE() const; + virtual IdentifierHash idDE() const override; /** returns some information about this RIO_OnTrack. - fullfills Trk::RIO_OnTrack interface */ - virtual MsgStream& dump( MsgStream& out ) const; + virtual MsgStream& dump( MsgStream& out ) const override; /** returns some information about this RIO_OnTrack. - fullfills Trk::RIO_OnTrack interface */ - virtual std::ostream& dump( std::ostream& out ) const; + virtual std::ostream& dump( std::ostream& out ) const override; protected: /** ONLY for use in custom convertor Allows the custom convertor to reset values when persistying/reading back RoTs*/ - virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd); + virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd) override; /** PlanarCluster - the RIO (PRD, PrepRawData)*/ ElementLinkToIDCPlanarClusterContainer m_rio; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.cxx index 8d376597a66ddc37aaaa3980f59432ee3c9f11a1..20de95fe21b7b8bcd965436e87e1ab6f8e1c03d9 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.cxx @@ -1,22 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ISF_PRDtoTrackMapTool.h" -//#include "TrkDetElementBase/TrkDetElementBase.h" + #include "TrkTrack/Track.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" -//#include "Identifier/Identifier.h" -//#include "AtlasDetDescr/AtlasDetectorID.h" - - #include <cassert> #include <vector> -//#include <functional> #include "ext/functional" -//#include "boost/mpl/select1st.hpp" iFatras::ISF_PRDtoTrackMapTool::ISF_PRDtoTrackMapTool(const std::string& t, const std::string& n, @@ -25,20 +19,6 @@ iFatras::ISF_PRDtoTrackMapTool::ISF_PRDtoTrackMapTool(const std::string& t, { } -iFatras::ISF_PRDtoTrackMapTool::~ISF_PRDtoTrackMapTool() -{ -} - -StatusCode iFatras::ISF_PRDtoTrackMapTool::initialize() -{ - return StatusCode::SUCCESS; -} - -StatusCode iFatras::ISF_PRDtoTrackMapTool::finalize() -{ - return StatusCode::SUCCESS; -} - std::unique_ptr<Trk::PRDtoTrackMap> iFatras::ISF_PRDtoTrackMapTool::createPRDtoTrackMap() const { return std::unique_ptr<Trk::PRDtoTrackMap>(new ISF_PRDtoTrackMap); } diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.h index 7fe54b629f653ae637e1e613ad140aab92e0c423..27e3e93145c8dc61f150e7b3cec46c87cd8ed58b 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.h +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/ISF_PRDtoTrackMapTool.h @@ -1,25 +1,19 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRK_ISF_PRDtoTrackMapTool_H #define TRK_ISF_PRDtoTrackMapTool_H -#include "AthenaBaseComps/AthAlgTool.h" #include "TrkToolInterfaces/IPRDtoTrackMapTool.h" +#include "AthenaBaseComps/AthAlgTool.h" #include "TrkEventUtils/PRDtoTrackMap.h" + #include <set> #include <map> - -class AtlasDetectorID; -class Identifier; - -namespace Muon{ - class MuonIdHelperTool; -} +#include <string> namespace Trk { - class Track; class PrepRawData; } @@ -32,9 +26,7 @@ namespace iFatras { public: ISF_PRDtoTrackMapTool(const std::string&,const std::string&,const IInterface*); - virtual ~ISF_PRDtoTrackMapTool() override; - virtual StatusCode initialize() override; - virtual StatusCode finalize () override; + virtual ~ISF_PRDtoTrackMapTool() override=default; virtual std::unique_ptr<Trk::PRDtoTrackMap> createPRDtoTrackMap() const override; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx index b7ef92c01c310d0b959005377984fcb898b8e66c..7a1ed1069d273defd148eb20cbefb27c22e9b807 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx @@ -2,7 +2,6 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// class header #include "SimHitCreatorMS.h" // ISF includes @@ -101,8 +100,8 @@ StatusCode iFatras::SimHitCreatorMS::initialize() ATH_CHECK(detStore()->retrieve(m_muonMgr)); - m_mmOffToSimId = new MM_SimIdToOfflineId(*(m_muonMgr->mmIdHelper())); - m_stgcOffToSimId = new sTgcSimIdToOfflineId(*(m_muonMgr->stgcIdHelper())); + m_mmOffToSimId = new MM_SimIdToOfflineId(&m_idHelperSvc->mmIdHelper()); + m_stgcOffToSimId = new sTgcSimIdToOfflineId(&m_idHelperSvc->stgcIdHelper()); // get measurement tool ATH_CHECK(m_measTool.retrieve()); @@ -228,8 +227,6 @@ void iFatras::SimHitCreatorMS::handle( const Incident& inc ) { //================ Track Creation Interface ===================================== void iFatras::SimHitCreatorMS::createHits(const ISF::ISFParticle& isp, const std::vector<Trk::HitInfo>& hits) const { - - //std::cout <<"creating MS hits"<< hits.size()<< std::endl; // iterate and assign as well the layer std::vector<Trk::HitInfo>::const_iterator plIter = hits.begin(); @@ -239,20 +236,16 @@ void iFatras::SimHitCreatorMS::createHits(const ISF::ISFParticle& isp, const Trk::TrackParameters* parm = (*plIter).trackParms; double timeInfo = (*plIter).time; const Trk::Layer* currLay = m_extrapolator->trackingGeometry()->associatedLayer( parm->position() ); - //std::cout <<"hit position:"<<parm->position()<<","<<currLay <<":"<<parm->position().mag()<< std::endl; - //std::cout <<"hit timing:"<< timeInfo << std::endl; if (!currLay) continue; Identifier id(currLay->layerType()); // NSW hits - if ( m_idHelperSvc->mdtIdHelper().is_mm(id) || m_idHelperSvc->mdtIdHelper().is_stgc(id) ) { + if ( m_idHelperSvc->isMM(id) || m_idHelperSvc->issTgc(id) ) { // hit ID int simID = offIdToSimId(id); // local position : at MTG layer ( corresponds to the middle of the gas gap ) - //Trk::GlobalPosition locPosRot = HepGeom::RotateY3D(M_PI)*HepGeom::RotateZ3D(+M_PI/2.)*currLay->surfaceRepresentation().transform().inverse()*parm->position(); - //std::cout << "local rotated:" << locPosRot << std::endl; // generating particle info double mom = parm->momentum().mag(); double mass = isp.mass(); @@ -269,12 +262,12 @@ void iFatras::SimHitCreatorMS::createHits(const ISF::ISFParticle& isp, isp.pdgCode(), unitMom, energyDeposit, isp.barcode()) ; - if ( m_muonMgr->mmIdHelper()->is_mm(id) ) m_mmSimHitCollection->Insert(nswMMHit); + if ( m_idHelperSvc->isMM(id) ) m_mmSimHitCollection->Insert(nswMMHit); else m_stgcSimHitCollection->Insert(nswsTGCHit); ATH_MSG_VERBOSE("[ muhit ] NSW hit created."); - } else if (m_idHelperSvc->mdtIdHelper().is_mdt(id)) { // (A) special treatment for MDTs to find closest channel and nearby hits + } else if (m_idHelperSvc->isMdt(id)) { // (A) special treatment for MDTs to find closest channel and nearby hits double pitch = 0.; // get the identifier Identifier hid = m_measTool->nearestDetEl(currLay,parm,false,pitch); @@ -338,7 +331,7 @@ bool iFatras::SimHitCreatorMS::createHit(const ISF::ISFParticle& isp, const Trk::Layer* lay,const Trk::TrackParameters* parm, Identifier id, double globalTimeEstimate, double /* pitch */, bool /* smear */) const { // MDT SECTION - if (m_idHelperSvc->mdtIdHelper().is_mdt(id)) { + if (m_idHelperSvc->isMdt(id)) { int simId = m_mdtHitIdHelper->BuildMdtHitId(m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(id)), m_idHelperSvc->mdtIdHelper().stationPhi(id), m_idHelperSvc->mdtIdHelper().stationEta(id), @@ -379,7 +372,7 @@ bool iFatras::SimHitCreatorMS::createHit(const ISF::ISFParticle& isp, } else { return false; } - } else if (m_idHelperSvc->rpcIdHelper().is_rpc(id)) { + } else if (m_idHelperSvc->isRpc(id)) { // local position from the rpc's const Amg::Vector3D localPos = m_muonMgr->getRpcReadoutElement(id)->globalToLocalCoords(parm->position(),id); int simId = m_rpcHitIdHelper->BuildRpcHitId(m_idHelperSvc->rpcIdHelper().stationNameString(m_idHelperSvc->rpcIdHelper().stationName(id)), @@ -397,7 +390,7 @@ bool iFatras::SimHitCreatorMS::createHit(const ISF::ISFParticle& isp, RPCSimHit rpcHit = RPCSimHit(simId,globalTimeEstimate, localPos, isp.barcode(), localPos, energyDeposit,1.,isp.pdgCode(),isp.momentum().mag() ) ; m_rpcSimHitCollection->Insert(rpcHit); - } else if (m_idHelperSvc->tgcIdHelper().is_tgc(id) && !m_idHelperSvc->tgcIdHelper().isStrip(id) ) { + } else if (m_idHelperSvc->isTgc(id) && !m_idHelperSvc->tgcIdHelper().isStrip(id) ) { // take eta hits only // local position @@ -419,7 +412,7 @@ bool iFatras::SimHitCreatorMS::createHit(const ISF::ISFParticle& isp, // a new simhit TGCSimHit tgcHit = TGCSimHit(simId,globalTimeEstimate, localPos, localDir, isp.barcode(), energyDeposit, stepLength ) ; m_tgcSimHitCollection->Insert(tgcHit); - } else if (m_idHelperSvc->cscIdHelper().is_csc(id)) { + } else if (m_idHelperSvc->isCsc(id)) { // one of eta/phi hits only Amg::Vector3D dir(parm->momentum().normalized()); @@ -463,7 +456,7 @@ bool iFatras::SimHitCreatorMS::createHit(const ISF::ISFParticle& isp, int iFatras::SimHitCreatorMS::offIdToSimId(Identifier id) const{ - if ( m_muonMgr->mmIdHelper()->is_mm(id) ) { + if (m_idHelperSvc->isMM(id)) { int simID = m_mmOffToSimId->convert(id); @@ -473,15 +466,13 @@ int iFatras::SimHitCreatorMS::offIdToSimId(Identifier id) const{ if ( check_id != id ) { ATH_MSG_WARNING("MM Id conversion error!"); - ATH_MSG_WARNING(m_muonMgr->mmIdHelper()->print_to_string(id)); - ATH_MSG_WARNING(m_muonMgr->mmIdHelper()->print_to_string(check_id)); + ATH_MSG_WARNING(m_idHelperSvc->mmIdHelper().print_to_string(id)); + ATH_MSG_WARNING(m_idHelperSvc->mmIdHelper().print_to_string(check_id)); } return simID; - } - - if ( m_muonMgr->stgcIdHelper()->is_stgc(id) ) { + } else if (m_idHelperSvc->issTgc(id)) { int simID = m_stgcOffToSimId->convert(id); @@ -491,8 +482,8 @@ int iFatras::SimHitCreatorMS::offIdToSimId(Identifier id) const{ if ( check_id != id ) { ATH_MSG_WARNING("sTGC Id conversion error!"); - ATH_MSG_WARNING(m_muonMgr->stgcIdHelper()->print_to_string(id)); - ATH_MSG_WARNING(m_muonMgr->stgcIdHelper()->print_to_string(check_id)); + ATH_MSG_WARNING(m_idHelperSvc->stgcIdHelper().print_to_string(id)); + ATH_MSG_WARNING(m_idHelperSvc->stgcIdHelper().print_to_string(check_id)); } diff --git a/Simulation/Overlay/OverlayConfiguration/CMakeLists.txt b/Simulation/Overlay/OverlayConfiguration/CMakeLists.txt index d85ee387349286f5391d834a0acc812739db55cd..a77429406ecfecb566604068aa4f1512a419c8d6 100644 --- a/Simulation/Overlay/OverlayConfiguration/CMakeLists.txt +++ b/Simulation/Overlay/OverlayConfiguration/CMakeLists.txt @@ -15,10 +15,10 @@ atlas_install_runtime( test/OverlayTest.py ) # Setup and run tests atlas_add_test( OverlayTest_MC SCRIPT test/OverlayTest.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( OverlayTest_data SCRIPT test/OverlayTest.py -d - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 POST_EXEC_SCRIPT nopost.sh ) diff --git a/Simulation/Tests/DigitizationTests/src/SCT_RDOsTestTool.cxx b/Simulation/Tests/DigitizationTests/src/SCT_RDOsTestTool.cxx index 0cd4caf753564ea468ab1459020f55b043c44f90..f30b9d3d8a7287bc938419be5f09804c4ed96350 100644 --- a/Simulation/Tests/DigitizationTests/src/SCT_RDOsTestTool.cxx +++ b/Simulation/Tests/DigitizationTests/src/SCT_RDOsTestTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RDOsTestTool.h" @@ -18,7 +18,7 @@ SCT_RDOsTestTool::SCT_RDOsTestTool(const std::string& type, const std::string& name, const IInterface* parent) : DigiTestToolBase(type, name, parent), - m_sctID(NULL), + m_sctID(nullptr), m_numberOfEventsSelected(0), m_collection("SCT_RDOs"), m_nRDO_Colls(0), @@ -42,10 +42,10 @@ SCT_RDOsTestTool::SCT_RDOsTestTool(const std::string& type, { for(unsigned int i(0); i<9; ++i) { - m_h_sct_endcapA_occ_layer[i]=NULL; - m_h_sct_endcapC_occ_layer[i]=NULL; + m_h_sct_endcapA_occ_layer[i]=nullptr; + m_h_sct_endcapC_occ_layer[i]=nullptr; } - for(unsigned int i(0); i<4; ++i) { m_h_sct_barrel_occ_layer[i]=NULL; } + for(unsigned int i(0); i<4; ++i) { m_h_sct_barrel_occ_layer[i]=nullptr; } for(unsigned int i(0); i<5; ++i) { m_NumberModulesVetoed[i]=0.0; } } @@ -307,7 +307,7 @@ StatusCode SCT_RDOsTestTool::CheckSDOs() { m_NoInnerModules.clear(); m_NoBarrelModules.clear(); - const InDetSimDataCollection* simDataMapSCT(NULL); + const InDetSimDataCollection* simDataMapSCT(nullptr); if(evtStore()->retrieve(simDataMapSCT,"SCT_SDO_Map").isFailure()) { ATH_MSG_WARNING ("Could not find SCT SDO container"); return StatusCode::SUCCESS; diff --git a/Simulation/Tests/DigitizationTests/test/test_DigitizationComparison.sh b/Simulation/Tests/DigitizationTests/test/test_DigitizationComparison.sh index 6c6b1fe3442c31c2ba1fd3e3918f48862296814d..817245010fc9c01e04369af78dfa2a5261632021 100755 --- a/Simulation/Tests/DigitizationTests/test/test_DigitizationComparison.sh +++ b/Simulation/Tests/DigitizationTests/test/test_DigitizationComparison.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# art-description: Run LAr digitization of an MC16a ttbar sample with 2016 geometry and conditions, without pile-up using Athena and Athena with ComponentAccumulator configuration +# art-description: Run a digitization example to compare configuration between ConfGetter and the new ComponentAccumulator approch. # art-type: grid # art-include: master/Athena # art-output: mc16a_ttbar.CG.RDO.pool.root diff --git a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh index 365cef8c0929e73ece69cb194f77d0d0be1eb5c3..61cadf3e786ddac0ac041015a23345b7bdd55cd5 100755 --- a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh +++ b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh @@ -28,6 +28,7 @@ Sim_tf.py \ --imf False rc=$? +mv log.EVNTtoHITS log.FullG4MTAthenaMT echo "art-result: $rc FullG4MTAthenaMT" rc2=-9999 if [ $rc -eq 0 ] @@ -49,6 +50,7 @@ then --preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \ --preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \ --imf False + mv log.EVNTtoHITS log.FullG4MTAthena rc2=$? fi echo "art-result: $rc2 FullG4MTAthena" @@ -72,6 +74,7 @@ then --preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \ --preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \ --imf False + mv log.EVNTtoHITS log.FullG4Athena rc3=$? fi echo "art-result: $rc3 FullG4Athena" diff --git a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_G4FastCalo_ttbar_MTvsST.sh b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_G4FastCalo_ttbar_MTvsST.sh new file mode 100755 index 0000000000000000000000000000000000000000..4841cabf7c7b89487eccf15c63dc489afeaead3f --- /dev/null +++ b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_G4FastCalo_ttbar_MTvsST.sh @@ -0,0 +1,97 @@ +#!/bin/sh +# +# art-description: Run MT and ST simulation outside ISF, reading ttbar events, writing HITS, using MC16 geometry and conditions + +# art-type: grid +# art-athena-mt: 8 +# art-output: log.* +# art-output: test.MT.HITS.pool.root +# art-output: test.ST.HITS.pool.root + +export ATHENA_CORE_NUMBER=8 + +Sim_tf.py \ +--multithreaded \ +--inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1" \ +--outputHITSFile "test.MT.HITS.pool.root" \ +--maxEvents 10 \ +--geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ +--conditionsTag 'default:OFLCOND-MC16-SDR-14' \ +--DataRunNumber '284500' \ +--physicsList 'FTFP_BERT_ATL' \ +--truthStrategy 'MC15aPlus' \ +--simulator 'G4FastCaloMT' \ +--postInclude 'default:PyJobTransforms/UseFrontier.py' \ +--preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \ +--preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' #\ +#--postExec 'EVNTtoHITS:ServiceMgr.MessageSvc.enableSuppression=False;topSeq.ISF_Kernel_G4FastCaloMT.OutputLevel=VERBOSE;' \ +#--imf False + +rc=$? +mv log.EVNTtoHITS log.G4FastCaloMTAthenaMT +echo "art-result: $rc G4FastCaloMTAthenaMT" +rc=0 +rc2=-9999 +if [ $rc -eq 0 ] +then + ArtPackage=$1 + ArtJobName=$2 + unset ATHENA_CORE_NUMBER + Sim_tf.py \ + --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1" \ + --outputHITSFile "test.ST.HITS.pool.root" \ + --maxEvents 10 \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --DataRunNumber '284500' \ + --physicsList 'FTFP_BERT_ATL' \ + --truthStrategy 'MC15aPlus' \ + --simulator 'G4FastCaloMT' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py' \ + --preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \ + --preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' #\ +# --postExec 'EVNTtoHITS:ServiceMgr.MessageSvc.enableSuppression=False;topSeq.ISF_Kernel_G4FastCaloMT.OutputLevel=VERBOSE;' \ +# --imf False + rc2=$? + mv log.EVNTtoHITS log.G4FastCaloMTAthena +fi +echo "art-result: $rc2 G4FastCaloMTAthena" +rc3=-9999 +if [ $rc -eq 0 ] +then + ArtPackage=$1 + ArtJobName=$2 + unset ATHENA_CORE_NUMBER + Sim_tf.py \ + --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1" \ + --outputHITSFile "test.ST.old.HITS.pool.root" \ + --maxEvents 10 \ + --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ + --conditionsTag 'default:OFLCOND-MC16-SDR-14' \ + --DataRunNumber '284500' \ + --physicsList 'FTFP_BERT_ATL' \ + --truthStrategy 'MC15aPlus' \ + --simulator 'G4FastCalo' \ + --postInclude 'default:PyJobTransforms/UseFrontier.py' \ + --preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \ + --preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' #\ +# --postExec 'EVNTtoHITS:ServiceMgr.MessageSvc.enableSuppression=False;topSeq.ISF_Kernel_G4FastCalo.OutputLevel=VERBOSE;ServiceMgr.ISF_AFIIParticleBrokerSvc.OutputLevel=VERBOSE;' \ +# --imf False + rc3=$? + mv log.EVNTtoHITS log.G4FastCaloAthena +fi +echo "art-result: $rc3 G4FastCaloAthena" +rc4=-9999 +if [ $rc2 -eq 0 ] +then + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode=resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + rc4=$? +fi +echo "art-result: $rc4 G4FastCaloMT_STvsMT" +rc5=-9999 +if [ $rc3 -eq 0 ] +then + acmd.py diff-root test.ST.HITS.pool.root test.ST.old.HITS.pool.root --error-mode=resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + rc5=$? +fi +echo "art-result: $rc5 G4FastCaloMTvsG4FastCalo" diff --git a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassBackG4_ttbar_MTvsST.sh similarity index 90% rename from Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh rename to Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassBackG4_ttbar_MTvsST.sh index c760fb22fecee4d4982735ebaf6e9fb951af4bff..3bdcf08c423315fe847d0aaf8b89d052e003ffda 100755 --- a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh +++ b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassBackG4_ttbar_MTvsST.sh @@ -28,7 +28,8 @@ Sim_tf.py \ --imf False rc=$? -echo "art-result: $rc PassbackG4MTAthenaMT" +mv log.EVNTtoHITS log.PassBackG4MTAthenaMT +echo "art-result: $rc PassBackG4MTAthenaMT" rc2=-9999 if [ $rc -eq 0 ] then @@ -50,8 +51,9 @@ then --preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \ --imf False rc2=$? + mv log.EVNTtoHITS log.PassBackG4MTAthena fi -echo "art-result: $rc2 PassbackG4MTAthena" +echo "art-result: $rc2 PassBackG4MTAthena" rc3=-9999 if [ $rc -eq 0 ] then @@ -74,19 +76,20 @@ then --postExec 'svcMgr.ISF_ParticleBrokerSvcNoOrdering.ParticleOrderingTool="ISF__EnergyParticleOrderingTool";svcMgr.ISF_ParticleBrokerSvcNoOrdering.AlwaysUseGeoIDSvc=True' \ --imf False rc3=$? + mv log.EVNTtoHITS log.PassBackG4Athena fi -echo "art-result: $rc3 PassbackG4Athena" +echo "art-result: $rc3 PassBackG4Athena" rc4=-9999 if [ $rc2 -eq 0 ] then acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi -echo "art-result: $rc4 PassbackG4MT_STvsMT" +echo "art-result: $rc4 PassBackG4MT_STvsMT" rc5=-9999 if [ $rc3 -eq 0 ] then acmd.py diff-root test.MT.HITS.pool.root test.ST.old.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc5=$? fi -echo "art-result: $rc5 PassbackG4MTvsPassbackG4" +echo "art-result: $rc5 PassBackG4MTvsPassBackG4" diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt index 79c27a60b40f628bcab172367786753ac7ff36e1..b697747a09d99be99c521ee9071d6ee2a440b7d3 100644 --- a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt @@ -10,20 +10,25 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel PRIVATE Calorimeter/CaloDetDescr + Calorimeter/CaloEvent Calorimeter/CaloIdentifier Calorimeter/CaloSimEvent - Calorimeter/CaloEvent Control/AthenaBaseComps DetectorDescription/GeoModel/GeoAdaptors + DetectorDescription/Identifier Event/EventInfo - Generators/AtlasHepMC - LArCalorimeter/LArSimEvent + External/AtlasHepMC/AtlasHepMC LArCalorimeter/LArElecCalib + LArCalorimeter/LArG4/LArG4RunControl + LArCalorimeter/LArGeoModel/LArReadoutGeometry + LArCalorimeter/LArSimEvent TileCalorimeter/TileDetDescr TileCalorimeter/TileSimEvent ) # External dependencies: find_package( CLHEP ) +find_package( HepMC ) +find_package( Eigen ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -34,11 +39,11 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore atlas_add_component( CaloSamplingFractionAnalysis src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent CaloEvent AthenaBaseComps GeoAdaptors EventInfo LArSimEvent TileDetDescr TileSimEvent ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent CaloEvent AthenaBaseComps GeoAdaptors EventInfo LArSimEvent LArG4RunControl LArReadoutGeometry TileDetDescr TileSimEvent ) # Install files from the package: # atlas_install_headers( CaloSamplingFractionAnalysis ) -# atlas_install_joboptions( share/*.py ) +atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/*.C ) diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C index 76d1fb099a34f99cd8efe5b14e0ffe601934cb75..f7d22be0e9b3b5165a799c845c6d79ebdb63853d 100644 --- a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C @@ -14,20 +14,34 @@ void LarEMSamplingFraction_barrel() TCanvas* c; c=new TCanvas("SF_LAr_barrel_calibhit","SF_LAr_barrel_calibhit"); - mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,140,0.18,0.25)","","colz"); + mytree->Draw("(energy_active_em[1]+energy_active_em[2]+energy_active_em[3]+energy_active_nonem[1]+energy_active_nonem[2]+energy_active_nonem[3] + energy_inactive_em[1]+energy_inactive_em[2]+energy_inactive_em[3]+energy_inactive_nonem[1]+energy_inactive_nonem[2]+energy_inactive_nonem[3])/mc_e:mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,300,0.7,1.0)","","colz"); TH2* SF_LAr_barrel_calibhit=(TH2*)gDirectory->Get("SF_LAr_barrel_calibhit"); //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") TProfile* SF_prof_calibhit=SF_LAr_barrel_calibhit->ProfileX(); + + SF_LAr_barrel_calibhit->GetYaxis()->SetRangeUser(0.96,1.0); + SF_prof_calibhit->SetLineColor(2); SF_prof_calibhit->Draw("same"); - //TFitResultPtr* fitres= - //SF_prof_calibhit->Fit("pol0","","",0.1,0.75); - //SF_prof_calibhit->Fit("pol0","+","",0.85,1.35); + + c->SetGridx(); + c->SetGridy(); + + c=new TCanvas("SF_LAr_barrel_hit","SF_LAr_barrel_hit"); + mytree->Draw("(energy_hit[1]+energy_hit[2]+energy_hit[3])/mc_e:mc_eta>>SF_LAr_barrel_hit(56,0,1.4,300,0.13,0.28)","","colz"); + TH2* SF_LAr_barrel_hit=(TH2*)gDirectory->Get("SF_LAr_barrel_hit"); + TProfile* SF_prof_hit=SF_LAr_barrel_hit->ProfileX(); + + SF_LAr_barrel_hit->GetYaxis()->SetRangeUser(0.96,1.0); + + SF_prof_hit->SetLineColor(2); + SF_prof_hit->Draw("same"); + c->SetGridx(); c->SetGridy(); c=new TCanvas("SF_LAr_barrel","SF_LAr_barrel"); - mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,140,0.16,0.23)","","colz"); + mytree->Draw("(energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_em[1]+energy_active_em[2]+energy_active_em[3]+energy_active_nonem[1]+energy_active_nonem[2]+energy_active_nonem[3] + energy_inactive_em[1]+energy_inactive_em[2]+energy_inactive_em[3]+energy_inactive_nonem[1]+energy_inactive_nonem[2]+energy_inactive_nonem[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,300,0.13,0.28)","","colz"); TH2* SF_LAr_barrel=(TH2*)gDirectory->Get("SF_LAr_barrel"); SF_LAr_barrel->SetStats(0); SF_LAr_barrel->SetTitle("Sampling fraction LAr EM barrel"); @@ -41,6 +55,11 @@ void LarEMSamplingFraction_barrel() SF_prof->Fit("pol0","Q+","",0.85,1.35); TList* res=SF_prof->GetListOfFunctions(); + TProfile* SF_prof_noncorr=(TProfile*)(SF_prof_hit->Clone("SF_prof_noncorr")); + SF_prof_noncorr->Divide(SF_prof_calibhit); + SF_prof_noncorr->SetLineColor(1); + SF_prof_noncorr->Draw("samehist"); + TPaveText *pt = new TPaveText(.05,.2,.75,.23,""); pt->SetFillStyle(1001); pt->SetFillColor(10); @@ -57,52 +76,73 @@ void LarEMSamplingFraction_barrel() pt->Draw(); - c->SetGridx(); c->SetGridy(); + c->SaveAs(".pdf"); } void LarEMSamplingFraction_endcap() { TFile* file = TFile::Open("LArEM_SF_endcap.root"); TTree* mytree=(TTree*)file->Get("mytree"); - new TCanvas("Etot_endcap","Etot_endcap"); - mytree->Draw("Sum$(energy_active_total+energy_inactive_total)"); new TCanvas("ELAr_hit_endcap","ELAr_hit_endcap"); - mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])"); + mytree->Draw("(energy_hit[5]+energy_hit[6]+energy_hit[7])/mc_e:mc_eta>>ELAr_hit_endcap(86,1.35,3.5,150,0,0.15)","","colz"); TCanvas* c; c=new TCanvas("SF_LAr_endcap_calibhit","SF_LAr_endcap_calibhit"); - mytree->Draw("(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap_calibhit(86,1.35,3.5,400,0.00,0.40)","","colz"); + mytree->Draw("(energy_active_em[5]+energy_active_em[6]+energy_active_em[7]+energy_active_nonem[5]+energy_active_nonem[6]+energy_active_nonem[7] + energy_inactive_em[5]+energy_inactive_em[6]+energy_inactive_em[7]+energy_inactive_nonem[5]+energy_inactive_nonem[6]+energy_inactive_nonem[7])/mc_e:mc_eta>>SF_LAr_endcap_calibhit(86,1.35,3.5,100,0.00,1.00)","","colz"); TH2* SF_LAr_endcap_calibhit=(TH2*)gDirectory->Get("SF_LAr_endcap_calibhit"); - //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") TProfile* SF_prof_calibhit=SF_LAr_endcap_calibhit->ProfileX(); SF_prof_calibhit->SetLineColor(2); SF_prof_calibhit->Draw("same"); - //TFitResultPtr* fitres= - //SF_prof_calibhit->Fit("pol0","","",0.1,0.75); - //SF_prof_calibhit->Fit("pol0","+","",0.85,1.35); + c->SetGridx(); c->SetGridy(); c=new TCanvas("SF_LAr_endcap","SF_LAr_endcap"); - mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap(86,1.35,3.5,800,0.00,0.40)","","colz"); + mytree->Draw("(energy_hit[5]+energy_hit[6]+energy_hit[7])/(energy_active_em[5]+energy_active_em[6]+energy_active_em[7]+energy_active_nonem[5]+energy_active_nonem[6]+energy_active_nonem[7] + energy_inactive_em[5]+energy_inactive_em[6]+energy_inactive_em[7]+energy_inactive_nonem[5]+energy_inactive_nonem[6]+energy_inactive_nonem[7]):mc_eta>>SF_LAr_endcap(86,1.35,3.5,800,0.00,0.40)","","colz"); TH2* SF_LAr_endcap=(TH2*)gDirectory->Get("SF_LAr_endcap"); SF_LAr_endcap->SetStats(0); SF_LAr_endcap->SetTitle("Sampling fraction LAr EM endcap"); SF_LAr_endcap->GetXaxis()->SetTitle("|#eta|"); SF_LAr_endcap->GetYaxis()->SetTitle("E_{G4hit}/E_{total}"); - SF_LAr_endcap->GetYaxis()->SetRangeUser(0,0.15); - //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") + SF_LAr_endcap->GetYaxis()->SetRangeUser(0,0.13); TProfile* SF_prof=SF_LAr_endcap->ProfileX(); SF_prof->SetLineColor(2); SF_prof->Draw("same"); - //TFitResultPtr* fitres= - //SF_prof->Fit("pol0","","",0.1,0.75); - //SF_prof->Fit("pol0","+","",0.85,1.35); + + SF_prof->Fit(new TF1("r1","[0]+(x-1.47)*[1]",1,4),"","",1.45,1.49); + SF_prof->Fit(new TF1("r2","[0]+(x-1.55)*[1]",1,4),"+","",1.53,1.57); + SF_prof->Fit(new TF1("r3","[0]+(x-1.70)*[1]",1,4),"+","",1.64,1.76); + SF_prof->Fit(new TF1("r4","[0]+(x-1.90)*[1]",1,4),"+","",1.84,1.96); + SF_prof->Fit(new TF1("r5","[0]+(x-2.055)*[1]",1,4),"+","",2.03,2.08); + SF_prof->Fit(new TF1("r6","[0]+(x-2.20)*[1]",1,4),"+","",2.14,2.26); + SF_prof->Fit(new TF1("r7","[0]+(x-2.395)*[1]",1,4),"+","",2.34,2.45); + SF_prof->Fit(new TF1("r8","[0]+(x-2.66)*[1]",1,4),"+","",2.56,2.76); + SF_prof->Fit(new TF1("r9","[0]+(x-2.995)*[1]",1,4),"+","",2.85,3.14); + TList* res=SF_prof->GetListOfFunctions(); + + TPaveText *pt = new TPaveText(1.45,0.005,3.1,0.075,""); + pt->SetFillStyle(1001); + pt->SetFillColor(10); + pt->SetBorderSize(1); + pt->AddText("Sampling fractions LAr EM endcap"); + + for(int i=0;i<res->GetSize();++i) if(res->At(i)->InheritsFrom(TF1::Class())) { + TF1* func=(TF1*)res->At(i); + TString text=Form("%4.2f < #eta < %4.2f = %+7.5f +- %7.5f + (|#eta|-%5.3f)*( %7.5f +- %7.5f )",func->GetXmin(),func->GetXmax(),func->GetParameter(0),func->GetParError(0),0.5*(func->GetXmin()+func->GetXmax()),func->GetParameter(1),func->GetParError(1)); + std::cout<<"Sampling fraction : "<<text<<std::endl; + pt->AddText(text); + if(func->GetFormula()) { + } + } + + pt->Draw(); + c->SetGridx(); c->SetGridy(); + c->SaveAs(".pdf"); } void LarEMSamplingFraction_analysis() diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..89866a0979e458e31b7bcf7959480ebc6394a09d --- /dev/null +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py @@ -0,0 +1,173 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +""" +Job options file for Geant4 ATLAS detector simulations to measure the FCal +sampling fractions. + +Set the 'module' variable to one of 'fcal1', 'fcal2' or 'fcal3' to simulate +particle interactions in the FCal1, FCal2 or FCal3 modules, respectively. + +Additionaly parameters, such as the number of events to simulate and the +particle gun energy and coordinates, may be set in the 'params' variable. +""" + +import random + +## Common parameters +module = "fcal1" # Choose from "fcal1", "fcal2" or "fcal3" + +## Distance from IP to face of each FCal module [mm] + +## Values based on Table 3 in JINST 3 P02010 (2008), "The ATLAS Forward Calorimeter" +## These numbers do not necessarily reflect the geometry and location of the FCal in the Geant4 model! +# fcal1_z = 4708.90 # Distance from IP to FCal1 face [mm]; = 4683.5 + 26.4 - 1.0 +# fcal2_z = 5166.10 # Distance from IP to FCal2 face [mm]; = 4683.5 + 483.6 - 1.0 +# fcal3_z = 5648.20 # Distance from IP to FCal3 face [mm]; = 4683.5 + 965.7 - 1.0 + +## Values for the Geant4 module +fcal1_z = 4713.5 +fcal2_z = 5173.3 +fcal3_z = 5647.8 + +params = { + 'n_event': 200, # Number of events to simulate + 'pg_E': 40000, # Particle gun energy [MeV] + 'pg_x': [212.5, 277.5], # Particle gun x-coordinate; constant or range + 'pg_y': [7.5, 72.5], # Particle gun y-coordinate; constant or range + 'pg_z': None, # Particle gun z-coordinate (distance to IP); should be constant + 'pg_eta': None, # Particle gun eta; constant or range +} + +if module.lower() == "fcal1": + params['pg_z'] = fcal1_z + params['pg_eta'] = [3.5, 3.8] +elif module.lower() == "fcal2": + params['pg_z'] = fcal2_z + params['pg_eta'] = [3.5, 3.8] +elif module.lower() == "fcal3": + params['pg_z'] = fcal3_z + params['pg_eta'] = [3.5, 3.8] + + +## Algorithm sequence +from AthenaCommon.AlgSequence import AlgSequence +topSeq = AlgSequence() + +## Output threshold (DEBUG, INFO, WARNING, ERROR, FATAL) +ServiceMgr.MessageSvc.OutputLevel = INFO + +## Detector flags +from AthenaCommon.DetFlags import DetFlags +DetFlags.ID_setOff() +DetFlags.Calo_setOn() +DetFlags.Muon_setOff() +DetFlags.HEC_setOff() +DetFlags.em_setOff() +DetFlags.Tile_setOff() +# DetFlags.Lucid_setOn() +DetFlags.Truth_setOn() +DetFlags.simulate.Truth_setOn() + +## Global conditions tag +from AthenaCommon.GlobalFlags import jobproperties +jobproperties.Global.ConditionsTag = "OFLCOND-MC16-SDR-16" + +## AthenaCommon flags +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +athenaCommonFlags.PoolHitsOutput = "atlasG4.hits.pool.root" +athenaCommonFlags.EvtMax = params['n_event'] + +## Simulation flags +from G4AtlasApps.SimFlags import simFlags +simFlags.load_atlas_flags() +simFlags.RandomSvc = "AtDSFMTGenSvc" + +## Layout tags: see simFlags.SimLayout for allowed values +## Use the default layout: +simFlags.SimLayout.set_On() +## Set a specific layout tag: +simFlags.SimLayout = "ATLAS-R2-2016-01-00-01" +## Set a specific non-officially-supported layout tag using the _VALIDATION suffix, e.g.: +# simFlags.SimLayout = "ATLAS-R2-2016-01-00-01_VALIDATION" + +## Set the EtaPhi, VertexSpread and VertexRange checks on +simFlags.EventFilter.set_Off() + +## Set CalibrationRun +simFlags.CalibrationRun = "LAr" + +## Set random seeds +## Seeds need to explicitly set, otherwise default constants are used +simFlags.RandomSeedList.addSeed('AtlasG4',random.randint(10000, 99999999), random.randint(10000, 99999999)) +simFlags.RandomSeedList.addSeed('VERTEX', random.randint(10000, 99999999), random.randint(10000, 99999999)) +simFlags.RandomSeedList.addSeed('SINGLE', random.randint(10000, 99999999), random.randint(10000, 99999999)) + +## No magnetic field +# simFlags.MagneticField.set_Off() + +## Register callback functions at various init stages +# def test_preInit(): +# print "CALLBACK AT PREINIT" +# def test_postInit(): +# print "CALLBACK AT POSTINIT" +# simFlags.InitFunctions.add_function("preInit", test_preInit) +# simFlags.InitFunctions.add_function("postInit", test_postInit) + +## Change the field stepper or use verbose G4 tracking +# from G4AtlasApps import callbacks +# simFlags.InitFunctions.add_function("postInit", callbacks.use_simplerunge_stepper) +# simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking) + +## Use single particle generator +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +athenaCommonFlags.PoolEvgenInput.set_Off() +athenaCommonFlags.SkipEvents.set_Off() + +## Set particle gun parameters +import AthenaCommon.AtlasUnixGeneratorJob +import ParticleGun as PG +pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE") +pg.sampler.pid = 11 +pg.sampler.mom = PG.EEtaMPhiSampler(energy=params['pg_E'], eta=params['pg_eta']) +pg.sampler.pos = PG.PosSampler(x=params['pg_x'], y=params['pg_y'], z=params['pg_z'], t=params['pg_z']) +topSeq += pg + +## Dump truth information +# from TruthExamples.TruthExamplesConf import DumpMC +# topSeq += DumpMC() + +StoreGateSvc = Service( "StoreGateSvc" ) +StoreGateSvc.Dump = True + +include("G4AtlasApps/G4Atlas.flat.configuration.py") + +## Use GeoCheckAction +## If using GeoCheckAction, make sure the particle type id is set to 999 (geantinos) +# def add_GeoCheckAction(): +# from G4AtlasApps import PyG4Atlas, AtlasG4Eng +# GeoCheckAction = PyG4Atlas.UserAction( 'G4UserActions', 'GeoCheckAction', ['BeginOfEvent','EndOfEvent','Step','EndOfRun'] ) +# AtlasG4Eng.G4Eng.menu_UserActions.add_UserAction(GeoCheckAction) + +# simFlags.InitFunctions.add_function("postInit", add_GeoCheckAction) + + +from AthenaCommon.CfgGetter import getAlgorithm +topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True) +topSeq.G4AtlasAlg.InputTruthCollection = "GEN_EVENT" + +## Tool to merge dead material containers into a single container +from LArG4SD import LArG4SDConfig +topSeq += LArG4SDConfig.getDeadMaterialCalibrationHitMerger() + +myAlg = CfgMgr.LArFCalSamplingFraction() +myAlg.Calibration = True +topSeq += myAlg + + +from GaudiSvc.GaudiSvcConf import THistSvc +ServiceMgr += THistSvc() +ServiceMgr.THistSvc.Output = [ + "AANT DATAFILE='LArFCalSamplingFraction.{}.{:g}GeV.aan.root' OPT='RECREATE'".format(module, params['pg_E']/1000) +] + +print topSeq diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py new file mode 100755 index 0000000000000000000000000000000000000000..9987534a5d71ceb0196236f47650f3b1233b2abb --- /dev/null +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +""" +Calculate FCal Sampling Fractions +================================= + +Calculate the FCal sampling fractions from Geant4 simulation. +""" + +from __future__ import absolute_import, division, print_function + + +import argparse +import glob +import math +import sys + +import ROOT as root + +# To stop ROOT from hijacking '--help' +root.PyConfig.IgnoreCommandLineOptions = True + + +def _docstring(docstring): + """Return summary of docstring + """ + return docstring.split('\n')[4] if docstring else "" + + +def parse_args(): + """Parse command-line arguments + """ + parser = argparse.ArgumentParser(description=_docstring(__doc__)) + parser.add_argument("--version", action="version", version="%(prog)s 0.1") + parser.add_argument("-v", "--verbose", action="count", default=0, + help="print verbose messages; multiple -v result in more verbose messages") + parser.add_argument("infile", default="LArFCalSamplingFraction.aan.root", + help="Path to input file; wildcards are supported (default: %(default)s)") + parser.add_argument("-m", "--module", choices=["FCal1", "FCal2", "FCal3"], + help="Calculate the sampling fraction for this FCal module only; " + "if unspecified, it will try to parse the module from the file name") + parser.add_argument("-o", "--outfile", default="out.txt", + help="Path to output file where sampling fraction results are written " + "(default: %(default)s)") + + args = parser.parse_args() + + return args + + +def calculate_samp_frac(args): + """Read ntuple from the Geant4 simulation and calculate FCal sampling + fractions. + + Returns (E_init, samp_frac, samp_frac_err) + """ + tree_name = "tree_AS" + print("Reading tree '{}' from file '{}'...".format(tree_name, args.infile)) + + aan_chain = root.TChain(tree_name) + aan_chain.Add(args.infile) + + n_event = aan_chain.GetEntries() + + # Get initial electron energy [GeV] + for event in aan_chain: + E_init = round(event.E, 2) / 1000 + break + + samp_frac = 0 + samp_frac_sq = 0 + + if args.verbose: + print("Event Active E [MeV] Total E [MeV]") + + # Loop over events and sum energy values + for event in aan_chain: + if args.module.lower() == "fcal1": + totalE = event.Calib_FCal1Active + event.Calib_FCal1Inactive + activeE = event.FCal1_E + elif args.module.lower() == "fcal2": + totalE = event.Calib_FCal2Active + event.Calib_FCal2Inactive + activeE = event.FCal2_E + elif args.module.lower() == "fcal3": + totalE = event.Calib_FCal3Active + event.Calib_FCal3Inactive + activeE = event.FCal3_E + + samp_frac += activeE / totalE + samp_frac_sq += (activeE / totalE)**2 + + if args.verbose: + print("{:<6} {:<15g} {:<15g}".format(event.Event, activeE, totalE)) + + if args.verbose: + print("") + + # Mean sampling fractions + samp_frac /= n_event + samp_frac_sq /= n_event + + # Sampling fraction error = sqrt(<x^2> - <x>^2) / sqrt(N) + samp_frac_err = math.sqrt(samp_frac_sq - samp_frac**2) / math.sqrt(n_event) + + print("{} sampling fraction (E = {:g} GeV): {:g} +/- {:g}".format(args.module, E_init, samp_frac, samp_frac_err)) + + return E_init, samp_frac, samp_frac_err + + +def write_results(results, args): + with open(args.outfile, "w") as outfile: + outfile.write("[{}]\n".format(args.module)) + + for key in sorted(results.keys()): + outfile.write("{:g} GeV: {} +/- {}\n".format(key, results[key][0], results[key][1])) + +def main(): + try: + args = parse_args() + + if args.module is None: + if "fcal1" in args.infile.lower(): + args.module = "fcal1" + elif "fcal2" in args.infile.lower(): + args.module = "fcal2" + elif "fcal3" in args.infile.lower(): + args.module = "fcal3" + else: + raise Exception("unknown FCal module") + + infiles = glob.glob(args.infile) + infiles.sort() + + results = {} + + for infile in infiles: + args.infile = infile + E_init, samp_frac, samp_frac_err = calculate_samp_frac(args) + + results[E_init] = (samp_frac, samp_frac_err) + + print("Writing results to '{}'".format(args.outfile)) + write_results(results, args) + + except KeyboardInterrupt: + return 1 + + except Exception as err: + print("error: {}".format(err)) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0829eb097bc20d1d65eca86e533dafa3b45542e4 --- /dev/null +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx @@ -0,0 +1,1052 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArFCalSamplingFraction.h" + +// C++ stdlib +#include <algorithm> +#include <functional> +#include <iostream> +#include <cmath> + +// Root +#include "TTree.h" + +// ATLAS Software +#include "GaudiKernel/IToolSvc.h" + +// Event Info +#include "EventInfo/EventID.h" +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventType.h" +#include "EventInfo/TriggerInfo.h" +#include "GaudiKernel/ITHistSvc.h" + +// ID classes +#include "CaloDetDescr/CaloDetDescrElement.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "CaloIdentifier/CaloDM_ID.h" +#include "CaloIdentifier/CaloIdManager.h" +#include "Identifier/Identifier.h" + +// Hits and hit collections +#include "LArSimEvent/LArHit.h" +#include "LArSimEvent/LArHitContainer.h" +#include "LArReadoutGeometry/FCALModule.h" +#include "LArReadoutGeometry/FCALTile.h" +#include "CaloSimEvent/CaloCalibrationHit.h" +#include "CaloSimEvent/CaloCalibrationHitContainer.h" +#include "GeoAdaptors/GeoLArHit.h" +#include "GeoAdaptors/GeoCaloCalibHit.h" + +// For Cryostat Positions +#include "LArG4RunControl/LArG4TBPosOptions.h" + +// Other useful tools for particle/event/beam info +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventID.h" +#include "GeneratorObjects/McEventCollection.h" +#include "HepMC/GenEvent.h" +#include "HepMC/GenVertex.h" +#include "HepMC/GenParticle.h" +#include "HepMC/SimpleVector.h" +#include "CLHEP/Vector/LorentzVector.h" +#include "CLHEP/Vector/ThreeVector.h" +#include "CLHEP/Geometry/Point3D.h" + + +/////////////////////////////////////////////////////////////////////////////// +/// Constructor + +LArFCalSamplingFraction::LArFCalSamplingFraction(const std::string &name, ISvcLocator *pSvcLocator) + : AthAlgorithm(name, pSvcLocator), + m_calibrationRun(false), + m_cx1(0.0), m_cx2(0.0), m_cx3(0.0), + m_cy1(0.0), m_cy2(0.0), m_cy3(0.0) +{ + declareProperty("Calibration", m_calibrationRun); +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Destructor + +LArFCalSamplingFraction::~LArFCalSamplingFraction() {} + + +/////////////////////////////////////////////////////////////////////////////// +/// Initialize +/// - Get a handle on the analysis tools +/// - Set up output TTree + +StatusCode LArFCalSamplingFraction::initialize() +{ + ATH_MSG_INFO("Initializing LArFCalSamplingFraction"); + + // Get a handle on the NTuple and histogramming service + ServiceHandle<ITHistSvc> histSvc("THistSvc", name()); + CHECK(histSvc.retrieve()); + ATH_MSG_DEBUG(" retrieved THistSvc"); + + const CaloIdManager *caloIdManager; + ATH_CHECK(detStore()->retrieve(caloIdManager)); + + // Use just for now for Calibration... change later to GeoCalibHit + m_larFCalID = caloIdManager->getFCAL_ID(); + + if (m_larFCalID == 0) + throw GaudiException("Invalid LAr FCAL ID helper", "LArHitAnalysis", StatusCode::FAILURE); + + // Use for now... soon change to GeoCalibHit + m_caloCellID = caloIdManager->getCaloCell_ID(); + + if (m_caloCellID == 0) + throw GaudiException("Invalid Calo Cell ID helper", "LArHitAnalysis", StatusCode::FAILURE); + + m_pdg_id = new std::vector<int>; // particle id + + m_hit_x1 = new std::vector<double>; // hit positions of cells + m_hit_y1 = new std::vector<double>; + + m_hit_x2 = new std::vector<double>; + m_hit_y2 = new std::vector<double>; + + m_hit_x3 = new std::vector<double>; + m_hit_y3 = new std::vector<double>; + + m_hit_ieta1 = new std::vector<double>; // hit indices of cells + m_hit_iphi1 = new std::vector<double>; + m_hit_ieta2 = new std::vector<double>; + m_hit_iphi2 = new std::vector<double>; + m_hit_ieta3 = new std::vector<double>; + m_hit_iphi3 = new std::vector<double>; + + m_cell1_E = new std::vector<double>; // Energy in cells + m_cell2_E = new std::vector<double>; + m_cell3_E = new std::vector<double>; + + // Now add branches and leaves to the AAN tree + m_tree_AS = new TTree("tree_AS", "TTree of AnalysisSkleton"); + + // Event info + m_tree_AS->Branch("Run", &m_runNumber, "Run/I"); // run number + m_tree_AS->Branch("Event", &m_eventNumber, "Event/I"); // event number + m_tree_AS->Branch("Time", &m_eventTime, "Time/I"); // time stamp + m_tree_AS->Branch("LumiBlock", &m_lumiBlock, "LumiBlock/I"); // lumi block num + m_tree_AS->Branch("BCID", &m_bCID, "BCID/I"); // bunch crossing ID + m_tree_AS->Branch("Weight", &m_eventWeight, "Weight/D"); // weight + + // FCal-specific and other variables + m_tree_AS->Branch("EFCal", &m_totalFCalEnergy, "EFCal/D"); + m_tree_AS->Branch("NHitsFCal", &m_numHitsFCal, "NhitsFCal/I"); + + m_tree_AS->Branch("Vertex_Eta", &m_vertex_eta, "Vertex_Eta/D"); + m_tree_AS->Branch("Vertex_Phi", &m_vertex_phi, "Vertex_Phi/D"); + + m_tree_AS->Branch("Pt", &m_pt, "Pt/D"); + m_tree_AS->Branch("px", &m_px, "px/D"); + m_tree_AS->Branch("py", &m_py, "py/D"); + m_tree_AS->Branch("pz", &m_pz, "pz/D"); + m_tree_AS->Branch("E", &m_E, "E/D"); + + m_tree_AS->Branch("VertexX", &m_vertx, "VertexX/D"); + m_tree_AS->Branch("VertexY", &m_verty, "VertexY/D"); + m_tree_AS->Branch("VertexZ", &m_vertz, "VertexZ/D"); + + m_tree_AS->Branch("MC_CCX1", &m_x_mc_cc1, "MC_CCX1/D"); + m_tree_AS->Branch("MC_CCY1", &m_y_mc_cc1, "MC_CCY1/D"); + + m_tree_AS->Branch("MC_CCX2", &m_x_mc_cc2, "MC_CCX2/D"); + m_tree_AS->Branch("MC_CCY2", &m_y_mc_cc2, "MC_CCY2/D"); + + m_tree_AS->Branch("MC_CCX3", &m_x_mc_cc3, "MC_CCX3/D"); + m_tree_AS->Branch("MC_CCY3", &m_y_mc_cc3, "MC_CCY3/D"); + + m_tree_AS->Branch("CCX1", &m_x_cc1, "CCX1/D"); + m_tree_AS->Branch("CCY1", &m_y_cc1, "CCY1/D"); + + m_tree_AS->Branch("CCX2", &m_x_cc2, "CCX2/D"); + m_tree_AS->Branch("CCY2", &m_y_cc2, "CCY2/D"); + + m_tree_AS->Branch("CCX3", &m_x_cc3, "CCX3/D"); + m_tree_AS->Branch("CCY3", &m_y_cc3, "CCY3/D"); + + m_tree_AS->Branch("NCell_1", &m_NCell1, "NCell1_1/I"); + m_tree_AS->Branch("NCell_2", &m_NCell2, "NCell1_2/I"); + m_tree_AS->Branch("NCell_3", &m_NCell3, "NCell1_3/I"); + + m_tree_AS->Branch("ParticleID", &m_pdg_id); + + m_tree_AS->Branch("Hit_X1", &m_hit_x1); + m_tree_AS->Branch("Hit_Y1", &m_hit_y1); + + m_tree_AS->Branch("Hit_X2", &m_hit_x2); + m_tree_AS->Branch("Hit_Y2", &m_hit_y2); + + m_tree_AS->Branch("Hit_X3", &m_hit_x3); + m_tree_AS->Branch("Hit_Y3", &m_hit_y3); + + m_tree_AS->Branch("Hit_eta1", &m_hit_ieta1); + m_tree_AS->Branch("Hit_phi1", &m_hit_iphi1); + m_tree_AS->Branch("Hit_eta2", &m_hit_ieta2); + m_tree_AS->Branch("Hit_phi2", &m_hit_iphi2); + m_tree_AS->Branch("Hit_eta3", &m_hit_ieta3); + m_tree_AS->Branch("Hit_phi3", &m_hit_iphi3); + + m_tree_AS->Branch("Cell1_E", &m_cell1_E); + m_tree_AS->Branch("Cell2_E", &m_cell2_E); + m_tree_AS->Branch("Cell3_E", &m_cell3_E); + + m_tree_AS->Branch("FCal1_E", &m_FCal1_SumE, "FCal1_E/D"); + m_tree_AS->Branch("FCal2_E", &m_FCal2_SumE, "FCal2_E/D"); + m_tree_AS->Branch("FCal3_E", &m_FCal3_SumE, "FCal3_E/D"); + + if (m_calibrationRun) { + m_caloDmID = caloIdManager->getDM_ID(); + + if (m_caloDmID == 0) + throw GaudiException("Invalid Calo DM ID helper", "LArFCalTB_MC_CBNT_AA", StatusCode::FAILURE); + + // Define the hit containers that we'll analyze in this program. + // For now, initialize the pointers to the containers to NULL (zero). + m_calibHitMap["LArCalibrationHitActive"] = 0; + m_calibHitMap["LArCalibrationHitInactive"] = 0; + m_calibHitMap["LArCalibrationHitDeadMaterial"] = 0; + + m_tree_AS->Branch("Calib_TotalEnergy", &m_totalCalibrationEnergy, "Calib_TotalEnergy/D"); + m_tree_AS->Branch("Calib_TotalEm", &m_totalEmEnergy, "Calib_TotalEm/D"); + m_tree_AS->Branch("Calib_TotalNonEm", &m_totalNonEmEnergy, "Calib_TotalNonEm/D"); + m_tree_AS->Branch("Calib_TotalInvisible", &m_totalInvisibleEnergy, "Calib_TotalInvisible/D"); + m_tree_AS->Branch("Calib_TotalEscaped", &m_totalEscapedEnergy, "Calib_TotalEscaped/D"); + m_tree_AS->Branch("Calib_FCalEnergy", &m_totalFCalCalibrationEnergy, "Calib_FCalEnergy/D"); + m_tree_AS->Branch("Calib_TotalActive", &m_totalActiveEnergy, "Calib_TotalActive/D"); + m_tree_AS->Branch("Calib_TotalInactive", &m_totalInactiveEnergy, "Calib_TotalInactive/D"); + m_tree_AS->Branch("Calib_DeadEnergy", &m_totalDeadMaterialEnergy, "Calib_DeadEnergy/D"); + m_tree_AS->Branch("Calib_NHitsInactive", &m_numHitsInactive, "Calib_NHitsInactive/I"); + m_tree_AS->Branch("Calib_NHitsDead", &m_numHitsDead, "Calib_NHitsDead/I"); + m_tree_AS->Branch("Calib_FCal1Energy", &m_totalFCal1CalibrationEnergy, "Calib_FCal1Energy/D"); + m_tree_AS->Branch("Calib_FCal2Energy", &m_totalFCal2CalibrationEnergy, "Calib_FCal2Energy/D"); + m_tree_AS->Branch("Calib_FCal3Energy", &m_totalFCal3CalibrationEnergy, "Calib_FCal3Energy/D"); + + m_tree_AS->Branch("Calib_FCalActive", &m_FCalActive, "Calib_FCalActive/D"); + m_tree_AS->Branch("Calib_FCalInactive", &m_FCalInactive, "Calib_FCalInactive/D"); + m_tree_AS->Branch("Calib_FCalDead", &m_FCalDead, "Calib_FCalDead/D"); + m_tree_AS->Branch("Calib_FCalEm", &m_FCalEm, "Calib_FCalEm/D"); + m_tree_AS->Branch("Calib_FCal1Em", &m_FCal1Em, "Calib_FCal1Em/D"); + m_tree_AS->Branch("Calib_FCal2Em", &m_FCal2Em, "Calib_FCal2Em/D"); + m_tree_AS->Branch("Calib_FCal3Em", &m_FCal3Em, "Calib_FCal3Em/D"); + m_tree_AS->Branch("Calib_FCalNonEm", &m_FCalNonEm, "Calib_FCalNonEm/D"); + m_tree_AS->Branch("Calib_FCal1NonEm", &m_FCal1NonEm, "Calib_FCal1NonEm/D"); + m_tree_AS->Branch("Calib_FCal2NonEm", &m_FCal2NonEm, "Calib_FCal2NonEm/D"); + m_tree_AS->Branch("Calib_FCal3NonEm", &m_FCal3NonEm, "Calib_FCal3NonEm/D"); + m_tree_AS->Branch("Calib_FCalInvisible", &m_FCalInvisible, "Calib_FCalInvisible/D"); + m_tree_AS->Branch("Calib_FCal1Invisible", &m_FCal1Invisible, "Calib_FCal1Invisible/D"); + m_tree_AS->Branch("Calib_FCal2Invisible", &m_FCal2Invisible, "Calib_FCal2Invisible/D"); + m_tree_AS->Branch("Calib_FCal3Invisible", &m_FCal3Invisible, "Calib_FCal3Invisible/D"); + m_tree_AS->Branch("Calib_FCalEscaped", &m_FCalEscaped, "Calib_FCalEscaped/D"); + m_tree_AS->Branch("Calib_FCal1Escaped", &m_FCal1Escaped, "Calib_FCal1Escaped/D"); + m_tree_AS->Branch("Calib_FCal2Escaped", &m_FCal2Escaped, "Calib_FCal2Escaped/D"); + m_tree_AS->Branch("Calib_FCal3Escaped", &m_FCal3Escaped, "Calib_FCal3Escaped/D"); + m_tree_AS->Branch("Calib_FCal1Active", &m_FCal1Active, "Calib_FCal1Active/D"); + m_tree_AS->Branch("Calib_FCal2Active", &m_FCal2Active, "Calib_FCal2Active/D"); + m_tree_AS->Branch("Calib_FCal3Active", &m_FCal3Active, "Calib_FCal3Active/D"); + m_tree_AS->Branch("Calib_FCal1Inactive", &m_FCal1Inactive, "Calib_FCal1Inactive/D"); + m_tree_AS->Branch("Calib_FCal2Inactive", &m_FCal2Inactive, "Calib_FCal2Inactive/D"); + m_tree_AS->Branch("Calib_FCal3Inactive", &m_FCal3Inactive, "Calib_FCal3Inactive/D"); + m_tree_AS->Branch("Calib_FCalActiveEm", &m_FCalActiveEm, "Calib_FCalActiveEm/D"); + m_tree_AS->Branch("Calib_FCalActiveNonEm", &m_FCalActiveNonEm, "Calib_FCalActiveNonEm/D"); + m_tree_AS->Branch("Calib_FCalActiveInvisible", &m_FCalActiveInvisible, "Calib_FCalActiveInvisible/D"); + m_tree_AS->Branch("Calib_FCalActiveEscaped", &m_FCalActiveEscaped, "Calib_FCalActiveEscaped/D"); + } + + CHECK(histSvc->regTree("/AANT/tree_AS", m_tree_AS)); + + m_eventNumber = 0; + + return StatusCode::SUCCESS; +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Finalize +/// - delete any memory allocation from the heap + +StatusCode LArFCalSamplingFraction::finalize() +{ + return StatusCode::SUCCESS; +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Init event +/// - clear CBNT members + +StatusCode LArFCalSamplingFraction::initEvent() +{ + /// For Athena-Aware NTuple + + ATH_MSG_INFO("Initializing event, clearing variables"); + + m_vertx = 0; // x-position for vertex generated particle (beam) + m_verty = 0; + m_vertz = 0; + + m_vertex_eta = 0; // eta value of generated particle + m_vertex_phi = 0; + + m_pt = 0; // Momentum of generated particle + m_px = 0; + m_py = 0; + m_pz = 0; + + m_E = 0; // Energy of generated particle + + m_NCell1 = 0; // Number of cells hit + m_NCell2 = 0; + m_NCell3 = 0; + + m_x_mc_cc1 = 0; // Center of cluster in x (FCal1, extrapolated) + m_y_mc_cc1 = 0; + + m_x_mc_cc2 = 0; // Center of cluster in x (FCal2, extrapolated) + m_y_mc_cc2 = 0; + + m_x_mc_cc3 = 0; // Center of cluster in x (FCal3, extrapolated) + m_y_mc_cc3 = 0; + + m_x_cc1 = 0; // Center of cluster in x (FCal1, c of g) + m_y_cc1 = 0; + + m_x_cc2 = 0; // Center of cluster in x (FCal2, c of g) + m_y_cc2 = 0; + + m_x_cc3 = 0; // Center of cluster in x (FCal3, c of g) + m_y_cc3 = 0; + + m_pdg_id->clear(); // particle id + + m_hit_x1->clear(); // hit positions of cells + m_hit_y1->clear(); + + m_hit_x2->clear(); + m_hit_y2->clear(); + + m_hit_x3->clear(); + m_hit_y3->clear(); + + m_hit_ieta1->clear(); // hit indices of cells + m_hit_iphi1->clear(); + m_hit_ieta2->clear(); + m_hit_iphi2->clear(); + m_hit_ieta3->clear(); + m_hit_iphi3->clear(); + + m_cell1_E->clear(); // Energy in cells + m_cell2_E->clear(); + m_cell3_E->clear(); + + m_FCal1_SumE = 0; // Energy in individual FCal modules + m_FCal2_SumE = 0; + m_FCal3_SumE = 0; + m_TCScint_E = 0; + m_TCIron_E = 0; + + m_totalFCalEnergy = 0; + m_numHitsFCal = 0; + + m_totalCalibrationEnergy = 0; // Total energy + + // Physic Processes + m_totalEmEnergy = 0; + m_totalNonEmEnergy = 0; + m_totalInvisibleEnergy = 0; + m_totalEscapedEnergy = 0; + + // Energy deposited in different material categories + m_totalActiveEnergy = 0; + m_totalInactiveEnergy = 0; + m_totalDeadMaterialEnergy = 0; + + // Number of hits in different material categories + m_numHitsActive = 0; + m_numHitsInactive = 0; + m_numHitsDead = 0; + + // Total energy deposited in the different FCal Modules + m_totalFCalCalibrationEnergy = 0; // Energy in all FCal + m_totalFCal1CalibrationEnergy = 0; + m_totalFCal2CalibrationEnergy = 0; + m_totalFCal3CalibrationEnergy = 0; + + m_FCalActive = 0; + m_FCalInactive = 0; + m_FCalDead = 0; + m_FCalActiveEm = 0; + m_FCalActiveNonEm = 0; + m_FCalActiveInvisible = 0; + m_FCalActiveEscaped = 0; + m_FCalEm = 0; + m_FCal1Em = 0; + m_FCal2Em = 0; + m_FCal3Em = 0; + m_FCalNonEm = 0; + m_FCal1NonEm = 0; + m_FCal2NonEm = 0; + m_FCal3NonEm = 0; + m_FCalInvisible = 0; + m_FCal1Invisible = 0; + m_FCal2Invisible = 0; + m_FCal3Invisible = 0; + m_FCalEscaped = 0; + m_FCal1Escaped = 0; + m_FCal2Escaped = 0; + m_FCal3Escaped = 0; + m_PhysTotE = 0; + m_FCal1Active = 0; + m_FCal2Active = 0; + m_FCal3Active = 0; + m_FCal1Inactive = 0; + m_FCal2Inactive = 0; + m_FCal3Inactive = 0; + + return StatusCode::SUCCESS; +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Calculate FCal hit center + +void LArFCalSamplingFraction::FCalHitCenter(const LArHitContainer *container) +{ + double max1 = 0.0; + double max2 = 0.0; + double max3 = 0.0; + + // Loop over hits in container + for (LArHit* const& hit : *container) { + + GeoLArHit fcalhit(*hit); + + if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) { + ATH_MSG_WARNING("Hit in LarHitContainer is not a GeoFCalHit"); + continue; + } + + double energy = fcalhit.Energy(); + + int module_index = fcalhit.getDetDescrElement()->getLayer(); + + double x = fcalhit.getDetDescrElement()->x(); + double y = fcalhit.getDetDescrElement()->y(); + + // Determine the center of the cluster for each FCal module + if (module_index == 1) { + // FCal1 + if (max1 < energy) { + max1 = energy; + m_cx1 = x; + m_cy1 = y; + } + } + else if (module_index == 2) { + // FCal2 + if (max2 < energy) { + max2 = energy; + m_cx2 = x; + m_cy2 = y; + } + } + else if (module_index == 3) { + // FCal3 + if (max3 < energy) { + max3 = energy; + m_cx3 = x; + m_cy3 = y; + } + } + + } // End loop over hits in container +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Calculate FCal cluster center + +void LArFCalSamplingFraction::FCalClusterCenter(const LArHitContainer *container) +{ + float xNumer1 = 0.0, xNumer2 = 0.0, xNumer3 = 0.0; + float yNumer1 = 0.0, yNumer2 = 0.0, yNumer3 = 0.0; + float Denom1 = 0.0, Denom2 = 0.0, Denom3 = 0.0; + + double subClusterSize = 30.0; // [mm] + double thisCG_R = 0.0; + + // Loop over hits in container + for (LArHit* const& hit : *container) { + + GeoLArHit fcalhit(*hit); + + if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) { + ATH_MSG_WARNING("Hit in LarHitContainer is not a GeoFCalHit"); + continue; + } + + double energy = fcalhit.Energy(); + int module_index = fcalhit.getDetDescrElement()->getLayer(); + + double x = fcalhit.getDetDescrElement()->x(); + double y = fcalhit.getDetDescrElement()->y(); + + // Determine center of cluster + if (module_index == 1) { + // FCal1 + double x_subcheck1 = m_cx1 - x; + double y_subcheck1 = m_cy1 - y; + thisCG_R = sqrt(x_subcheck1 * x_subcheck1 + y_subcheck1 * y_subcheck1); + + if (thisCG_R <= subClusterSize) { + xNumer1 += x * energy; + yNumer1 += y * energy; + Denom1 += energy; + } + } + else if (module_index == 2) { + // FCal2 + double x_subcheck2 = m_cx2 - x; + double y_subcheck2 = m_cy2 - y; + thisCG_R = sqrt(x_subcheck2 * x_subcheck2 + y_subcheck2 * y_subcheck2); + + if (thisCG_R <= subClusterSize) { + xNumer2 += x * energy; + yNumer2 += y * energy; + Denom2 += energy; + } + } + else if (module_index == 3) { + // FCal3 + double x_subcheck3 = m_cx3 - x; + double y_subcheck3 = m_cy3 - y; + thisCG_R = sqrt(x_subcheck3 * x_subcheck3 + y_subcheck3 * y_subcheck3); + + if (thisCG_R <= subClusterSize) { + xNumer3 += x * energy; + yNumer3 += y * energy; + Denom3 += energy; + } + } + + } // End loop over hits in container + + if (fabs(Denom1) > 0.0) { + m_x_cc1 = xNumer1 / Denom1; + m_y_cc1 = yNumer1 / Denom1; + } + + if (fabs(Denom2) > 0.0) { + m_x_cc2 = xNumer2 / Denom2; + m_y_cc2 = yNumer2 / Denom2; + } + + if (fabs(Denom3) > 0.0) { + m_x_cc3 = xNumer3 / Denom3; + m_y_cc3 = yNumer3 / Denom3; + } +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Calibration hit analysis + +StatusCode LArFCalSamplingFraction::doCalib() +{ + StatusCode sc; + + ATH_MSG_DEBUG("Starting FCal Calibration Analysis"); + + // Get the calibration hit containers (if any) + for (m_calibHitMap_ptr_t i = m_calibHitMap.begin(); + i != m_calibHitMap.end(); + i++) + { + std::string name = (*i).first; + const CaloCalibrationHitContainer *container = 0; + sc = evtStore()->retrieve(container, name); + + if (sc.isFailure() || container == 0) { + ATH_MSG_ERROR("CaloCalibrationHit container was not found"); + m_numHitsActive = 0; + m_numHitsInactive = 0; + m_numHitsDead = 0; + (*i).second = 0; + + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("CaloCalibrationHit container successfully retrieved"); + + (*i).second = container; + } + + // Get the number of hits in each container + // (The braces let us re-use the name 'container') + { + const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitActive"]; + + if (container != 0) + m_numHitsActive = container->Size(); + else + m_numHitsActive = 0; + } + { + const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitInactive"]; + + if (container != 0) + m_numHitsInactive = container->Size(); + else + m_numHitsInactive = 0; + } + { + const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitDeadMaterial"]; + + if (container != 0) + m_numHitsDead = container->Size(); + else + m_numHitsDead = 0; + } + + // Loop over all the hit containers, inspecting each hit within the collection + for (m_calibHitMap_ptr_t i = m_calibHitMap.begin(); + i != m_calibHitMap.end(); + i++) + { + std::string name = (*i).first; + const CaloCalibrationHitContainer *container = (*i).second; + + // Skip rest of loop if it's a null container. + if (container == 0) + continue; + + // Loop over calibration hits in container + for (CaloCalibrationHit* const& calibhit : *container) { + + Identifier identifier = calibhit->cellID(); + double energy = calibhit->energyTotal(); + + // Accumulate energy sums. Use the ID helpers to determine in which + // detector the hit took place. + + m_totalCalibrationEnergy += energy; + m_totalEmEnergy += calibhit->energyEM(); + m_totalNonEmEnergy += calibhit->energyNonEM(); + m_totalInvisibleEnergy += calibhit->energyInvisible(); + m_totalEscapedEnergy += calibhit->energyEscaped(); + + if (name == "LArCalibrationHitActive") + m_totalActiveEnergy += energy; + + if (name == "LArCalibrationHitInactive") + m_totalInactiveEnergy += energy; + + if (name == "LArCalibrationHitDeadMaterial") { + m_totalDeadMaterialEnergy += energy; + + if (m_caloDmID->is_lar(identifier) && (m_caloDmID->sampling(identifier) == 3) && (m_caloDmID->dmat(identifier) == 1)) + m_FCalDead += energy; + } + + if (m_caloCellID->is_lar_fcal(identifier)) + FCalCalibAnalysis(name, calibhit); + + } // End loop over calibration hits in container + } // End loop over containers + + // Execution completed + + ATH_MSG_DEBUG("doCalib() completed successfully"); + return sc; +} + + +/////////////////////////////////////////////////////////////////////////////// +/// FCal Analysis with Calibration Hits on +/// Added by JPA, June 2005 + +void LArFCalSamplingFraction::FCalCalibAnalysis(const std::string name, const CaloCalibrationHit *CalibHit) +{ + Identifier id = CalibHit->cellID(); + double energy = CalibHit->energyTotal(); + + m_totalFCalCalibrationEnergy += energy; + //// Added by JPA Feb. 2005 + m_FCalEm += CalibHit->energyEM(); + m_FCalNonEm += CalibHit->energyNonEM(); + m_FCalInvisible += CalibHit->energyInvisible(); + m_FCalEscaped += CalibHit->energyEscaped(); + + if (m_larFCalID->module(id) == 1) { + // FCal1 + m_totalFCal1CalibrationEnergy += energy; + m_FCal1Em += CalibHit->energyEM(); + m_FCal1NonEm += CalibHit->energyNonEM(); + m_FCal1Invisible += CalibHit->energyInvisible(); + m_FCal1Escaped += CalibHit->energyEscaped(); + } + else if (m_larFCalID->module(id) == 2) { + // FCal2 + m_totalFCal2CalibrationEnergy += energy; + m_FCal2Em += CalibHit->energyEM(); + m_FCal2NonEm += CalibHit->energyNonEM(); + m_FCal2Invisible += CalibHit->energyInvisible(); + m_FCal2Escaped += CalibHit->energyEscaped(); + } + else if (m_larFCalID->module(id) == 3) { + // FCal3 + m_totalFCal3CalibrationEnergy += energy; + m_FCal3Em += CalibHit->energyEM(); + m_FCal3NonEm += CalibHit->energyNonEM(); + m_FCal3Invisible += CalibHit->energyInvisible(); + m_FCal3Escaped += CalibHit->energyEscaped(); + } + + if (name == "LArCalibrationHitActive") { + m_FCalActive += energy; + m_FCalActiveEm += CalibHit->energyEM(); + m_FCalActiveNonEm += CalibHit->energyNonEM(); + m_FCalActiveInvisible += CalibHit->energyInvisible(); + m_FCalActiveEscaped += CalibHit->energyEscaped(); + + if (m_larFCalID->module(id) == 1) + m_FCal1Active += energy; + + if (m_larFCalID->module(id) == 2) + m_FCal2Active += energy; + + if (m_larFCalID->module(id) == 3) + m_FCal3Active += energy; + } + + if (name == "LArCalibrationHitInactive") { + m_FCalInactive += energy; + + if (m_larFCalID->module(id) == 1) + m_FCal1Inactive += energy; + + if (m_larFCalID->module(id) == 2) + m_FCal2Inactive += energy; + + if (m_larFCalID->module(id) == 3) + m_FCal3Inactive += energy; + } +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Calculate truth impact position + +void LArFCalSamplingFraction::TruthImpactPosition(McEventCollection::const_iterator e) +{ + for (HepMC::GenEvent::particle_const_iterator p = (**e).particles_begin(); + p != (**e).particles_end(); p++) + { + const HepMC::GenParticle *theParticle = *p; + + // Note: old GenParticles used HepLorentzVectors, now they use HepMC::FourVectors + + // Get the kinematic variables + HepMC::FourVector HMCmom = theParticle->momentum(); + CLHEP::HepLorentzVector momentum(CLHEP::Hep3Vector(HMCmom.px(), HMCmom.py(), HMCmom.pz()), HMCmom.e()); + + HepMC::FourVector HMC3vec = theParticle->production_vertex()->position(); + HepGeom::Point3D<double> origin = HepGeom::Point3D<double>(HMC3vec.x(), HMC3vec.y(), HMC3vec.z()); + + // Put VEta and VPhi into the Ntuple + m_vertex_phi = momentum.vect().phi(); + m_vertex_eta = -log(tan(momentum.vect().theta() / 2)); + + if (!finite(m_vertex_eta)) + m_vertex_eta = 0; + + m_pt = momentum.vect().perp(); + + m_px = momentum.px(); + m_py = momentum.py(); + m_pz = momentum.pz(); + + m_E = momentum.e(); + + m_vertx = theParticle->production_vertex()->position().x(); + m_verty = theParticle->production_vertex()->position().y(); + m_vertz = theParticle->production_vertex()->position().z(); + + // Must get x-offset depending on TB position. The 90.0 mm is from the + // initial x-offset of FCal in cryostat. The -15.0 mm is from the + // initial y-offset of FCal in cryostat. The second number changes + // between different positions (these numbers will be in database soon) + + std::string nickname; + double xoffset = 0; + double sinangle = 0; + double yoffset = 0; + const double z1 = -32668.5 * CLHEP::mm; // This is 4668.5 (z=0 to FCal1 Face) + 28000 (B9 to z=0) + const double z2 = -33128.3 * CLHEP::mm; // This is 5128.3 (z=0 to FCal1 Face) + 28000 (B9 to z=0) + const double z3 = -33602.8 * CLHEP::mm; // This is 5602.8 (z=0 to FCal1 Face) + 28000 (B9 to z=0) + + double shift2 = sinangle * (5128.3 - 4668.5) * CLHEP::mm; + double shift3 = sinangle * (5602.8 - 4668.5) * CLHEP::mm; + + // Accounts for rotation of Fcal + cryostat. + m_x_mc_cc1 = origin.x() + m_px * z1 / m_pz + xoffset; + m_y_mc_cc1 = origin.y() + m_py * z1 / m_pz + yoffset; + + m_x_mc_cc2 = origin.x() + m_px * z2 / m_pz + shift2 + xoffset; + m_y_mc_cc2 = origin.y() + m_py * z2 / m_pz + yoffset; + + m_x_mc_cc3 = origin.x() + m_px * z3 / m_pz + shift3 + xoffset; + m_y_mc_cc3 = origin.y() + m_py * z3 / m_pz + yoffset; + + } // particles +} + + +/////////////////////////////////////////////////////////////////////////////// +/// The main FCal analysis method + +StatusCode LArFCalSamplingFraction::doFCal() +{ + ATH_MSG_INFO("Starting main FCal analysis"); + + ATH_MSG_DEBUG("LArFCalSamplingFraction parameters are:"); + ATH_MSG_DEBUG("Calibration: " << m_calibrationRun); + + StatusCode sc; + + // ACCESSING EVENT INFORMATION + // Get the basic event information (run number, event number). + + const EventInfo *eventInfo = 0; + sc = evtStore()->retrieve(eventInfo); + + if (sc.isFailure()) { + ATH_MSG_ERROR("Could not fetch event information"); + return sc; + } + + const EventID *eventID = eventInfo->event_ID(); + m_runNumber = eventID->run_number(); + m_eventNumber = eventID->event_number(); + + ATH_MSG_INFO("Run " << m_runNumber << ", event " << m_eventNumber); + + // How to access MC Truth information: + const McEventCollection *mcEventCollection; + sc = evtStore()->retrieve(mcEventCollection, "TruthEvent"); + + if (sc.isSuccess()) { + // There can potentially be more than one MC event in the collection. + McEventCollection::const_iterator mcEvent; + int numMcEvent = 0; + + for (mcEvent = mcEventCollection->begin(); + mcEvent != mcEventCollection->end(); + mcEvent++, numMcEvent++) + TruthImpactPosition(mcEvent); + } // retrieved MC event collection + else { + ATH_MSG_DEBUG("Run " << m_runNumber << ", event " << m_eventNumber + << ": could not fetch MC event collection"); + } + + // Accessing Hits + // Regular hits + std::string FCalContainerName = "LArHitFCAL"; + const LArHitContainer *container = 0; + sc = evtStore()->retrieve(container, FCalContainerName); + + if (sc.isFailure() || container == 0) { + ATH_MSG_ERROR("LArHitFCAL container was not found"); + m_numHitsFCal = 0; + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("LArHitFCAL container successfully retrieved"); + + // Get the number of hits in the LArHitFCAL container + m_numHitsFCal = container->size(); + ATH_MSG_INFO("NumHitsFCal = " << m_numHitsFCal); + + if (m_numHitsFCal > 0) { + // Calculate the center of gravity + FCalHitCenter(container); + FCalClusterCenter(container); + } + + // Loop over hits in container + for (LArHit* const& hit : *container) { + + GeoLArHit fcalhit(*hit); + + // Added by JPA to get particle id for each hit + const McEventCollection *mcEventCollection; + sc = evtStore()->retrieve(mcEventCollection, "TruthEvent"); + + if (sc.isSuccess()) { + // There can potentially be more than one MC event in the collection + McEventCollection::const_iterator mcEvent; + int numParticles = 0; + + for (mcEvent = mcEventCollection->begin(); + mcEvent != mcEventCollection->end(); + mcEvent++) + { + // There may be many particles per event + for (HepMC::GenEvent::particle_const_iterator p = (**mcEvent).particles_begin(); + p != (**mcEvent).particles_end(); + p++) + { + const HepMC::GenParticle *theParticle = *p; + m_pdg_id->push_back(theParticle->pdg_id()); + numParticles++; + } + } + } // retrieved MC event collection + + // End JPA particle id + + if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) { + ATH_MSG_ERROR("GeoFCalHit is not defined"); + } + + double energy = fcalhit.Energy(); + int module_index = fcalhit.getDetDescrElement()->getLayer(); + m_totalFCalEnergy += energy; + + if (module_index == 1) { + m_FCal1_SumE += energy; + FillCellInfo(fcalhit, m_cell1_E, m_hit_x1, m_hit_y1, m_hit_ieta1, m_hit_iphi1, m_NCell1); + } + else if (module_index == 2) { + m_FCal2_SumE += energy; + FillCellInfo(fcalhit, m_cell2_E, m_hit_x2, m_hit_y2, m_hit_ieta2, m_hit_iphi2, m_NCell2); + } + else if (module_index == 3) { + m_FCal3_SumE += energy; + FillCellInfo(fcalhit, m_cell3_E, m_hit_x3, m_hit_y3, m_hit_ieta3, m_hit_iphi3, m_NCell3); + } + } // End loop over hits in container + + // Calibration hit analysis. + if (m_calibrationRun) + CHECK(doCalib()); + + ATH_MSG_DEBUG("doFCal() completed successfully"); + + return StatusCode::SUCCESS; +} + + +/////////////////////////////////////////////////////////////////////////////// +/// Fill FCal cell information + +void LArFCalSamplingFraction::FillCellInfo(const GeoLArHit &fcalhit, std::vector<double> *cell_E, + std::vector<double> *hit_x, std::vector<double> *hit_y, + std::vector<double> *hit_ieta, std::vector<double> *hit_iphi, + int &NCell) +{ + const double energy = fcalhit.Energy(); + + //const FCALTile *tile = fcalhit.getTile(); + const double hitx = fcalhit.getDetDescrElement()->x(); //tile->getX(); + const double hity = fcalhit.getDetDescrElement()->y(); //tile->getY(); + const double hiteta = 7; //tile->getIndexI(); + const double hitphi = 7; //tile->getIndexJ(); + + bool cellHit = true; + + if (NCell != 0) { + for (int icell = 0; icell < NCell; icell++) { + if ((hitx == hit_x->at(icell)) && (hity == hit_y->at(icell))) { + cellHit = false; + cell_E->at(icell) += energy; + break; + } + } + } + + if (cellHit) { + cell_E->push_back(energy); + hit_x->push_back(hitx); + hit_y->push_back(hity); + hit_ieta->push_back(hiteta); + hit_iphi->push_back(hitphi); + NCell += 1; + } +} + + +////////////////////////////////////////////////////////////////////////////////// +/// Execute (event by event) + +StatusCode LArFCalSamplingFraction::execute() +{ + ATH_MSG_DEBUG(" in execute()"); + + m_eventNumber++; + + // Initialize first before processing each event + StatusCode sc = initEvent(); + + if (sc.isFailure()) + ATH_MSG_WARNING("initEvent failed. Continue"); + + sc = doFCal(); + + sc = addEventInfo(); + + if (sc.isFailure()) { + ATH_MSG_WARNING("Failure in getEventInfo() "); + return StatusCode::SUCCESS; + } + + m_tree_AS->Fill(); + + return StatusCode::SUCCESS; +} + + +StatusCode LArFCalSamplingFraction::addEventInfo() +{ + ATH_MSG_DEBUG("in addEventInfo()"); + + // This code has been taken from AnalysisExamples/VFitZmmOnAOD + // I have the actual EventNumber, but skipped the sequential count of event # + + // Get EventInfo for run and event number + const EventInfo *eventInfo; + StatusCode sc = evtStore()->retrieve(eventInfo); + + if (sc.isFailure()) { + ATH_MSG_WARNING("Could not retrieve event info"); + return sc; + } + + const EventID *myEventID = eventInfo->event_ID(); + + m_runNumber = myEventID->run_number(); + m_eventNumber = myEventID->event_number(); + ATH_MSG_DEBUG("event " << m_eventNumber); + + m_eventTime = myEventID->time_stamp(); + m_lumiBlock = myEventID->lumi_block(); + m_bCID = myEventID->bunch_crossing_id(); + + const EventType *myEventType = eventInfo->event_type(); + + if (myEventType != 0) + m_eventWeight = myEventType->mc_event_weight(); + + else + m_eventWeight = -999; + + return StatusCode::SUCCESS; +} diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h new file mode 100644 index 0000000000000000000000000000000000000000..525b4704501dda32611103046704f8cde2432a1f --- /dev/null +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h @@ -0,0 +1,218 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LAR_FCAL_SAMPLING_FRACTION_H +#define LAR_FCAL_SAMPLING_FRACTION_H + +// C++ stdlib +#include <string> + +// ATLAS Software +#include "AthenaBaseComps/AthAlgorithm.h" +#include "CLHEP/Units/SystemOfUnits.h" +#include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/ObjectVector.h" +#include "GaudiKernel/ToolHandle.h" +#include "GeneratorObjects/McEventCollection.h" +#include "GeoAdaptors/GeoLArHit.h" +#include "LArSimEvent/LArHit.h" +#include "LArSimEvent/LArHitContainer.h" +#include "StoreGate/StoreGateSvc.h" + +class JetCollection; +class ISvcLocator; +class StoreGateSvc; +class LArFCAL_ID; +class CaloDM_ID; +class CaloCell_ID; +class LArHitContainer; +class CaloCalibrationHit; +class CaloCalibrationHitContainer; +class CaloDetDescrManager; +class TCECollection; +class TCEnergies; + + +class LArFCalSamplingFraction : public AthAlgorithm +{ +public: + LArFCalSamplingFraction(const std::string &name, ISvcLocator *pSvcLocator); + ~LArFCalSamplingFraction(); + + virtual StatusCode initialize(); + virtual StatusCode finalize(); + virtual StatusCode execute(); + virtual StatusCode initEvent(); + StatusCode doFCal(); + void TruthImpactPosition(McEventCollection::const_iterator); + + void FCalCalibAnalysis(const std::string name, const CaloCalibrationHit *CalibHit); + void FCalClusterCenter(const LArHitContainer *container); + void FCalHitCenter(const LArHitContainer *container); + void FillCellInfo(const GeoLArHit &fcalhit, std::vector<double> *cell_E, + std::vector<double> *hit_x, std::vector<double> *hit_y, + std::vector<double> *hit_ieta, std::vector<double> *hit_iphi, + int &NCell); + StatusCode doCalib(); + +private: + /** methods called by execute() */ + + // To add event info to new ntuple (used to go by default in CollectionTree) + StatusCode addEventInfo(); + +private: + /** Athena-Aware Ntuple (AAN) variables - branches of the AAN TTree */ + TTree *m_tree_AS; + + unsigned int m_runNumber; + unsigned int m_eventNumber; + unsigned int m_eventTime; + unsigned int m_lumiBlock; + unsigned int m_bCID; + double m_eventWeight; + + /* ----- FCal-related variables ----- */ + double m_vertx; // x-position for vertex generated particle (beam) + double m_verty; + double m_vertz; + + double m_vertex_eta; // eta value of generated particle + double m_vertex_phi; + + double m_pt; // Momentum of generated particle + double m_px; + double m_py; + double m_pz; + + double m_E; // Energy of generated particle + + int m_NCell1; // Number of cells hit + int m_NCell2; + int m_NCell3; + + double m_x_mc_cc1; // Center of cluster in x (FCal1, extrapolated) + double m_y_mc_cc1; + + double m_x_mc_cc2; // Center of cluster in x (FCal2, extrapolated) + double m_y_mc_cc2; + + double m_x_mc_cc3; // Center of cluster in x (FCal3, extrapolated) + double m_y_mc_cc3; + + double m_x_cc1; // Center of cluster in x (FCal1, c of g) + double m_y_cc1; + + double m_x_cc2; // Center of cluster in x (FCal2, c of g) + double m_y_cc2; + + double m_x_cc3; // Center of cluster in x (FCal3, c of g) + double m_y_cc3; + + std::vector<int> *m_pdg_id; // particle id + + std::vector<double> *m_hit_x1; // hit positions of cells + std::vector<double> *m_hit_y1; + + std::vector<double> *m_hit_x2; + std::vector<double> *m_hit_y2; + + std::vector<double> *m_hit_x3; + std::vector<double> *m_hit_y3; + + std::vector<double> *m_hit_ieta1; // hit indices of cells + std::vector<double> *m_hit_iphi1; + std::vector<double> *m_hit_ieta2; + std::vector<double> *m_hit_iphi2; + std::vector<double> *m_hit_ieta3; + std::vector<double> *m_hit_iphi3; + + std::vector<double> *m_cell1_E; // Energy in cells + std::vector<double> *m_cell2_E; + std::vector<double> *m_cell3_E; + + double m_FCal1_SumE; // Energy in individual FCal modules + double m_FCal2_SumE; + double m_FCal3_SumE; + double m_TCScint_E; + double m_TCIron_E; + + double m_totalFCalEnergy; + int m_numHitsFCal; + + /* ----- Calibration Hits Variables ----- */ + double m_totalCalibrationEnergy; // Total energy + + // Physic processes + double m_totalEmEnergy; + double m_totalNonEmEnergy; + double m_totalInvisibleEnergy; + double m_totalEscapedEnergy; + + // Energy deposited in different material categories + double m_totalActiveEnergy; + double m_totalInactiveEnergy; + double m_totalDeadMaterialEnergy; + + // Number of hits in different material categories + int m_numHitsActive; + int m_numHitsInactive; + int m_numHitsDead; + + // Total energy deposited in the different FCal Modules + double m_totalFCalCalibrationEnergy; // Energy in all FCal + double m_totalFCal1CalibrationEnergy; + double m_totalFCal2CalibrationEnergy; + double m_totalFCal3CalibrationEnergy; + + double m_FCalActive; + double m_FCalInactive; + double m_FCalDead; + double m_FCalActiveEm; + double m_FCalActiveNonEm; + double m_FCalActiveInvisible; + double m_FCalActiveEscaped; + double m_FCalEm; + double m_FCal1Em; + double m_FCal2Em; + double m_FCal3Em; + double m_FCalNonEm; + double m_FCal1NonEm; + double m_FCal2NonEm; + double m_FCal3NonEm; + double m_FCalInvisible; + double m_FCal1Invisible; + double m_FCal2Invisible; + double m_FCal3Invisible; + double m_FCalEscaped; + double m_FCal1Escaped; + double m_FCal2Escaped; + double m_FCal3Escaped; + double m_PhysTotE; + double m_FCal1Active; + double m_FCal2Active; + double m_FCal3Active; + double m_FCal1Inactive; + double m_FCal2Inactive; + double m_FCal3Inactive; + + const CaloDM_ID *m_caloDmID; + const CaloCell_ID *m_caloCellID; + const LArFCAL_ID *m_larFCalID; + + // For LAr analysis: Do we have any calibration hits at all? + bool m_calibrationRun; + + // In order to write some clever loops, store all the hit containers + // of a given type in a map. + typedef std::map<std::string, const CaloCalibrationHitContainer *> m_calibHitMap_t; + typedef m_calibHitMap_t::iterator m_calibHitMap_ptr_t; + m_calibHitMap_t m_calibHitMap; + + // Variables needed for cluster centers + double m_cx1, m_cx2, m_cx3; + double m_cy1, m_cy2, m_cy3; +}; + +#endif // LAR_FCAL_SAMPLING_FRACTION_H diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx index ce7ff66556fa8e9596951aefb42ee04d47ef0f41..fc5934fe7f5e0cc3ca083aa9f8f2a5046dfdc035 100755 --- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx @@ -1,4 +1,6 @@ #include "../LarEMSamplingFraction.h" +#include "../LArFCalSamplingFraction.h" DECLARE_COMPONENT( LarEMSamplingFraction ) +DECLARE_COMPONENT( LArFCalSamplingFraction ) diff --git a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx index 03eb2d3bfbfae4aebb33d710ea429609f929da63..217f16dfbc99c839d22fbd9bb5d194fa42422037 100644 --- a/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx +++ b/Simulation/Tools/RDOAnalysis/src/SCT_RDOAnalysis.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RDOAnalysis.h" @@ -369,7 +369,7 @@ StatusCode SCT_RDOAnalysis::execute() { m_h_brlGroupSize->Fill(sctGroupSize); m_h_brl_phi_v_eta->Fill(sctEtaMod, sctPhiMod); } - else if (abs(sctBrlEc) == 2) { + else if (std::abs(sctBrlEc) == 2) { m_h_ecDisk->Fill(sctLayerDisk); m_h_ecPhiMod->Fill(sctPhiMod); m_h_ecEtaMod->Fill(sctEtaMod); diff --git a/TileCalorimeter/TileCalib/TileCalibBlobPython/CMakeLists.txt b/TileCalorimeter/TileCalib/TileCalibBlobPython/CMakeLists.txt index 37943a4c6a3b6da35b465adb2406ca8a3826317d..ef2e482ff36af47ddd0bae3033f4186e14684b74 100644 --- a/TileCalorimeter/TileCalib/TileCalibBlobPython/CMakeLists.txt +++ b/TileCalorimeter/TileCalib/TileCalibBlobPython/CMakeLists.txt @@ -9,14 +9,6 @@ atlas_subdir( TileCalibBlobPython ) find_package( cx_Oracle ) # Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) atlas_install_scripts( share/*.py ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) diff --git a/TileCalorimeter/TileConditions/CMakeLists.txt b/TileCalorimeter/TileConditions/CMakeLists.txt index d4a60773c20eda04353f1b5e93cc7e149104ca44..d36e537a108c2a26d6f7cb8845c8d5642e7d0bfa 100644 --- a/TileCalorimeter/TileConditions/CMakeLists.txt +++ b/TileCalorimeter/TileConditions/CMakeLists.txt @@ -90,7 +90,7 @@ atlas_add_test( TileDCSComponents_test # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/*.txt share/Tile2003.* share/Tile2004.* share/TileDefault.* share/TileNo*.* share/dleak*.dat share/dsleak*.dat share/leak*.dat share/dpulse*.dat share/pulse*.dat share/noise*.dat share/ai_lo*.dat share/ai_hi*.dat share/bi_lo*.dat share/bi_hi*.dat share/ci_lo*.dat share/ci_hi*.dat share/DCS*.dat share/BadHVChannels.dat share/wiener*.dat) @@ -126,10 +126,3 @@ if( NOT SIMULATIONBASE ) POST_EXEC_SCRIPT nopost.sh) endif() - - -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py - POST_EXEC_SCRIPT nopost.sh ) - diff --git a/TileCalorimeter/TileConfiguration/CMakeLists.txt b/TileCalorimeter/TileConfiguration/CMakeLists.txt index 15c1b7daf8676d110f49b28e8422a0f433c063f7..984219197d269497f06e6cd0d50d0a4912fbc591 100644 --- a/TileCalorimeter/TileConfiguration/CMakeLists.txt +++ b/TileCalorimeter/TileConfiguration/CMakeLists.txt @@ -6,13 +6,9 @@ atlas_subdir( TileConfiguration ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +# Tests: if( NOT SIMULATIONBASE ) atlas_add_test( TileConfigFlagsTest diff --git a/TileCalorimeter/TileCoolDcs/CMakeLists.txt b/TileCalorimeter/TileCoolDcs/CMakeLists.txt index 0879b8a611306bf902cb6b1937b0cc63523abfc6..acc2cccb509f567e64675ac254b46bab4b412e09 100644 --- a/TileCalorimeter/TileCoolDcs/CMakeLists.txt +++ b/TileCalorimeter/TileCoolDcs/CMakeLists.txt @@ -6,14 +6,6 @@ atlas_subdir( TileCoolDcs ) # Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_scripts( share/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_scripts( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) atlas_install_runtime( share/*.dat ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) diff --git a/TileCalorimeter/TileCoolDcs/python/ProgressBar.py b/TileCalorimeter/TileCoolDcs/python/ProgressBar.py index 5921a45dab8689d81ac3088399a4bc805533ef9c..b1d19400c3924d03d1bc5ff681e167cfc9a7cf9f 100755 --- a/TileCalorimeter/TileCoolDcs/python/ProgressBar.py +++ b/TileCalorimeter/TileCoolDcs/python/ProgressBar.py @@ -1,4 +1,5 @@ -#!/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + import sys class progressBar: diff --git a/TileCalorimeter/TileCoolDcs/python/TileDCSDataGrabber.py b/TileCalorimeter/TileCoolDcs/python/TileDCSDataGrabber.py index 31a420c1329fa360354bd1b8020d3ec26356af52..c24c9c79498927a848ee8a3b1180a2391b5442db 100755 --- a/TileCalorimeter/TileCoolDcs/python/TileDCSDataGrabber.py +++ b/TileCalorimeter/TileCoolDcs/python/TileDCSDataGrabber.py @@ -1,4 +1,4 @@ -#!/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Author: nils.gollub@cern.ch from __future__ import print_function diff --git a/TileCalorimeter/TileCoolDcs/python/TileDCSDataInfo.py b/TileCalorimeter/TileCoolDcs/python/TileDCSDataInfo.py index 4601127c4eb35224a1ec548bd7a0f2ea3ebf0ea8..ba98bdcb723a210da34addf166d7da101b99d2b0 100755 --- a/TileCalorimeter/TileCoolDcs/python/TileDCSDataInfo.py +++ b/TileCalorimeter/TileCoolDcs/python/TileDCSDataInfo.py @@ -1,4 +1,4 @@ -#!/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Author: nils.gollub@cern.ch from __future__ import print_function @@ -60,6 +60,7 @@ class TileDCSDataInfo: "5VHV_OUTPUT_I" : [ LVPS_AI, type_float], "5VHV_OUTPUT_V" : [ LVPS_AI, type_float], "15VMB_INPUT_V" : [ LVPS_AI, type_float], + "5VHV_TEMP2" : [ LVPS_AI, type_float], "5VHV_TEMP3" : [ LVPS_AI, type_float], "15VHV_TEMP3" : [ LVPS_AI, type_float], diff --git a/TileCalorimeter/TileCoolDcs/python/__init__.py b/TileCalorimeter/TileCoolDcs/python/__init__.py index 36af10244e73a475759c651eeffdcaf32b0b30be..72e682f26964fdd02c6eb95b4f3bc6c89d02e5e9 100755 --- a/TileCalorimeter/TileCoolDcs/python/__init__.py +++ b/TileCalorimeter/TileCoolDcs/python/__init__.py @@ -1,4 +1,4 @@ -# File TileCoolDcs/python/__init__.py +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Author: nils.gollub@cern.ch __author__="Nils Gollub" diff --git a/TileCalorimeter/TileCosmicAlgs/CMakeLists.txt b/TileCalorimeter/TileCosmicAlgs/CMakeLists.txt index 8de98fe6659ea2a4ddf9ca5b10da2d559c2d3676..4484267451ace29f1cbb88e7eb9aea324f8d7921 100644 --- a/TileCalorimeter/TileCosmicAlgs/CMakeLists.txt +++ b/TileCalorimeter/TileCosmicAlgs/CMakeLists.txt @@ -34,14 +34,10 @@ atlas_add_component( TileCosmicAlgs # Install files from the package: atlas_install_headers( TileCosmicAlgs ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - +# Tests: atlas_add_test( TileMuonFitterConfig_test SCRIPT python -m TileCosmicAlgs.TileMuonFitterConfig PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py index eb01ad1c38c5f76756e3c50e869c7833ae17c07e..1fdf48a9284d6a2e5dc84a8c4a104a6d72e79680 100644 --- a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py +++ b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py @@ -206,8 +206,10 @@ else: Year = 2017 elif RunNumber < 367980: Year = 2018 - else: + elif RunNumber < 374260: Year = 2019 + else: + Year = 2020 if 'RunStream' in dir(): @@ -615,6 +617,13 @@ if not 'doCaloCell' in dir(): if not 'TileD3PDSavePosition' in dir(): TileD3PDSavePosition = False +if not 'TileFragIDsToIgnoreDMUErrors' in dir(): + # List of Tile module frag IDs for which ignore DMU errors + if RunNumber > 370000: + TileFragIDsToIgnoreDMUErrors = [0x10D] # Tile Demonstrator + else: + TileFragIDsToIgnoreDMUErrors = [] + #--------------- # end of options #--------------- @@ -716,8 +725,8 @@ else: # Set Global tag for IOVDbSvc if not 'CondDbTag' in dir(): if RUN2: - if 'UPD4' in dir() and UPD4: CondDbTag = 'CONDBR2-BLKPA-2018-03' - else: CondDbTag = 'CONDBR2-ES1PA-2018-02' + if 'UPD4' in dir() and UPD4: CondDbTag = 'CONDBR2-BLKPA-2018-13' + else: CondDbTag = 'CONDBR2-ES1PA-2018-05' else: if 'UPD4' in dir() and UPD4 and RunNumber > 141066: CondDbTag = 'COMCOND-BLKPA-RUN1-06' else: CondDbTag = 'COMCOND-ES1PA-006-05' @@ -831,11 +840,6 @@ if not 'newRDO' in dir() or newRDO is None: else: newRDO = True -if ReadPool and newRDO: - topSequence += CfgMgr.xAODMaker__EventInfoNonConstCnvAlg() -else: - from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg - topSequence+=xAODMaker__EventInfoCnvAlg() #============================================================ #=== configure BunchCrossingTool @@ -847,6 +851,9 @@ ToolSvc += BunchCrossingTool("LHC" if globalflags.DataSource() == "data" else "M #=== read ByteStream and reconstruct data #============================================================= tileRawChannelBuilderFitFilter = None +tileRawChannelBuilderFitFilterCool = None +tileRawChannelBuilderMF = None +tileRawChannelBuilderOF1 = None tileRawChannelBuilderOpt2Filter = None tileRawChannelBuilderOptATLAS = None tileRawChannelBuilderWienerFilter = None @@ -871,6 +878,9 @@ else: from TileRecUtils.TileRawChannelGetter import * theTileRawChannelGetter=TileRawChannelGetter() tileRawChannelBuilderFitFilter = theTileRawChannelGetter.TileRawChannelBuilderFitFilter() + tileRawChannelBuilderFitFilterCool = theTileRawChannelGetter.TileRawChannelBuilderFitFilterCool() + tileRawChannelBuilderMF = theTileRawChannelGetter.TileRawChannelBuilderMF() + tileRawChannelBuilderOF1 = theTileRawChannelGetter.TileRawChannelBuilderOF1() tileRawChannelBuilderOpt2Filter = theTileRawChannelGetter.TileRawChannelBuilderOpt2Filter() tileRawChannelBuilderOptATLAS = theTileRawChannelGetter.TileRawChannelBuilderOptATLAS() tileRawChannelBuilderWienerFilter = theTileRawChannelGetter.TileRawChannelBuilderWienerFilter() @@ -889,11 +899,11 @@ if doTileFit and tileRawChannelBuilderFitFilter: printfunc (tileRawChannelBuilderFitFilter) -if doTileFitCool: - ToolSvc.TileRawChannelBuilderFitFilterCool.MaxTimeFromPeak = 250.0; # recover behaviour of rel 13.0.30 - ToolSvc.TileRawChannelBuilderFitFilterCool.UseDSPCorrection = not TileBiGainRun +if doTileFitCool and tileRawChannelBuilderFitFilterCool: + tileRawChannelBuilderFitFilterCool.MaxTimeFromPeak = 250.0; # recover behaviour of rel 13.0.30 + tileRawChannelBuilderFitFilterCool.UseDSPCorrection = not TileBiGainRun - printfunc (ToolSvc.TileRawChannelBuilderFitFilterCool) + printfunc (tileRawChannelBuilderFitFilterCool) if doTileOpt2: @@ -920,35 +930,28 @@ if doTileOptATLAS and tileRawChannelBuilderOptATLAS: printfunc (tileRawChannelBuilderOptATLAS) -if doTileMF: +if doTileMF and tileRawChannelBuilderMF: if PhaseFromCOOL: - ToolSvc.TileRawChannelBuilderMF.correctTime = False; # do not need to correct time with best phase - - ToolSvc.TileRawChannelBuilderMF.BestPhase = PhaseFromCOOL; # Phase from COOL or assume phase=0 - ToolSvc.TileRawChannelBuilderMF.UseDSPCorrection = not TileBiGainRun - - if OfcFromCOOL and not doTileFitCool: - TilePulseTypes = {0 : 'PHY', 1 : 'PHY', 2 : 'LAS', 4 : 'PHY', 8 : 'CIS'} - TilePulse = TilePulseTypes[jobproperties.TileRecFlags.TileRunType()] + tileRawChannelBuilderMF.correctTime = False; # do not need to correct time with best phase - tileInfoConfigurator.setupCOOLPULSE(type = TilePulse) - tileInfoConfigurator.setupCOOLAutoCr() + tileRawChannelBuilderMF.BestPhase = PhaseFromCOOL; # Phase from COOL or assume phase=0 + tileRawChannelBuilderMF.UseDSPCorrection = not TileBiGainRun - printfunc (ToolSvc.TileRawChannelBuilderMF ) + printfunc (tileRawChannelBuilderMF ) -if doTileOF1: - ToolSvc.TileRawChannelBuilderOF1.PedestalMode = TileOF1Ped +if doTileOF1 and tileRawChannelBuilderOF1: + tileRawChannelBuilderOF1.PedestalMode = TileOF1Ped if PhaseFromCOOL: - ToolSvc.TileRawChannelBuilderOF1.correctTime = False # do not need to correct time with best phase + tileRawChannelBuilderOF1.correctTime = False # do not need to correct time with best phase - ToolSvc.TileRawChannelBuilderOF1.BestPhase = PhaseFromCOOL # Phase from COOL or assume phase=0 + tileRawChannelBuilderOF1.BestPhase = PhaseFromCOOL # Phase from COOL or assume phase=0 if TileCompareMode or TileEmulateDSP: - ToolSvc.TileRawChannelBuilderOF1.EmulateDSP = True # use dsp emulation - ToolSvc.TileRawChannelBuilderOF1.UseDSPCorrection = not TileBiGainRun + tileRawChannelBuilderOF1.EmulateDSP = True # use dsp emulation + tileRawChannelBuilderOF1.UseDSPCorrection = not TileBiGainRun - printfunc (ToolSvc.TileRawChannelBuilderOF1 ) + printfunc (tileRawChannelBuilderOF1) if doTileWiener and tileRawChannelBuilderWienerFilter: if PhaseFromCOOL: @@ -1282,8 +1285,9 @@ if doTileMon: histoPathBase = "/Tile/Digits", book2D = b2d, runType = runType, + FragIDsToIgnoreDMUErrors = TileFragIDsToIgnoreDMUErrors, FillPedestalDifference = True) - #ToolSvc += theTileDigitsMon + TileMon.AthenaMonTools += [ theTileDigitsMon ] printfunc (theTileDigitsMon) @@ -1293,8 +1297,9 @@ if doTileMon: histoPathBase = "/Tile/RawChannel", book2D = b2d, PlotDSP = useRODReco, + FragIDsToIgnoreDMUErrors = TileFragIDsToIgnoreDMUErrors, runType = runType ) - #ToolSvc += theTileRawChannelMon + TileMon.AthenaMonTools += [ theTileRawChannelMon ] theTileRawChannelMon.TileRawChannelContainer = "TileRawChannelCnt"; # default for simulation @@ -1359,7 +1364,6 @@ if doTileMon: if useRODReco: theTileDQFragMon.TileRawChannelContainerDSP = "TileRawChannelCnt" - #ToolSvc += theTileDQFragMon; TileMon.AthenaMonTools += [ theTileDQFragMon ]; printfunc (theTileDQFragMon) @@ -1372,7 +1376,7 @@ if doTileMon: negEnergyThreshold = -2000, energyThreshold = 300, histoPathBase = "/Tile/Cell"); - #ToolSvc += theTileCellMonHG; + TileMon.AthenaMonTools += [ theTileCellMonHG ]; printfunc (theTileCellMonHG) @@ -1388,7 +1392,6 @@ if doTileMon: #theTileCellMon.energyThreshold = 300. #theTileCellMon.energyThresholdForTime = 150. #theTileCellMon.FillTimeHistograms = True - #ToolSvc += theTileCellMon; TileMon.AthenaMonTools += [ theTileCellMon ]; printfunc (theTileCellMon) @@ -1397,10 +1400,11 @@ if doTileMon: OutputLevel = OutputLevel, TileDigitsContainer = "TileDigitsCnt", CheckDCS = TileUseDCS, + FragIDsToIgnoreDMUErrors = TileFragIDsToIgnoreDMUErrors, histoPathBase = "/Tile/DigiNoise" ); if not TileBiGainRun: TileDigiNoiseMon.TriggerTypes = [ 0x82 ] - #ToolSvc += TileDigiNoiseMon; + TileMon.AthenaMonTools += [ TileDigiNoiseMon ]; printfunc (TileDigiNoiseMon) @@ -1412,7 +1416,6 @@ if doTileMon: histoPathBase = "/Tile/CellNoise/LG"); TileCellNoiseMonLG.Xmin = -2000.; TileCellNoiseMonLG.Xmax = 2000.; - #ToolSvc += TileCellNoiseMonLG; TileMon.AthenaMonTools += [ TileCellNoiseMonLG ]; printfunc (TileCellNoiseMonLG) @@ -1424,7 +1427,6 @@ if doTileMon: histoPathBase = "/Tile/CellNoise/HG"); TileCellNoiseMonHG.Xmin = -300.; TileCellNoiseMonHG.Xmax = 300.; - #ToolSvc += TileCellNoiseMonHG; TileMon.AthenaMonTools += [ TileCellNoiseMonHG ]; printfunc (TileCellNoiseMonHG) @@ -1436,7 +1438,6 @@ if doTileMon: histoPathBase = "/Tile/CellNoise"); TileCellNoiseMon.Xmin = -2000.; TileCellNoiseMon.Xmax = 2000.; - #ToolSvc += TileCellNoiseMon; TileMon.AthenaMonTools += [ TileCellNoiseMon ]; printfunc (TileCellNoiseMon) @@ -1451,7 +1452,6 @@ if doTileMon: CheckDCS = TileUseDCS, TileRawChannelContainer = "TileRawChannelFit") - #ToolSvc += TileRawChannelTimeMon TileMon.AthenaMonTools += [ TileRawChannelTimeMon ]; printfunc (TileRawChannelTimeMon) @@ -1472,7 +1472,6 @@ if doTileMon: CheckDCS = TileUseDCS, SummaryUpdateFrequency = 0 ); - #ToolSvc += TileRawChannelNoiseMonLG; TileMon.AthenaMonTools += [ TileRawChannelNoiseMonLG ]; printfunc (TileRawChannelNoiseMonLG) @@ -1488,8 +1487,6 @@ if doTileMon: # doFit = True, SummaryUpdateFrequency = 0 ); - - #ToolSvc += TileRawChannelNoiseMonHG; TileMon.AthenaMonTools += [ TileRawChannelNoiseMonHG ]; printfunc (TileRawChannelNoiseMonHG) @@ -1509,7 +1506,6 @@ if doTileMon: # if not defined here, then by default all triggers will be considered TileRawChannelNoiseMon.TriggerTypes = [ 0x82 ]; - #ToolSvc += TileRawChannelNoiseMon; TileMon.AthenaMonTools += [ TileRawChannelNoiseMon ]; printfunc (TileRawChannelNoiseMon) diff --git a/TileCalorimeter/TileL2Algs/CMakeLists.txt b/TileCalorimeter/TileL2Algs/CMakeLists.txt index 2b5d846a62d636ca325f47cc1334a02ea4e535bb..4591d8771327c5e6c5b3973be09c9037661b009f 100644 --- a/TileCalorimeter/TileL2Algs/CMakeLists.txt +++ b/TileCalorimeter/TileL2Algs/CMakeLists.txt @@ -31,14 +31,10 @@ atlas_add_component( TileL2Algs LINK_LIBRARIES TileL2AlgsLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - +# Tests: atlas_add_test( TileL2Config_test SCRIPT python -m TileL2Algs.TileL2Config PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileL2Algs/python/TileL2Config.py b/TileCalorimeter/TileL2Algs/python/TileL2Config.py index 684d8e80b40078d0b323baf6810761468964896b..67dc0885b8ddc321dbc433fd1df2fbcfb57b1241 100644 --- a/TileCalorimeter/TileL2Algs/python/TileL2Config.py +++ b/TileCalorimeter/TileL2Algs/python/TileL2Config.py @@ -112,8 +112,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) - from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg - acc.merge( TrigBSReadCfg(ConfigFlags) ) + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge( ByteStreamReadCfg(ConfigFlags, ["TileRawChannelContainer/TileRawChannelCnt"]) ) acc.merge( TileRawChannelToL2OutputCfg(ConfigFlags, streamName = 'ESD') ) acc.getService('StoreGateSvc').Dump = True diff --git a/TileCalorimeter/TileMonitoring/CMakeLists.txt b/TileCalorimeter/TileMonitoring/CMakeLists.txt index 70ebbf7be696513ae0ebc0e1d89c73999c2fb849..edb3d276da5ccb1060d1352dc9e9491280a63439 100644 --- a/TileCalorimeter/TileMonitoring/CMakeLists.txt +++ b/TileCalorimeter/TileMonitoring/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 767269 2016-08-10 15:10:39Z aryzhov $ ################################################################################ # Package: TileMonitoring ################################################################################ @@ -56,14 +55,10 @@ atlas_add_component( TileMonitoring # Install files from the package: atlas_install_headers( TileMonitoring ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py - POST_EXEC_SCRIPT nopost.sh ) - +# Tests: atlas_add_test( TileCellMonitorAlgorithm_test SCRIPT python -m TileMonitoring.TileCellMonitorAlgorithm PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileMonitoring/src/TileRawChannelNoiseMonitorAlgorithm.cxx b/TileCalorimeter/TileMonitoring/src/TileRawChannelNoiseMonitorAlgorithm.cxx index 814105a20f0c3880b5f659fa58b24f415a45d236..c74b63afb2d3ba1066896bf265056ca5c33a2067 100644 --- a/TileCalorimeter/TileMonitoring/src/TileRawChannelNoiseMonitorAlgorithm.cxx +++ b/TileCalorimeter/TileMonitoring/src/TileRawChannelNoiseMonitorAlgorithm.cxx @@ -39,8 +39,6 @@ StatusCode TileRawChannelNoiseMonitorAlgorithm::initialize() { StatusCode TileRawChannelNoiseMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const { - using Tile = TileCalibUtils; - // In case you want to measure the execution time auto timer = Monitored::Timer("TIME_execute"); diff --git a/TileCalorimeter/TileRecAlgs/CMakeLists.txt b/TileCalorimeter/TileRecAlgs/CMakeLists.txt index 699eb266d6a70f56f440e49ebff62628083172a7..70e3e123be1b70f12c6a9328cd8b8b41399bdeaf 100644 --- a/TileCalorimeter/TileRecAlgs/CMakeLists.txt +++ b/TileCalorimeter/TileRecAlgs/CMakeLists.txt @@ -51,15 +51,10 @@ set_target_properties( TileRecAlgs_TileDigitsThresholdFilter_test PROPERTIES ENA # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - - +# Tests: atlas_add_test( MBTSTimeDiffEventInfoAlgConfig_test SCRIPT python -m TileRecAlgs.MBTSTimeDiffEventInfoAlgConfig PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py b/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py index f4aca096b0dadc6127000aeccb41ff403f49d16d..834bd1a21962686cef0ef763aa63156984e960d1 100644 --- a/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py +++ b/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py @@ -1,5 +1,9 @@ if not 'RUN2' in dir(): RUN2=True +if not 'RUCIO' in dir(): + RUCIO=True +if not 'WORKDIR' in dir(): + WORKDIR='.' if RUN2: from AthenaCommon.GlobalFlags import globalflags globalflags.DetGeo.set_Value_and_Lock('atlas') @@ -36,7 +40,7 @@ else: filter='RAW' if not 'WriteESD' in dir(): - WriteESD=True + WriteESD=False if not 'TileUseDCS' in dir(): TileUseDCS = True @@ -69,7 +73,12 @@ if not 'InputFile' in dir(): RunStream = ("express_express" if ReadESD else "physics_Main") if RUN2 else "physics_JetTauEtmiss" if not 'DataProject' in dir(): DataProject = "data18_13TeV" if RUN2 else "data12_8TeV" - if RUN2: + if RUCIO: + TopDir="/castor/cern.ch/grid/atlas/rucio/raw/%(D)s/%(S)s/%(R)08d" % {'D':DataProject, 'S':RunStream, 'R':RunNumber} + for f in popen("nsls %(path)s | grep %(filt)s | grep -v -i -e log -e tgz | sort -r | tail -1" % {'path': TopDir, 'filt':filter }): + temp=f.split('\n') + InputDirectory=TopDir+'/'+temp[0] + elif RUN2: TopDir="/eos/atlas/atlastier0/rucio/%(D)s/%(S)s/%(R)08d" % {'D':DataProject, 'S':RunStream, 'R':RunNumber} for f in popen("xrdfs eosatlas ls %(path)s | grep %(filt)s | grep -v -i -e log -e tgz | awk '{print $NF}' | sort -r | tail -1" % {'path': TopDir, 'filt':filter }): temp=f.split('\n') @@ -99,13 +108,23 @@ if not 'InputFile' in dir(): else: dummy="dummy.RAW.data" if path.isfile(dummy): InputFile=[dummy] else: InputFile=[] + first=1 for name in files: if InputDirectory.startswith('/castor'): - InputFile.append('rfio:'+InputDirectory+'/'+name) + if first: + if path.exists(WORKDIR+'/'+name): + print "Using file",name,"from workdir",WORKDIR + else: + print "Copying file",name,"from",InputDirectory,"to workdir",WORKDIR + popen("/lib64/ld-linux-x86-64.so.2 --library-path /usr/lib64 /usr/bin/xrdcp -s -OSsvcClass=t0atlas root://castoratlas/%(dir)s/%(file)s %(work)s" % {'dir': InputDirectory, 'file': name, 'work': WORKDIR}) + InputFile.append(WORKDIR+'/'+name) + else: + InputFile.append('root://castoratlas/'+InputDirectory+'/'+name+'?svcClass=t0atlas') elif InputDirectory.startswith('/eos'): InputFile.append('root://eosatlas.cern.ch/'+name) else: InputFile.append(InputDirectory+'/'+name) + first=0 #import glob #InputFile = glob.glob(InputDirectory) @@ -250,19 +269,30 @@ if not ReadESD: # (191920, 34336488) ] -from TileRecUtils.TileDQstatusDefault import TileDQstatusDefault -TileDQstatusDefault() - +from TileRecUtils.TileRecUtilsConf import TileDQstatusAlg from TileRecAlgs.TileRecAlgsConf import TileCellSelector -tileSelector = TileCellSelector('TileSelector') if ReadESD: - tileSelector.CellContainerName = "AllCalo" - tileSelector.DigitsContainerName = "TileDigitsFlt" - tileSelector.RawChannelContainerName = "TileRawChannelFlt" + dq = TileDQstatusAlg('TileDQstatusAlgSel', + TileRawChannelContainer = '', + TileDigitsContainer = '', + TileBeamElemContainer = '', + TileDQstatus = 'TileDQstatusSel') + tileSelector = TileCellSelector('TileSelector', + CellContainerName = "AllCalo", + DigitsContainerName = "TileDigitsFlt", + RawChannelContainerName = "TileRawChannelFlt", + TileDQstatus = 'TileDQstatusSel') else: - tileSelector.CellContainerName = "" - tileSelector.DigitsContainerName = "TileDigitsCnt" - tileSelector.RawChannelContainerName = "TileRawChannelCnt" + dq = TileDQstatusAlg('TileDQstatusAlgSel', + TileRawChannelContainer = 'TileRawChannelCnt', + TileDigitsContainer = 'TileDigitsCnt', + TileBeamElemContainer = '', + TileDQstatus = 'TileDQstatusSel') + tileSelector = TileCellSelector('TileSelector', + CellContainerName = "", + DigitsContainerName = "TileDigitsCnt", + RawChannelContainerName = "TileRawChannelCnt", + TileDQstatus = 'TileDQstatusSel') # example how to select events with completely masked cells in few drawers #tileSelector.DrawerToCheck=[0x30b,0x327,0x400] @@ -314,13 +344,20 @@ tileSelector.CheckDCS=TileUseDCS tileSelector.SkipMBTS=True tileSelector.CheckDMUs=True tileSelector.CheckJumps=True +tileSelector.OverflowLG=-0.1 tileSelector.CheckOverLG=True +tileSelector.UnderflowLG=0.1 +tileSelector.CheckUnderHG=False +tileSelector.OverflowHG=-1.1 tileSelector.CheckOverHG=False +tileSelector.UnderflowHG=2.1 +tileSelector.CheckUnderLG=False tileSelector.MaxVerboseCnt=20 tileSelector.OutputLevel=1 from AthenaCommon.AlgSequence import AlgSequence condSeq = AthSequencer("AthCondSeq") +condSeq.insert(len(condSeq), dq) condSeq.insert(len(condSeq), tileSelector) # get a handle on the job main sequence diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx index 5d23980a9334b6c38959d6384ba5db29c7c910ca..5df1dd3cee4431d2a8acb27582fd40b9ffebb302 100644 --- a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx +++ b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx @@ -10,7 +10,6 @@ #include "TileIdentifier/TileHWID.h" #include "TileCalibBlobObjs/TileCalibUtils.h" #include "TileConditions/TileCablingService.h" -#include "TileConditions/ITileBadChanTool.h" #include "TileConditions/TileInfo.h" // Calo includes @@ -46,19 +45,23 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc , m_const(0) , m_overLG(0) , m_overHG(0) + , m_underLG(0) + , m_underHG(0) , m_dqerr(0) , m_dmuerr(0) , m_warnerr(0) , m_tileID(0) , m_tileHWID(0) , m_cabling(0) - , m_tileBadChanTool("TileBadChanTool") , m_runNum(0) , m_lumiBlock(0) , m_evtNum(0) , m_evtBCID(0) , m_tileFlag(0) , m_tileError(0) + , m_readCells(true) + , m_readRawChannels(true) + , m_readDigits(true) , m_tileInfo(0) { @@ -123,6 +126,12 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc declareProperty( "CheckDMUs", m_checkDMUs = true); // global flag which allows to swithc on/off DMU checks declareProperty( "CheckOverLG" ,m_checkOverLG = true); // select events with overflow in low gain declareProperty( "CheckOverHG", m_checkOverHG = false); // select events with overflow in high gain + declareProperty( "CheckUnderLG", m_checkUnderLG = false); // select events with underflow in low gain + declareProperty( "CheckUnderHG", m_checkUnderHG = false); // select events with underflow in high gain + declareProperty( "OverflowLG", m_overflowLG = -0.1); // threshold for overflow in low gain (smaller than ADCmax by this value) + declareProperty( "OverflowHG", m_overflowHG = -1.1); // threshold for overflow in high gain (smaller than ADCmax by this value) + declareProperty( "UnderflowLG", m_underflowLG = 0.1); // threshold for underflow in low gain + declareProperty( "UnderflowHG", m_underflowHG = 2.1); // threshold for underflow in high gain declareProperty( "CheckWarning", m_checkWarning = false); // select events with warning status in TileCal status word declareProperty( "CheckError", m_checkError = false); // select events with error status in TileCal status word @@ -130,11 +139,7 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc declareProperty( "MaxVerboseCnt",m_maxVerboseCnt=20); // max number of verbose output lines about drawer off - declareProperty("TileBadChanTool", m_tileBadChanTool); - declareProperty("TileInfoName", m_infoName = "TileInfo"); - - declareProperty("TileDQstatus", m_dqStatusKey = "TileDQstatus"); } @@ -169,7 +174,7 @@ StatusCode TileCellSelector::initialize() { ATH_MSG_INFO( "Cell container " << ((m_cellContainerKey.key().empty()) ? "NOT SET" : m_cellContainerKey.key()) ); ATH_MSG_INFO( "Digits container " - << ((m_digitsContainerKey.key().empty()) ? "NOT SET" : m_digitsContName)); + << ((m_digitsContainerKey.key().empty()) ? "NOT SET" : m_digitsContainerKey.key())); ATH_MSG_INFO( "RawChannel container " << ((m_rawChannelContainerKey.key().empty()) ? "NOT SET" : m_rawChannelContainerKey.key())); @@ -177,13 +182,27 @@ StatusCode TileCellSelector::initialize() { ATH_MSG_INFO( "CheckDMUs " << ((m_checkDMUs) ? "true" : "false")); ATH_MSG_INFO( "CheckOverLG " << ((m_checkOverLG) ? "true" : "false")); ATH_MSG_INFO( "CheckOverHG " << ((m_checkOverHG) ? "true" : "false")); + ATH_MSG_INFO( "CheckUnderLG " << ((m_checkUnderLG) ? "true" : "false")); + ATH_MSG_INFO( "CheckUnderHG " << ((m_checkUnderHG) ? "true" : "false")); + + if (m_overflowLG < 0) m_overflowLG += m_tileInfo->ADCmax(); + if (m_overflowHG < 0) m_overflowHG += m_tileInfo->ADCmax(); + ATH_MSG_INFO( "OverflowLG " << m_overflowLG); + ATH_MSG_INFO( "OverflowHG " << m_overflowHG); + ATH_MSG_INFO( "UnderflowLG " << m_underflowLG); + ATH_MSG_INFO( "UnderflowHG " << m_underflowHG); ATH_MSG_INFO( "SkipEmpty " << ((m_skipEmpty) ? "true" : "false")); ATH_MSG_INFO( "SkipMasked " << ((m_skipMasked) ? "true" : "false")); ATH_MSG_INFO( "SkipMBTS " << ((m_skipMBTS) ? "true" : "false")); ATH_MSG_INFO( "CheckDCS " << ((m_checkDCS) ? "true" : "false")); - if (!m_cellContainerKey.key().empty()) { + + m_readCells = !m_cellContainerKey.key().empty(); + m_readRawChannels = !m_rawChannelContainerKey.key().empty(); + m_readDigits = !m_digitsContainerKey.key().empty(); + + if (m_readCells) { ATH_MSG_INFO( "MinEnergyCell < " << m_minEneCell); ATH_MSG_INFO( "MaxEnergyCell > " << m_maxEneCell); ATH_MSG_INFO( "PtnEnergyCell = " << m_ptnEneCell); @@ -192,10 +211,9 @@ StatusCode TileCellSelector::initialize() { ATH_MSG_INFO( "PtnTimeCell = " << m_ptnTimeCell); ATH_CHECK( m_cellContainerKey.initialize() ); - } - if (!(m_cellContainerKey.key().empty() && m_rawChannelContainerKey.key().empty())) { + if (m_readCells || m_readRawChannels) { ATH_MSG_INFO( "MinEnergyChan < " << m_minEneChan[0]); ATH_MSG_INFO( "MaxEnergyChan > " << m_maxEneChan[0]); ATH_MSG_INFO( "PtnEnergyChan = " << m_ptnEneChan[0]); @@ -210,7 +228,7 @@ StatusCode TileCellSelector::initialize() { ATH_MSG_INFO( "PtnTimeGap = " << m_ptnTimeChan[1]); } - if (!m_rawChannelContainerKey.key().empty()) { + if (m_readRawChannels) { ATH_MSG_INFO( "MinEnergyMBTS < " << m_minEneChan[2]); ATH_MSG_INFO( "MaxEnergyMBTS > " << m_maxEneChan[2]); ATH_MSG_INFO( "PtnEnergyMBTS = " << m_ptnEneChan[2]); @@ -219,7 +237,6 @@ StatusCode TileCellSelector::initialize() { ATH_MSG_INFO( "PtnTimeMBTS = " << m_ptnTimeChan[2]); ATH_CHECK( m_rawChannelContainerKey.initialize() ); - } switch (m_selectGain) { @@ -542,7 +559,7 @@ StatusCode TileCellSelector::execute() { const TileCell* tcellminCh = 0; const TileCell* tcellmaxCh = 0; - if (!m_cellContainerKey.key().empty()) { + if (m_readCells) { // Get Calo cell container SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey); @@ -550,7 +567,7 @@ StatusCode TileCellSelector::execute() { if (!cellContainer.isValid()) { ATH_MSG_WARNING("Unable to read CaloCellContainer from EventStore, disable reading of this container"); - m_cellsContName = ""; + m_readCells = false; } else { @@ -901,13 +918,14 @@ StatusCode TileCellSelector::execute() { const TileDQstatus* DQstatus(0); - if (!m_rawChannelContainerKey.key().empty()) { + if (m_readRawChannels) { // Get Tile RawChannel container SG::ReadHandle<TileRawChannelContainer> rawChannelContainer(m_rawChannelContainerKey); if ( !rawChannelContainer.isValid() ) { ATH_MSG_WARNING("Unable to read TileRawChannelContainer from EventStore, disable reading of this container"); + m_readRawChannels = false; } else { @@ -922,7 +940,7 @@ StatusCode TileCellSelector::execute() { TileRawChannelUnit::UNIT rChUnit = rawChannelContainer->get_unit(); bool allowAmpCheck = ( ( rChUnit == TileRawChannelUnit::MegaElectronVolts || // allow MeV only as units rChUnit == TileRawChannelUnit::OnlineMegaElectronVolts ) ) ; - bool fillChanEne = ( m_cellsContName.size()==0 && allowAmpCheck ); // use amplitude from channel if cell container was not checked + bool fillChanEne = ( !m_readCells && allowAmpCheck ); // use amplitude from channel if cell container was not checked if (!fillChanEne) { m_chanDsp.clear(); m_chanDsp.resize(1+TileHWID::NOT_VALID_HASH,0.0); @@ -1372,14 +1390,14 @@ StatusCode TileCellSelector::execute() { } - if (!m_digitsContainerKey.key().empty()) { + if (m_readDigits) { // Pointer to a Tile digits container SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey); if (!digitsContainer.isValid()) { ATH_MSG_WARNING("Unable to read TileDigitsContainer from EventStore, disable reading of this container"); - m_digitsContName = ""; + m_readDigits = false; } else { @@ -1391,6 +1409,8 @@ StatusCode TileCellSelector::execute() { int nDmuErr = 0; int nOverLG = 0; int nOverHG = 0; + int nUnderLG = 0; + int nUnderHG = 0; for (const TileDigitsCollection * digitsCollection : *digitsContainer) { @@ -1540,20 +1560,39 @@ StatusCode TileCellSelector::execute() { } } - if (dmax > m_ADCmaxMinusEps && (!err) // overflow without bad patterns + if ((!err) // channel without bad patterns && (useCh) // normal connected channel && (badname[0] == 0 || badname[1] == 'w' // no digital error || (badname[4] == 'Q' && !m_skipMasked))) { // error from TileCell but it is ignored - m_chanSel[hash] = true; // always print overflows + if (adc) { // HG - if (adc) { - if (m_checkOverHG){ - ++nOverHG; + if (dmax > m_overflowHG) { + m_chanSel[hash] = true; // always print overflows + if (m_checkOverHG){ + ++nOverHG; + } } - } else { - if (m_checkOverLG) { - ++nOverLG; + if (dmin < m_underflowHG) { + m_chanSel[hash] = true; // always print underflows + if (m_checkUnderHG){ + ++nUnderHG; + } + } + + } else { // LG + + if (dmax > m_overflowLG) { + m_chanSel[hash] = true; // always print overflows + if (m_checkOverLG){ + ++nOverLG; + } + } + if (dmin < m_underflowLG) { + m_chanSel[hash] = true; // always print underflows + if (m_checkUnderLG){ + ++nUnderLG; + } } } } @@ -1743,6 +1782,7 @@ StatusCode TileCellSelector::execute() { bool accEmin = (m_chanEne[hash] < m_minEneChan[ch_type]); bool accEmax = (m_chanEne[hash] > m_maxEneChan[ch_type]); bool jumpOve = (dmax>m_ADCmaxMinusEps); + bool jumpZer = (dmin < 0.01); ATH_MSG_VERBOSE(evtnum.str() << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId) << enename << m_chanEne[hash] << " samp = " << samples[0] @@ -1753,6 +1793,7 @@ StatusCode TileCellSelector::execute() { << cellname << badname << ((accEmin) ? " neg_e" : "") << ((accEmax) ? " pos_e" : "") + <<((jumpZer) ? " underflow" : "") <<((jumpOve) ? " overflow" : "") ); } @@ -1871,6 +1912,7 @@ StatusCode TileCellSelector::execute() { bool accEmin = (m_chanEne[hash]<m_minEneChan[ch_type]); bool accEmax = (m_chanEne[hash]>m_maxEneChan[ch_type]); bool jumpOve = (dmax > m_ADCmaxMinusEps); + bool jumpZer = (dmin < 0.01); ATH_MSG_VERBOSE(evtnum.str() << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId) @@ -1882,6 +1924,7 @@ StatusCode TileCellSelector::execute() { << cellname << badname << ((accEmin) ? " neg_e" : "") << ((accEmax) ? " pos_e" : "") + << ((jumpZer) ? " underflow" : "") << ((jumpOve) ? " overflow" : "") ); } @@ -1929,6 +1972,20 @@ StatusCode TileCellSelector::execute() { << " n_overflow_HG = " << nOverHG << " accepted"); } + if (nUnderLG) { + ++m_underLG; + statusOk = true; + ATH_MSG_DEBUG( nevtnum.str() + << " n_underflow_LG = " << nUnderLG + << " accepted"); + } + if (nUnderHG) { + ++m_underHG; + statusOk = true; + ATH_MSG_DEBUG(nevtnum.str() + << " n_underflow_HG = " << nUnderHG + << " accepted"); + } if (nDmuErr) { ++m_dmuerr; statusOk = true; @@ -2040,6 +2097,7 @@ StatusCode TileCellSelector::finalize() { << "," << m_maxCell << "/" << m_maxChan << "," << m_jump << "/" << m_const << "," << m_overLG << "/" << m_overHG + << "," << m_underLG << "/" << m_underHG << "," << m_dqerr << "/" << m_dmuerr << "," << m_warnerr << ") events."); diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.h b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.h index 606998f652f857868a8e6406eb22aeccc5d06793..2302107193df062beb18b373bb7fc5e9e2d06e5e 100644 --- a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.h +++ b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.h @@ -12,6 +12,7 @@ #include "TileEvent/TileRawChannelContainer.h" #include "TileEvent/TileDQstatus.h" #include "TileConditions/ITileDCSTool.h" +#include "TileConditions/ITileBadChanTool.h" // Calo includes #include "CaloEvent/CaloCellContainer.h" @@ -31,7 +32,6 @@ class TileID; class TileHWID; class TileCell; class TileCablingService; -class ITileBadChanTool; class TileInfo; @@ -61,6 +61,8 @@ class TileCellSelector: public AthAlgorithm { unsigned int m_const; unsigned int m_overLG; unsigned int m_overHG; + unsigned int m_underLG; + unsigned int m_underHG; unsigned int m_dqerr; unsigned int m_dmuerr; unsigned int m_warnerr; @@ -68,8 +70,8 @@ class TileCellSelector: public AthAlgorithm { const TileID* m_tileID; const TileHWID* m_tileHWID; const TileCablingService* m_cabling; - ToolHandle<ITileBadChanTool> m_tileBadChanTool; //!< Tile Bad Channel tool - SG::ReadHandleKey<TileDQstatus> m_dqStatusKey; + ToolHandle<ITileBadChanTool> m_tileBadChanTool{this, "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"}; + SG::ReadHandleKey<TileDQstatus> m_dqStatusKey{this, "TileDQstatus", "TileDQstatus", "TileDQstatus key"}; ToolHandle<ITileDCSTool> m_tileDCS{this, "TileDCSTool", "TileDCSTool", "Tile DCS tool"}; unsigned int m_runNum; @@ -102,9 +104,9 @@ class TileCellSelector: public AthAlgorithm { std::vector<bool> m_chanToSkip; std::vector<bool> m_drawerToSkip; - std::string m_cellsContName; - std::string m_digitsContName; - std::string m_rchContName; + bool m_readCells; + bool m_readRawChannels; + bool m_readDigits; SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this,"CellContainerName", "AllCalo", "Input Calo cell container key"}; @@ -155,6 +157,12 @@ class TileCellSelector: public AthAlgorithm { bool m_checkDMUs; bool m_checkOverLG; bool m_checkOverHG; + bool m_checkUnderLG; + bool m_checkUnderHG; + float m_overflowLG; + float m_overflowHG; + float m_underflowLG; + float m_underflowHG; bool m_checkWarning; bool m_checkError; bool m_printOnly; diff --git a/TileCalorimeter/TileRecUtils/CMakeLists.txt b/TileCalorimeter/TileRecUtils/CMakeLists.txt index ce29185c03a7b9dd08dbfa1142dd8235de0221ff..0b4ee0695cc804e7200556ccb41ac2f509132d94 100644 --- a/TileCalorimeter/TileRecUtils/CMakeLists.txt +++ b/TileCalorimeter/TileRecUtils/CMakeLists.txt @@ -44,7 +44,7 @@ atlas_add_library( TileRecUtilsLib INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloConditions CaloIdentifier AthenaBaseComps AthenaKernel Identifier GaudiKernel TileEvent TileSimEvent TileIdentifier CaloUtilsLib TileConditionsLib CaloDetDescrLib StoreGateLib SGtests CxxUtils + LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloConditions CaloIdentifier AthenaBaseComps AthenaKernel Identifier GaudiKernel TileEvent TileSimEvent TileIdentifier CaloUtilsLib TileConditionsLib CaloDetDescrLib StoreGateLib SGtests CxxUtils TrigAnalysisInterfaces PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} CaloEvent AthAllocators xAODEventInfo TileCalibBlobObjs TileDetDescr PathResolver ) atlas_add_component( TileRecUtils @@ -53,7 +53,7 @@ atlas_add_component( TileRecUtils LINK_LIBRARIES TileRecUtilsLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_add_dictionary( TileRecUtilsDict @@ -96,11 +96,7 @@ atlas_add_test( TileDQstatusTool_test PROPERTIES TIMEOUT 600 LOG_IGNORE_PATTERN "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|TileDetectorTool|Creating TileCondProxyFile|Cache alignment|No RecFlags available" ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py - POST_EXEC_SCRIPT nopost.sh ) - +# Tests: atlas_add_test( TileRawChannelBuilderFitConfig_test SCRIPT python -m TileRecUtils.TileRawChannelBuilderFitConfig PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileRecUtils/python/TileCellMakerConfig.py b/TileCalorimeter/TileRecUtils/python/TileCellMakerConfig.py index 5f0e7402254bc7f216efce13627db0e6f9d31e16..8af426ffe4fdb4367428fd239d1ad55ad13915de 100644 --- a/TileCalorimeter/TileRecUtils/python/TileCellMakerConfig.py +++ b/TileCalorimeter/TileRecUtils/python/TileCellMakerConfig.py @@ -130,9 +130,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) - from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg - acc.merge( TrigBSReadCfg(ConfigFlags) ) - acc.getService('ByteStreamAddressProviderSvc').TypeNames += ['TileDigitsContainer/TileDigitsCnt'] + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge( ByteStreamReadCfg(ConfigFlags, ['TileRawChannelContainer/TileRawChannelCnt', 'TileDigitsContainer/TileDigitsCnt']) ) acc.merge( TileCellMakerCfg(ConfigFlags) ) diff --git a/TileCalorimeter/TileRecUtils/python/TileDQstatusConfig.py b/TileCalorimeter/TileRecUtils/python/TileDQstatusConfig.py index 3f4b2be0aa8f5ffbe781ef0c1df6e47f4f690956..6b7110f46ee5f7a474c8e7e87e53f02fd24d20b6 100644 --- a/TileCalorimeter/TileRecUtils/python/TileDQstatusConfig.py +++ b/TileCalorimeter/TileRecUtils/python/TileDQstatusConfig.py @@ -106,9 +106,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) - from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg - acc.merge( TrigBSReadCfg(ConfigFlags) ) - acc.getService('ByteStreamAddressProviderSvc').TypeNames += ['TileDigitsContainer/TileDigitsCnt'] + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge( ByteStreamReadCfg(ConfigFlags, ['TileDigitsContainer/TileDigitsCnt']) ) acc.merge( TileDQstatusAlgCfg(ConfigFlags) ) diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelCorrectionConfig.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelCorrectionConfig.py index dbda52dc5b17d80c09e903eabce036126bae479a..bad4fca6a29555076a804b9e3fd10883630dd109 100644 --- a/TileCalorimeter/TileRecUtils/python/TileRawChannelCorrectionConfig.py +++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelCorrectionConfig.py @@ -157,9 +157,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) - from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg - acc.merge( TrigBSReadCfg(ConfigFlags) ) - acc.getService('ByteStreamAddressProviderSvc').TypeNames += ['TileDigitsContainer/TileDigitsCnt'] + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge( ByteStreamReadCfg(ConfigFlags, ['TileRawChannelContainer/TileRawChannelCnt', 'TileDigitsContainer/TileDigitsCnt']) ) acc.merge( TileRawChannelCorrectionAlgCfg(ConfigFlags) ) diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py index 1696fda34746b624f47beef0e5a261326cc3baa7..e158a11c86d5c729d237cdf34dba569e3aaa4bf4 100644 --- a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py +++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Author: J. Poveda (Ximo.Poveda@cern.ch) # TileRawChannel creation from TileDigits @@ -28,8 +28,12 @@ class TileRawChannelGetter ( Configured) : mlog.info ("entering") self._TileRawChannelBuilderFitFilter = None + self._TileRawChannelBuilderFitFilterCool = None + self._TileRawChannelBuilderMF = None + self._TileRawChannelBuilderOF1 = None self._TileRawChannelBuilderOpt2Filter = None self._TileRawChannelBuilderOptATLAS = None + self._TileRawChannelBuilderWienerFilter = None # Instantiation of the C++ algorithm try: @@ -315,6 +319,7 @@ class TileRawChannelGetter ( Configured) : mlog.info(" adding now TileRawChannelBuilderFitFilterCool to the algorithm: %s", theTileRawChannelMaker.name()) theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderFitFilterCool] + self._TileRawChannelBuilderFitFilterCool = theTileRawChannelBuilderFitFilterCool # matched filter if jobproperties.TileRecFlags.doTileMF(): @@ -354,6 +359,7 @@ class TileRawChannelGetter ( Configured) : mlog.info(" adding now TileRawChannelBuilderMF to the algorithm: %s", theTileRawChannelMaker.name()) theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderMF] + self._TileRawChannelBuilderMF = theTileRawChannelBuilderMF if jobproperties.TileRecFlags.doTileOF1(): try: @@ -396,10 +402,11 @@ class TileRawChannelGetter ( Configured) : theTileRawChannelBuilderOF1.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection() theTileRawChannelBuilderOF1.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection() - theTileRawChannelBuilderOF1 = TileRawChannelContainerDSP + theTileRawChannelBuilderOF1.DSPContainer = TileRawChannelContainerDSP mlog.info(" adding now TileRawChannelBuilderOF1 to the algorithm: %s", theTileRawChannelMaker.name()) theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOF1] + self._TileRawChannelBuilderOF1 = theTileRawChannelBuilderOF1 if jobproperties.TileRecFlags.doTileOpt2(): try: @@ -514,6 +521,7 @@ class TileRawChannelGetter ( Configured) : mlog.info(" adding now TileRawChannelBuilderWienerFilter to the algorithm: %s", theTileRawChannelMaker.name()) theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderWienerFilter] + self._TileRawChannelBuilderWienerFilter = theTileRawChannelBuilderWienerFilter # now add algorithm to topSequence @@ -561,13 +569,25 @@ class TileRawChannelGetter ( Configured) : def TileRawChannelBuilderFitFilter(self): return self._TileRawChannelBuilderFitFilter - + + def TileRawChannelBuilderFitFilterCool(self): + return self._TileRawChannelBuilderFitFilterCool + + def TileRawChannelBuilderMF(self): + return self._TileRawChannelBuilderMF + + def TileRawChannelBuilderOF1(self): + return self._TileRawChannelBuilderOF1 + def TileRawChannelBuilderOpt2Filter(self): return self._TileRawChannelBuilderOpt2Filter def TileRawChannelBuilderOptATLAS(self): return self._TileRawChannelBuilderOptATLAS - + + def TileRawChannelBuilderWienerFilter(self): + return self._TileRawChannelBuilderWienerFilter + ## # would work only if one output object type ## def outputKey(self): ## return self._output[self._outputType] diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter_DigiHSTruth.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter_DigiHSTruth.py index 6cb5d2ee151d82cffa3c04b8bfa3a2a7c9ad1a8b..b7a8e839ba54f7e0f0da8e122cf736b22f7171e3 100644 --- a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter_DigiHSTruth.py +++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter_DigiHSTruth.py @@ -1,3 +1,5 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# # Author: J. Poveda (Ximo.Poveda@cern.ch) # TileRawChannel creation from TileDigits # TileRawChannelMaker algorithm using diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelMakerConfig.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelMakerConfig.py index 3ed54f8b8ad08308f61a328990313124a424e942..b9fb49b7ef9520501c9ffed20ab14d204c568eaf 100644 --- a/TileCalorimeter/TileRecUtils/python/TileRawChannelMakerConfig.py +++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelMakerConfig.py @@ -170,9 +170,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) - from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg - acc.merge( TrigBSReadCfg(ConfigFlags) ) - acc.getService('ByteStreamAddressProviderSvc').TypeNames += ['TileDigitsContainer/TileDigitsCnt'] + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge( ByteStreamReadCfg(ConfigFlags, ['TileRawChannelContainer/TileRawChannelCnt', 'TileDigitsContainer/TileDigitsCnt']) ) acc.merge( TileRawChannelMakerOutputCfg(ConfigFlags) ) diff --git a/TileCalorimeter/TileSimAlgs/CMakeLists.txt b/TileCalorimeter/TileSimAlgs/CMakeLists.txt index 57e24ad519c99a5e016fbaafa4b1f0e6ac2f7887..6bf73dc421443d402fee467b6717e66fb71eaef1 100644 --- a/TileCalorimeter/TileSimAlgs/CMakeLists.txt +++ b/TileCalorimeter/TileSimAlgs/CMakeLists.txt @@ -40,14 +40,10 @@ atlas_add_component( TileSimAlgs # Install files from the package: atlas_install_headers( TileSimAlgs ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py - POST_EXEC_SCRIPT nopost.sh ) - +# Tests: atlas_add_test( TileMuonReceiverConfig_test SCRIPT python -m TileSimAlgs.TileMuonReceiverConfig PROPERTIES TIMEOUT 300 diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx index a65a931c095588f4598177a911ca67af5c3f26ff..b9ab38028b5b0b9eb4be7ca53b44196dc92b88fb 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx @@ -260,7 +260,7 @@ void TileROD_Decoder::unpack_frag0(uint32_t version, // Digitizer mode doesn't change between events static int digiMode = -1; - if (digiMode < 0) { // try to find digi mode until good mode is found + if (digiMode < 0 && size > 0) { // try to find digi mode until good mode is found digiMode = m_d2Bytes.getDigiMode(data, chipCount, blockSize); } diff --git a/Tools/KitValidation/CMakeLists.txt b/Tools/KitValidation/CMakeLists.txt index 4a45a19643b5db5632eadc99ffce953641ad3079..279e9b465d1674de9c1f23eea69515ca8bc066be 100644 --- a/Tools/KitValidation/CMakeLists.txt +++ b/Tools/KitValidation/CMakeLists.txt @@ -5,10 +5,6 @@ # Declare the package name: atlas_subdir( KitValidation ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Tools/JobTransforms ) - # Install files from the package: atlas_install_joboptions( share/kv_perfmon.py share/kv_reflex.py ) atlas_install_scripts( share/kvpost.py ) diff --git a/Tools/PyJobTransforms/CMakeLists.txt b/Tools/PyJobTransforms/CMakeLists.txt index 3219c5f7b0b4e130ec94bbb593f08061610e1c00..b9e00659b85fed8ff0c362995c3a86e53b4edb04 100644 --- a/Tools/PyJobTransforms/CMakeLists.txt +++ b/Tools/PyJobTransforms/CMakeLists.txt @@ -13,6 +13,7 @@ find_package( future ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( scripts/*.py ) +atlas_install_scripts( scripts/HelloWorld_tf.py ) atlas_install_generic( share/*.db DESTINATION share EXECUTABLE ) @@ -35,6 +36,10 @@ if( NOT SIMULATIONBASE AND NOT GENERATIONBASE ) SCRIPT test/test_${test}.py ) endforeach() + + atlas_add_test( HelloWorldTrf + SCRIPT test/test_HelloWorldTrf.sh + ) endif() #The following tests currently fail in master and should be revised diff --git a/Tools/PyJobTransforms/python/CommonRunArgsToFlags.py b/Tools/PyJobTransforms/python/CommonRunArgsToFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..3f39b78960ba1ba46dcc1e42dc96ee7382402401 --- /dev/null +++ b/Tools/PyJobTransforms/python/CommonRunArgsToFlags.py @@ -0,0 +1,21 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Translate the commonly used runArgs into configFlags +def commonRunArgsToFlags(runArgs,configFlags): + ## Max/skip events + if hasattr(runArgs,"skipEvents"): + configFlags.Exec.SkipEvents=runArgs.skipEvents + + if hasattr(runArgs,"maxEvents"): + configFlags.Exec.MaxEvents=runArgs.maxEvents + + if hasattr(runArgs,"conditionsTag"): + configFlags.IOVDb.GlobalTag=runArgs.conditionsTag + + if hasattr(runArgs,"geometryVersion"): + configFlags.GeoModel.AtlasVersion=runArgs.geometryVersion + + if hasattr(runArgs,"beamType"): + configFlags.Beam.Type=runArgs.beamType + + diff --git a/Tools/PyJobTransforms/python/HelloWorldSkeleton.py b/Tools/PyJobTransforms/python/HelloWorldSkeleton.py new file mode 100644 index 0000000000000000000000000000000000000000..2553ad88c186c2cd24042847f4ca981762289146 --- /dev/null +++ b/Tools/PyJobTransforms/python/HelloWorldSkeleton.py @@ -0,0 +1,15 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags +from AthExHelloWorld.HelloWorldConfig import HelloWorldCfg +from AthenaConfiguration.MainServicesConfig import MainServicesCfg + + +def fromRunArgs(runArgs): + from AthenaConfiguration.AllConfigFlags import ConfigFlags + + commonRunArgsToFlags(runArgs,ConfigFlags) + + cfg=MainServicesCfg(ConfigFlags) + cfg.merge(HelloWorldCfg()) + cfg.run() diff --git a/Tools/PyJobTransforms/python/trfArgs.py b/Tools/PyJobTransforms/python/trfArgs.py index fe83c984a904b98cd24cf7c16b0f2bb7b41015e2..854fd04b7382791eab85131bc15ddb1aa0a76f09 100644 --- a/Tools/PyJobTransforms/python/trfArgs.py +++ b/Tools/PyJobTransforms/python/trfArgs.py @@ -16,6 +16,7 @@ from PyJobTransforms.trfLogger import stdLogLevels ## Add standard transform arguments to an argparse ArgumentParser def addStandardTrfArgs(parser): + parser.add_argument('--CA', action='store_true', help='Use ComponentAccumulator base configuration') parser.add_argument('--verbose', '--debug', action='store_true', help='Set transform loglevel to DEBUG') parser.add_argument('--loglevel', choices=list(stdLogLevels), help='Set transform logging level') parser.add_argument('--argJSON', '--argjson', metavar='FILE', help='File containing JSON serialised argument dictionary') diff --git a/Tools/PyJobTransforms/python/trfExe.py b/Tools/PyJobTransforms/python/trfExe.py index cfb198bfe41a6982f76df105cfe2c10cb2c04d4b..999b4a56ce74bf317c7d754fdf4f000f3dd7d4dc 100755 --- a/Tools/PyJobTransforms/python/trfExe.py +++ b/Tools/PyJobTransforms/python/trfExe.py @@ -816,6 +816,7 @@ class athenaExecutor(scriptExecutor): # @param skeletonFile athena skeleton job options file (optionally this can be a list of skeletons # that will be given to athena.py in order); can be set to @c None to disable writing job options # files at all + # @param skeletonCA ComponentAccumulator-compliant skeleton file (used with the --CA option) # @param inputDataTypeCountCheck List of input datatypes to apply preExecute event count checks to; # default is @c None, which means check all inputs # @param exe Athena execution script @@ -841,9 +842,9 @@ class athenaExecutor(scriptExecutor): # uses repr(), so the RHS is the same as the python object in the transform; @c runtimeRunargs uses str() so # that a string can be interpreted at runtime; @c literalRunargs allows the direct insertion of arbitary python # snippets into the runArgs file. - def __init__(self, name = 'athena', trf = None, conf = None, skeletonFile = 'PyJobTransforms/skeleton.dummy.py', inData = set(), - outData = set(), inputDataTypeCountCheck = None, exe = 'athena.py', exeArgs = ['athenaopts'], substep = None, inputEventTest = True, - perfMonFile = None, tryDropAndReload = True, extraRunargs = {}, runtimeRunargs = {}, + def __init__(self, name = 'athena', trf = None, conf = None, skeletonFile = 'PyJobTransforms/skeleton.dummy.py', skeletonCA=None, + inData = set(), outData = set(), inputDataTypeCountCheck = None, exe = 'athena.py', exeArgs = ['athenaopts'], + substep = None, inputEventTest = True, perfMonFile = None, tryDropAndReload = True, extraRunargs = {}, runtimeRunargs = {}, literalRunargs = [], dataArgs = [], checkEventCount = False, errorMaskFiles = None, manualDataDictionary = None, memMonitor = True, disableMP = False): @@ -857,6 +858,7 @@ class athenaExecutor(scriptExecutor): self._errorMaskFiles = errorMaskFiles self._inputDataTypeCountCheck = inputDataTypeCountCheck self._disableMP = disableMP + self._skeletonCA=skeletonCA if perfMonFile: self._perfMonFile = None @@ -875,7 +877,7 @@ class athenaExecutor(scriptExecutor): self._extraMetadata.update({'substep': substep}) # Setup JO templates - if self._skeleton is not None: + if self._skeleton or self._skeletonCA: self._jobOptionsTemplate = JobOptionsTemplate(exe = self, version = '$Id: trfExe.py 792052 2017-01-13 13:36:51Z mavogel $') else: self._jobOptionsTemplate = None @@ -1033,7 +1035,7 @@ class athenaExecutor(scriptExecutor): ## Write the skeleton file and prep athena - if self._skeleton is not None: + if self._skeleton or self._skeletonCA: inputFiles = dict() for dataType in input: inputFiles[dataType] = self.conf.dataDictionary[dataType] @@ -1304,8 +1306,12 @@ class athenaExecutor(scriptExecutor): any('--nprocs' in opt for opt in self.conf.argdict['athenaopts'].value[currentSubstep])): self._cmd.append('--nprocs=%s' % str(self._athenaMP)) + #Switch to ComponentAccumulator based config if requested + if 'CA' in self.conf.argdict: + self._cmd.append("--CA") + # Add topoptions - if self._skeleton is not None: + if self._skeleton or self._skeletonCA: self._cmd += self._topOptionsFiles msg.info('Updated script arguments with topoptions: %s' % self._cmd) diff --git a/Tools/PyJobTransforms/python/trfJobOptions.py b/Tools/PyJobTransforms/python/trfJobOptions.py index 8092d16306f4c1ac81e10fc5aba47a5c5b951f29..dafbaed30d670e474ff8d8d097af9c62620968b4 100644 --- a/Tools/PyJobTransforms/python/trfJobOptions.py +++ b/Tools/PyJobTransforms/python/trfJobOptions.py @@ -56,6 +56,18 @@ class JobOptionsTemplate(object): ## @brief Write the runArgs Job Options file def writeRunArgs(self, input = dict(), output = dict()): msg.info('Writing runArgs to file \"%s\"' % self._runArgsFile) + + ## Check consistency btw --CA flag and provided skeletons: + if 'CA' in self._exe.conf.argdict: + if self._exe._skeletonCA is None: + errMsg = "Got the --CA option but this transform doesn't supply a ComponentAccumulator-based skeleton file" + msg.error(errMsg) + raise trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_EXEC_RUNARGS_ERROR'),errMsg) + else: # 'CA' not in self._exe.conf.argdict + if self._exe._skeleton is None: + errMsg = "No --CA option given, but this transform doesn't supply old-style skeleton file" + msg.error(errMsg) + raise trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_EXEC_RUNARGS_ERROR'),errMsg) with open(self._runArgsFile, 'w') as runargsFile: try: @@ -191,6 +203,11 @@ class JobOptionsTemplate(object): raise trfExceptions.TransformExecutionException(trfExit.nameToCode("TRF_EXEC_RUNARGS_ERROR"), "Failed to find file: {0} required by athenaMP option: --athenaMPUseEventOrders true".format(self._exe._athenaMPEventOrdersFile)) if 'athenaMPEventsBeforeFork' in self._exe.conf.argdict: print('AthenaMPJobProps.AthenaMPFlags.EventsBeforeFork={0}'.format(self._exe.conf.argdict['athenaMPEventsBeforeFork'].value), file=runargsFile) + if 'CA' in self._exe.conf.argdict: + #ComponentAccumulator based config, import skeleton here: + print(os.linesep, '# Import skeleton and execute it', file=runargsFile) + print('from {0} import fromRunArgs'.format(self._exe._skeletonCA),file=runargsFile) + print('fromRunArgs({0})'.format(self._runArgsName),file=runargsFile) msg.info('Successfully wrote runargs file {0}'.format(self._runArgsFile)) @@ -211,9 +228,10 @@ class JobOptionsTemplate(object): msg.warning('Could not find runArgs file %s' % self._runArgsFile) # Check the skeleton(s): - for skeleton in self._exe._skeleton: - if not findFile(os.environ["JOBOPTSEARCHPATH"], skeleton): - msg.warning('Could not find job options skeleton file %s' % skeleton) + if self._exe._skeleton: + for skeleton in self._exe._skeleton: + if not findFile(os.environ["JOBOPTSEARCHPATH"], skeleton): + msg.warning('Could not find job options skeleton file %s' % skeleton) ## @brief Get the runArgs and skeleton joboptions, Master function @@ -225,5 +243,10 @@ class JobOptionsTemplate(object): self.writeRunArgs(input = input, output = output) # Make sure runArgs and skeleton are valid self.ensureJobOptions() - return [ self._runArgsFile ] + self._exe._skeleton + if 'CA' in self._exe.conf.argdict: + #ComponentAccumulator based config, use only runargs file + return [ self._runArgsFile ] + else: + #Traditional athena: runargs + skeleton + return [ self._runArgsFile ] + self._exe._skeleton diff --git a/Tools/PyJobTransforms/python/trfValidation.py b/Tools/PyJobTransforms/python/trfValidation.py index 38abe22d18fbef9f01c1684f78fd9d5e558c4009..ae79365a219800af5ff6fad7ef88e88eb640940d 100644 --- a/Tools/PyJobTransforms/python/trfValidation.py +++ b/Tools/PyJobTransforms/python/trfValidation.py @@ -273,6 +273,27 @@ class athenaLogFileReport(logFileReport): self._dbbytes = 0 self._dbtime = 0.0 + ## Generally, a knowledge file consists of non-standard logging error/abnormal lines + # which are left out during log scan and could help diagnose job failures. + def knowledgeFileHandler(self, knowledgefile): + # load abnormal/error line(s) from the knowledge file(s) + linesList = [] + fullName = trfUtils.findFile(os.environ['DATAPATH'], knowledgefile) + if not fullName: + msg.warning('Knowledge file {0} could not be found in DATAPATH'.format(knowledgefile)) + try: + with open(fullName) as knowledgeFileHandle: + msg.debug('Opened knowledge file {0} from here: {1}'.format(knowledgefile, fullName)) + + for line in knowledgeFileHandle: + if line.startswith('#') or line == '' or line =='\n': + continue + line = line.rstrip('\n') + linesList.append(line) + except OSError as e: + msg.warning('Failed to open knowledge file {0}: {1}'.format(fullName, e)) + return linesList + def scanLogFile(self, resetReport=False): if resetReport: self.resetReport() @@ -300,7 +321,7 @@ class athenaLogFileReport(logFileReport): # But we can check for certain other interesting things, like core dumps if 'Core dump from CoreDumpSvc' in line: msg.warning('Detected CoreDumpSvc report - activating core dump svc grabber') - self.coreDumpSvcParser(myGen, line, lineCounter) + self.coreDumpSvcParser(log, myGen, line, lineCounter) continue # Add the G4 exceptipon parsers if 'G4Exception-START' in line: @@ -430,12 +451,21 @@ class athenaLogFileReport(logFileReport): return {'level': firstName, 'nLevel': firstLevel, 'firstError': firstError} ## @brief Attempt to suck a core dump report from the current logfile - # @note: Current implementation just eats lines until a 'normal' line is seen. + # This function scans logs in two different directions: + # 1) downwards, to exctract information after CoreDrmpSvc; and 2) upwards, to find abnormal lines + # @note: Current downwards scan just eats lines until a 'normal' line is seen. # There is a slight problem here in that the end of core dump trigger line will not get parsed # TODO: fix this (OTOH core dump is usually the very last thing and fatal!) - def coreDumpSvcParser(self, lineGenerator, firstline, firstLineCount): + def coreDumpSvcParser(self, log, lineGenerator, firstline, firstLineCount): + abnormalLinesList = self.knowledgeFileHandler('coreDumpKnowledgeFile.db') _eventCounter = _run = _event = _currentAlgorithm = _functionLine = _currentFunction = None coreDumpReport = 'Core dump from CoreDumpSvc' + linesToBeScaned = 50 + seenAbnormalLines = [] + abnormalLinesReport = {} + lastNormalLineReport = {} + coreDumpDetailsReport = {} + for line, linecounter in lineGenerator: m = self._regExp.match(line) if m is None: @@ -464,7 +494,10 @@ class athenaLogFileReport(logFileReport): if '<signal handler called>' in line: _functionLine = linecounter+1 if _functionLine and linecounter is _functionLine: - _currentFunction = line + if ' in ' in line: + _currentFunction = 'Current Function: ' + line.split(' in ')[1].split()[0] + else: + _currentFunction = 'Current Function: ' + line.split()[1] else: # Can this be done - we want to push the line back into the generator to be # reparsed in the normal way (might need to make the generator a class with the @@ -476,13 +509,54 @@ class athenaLogFileReport(logFileReport): _run = 'Run: unknown' if not _run else _run _event = 'Evt: unknown' if not _event else _event _currentAlgorithm = 'Current algorithm: unknown' if not _currentAlgorithm else _currentAlgorithm - _currentFunction = 'Current Function: unknown' if not _currentFunction else 'Current Function: '+_currentFunction.split(' in ')[1].split()[0] + _currentFunction = 'Current Function: unknown' if not _currentFunction else _currentFunction coreDumpReport = '{0}: {1}; {2}; {3}; {4}; {5}'.format(coreDumpReport, _eventCounter, _run, _event, _currentAlgorithm, _currentFunction) + ## look up for lines before core dump for "abnormal" and "last normal" line(s) + + # make a list of last e.g. 50 lines before core dump + # A new "line generator" is required to give access to the upper lines + linesList = [] + lineGen = trfUtils.lineByLine(log) + for line, linecounter in lineGen: + if linecounter in range(firstLineCount - linesToBeScaned, firstLineCount-1): + linesList.append([linecounter, line]) + elif linecounter == firstLineCount: + break + + for linecounter, line in reversed(linesList): + if re.findall(r'|'.join(abnormalLinesList), line): + seenLine = False + for dic in seenAbnormalLines: + # count repetitions or similar (e.g. first 15 char) abnormal lines + if dic['message'] == line or dic['message'][0:15] == line[0:15]: + dic['count'] += 1 + seenLine = True + break + if seenLine is False: + seenAbnormalLines.append({'message': line, 'firstLine': linecounter, 'count': 1}) + else: + if line != '': + lastNormalLineReport = {'message': line, 'firstLine': linecounter, 'count': 1} + break + else: + continue + + # write the list of abnormal lines into a dictionary to report + # The keys of each abnormal line are labeled by a number starting with 0 + # e.g. first abnormal line's keys are :{'meesage0', 'firstLine0', 'count0'} + for a in range(len(seenAbnormalLines)): + abnormalLinesReport.update({'message{0}'.format(a): seenAbnormalLines[a]['message'], 'firstLine{0}'.format(a): seenAbnormalLines[a]['firstLine'], 'count{0}'.format(a): seenAbnormalLines[a]['count']}) + coreDumpDetailsReport = {'abnormalLine(s) before CoreDump': abnormalLinesReport, 'lastNormalLine before CoreDump': lastNormalLineReport} + + # concatenate an extract of first seen abnormal line to the core dump message + if len(seenAbnormalLines) > 0: + coreDumpReport += '; Abnormal line(s) seen just before core dump: ' + seenAbnormalLines[0]['message'][0:30] + '...[truncated] ' + '(see the jobReport)' + # Core dumps are always fatal... msg.debug('Identified core dump - adding to error detail report') self._levelCounter['FATAL'] += 1 - self._errorDetails['FATAL'].append({'message': coreDumpReport, 'firstLine': firstLineCount, 'count': 1}) + self._errorDetails['FATAL'].append({'moreDetails': coreDumpDetailsReport, 'message': coreDumpReport, 'firstLine': firstLineCount, 'count': 1}) def g494ExceptionParser(self, lineGenerator, firstline, firstLineCount): g4Report = firstline diff --git a/Tools/PyJobTransforms/scripts/HelloWorld_tf.py b/Tools/PyJobTransforms/scripts/HelloWorld_tf.py new file mode 100755 index 0000000000000000000000000000000000000000..5bf035d1b3f994328eb871f3b10a383590313f02 --- /dev/null +++ b/Tools/PyJobTransforms/scripts/HelloWorld_tf.py @@ -0,0 +1,52 @@ +#! /usr/bin/env python + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +## A simple tranform running HelloWorld + +import argparse +import os.path +import sys +import time +import traceback + +import logging + +# Setup core logging here +from PyJobTransforms.trfLogger import msg +msg.info('logging set in %s' % sys.argv[0]) + +from PyJobTransforms.trfExitCodes import trfExit +from PyJobTransforms.transform import transform +from PyJobTransforms.trfExe import athenaExecutor +from PyJobTransforms.trfArgs import addAthenaArguments, addDetectorArguments +from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace + +import PyJobTransforms.trfExceptions as trfExceptions +import PyJobTransforms.trfArgClasses as trfArgClasses + +@stdTrfExceptionHandler +@sigUsrStackTrace +def main(): + + msg.info('This is %s' % sys.argv[0]) + + trf = getTransform() + trf.parseCmdLineArgs(sys.argv[1:]) + trf.execute() + trf.generateReport() + + msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) + sys.exit(trf.exitCode) + +## Get the base transform with all arguments added +def getTransform(): + trf = transform(executor = athenaExecutor(name = 'athena', + skeletonFile=None, + skeletonCA="PyJobTransforms.HelloWorldSkeleton")) + addAthenaArguments(trf.parser) + addDetectorArguments(trf.parser) + return trf + +if __name__ == '__main__': + main() diff --git a/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db b/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db new file mode 100644 index 0000000000000000000000000000000000000000..02c1c72b7d9f735d0fe56774f12d9b57482d3c77 --- /dev/null +++ b/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db @@ -0,0 +1,18 @@ +# A knowledge file consist of abnormal lines +# +# The main goal of reporting abnormal line(s) before core dump is to +# improve error reporting for exe65 with "Segmentation fault" +# +# These abnormal lines normally do not appeare in successful jobs +# and they don't have the standard logging structure +# +# List of abnormal lines: +warn\s+\[frontier(.*) +TBufferFile::CheckObject:0:\s(.*) +Error\s+in\s<TExMap::Remove>:\s(.*) +G4GDecay3::GetThreeBodyMomenta:\s(.*) +generateSCMmuonAbsorption:\sGetThreeBodyMomenta\(\)\sfailed(.*) +Failed\sretrieving\stool!! +Warning:\spTpythia\swas\snegative +tcmalloc:\slarge\salloc(.*) + diff --git a/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh b/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh new file mode 100755 index 0000000000000000000000000000000000000000..9d9a1cbe77ea091f7eeadf8539ed9609a5fae6a5 --- /dev/null +++ b/Tools/PyJobTransforms/test/test_HelloWorldTrf.sh @@ -0,0 +1,2 @@ +#!/bin/bash +HelloWorld_tf.py --maxEvents=5 --CA diff --git a/Tools/PyJobTransforms/test/test_trfValidation.py b/Tools/PyJobTransforms/test/test_trfValidation.py index 5703916b360802206d0dd01cbc659089f30ef839..02582a368569dce9c9324f2756090562a40b94d2 100755 --- a/Tools/PyJobTransforms/test/test_trfValidation.py +++ b/Tools/PyJobTransforms/test/test_trfValidation.py @@ -507,6 +507,78 @@ class athenaLogFileReportTests(unittest.TestCase): 16:32:37 IOVDbSvc INFO Total payload read from COOL: 123 bytes in (( 4.56 ))s 16:32:39 IOVDbSvc INFO Total payload read from COOL: 456 bytes in (( 7.89 ))s''' + testCoreDumpAbNormalLine =''' +00:49:51 RelationalDatabase Info Release number backward compatibility - NO SCHEMA EVOLUTION REQUIRED: database with OLDER release number 2.2.2 will be opened using CURRENT client release number 3.1.8 +00:49:51 2018-07-04 00:45:52,400 IOVDbSvc INFO HVS tag OFLCOND-MC16-SDR-16 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA +00:49:51 2018-07-04 00:45:52,416 IOVDbSvc INFO HVS tag OFLCOND-MC16-SDR-16 resolved to MDTDCSDROPPEDCH_2010_Run158116 for folder /MDT/DCS/DROPPEDCH +00:49:51 2018-07-04 00:45:52,433 IOVDbSvc INFO HVS tag OFLCOND-MC16-SDR-16 resolved to MDTDCSPSLVCHSTATE_RUN12_MC16_01 for folder /MDT/DCS/PSLVCHSTATE +00:49:51 2018-07-04 00:45:53,471 IOVDbSvc INFO HVS tag OFLCOND-MC16-SDR-16 resolved to PixDCSFSMState-SIM-RUN124-000-00 for folder /PIXEL/DCS/FSMSTATE +00:49:51 warn [frontier.c:1014]: Request 76 on chan 7 failed at Wed Jul 4 00:45:59 2018: -9 [fn-socket.c:125]: connect to 138.253.60.41 timed out after 5 seconds +00:49:51 warn [frontier.c:1114]: Trying next proxy lcgsquid.shef.ac.uk with same server lcgft-atlas.gridpp.rl.ac.uk +00:49:51 ------------------------------------------------------------------------------------- +00:49:51 Core dump from CoreDumpSvc on r21-n20.ph.liv.ac.uk at Wed Jul 4 00:46:24 2018 +00:49:51 +00:49:51 Caught signal 11(Segmentation fault). Details: +00:49:51 errno = 0, code = 1 (address not mapped to object) +00:49:51 pid = 4, uid = 0 +00:49:51 value = (1069839440, 0x7ffe3fc47450) +00:49:51 vmem = 1442.31 MB +00:49:51 rss = 265.988 MB +00:49:51 total-ram = 48257.4 MB +00:49:51 free-ram = 286.988 MB +00:49:51 buffer-ram= 31.6758 MB +00:49:51 total-swap= 32075 MB +00:49:51 free-swap = 29365.3 MB +00:49:51 addr = 0x4 +00:49:51 +00:49:51 Event counter: 0 +00:49:51 EventID: +00:49:51 Last incident: BkgEvent_2548_SG:StoreCleared +00:49:51 Current algorithm: <NONE> +00:49:51 Algorithm stack: <EMPTY> +00:49:51 ------------------------------------------------------------------------------------- +00:49:51 | AtlasBaseDir : /cvmfs/atlas.cern.ch/repo/sw/software/21.0 | +00:49:51 | AtlasVersion : 21.0.71 | +00:49:51 | CMTCONFIG : x86_64-slc6-gcc62-opt | +00:49:51 ------------------------------------------------------------------------------------- +00:49:51 Note: to see line numbers in below stacktrace you might consider running following : +00:49:51 atlasAddress2Line --file <logfile> +00:49:51 ------------------------------------------------------------------------------------- +00:49:51 +00:49:51 *** Break *** segmentation violation +00:49:51 +00:49:51 +00:49:51 +00:49:51 =========================================================== +00:49:51 There was a crash. +00:49:51 This is the entire stack trace of all threads: +00:49:51 =========================================================== +00:49:51 #0 0x00002afccfc2b86d in waitpid () from /lib64/libc.so.6 +00:49:51 #1 0x00002afccfbbd479 in do_system () from /lib64/libc.so.6 +00:49:51 #2 0x00002afccfbbd7b0 in system () from /lib64/libc.so.6 +00:49:51 #3 0x00002afcd6863868 in TUnixSystem::StackTrace() () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so +00:49:51 #4 0x00002afcd6865d7c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so +00:49:51 #5 0x00002afcef419c10 in CoreDumpSvcHandler::action(int, siginfo*, void*) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/Athena/21.0.71/InstallArea/x86_64-slc6-gcc62-opt/lib/libAthenaServices.so +00:49:51 #6 <signal handler called> +00:49:51 #7 frontierHttpClnt_usinglastproxyingroup (c=c +00:49:51 entry=0x27a94000) at fn-htclient.c:904 +00:49:51 #8 0x00002afce97b7e6a in frontier_postRawData (u_channel=657625312, uri=0x31e5c100 "Frontier/type=frontier_request:1:DEFAULT&encoding=BLOBzip5&p1=eNplj0EKAyEMRa8Ssi7FOnTpImimIzg6GKF05f1vUSu0o3QRyH--JyTCgW2BgzLHUmNy7B2QAE4EL99Eoccc6KD5dvPBjQtG8PPP8UE3V15SfZTid.7uoBHWnHZAKoGk2pRCWkN1Vv"..., body=body +00:49:51 entry=0x0) at frontier.c:1066 + ''' + + testCoreDumpAbnormalPattern = ''' +10:15:20 Error in <TProtoClass::FindDataMember>: data member with index 0 is not found in class Identifier +10:15:20 Error in <CreateRealData>: Cannot find data member # 0 of class Identifier for parent TileTrigger! +10:15:20 Error in <TExMap::Remove>: key 980837730 not found at 305 +10:15:20 TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837730 pointer will be 0 +10:15:20 Error in <TExMap::Remove>: key 980837731 not found at 306 +10:15:20 TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837731 pointer will be 0 +10:15:20 ------------------------------------------------------------------------------------- +10:15:20 Core dump from CoreDumpSvc on t-cn0130.hpc2n.umu.se at Thu Nov 7 10:14:44 2019 +18:16:06 ------------------------------------------------------------------------------------- +18:16:06 Caught signal 11(Segmentation fault). Details: + ''' + with open('file1', 'w') as f1: print('This is test file 1 w/o meaning', file=f1) with open('file2', 'w') as f2: @@ -529,6 +601,10 @@ class athenaLogFileReportTests(unittest.TestCase): with open('file10', 'w') as f10: print(testLogExcerptMP, file=f10) print(testErrorExcerptMP, file=f10) + with open('file11', 'w') as f11: + print(testCoreDumpAbNormalLine, file=f11) + with open('file12', 'w') as f12: + print(testCoreDumpAbnormalPattern, file=f12) self.myFileReport1 = athenaLogFileReport('file1') self.myFileReport2 = athenaLogFileReport('file2') @@ -540,9 +616,11 @@ class athenaLogFileReportTests(unittest.TestCase): self.myFileReport8 = athenaLogFileReport('file8') self.myFileReport9 = athenaLogFileReport('file9') self.myFileReport10 = athenaLogFileReport('file10') + self.myFileReport11 = athenaLogFileReport('file11') + self.myFileReport12 = athenaLogFileReport('file12') def tearDown(self): - for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10',\ + for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10', 'file11', 'file12',\ 'logWithSubstepNameSerial', 'logWithSubstepNameMP': try: os.unlink(f) @@ -626,11 +704,13 @@ ManagedAthenaTileMon reported an ERROR, but returned a StatusCode "SUCCESS"''' def test_coreDumpCurAlg(self): self.assertEqual(self.myFileReport6.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, - 'firstError': {'count': 1, 'firstLine': 4, - 'message': 'Segmentation fault: Event counter: 41; Run: 204158; Evt: 70319934; Current algorithm: MuonCreatorAlg; Current Function: G4VoxelNavigation::ComputeStep'}}) + 'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {}, 'lastNormalLine before CoreDump': {'message': 'ToolSvc.CombinedMuonTrackBuilder WARNING standaloneRefit:: no outer material', 'firstLine': 2, 'count': 1}}, 'message': 'Segmentation fault: Event counter: 41; Run: 204158; Evt: 70319934; Current algorithm: MuonCreatorAlg; Current Function: G4VoxelNavigation::ComputeStep', 'firstLine': 4, 'count': 1}}) self.assertEqual(self.myFileReport7.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, - 'firstError': {'count': 1, 'firstLine': 4, - 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown'}}) + 'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {}, 'lastNormalLine before CoreDump': {'message': 'ToolSvc.CombinedMuonTrackBuilder WARNING standaloneRefit:: no outer material', 'firstLine': 2, 'count': 1}}, 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown', 'firstLine': 4, 'count': 1}}) + self.assertEqual(self.myFileReport11.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, + 'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {'message0': 'warn [frontier.c:1114]: Trying next proxy lcgsquid.shef.ac.uk with same server lcgft-atlas.gridpp.rl.ac.uk', 'firstLine0': 8, 'count0': 2}, 'lastNormalLine before CoreDump': {'message': 'IOVDbSvc INFO HVS tag OFLCOND-MC16-SDR-16 resolved to PixDCSFSMState-SIM-RUN124-000-00 for folder /PIXEL/DCS/FSMSTATE', 'firstLine': 6, 'count': 1}}, 'message': 'Segmentation fault: Event counter: 0; Run: unknown; Evt: unknown; Current algorithm: <NONE>; Current Function: frontierHttpClnt_usinglastproxyingroup; Abnormal line(s) seen just before core dump: warn [frontier.c:1114]: Tryin...[truncated] (see the jobReport)', 'firstLine': 10, 'count': 1}}) + self.assertEqual(self.myFileReport12.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, + 'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {'message0': 'TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837731 pointer will be 0', 'firstLine0': 7, 'count0': 2, 'message1': 'Error in <TExMap::Remove>: key 980837731 not found at 306', 'firstLine1': 6, 'count1': 2}, 'lastNormalLine before CoreDump': {'message': 'Error in <CreateRealData>: Cannot find data member # 0 of class Identifier for parent TileTrigger!', 'firstLine': 3, 'count': 1}}, 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown; Abnormal line(s) seen just before core dump: TBufferFile::CheckObject:0: Ru...[truncated] (see the jobReport)', 'firstLine': 9, 'count': 1}}) def test_dbMonitor(self): print(self.myFileReport9) diff --git a/Tools/PyUtils/bin/acmd.py b/Tools/PyUtils/bin/acmd.py index eca71801e940a1e99233c7ca51f8b25bf229e9a7..d4f4472e8baf7bef1b36020afa6d7f01581e5454 100755 --- a/Tools/PyUtils/bin/acmd.py +++ b/Tools/PyUtils/bin/acmd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file PyUtils.acmd # @purpose main command line script for the general purpose athena scripts # @author Sebastien Binet @@ -18,23 +18,22 @@ def main(): msg = L.logging.getLogger('Acmd') msg.setLevel(L.logging.INFO) - acmdlib.Plugins.loadAll() + # To avoid loading all plugins every time, first try to find + # a specific plugin that matches the first N arguments: + cmd = None + for i in range(1,len(sys.argv)): + cmd_name = '.'.join(sys.argv[1:i+1]) + if acmdlib.Plugins.exists(cmd_name): + cmd = acmdlib.Plugins.load(cmd_name) + break + + # Otherwise load all plugins and leave the rest to the parser: + if cmd is None: + acmdlib.Plugins.loadAll() parser = acmdlib.ACMD_PARSER args = parser.parse_args() - msg.info('running sub-command [%s]...', args.command) - cmd_name = args.command - - sys_args = sys.argv[1:] - if sys_args[0] != cmd_name: - # special case of a sub(sub,...) command: - # acmd a b c cmd arg1 arg2 ... - # -> a.b.c.cmd - idx = sys_args.index(cmd_name) - cmd_name = '.'.join(sys_args[:idx+1]) - - cmd = acmdlib.Plugins.load(cmd_name) exitcode = 1 try: exitcode = cmd.main(args) diff --git a/Tools/PyUtils/bin/meta-diff.py b/Tools/PyUtils/bin/meta-diff.py index 08f91b6aae098c2ccd1e075c6794fbfb31b4b2cd..bee8a42dcfa6064f38a864b662298ac8b8d15489 100755 --- a/Tools/PyUtils/bin/meta-diff.py +++ b/Tools/PyUtils/bin/meta-diff.py @@ -5,162 +5,110 @@ from __future__ import print_function -import sys -import json import argparse -import time -import logging import os +import sys -# escape sequence [?1034h which appear on several runs due to smm capability (Meta Mode On) for xterm. +from PyUtils.MetaDiff import meta_diff + +# escape sequence [?1034h which appear on several runs due to smm capability +# (Meta Mode On) for xterm. if 'TERM' in os.environ: del os.environ['TERM'] -msg = logging.getLogger('MetaReaderDiff') - -from PyUtils.MetaReader import read_metadata - -def print_diff(parent_key, obj1, obj2): - print('') - if parent_key is not None: - print('{}:'.format(parent_key)) - print('> {}'.format(obj1)) - print('----------') - print('< {}'.format(obj2)) - -def print_diff_type(parent_key, obj1, obj2): - print('') - if parent_key is not None: - print('{}:'.format(parent_key)) - print('> {} (type: {})'.format(obj1, type(obj1))) - print('----------') - print('< {} (type: {})'.format(obj2, type(obj2))) - -def print_diff_dict_keys(parent_key, obj1, obj2): - print('') - if parent_key is not None: - print('{}:'.format(parent_key)) - print('> ' + ', '.join(['{}: {}'.format(k, '{...}' if isinstance(v, dict) else v) for k,v in sorted(obj1.items())])) - print('----------') - print('< ' + ', '.join(['{}: {}'.format(k, '{...}' if isinstance(v, dict) else v) for k,v in sorted(obj2.items())])) - -def compare(obj1, obj2, parent_key=None, ordered=False): - - if isinstance(obj1, dict) and isinstance(obj2, dict): - if sorted(obj1.keys()) != sorted(obj2.keys()): - print_diff_dict_keys(parent_key, obj1, obj2) - else: - for key in sorted(set(obj1.keys() + obj2.keys())): - - child_key = '' - if parent_key is not None: - child_key += parent_key + '/' - child_key += key - - compare(obj1[key], obj2[key], child_key, ordered) - - elif isinstance(obj1, list) and isinstance(obj2, list): - if ordered: - if sorted(obj1) != sorted(obj2): - print_diff(parent_key, obj1, obj2) - else: - if obj1 != obj2: - print_diff(parent_key, obj1, obj2) - elif isinstance(obj1, set) and isinstance(obj2, set): - if obj1 != obj2: - print_diff(parent_key, obj1, obj2) - elif type(obj1) == type(obj2): - if obj1 != obj2: - print_diff(parent_key, obj1, obj2) - else: - print_diff_type(parent_key, obj1, obj2) + +def main(): + """Handle command line arguments and call meta_diff""" + + parser = argparse.ArgumentParser( + description='Compare the metadata content fo two files') + + parser.add_argument( + 'files', + nargs=2, + metavar='FILE', + help='The names of two files to compare') + + parser.add_argument( + '-v', '--verbose', + action='store_true', + help='print detailed output on screen') + + parser.add_argument( + '-s', '--ordered', + action='store_true', + help='When comparing lists, check the element order too.') + + parser.add_argument( + '-d', '--drop', + nargs='*', + default=None, + metavar='KEY', + help='Keys to drop from metadata retrieved from file') + + parser.add_argument( + '-m', '--mode', + default='lite', + metavar='MODE', + type=str, + choices=['tiny', 'lite', 'full', 'peeker'], + help='''\ + This flag provides the user capability to select the amount of + metadata retrieved. There three options: + tiny (only those values used in PyJobTransforms), + lite (same output as dump-athfile) + and full ( all available data found) + ''') + + parser.add_argument( + '-t', '--type', + default=None, + metavar='TYPE', + type=str, + choices=['POOL', 'BS'], + help='''\ + The file type of the input filename. By default, it tries to + determine itself the file type of the input. + ''') + + parser.add_argument( + '-f', '--filter', + default=[], + metavar='FILTER', + nargs='+', + type=str, + help="Expression to select specific metadata fields to retrieve.") - - - -def _main(): - # Parsing the arguments provided by user - parser = argparse.ArgumentParser(description='This script reads metadata from a given file') - - parser.add_argument('-v', - '--verbose', - action='store_true', - help='print detailed output on screen') - parser.add_argument('-s', - '--ordered', - action='store_true', - help='When comparing lists, check the element order too.') - parser.add_argument('-o', - '--output', - metavar='FILE', - default=None, - help="Saves the output in a file. By default, the output is written on the screen (stdout) in a prettier format for better readabiilty.") - parser.add_argument('-m', - '--mode', - default= 'lite', - metavar='MODE', - type=str, - choices=['tiny', 'lite', 'full', 'peeker'], - help="This flag provides the user capability to select the amount of metadata retrieved. There three options: " - "tiny (only those values used in PyJobTransforms), " - "lite (same output as dump-athfile) " - "and full ( all available data found) ") - parser.add_argument('-t', - '--type', - default= None, - metavar='TYPE', - type=str, - choices=['POOL', 'BS'], - help="The file type of the input filename. By default, it tries to determine itself the file type of the input.") + parser.add_argument( + '-x', '--diff-format', + default= 'simple', + type=str, + choices=['simple', 'diff'], + help="Switch between 'simple' or 'diff' style differences ") - parser.add_argument('-f', - '--filter', - default= [], - metavar='FILTER', - nargs = '+', - type=str, - help="The metadata keys to filter. ") - parser.add_argument('--promote', - default=None, - type=bool, - help="Force promotion or not of the metadata keys ") - - parser.add_argument('filename1', help='First file to compare.') - parser.add_argument('filename2', help='Second file to compare.') - - args = parser.parse_args() - - verbose = args.verbose - ordered = args.ordered - filename1 = args.filename1 - filename2 = args.filename2 - output = args.output - mode = args.mode - file_type = args.type - meta_key_filter = args.filter - - msg.setLevel(logging.INFO if verbose else logging.WARNING) - # create a stream handler - handler = logging.StreamHandler() - handler.setLevel(logging.INFO if verbose else logging.WARNING) - # create a logging format - formatter = logging.Formatter('%(name)s %(levelname)s %(message)s') - handler.setFormatter(formatter) - # add the handlers to the logger - msg.addHandler(handler) - - metadatas = read_metadata([filename1, filename2], file_type, mode=mode, meta_key_filter= meta_key_filter, promote=args.promote) - metadata1 = metadatas[filename1] - metadata2 = metadatas[filename2] - compare(metadata1, metadata2, ordered=ordered) - - - -if __name__ == '__main__': - _main() + parser.add_argument( + '--promote', + default=None, + type=bool, + help="Force promotion or not of the metadata keys ") + args = parser.parse_args() + try: + diff = meta_diff( + args.files, verbose=args.verbose, ordered=args.ordered, + drop=args.drop, mode=args.mode, meta_key_filter=args.filter, + file_type=args.type, promote=args.promote, diff_format=args.diff_format) + except (ValueError, IndexError): + print("you must supply two files to compare") + sys.exit(1) + if diff: + print('\n'.join(diff)) + sys.exit(1) + sys.exit(0) +if __name__ == '__main__': + main() diff --git a/Tools/PyUtils/python/Dso.py b/Tools/PyUtils/python/Dso.py index 97a0a6e40d4c460368dcc17a613bc7aad8f311e5..97ff75df8b740af2fbf43b312d772b16d48a0fd7 100644 --- a/Tools/PyUtils/python/Dso.py +++ b/Tools/PyUtils/python/Dso.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @author: Sebastien Binet ## @file : PyUtils/python/Dso.py @@ -6,14 +6,10 @@ from __future__ import print_function -__version__ = "$Revision$" __author__ = "Sebastien Binet" __all__ = [ 'DsoDb', - 'gen_typeregistry_dso', - 'load_typeregistry_dso', - ] import os @@ -145,154 +141,6 @@ def find_library(libname): return lib return -_dflt_typereg_fname = 'typereg_dso_db.csv' -def gen_typeregistry_dso(oname=_dflt_typereg_fname): - '''inspect all the accessible reflex types and get their rootmap-naming. - also associate the clid if available. - ''' - import CLIDComps.clidGenerator as _c - cliddb = _c.clidGenerator(db=None) - del _c - - import PyUtils.path as _p - oname = _p.path(oname) - del _p - - import PyUtils.Logging as _L - msg = _L.logging.getLogger('typereg-dso') - msg.setLevel(_L.logging.INFO) - #msg.setLevel(_L.logging.VERBOSE) #MN - del _L - - msg.info("installing registry in [%s]...", oname) - - # FIXME: should use the Cxx one... - #reg = DsoDb() - reg = PyDsoDb() - - cls_names = reg.db.keys() - import cppyy - _load_lib = cppyy.loadDict - rflx = cppyy.gbl.RootType - - def _load_dict(libname,retry=10): - msg.debug("::: loading [%s]...", libname) - try: - return _load_lib(libname) - except (Exception,SystemError,) as err: - msg.warning("**error** %s", err) - return - - # we need to pre-load these guys as HepPDT is missing a linkopts - # against HepPID. see bug #46551 - hep_pid = _load_lib('libHepPID.so') - hep_pdt = _load_lib('libHepPDT.so') - - from PyUtils.Decorators import forking - - import os - dict_libs = reduce(set.union, [set(v) for v in reg.db.values()]) - dict_libs = [os.path.basename(l) for l in dict_libs] - - _veto_libs = [ - 'libG4EventGraphicsDict.so', # freaking statics ! - ] - dict_libs = [l for l in dict_libs if l not in _veto_libs] - - msg.debug("::: loading dict-libraries...") - @forking - def inspect_dict_lib(lib): - _load_dict(lib) - try: - rflx_names = update_db(lib) - return rflx_names - except Exception as err: - msg.warning(err) - return {} - - msg.debug(":"*80) - def update_db(libname): - rflx_names={} - for i in range(rflx.TypeSize()): - rflx_type = rflx.TypeAt(i) - rflx_name = rflx_type.Name(7) - root_name = _to_rootmap_name(rflx_name) -## # could also retro-fit typedefs, and allow their auto-loading... -## if rflx_type.IsTypedef(): -## import ROOT -## print "[%s] ::: processing [%s -> %s]..." % ( -## ROOT.TClass.GetClass(rflx_name).GetSharedLibs(), -## rflx_type.Name(6), -## rflx_name) - if not(root_name in reg.db): -## print "::ERR::",root_name - continue - ##rflx_names[rflx_name] = root_name - rflx_names[root_name] = rflx_name - return rflx_names - - rflx_names = {} - # for lib in dict_libs: - # rflx_names.update(inspect_dict_lib(lib)) - msg.warning("::: DSO functionality disabled in ROOT6!") - - msg.debug("::: rflx types: %d %d",len(rflx_names),len(reg.db.keys())) - msg.info("::: saving informations in [%s]...", oname) - - import csv - db= csv.writer(open(oname,'w'), delimiter=';') - keys = sorted(rflx_names.keys()) - for k in keys: - v = rflx_names[k] - clid = (cliddb.getClidFromName(k) or - cliddb.getClidFromName(v) or - cliddb.getClidFromTid(k) or - cliddb.getClidFromTid(v)) - if k != v: - db.writerow([k,v,clid or '']) - elif clid: - db.writerow([k,v,clid]) - - return rflx_names - -def load_typeregistry_dso(iname=None): - import os - import PyUtils.path as _p - if iname is None: - iname = _p.path(_dflt_typereg_fname) - if not iname.exists(): - import os - projects = os.environ.get('CMTPATH','').split(os.pathsep)[:2] - for project_root in projects: - n = _p.path(project_root)/"InstallArea"/"share"/iname - if n.exists(): - iname = n - break - else: - iname = _p.path(iname) - - if not iname.exists(): - raise OSError('no such file [%s]'%iname) - - import PyUtils.Logging as _L - msg = _L.logging.getLogger("typereg-dso") - msg.setLevel(_L.logging.INFO) - del _L - msg.info("::: loading typeregistry from [%s]...", iname) - - rflx_names = {} - f = iname.open(mode='r') - import csv - db = csv.reader(f, delimiter=';') - for row in db: - row = [i.strip() for i in row] - root_name = row[0] - rflx_name = row[1] - rflx_names[root_name] = rflx_name - - del _p, csv - return rflx_names - import re def _is_rootcint_dict (libname): diff --git a/Tools/PyUtils/python/MetaDiff.py b/Tools/PyUtils/python/MetaDiff.py new file mode 100644 index 0000000000000000000000000000000000000000..99156734068548fc5e9f27e9388a77adef4d75ad --- /dev/null +++ b/Tools/PyUtils/python/MetaDiff.py @@ -0,0 +1,168 @@ +"""The function in this module you should look to be using is meta_diff""" +# -*- coding: utf-8 -*- +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# This script reads metadata from a given file +from __future__ import print_function + +import logging + +from PyUtils.MetaReader import read_metadata + + +def print_diff(parent_key, obj1, obj2, diff_format): + """build comparison string for two non-dictionary objects""" + result = '\n' + + if diff_format == 'simple': + if obj1 is None: + result += '{} has been inserted'.format(parent_key) + elif obj2 is None: + result += '{} has been deleted'.format(parent_key) + else: + result += '{} has changed from \'{}\' to \'{}\''.format(parent_key, obj1, obj2) + result += '\n' + else: + if parent_key is not None: + result += '{}:\n'.format(parent_key) + result += '''\ + > {} + ---------- + < {} + '''.format(obj1, obj2) + + return result + + +def print_diff_type(parent_key, obj1, obj2, diff_format): + """Build diff string for objet of different type""" + result = '\n' + + if diff_format == 'simple': + if obj1 is None: + result += '{} has been inserted'.format(parent_key) + elif obj2 is None: + result += '{} has been deleted'.format(parent_key) + else: + result += '{} has changed changed type from {} (value: \'{}\') to {} (value: \'{}\')'.format(parent_key, type(obj1), obj1, type(obj2), obj2) + result += '\n' + else: + if parent_key is not None: + result += '{}:\n'.format(parent_key) + result += '''\ + > {} (type: {}) + ---------- + < {} (type: {}) + '''.format(obj1, type(obj1), obj2, type(obj2)) + + return result + + +def print_diff_dict_keys(parent_key, obj1, obj2, diff_format): + """build diff style string for dictionary objects""" + result = '\n' + + value1 = ', '.join(['{}: {}'.format(k, '{...}' if isinstance(v, dict) else v) + for k, v in sorted(obj1.items())]); + value2 = ', '.join(['{}: {}'.format(k, '{...}' if isinstance(v, dict) else v) + for k, v in sorted(obj2.items())]) + + if diff_format == 'simple': + if obj1 is None: + result += '{} has been inserted'.format(parent_key) + elif obj2 is None: + result += '{} has been deleted'.format(parent_key) + else: + result += '{} has changed from \'{}\' to \'{}\''.format(parent_key, value1, value2) + else: + if parent_key is not None: + result += '{}:\n'.format(parent_key) + result += '> ' + value1 + result += '\n----------\n' + result += '< ' + value2 + + result += '\n' + + return result + + +def compare(obj1, obj2, parent_key=None, ordered=False, diff_format='simple'): + """Caclulate difference between two objects + + Keyword arguments: + obj1 -- first object in comparision + obj2 -- second object in comparision + parent_key -- the key for in objects in the parent objects, used in recursion + ordered -- whether to check order of list content + """ + result = list() + + if not ordered and isinstance(obj1, list): + obj1.sort() + + if not ordered and isinstance(obj2, list): + obj2.sort() + + if obj1 == obj2: + return result + + if isinstance(obj1, type(obj2)): + + if isinstance(obj1, dict): + + if sorted(obj1.keys()) != sorted(obj2.keys()): + result += [print_diff_dict_keys(parent_key, obj1, obj2, diff_format)] + else: + for key in sorted(set(obj1.keys() + obj2.keys())): + if parent_key: + child_key = '{}/{}'.format(parent_key, key) + else: + child_key = key + result += compare(obj1[key], obj2[key], child_key, ordered, diff_format) + + else: + result += [print_diff(parent_key, obj1, obj2, diff_format)] + + else: + result += [print_diff_type(parent_key, obj1, obj2, diff_format)] + + return result + + +def meta_diff(files, verbose=False, ordered=False, drop=None, mode='lite', + meta_key_filter=None, file_type=None, promote=False, diff_format='simple'): + """ + Compare the in-file metadata in two given files. Uses PyUtils.MetaReader + to obtain file content. Generates list of string that show difference. + Returns empty list if no difference is found + + Keyword arguments: + files -- Names of two files to compare + verbose -- toggle to get debug information + ordered -- whether to check order of lists in the metadata + drop -- keys to drop from metadata retrieved by MetaReader + mode -- MetaReader argument setting amount of content (default 'lite'). + Allowed values are: tiny, lite, peeker, and full + meta_key_filter -- MetaReader argument selecting keys to retrieve (default + get all) + file_type -- Type of files, POOL or BS (default: auto-configure) + promote -- MetaReader argument (default: False) + diff_format -- Show 'simple' or 'diff' style differences (default: 'simple') + """ + if len(files) != 2: + raise ValueError("Wrong number of files passes, need two") + + msg = logging.getLogger('MetaReader') + msg.setLevel(logging.INFO if verbose else logging.WARNING) + + metadata = read_metadata( + files, file_type, mode=mode, + meta_key_filter=meta_key_filter, promote=promote) + + try: + for key in drop: + for _, value in metadata.items(): + value.pop(key, None) + except TypeError: + pass + + return compare(metadata[files[0]], metadata[files[1]], ordered=ordered, diff_format=diff_format) diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py index b685a46ba54ef3ebad172c10d4f565f45acf8d14..588fa40ef7d5373665d8decd9979fce0e5220062 100644 --- a/Tools/PyUtils/python/MetaReader.py +++ b/Tools/PyUtils/python/MetaReader.py @@ -51,7 +51,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me if mode != 'full' and len(meta_key_filter) > 0: raise NameError('It is possible to use the meta_key_filter option only for full mode') - if len(meta_key_filter) > 0: + if meta_key_filter: msg.info('Filter used: {0}'.format(meta_key_filter)) # create the storage object for metadata. @@ -149,7 +149,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me '*': 'EventStreamInfo_p*' } - if mode == 'full' and len(meta_key_filter) > 0: + if mode == 'full' and meta_key_filter: meta_filter = {f: '*' for f in meta_key_filter} # store all persistent classes for metadata container existing in a POOL/ROOT file. persistent_instances = {} @@ -199,7 +199,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me metadata_tree.GetEntry(0) # clean the meta-dict if the meta_key_filter flag is used, to return only the key of interest - if len(meta_key_filter) > 0: + if meta_key_filter: meta_dict[filename] = {} # read the metadata diff --git a/Tools/PyUtils/python/MetaReaderPeeker.py b/Tools/PyUtils/python/MetaReaderPeeker.py index fc78df8b49594973a8024cfa56cae4a00df2db90..6a43f85f9e1677ed5d4f0c0daea28b606a311c87 100644 --- a/Tools/PyUtils/python/MetaReaderPeeker.py +++ b/Tools/PyUtils/python/MetaReaderPeeker.py @@ -9,7 +9,7 @@ metadata_all_files = {} def _setup(): - + from PyUtils.MetaReader import read_metadata from AthenaCommon.Logging import logging @@ -20,10 +20,9 @@ def _setup(): # get input file name from RecExConfig.RecoFunctions import InputFileNames - inFiles = InputFileNames() from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - if athenaCommonFlags.isOnline() and not inFiles: + if athenaCommonFlags.isOnline() and (not InputFileNames() or all([f.strip() == '' for f in InputFileNames()])): # set minimal items of inputFileSummary metadata = { 'file_type':'BS', @@ -31,6 +30,7 @@ def _setup(): 'TagStreamsRef':'' } else: + inFiles = InputFileNames() if len(inFiles) < 1: msg.warning("No input files specified yet! Cannot do anything.") return diff --git a/Tools/PyUtils/python/MetaReaderPeekerFull.py b/Tools/PyUtils/python/MetaReaderPeekerFull.py index 17aefd5c452cd84a983edf7631bcc38a26368ab3..76942f1a502576c200fb2cfbefe98c67beb47ece 100644 --- a/Tools/PyUtils/python/MetaReaderPeekerFull.py +++ b/Tools/PyUtils/python/MetaReaderPeekerFull.py @@ -20,10 +20,9 @@ def _setup(): # get input file name from RecExConfig.RecoFunctions import InputFileNames - inFiles = InputFileNames() - + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - if athenaCommonFlags.isOnline() and not inFiles: + if athenaCommonFlags.isOnline() and (not InputFileNames() or all([f.strip() == '' for f in InputFileNames()])): # set minimal items of inputFileSummary metadata = { 'file_type':'BS', @@ -31,6 +30,7 @@ def _setup(): 'TagStreamsRef':'' } else: + inFiles = InputFileNames() if len(inFiles) < 1: msg.warning("No input files specified yet! Cannot do anything.") return diff --git a/Tools/PyUtils/python/RootUtils.py b/Tools/PyUtils/python/RootUtils.py index ed5bdb3fc340c6bcf699d722c418c735220c554a..7ff37474a3e02494d7c548fb89838b25d1ae8007 100644 --- a/Tools/PyUtils/python/RootUtils.py +++ b/Tools/PyUtils/python/RootUtils.py @@ -28,10 +28,10 @@ from .Decorators import memoize ### functions ----------------------------------------------------------------- # Set buffer size, in bytes. -# The argument to SetSize is in elements, not bytes. +# The argument to reshape is in elements, not bytes. def _set_byte_size (buf, sz): eltsz = array(buf.typecode).itemsize - buf.SetSize (sz // eltsz) + buf.reshape ((sz // eltsz,)) return def import_root(batch=True): diff --git a/Tools/PyUtils/python/_rfio.py b/Tools/PyUtils/python/_rfio.py deleted file mode 100644 index 39abdcc1c9fdc0e1ac3afe90957fcd418bcd38ab..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/_rfio.py +++ /dev/null @@ -1,468 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from ctypes import * - -def _load_library (libname): - """ - Helper method to load a library by its natural name, not the OS-native name. - But if the OS-native name is given, it is safely handled too. - usage: - >>> load_library ('AthenaServices') - >>> load_library ('AthenaServicesDict') - """ - import ctypes, sys - plat = sys.platform - if plat.count('linux')>0: - lib_prefix,lib_suffix = 'lib', '.so' - elif plat == 'win32': - lib_prefix,lib_suffix = '', '.dll' - elif plat == 'darwin': - lib_prefix,lib_suffix = 'lib','.dylib' - else: - raise RuntimeError ("sorry platform [%s] is not (yet?) supported"%plat) - _sys_libname = libname - if not _sys_libname.startswith (lib_prefix): - _sys_libname = ''.join([lib_prefix,_sys_libname]) - if not _sys_libname.endswith (lib_suffix): - _sys_libname = ''.join([_sys_libname, lib_suffix]) - return ctypes.cdll.LoadLibrary (_sys_libname) - -STRING = c_char_p -_libraries = {} -_libraries['libshift.so'] = _load_library('libshift.so') - - -rfio_access = _libraries['libshift.so'].rfio_access -rfio_access.restype = c_int -rfio_access.argtypes = [STRING, c_int] -rfio_chdir = _libraries['libshift.so'].rfio_chdir -rfio_chdir.restype = c_int -rfio_chdir.argtypes = [STRING] -rfio_chmod = _libraries['libshift.so'].rfio_chmod -rfio_chmod.restype = c_int -rfio_chmod.argtypes = [STRING, c_int] -rfio_chown = _libraries['libshift.so'].rfio_chown -rfio_chown.restype = c_int -rfio_chown.argtypes = [STRING, c_int, c_int] -rfio_close = _libraries['libshift.so'].rfio_close -rfio_close.restype = c_int -rfio_close.argtypes = [c_int] -rfio_close_v3 = _libraries['libshift.so'].rfio_close_v3 -rfio_close_v3.restype = c_int -rfio_close_v3.argtypes = [c_int] -rfio_end = _libraries['libshift.so'].rfio_end -rfio_end.restype = c_int -rfio_end.argtypes = [] -rfio_symend = _libraries['libshift.so'].rfio_symend -rfio_symend.restype = c_int -rfio_symend.argtypes = [] -rfio_unend = _libraries['libshift.so'].rfio_unend -rfio_unend.restype = c_int -rfio_unend.argtypes = [] -rfio_fchmod = _libraries['libshift.so'].rfio_fchmod -rfio_fchmod.restype = c_int -rfio_fchmod.argtypes = [c_int, c_int] -rfio_fchown = _libraries['libshift.so'].rfio_fchown -rfio_fchown.restype = c_int -rfio_fchown.argtypes = [c_int, c_int, c_int] -class stat(Structure): - pass -rfio_fstat = _libraries['libshift.so'].rfio_fstat -rfio_fstat.restype = c_int -rfio_fstat.argtypes = [c_int, POINTER(stat)] -rfio_getcwd = _libraries['libshift.so'].rfio_getcwd -rfio_getcwd.restype = STRING -rfio_getcwd.argtypes = [STRING, c_int] -rfio_lockf = _libraries['libshift.so'].rfio_lockf -rfio_lockf.restype = c_int -rfio_lockf.argtypes = [c_int, c_int, c_long] -__off_t = c_long -off_t = __off_t -rfio_lseek = _libraries['libshift.so'].rfio_lseek -rfio_lseek.restype = off_t -rfio_lseek.argtypes = [c_int, off_t, c_int] -rfio_lstat = _libraries['libshift.so'].rfio_lstat -rfio_lstat.restype = c_int -rfio_lstat.argtypes = [STRING, POINTER(stat)] -rfio_mkdir = _libraries['libshift.so'].rfio_mkdir -rfio_mkdir.restype = c_int -rfio_mkdir.argtypes = [STRING, c_int] -rfio_mstat = _libraries['libshift.so'].rfio_mstat -rfio_mstat.restype = c_int -rfio_mstat.argtypes = [STRING, POINTER(stat)] -rfio_munlink = _libraries['libshift.so'].rfio_munlink -rfio_munlink.restype = c_int -rfio_munlink.argtypes = [STRING] -rfio_msymlink = _libraries['libshift.so'].rfio_msymlink -rfio_msymlink.restype = c_int -rfio_msymlink.argtypes = [STRING, STRING] -rfio_mstat_reset = _libraries['libshift.so'].rfio_mstat_reset -rfio_mstat_reset.restype = c_int -rfio_mstat_reset.argtypes = [] -rfio_munlink_reset = _libraries['libshift.so'].rfio_munlink_reset -rfio_munlink_reset.restype = c_int -rfio_munlink_reset.argtypes = [] -rfio_msymlink_reset = _libraries['libshift.so'].rfio_msymlink_reset -rfio_msymlink_reset.restype = c_int -rfio_msymlink_reset.argtypes = [] -rfio_open = _libraries['libshift.so'].rfio_open -rfio_open.restype = c_int -rfio_open.argtypes = [STRING, c_int] -rfio_open_v3 = _libraries['libshift.so'].rfio_open_v3 -rfio_open_v3.restype = c_int -rfio_open_v3.argtypes = [STRING, c_int, c_int] -rfio_perror = _libraries['libshift.so'].rfio_perror -rfio_perror.restype = None -rfio_perror.argtypes = [STRING] -class iovec(Structure): - pass -rfio_preseek = _libraries['libshift.so'].rfio_preseek -rfio_preseek.restype = c_int -rfio_preseek.argtypes = [c_int, POINTER(iovec), c_int] -rfio_read = _libraries['libshift.so'].rfio_read -rfio_read.restype = c_int -rfio_read.argtypes = [c_int, c_void_p, c_int] -rfio_read_v3 = _libraries['libshift.so'].rfio_read_v3 -rfio_read_v3.restype = c_int -rfio_read_v3.argtypes = [c_int, STRING, c_int] -rfio_readlink = _libraries['libshift.so'].rfio_readlink -rfio_readlink.restype = c_int -rfio_readlink.argtypes = [STRING, STRING, c_int] -rfio_rename = _libraries['libshift.so'].rfio_rename -rfio_rename.restype = c_int -rfio_rename.argtypes = [STRING, STRING] -rfio_rmdir = _libraries['libshift.so'].rfio_rmdir -rfio_rmdir.restype = c_int -rfio_rmdir.argtypes = [STRING] -rfio_serrno = _libraries['libshift.so'].rfio_serrno -rfio_serrno.restype = c_int -rfio_serrno.argtypes = [] -rfio_serror = _libraries['libshift.so'].rfio_serror -rfio_serror.restype = STRING -rfio_serror.argtypes = [] -rfio_stat = _libraries['libshift.so'].rfio_stat -rfio_stat.restype = c_int -rfio_stat.argtypes = [STRING, POINTER(stat)] -class rfstatfs(Structure): - pass -rfio_statfs = _libraries['libshift.so'].rfio_statfs -rfio_statfs.restype = c_int -rfio_statfs.argtypes = [STRING, POINTER(rfstatfs)] -rfio_symlink = _libraries['libshift.so'].rfio_symlink -rfio_symlink.restype = c_int -rfio_symlink.argtypes = [STRING, STRING] -rfio_unlink = _libraries['libshift.so'].rfio_unlink -rfio_unlink.restype = c_int -rfio_unlink.argtypes = [STRING] -rfio_write = _libraries['libshift.so'].rfio_write -rfio_write.restype = c_int -rfio_write.argtypes = [c_int, c_void_p, c_int] -rfio_write_v3 = _libraries['libshift.so'].rfio_write_v3 -rfio_write_v3.restype = c_int -rfio_write_v3.argtypes = [c_int, STRING, c_int] -rfio_smstat = _libraries['libshift.so'].rfio_smstat -rfio_smstat.restype = c_int -rfio_smstat.argtypes = [c_int, STRING, POINTER(stat), c_int] -rfio_lseek_v3 = _libraries['libshift.so'].rfio_lseek_v3 -rfio_lseek_v3.restype = c_int -rfio_lseek_v3.argtypes = [c_int, c_int, c_int] -rfio_close64_v3 = _libraries['libshift.so'].rfio_close64_v3 -rfio_close64_v3.restype = c_int -rfio_close64_v3.argtypes = [c_int] -class stat64(Structure): - pass -rfio_fstat64 = _libraries['libshift.so'].rfio_fstat64 -rfio_fstat64.restype = c_int -rfio_fstat64.argtypes = [c_int, POINTER(stat64)] -__quad_t = c_longlong -__off64_t = __quad_t -off64_t = __off64_t -rfio_lockf64 = _libraries['libshift.so'].rfio_lockf64 -rfio_lockf64.restype = c_int -rfio_lockf64.argtypes = [c_int, c_int, off64_t] -rfio_lseek64 = _libraries['libshift.so'].rfio_lseek64 -rfio_lseek64.restype = off64_t -rfio_lseek64.argtypes = [c_int, off64_t, c_int] -rfio_lseek64_v3 = _libraries['libshift.so'].rfio_lseek64_v3 -rfio_lseek64_v3.restype = off64_t -rfio_lseek64_v3.argtypes = [c_int, off64_t, c_int] -rfio_lstat64 = _libraries['libshift.so'].rfio_lstat64 -rfio_lstat64.restype = c_int -rfio_lstat64.argtypes = [STRING, POINTER(stat64)] -rfio_mstat64 = _libraries['libshift.so'].rfio_mstat64 -rfio_mstat64.restype = c_int -rfio_mstat64.argtypes = [STRING, POINTER(stat64)] -rfio_open64 = _libraries['libshift.so'].rfio_open64 -rfio_open64.restype = c_int -rfio_open64.argtypes = [STRING, c_int] -rfio_open64_v3 = _libraries['libshift.so'].rfio_open64_v3 -rfio_open64_v3.restype = c_int -rfio_open64_v3.argtypes = [STRING, c_int, c_int] -class iovec64(Structure): - pass -rfio_preseek64 = _libraries['libshift.so'].rfio_preseek64 -rfio_preseek64.restype = c_int -rfio_preseek64.argtypes = [c_int, POINTER(iovec64), c_int] -rfio_read64_v3 = _libraries['libshift.so'].rfio_read64_v3 -rfio_read64_v3.restype = c_int -rfio_read64_v3.argtypes = [c_int, STRING, c_int] -rfio_stat64 = _libraries['libshift.so'].rfio_stat64 -rfio_stat64.restype = c_int -rfio_stat64.argtypes = [STRING, POINTER(stat64)] -rfio_write64_v3 = _libraries['libshift.so'].rfio_write64_v3 -rfio_write64_v3.restype = c_int -rfio_write64_v3.argtypes = [c_int, STRING, c_int] -rfio_smstat64 = _libraries['libshift.so'].rfio_smstat64 -rfio_smstat64.restype = c_int -rfio_smstat64.argtypes = [c_int, STRING, POINTER(stat64), c_int] -class __dirstream(Structure): - pass -DIR = __dirstream -rfio_closedir = _libraries['libshift.so'].rfio_closedir -rfio_closedir.restype = c_int -rfio_closedir.argtypes = [POINTER(DIR)] -class _IO_FILE(Structure): - pass -FILE = _IO_FILE -rfio_fclose = _libraries['libshift.so'].rfio_fclose -rfio_fclose.restype = c_int -rfio_fclose.argtypes = [POINTER(FILE)] -rfio_feof = _libraries['libshift.so'].rfio_feof -rfio_feof.restype = c_int -rfio_feof.argtypes = [POINTER(FILE)] -rfio_ferror = _libraries['libshift.so'].rfio_ferror -rfio_ferror.restype = c_int -rfio_ferror.argtypes = [POINTER(FILE)] -rfio_fflush = _libraries['libshift.so'].rfio_fflush -rfio_fflush.restype = c_int -rfio_fflush.argtypes = [POINTER(FILE)] -rfio_fileno = _libraries['libshift.so'].rfio_fileno -rfio_fileno.restype = c_int -rfio_fileno.argtypes = [POINTER(FILE)] -rfio_fopen = _libraries['libshift.so'].rfio_fopen -rfio_fopen.restype = POINTER(FILE) -rfio_fopen.argtypes = [STRING, STRING] -rfio_fread = _libraries['libshift.so'].rfio_fread -rfio_fread.restype = c_int -rfio_fread.argtypes = [c_void_p, c_int, c_int, POINTER(FILE)] -rfio_fseek = _libraries['libshift.so'].rfio_fseek -rfio_fseek.restype = c_int -rfio_fseek.argtypes = [POINTER(FILE), c_long, c_int] -rfio_ftell = _libraries['libshift.so'].rfio_ftell -rfio_ftell.restype = c_long -rfio_ftell.argtypes = [POINTER(FILE)] -rfio_fwrite = _libraries['libshift.so'].rfio_fwrite -rfio_fwrite.restype = c_int -rfio_fwrite.argtypes = [c_void_p, c_int, c_int, POINTER(FILE)] -rfio_getc = _libraries['libshift.so'].rfio_getc -rfio_getc.restype = c_int -rfio_getc.argtypes = [POINTER(FILE)] -rfio_pclose = _libraries['libshift.so'].rfio_pclose -rfio_pclose.restype = c_int -rfio_pclose.argtypes = [POINTER(FILE)] -rfio_popen = _libraries['libshift.so'].rfio_popen -rfio_popen.restype = POINTER(FILE) -rfio_popen.argtypes = [STRING, STRING] -rfio_pread = _libraries['libshift.so'].rfio_pread -rfio_pread.restype = c_int -rfio_pread.argtypes = [STRING, c_int, c_int, POINTER(FILE)] -rfio_pwrite = _libraries['libshift.so'].rfio_pwrite -rfio_pwrite.restype = c_int -rfio_pwrite.argtypes = [STRING, c_int, c_int, POINTER(FILE)] -rfio_opendir = _libraries['libshift.so'].rfio_opendir -rfio_opendir.restype = POINTER(DIR) -rfio_opendir.argtypes = [STRING] -class dirent(Structure): - pass -rfio_readdir = _libraries['libshift.so'].rfio_readdir -rfio_readdir.restype = POINTER(dirent) -rfio_readdir.argtypes = [POINTER(DIR)] -rfio_rewinddir = _libraries['libshift.so'].rfio_rewinddir -rfio_rewinddir.restype = c_int -rfio_rewinddir.argtypes = [POINTER(DIR)] -rfio_fopen64 = _libraries['libshift.so'].rfio_fopen64 -rfio_fopen64.restype = POINTER(FILE) -rfio_fopen64.argtypes = [STRING, STRING] -rfio_fseeko64 = _libraries['libshift.so'].rfio_fseeko64 -rfio_fseeko64.restype = c_int -rfio_fseeko64.argtypes = [POINTER(FILE), off64_t, c_int] -rfio_ftello64 = _libraries['libshift.so'].rfio_ftello64 -rfio_ftello64.restype = off64_t -rfio_ftello64.argtypes = [POINTER(FILE)] -class dirent64(Structure): - pass -rfio_readdir64 = _libraries['libshift.so'].rfio_readdir64 -rfio_readdir64.restype = POINTER(dirent64) -rfio_readdir64.argtypes = [POINTER(DIR)] -size_t = c_uint -rfio_errmsg_r = _libraries['libshift.so'].rfio_errmsg_r -rfio_errmsg_r.restype = STRING -rfio_errmsg_r.argtypes = [c_int, c_int, STRING, size_t] -rfio_errmsg = _libraries['libshift.so'].rfio_errmsg -rfio_errmsg.restype = STRING -rfio_errmsg.argtypes = [c_int, c_int] -rfio_serror_r = _libraries['libshift.so'].rfio_serror_r -rfio_serror_r.restype = STRING -rfio_serror_r.argtypes = [STRING, size_t] -__ino_t = c_ulong -dirent._fields_ = [ - ('d_ino', __ino_t), - ('d_off', __off_t), - ('d_reclen', c_ushort), - ('d_type', c_ubyte), - ('d_name', c_char * 256), -] -__u_quad_t = c_ulonglong -__ino64_t = __u_quad_t -dirent64._pack_ = 4 -dirent64._fields_ = [ - ('d_ino', __ino64_t), - ('d_off', __off64_t), - ('d_reclen', c_ushort), - ('d_type', c_ubyte), - ('d_name', c_char * 256), -] -__dev_t = __u_quad_t -__mode_t = c_uint -__nlink_t = c_uint -__uid_t = c_uint -__gid_t = c_uint -__blksize_t = c_long -__blkcnt_t = c_long -class timespec(Structure): - pass -__time_t = c_long -timespec._fields_ = [ - ('tv_sec', __time_t), - ('tv_nsec', c_long), -] -stat._pack_ = 4 -stat._fields_ = [ - ('st_dev', __dev_t), - ('__pad1', c_ushort), - ('st_ino', __ino_t), - ('st_mode', __mode_t), - ('st_nlink', __nlink_t), - ('st_uid', __uid_t), - ('st_gid', __gid_t), - ('st_rdev', __dev_t), - ('__pad2', c_ushort), - ('st_size', __off_t), - ('st_blksize', __blksize_t), - ('st_blocks', __blkcnt_t), - ('st_atim', timespec), - ('st_mtim', timespec), - ('st_ctim', timespec), - ('__unused4', c_ulong), - ('__unused5', c_ulong), -] -__blkcnt64_t = __quad_t -stat64._pack_ = 4 -stat64._fields_ = [ - ('st_dev', __dev_t), - ('__pad1', c_uint), - ('__st_ino', __ino_t), - ('st_mode', __mode_t), - ('st_nlink', __nlink_t), - ('st_uid', __uid_t), - ('st_gid', __gid_t), - ('st_rdev', __dev_t), - ('__pad2', c_uint), - ('st_size', __off64_t), - ('st_blksize', __blksize_t), - ('st_blocks', __blkcnt64_t), - ('st_atim', timespec), - ('st_mtim', timespec), - ('st_ctim', timespec), - ('st_ino', __ino64_t), -] -iovec._fields_ = [ - ('iov_base', c_void_p), - ('iov_len', size_t), -] -__dirstream._fields_ = [ -] -class _IO_marker(Structure): - pass -_IO_lock_t = None -_IO_FILE._pack_ = 4 -_IO_FILE._fields_ = [ - ('_flags', c_int), - ('_IO_read_ptr', STRING), - ('_IO_read_end', STRING), - ('_IO_read_base', STRING), - ('_IO_write_base', STRING), - ('_IO_write_ptr', STRING), - ('_IO_write_end', STRING), - ('_IO_buf_base', STRING), - ('_IO_buf_end', STRING), - ('_IO_save_base', STRING), - ('_IO_backup_base', STRING), - ('_IO_save_end', STRING), - ('_markers', POINTER(_IO_marker)), - ('_chain', POINTER(_IO_FILE)), - ('_fileno', c_int), - ('_flags2', c_int), - ('_old_offset', __off_t), - ('_cur_column', c_ushort), - ('_vtable_offset', c_byte), - ('_shortbuf', c_char * 1), - ('_lock', POINTER(_IO_lock_t)), - ('_offset', __off64_t), - ('__pad1', c_void_p), - ('__pad2', c_void_p), - ('__pad3', c_void_p), - ('__pad4', c_void_p), - ('__pad5', size_t), - ('_mode', c_int), - ('_unused2', c_char * 40), -] -rfstatfs._fields_ = [ - ('totblks', c_long), - ('freeblks', c_long), - ('bsize', c_long), - ('totnods', c_long), - ('freenods', c_long), -] -iovec64._pack_ = 4 -iovec64._fields_ = [ - ('iov_base', off64_t), - ('iov_len', c_int), -] -_IO_marker._fields_ = [ - ('_next', POINTER(_IO_marker)), - ('_sbuf', POINTER(_IO_FILE)), - ('_pos', c_int), -] -__all__ = ['rfio_lstat', 'rfio_msymlink_reset', 'FILE', '__off64_t', - 'size_t', 'rfio_preseek', 'rfio_fstat', 'rfio_fflush', - 'rfio_closedir', '__ino64_t', 'rfio_serrno', 'rfio_feof', - 'rfio_lseek_v3', 'rfio_ftell', 'rfio_fchown', 'rfio_lseek', - 'rfio_close64_v3', 'rfio_fchmod', '__time_t', - 'rfio_serror', 'rfio_fseeko64', 'rfio_read64_v3', - '__nlink_t', 'rfio_open', 'rfio_smstat', '_IO_lock_t', - 'timespec', '__off_t', 'rfio_ftello64', 'rfio_close', - 'rfio_write_v3', 'rfio_munlink_reset', 'rfio_mkdir', - 'rfio_lockf64', 'rfio_statfs', 'rfio_errmsg', - 'rfio_readlink', 'rfio_close_v3', 'dirent64', - 'rfio_lseek64_v3', 'rfio_end', 'rfio_popen', 'rfio_symend', - 'rfio_fopen64', 'rfio_pread', 'rfio_fopen', '__dirstream', - 'rfio_preseek64', '__blkcnt_t', 'rfio_msymlink', - 'rfio_fclose', 'rfio_readdir', 'rfio_readdir64', - 'rfio_rename', '__mode_t', 'off64_t', 'rfio_pwrite', - '__blksize_t', 'rfio_fwrite', 'rfio_fseek', 'rfio_lockf', - 'rfio_stat', 'rfio_ferror', 'rfio_rewinddir', 'rfio_getc', - 'rfio_getcwd', 'iovec64', 'rfio_chmod', 'rfio_chdir', - 'rfio_serror_r', 'rfio_smstat64', 'rfio_mstat64', - 'rfio_rmdir', 'rfio_symlink', '__blkcnt64_t', '__dev_t', - 'rfio_unlink', 'rfio_lseek64', 'rfio_munlink', - 'rfio_pclose', 'rfio_open64_v3', 'rfio_write', '_IO_FILE', - 'rfio_fileno', 'rfio_mstat', 'rfio_perror', 'off_t', - 'iovec', 'rfio_chown', 'stat64', 'rfio_fread', - '_IO_marker', 'rfio_fstat64', '__u_quad_t', 'DIR', - 'rfstatfs', 'dirent', '__gid_t', 'rfio_opendir', 'stat', - 'rfio_read_v3', 'rfio_open64', '__ino_t', 'rfio_access', - 'rfio_stat64', 'rfio_mstat_reset', 'rfio_lstat64', - 'rfio_read', '__quad_t', 'rfio_unend', 'rfio_errmsg_r', - 'rfio_open_v3', '__uid_t', 'rfio_write64_v3'] - diff --git a/Tools/PyUtils/python/acmdlib.py b/Tools/PyUtils/python/acmdlib.py index d8120d792dc85239f0798da323757d53db2cbd3d..20eeecc43868fee5dda11be603eeb33f9788aedf 100644 --- a/Tools/PyUtils/python/acmdlib.py +++ b/Tools/PyUtils/python/acmdlib.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file PyUtils.acmdlib # @purpose a library to ease the writing of sub-command scripts @@ -7,7 +7,6 @@ from __future__ import with_statement -__version__ = "$Revision: 464077 $" __doc__ = "a library to ease the writing of sub-command scripts" __author__ = "Sebastien Binet" @@ -32,11 +31,6 @@ ACMD_PARSER = argparse.ArgumentParser( prog="acmd", description="a general script interface with sub-commands", ) -ACMD_PARSER.add_argument( - '--version', - action='version', - version=__version__, - help="show program's version number and exit") ACMD_SUBPARSERS = ACMD_PARSER.add_subparsers( dest='command', @@ -141,6 +135,12 @@ class Plugins(object): """ cls._plugins[name] = value + @classmethod + def exists(cls, name): + """Check if plugin exists + """ + return name in cls._plugins + @classmethod def load(cls, name): """Load given plugin and return it @@ -188,4 +188,5 @@ def register(name, value): ex: register('check-file', 'PyUtils.CheckFileLib:fct') """ + return Plugins.register(name, value) diff --git a/Tools/PyUtils/python/bwdcompat.py b/Tools/PyUtils/python/bwdcompat.py deleted file mode 100644 index c70a52586a196abd65f1fb8b87278ec8bdb75b0a..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/bwdcompat.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import subprocess - -### monkey-patch subprocess (fwd compat w/ py-3.x) ---------------------------- -def getstatusoutput(cmd, *popenargs, **kwargs): - if isinstance(cmd, basestring): - cmd = cmd.split() - if 'stdout' in kwargs: - raise ValueError('stdout argument not allowed, it will be overridden.') - kwargs['stdout'] = subprocess.PIPE - p = subprocess.Popen(cmd, *popenargs, **kwargs) - sc = p.returncode - if sc is None: - sc = 0 - fd = p.stdout - out= ''.join(list(fd.readlines())) - if out[-1:] == '\n': out = out[:-1] - return sc,out -subprocess.getstatusoutput = getstatusoutput -del getstatusoutput - -def getstatus(cmd, *popenargs, **kwargs): - return subprocess.getstatusoutput(cmd, *popenargs, **kwargs)[0] -subprocess.getstatus = getstatus -del getstatus - -def getoutput(cmd, *popenargs, **kwargs): - return subprocess.getstatusoutput(cmd, *popenargs, **kwargs)[1] -subprocess.getoutput = getoutput -del getoutput -### --------------------------------------------------------------------------- diff --git a/Tools/PyUtils/python/castor.py b/Tools/PyUtils/python/castor.py deleted file mode 100644 index 2c0653fa6d16af526e8e3476b62465522e3e4fe9..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/castor.py +++ /dev/null @@ -1,414 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -# @file castor.py -# @brief A simple helper to handle simple tasks with CASTOR -# -# - nsls : lists CASTOR name server directory. Handles wildcards only -# in the filename (no wildcard in path to file allowed) -# - stager_get: takes a path-to-file-pattern and stages the matching files -# per bunch of N (default=10) files -# - rfcat : todo -# - rfcp : done in a very naive way -# - rfiod : todo -# - rfrename : todo -# - rfstat : done -# - rfchmod : todo -# - rfdir : done -# - rfmkdir : todo -# - rfrm : todo -# - rftp : todo -# -# date: May 2006 -# @author: Sebastien Binet <binet@cern.ch> -from __future__ import print_function -import commands -import os -import fnmatch -import re - -def group(iterator, count): - """ - This function extracts items from a sequence or iterator 'count' at a time: - >>> list(group([0, 1, 2, 3, 4, 5, 6], 2)) - [(0, 1), (2, 3), (4, 5)] - Stolen from : - http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/439095 - """ - itr = iter(iterator) - while True: - yield tuple([itr.next() for i in range(count)]) - -__author__ = "Sebastien Binet <binet@cern.ch>" -__version__ = "$Revision$" -__doc__ = """A set of simple helper methods to handle simple tasks with CASTOR. -""" - -def hasWildcard(name) : - """Return true if the name has a UNIX wildcard (*,?,[,]) - """ - if ( name.count('*') > 0 or name.count('?') > 0 or - name.count('[') > 0 or name.count(']') > 0 ) : - return True - else : - return False - -def nsls(files, prefix=None): - """ - lists CASTOR name server directory/file entries. - If path is a directory, nsls lists the entries in the directory; - they are sorted alphabetically. - - `files` specifies the CASTOR pathname. - `prefix` specifies the prefix one wants to prepend to the path found. - (e.g. prefix='root://castoratlas/' or 'rfio:' or 'castor:') - - ex: - >>> nsls('/castor/cern.ch/atlas/*') - >>> nsls('/castor/cern.ch/atl*/foo?[bar]/*.pool.root.?') - >>> nsls('/castor/cern.ch/atlas/*', prefix='root://castoratlas/') - """ - _prefix = 'root://castoratlas/' - path, fname = os.path.split(files) - for p in (_prefix, 'rfio:', 'castor:'): - if path.startswith(p): - path = path[len(p):] - if path.startswith('//'): - path = path[1:] - if not path.startswith('/'): - path = '/'+path - break - if hasWildcard(path): - paths = nsls(path) - return sum([nsls(os.path.join(p,fname)) - for p in paths], []) - sc, flist = commands.getstatusoutput('nsls %s' % (path,)) - if sc: # command failed - print(flist) - return [] - - flist = flist.split() - if not (os.path.basename(files) in ['', '*']): # no need to filter - pattern = fnmatch.translate(os.path.basename(files)) - flist = filter(lambda x: re.search(pattern, x), flist) - if prefix and isinstance(prefix, str): - return [os.path.join(prefix+path, p) for p in flist] - else: - return [os.path.join(path, p) for p in flist] - -def _old_nsls(path) : - """ - lists CASTOR name server directory/file entries. - If path is a directory, nsls lists the entries in the directory; - they are sorted alphabetically. - - path specifies the CASTOR pathname. If path does not start with /, - it is prefixed by the content of the CASTOR_HOME environment - variable. - - ex: - >>> nsls( '/castor/cern.ch/atlas/*' ) - >>> nsls( 'mydata' ) - """ - - wildcards = False - tail = "*" - path = os.path.expandvars(path) - - if path.endswith('/') : - path = path[0:len(path)-1] - # Do we detect a wildcard in the path we are given ? - # if so then we have to parse it to remove them because - # nsls does not understand them. - # The ouput of the command will be filtered afterwards - if hasWildcard(path) : - wildcards = True - - wholepath = path.split(os.sep) - - paths = nsls(path) - return sum([nsls(os.path.join(i,fname)) - for i in paths], []) - - # Here we assume the wildcards are located *only* in the filename !! - tail = wholepath[len(wholepath)-1] - if tail == '' : - if len(wholepath) >= 2 : - tail = wholepath[len(wholepath)-2] - else : - raise Exception \ - ("Malformed path to files: <"+path+">") - - # Check that the wildcard is not in the path to files - if tail.count('/') > 0 : - if tail.endswith('/') : - # the / is sitting in last position. Can safely remove it - tail = tail[0:len(tail)-1] - else : - raise Exception \ - ("No wildcard allowed in the path to files: <"+path+">") - - - path = path.split(tail)[0] - if hasWildcard(path) : - raise ValueError("No wildcard allowed in the path to files: <"+path+">") - #print(path) - - status,output = commands.getstatusoutput('nsls '+path) - - if status != 0 : - print(output) - return [] - - flist = output.splitlines() - - if wildcards : - flist = fnmatch.filter(ut,tail) - - for i in range(0,len(output)) : - if output[i].count(path) < 1: - output[i] = path+"/"+output[i] - output[i] = output[i].replace('//','/') - return output - -def pool_nsls( path ) : - """ - lists CASTOR name server directory/file entries. - Prepend the 'rfio:' prefix so the output list can be used as an input - for an xmlfile_catalog file. - """ - _prefix = 'root://castoratlas/' - files = nsls(path) - for i in range(len(files)) : - files[i] = _prefix+files[i] - pass - - return files - -def getFileSize( pathToFile = None ) : - """ - Use nsls -l function to read the file and decypher the output string to - extract the size of the file. - Returns the size in Mb - """ - if hasWildcard(pathToFile) : - raise Exception \ - ("No wildcard allowed in the path to files: <"+pathToFile+">") - - status,output = commands.getstatusoutput( 'nsls -l '+pathToFile ) - #'nsls -l $CASTOR_DIR/$FILE | awk -F ' ' '{print $5}' - - if status != 0 : - print("** PyCastor ERROR **") - print(output) - return [] - - output = output.splitlines() - - #print("output:",output) - #print("output size= ",len(output)) - - if len(output) != 1 : - raise Exception \ - ("Wrong status (didn't find only *1* file!!)") - - output = output[0] - output = output.split( " " ) - - result = [] - # Removes whitespaces - for i in output : - if i != '' : - result.append( i ) - pass - pass - - size = int(result[4])/(1024.*1024.) # size in Mb - #print("size = ",size," Mb") - - return size - -def stagein( fileListPattern = None, nSlices = 10, verbose = True ) : - """ - Take a path to a file pattern and stages all the files corresponding - to this pattern by bunchs of N (default=10) files. - """ - files = nsls( fileListPattern ) - if ( type(files) != type([]) or len(files) < 1 ) : - raise Exception \ - ("Error, no file to stagein !!") - return - - slices = list(group(files,nSlices)) - - for slice in slices : - stageList = ' -M '.join( [''] + [ s for s in slice ] ) - cmd = 'stager_get %s' % stageList - if verbose : - print(">>> cmd= ",cmd) - status,output = commands.getstatusoutput(cmd) - - if status != 0 : - print("** PyCastor ERROR **") - print(output) - pass - else : - if verbose : - # print output - pass - pass - pass - - return 0 - -def stager_qry(inFiles): - """ - Find out the stage status of the inFiles - returns dictionary of outStatus(files:status) status = 0|1 - """ - outStatus = dict() - for inFile in inFiles: - cmd = "stager_qry -M %s " % ( inFile, ) - sc,out = commands.getstatusoutput( cmd ) - if sc != 0: - print("** PyCastor ERROR **") - print("## Could not check status of this file [%s] !!" % inFile) - print("## status sc=", sc) - print("## output out=", out) - - #for str in out.split(): - # print "out_str=", str - - if out.split()[-1] == "STAGED": - outStatus[inFile] = 1 - else: - outStatus[inFile] = 0 - #print "-"*77 - - return outStatus - -def extract_rfio(inFile, outDir): - """ - Extract the list of rfio:/castor/.. files from given input file_name - - Finds out STAGED status of files using stager_qry -M ... - - if STAGED: rfcp them into outDir - - if NOT: stage them in using stager_get -M ... - - returns status dictionary returned by stager_qry() above - """ - allGood = True - f = open(inFile, 'r') - file_text = f.read() - f.close() - - import re - import urlparse - def grep_path(schema, text): - expr = "\"" + schema + "\:.+?\"" - lines = re.findall(expr, text) - lines = [line.strip('"') for line in lines ] - import urlparse - paths = [urlparse.urlparse(line)[2] for line in lines] - #results = [str[len(schema)+1:] for str in results if str.startswith(schema+':')] - return paths - - path_list = grep_path("rfio", file_text) - print("rfio_file list extracted from input file =", inFile) - print("-"*77); print(path_list); print("-"*77) - - def _print(str): - print(str) - - status_dict = stager_qry(path_list) - ready_files_list = [file for file in status_dict if status_dict[file] == 1] - print("---STAGED (ready to be copied):") - p = map(_print, ready_files_list); print("-"*77) - - noready_files_list = [file for file in status_dict if status_dict[file] == 0] - print("---NOT STAGED (not ready to be copied):") - p = map(_print, noready_files_list); print("-"*77) - - def _rfcp(file): #aux func. just for reporting purpose - print("rfcp ", file) - return file - rfcp( map(_rfcp, ready_files_list), #[file for file in ready_files_list], - outDir ) - - def _stager_get(file): #aux func. just for reporting purpose - print("stager_get -M ", file) - stager_get(file) - map(_stager_get, noready_files_list) #[stager_get(file) for file in noready_files_list if 1 print "stager_get -M ", file] - - return status_dict #returned from stager_qry(), - #not completely true since the outcome of rfcp is not checked here - -def stager_get(inFile): - """ - STAGE IN the inFile on castor - """ - allGood = True - cmd = "stager_get -M %s" % (inFile) - sc,out = commands.getstatusoutput( cmd ) - if sc != 0: - print("** PyCastor ERROR **") - print("## Could not stager_get this file [%s] !!" % inFile) - allGood = False - pass - if allGood: - return 0 - return 1 - -def rfcp( inFiles, outDir ): - """ - Copy the inFiles into the outDir - """ - allGood = True - for inFile in inFiles: - cmd = "rfcp %s %s" % ( inFile, - os.path.join( outDir, - os.path.basename(inFile) ) ) - sc,out = commands.getstatusoutput( cmd ) - if sc != 0: - print("** PyCastor ERROR **") - print("## Could not copy this file [%s] !!" % inFile) - allGood = False - pass - pass - if allGood: - return 0 - return 1 - - -def rfstat (pathname): - """rfstat <file_path> - Perform a stat system call on the given path - @param `pathname` to a file or directory on a castor node - @return a dictionary of entries built from rfstat's summary - """ - cmd = 'rfstat %s' % pathname - sc, out = commands.getstatusoutput (cmd) - if sc != 0: - print("** PyCastor ERROR **") - print(":: command: [%s]" % cmd) - print(":: status: [%s]" % sc) - print(out) - raise RuntimeError (sc) - - stat = dict() - for l in out.splitlines(): - l = l.strip() - o = l.split(':') - hdr = o[0].strip() - tail= ''.join(l.split(o[0]+':')[1:]).strip() - stat[hdr] = tail - return stat - -def rfdir (paths, recursive=False): - """ rfdir file|directory - """ - if isinstance(paths, str): - paths = [paths] - - cmd = "rfdir %s %s" % ('-R' if recursive else '', - ' '.join(paths)) - sc, out = commands.getstatusoutput (cmd) - return sc, out - diff --git a/Tools/PyUtils/python/pshell.py b/Tools/PyUtils/python/pshell.py deleted file mode 100644 index 7f46a4e0d31f4d30af9b6acdf423516da5edafc9..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/pshell.py +++ /dev/null @@ -1,214 +0,0 @@ -# -*- coding: utf-8 -*- -""" - pshell - ~~~~~~ - - Helpers for dumping a shell into a file and load back from there. Based - on the python cookbook `recipe 572213`_ by Oren Tirosh. - - Dumping:: - - >>> import pshell - >>> def foo(a, b): - ... return a + b - ... - >>> pshell.dump('shell.dump') - - And loading:: - - >>> import pshell - >>> pshell.load() - >>> foo(1, 2) - 3 - - .. _recipe 572213: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/572213 - - :copyright: Copyright 2008 by Armin Ronacher. - :license: BSD. -""" -import __builtin__ -import __main__ as _main_module -import sys -import marshal -import ctypes -from pickle import Pickler, Unpickler -from types import CodeType, FunctionType, ClassType, MethodType, \ - ModuleType, GetSetDescriptorType, BuiltinMethodType - - -CellType = type((lambda x: lambda y: x)(0).func_closure[0]) -WrapperDescriptorType = type(type.__repr__) - - -def dump(filename='/tmp/console.sess', main_module=_main_module): - """Dump the main module into a session file.""" - f = file(filename, 'wb') - try: - pickler = ShellPickler(f, 2) - pickler._main_module = main_module - pickler.dump(main_module) - finally: - f.close() - - -def load(filename='/tmp/console.sess', main_module=_main_module): - """Update the main module with the state from the session file.""" - f = file(filename, 'rb') - try: - unpickler = ShellUnpickler(f) - unpickler._main_module = main_module - module = unpickler.load() - main_module.__dict__.update(module.__dict__) - finally: - f.close() - - -class ShellPickler(Pickler): - dispatch = Pickler.dispatch.copy() - _main_module = None - - -class ShellUnpickler(Unpickler): - _main_module = None - - def find_class(self, module, name): - if (module, name) == ('__builtin__', '__main__'): - return self._main_module.__dict__ - return Unpickler.find_class(self, module, name) - - -def register(t): - def proxy(func): - ShellPickler.dispatch[t] = func - return func - return proxy - - -def _create_typemap(): - import types - for key, value in types.__dict__.iteritems(): - if getattr(value, '__module__', None) == '__builtin__' and \ - type(value) is type: - yield value, key -_typemap = dict(_create_typemap(), **{ - CellType: 'CellType', - WrapperDescriptorType: 'WrapperDescriptorType' -}) -_reverse_typemap = dict((v, k) for k, v in _typemap.iteritems()) - - -def _unmarshal(string): - return marshal.loads(string) - - -def _load_type(name): - return _reverse_typemap[name] - - -def _create_type(type, *args): - return type(*args) - - -def _create_cell(obj): - d = {} - p = ctypes.pythonapi.PyCell_New(ctypes.py_object(obj)) - ctypes.pythonapi.PyDict_SetItemString(ctypes.py_object(d), 'x', p) - return d['x'] - - -def _import_module(import_name): - if '.' in import_name: - items = import_name.split('.') - module = '.'.join(items[:-1]) - obj = items[-1] - else: - return __import__(import_name) - return getattr(__import__(module, None, None, [obj]), obj) - - -def _locate_function(obj): - if obj.__module__ == '__main__': - return False - try: - found = _import_module(obj.__module__ + '.' + obj.__name__) - except: - return False - return found is obj - - -@register(CodeType) -def save_code(pickler, obj): - pickler.save_reduce(_unmarshal, (marshal.dumps(obj),), obj=obj) - - -@register(FunctionType) -def save_function(pickler, obj): - if not _locate_function(obj): - pickler.save_reduce(FunctionType, (obj.func_code, obj.func_globals, - obj.func_name, obj.func_defaults, - obj.func_closure), obj=obj) - else: - Pickler.save_global(pickler, obj) - - -@register(dict) -def save_module_dict(pickler, obj): - if obj is pickler._main_module.__dict__: - pickler.write('c__builtin__\n__main__\n', obj=obj) - else: - Pickler.save_dict(pickler, obj) - - -@register(ClassType) -def save_classobj(pickler, obj): - if obj.__module__ == '__main__': - pickler.save_reduce(ClassType, (obj.__name__, obj.__bases__, - obj.__dict__), obj=obj) - else: - Pickler.save_global(pickler, obj) - - -@register(MethodType) -def save_instancemethod(pickler, obj): - pickler.save_reduce(MethodType, (obj.im_func, obj.im_self, - obj.im_class), obj=obj) - - -@register(BuiltinMethodType) -def save_builtin_method(pickler, obj): - if obj.__self__ is not None: - pickler.save_reduce(getattr, (obj.__self__, obj.__name__), obj=obj) - else: - Pickler.save_global(pickler, obj) - - -@register(GetSetDescriptorType) -@register(WrapperDescriptorType) -def save_wrapper_descriptor(pickler, obj): - pickler.save_reduce(getattr, (obj.__objclass__, obj.__name__), obj=obj) - - -@register(CellType) -def save_cell(pickler, obj): - pickler.save_reduce(_create_cell, (obj.cell_contents,), obj=obj) - - -@register(ModuleType) -def save_module(pickler, obj): - if obj is pickler._main_module: - pickler.save_reduce(__import__, (obj.__name__,), obj=obj, - state=obj.__dict__.copy()) - else: - pickler.save_reduce(_import_module, (obj.__name__,), obj=obj) - - -@register(type) -def save_type(pickler, obj): - if obj in _typemap: - pickler.save_reduce(_load_type, (_typemap[obj],), obj=obj) - elif obj.__module__ == '__main__': - pickler.save_reduce(_create_type, (type(obj), obj.__name__, - obj.__bases__, obj.__dict__), - obj=obj) - else: - Pickler.save_global(pickler, obj) diff --git a/Tools/PyUtils/python/reimport.py b/Tools/PyUtils/python/reimport.py deleted file mode 100644 index 19ed1c8753833c2ed073ef27e48c715d062ca835..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/reimport.py +++ /dev/null @@ -1,559 +0,0 @@ -# MIT Licensed -# Copyright (c) 2009 Peter Shinners <pete@shinners.org> -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -""" -This module intends to be a full featured replacement for Python's reload -function. It is targeted towards making a reload that works for Python -plugins and extensions used by longer running applications. - -Reimport currently supports Python 2.4 through 2.6. - -By its very nature, this is not a completely solvable problem. The goal of -this module is to make the most common sorts of updates work well. It also -allows individual modules and package to assist in the process. A more -detailed description of what happens is at -http://code.google.com/p/reimport . -""" - - -__all__ = ["reimport", "modified"] - - -import sys -import os -import gc -import inspect -import weakref -import traceback -import time - - - -__version__ = "1.0" -__author__ = "Peter Shinners <pete@shinners.org>" -__license__ = "MIT" -__url__ = "http://code.google.com/p/reimport" - - - -_previous_scan_time = time.time() - 1.0 -_module_timestamps = {} - - -# find the 'instance' old style type -class _OldClass: pass -_InstanceType = type(_OldClass()) -del _OldClass - - - -def reimport(*modules): - """Reimport python modules. Multiple modules can be passed either by - name or by reference. Only pure python modules can be reimported. - - For advanced control, global variables can be placed in modules - that allows finer control of the reimport process. - - If a package module has a true value for "__package_reimport__" - then that entire package will be reimported when any of its children - packages or modules are reimported. - - If a package module defines __reimported__ it must be a callable - function that accepts one argument and returns a bool. The argument - is the reference to the old version of that module before any - cleanup has happend. The function should normally return True to - allow the standard reimport cleanup. If the function returns false - then cleanup will be disabled for only that module. Any exceptions - raised during the callback will be handled by traceback.print_exc, - similar to what happens with tracebacks in the __del__ method. - """ - __internal_swaprefs_ignore__ = "reimport" - reloadSet = set() - - if not modules: - return - - # Get names of all modules being reloaded - for module in modules: - name, target = _find_exact_target(module) - if not target: - raise ValueError("Module %r not found" % module) - if not _is_code_module(target): - raise ValueError("Cannot reimport extension, %r" % name) - - reloadSet.update(_find_reloading_modules(name)) - - # Sort module names - reloadNames = _package_depth_sort(reloadSet, False) - - # Check for SyntaxErrors ahead of time. This won't catch all - # possible SyntaxErrors or any other ImportErrors. But these - # should be the most common problems, and now is the cleanest - # time to abort. - # I know this gets compiled again anyways. It could be - # avoided with py_compile, but I will not be the creator - # of messy .pyc files! - for name in reloadNames: - filename = getattr(sys.modules[name], "__file__", None) - if not filename: - continue - pyname = os.path.splitext(filename)[0] + ".py" - try: - data = open(pyname, "rU").read() + "\n" - except (IOError, OSError): - continue - - compile(data, pyname, "exec", 0, False) # Let this raise exceptions - - # Move modules out of sys - oldModules = {} - for name in reloadNames: - oldModules[name] = sys.modules.pop(name) - ignores = (id(oldModules),) - prevNames = set(sys.modules) - - # Reimport modules, trying to rollback on exceptions - try: - for name in reloadNames: - if name not in sys.modules: - __import__(name) - - except StandardError: - # Try to dissolve any newly import modules and revive the old ones - newNames = set(sys.modules) - prevNames - newNames = _package_depth_sort(newNames, True) - for name in newNames: - _unimport_module(sys.modules[name], ignores) - assert name not in sys.modules - - sys.modules.update(oldModules) - raise - - newNames = set(sys.modules) - prevNames - newNames = _package_depth_sort(newNames, True) - - # Update timestamps for loaded time - now = time.time() - 1.0 - for name in newNames: - _module_timestamps[name] = (now, True) - - # Rejigger the universe - for name in newNames: - old = oldModules.get(name) - if not old: - continue - new = sys.modules[name] - rejigger = True - reimported = getattr(new, "__reimported__", None) - if reimported: - try: - rejigger = reimported(old) - except StandardError: - # What else can we do? the callbacks must go on - # Note, this is same as __del__ behaviour. /shrug - traceback.print_exc() - - if rejigger: - _rejigger_module(old, new, ignores) - else: - _unimport_module(new, ignores) - - - -def modified(path=None): - """Find loaded modules that have changed on disk under the given path. - If no path is given then all modules are searched. - """ - global _previous_scan_time - modules = [] - - if path: - path = os.path.normpath(path) + os.sep - - defaultTime = (_previous_scan_time, False) - pycExt = __debug__ and ".pyc" or ".pyo" - - for name, module in sys.modules.items(): - filename = _is_code_module(module) - if not filename: - continue - - filename = os.path.normpath(filename) - prevTime, prevScan = _module_timestamps.setdefault(name, defaultTime) - if path and not filename.startswith(path): - continue - - # Get timestamp of .pyc if this is first time checking this module - if not prevScan: - pycName = os.path.splitext(filename)[0] + pycExt - if pycName != filename: - try: - prevTime = os.path.getmtime(pycName) - except OSError: - pass - _module_timestamps[name] = (prevTime, True) - - # Get timestamp of source file - try: - diskTime = os.path.getmtime(filename) - except OSError: - diskTime = None - - if diskTime is not None and prevTime < diskTime: - modules.append(name) - - _previous_scan_time = time.time() - return modules - - - -def _is_code_module(module): - """Determine if a module comes from python code""" - # getsourcefile will not return "bare" pyc modules. we can reload those? - try: - return inspect.getsourcefile(module) or "" - except TypeError: - return "" - - - -def _find_exact_target(module): - """Given a module name or object, find the - base module where reimport will happen.""" - # Given a name or a module, find both the name and the module - actualModule = sys.modules.get(module) - if actualModule is not None: - name = module - else: - for name, mod in sys.modules.iteritems(): - if mod is module: - actualModule = module - break - else: - return "", None - - # Find highest level parent package that has package_reimport magic - parentName = name - while True: - splitName = parentName.rsplit(".", 1) - if len(splitName) <= 1: - return name, actualModule - parentName = splitName[0] - - parentModule = sys.modules.get(parentName) - if getattr(parentModule, "__package_reimport__", None): - name = parentName - actualModule = parentModule - - - -def _find_reloading_modules(name): - """Find all modules that will be reloaded from given name""" - modules = [name] - childNames = name + "." - for name in sys.modules.keys(): - if name.startswith(childNames) and _is_code_module(sys.modules[name]): - modules.append(name) - return modules - - - -def _package_depth_sort(names, reverse): - """Sort a list of module names by their package depth""" - def packageDepth(name): - return name.count(".") - return sorted(names, key=packageDepth, reverse=reverse) - - - -# To rejigger is to copy internal values from new to old -# and then to swap external references from old to new - - -def _rejigger_module(old, new, ignores): - """Mighty morphin power modules""" - __internal_swaprefs_ignore__ = "rejigger_module" - oldVars = vars(old) - newVars = vars(new) - ignores += (id(oldVars),) - old.__doc__ = new.__doc__ - - # Get filename used by python code - filename = new.__file__ - fileext = os.path.splitext(filename) - if fileext in (".pyo", ".pyc", ".pyw"): - filename = filename[:-1] - - for name, value in newVars.iteritems(): - try: objfile = inspect.getsourcefile(value) - except TypeError: objfile = "" - - if name in oldVars: - oldValue = oldVars[name] - if oldValue is value: - continue - - if objfile == filename: - if inspect.isclass(value): - _rejigger_class(oldValue, value, ignores) - - elif inspect.isfunction(value): - _rejigger_func(oldValue, value, ignores) - - setattr(old, name, value) - - for name in oldVars.keys(): - if name not in newVars: - value = getattr(old, name) - delattr(old, name) - _remove_refs(value, ignores) - - _swap_refs(old, new, ignores) - - - -def _rejigger_class(old, new, ignores): - """Mighty morphin power classes""" - __internal_swaprefs_ignore__ = "rejigger_class" - oldVars = vars(old) - newVars = vars(new) - ignores += (id(oldVars),) - - for name, value in newVars.iteritems(): - if name in ("__dict__", "__doc__", "__weakref__"): - continue - - if name in oldVars: - oldValue = oldVars[name] - if oldValue is value: - continue - - if inspect.isclass(value) and value.__module__ == new.__module__: - _rejigger_class(oldValue, value, ignores) - - elif inspect.isfunction(value): - _rejigger_func(oldValue, value, ignores) - - setattr(old, name, value) - - for name in oldVars.keys(): - if name not in newVars: - value = getattr(old, name) - delattr(old, name) - _remove_refs(value, ignores) - - _swap_refs(old, new, ignores) - - - -def _rejigger_func(old, new, ignores): - """Mighty morphin power functions""" - __internal_swaprefs_ignore__ = "rejigger_func" - old.func_code = new.func_code - old.func_doc = new.func_doc - old.func_defaults = new.func_defaults - old.func_dict = new.func_dict - _swap_refs(old, new, ignores) - - - -def _unimport_module(old, ignores): - """Remove traces of a module""" - __internal_swaprefs_ignore__ = "unimport_module" - oldValues = vars(old).values() - ignores += (id(oldValues),) - - # Get filename used by python code - filename = old.__file__ - fileext = os.path.splitext(filename) - if fileext in (".pyo", ".pyc", ".pyw"): - filename = filename[:-1] - - for value in oldValues: - try: objfile = inspect.getsourcefile(value) - except TypeError: objfile = "" - - if objfile == filename: - if inspect.isclass(value): - _unimport_class(value, ignores) - - elif inspect.isfunction(value): - _remove_refs(value, ignores) - - _remove_refs(old, ignores) - - - -def _unimport_class(old, ignores): - """Remove traces of a class""" - __internal_swaprefs_ignore__ = "unimport_class" - oldItems = vars(old).items() - ignores += (id(oldItems),) - - for name, value in oldItems: - if name in ("__dict__", "__doc__", "__weakref__"): - continue - - if inspect.isclass(value) and value.__module__ == old.__module__: - _unimport_class(value, ignores) - - elif inspect.isfunction(value): - _remove_refs(value, ignores) - - _remove_refs(old, ignores) - - - - - -_recursive_tuple_swap = set() - - - -def _swap_refs(old, new, ignores): - """Swap references from one object to another""" - __internal_swaprefs_ignore__ = "swap_refs" - # Swap weak references - refs = weakref.getweakrefs(old) - if refs: - try: - newRef = weakref.ref(new) - except ValueError: - pass - else: - for oldRef in refs: - _swap_refs(oldRef, newRef, ignores + (id(refs),)) - del refs - - # Swap through garbage collector - referrers = gc.get_referrers(old) - for container in referrers: - if id(container) in ignores: - continue - containerType = type(container) - - if containerType is list: - while True: - try: - index = container.index(old) - except ValueError: - break - container[index] = new - - elif containerType is tuple: - # protect from recursive tuples - orig = container - if id(orig) in _recursive_tuple_swap: - continue - _recursive_tuple_swap.add(id(orig)) - try: - container = list(container) - while True: - try: - index = container.index(old) - except ValueError: - break - container[index] = new - container = tuple(container) - _swap_refs(orig, container, ignores + (id(referrers),)) - finally: - _recursive_tuple_swap.remove(id(orig)) - - elif containerType is dict: - if "__internal_swaprefs_ignore__" not in container: - try: - if old in container: - container[new] = container.pop(old) - except TypeError: # Unhashable old value - pass - for k,v in container.iteritems(): - if v is old: - container[k] = new - - elif containerType is set: - container.remove(old) - container.add(new) - - elif containerType == type: - if old in container.__bases__: - bases = list(container.__bases__) - bases[bases.index(old)] = new - container.__bases__ = tuple(bases) - - elif type(container) is old: - container.__class__ = new - - elif containerType is _InstanceType: - if container.__class__ is old: - container.__class__ = new - - - -def _remove_refs(old, ignores): - """Remove references to a discontinued object""" - __internal_swaprefs_ignore__ = "remove_refs" - - # Ignore builtin immutables that keep no other references - _isinst = isinstance - if (old is None or _isinst(old, int) or _isinst(old, basestring) - or _isinst(old, float) or _isinst(old, complex)): - return - - # Remove through garbage collector - for container in gc.get_referrers(old): - if id(container) in ignores: - continue - containerType = type(container) - - if containerType == list: - while True: - try: - container.remove(old) - except ValueError: - break - - elif containerType == tuple: - orig = container - container = list(container) - while True: - try: - container.remove(old) - except ValueError: - break - container = tuple(container) - _swap_refs(orig, container, ignores) - - elif containerType == dict: - if "__internal_swaprefs_ignore__" not in container: - try: - if old in container: - container.pop(old) - except TypeError: # Unhashable old value - pass - for k,v in container.items(): - if v is old: - del container[k] - - elif containerType == set: - container.remove(old) diff --git a/Tools/PyUtils/python/rfio.py b/Tools/PyUtils/python/rfio.py deleted file mode 100644 index 0457a7adb01f427f6a31fd4f82291821780d3d41..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/rfio.py +++ /dev/null @@ -1,233 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# @file: PyUtils/python/rfio.py -# @purpose: simple ctypes-based python wrapper around libshift (from CASTOR2) -# @author: Sebastien Binet <binet@cern.ch> -# @date: October 2008 - -__doc__ = "simple ctypes-based python wrapper around librfio (from CASTOR2)" -__version__ = "$Revision$" -__author__ = "Sebastien Binet <binet@cern.ch>" - -import ctypes, os -from . import _rfio as c_api - -_lib = c_api._libraries['libshift.so'] - -STRING = ctypes.c_char_p - -### -- exports ---------------------------------------------------------------- -__all__ = [ - 'c_api', # the raw ctypes-wrapped library - 'access', - 'stat', - 'lstat', - 'open', - ] - - -### -- helper methods --------------------------------------------------------- -def _raise_ioerror(): - global c_api - raise IOError(c_api.rfio_serrno(),c_api.rfio_serror()) - -### -- data ------------------------------------------------------------------- -DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes - -### -- classes ---------------------------------------------------------------- -def __str__(self): - return str(tuple([self.tv_sec,self.tv_nsec])) -c_api.timespec.__str__ = __str__ -c_api.timespec.__repr__= __str__ -del __str__ - -def __str__(self): - return str(tuple([ - self.st_mode, # protection bits - self.st_ino, # inode number - self.st_dev, # device - self.st_nlink, # number of hard links - self.st_uid, # user ID of owner - self.st_gid, # group ID of owner - self.st_size, # size of file, in bytes - self.st_atim, # time of most recent access - self.st_mtim, # time of most recent content modification - self.st_ctim, # time of most recent metadata change - ])) -c_api.stat.__str__ = __str__ -c_api.stat.__repr__= __str__ -del __str__ - -## -class File(object): - """file-like object for files on CASTOR""" - - def __init__ (self, fname, mode='r'): - super (File, self).__init__ () - self.name = fname - self.mode = mode - if not mode in ('r','w','a'): - raise ValueError("mode should be 'r', 'w' or 'a'") - global c_api - self._f = c_api.rfio_fopen (fname, mode) - if c_api.rfio_serrno(): - _raise_ioerror() - self.fd = c_api.rfio_fileno (self._f) - - def close (self): - fd = self.fd - if fd is not None: - self.fd = None - global c_api - if c_api.rfio_close (fd): - raise_ioerror() - return - - def __del__ (self): - try: - self.close() - except: - pass - - def fileno (self): - if self.fd is not None: - return self.fd - raise ValueError ('I/O operation on closed file') - - def flush (self): - global c_api - if c_api.rfio_fflush (self._f): - _raise_ioerror() - return - - def next (self): - line = self.readline() - if not line: - raise StopIteration - return line - - def tell (self): - bytes = c_api.rfio_ftell (self._f) - if bytes < 0: - _raise_ioerror() - return bytes - - def read (self, n=-1): - if n < 0: - return self.readall() - buf = c_api.STRING('\0'*n) - rc = c_api.rfio_fread (buf, 1, n, self._f) - if rc < 0: - _raise_ioerror() - return str(buf.value) - - def readall (self): - res = str() - while True: - data = self.read (DEFAULT_BUFFER_SIZE) - if not data: - break - res += data - return res - - def readline (self, limit = -1): - r"""Read and return a line from the stream. - - If limit is specified, at most limit bytes will be read. - """ - if limit is None: - limit = -1 - if not isinstance (limit, (int, long)): - raise TypeError ("limit must be an integer") - res = str() - while limit < 0 or len(res) < limit: - data = self.read (DEFAULT_BUFFER_SIZE) - if not data: - break - res += data - if res.endswith('\n'): - break - return res - - def readinto (self, b): - nb = c_api.rfio_fread (b, 1, len(b), self._f) - if nb < 0: - _raise_ioerror() - return nb - - def __iter__ (self): - return self - - def readlines (self, hint=None): - """Return a list of lines from the stream. - - hint can be specified to control the number of lines read: no more - lines will be read if the total size (in bytes/characters) of all - lines so far exceeds hint. - """ - if hint is None: - hint = -1 - if not isinstance (hint, (int, long)): - raise TypeError ("hint must be an integer") - if hint <= 0: - return list(self) - n = 0 - lines = []; _append = lines.append - for line in self: - _append (line) - n += len(line) - if n >= hint: - break - return lines - - def seek (self, offset, whence=0): - rc = c_api.rfio_fseek (self._f, offset, whence) - if rc < 0: - _raise_ioerror() - return - - def write (self, b): - # FIXME: use buffer protocol... - buf = c_api.STRING(b) - nb = c_api.rfio_fwrite (buf, 1, len(buf.value), self._f) - if nb < 0: - _raise_ioerror() - return nb - - def writelines (self, lines): - for line in lines: - self.write (line) - - ### Context manager ### - def __enter__ (self): - """Context management protocol. Returns self.""" - return self - - def __exit__ (self, *args): - self.close() - - pass # class File - -### -- module methods --------------------------------------------------------- -def open (fname, mode='r'): - return File (fname, mode) - -def stat (fname): - st = c_api.stat() - if c_api.rfio_stat (fname, st): - _raise_ioerror() - return st - -def lstat (fname): - st = c_api.stat() - if c_api.rfio_lstat (fname, st): - _raise_ioerror() - return st - -def access (fname, mode): - """access(path, mode) -> 1 if granted, 0 otherwise""" - rc = c_api.rfio_access (fname, mode) - if rc < 0: - return 0 - return 1 - diff --git a/Tools/PyUtils/python/scripts/__init__.py b/Tools/PyUtils/python/scripts/__init__.py index b0c5d373f701d6ebc3d111fe7bf4fbb5e32e00ca..dbf2414bfc45b73fa5cb28b33a9a672864d0b1d7 100644 --- a/Tools/PyUtils/python/scripts/__init__.py +++ b/Tools/PyUtils/python/scripts/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # hook for PyUtils.scripts package @@ -18,6 +18,7 @@ acmdlib.register('filter-files', 'PyUtils.scripts.filter_files') acmdlib.register('cmake.new-skeleton', 'PyUtils.scripts.cmake_newskeleton') acmdlib.register('cmake.new-pkg', 'PyUtils.scripts.cmake_newpkg') acmdlib.register('cmake.new-analysisalg', 'PyUtils.scripts.cmake_newanalysisalg') +acmdlib.register('cmake.depends', 'PyUtils.scripts.cmake_depends') acmdlib.register('jira.issues', 'PyUtils.scripts.jira_issues') ## diff --git a/Tools/PyUtils/python/scripts/cmake_depends.py b/Tools/PyUtils/python/scripts/cmake_depends.py new file mode 100644 index 0000000000000000000000000000000000000000..44da437d98c0caeeede96e23134f0bd1fc536e46 --- /dev/null +++ b/Tools/PyUtils/python/scripts/cmake_depends.py @@ -0,0 +1,246 @@ +#!/usr/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# Created: June 2020, Frank Winklmeier +# +""" +Print target/package dependencies of ATLAS releases. For a given target/package +name, the dependencies are printed as a plain list or DOT graph. The recursion +depth is configurable. +""" + +import sys +import os +import re +from collections import deque +import PyUtils.acmdlib as acmdlib +import argparse + +# Hack until we have pygraphviz in LCG (SPI-1633): +try: + import pygraphviz +except ImportError: + sys.path.append('/cvmfs/sft.cern.ch/lcg/nightlies/dev4/Tue/pygraphviz/1.5/x86_64-centos7-gcc8-opt/lib/python2.7/site-packages/') + import pygraphviz + +# +# Some helper functions +# +def read_package_list(package_file): + """Read packages.txt as a source for the full package path""" + + with open(package_file) as f: + packages = [line.rstrip() for line in f if not line.startswith('#')] + + return dict([(p.split('/')[-1],p) for p in packages]) + + +def externals_name(lib): + """Return a short name for an external library""" + if '/LCG_' in lib: + dirs = lib.split('/') + lcg = next(d for d in dirs if d.startswith('LCG_')) + return '%s::%s' % (dirs[dirs.index(lcg)+1], dirs[-1]) + elif lib.startswith('Gaudi'): + return 'Gaudi::%s' % lib + else: + return os.path.basename(lib) + + +def ignore_target(t): + """Check if target should be ignored""" + if t.startswith('__MUST_NOT_LINK_AGAINST') or t.startswith('-') or \ + t.endswith('Pkg') or t.endswith('PkgPrivate'): return True + else: return False + + +def lrstrip(s, prefix, postfix): + """Strip `prefix` and `postfix` from string `s`""" + if s.startswith(prefix): s = s[len(prefix):] + if s.endswith(postfix): s = s[:-len(postfix)] + return s + + +def traverse(graph, root, reverse=False, maxdepth=None, nodegetter=lambda n:n): + """Depth-limited BFS edge traversal of graph starting at root. + + @param graph graph + @param root start node for traversal + @param reverse traverse graph in reverse + @param maxdepth maximum traversal depth (1 = only direct neighbors) + @param nodegetter functor returning node names + @return edge tuple (parent,node) + + Inspired by https://github.com/networkx/networkx/tree/master/networkx/algorithms/traversal + """ + visited_nodes = set() + visited_edges = set() + queue = deque([(root,root,0)]) + neighbors = graph.iterpred if reverse else graph.itersucc + while queue: + parent,node,level = queue.popleft() + + if node not in visited_nodes: + visited_nodes.add(node) + # Add edges to neighbors into queue: + if maxdepth is None or level < maxdepth: + queue.extend((node,n,level+1) for n in neighbors(node)) + # For the last level only edges to already visited nodes: + elif level==maxdepth: + queue.extend((node,n,level+1) for n in neighbors(node) if n in visited_nodes) + + if (parent,node) not in visited_edges: + visited_edges.add((parent,node)) + yield nodegetter(parent), nodegetter(node) + + +def subgraph(graph, sources, reverse=False, maxdepth=None, nodegetter=lambda n : n.attr.get('label')): + """Extract subgraph created by traversing from one or more sources. + Parameters are the same as in `traverse`. + """ + g = pygraphviz.AGraph(directed=True) + for root in sources: + for a,b in traverse(graph, root, reverse=reverse, maxdepth=maxdepth, nodegetter=nodegetter): + if a and b and a!=b and not ignore_target(a) and not ignore_target(b): + if reverse: g.add_edge(b,a) + else: g.add_edge(a,b) + + return g + + +class AthGraph: + """Class to hold dependency information for release""" + + def __init__(self, dotfile, package_paths={}): + """Read dotfile and and optionally transform package names to full paths""" + + # Read dot file: + self.graph = pygraphviz.AGraph(dotfile) + + # Build dictionary for node names: + self.node = { n.attr['label'] : n.get_name() for n in self.graph.iternodes() } + + # Extract package dependencies: + for e in self.graph.iteredges(): + p = e[0].attr['label'] + + # Decorate target with package name + if p.startswith('Package_'): + pkg = lrstrip(p, 'Package_', '_tests') + e[1].attr['package'] = package_paths.get(pkg,pkg) + + # Assign "package" names to externals if possible: + external_nodes = filter(lambda n : 'package' not in n.attr.keys(), + self.graph.iternodes()) + for n in external_nodes: + name = externals_name(n.attr['label']) + n.attr['package'] = name.split('::')[0] + n.attr['label'] = name + n.attr['external'] = True + + def get_node(self, label): + """Return graph node for label/target""" + return self.graph.get_node(self.node[label]) + + def get_labels(self, regex): + """Return labels matching regex""" + r = re.compile(regex) + return [l for l in self.node if r.match(l)] + + +# +# Main function and command line arguments +# +@acmdlib.command(name='cmake.depends', + description=__doc__) + +@acmdlib.argument('names', nargs='+', metavar='NAME', + help='package/target name or regular expression') + +@acmdlib.argument('-t', '--target', action='store_true', + help='treat NAME as target instead of package name') + +@acmdlib.argument('-c', '--clients', action='store_true', + help='show clients (instead of dependencies)') + +@acmdlib.argument('-e', '--externals', action='store_true', + help='include external dependencies') + +@acmdlib.argument('-l', '--long', action='store_true', + help='show full package names') + +@acmdlib.argument('-r', '--recursive', nargs='?', metavar='DEPTH', + type=int, default=1, const=None, + help='recursively resolve dependencies up to DEPTH (default: unlimited)') + +@acmdlib.argument('--regex', action='store_true', + help='treat NAME as regular expression') + +@acmdlib.argument('-d', '--dot', action='store_true', + help='print DOT graph') + +# Debugging/expert options: +@acmdlib.argument('--cmakedot', help=argparse.SUPPRESS) + +def main(args): + + # Find packages.dot: + if not args.cmakedot: + try: + args.cmakedot = os.path.join(os.environ['AtlasArea'],'InstallArea', + os.environ['BINARY_TAG'],'packages.dot') + except KeyError: + main.parser.error("Cannot find 'packages.dot'. Setup a release or use --cmakedot.") + + # Read packages.txt if needed: + package_paths = {} + if args.long: + try: + package_paths = read_package_list(os.path.join(os.environ['AtlasArea'],'InstallArea', + os.environ['BINARY_TAG'],'packages.txt')) + except Exception: + main.parser.error("Cannot read 'packages.txt'. Setup a release or run without -l/--long.") + + # In package mode we have one extra level due to the Package_ target: + if not args.target and not args.clients and args.recursive is not None: + args.recursive += 1 + + # Read dependencies: + d = AthGraph(args.cmakedot, package_paths) + + # Helper for graph traversal below: + def getnode(node): + if args.externals or 'external' not in node.attr.keys(): + a = 'label' if args.target else 'package' + return node.attr[a] + + graph = pygraphviz.AGraph(name='AthGraph', directed=True) + for p in args.names: + # In package mode construct relevant target: + target = p if args.target else 'Package_'+p.split('/')[-1] + targets = d.get_labels(target) if args.regex else [target] + + sources = [] + for l in targets: + # To find clients of a package means finding clients of the targets + # within that package. First find all targets within the package: + if args.clients and not args.target: + sources.extend([b for a,b in traverse(d.graph, d.get_node(l), maxdepth=1)]) + l + else: + sources.extend([d.get_node(l)]) + + g = subgraph(d.graph, sources, reverse=args.clients, + maxdepth=args.recursive, nodegetter=getnode) + + graph.add_subgraph(name=target) + graph.get_subgraph(target).add_edges_from(g.edges()) + + # Print result: + if args.dot: + print(graph) + else: + nodes = [e[0] for e in graph.in_edges_iter()] if args.clients \ + else [e[1] for e in graph.out_edges_iter()] + for p in sorted(set(nodes)): + print(p) diff --git a/Tools/PyUtils/python/smem.py b/Tools/PyUtils/python/smem.py deleted file mode 100644 index dc8257a5255bf19fa034ad44b43b536b7aa80211..0000000000000000000000000000000000000000 --- a/Tools/PyUtils/python/smem.py +++ /dev/null @@ -1,643 +0,0 @@ -#!/usr/bin/env python -# -# smem - a tool for meaningful memory reporting -# -# Copyright 2008-2009, 2019 Matt Mackall <mpm@selenic.com> -# -# This software may be used and distributed according to the terms of -# the GNU General Public License version 2 or later, incorporated -# herein by reference. - -from __future__ import print_function - -import re, os, sys, pwd, grp, optparse, errno, tarfile - -class procdata(object): - def __init__(self, source): - self._ucache = {} - self._gcache = {} - self.source = source and source or "" - def _list(self): - return os.listdir(self.source + "/proc") - def _read(self, f): - return file(self.source + '/proc/' + f).read() - def _readlines(self, f): - return self._read(f).splitlines(True) - def _stat(self, f): - return os.stat(self.source + "/proc/" + f) - - def pids(self): - '''get a list of processes''' - return [int(e) for e in self._list() - if e.isdigit() and not iskernel(e)] - def mapdata(self, pid): - return self._readlines('%s/smaps' % pid) - def memdata(self): - return self._readlines('meminfo') - def version(self): - return self._readlines('version')[0] - def pidname(self, pid): - l = self._read('%d/stat' % pid) - return l[l.find('(') + 1: l.find(')')] - def pidcmd(self, pid): - c = self._read('%s/cmdline' % pid)[:-1] - return c.replace('\0', ' ') - def piduser(self, pid): - return self._stat('%d/cmdline' % pid).st_uid - def pidgroup(self, pid): - return self._stat('%d/cmdline' % pid).st_gid - def username(self, uid): - if uid not in self._ucache: - self._ucache[uid] = pwd.getpwuid(uid)[0] - return self._ucache[uid] - def groupname(self, gid): - if gid not in self._gcache: - self._gcache[gid] = pwd.getgrgid(gid)[0] - return self._gcache[gid] - -class tardata(procdata): - def __init__(self, source): - procdata.__init__(self, source) - self.tar = tarfile.open(source) - def _list(self): - for ti in self.tar: - if ti.name.endswith('/smaps'): - d,f = ti.name.split('/') - yield d - def _read(self, f): - return self.tar.extractfile(f).read() - def _readlines(self, f): - return self.tar.extractfile(f).readlines() - def piduser(self, p): - t = self.tar.getmember("%s/cmdline" % p) - if t.uname: - self._ucache[t.uid] = t.uname - return t.uid - def pidgroup(self, p): - t = self.tar.getmember("%s/cmdline" % p) - if t.gname: - self._gcache[t.gid] = t.gname - return t.gid - def username(self, u): - return self._ucache.get(u, str(u)) - def groupname(self, g): - return self._gcache.get(g, str(g)) - -_totalmem = 0 -def totalmem(): - global _totalmem - if not _totalmem: - if options.realmem: - _totalmem = fromunits(options.realmem) / 1024 - else: - _totalmem = memory()['memtotal'] - return _totalmem - -_kernelsize = 0 -def kernelsize(): - global _kernelsize - if not _kernelsize and options.kernel: - try: - d = os.popen("size %s" % options.kernel).readlines()[1] - _kernelsize = int(d.split()[3]) / 1024 - except: - pass - return _kernelsize - -def pidmaps(pid): - maps = {} - start = None - for l in src.mapdata(pid): - f = l.split() - if f[-1] == 'kB': - maps[start][f[0][:-1].lower()] = int(f[1]) - else: - start, end = f[0].split('-') - start = int(start, 16) - name = "<anonymous>" - if len(f) > 5: - name = f[5] - maps[start] = dict(end=int(end, 16), mode=f[1], - offset=int(f[2], 16), - device=f[3], inode=f[4], name=name) - - if options.mapfilter: - f = {} - for m in maps: - if not filter(options.mapfilter, m, lambda x: maps[x]['name']): - f[m] = maps[m] - return f - - return maps - -def sortmaps(totals, key): - l = [] - for pid in totals: - l.append((totals[pid][key], pid)) - l.sort() - return [pid for pid,key in l] - -def iskernel(pid): - return src.pidcmd(pid) == "" - -def memory(): - t = {} - f = re.compile('(\\S+):\\s+(\\d+) kB') - for l in src.memdata(): - m = f.match(l) - if m: - t[m.group(1).lower()] = int(m.group(2)) - return t - -def units(x): - s = '' - if x == 0: - return '0' - for s in ('', 'K', 'M', 'G'): - if x < 1024: - break - x /= 1024.0 - return "%.1f%s" % (x, s) - -def fromunits(x): - s = dict(k=2**10, K=2**10, kB=2**10, KB=2**10, - M=2**20, MB=2**20, G=2**30, GB=2**30) - for k,v in s.items(): - if x.endswith(k): - return int(float(x[:len(k)])*v) - -def pidusername(pid): - return src.username(src.piduser(pid)) - -def showamount(a): - if options.abbreviate: - return units(a * 1024) - elif options.percent: - return "%.2f%%" % (100.0 * a / totalmem()) - return a - -def filter(opt, arg, *sources): - if not opt: - return False - - for f in sources: - if re.search(opt, f(arg)): - return False - return True - -def pidtotals(pid): - maps = pidmaps(pid) - t = dict(size=0, rss=0, pss=0, shared_clean=0, shared_dirty=0, - private_clean=0, private_dirty=0, referenced=0, swap=0) - for m in maps.iterkeys(): - for k in t: - t[k] += maps[m].get(k, 0) - - t['uss'] = t['private_clean'] + t['private_dirty'] - t['maps'] = len(maps) - - return t - -def processtotals(pids): - totals = {} - for pid in pids: - if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or - filter(options.userfilter, pid, pidusername)): - continue - try: - p = pidtotals(pid) - if p['maps'] != 0: - totals[pid] = p - except: - continue - return totals - -def showpids(): - p = src.pids() - pt = processtotals(p) - - def showuser(p): - if options.numeric: - return src.piduser(p) - return pidusername(p) - - fields = dict( - pid=('PID', lambda n: n, '% 5s', lambda x: len(p), - 'process ID'), - user=('User', showuser, '%-8s', lambda x: len(dict.fromkeys(x)), - 'owner of process'), - name=('Name', src.pidname, '%-24.24s', None, - 'name of process'), - command=('Command', src.pidcmd, '%-27.27s', None, - 'process command line'), - maps=('Maps',lambda n: pt[n]['maps'], '% 5s', sum, - 'total number of mappings'), - swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum, - 'amount of swap space consumed (ignoring sharing)'), - uss=('USS', lambda n: pt[n]['uss'], '% 8a', sum, - 'unique set size'), - rss=('RSS', lambda n: pt[n]['rss'], '% 8a', sum, - 'resident set size (ignoring sharing)'), - pss=('PSS', lambda n: pt[n]['pss'], '% 8a', sum, - 'proportional set size (including sharing)'), - vss=('VSS', lambda n: pt[n]['size'], '% 8a', sum, - 'virtual set size (total virtual memory mapped)'), - ) - columns = options.columns or 'pid user command swap uss pss rss' - - showtable(pt.keys(), fields, columns.split(), options.sort or 'pss') - -def maptotals(pids): - totals = {} - for pid in pids: - if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or - filter(options.userfilter, pid, pidusername)): - continue - try: - maps = pidmaps(pid) - seen = {} - for m in maps.iterkeys(): - name = maps[m]['name'] - if name not in totals: - t = dict(size=0, rss=0, pss=0, shared_clean=0, - shared_dirty=0, private_clean=0, count=0, - private_dirty=0, referenced=0, swap=0, pids=0) - else: - t = totals[name] - - for k in t: - t[k] += maps[m].get(k, 0) - t['count'] += 1 - if name not in seen: - t['pids'] += 1 - seen[name] = 1 - totals[name] = t - except: - raise - return totals - -def showmaps(): - p = src.pids() - pt = maptotals(p) - - fields = dict( - map=('Map', lambda n: n, '%-40.40s', len, - 'mapping name'), - count=('Count', lambda n: pt[n]['count'], '% 5s', sum, - 'number of mappings found'), - pids=('PIDs', lambda n: pt[n]['pids'], '% 5s', sum, - 'number of PIDs using mapping'), - swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum, - 'amount of swap space consumed (ignoring sharing)'), - uss=('USS', lambda n: pt[n]['private_clean'] - + pt[n]['private_dirty'], '% 8a', sum, - 'unique set size'), - rss=('RSS', lambda n: pt[n]['rss'], '% 8a', sum, - 'resident set size (ignoring sharing)'), - pss=('PSS', lambda n: pt[n]['pss'], '% 8a', sum, - 'proportional set size (including sharing)'), - vss=('VSS', lambda n: pt[n]['size'], '% 8a', sum, - 'virtual set size (total virtual address space mapped)'), - avgpss=('AVGPSS', lambda n: int(1.0 * pt[n]['pss']/pt[n]['pids']), - '% 8a', sum, - 'average PSS per PID'), - avguss=('AVGUSS', lambda n: int(1.0 * pt[n]['uss']/pt[n]['pids']), - '% 8a', sum, - 'average USS per PID'), - avgrss=('AVGRSS', lambda n: int(1.0 * pt[n]['rss']/pt[n]['pids']), - '% 8a', sum, - 'average RSS per PID'), - ) - columns = options.columns or 'map pids avgpss pss' - - showtable(pt.keys(), fields, columns.split(), options.sort or 'pss') - -def usertotals(pids): - totals = {} - for pid in pids: - if (filter(options.processfilter, pid, src.pidname, src.pidcmd) or - filter(options.userfilter, pid, pidusername)): - continue - try: - maps = pidmaps(pid) - if len(maps) == 0: - continue - except: - raise - user = src.piduser(pid) - if user not in totals: - t = dict(size=0, rss=0, pss=0, shared_clean=0, - shared_dirty=0, private_clean=0, count=0, - private_dirty=0, referenced=0, swap=0) - else: - t = totals[user] - - for m in maps.iterkeys(): - for k in t: - t[k] += maps[m].get(k, 0) - - t['count'] += 1 - totals[user] = t - return totals - -def showusers(): - p = src.pids() - pt = usertotals(p) - - def showuser(u): - if options.numeric: - return u - return src.username(u) - - fields = dict( - user=('User', showuser, '%-8s', None, - 'user name or ID'), - count=('Count', lambda n: pt[n]['count'], '% 5s', sum, - 'number of processes'), - swap=('Swap',lambda n: pt[n]['swap'], '% 8a', sum, - 'amount of swapspace consumed (ignoring sharing)'), - uss=('USS', lambda n: pt[n]['private_clean'] - + pt[n]['private_dirty'], '% 8a', sum, - 'unique set size'), - rss=('RSS', lambda n: pt[n]['rss'], '% 8a', sum, - 'resident set size (ignoring sharing)'), - pss=('PSS', lambda n: pt[n]['pss'], '% 8a', sum, - 'proportional set size (including sharing)'), - vss=('VSS', lambda n: pt[n]['pss'], '% 8a', sum, - 'virtual set size (total virtual memory mapped)'), - ) - columns = options.columns or 'user count swap uss pss rss' - - showtable(pt.keys(), fields, columns.split(), options.sort or 'pss') - -def showsystem(): - t = totalmem() - ki = kernelsize() - m = memory() - - mt = m['memtotal'] - f = m['memfree'] - - # total amount used by hardware - fh = max(t - mt - ki, 0) - - # total amount mapped into userspace (ie mapped an unmapped pages) - u = m['anonpages'] + m['mapped'] - - # total amount allocated by kernel not for userspace - kd = mt - f - u - - # total amount in kernel caches - kdc = m['buffers'] + m['sreclaimable'] + (m['cached'] - m['mapped']) - - l = [("firmware/hardware", fh, 0), - ("kernel image", ki, 0), - ("kernel dynamic memory", kd, kdc), - ("userspace memory", u, m['mapped']), - ("free memory", f, f)] - - fields = dict( - order=('Order', lambda n: n, '% 1s', lambda x: '', - 'hierarchical order'), - area=('Area', lambda n: l[n][0], '%-24s', lambda x: '', - 'memory area'), - used=('Used', lambda n: l[n][1], '%10a', sum, - 'area in use'), - cache=('Cache', lambda n: l[n][2], '%10a', sum, - 'area used as reclaimable cache'), - noncache=('Noncache', lambda n: l[n][1] - l[n][2], '%10a', sum, - 'area not reclaimable')) - - columns = options.columns or 'area used cache noncache' - showtable(range(len(l)), fields, columns.split(), options.sort or 'order') - -def showfields(fields, f): - if f != list: - print ("unknown field", f) - print ("known fields:") - for l in sorted(fields.keys()): - print ("%-8s %s" % (l, fields[l][-1])) - -def showtable(rows, fields, columns, sort): - header = "" - format = "" - formatter = [] - - if sort not in fields: - showfields(fields, sort) - sys.exit(-1) - - if options.pie: - columns.append(options.pie) - if options.bar: - columns.append(options.bar) - - for n in columns: - if n not in fields: - showfields(fields, n) - sys.exit(-1) - - f = fields[n][2] - if 'a' in f: - formatter.append(showamount) - f = f.replace('a', 's') - else: - formatter.append(lambda x: x) - format += f + " " - header += f % fields[n][0] + " " - - l = [] - for n in rows: - r = [fields[c][1](n) for c in columns] - l.append((fields[sort][1](n), r)) - - l.sort(reverse=bool(options.reverse)) - - if options.pie: - showpie(l, sort) - return - elif options.bar: - showbar(l, columns, sort) - return - - if not options.no_header: - print (header) - - for k,r in l: - print (format % tuple([f(v) for f,v in zip(formatter, r)])) - - if options.totals: - # totals - t = [] - for c in columns: - f = fields[c][3] - if f: - t.append(f([fields[c][1](n) for n in rows])) - else: - t.append("") - - print ("-" * len(header)) - print (format % tuple([f(v) for f,v in zip(formatter, t)])) - -def showpie(l, sort): - try: - import pylab - except ImportError: - sys.stderr.write("pie chart requires matplotlib\n") - sys.exit(-1) - - if (l[0][0] < l[-1][0]): - l.reverse() - - labels = [r[1][-1] for r in l] - values = [r[0] for r in l] # sort field - - tm = totalmem() - s = sum(values) - unused = tm - s - t = 0 - c = 0 - while values and (t + values[-1 - c] < (tm * .02) or - values[-1 - c] < (tm * .005)): - c += 1 - t += values.pop() - labels.pop() - if c > 1: - values = values[:-c] - labels = labels[:-c] - values.append(t) - labels.append('other') - - explode = [0] * len(values) - if unused > 0: - values.insert(0, unused) - labels.insert(0, 'unused') - explode.insert(0, .05) - - pylab.figure(1, figsize=(6,6)) - ax = pylab.axes([0.1, 0.1, 0.8, 0.8]) - pylab.pie(values, explode = explode, labels=labels, - autopct="%.2f%%", shadow=True) - pylab.title('%s by %s' % (options.pie, sort)) - pylab.show() - -def showbar(l, columns, sort): - try: - import pylab, numpy - except ImportError: - sys.stderr.write("bar chart requires matplotlib\n") - sys.exit(-1) - - if (l[0][0] < l[-1][0]): - l.reverse() - - rc = [] - key = [] - for n in range(len(columns) - 1): - try: - if columns[n] in 'pid user group'.split(): - continue - float(l[0][1][n]) - rc.append(n) - key.append(columns[n]) - except: - pass - - width = 1.0 / (len(rc) + 1) - offset = width / 2 - - def gc(n): - return 'bgrcmyw'[n % 7] - - pl = [] - ind = numpy.arange(len(l)) - for n in xrange(len(rc)): - pl.append(pylab.bar(ind + offset + width * n, - [x[1][rc[n]] for x in l], width, color=gc(n))) - - #plt.xticks(ind + .5, ) - pylab.gca().set_xticks(ind + .5) - pylab.gca().set_xticklabels([x[1][-1] for x in l], rotation=45) - pylab.legend([p[0] for p in pl], key) - pylab.show() - -def kernel_version_check(): - kernel_release = src.version().split()[2].split('-')[0] - if kernel_release < "2.6.27": - name = os.path.basename(sys.argv[0]) - sys.stderr.write(name + " requires a kernel >= 2.6.27\n") - sys.exit(-1) - -parser = optparse.OptionParser("%prog [options]") -parser.add_option("-H", "--no-header", action="store_true", - help="disable header line") -parser.add_option("-c", "--columns", type="str", - help="columns to show") -parser.add_option("-t", "--totals", action="store_true", - help="show totals") - -parser.add_option("-R", "--realmem", type="str", - help="amount of physical RAM") -parser.add_option("-K", "--kernel", type="str", - help="path to kernel image") - -parser.add_option("-m", "--mappings", action="store_true", - help="show mappings") -parser.add_option("-u", "--users", action="store_true", - help="show users") -parser.add_option("-w", "--system", action="store_true", - help="show whole system") - -parser.add_option("-P", "--processfilter", type="str", - help="process filter regex") -parser.add_option("-M", "--mapfilter", type="str", - help="map filter regex") -parser.add_option("-U", "--userfilter", type="str", - help="user filter regex") - -parser.add_option("-n", "--numeric", action="store_true", - help="numeric output") -parser.add_option("-s", "--sort", type="str", - help="field to sort on") -parser.add_option("-r", "--reverse", action="store_true", - help="reverse sort") - -parser.add_option("-p", "--percent", action="store_true", - help="show percentage") -parser.add_option("-k", "--abbreviate", action="store_true", - help="show unit suffixes") - -parser.add_option("", "--pie", type='str', - help="show pie graph") -parser.add_option("", "--bar", type='str', - help="show bar graph") - -parser.add_option("-S", "--source", type="str", - help="/proc data source") - - -defaults = {} -parser.set_defaults(**defaults) -(options, args) = parser.parse_args() - -try: - src = tardata(options.source) -except: - src = procdata(options.source) - -kernel_version_check() - -try: - if options.mappings: - showmaps() - elif options.users: - showusers() - elif options.system: - showsystem() - else: - showpids() -except IOError as e: - if e.errno == errno.EPIPE: - pass -except KeyboardInterrupt: - pass diff --git a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx index 482bdcebbc125494ad4819a4cf5c741e54e1a388..d9d97be93089318dc446ad67959d2ec2ba0b961c 100644 --- a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx @@ -81,7 +81,10 @@ StatusCode NominalAlignmentCondAlg::execute() { EventIDBase start(1, EventIDBase::UNDEFEVT); EventIDBase end(1, EventIDBase::UNDEFEVT); start.set_lumi_block(0); - end.set_lumi_block(9999); // this is not actually forever + end.set_lumi_block(std::numeric_limits<EventIDBase::number_type>::max()); + + start.set_time_stamp(0); + end.set_time_stamp(std::numeric_limits<EventIDBase::number_type>::max()); EventIDRange r(start, end); diff --git a/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..7ab038a4a9c1c2c5c2d6ba216f04c11af0ce43f5 --- /dev/null +++ b/Tracking/TrkAlgorithms/TrkTruthAlgs/TrkTruthAlgs/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkAlgorithms/TrkTruthAlgs diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..5a0bbff64adec3bdf1d16c7e50484f7b439d5a24 --- /dev/null +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkDetDescr/TrkDetDescrSvc diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h index fd5dbe884a30f440d46c82dac3282d642c4c2f81..843ae7714d571b9058277f295bbaea7bd8ad7071 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ namespace Trk { @author Andreas.Salzburger@cern.ch */ - class TrackingGeometrySvc : public AthService, virtual public ITrackingGeometrySvc { + class ATLAS_NOT_THREAD_SAFE TrackingGeometrySvc : public AthService, virtual public ITrackingGeometrySvc { public: diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingVolumesSvc.h b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingVolumesSvc.h index 9dcdb96446dc3cac037107dca7c18c22aa4b479a..eb32dfdeab10e4adf062ed937165371de377e25b 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingVolumesSvc.h +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingVolumesSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h index 2c8369b47c174269968516a1bdfcfb79a4e39b93..162179368dc9253496c6c74b070e93e052f4c7a3 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -28,6 +28,7 @@ namespace Trk { given by the BinUtitlity. @author Andreas.Salzburger@cern.ch + @author Christos Anastopoulos (Athena MT modifications) */ template<class T> @@ -38,30 +39,35 @@ public: /**Default Constructor - needed for inherited classes */ BinnedArray1DT() : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtility(0) + , m_binUtility(nullptr) {} - /**Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, - if this deletion should be turned off, the boolean deletion should be switched to false - the global position is given by object */ - BinnedArray1DT(const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector, BinUtility* bingen) + /**Constructor with std::vector and a BinUtility - reference counted, will + delete objects at the end, if this deletion should be turned off, the + boolean deletion should be switched to false the global position is given + by object */ + BinnedArray1DT( + const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector, + BinUtility* bingen) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_binUtility(bingen) { // prepare the binned Array if (bingen) { size_t vecsize = tclassvector.size(); - m_array = new std::vector<SharedObject<T>>(vecsize); + m_array = std::vector<SharedObject<T>>(vecsize); for (size_t ivec = 0; ivec < vecsize; ++ivec) { const Amg::Vector3D currentGlobal(((tclassvector[ivec]).second)); if (bingen->inside(currentGlobal)) { - (*m_array)[bingen->bin(currentGlobal, 0)] = ((tclassvector)[ivec]).first; + m_array[bingen->bin(currentGlobal, 0)] = ((tclassvector)[ivec]).first; } else - throw GaudiException("BinnedArray1DT constructor", "Object outside bounds", StatusCode::FAILURE); + throw GaudiException("BinnedArray1DT constructor", + "Object outside bounds", + StatusCode::FAILURE); } } } @@ -69,15 +75,15 @@ public: /**Copy Constructor - copies only pointers !*/ BinnedArray1DT(const BinnedArray1DT& barr) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtility(0) + , m_binUtility(nullptr) { - m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : 0; + m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : nullptr; if (m_binUtility) { - m_array = new std::vector<SharedObject<T>>(barr.m_array->size()); - for (unsigned int ient = 0; ient < barr.m_array->size(); ++ient) { - (*m_array)[ient] = (*barr.m_array)[ient]; + m_array = std::vector<SharedObject<T>>(barr.m_array.size()); + for (unsigned int ient = 0; ient < barr.m_array.size(); ++ient) { + m_array[ient] = (barr.m_array)[ient]; } } } @@ -85,17 +91,16 @@ public: BinnedArray1DT& operator=(const BinnedArray1DT& barr) { if (this != &barr) { - - delete m_array; + m_array.clear(); m_arrayObjects.release(); delete m_binUtility; // now refill m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : 0; - // -------------------------------------------------------------------------- + if (m_binUtility) { - m_array = new std::vector<SharedObject<T>>(barr.m_array->size()); - for (unsigned int ient = 0; ient < barr.m_array->size(); ++ient) { - (*m_array)[ient] = (*barr.m_array)[ient]; + m_array = std::vector<SharedObject<T>>(barr.m_array.size()); + for (unsigned int ient = 0; ient < barr.m_array.size(); ++ient) { + m_array[ient] = (barr.m_array)[ient]; } } } @@ -105,48 +110,56 @@ public: BinnedArray1DT* clone() const { return new BinnedArray1DT(*this); } /**Virtual Destructor*/ - ~BinnedArray1DT() - { - delete m_array; - delete m_binUtility; - } + ~BinnedArray1DT() { delete m_binUtility; } /** Returns the pointer to the templated class object from the BinnedArrayT, it returns 0 if not defined; */ T* object(const Amg::Vector2D& lp) const { - if (m_binUtility->inside(lp)) - return ((*m_array)[m_binUtility->bin(lp, 0)]).get(); - return 0; + if (m_binUtility->inside(lp)) { + return (m_array[m_binUtility->bin(lp, 0)]).get(); + } + return nullptr; } /** Returns the pointer to the templated class object from the BinnedArrayT it returns 0 if not defined; */ - T* object(const Amg::Vector3D& gp) const { return ((*m_array)[m_binUtility->bin(gp, 0)]).get(); } + T* object(const Amg::Vector3D& gp) const + { + return (m_array[m_binUtility->bin(gp, 0)]).get(); + } - /** Returns the pointer to the templated class object from the BinnedArrayT - entry point*/ - T* entryObject(const Amg::Vector3D& gp) const { return ((*m_array)[m_binUtility->entry(gp, 0)]).get(); } + /** Returns the pointer to the templated class object from the BinnedArrayT - + * entry point*/ + T* entryObject(const Amg::Vector3D& gp) const + { + return (m_array[m_binUtility->entry(gp, 0)]).get(); + } /** Returns the pointer to the templated class object from the BinnedArrayT */ - T* nextObject(const Amg::Vector3D& gp, const Amg::Vector3D& mom, bool associatedResult = true) const + T* nextObject(const Amg::Vector3D& gp, + const Amg::Vector3D& mom, + bool associatedResult = true) const { // the bins - size_t bin = associatedResult ? m_binUtility->bin(gp, 0) : m_binUtility->next(gp, mom, 0); - return ((*m_array)[bin]).get(); + size_t bin = associatedResult ? m_binUtility->bin(gp, 0) + : m_binUtility->next(gp, mom, 0); + return (m_array[bin]).get(); } /** Return all objects of the Array */ const std::vector<T*>& arrayObjects() const { if (!m_arrayObjects) { - std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>(); + std::unique_ptr<std::vector<T*>> arrayObjects = + std::make_unique<std::vector<T*>>(); auto bins = m_binUtility->bins(0); arrayObjects->reserve(bins); for (size_t ill = 0; ill < bins; ++ill) { - arrayObjects->push_back(((*m_array)[ill]).get()); + arrayObjects->push_back((m_array[ill]).get()); } m_arrayObjects.set(std::move(arrayObjects)); } @@ -160,12 +173,15 @@ public: const BinUtility* binUtility() const { return (m_binUtility); } private: - std::vector<SharedObject<T>>* m_array; //!< vector of pointers to the class T - CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; //!< forced 1D vector of pointers to class T - BinUtility* m_binUtility; //!< binUtility for retrieving and filling the Array + //!< vector of pointers to the class T + std::vector<SharedObject<T>> m_array; + //!< forced 1D vector of pointers to class T + CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; + //!< binUtility for retrieving and filling the Array + BinUtility* m_binUtility; }; -template <class T> +template<class T> using BinnedArray1D = BinnedArray1DT<const T>; } // end of namespace Trk diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h index bb454f0d901492cc5b159453083ddf11027882d5..179df9c706e3fee17fea7994a032a8ffb17bcf2f 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D.h @@ -13,10 +13,9 @@ #include "TrkDetDescrUtils/BinnedArray.h" #include "TrkDetDescrUtils/SharedObject.h" -// STL #include <vector> - #include "CxxUtils/CachedUniquePtr.h" + class MsgStream; namespace Trk { @@ -38,20 +37,22 @@ public: /** Default Constructor - needed for inherited classes */ BinnedArray1D1DT() : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_steeringBinUtility(0) - , m_singleBinUtilities(0) + , m_steeringBinUtility(nullptr) + , m_singleBinUtilities(nullptr) {} - /** Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, - if this deletion should be turned off, the boolean deletion should be switched to false - the global position is given by object! */ - BinnedArray1D1DT(const std::vector<std::pair<SharedObject<T>,Amg::Vector3D>>& tclassvector, - BinUtility* steeringBinGen1D, - std::vector<BinUtility*>* singleBinGen) + /** Constructor with std::vector and a BinUtility - reference counted, will + delete objects at the end, if this deletion should be turned off, the + boolean deletion should be switched to false the global position is given + by object! */ + BinnedArray1D1DT( + const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector, + BinUtility* steeringBinGen1D, + std::vector<BinUtility*>* singleBinGen) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_steeringBinUtility(steeringBinGen1D) , m_singleBinUtilities(singleBinGen) @@ -59,10 +60,11 @@ public: // prepare the binned Array if (steeringBinGen1D) { - m_array = new std::vector<std::vector<SharedObject<T>>*>(steeringBinGen1D->bins(), 0); + m_array = + std::vector<std::vector<SharedObject<T>>>(steeringBinGen1D->bins()); for (size_t i = 0; i < steeringBinGen1D->bins(); ++i) { size_t sizeOfSubBin = ((*m_singleBinUtilities)[i])->bins(); - (*m_array)[i] = new std::vector<SharedObject<T>>(sizeOfSubBin); + m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin); } // fill the Volume vector into the array @@ -71,11 +73,13 @@ public: const Amg::Vector3D currentGlobal((tclassvector[ivec]).second); if (steeringBinGen1D->inside(currentGlobal)) { int steeringBin = steeringBinGen1D->bin(currentGlobal, 0); - int singleBin = ((*m_singleBinUtilities)[steeringBin])->bin(currentGlobal, 0); - std::vector<SharedObject<T>>* curVec = (*m_array)[steeringBin]; - (*curVec)[singleBin] = ((tclassvector)[ivec]).first; + int singleBin = + ((*m_singleBinUtilities)[steeringBin])->bin(currentGlobal, 0); + std::vector<SharedObject<T>>& curVec = m_array[steeringBin]; + curVec[singleBin] = ((tclassvector)[ivec]).first; } else - throw GaudiException("BinnedArray1D1DT", "Object outside bounds", StatusCode::FAILURE); + throw GaudiException( + "BinnedArray1D1DT", "Object outside bounds", StatusCode::FAILURE); } } } @@ -83,31 +87,38 @@ public: /** Copy Constructor - copies only pointers! */ BinnedArray1D1DT(const BinnedArray1D1DT& barr) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_steeringBinUtility(0) - , m_singleBinUtilities(0) + , m_steeringBinUtility(nullptr) + , m_singleBinUtilities(nullptr) { // prepare the binUtilities - m_steeringBinUtility = (barr.m_steeringBinUtility) ? barr.m_steeringBinUtility->clone() : 0; + m_steeringBinUtility = (barr.m_steeringBinUtility) + ? barr.m_steeringBinUtility->clone() + : nullptr; m_singleBinUtilities = new std::vector<BinUtility*>; - std::vector<BinUtility*>::iterator singleBinIter = barr.m_singleBinUtilities->begin(); - for (; singleBinIter != barr.m_singleBinUtilities->end(); ++singleBinIter) + std::vector<BinUtility*>::iterator singleBinIter = + barr.m_singleBinUtilities->begin(); + for (; singleBinIter != barr.m_singleBinUtilities->end(); ++singleBinIter){ m_singleBinUtilities->push_back((*singleBinIter)->clone()); + } // prepare the binned Array - if (m_steeringBinUtility && m_singleBinUtilities->size()) { + if (m_steeringBinUtility && !m_singleBinUtilities->empty()) { // prepare the array - m_array = new std::vector<std::vector<SharedObject<T>>*>(m_steeringBinUtility->bins(0)); + m_array = std::vector<std::vector<SharedObject<T>>>( + m_steeringBinUtility->bins(0)); for (size_t i = 0; i < m_steeringBinUtility->bins(0); ++i) { size_t sizeOfSubBin = ((*m_singleBinUtilities)[i])->bins(0); - (*m_array)[i] = new std::vector<SharedObject<T>>(sizeOfSubBin, 0); + m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin, nullptr); } // assign the items - for (size_t isteer = 0; isteer < m_steeringBinUtility->bins(0); ++isteer) - for (size_t isingle = 0; isingle < (*m_singleBinUtilities)[isteer]->bins(0); ++isteer) - (*((*m_array)[isteer]))[isingle] = (*((*barr.m_array)[isteer]))[isingle]; + for (size_t isteer = 0; isteer < m_steeringBinUtility->bins(0); ++isteer){ + for (size_t isingle = 0; isingle < (*m_singleBinUtilities)[isteer]->bins(0);++isteer){ + m_array[isteer][isingle] = (barr.m_array)[isteer][isingle]; + } + } } } @@ -116,22 +127,20 @@ public: { if (this != &barr) { - int arrsize = m_array->size(); - // first deleting everything - for (int ivec = 0; ivec < arrsize; ++ivec) - delete (*m_array)[ivec]; - delete m_array; m_arrayObjects.release(); delete m_steeringBinUtility; - std::vector<BinUtility*>::iterator singleBinIter = m_singleBinUtilities->begin(); - for (; singleBinIter != m_singleBinUtilities->end(); ++singleBinIter) + std::vector<BinUtility*>::iterator singleBinIter = + m_singleBinUtilities->begin(); + for (; singleBinIter != m_singleBinUtilities->end(); ++singleBinIter){ delete *singleBinIter; + } delete m_singleBinUtilities; m_singleBinUtilities = new std::vector<BinUtility*>; // now assign the stuff - m_steeringBinUtility = (barr.m_steeringBinUtility) ? (barr.m_steeringBinUtility)->clone() : 0; + m_steeringBinUtility = + (barr.m_steeringBinUtility) ? (barr.m_steeringBinUtility)->clone() : 0; singleBinIter = barr.m_singleBinUtilties->begin(); for (; singleBinIter != barr.m_singleBinUtilities->end(); ++singleBinIter) @@ -140,16 +149,18 @@ public: // prepare the binned Array if (m_steeringBinUtility && m_singleBinUtilities->size()) { // prepare the array - m_array = new std::vector<std::vector<SharedObject<T>>*>(m_steeringBinUtility->bins(0)); + m_array=std::vector<std::vector<SharedObject<T>>>(m_steeringBinUtility->bins(0)); for (int i = 0; i < m_steeringBinUtility->bins(0); ++i) { unsigned int sizeOfSubBin = ((*m_singleBinUtilities)[i])->bins(0); - (*m_array)[i] = new std::vector<SharedObject<T>>(sizeOfSubBin); + m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin); } // assign the items - for (int isteer = 0; isteer < m_steeringBinUtility->bins(0); ++isteer) - for (int isingle = 0; isingle < (*m_singleBinUtilities)[isteer]->bins(0); ++isteer) - (*((*m_array)[isteer]))[isingle] = (*((*barr.m_array)[isteer]))[isingle]; + for (int isteer = 0; isteer < m_steeringBinUtility->bins(0); ++isteer) { + for (int isingle = 0;isingle < (*m_singleBinUtilities)[isteer]->bins(0);++isteer) { + m_array[isteer][isingle] = (barr.m_array)[isteer][isingle]; + } + } } } return *this; @@ -161,15 +172,12 @@ public: /** Virtual Destructor */ virtual ~BinnedArray1D1DT() { - int arrsize = m_array->size(); - for (int ivec = 0; ivec < arrsize; ++ivec) - delete (*m_array)[ivec]; - delete m_array; delete m_steeringBinUtility; if (m_singleBinUtilities) { std::vector<BinUtility*>::iterator binIter = m_singleBinUtilities->begin(); - for (; binIter != m_singleBinUtilities->end(); ++binIter) + for (; binIter != m_singleBinUtilities->end(); ++binIter){ delete *binIter; + } } delete m_singleBinUtilities; } @@ -181,7 +189,7 @@ public: { int steerBin = m_steeringBinUtility->bin(lp, 0); int singleBin = (*m_singleBinUtilities)[steerBin]->bin(lp, 0); - return ((*((*m_array)[steerBin]))[singleBin]).get(); + return (m_array[steerBin][singleBin]).get(); } /** Returns the pointer to the templated class object from the BinnedArrayT, @@ -191,28 +199,35 @@ public: { int steerBin = m_steeringBinUtility->bin(gp, 0); int singleBin = (*m_singleBinUtilities)[steerBin]->bin(gp, 0); - return ((*((*m_array)[steerBin]))[singleBin]).get(); + return (m_array[steerBin][singleBin]).get(); } - /** Returns the pointer to the templated class object from the BinnedArrayT - entry point */ + /** Returns the pointer to the templated class object from the BinnedArrayT - + * entry point */ T* entryObject(const Amg::Vector3D& gp) const { int steerBin = m_steeringBinUtility->entry(gp, 0); int singleBin = (*m_singleBinUtilities)[steerBin]->entry(gp, 0); - return ((*((*m_array)[steerBin]))[singleBin]).get(); + return (m_array[steerBin][singleBin]).get(); } /** Returns the pointer to the templated class object from the BinnedArrayT */ - T* nextObject(const Amg::Vector3D&, const Amg::Vector3D&, bool) const { return 0; } + T* nextObject(const Amg::Vector3D&, const Amg::Vector3D&, bool) const + { + return nullptr; + } /** Return all objects of the Array */ const std::vector<T*>& arrayObjects() const { if (!m_arrayObjects) { - std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>(); + std::unique_ptr<std::vector<T*>> arrayObjects = + std::make_unique<std::vector<T*>>(); for (size_t isteer = 0; isteer < m_steeringBinUtility->bins(); ++isteer) { - for (size_t isingle = 0; isingle < (*m_singleBinUtilities)[isteer]->bins(); ++isingle) { - arrayObjects->push_back(((*((*m_array)[isteer]))[isingle]).get()); + for (size_t isingle = 0; + isingle < (*m_singleBinUtilities)[isteer]->bins(); + ++isingle) { + arrayObjects->push_back((m_array[isteer][isingle]).get()); } } m_arrayObjects.set(std::move(arrayObjects)); @@ -227,12 +242,12 @@ public: const BinUtility* binUtility() const { return (m_steeringBinUtility); } private: - std::vector<std::vector<SharedObject<T>>*>* m_array; //!< vector of pointers to the class T + std::vector<std::vector<SharedObject<T>>> m_array; //!< vector of pointers to the class T CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; //!< forced 1D vector of pointers to class T - BinUtility* m_steeringBinUtility; //!< binUtility for retrieving and filling the Array - std::vector<BinUtility*>* m_singleBinUtilities; //!< single bin utilities + BinUtility* m_steeringBinUtility; //!< binUtility for retrieving and filling the Array + std::vector<BinUtility*>* m_singleBinUtilities; //!< single bin utilities }; -template <class T> +template<class T> using BinnedArray1D1D = BinnedArray1D1DT<const T>; } // end of namespace Trk diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h index 15fe09aa06fc8171fd1c9c95742da58c0e1582ec..4c62297f446e327028ba34311c2a30e4c4095724 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray1D1D1D.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -39,11 +39,11 @@ public: /**Default Constructor - needed for inherited classes */ BinnedArray1D1D1DT() : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtil1(0) - , m_binUtil2(0) - , m_binUtilArray(0) + , m_binUtil1(nullptr) + , m_binUtil2(nullptr) + , m_binUtilArray(nullptr) {} /**Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, @@ -54,7 +54,7 @@ public: BinUtility* binUtil2, std::vector<std::vector<BinUtility*>>* binUtilVec) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_binUtil1(binUtil1) , m_binUtil2(binUtil2) @@ -68,11 +68,11 @@ public: { int v1Size = binUtil1->bins(); int v2Size = binUtil2->bins(); - m_array = new std::vector<std::vector<std::vector<SharedObject<T>>*>*>(v1Size); + m_array = std::vector<std::vector<std::vector<SharedObject<T>>>>(v1Size); for (int i = 0; i < v1Size; ++i) { - (*m_array)[i] = new std::vector<std::vector<SharedObject<T>>*>(v2Size); + m_array[i] = std::vector<std::vector<SharedObject<T>>>(v2Size); for (int j = 0; j < v2Size; ++j) { - (*((*m_array)[i]))[j] = new std::vector<SharedObject<T>>((*binUtilVec)[i][j]->bins()); + m_array[i][j] = std::vector<SharedObject<T>>((*binUtilVec)[i][j]->bins()); } } } @@ -86,9 +86,9 @@ public: int bin2 = binUtil2->bin(currentGlobal); assert((*binUtilVec)[bin1][bin2]); int bin3 = (*binUtilVec)[bin1][bin2]->bin(currentGlobal); - std::vector<std::vector<SharedObject<T>>*>* currArr = (*m_array)[bin1]; - std::vector<SharedObject<T>>* curVec = (*currArr)[bin2]; - (*curVec)[bin3] = ((tclassvector)[ivec]).first; + std::vector<std::vector<SharedObject<T>>>& currArr = m_array[bin1]; + std::vector<SharedObject<T>>& curVec = currArr[bin2]; + curVec[bin3] = ((tclassvector)[ivec]).first; } else throw GaudiException("BinnedArray1D1D1DT", "Object outside bounds", StatusCode::FAILURE); } @@ -97,11 +97,11 @@ public: /** Copy Constructor - copies only pointers! */ BinnedArray1D1D1DT(const BinnedArray1D1D1DT& barr) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtil1(0) - , m_binUtil2(0) - , m_binUtilArray(0) + , m_binUtil1(nullptr) + , m_binUtil2(nullptr) + , m_binUtilArray(nullptr) { // prepare the binUtilities m_binUtil1 = (barr.m_binUtil1) ? barr.m_binUtil1->clone() : 0; @@ -118,18 +118,18 @@ public: if (m_binUtil1 && m_binUtil2 && m_binUtilArray->size()) { int v1Size = m_binUtil1->bins(); int v2Size = m_binUtil2->bins(); - m_array = new std::vector<std::vector<std::vector<SharedObject<T>>*>*>(v1Size); + m_array = std::vector<std::vector<std::vector<SharedObject<T>>>>(v1Size); for (int i = 0; i < v1Size; ++i) { - (*m_array)[i] = new std::vector<std::vector<SharedObject<T>>*>(v2Size); + m_array[i] = std::vector<std::vector<SharedObject<T>>>(v2Size); for (int j = 0; j < v2Size; ++j) - (*((*m_array)[i]))[j] = new std::vector<SharedObject<T>>((*m_binUtilArray)[i][j]->bins()); + m_array[i][j] = std::vector<SharedObject<T>>((*m_binUtilArray)[i][j]->bins()); } // assign the items for (int ibin1 = 0; ibin1 < v1Size; ++ibin1) { for (int ibin2 = 0; ibin2 < v2Size; ++ibin2) { for (size_t ibin3 = 0; ibin3 < (*m_binUtilArray)[ibin1][ibin2]->bins(); ++ibin3) { - (*((*((*m_array)[ibin1]))[ibin2]))[ibin3] = (*((*((*barr.m_array)[ibin1]))[ibin2]))[ibin3]; + m_array[ibin1][ibin2][ibin3] = (barr.m_array)[ibin1][ibin2][ibin3]; } } } @@ -141,26 +141,15 @@ public: { if (this != &barr) { - // delete everything - int arr = m_array->size(); - for (int ia = 0; ia < arr; ++ia) { - for (unsigned int iv = 0; iv < (*m_array)[ia]->size(); ++iv) { - for (unsigned int io = 0; io < (*((*m_array)[ia]))[iv]->size(); ++io) - delete (*((*((*m_array)[ia]))[iv]))[io]; - delete (*((*m_array)[ia]))[iv]; - } - delete (*m_array)[ia]; - } - delete m_array; m_arrayObjects.release(); // bin utilities - int v1Size = m_binUtil1->bins(); - int v2Size = m_binUtil2->bins(); + size_t v1Size = m_binUtil1->bins(); + size_t v2Size = m_binUtil2->bins(); delete m_binUtil1; delete m_binUtil2; - for (int ibin1 = 0; ibin1 < v1Size; ibin1++) { - for (int ibin2 = 0; ibin2 < v2Size; ibin2++) + for (size_t ibin1 = 0; ibin1 < v1Size; ibin1++) { + for (size_t ibin2 = 0; ibin2 < v2Size; ibin2++) delete (*m_binUtilArray)[ibin1][ibin2]; } delete m_binUtilArray; @@ -179,20 +168,20 @@ public: // prepare the binned Array if (m_binUtil1 && m_binUtil2 && m_binUtilArray->size()) { - int v1Size = m_binUtil1->bins(); - int v2Size = m_binUtil2->bins(); - m_array = new std::vector<std::vector<std::vector<SharedObject<T>>*>*>(v1Size); - for (int i = 0; i < v1Size; ++i) { - (*m_array)[i] = new std::vector<std::vector<SharedObject<T>>*>(v2Size); - for (int j = 0; j < v2Size; ++j) - (*((*m_array)[i]))[j] = new std::vector<SharedObject<T>>((*m_binUtilArray)[i][j]->bins()); + size_t v1Size = m_binUtil1->bins(); + size_t v2Size = m_binUtil2->bins(); + m_array = std::vector<std::vector<std::vector<SharedObject<T>>>>(v1Size); + for (size_t i = 0; i < v1Size; ++i) { + m_array[i] = std::vector<std::vector<SharedObject<T>>>(v2Size); + for (size_t j = 0; j < v2Size; ++j) + m_array[i][j] = std::vector<SharedObject<T>>((*m_binUtilArray)[i][j]->bins()); } // assign the items for (size_t ibin1 = 0; ibin1 < v1Size; ++ibin1) { for (size_t ibin2 = 0; ibin2 < v2Size; ++ibin2) { for (size_t ibin3 = 0; ibin3 < (*m_binUtilArray)[ibin1][ibin2]->bins(); ++ibin3) { - (*((*((*m_array)[ibin1]))[ibin2]))[ibin3] = (*((*((*barr.m_array)[ibin1]))[ibin2]))[ibin3]; + m_array[ibin1][ibin2][ibin3] = (barr.m_array)[ibin1][ibin2][ibin3]; } } } @@ -207,14 +196,6 @@ public: /**Virtual Destructor*/ ~BinnedArray1D1D1DT() { - int arr = m_array->size(); - for (int ia = 0; ia < arr; ++ia) { - for (unsigned int iv = 0; iv < (*m_array)[ia]->size(); ++iv) { - delete (*((*m_array)[ia]))[iv]; - } - delete (*m_array)[ia]; - } - delete m_array; int v1Size = m_binUtil1->bins(); int v2Size = m_binUtil2->bins(); delete m_binUtil1; @@ -240,7 +221,7 @@ public: return 0; int bin3 = (*m_binUtilArray)[bin1][bin2]->bin(lp); - return ((*((*((*m_array)[bin1]))[bin2]))[bin3]).get(); + return (m_array[bin1][bin2][bin3]).get(); } /** Returns the pointer to the templated class object from the BinnedArrayT, @@ -259,7 +240,7 @@ public: if (bin3 >= (*m_binUtilArray)[bin1][bin2]->bins()) return 0; - return ((*((*((*m_array)[bin1]))[bin2]))[bin3]).get(); + return (m_array[bin1][bin2][bin3]).get(); } /** Returns the pointer to the templated class object from the BinnedArrayT - entry point */ @@ -269,7 +250,7 @@ public: int bin2 = m_binUtil2->entry(gp, 0); int bin3 = (*m_binUtilArray)[bin1][bin2]->entry(gp, 0); - return ((*((*((*m_array)[bin1]))[bin2]))[bin3]).get(); + return (m_array[bin1][bin2][bin3]).get(); } /** Returns the pointer to the templated class object from the BinnedArrayT @@ -284,7 +265,7 @@ public: for (size_t ibin1 = 0; ibin1 < m_binUtil1->bins(); ++ibin1) { for (size_t ibin2 = 0; ibin2 < m_binUtil2->bins(); ++ibin2) { for (size_t ibin3 = 0; ibin3 < (*m_binUtilArray)[ibin1][ibin2]->bins(); ++ibin3) { - arrayObjects->push_back(((*((*((*m_array)[ibin1]))[ibin2]))[ibin3]).get()); + arrayObjects->push_back((m_array[ibin1][ibin2][ibin3]).get()); } } } @@ -300,7 +281,7 @@ public: const BinUtility* binUtility() const { return (m_binUtil1); } private: - std::vector<std::vector<std::vector<SharedObject<T>>*>*>* m_array; //!< vector of pointers to the class T + std::vector<std::vector<std::vector<SharedObject<T>>>> m_array; //!< vector of pointers to the class T CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; //!< forced 1D vector of pointers to class T BinUtility* m_binUtil1; //!< binUtility for retrieving and filling the Array BinUtility* m_binUtil2; //!< binUtility for retrieving and filling the Array diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h index 2d826fec71ccd366f8e08908da3b53a1d6993674..c01aefc23e883f91869ee3d0475b8bdd0d810b69 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArray2D.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -26,9 +26,10 @@ namespace Trk { Avoiding a map search, the templated BinnedArrayT class can help ordereing geometrical objects by providing a dedicated BinUtility. - dedicated for 2-dim aequidistant binning + dedicated for 2-dim equidistant binning @author Andreas.Salzburger@cern.ch + @author Christos Anastopoulos (Athena MT modifications) */ template<class T> @@ -39,35 +40,41 @@ public: /**Default Constructor - needed for inherited classes */ BinnedArray2DT() : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtility(0) + , m_binUtility(nullptr) {} - /**Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, - if this deletion should be turned off, the boolean deletion should be switched to false - the global position is given by object! */ - BinnedArray2DT(const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector, BinUtility* bingen) + /**Constructor with std::vector and a BinUtility - reference counted, will + delete objects at the end, if this deletion should be turned off, the + boolean deletion should be switched to false the global position is given + by object! */ + BinnedArray2DT( + const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector, + BinUtility* bingen) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_binUtility(bingen) { if (bingen) { - m_array = new std::vector<std::vector<SharedObject<T>>*>(bingen->bins(1)); - for (size_t i = 0; i < bingen->bins(1); ++i) - (*m_array)[i] = new std::vector<SharedObject<T>>(bingen->bins(0)); - + m_array=std::vector<std::vector<SharedObject<T>>>(bingen->bins(1)); + for (size_t i = 0; i < bingen->bins(1); ++i) { + m_array[i] = std::vector<SharedObject<T>>(bingen->bins(0)); + } // fill the Volume vector into the array size_t vecsize = tclassvector.size(); for (size_t ivec = 0; ivec < vecsize; ++ivec) { const Amg::Vector3D currentGlobal(((tclassvector[ivec]).second)); if (bingen->inside(currentGlobal)) { - std::vector<SharedObject<T>>* curVec = (*m_array)[bingen->bin(currentGlobal, 1)]; - (*curVec)[bingen->bin(currentGlobal, 0)] = ((tclassvector)[ivec]).first; + std::vector<SharedObject<T>>& curVec = + m_array[bingen->bin(currentGlobal, 1)]; + + curVec[bingen->bin(currentGlobal, 0)] = ((tclassvector)[ivec]).first; } else { - throw GaudiException("BinnedArray2DT", "Object outside bounds", StatusCode::FAILURE); + throw GaudiException( + "BinnedArray2DT", "Object outside bounds", StatusCode::FAILURE); } } } @@ -76,38 +83,35 @@ public: /**Copy Constructor - copies only pointers !*/ BinnedArray2DT(const BinnedArray2DT& barr) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) - , m_binUtility(0) + , m_binUtility(nullptr) { - m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : 0; + m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : nullptr; // copy over - m_array = new std::vector<std::vector<SharedObject<T>>*>(barr.m_array->size()); - for (size_t ihl = 0; ihl < barr.m_array->size(); ++ihl) { - (*m_array)[ihl] = new std::vector<SharedObject<T>>(((*barr.m_array)[0])->size()); - for (size_t ill = 0; ill < ((*barr.m_array)[0])->size(); ++ill) - (*((*m_array)[ihl]))[ill] = (*((*barr.m_array)[ihl]))[ill]; + m_array=std::vector<std::vector<SharedObject<T>>>(barr.m_array.size()); + for (size_t ihl = 0; ihl < barr.m_array.size(); ++ihl) { + m_array[ihl] = std::vector<SharedObject<T>>((barr.m_array[0]).size()); + for (size_t ill = 0; ill < (barr.m_array[0]).size(); ++ill) { + m_array[ihl][ill] = (barr.m_array)[ihl][ill]; + } } } /**Assignment operator*/ BinnedArray2DT& operator=(const BinnedArray2DT& barr) { if (this != &barr) { - size_t arrsize = m_array->size(); - // first deleting everything - for (size_t ivec = 0; ivec < arrsize; ++ivec) - delete (*m_array)[ivec]; - delete m_array; m_arrayObjects.release(); delete m_binUtility; // now refill - m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : 0; + m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : nullptr; // assign over - m_array = new std::vector<std::vector<SharedObject<T>>*>(barr.m_array->size()); - for (size_t ihl = 0; ihl < barr.m_array->size(); ++ihl) { - (*m_array)[ihl] = new std::vector<SharedObject<T>>(((*barr.m_array)[0])->size()); - for (size_t ill = 0; ill < ((*barr.m_array)[0])->size(); ++ill) - (*((*m_array)[ihl]))[ill] = (*((*barr.m_array)[ihl]))[ill]; + m_array=std::vector<std::vector<SharedObject<T>>>(barr.m_array.size()); + for (size_t ihl = 0; ihl < barr.m_array.size(); ++ihl) { + m_array[ihl] = std::vector<SharedObject<T>>((barr.m_array[0]).size()); + for (size_t ill = 0; ill < ((barr.m_array)[0]).size(); ++ill) { + m_array[ihl][ill] = (barr.m_array)[ihl][ill]; + } } } return *this; @@ -116,23 +120,17 @@ public: BinnedArray2DT* clone() const { return new BinnedArray2DT(*this); } /**Virtual Destructor*/ - ~BinnedArray2DT() - { - // these are SharedObjects - memory management internally handled - for (size_t ivec = 0; ivec < m_array->size(); ++ivec) - delete (*m_array)[ivec]; - delete m_array; - delete m_binUtility; - } + ~BinnedArray2DT() { delete m_binUtility; } /** Returns the pointer to the templated class object from the BinnedArrayT, it returns 0 if not defined; */ T* object(const Amg::Vector2D& lp) const { - if (m_binUtility->inside(lp)) - return ((*((*m_array)[m_binUtility->bin(lp, 1)]))[m_binUtility->bin(lp, 0)]).get(); - return 0; + if (m_binUtility->inside(lp)) { + return (m_array[m_binUtility->bin(lp, 1)][m_binUtility->bin(lp, 0)]).get(); + } + return nullptr; } /** Returns the pointer to the templated class object from the BinnedArrayT @@ -140,57 +138,76 @@ public: */ T* object(const Amg::Vector3D& gp) const { - if (m_binUtility->inside(gp)) - return ((*((*m_array)[m_binUtility->bin(gp, 1)]))[m_binUtility->bin(gp, 0)]).get(); - return 0; + if (m_binUtility->inside(gp)) { + return (m_array[m_binUtility->bin(gp, 1)][m_binUtility->bin(gp, 0)]).get(); + } + return nullptr; } - /** Returns the pointer to the templated class object from the BinnedArrayT - entry point*/ + /** Returns the pointer to the templated class object + * from the BinnedArrayT -entry point*/ T* entryObject(const Amg::Vector3D& pos) const { - return ((*((*m_array)[m_binUtility->entry(pos, 1)]))[m_binUtility->entry(pos, 0)]).get(); + return (m_array[m_binUtility->entry(pos, 1)][m_binUtility->entry(pos, 0)]).get(); } - /** Returns the pointer to the templated class object from the BinnedArrayT - */ - T* nextObject(const Amg::Vector3D& gp, const Amg::Vector3D& mom, bool associatedResult = true) const + /** Returns the pointer to the templated class object + * from the BinnedArrayT*/ + T* nextObject(const Amg::Vector3D& gp, + const Amg::Vector3D& mom, + bool associatedResult = true) const { // direct access to associated one if (associatedResult) return object(gp); size_t nextFirst = m_binUtility->next(gp, mom, 0); size_t nextSecond = m_binUtility->next(gp, mom, 1); - return (nextFirst > 0 && nextSecond > 0) ? ((*((*m_array)[nextSecond]))[nextFirst]).get() : 0; + + return (nextFirst > 0 && nextSecond > 0) + ? (m_array[nextSecond][nextFirst]).get() + : nullptr; } /** Return all objects of the Array */ const std::vector<T*>& arrayObjects() const { if (!m_arrayObjects) { - std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>(); + + std::unique_ptr<std::vector<T*>> arrayObjects = + std::make_unique<std::vector<T*>>(); + arrayObjects->reserve(arrayObjectsNumber()); + for (size_t ihl = 0; ihl < (m_binUtility->bins(1)); ++ihl) { for (size_t ill = 0; ill < (m_binUtility->bins(0)); ++ill) { - arrayObjects->push_back(((*((*m_array)[ihl]))[ill]).get()); + arrayObjects->push_back((m_array[ihl][ill]).get()); } } m_arrayObjects.set(std::move(arrayObjects)); } + return (*m_arrayObjects); } /** Number of Entries in the Array */ - unsigned int arrayObjectsNumber() const { return (m_array->size()) * ((*m_array)[0]->size()); } + unsigned int arrayObjectsNumber() const + { + return (m_array.size() * (m_array[0]).size()); + } /** Return the BinUtility*/ const BinUtility* binUtility() const { return (m_binUtility); } private: - std::vector<std::vector<SharedObject<T>>*>* m_array; //!< vector of pointers to the class T - CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; //!< forced 1D vector of pointers to class T - BinUtility* m_binUtility; //!< binUtility for retrieving and filling the Array + //!< vector of pointers to the class T + std::vector<std::vector<SharedObject<T>>> m_array; + //!< forced 1D vector of pointers to class T + CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; + //!< binUtility for retrieving and filling the Array + BinUtility* m_binUtility; }; -template <class T> + +template<class T> using BinnedArray2D = BinnedArray2DT<const T>; } // end of namespace Trk diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h index 51a255e1aac6f3929ad35ae74d40944a47d4f18e..98eb72538f36747da6b93324f94308d8b9e26003 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/BinnedArrayArray.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ public: /**Default Constructor */ BinnedArrayArrayT(const std::vector<std::pair<BinnedArrayT<T>*, Amg::Vector3D>>& tbas, BinUtility* bUtility) : m_binUtility(bUtility) - , m_binnedArrays(bUtility->bins(0), NULL) + , m_binnedArrays(bUtility->bins(0), nullptr) , m_arrayObjects() { // the array objects @@ -97,7 +97,7 @@ public: if (ba) return ba->object(lp); } - return 0; + return nullptr; } /** Returns the pointer to the templated class object from the BinnedArrayArrayT @@ -109,7 +109,7 @@ public: if (ba) return ba->object(gp); } - return 0; + return nullptr; } /** Returns the pointer to the templated class object from the BinnedArrayArrayT - entry point*/ diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/LayerIndex.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/LayerIndex.h index bc3867546d1b4600f8d0d66f366bddcc911ef1a7..9cb44bbc0fc41df4ae272b09203c8498aa289590 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/LayerIndex.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/LayerIndex.h @@ -29,8 +29,8 @@ namespace Trk { LayerIndex for the identification of layers in a simplified detector geometry of Cylinders and Discs. - - @author Andreas.Salzburger@cern.ch + + @author Andreas.Salzburger@cern.ch */ class LayerIndex @@ -38,9 +38,7 @@ class LayerIndex public: /** Default Constructor */ - LayerIndex() - : m_value(0) - {} + LayerIndex() = default; /** Constructor with value*/ LayerIndex(int value) @@ -48,26 +46,25 @@ public: {} /** Copy Constructor */ - LayerIndex(const LayerIndex& layIx) - : m_value(layIx.m_value) - {} + LayerIndex(const LayerIndex& layIx) = default; + + /** Move Constructor */ + LayerIndex(LayerIndex&& layIx) = default; /** Assignment Operator */ - LayerIndex& operator=(const LayerIndex& layIx) - { - if (this != &layIx) - m_value = layIx.m_value; - return (*this); - } + LayerIndex& operator=(const LayerIndex& layIx) = default; + + /** Move Assignment Operator */ + LayerIndex& operator=(LayerIndex&& layIx) = default; /** Destructor */ - virtual ~LayerIndex() {} + ~LayerIndex() = default; /** layerIndex expressed in an integer */ int value() const; protected: - int m_value; + int m_value=0; }; inline int @@ -86,12 +83,12 @@ operator>(const LayerIndex& one, const LayerIndex& two); bool operator>=(const LayerIndex& one, const LayerIndex& two); -/**Overload of << operator for both, MsgStream and std::ostream for debug output*/ +/**Overload of << operator for both, MsgStream and std::ostream for debug + * output*/ MsgStream& operator<<(MsgStream& sl, const LayerIndex& layx); std::ostream& operator<<(std::ostream& sl, const LayerIndex& layx); - } #endif diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/NavBinnedArray1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/NavBinnedArray1D.h index 4b2d2ec54dd2c677a024b0b866924a80a6e2ab42..e96003042dc721cfbbf565e63fca63624a3139e5 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/NavBinnedArray1D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/NavBinnedArray1D.h @@ -38,35 +38,38 @@ public: /**Default Constructor - needed for inherited classes */ NavBinnedArray1DT() : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_binUtility() , m_transf(nullptr) {} - /**Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, - if this deletion should be turned off, the boolean deletion should be switched to false - the global position is given by pointer and then deleted! */ + /**Constructor with std::vector and a BinUtility - reference counted, will + delete objects at the end, if this deletion should be turned off, the boolean + deletion should be switched to false the global position is given by pointer + and then deleted! */ NavBinnedArray1DT(const std::vector<SharedObject<T>>& tclassvector, - BinUtility* bingen, - Amg::Transform3D* transform) + BinUtility* bingen, + Amg::Transform3D* transform) : BinnedArrayT<T>() - , m_array(0) + , m_array{} , m_arrayObjects(nullptr) , m_binUtility(SharedObject<BinUtility>(bingen)) , m_transf(transform) { // prepare the binned Array // simplify as the array is ordered when defined if (bingen) { - m_array = new std::vector<SharedObject<T>>(tclassvector); + m_array = std::vector<SharedObject<T>>(tclassvector); } } /**Copy Constructor with shift */ - NavBinnedArray1DT(const NavBinnedArray1DT& barr, std::vector<SharedObject<T>>* vec, Amg::Transform3D& shift) + NavBinnedArray1DT(const NavBinnedArray1DT& barr, + std::vector<SharedObject<T>>&& vec, + Amg::Transform3D& shift) : BinnedArrayT<T>() - , m_array(vec) - , m_arrayObjects(nullptr) + , m_array(std::move(vec)) + , m_arrayObjects{} , m_binUtility(barr.m_binUtility) , m_transf(new Amg::Transform3D(shift * (*barr.m_transf))) {} @@ -74,38 +77,38 @@ public: /**Copy Constructor - copies only pointers !*/ NavBinnedArray1DT(const NavBinnedArray1DT& barr) : BinnedArrayT<T>() - , m_array(nullptr) + , m_array{} , m_arrayObjects(nullptr) , m_binUtility(barr.m_binUtility) , m_transf(nullptr) { if (m_binUtility.get()) { - m_array = new std::vector<SharedObject<T>>(m_binUtility.get()->bins(0)); + m_array = std::vector<SharedObject<T>>(m_binUtility.get()->bins(0)); for (size_t ient = 0; ient < m_binUtility.get()->bins(0); ++ient) { - (*m_array)[ient] = (*barr.m_array)[ient]; + m_array[ient] = (barr.m_array)[ient]; } } - m_transf = (barr.m_transf) ? new Amg::Transform3D(*(barr.m_transf)) : nullptr; + m_transf = + (barr.m_transf) ? new Amg::Transform3D(*(barr.m_transf)) : nullptr; } /**Assignment operator*/ NavBinnedArray1DT& operator=(const NavBinnedArray1DT& barr) { if (this != &barr) { - - delete m_array; m_arrayObjects.release(); delete m_transf; // now refill m_binUtility = barr.m_binUtility; // -------------------------------------------------------------------------- if (m_binUtility.get()) { - m_array = new std::vector<SharedObject<T>>(m_binUtility.get()->bins(0)); + m_array = std::vector<SharedObject<T>>(m_binUtility.get()->bins(0)); for (size_t ient = 0; ient < m_binUtility.get()->bins(0); ++ient) { - (*m_array)[ient] = (*barr.m_array)[ient]; + m_array[ient] = (barr.m_array)[ient]; } } - m_transf = (barr.m_transf) ? new Amg::Transform3D(*barr.m_transf) : nullptr; + m_transf = + (barr.m_transf) ? new Amg::Transform3D(*barr.m_transf) : nullptr; } return *this; } @@ -116,7 +119,6 @@ public: /**Virtual Destructor*/ ~NavBinnedArray1DT() { - delete m_array; delete m_transf; } @@ -125,8 +127,9 @@ public: */ T* object(const Amg::Vector2D& lp) const { - if (m_binUtility.get()->inside(lp)) - return ((*m_array)[m_binUtility.get()->bin(lp)]).get(); + if (m_binUtility.get()->inside(lp)){ + return (m_array[m_binUtility.get()->bin(lp)]).get(); + } return nullptr; } @@ -137,17 +140,21 @@ public: { // transform into navig.coordinates const Amg::Vector3D navGP((m_transf->inverse()) * gp); - if (m_binUtility.get()->inside(navGP)) - return ((*m_array)[m_binUtility.get()->bin(navGP)]).get(); + if (m_binUtility.get()->inside(navGP)){ + return (m_array[m_binUtility.get()->bin(navGP)]).get(); + } return nullptr; } - /** Returns the pointer to the templated class object from the BinnedArray - entry point*/ - T* entryObject(const Amg::Vector3D&) const { return ((*m_array)[0]).get(); } + /** Returns the pointer to the templated class object from the BinnedArray - + * entry point*/ + T* entryObject(const Amg::Vector3D&) const { return (m_array[0]).get(); } /** Returns the pointer to the templated class object from the BinnedArray */ - T* nextObject(const Amg::Vector3D& gp, const Amg::Vector3D& mom, bool associatedResult = true) const + T* nextObject(const Amg::Vector3D& gp, + const Amg::Vector3D& mom, + bool associatedResult = true) const { // transform into navig.coordinates const Amg::Vector3D navGP((m_transf->inverse()) * gp); @@ -156,23 +163,28 @@ public: size_t firstBin = m_binUtility.get()->next(navGP, navMom, 0); // use the information of the associated result if (associatedResult) { - if (firstBin <= m_binUtility.get()->max(0)) - return ((*m_array)[firstBin]).get(); - else + if (firstBin <= m_binUtility.get()->max(0)){ + return (m_array[firstBin]).get(); + } + else{ return nullptr; + } } // the associated result was 0 -> set to boundary - firstBin = (firstBin < m_binUtility.get()->bins(0)) ? firstBin : m_binUtility.get()->max(0); - return ((*m_array)[m_binUtility.get()->bin(navGP)]).get(); + firstBin = (firstBin < m_binUtility.get()->bins(0)) + ? firstBin + : m_binUtility.get()->max(0); + return (m_array[m_binUtility.get()->bin(navGP)]).get(); } /** Return all objects of the Array */ const std::vector<T*>& arrayObjects() const { if (!m_arrayObjects) { - std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>(); - for (unsigned int ill = 0; ill < m_array->size(); ++ill) { - arrayObjects->push_back(((*m_array)[ill]).get()); + std::unique_ptr<std::vector<T*>> arrayObjects = + std::make_unique<std::vector<T*>>(); + for (unsigned int ill = 0; ill < m_array.size(); ++ill) { + arrayObjects->push_back((m_array[ill]).get()); } m_arrayObjects.set(std::move(arrayObjects)); } @@ -197,12 +209,17 @@ public: } private: - std::vector<SharedObject<T>>* m_array; //!< vector of pointers to the class T - CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; //!< forced 1D vector of pointers to class T - SharedObject<BinUtility> m_binUtility; //!< binUtility for retrieving and filling the Array - Amg::Transform3D* m_transf; // !< transform into local navigation coordinates + //!< vector of pointers to the class T + std::vector<SharedObject<T>> m_array; + //!< forced 1D vector of pointers to class T + CxxUtils::CachedUniquePtr<std::vector<T*>> m_arrayObjects; + //!< binUtility for retrieving and filling the Array + SharedObject<BinUtility> m_binUtility; + // !< transform into local navigation coordinates + + Amg::Transform3D* m_transf; }; -template <class T> +template<class T> using NavBinnedArray1D = NavBinnedArray1DT<const T>; } // end of namespace Trk diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/OrderPositionsToStepVector.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/OrderPositionsToStepVector.h deleted file mode 100644 index d7030498c80e98f726a1e69c9d7444c45fdd72c5..0000000000000000000000000000000000000000 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/OrderPositionsToStepVector.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// BinUtility.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef TRKDETDESCRUTILS_ORDERPOSITIONSTOSTEPVECTOR_H -#define TRKDETDESCRUTILS_ORDERPOSITIONSTOSTEPVECTOR_H - -#include <algorithm> -#include <vector> - -namespace Trk { - -/** @class OrderPositionsToStepVector - - Class inheriting from std::vector<double> to transform 1-dim - un-aequidistant positions (x,y,z,r-values) into stepvectors - for BinUtility1D usage. - - The constructor takes r/z values as a std::vector<double>, - a mimimum and a maximum boundary. - - @author Andreas.Salzburger@cern.ch - - */ - -class OrderPositionsToStepVector : public std::vector<double> -{ -public: - /**Constructor with arguments*/ - OrderPositionsToStepVector(std::vector<double>& rzvalues, double rzmin, double rzmax); - /**Destructor*/ - ~OrderPositionsToStepVector() {} - -private: - /** Forbidden constructor */ - OrderPositionsToStepVector() {} -}; - -inline OrderPositionsToStepVector::OrderPositionsToStepVector(std::vector<double>& values, double min, double max) - : std::vector<double>(values.size()) -{ - unsigned int vectorSize = values.size(); - // sort the vector - sort(values.begin(), values.end()); - // first step - necessary because of correction of parsecLayerRmin - double firstStep = fabs(0.5 * (values[1] + values[0]) - min); - double lastValue = min + firstStep; - push_back(firstStep); - // all steps between second and one before last - for (unsigned int istep = 2; istep < vectorSize; ++istep) { - double currentStep = fabs(0.5 * (values[istep] + values[istep - 1]) - lastValue); - push_back(currentStep); - lastValue += currentStep; - } - // last step - push_back(fabs(max - 0.5 * (values[vectorSize - 2] + values[vectorSize - 1]))); -} - -} - -#endif diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx index 3e9420a2dd7c505f31ece4c05e60e97a57ee8c76..f8e2f3533626ef2bd1ff8d78a83b0aec5e056dd1 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx @@ -421,7 +421,7 @@ Trk::TrackingVolume::TrackingVolume(const Trk::TrackingVolume& trVol, const Trk::NavBinnedArray1D<Trk::Layer>* confLays = dynamic_cast<const Trk::NavBinnedArray1D<Trk::Layer>*> (confinedLayers); if (confLays) m_confinedLayers = new Trk::NavBinnedArray1D<Trk::Layer>(*confLays, - new std::vector<Trk::SharedObject<const Trk::Layer> >(layerOrder), transform); + std::vector<Trk::SharedObject<const Trk::Layer> >(layerOrder), transform); } // confined 'unordered' layers @@ -467,7 +467,7 @@ Trk::TrackingVolume::TrackingVolume(const Trk::TrackingVolume& trVol, const Trk::NavBinnedArray1D<Trk::TrackingVolume>* confVols = dynamic_cast<const Trk::NavBinnedArray1D<Trk::TrackingVolume>*> (confinedVolumes); if (confVols) m_confinedVolumes = new Trk::NavBinnedArray1D<Trk::TrackingVolume>(*confVols, - new std::vector<Trk::SharedObject<const Trk::TrackingVolume> >(volOrder), transform); + std::vector<Trk::SharedObject<const Trk::TrackingVolume> >(volOrder), transform); } // confined unordered volumes @@ -1064,7 +1064,7 @@ const Trk::TrackingVolume* Trk::TrackingVolume::cloneTV ATLAS_NOT_THREAD_SAFE (A if (confLaysNav) layerArray = new Trk::NavBinnedArray1D<Trk::Layer>( *confLaysNav, - new std::vector<Trk::SharedObject<const Trk::Layer> >(layerOrder), + std::vector<Trk::SharedObject<const Trk::Layer> >(layerOrder), transform); } @@ -1117,7 +1117,7 @@ const Trk::TrackingVolume* Trk::TrackingVolume::cloneTV ATLAS_NOT_THREAD_SAFE (A if (confVolsNav) volumeArray = new Trk::NavBinnedArray1D<Trk::TrackingVolume>( *confVolsNav, - new std::vector<Trk::SharedObject<const TrackingVolume> >(volOrder), + std::vector<Trk::SharedObject<const TrackingVolume> >(volOrder), transform ); } diff --git a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/LocalParameters.h b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/LocalParameters.h index 74f3b87ab4a6af9367fec7e53c358f7e6c3710c7..9e613e4ad4e5d0cd50c6578e7bda212c4a78eb62 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/LocalParameters.h +++ b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/LocalParameters.h @@ -16,7 +16,7 @@ #include "TrkEventPrimitives/DefinedParameter.h" #include "TrkEventPrimitives/ProjectionMatricesSet.h" // maths -#include <math.h> +#include <cmath> class MsgStream; diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPerigee.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPerigee.cxx index 40cc6a8cafcf1e3543a4932123e4f072260b80f9..6c75ae54befbd0863afbc10313e09ee83a8d0060 100644 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPerigee.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPerigee.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianCartesianToPerigee.h" -#include <math.h> +#include <cmath> Trk::JacobianCartesianToPerigee::JacobianCartesianToPerigee(const double px, const double py, const double pz, const double E, const double, const double, const double, const double charge ): AmgMatrix(5,7)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPolar.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPolar.cxx index 3bb4eec1f50de74f9853ad50e3ae894747ba6595..35967ad81afd877d2b6a81021d91f53e9ed54021 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPolar.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCartesianToPolar.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianCartesianToPolar.h" -#include <math.h> +#include <cmath> Trk::JacobianCartesianToPolar::JacobianCartesianToPolar(const double lx, const double ly): AmgMatrix(5,5)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCotThetaPtToThetaP.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCotThetaPtToThetaP.cxx index 735e90fb7d650feb6c0e1ea0ff621c6aedb09fbf..0418c34581ab2d69bc69ca54fb8bc4676cbc44bb 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCotThetaPtToThetaP.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianCotThetaPtToThetaP.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianCotThetaPtToThetaP.h" -#include <math.h> +#include <cmath> Trk::JacobianCotThetaPtToThetaP::JacobianCotThetaPtToThetaP(const double cotTheta, const double qpT): AmgMatrix(5,5)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianLocalAnglesPhiTheta.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianLocalAnglesPhiTheta.cxx index 8067561c93a688fd80bd6db83abbbba33200e7d5..8bc4af356d10297b389df33061e0412dbef61aee 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianLocalAnglesPhiTheta.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianLocalAnglesPhiTheta.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianLocalAnglesPhiTheta.h" -#include <math.h> +#include <cmath> Trk::JacobianLocalAnglesPhiTheta::JacobianLocalAnglesPhiTheta(const double angleXZ, const double angleYZ, const Amg::RotationMatrix3D& rot): AmgMatrix(2,2)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPerigeeToCartesian.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPerigeeToCartesian.cxx index 0c4e2d06cfc4df256a2e749c17e0bea64d475e3e..c46d707982a037231f6c938f96be9df143b46104 100644 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPerigeeToCartesian.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPerigeeToCartesian.cxx @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPerigeeToCartesian.h" -#include <math.h> +#include <cmath> Trk::JacobianPerigeeToCartesian::JacobianPerigeeToCartesian(const double d0, const double, diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaLocalAngles.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaLocalAngles.cxx index 1a36de27af9f60f4082e9781c43e21f30640d763..940f239839989a780d41b4be08c9e333acb5c662 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaLocalAngles.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaLocalAngles.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPhiThetaLocalAngles.h" -#include <math.h> +#include <cmath> Trk::JacobianPhiThetaLocalAngles::JacobianPhiThetaLocalAngles(const double phi, const double theta, const Amg::RotationMatrix3D& rot) : diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaQoverPToPxyz.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaQoverPToPxyz.cxx index 86d6688c2aa0cfa36a5e130aaa7be186ecde8db7..7acc7cd39cd58c29c668dd995678d602b4db82fb 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaQoverPToPxyz.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPhiThetaQoverPToPxyz.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPhiThetaQoverPToPxyz.h" -#include <math.h> +#include <cmath> Trk::JacobianPhiThetaQoverPToPxyz::JacobianPhiThetaQoverPToPxyz(const double phi, const double theta, const double qOverP): AmgMatrix(3,3)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPolarToCartesian.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPolarToCartesian.cxx index 22d0bd6ea23eef8c8e4f2f8f2684b4147aaa1628..d9c52338700a5549600d41e994806138ad005285 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPolarToCartesian.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPolarToCartesian.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPolarToCartesian.h" -#include <math.h> +#include <cmath> Trk::JacobianPolarToCartesian::JacobianPolarToCartesian(const double r, const double phi): AmgMatrix(5,5)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPcartesian.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPcartesian.cxx index 25878dd1ee84ed76a14362d5317d49771e8408ce..8ce013bc3d175a66570216762cf49aef73a3f359 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPcartesian.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPcartesian.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPxyzToPhiThetaQoverPcartesian.h" -#include <math.h> +#include <cmath> Trk::JacobianPxyzToPhiThetaQoverPcartesian::JacobianPxyzToPhiThetaQoverPcartesian(const double px, const double py, const double pz, double charge): AmgMatrix(3,3)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPspherical.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPspherical.cxx index c3e5ff8d5ce03f467cab83a114c6b40e8fac721d..80378a3f5b9e38a437f7a8e5a59a0c5975ad8ee1 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPspherical.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianPxyzToPhiThetaQoverPspherical.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianPxyzToPhiThetaQoverPspherical.h" -#include <math.h> +#include <cmath> Trk::JacobianPxyzToPhiThetaQoverPspherical::JacobianPxyzToPhiThetaQoverPspherical(const double phi, const double theta, const double qOverP): AmgMatrix(3,3)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianThetaPToCotThetaPt.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianThetaPToCotThetaPt.cxx index b4f6a8231cc95a1367452d3635214006d5a59f8f..002b45789f47949cc8b10c95a8a2c0147fa6acee 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianThetaPToCotThetaPt.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/JacobianThetaPToCotThetaPt.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/JacobianThetaPToCotThetaPt.h" -#include <math.h> +#include <cmath> Trk::JacobianThetaPToCotThetaPt::JacobianThetaPToCotThetaPt(const double theta, const double qp): AmgMatrix(5,5)() diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx index c7d5a21f6ec80ac26f569dfdb5d6d2620aa7ca8f..d42ca6fa11085f16aea5a2b5e7ebf6f4bde18ed2 100755 --- a/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx +++ b/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx @@ -7,7 +7,7 @@ /////////////////////////////////////////////////////////////////// #include "TrkEventPrimitives/ProjectionMatricesSet.h" -#include <math.h> +#include <cmath> Trk::ProjectionMatricesSet::ProjectionMatricesSet(int maxdim) : m_maxdim(maxdim) diff --git a/Tracking/TrkEvent/TrkEventUtils/src/MeasurementTypeID.cxx b/Tracking/TrkEvent/TrkEventUtils/src/MeasurementTypeID.cxx index 65f0aa7e8a6b3f8f740169cbfdc41307fcb3cd3f..367028c9d2e95430e9b0bb23b5a43e55c2f561fa 100644 --- a/Tracking/TrkEvent/TrkEventUtils/src/MeasurementTypeID.cxx +++ b/Tracking/TrkEvent/TrkEventUtils/src/MeasurementTypeID.cxx @@ -28,7 +28,7 @@ Trk::MeasurementTypeID::defineType (const Trk::MeasurementBase* meas) const { } if (m_idHelper->is_pixel(testROT->identify())) { return Trk::TrackState::Pixel; - } else if (m_idHelper->is_sct(testROT->identify())) { + } if (m_idHelper->is_sct(testROT->identify())) { return Trk::TrackState::SCT; } else if (m_idHelper->is_trt(testROT->identify())) { return Trk::TrackState::TRT; diff --git a/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h b/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h index 348b84614fd1884b9ea1c63ce6f65239414f6f50..d8a8997e2033d02fdde8406b859967759ae346ec 100755 --- a/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h +++ b/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,8 +9,8 @@ #ifndef TRKMATERIALONTRACK_ENERGYLOSS_H #define TRKMATERIALONTRACK_ENERGYLOSS_H +#include <cmath> #include <iostream> -#include <math.h> class MsgStream; class TrackCollectionCnv; diff --git a/Tracking/TrkEvent/TrkMaterialOnTrack/src/MaterialEffectsOnTrack.cxx b/Tracking/TrkEvent/TrkMaterialOnTrack/src/MaterialEffectsOnTrack.cxx index 1f3250f047cc3c73b0b9b42352a90a4acc57942e..f0610fd6021218c0eaeba23f60dc7d8bb1202038 100755 --- a/Tracking/TrkEvent/TrkMaterialOnTrack/src/MaterialEffectsOnTrack.cxx +++ b/Tracking/TrkEvent/TrkMaterialOnTrack/src/MaterialEffectsOnTrack.cxx @@ -3,12 +3,12 @@ */ #include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" +#include "GaudiKernel/MsgStream.h" #include "TrkMaterialOnTrack/EnergyLoss.h" #include "TrkMaterialOnTrack/ScatteringAngles.h" #include "TrkSurfaces/Surface.h" -#include "GaudiKernel/MsgStream.h" +#include <cassert> #include <string> -#include <assert.h> // typedef Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes nmetypes; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Charged.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Charged.h index 8acffedbf1452612f3e253fa28094ca0e78a2c02..c371c4c0e5ed1a7832fd879d3d90d612654dfa1e 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Charged.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Charged.h @@ -39,7 +39,7 @@ namespace Trk Charged(Charged&&) = default; /** Destructor */ - ~Charged() {} + ~Charged() = default; /** Assignment operator */ Charged& operator=(const Charged&) = default; @@ -56,7 +56,7 @@ namespace Trk /** Equality operator */ bool operator==(const Charged& rOther) const { - static const double tolerance = 1e-8; + constexpr double tolerance = 1e-8; return fabs(charge() - rOther.charge()) < tolerance; } diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h index 779cce6d3efaf1e756d67b50633881f2f33898c5..de8707c9c52528dd78adb0e508bb24295a47ea03 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h @@ -16,7 +16,8 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" // Tracking includes -#include "TrkParametersBase/ParametersT.h" +#include "TrkParametersBase/ParametersBase.h" +#include "TrkParametersBase/SurfaceUniquePtrT.h" #include "TrkEventPrimitives/CurvilinearUVT.h" class MsgStream; @@ -44,7 +45,7 @@ namespace Trk */ template<int DIM,class T, class S> - class CurvilinearParametersT : public ParametersT<DIM,T,S> + class CurvilinearParametersT : public ParametersBase<DIM,T> { public: /** default constructor only for POOL */ @@ -52,86 +53,111 @@ namespace Trk /** Create CurvilinearParametersT from DIM+2 parameters - these are: global position, momentum, charge, extension */ - CurvilinearParametersT(const AmgVector(DIM+2)& parameters, - AmgSymMatrix(DIM)* covariance = 0, - unsigned int cIdenfier = 0); - + CurvilinearParametersT(const AmgVector(DIM + 2) & parameters, + AmgSymMatrix(DIM) * covariance = nullptr, + unsigned int cIdenfier = 0); + /**Create CurvilinearParametersT from mixed parameters: pos, local parameters*/ - CurvilinearParametersT(const Amg::Vector3D& pos, - double phi, - double theta, - double qOverP, - AmgSymMatrix(DIM)* covariance = 0, - unsigned int cIdenfier = 0); - + CurvilinearParametersT(const Amg::Vector3D& pos, + double phi, + double theta, + double qOverP, + AmgSymMatrix(DIM) * covariance = nullptr, + unsigned int cIdenfier = 0); + /** Create CurvilinearParametersT from global parameters. - -- it will throw a GaudiException if the position is not on surface */ - CurvilinearParametersT(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - double charge, - AmgSymMatrix(DIM)* covariance = nullptr, - unsigned int cIdenfier = 0); - + -- it will throw a GaudiException if the position is not on surface */ + CurvilinearParametersT(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + double charge, + AmgSymMatrix(DIM) * covariance = nullptr, + unsigned int cIdenfier = 0); + /** Copy Constructor */ CurvilinearParametersT(const CurvilinearParametersT<DIM,T,S>&); /** Move Constructor */ - CurvilinearParametersT(CurvilinearParametersT<DIM,T,S>&&); - - /** Destructor */ - virtual ~CurvilinearParametersT()=default; - + CurvilinearParametersT(CurvilinearParametersT<DIM, T, S>&&) = default; + /** Assignment operator*/ CurvilinearParametersT<DIM,T,S> &operator=(const CurvilinearParametersT<DIM,T,S>&); /** Move assignment operator*/ - CurvilinearParametersT<DIM,T,S> &operator=(CurvilinearParametersT<DIM,T,S>&&); + CurvilinearParametersT<DIM, T, S>& operator=( + CurvilinearParametersT<DIM, T, S>&&) = default; + + /** Destructor */ + virtual ~CurvilinearParametersT()=default; + + /** the curvilinear parameters identifier */ + unsigned int cIdentifier() const { return m_cIdentifier; } + + void setcIdentifier(unsigned int cIdentifier) + { m_cIdentifier = cIdentifier; } + + /** Test to see if there's a surface there. */ + virtual bool hasSurface() const override final + { + return m_surface != nullptr; + } + + /** Access to the Surface method */ + virtual const S& associatedSurface() const override final + { + return *m_surface; + } /** equality operator */ virtual bool operator==(const ParametersBase<DIM,T>& rhs) const override final; - /** Pseudo constructor */ - virtual CurvilinearParametersT<DIM,T,S>* clone() const override final - {return new CurvilinearParametersT<DIM,T,S>(*this);} - + /** Virtual clone */ + virtual CurvilinearParametersT<DIM, T, S>* clone() const override final + { + return new CurvilinearParametersT<DIM, T, S>(*this); + } + /** Return the ParametersType enum */ - virtual ParametersType type() const override - {return Trk::Curvilinear;} - + virtual ParametersType type() const override final + { + return Trk::Curvilinear; + } + /** Return the measurementFrame of the parameters */ virtual Amg::RotationMatrix3D measurementFrame() const override final; - + /**Dumps relevant information about the track parameters into the ostream.*/ virtual MsgStream& dump(MsgStream& out) const override; virtual std::ostream& dump(std::ostream& out) const override; - /** Update parameters and covariance */ - virtual void updateParameters(const AmgVector(DIM)&, AmgSymMatrix(DIM)* = nullptr) override; - - /** Update parameters and covariance , passing covariance by ref. A covariance - * is created if one does not exist. Otherwise in place update occurs*/ - virtual void updateParameters(const AmgVector(DIM)&, const AmgSymMatrix(DIM)&) override; - - /** the curvilinear parameters identifier */ - unsigned int cIdentifier() const {return m_cIdentifier;} - - void setcIdentifier (unsigned int cIdentifier) - { m_cIdentifier = cIdentifier; } - - - /** DESIGN TO BE REVISITED */ - protected: - friend class MaterialEffectsEngine; - private: /* Helper to factor in update of parameters*/ - void updateParametersHelper(const AmgVector(DIM)&); + virtual void updateParametersHelper(const AmgVector(DIM)&) override final; /** return the curvilinear frame */ CurvilinearUVT curvilinearFrame() const; - + + protected: + /* + * Add dependent names into scope + */ + using ParametersBase<DIM,T>::m_parameters; + using ParametersBase<DIM,T>::m_covariance; + using ParametersBase<DIM,T>::m_position; + using ParametersBase<DIM,T>::m_momentum; + using ParametersBase<DIM,T>::m_chargeDef; + SurfaceUniquePtrT<const S> m_surface; //!< surface template /** the curvilinear parameters identifier */ unsigned int m_cIdentifier=0; + /* + * friends needed for Persistency + */ + template<typename pars> + friend class ::TrackParametersCovarianceCnv; + friend class ::TrackParametersCnv_p2; + friend class ::MeasuredPerigeeCnv_p1; + + /** DESIGN TO BE REVISITED */ + friend class MaterialEffectsEngine; }; }//end of namespace Trk diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc index 84026ec3ab9acd6ed4030bd399b4495e103e60bc..8acdc3286e3794f5e1e02cb745796bf5ebae228f 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc @@ -6,291 +6,288 @@ // CurvilinearParametersT.icc, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// -//Gaudi +// Gaudi #include "GaudiKernel/MsgStream.h" -//Trk +// Trk #include "TrkEventPrimitives/ParamDefs.h" -namespace Trk -{ +namespace Trk { // Constructor with TP arguments - template <int DIM,class T,class S> - Trk::CurvilinearParametersT<DIM,T,S>::CurvilinearParametersT(const AmgVector(DIM+2)& parameters, - AmgSymMatrix(DIM)* covariance, - unsigned int cIdentifier): - ParametersT<DIM,T,S>(Amg::Vector3D(parameters[x],parameters[y],parameters[z]), - Amg::Vector3D(parameters[3],parameters[4],parameters[5]), - covariance), - m_cIdentifier(cIdentifier) - { - - // flip the charge according to qOverP - if (parameters[6] < 0.) { this->m_chargeDef.setCharge(-1);} - // assign the parameters - this->m_parameters[locX] = 0.; - this->m_parameters[locY] = 0.; - // get phi & theta from the momentum vector - this->m_parameters[phi] = this->momentum().phi(); - this->m_parameters[theta] = this->momentum().theta(); - this->m_parameters[qOverP] = parameters[6]/this->momentum().mag(); - - /* we need all the above to be there for the surfac*/ - this->m_surface.reset(new S(this->m_position,curvilinearFrame())); +template<int DIM, class T, class S> +Trk::CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( + const AmgVector(DIM + 2) & parameters, + AmgSymMatrix(DIM) * covariance, + unsigned int cIdentifier) + : ParametersBase<DIM, T>( + Amg::Vector3D(parameters[x], parameters[y], parameters[z]), + Amg::Vector3D(parameters[3], parameters[4], parameters[5]), + covariance) + , m_surface{ nullptr } + , m_cIdentifier(cIdentifier) +{ + + // flip the charge according to qOverP + if (parameters[6] < 0.) { + this->m_chargeDef.setCharge(-1); } - - // Constructor with TP arguments - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>::CurvilinearParametersT(const Amg::Vector3D& pos, - double tphi, - double ttheta, - double tqOverP, - AmgSymMatrix(DIM)* cov, - unsigned int cIdentifier): - ParametersT<DIM,T,S>(), - m_cIdentifier(cIdentifier) - { - this->m_covariance.reset(cov); - this->m_position=pos; - // flip the charge according to qOverP - if(tqOverP < 0.) { - this->m_chargeDef.setCharge(-1.); - } else { - this->m_chargeDef.setCharge(1.); - } - - // assign the parameters - this->m_parameters[Trk::locX] = 0.; - this->m_parameters[Trk::locY] = 0.; - this->m_parameters[Trk::phi] = tphi; - this->m_parameters[Trk::theta] = ttheta; - this->m_parameters[Trk::qOverP] = tqOverP; - - // make sure that the position & momentum are calculated - double p = fabs(1./tqOverP); - this->m_momentum = Amg::Vector3D(p*cos(tphi)*sin(ttheta),p*sin(tphi)*sin(ttheta),p*cos(ttheta)); - - /* we need all the above for the surface*/ - this->m_surface.reset(new S(this->m_position,curvilinearFrame())); + // assign the parameters + this->m_parameters[locX] = 0.; + this->m_parameters[locY] = 0.; + // get phi & theta from the momentum vector + this->m_parameters[phi] = this->momentum().phi(); + this->m_parameters[theta] = this->momentum().theta(); + this->m_parameters[qOverP] = parameters[6] / this->momentum().mag(); + + /* we need all the above to be there for the surfac*/ + this->m_surface.reset(new S(this->m_position, curvilinearFrame())); +} + +// Constructor with TP arguments +template<int DIM, class T, class S> +CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( + const Amg::Vector3D& pos, + double tphi, + double ttheta, + double tqOverP, + AmgSymMatrix(DIM) * cov, + unsigned int cIdentifier) + : ParametersBase<DIM, T>() + , m_surface{ nullptr } + , m_cIdentifier(cIdentifier) +{ + this->m_covariance.reset(cov); + this->m_position = pos; + // flip the charge according to qOverP + if (tqOverP < 0.) { + this->m_chargeDef.setCharge(-1.); + } else { + this->m_chargeDef.setCharge(1.); } - // full global constructor - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>::CurvilinearParametersT(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - double charge, - AmgSymMatrix(DIM)* cov, - unsigned int cIdentifier) : - ParametersT<DIM,T,S>(), - m_cIdentifier(cIdentifier) - { - this->m_chargeDef.setCharge(charge); - this->m_covariance.reset(cov); - - // assign the parameters - this->m_parameters[Trk::locX] = 0.; - this->m_parameters[Trk::locY] = 0.; - this->m_parameters[Trk::phi] = mom.phi(); - this->m_parameters[Trk::theta] = mom.theta(); - - if(charge == 0.) { - charge = 1.; // such that below is 1./mom.mag() - } - - this->m_parameters[Trk::qOverP] = charge/mom.mag(); - this->m_position = pos; - this->m_momentum = mom; - - /* we need all the above to be there for the surfac*/ - this->m_surface.reset(new S(this->m_position,curvilinearFrame())); + // assign the parameters + this->m_parameters[Trk::locX] = 0.; + this->m_parameters[Trk::locY] = 0.; + this->m_parameters[Trk::phi] = tphi; + this->m_parameters[Trk::theta] = ttheta; + this->m_parameters[Trk::qOverP] = tqOverP; + + // make sure that the position & momentum are calculated + double p = fabs(1. / tqOverP); + this->m_momentum = Amg::Vector3D( + p * cos(tphi) * sin(ttheta), p * sin(tphi) * sin(ttheta), p * cos(ttheta)); + + /* we need all the above for the surface*/ + this->m_surface.reset(new S(this->m_position, curvilinearFrame())); +} + +// full global constructor +template<int DIM, class T, class S> +CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( + const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + double charge, + AmgSymMatrix(DIM) * cov, + unsigned int cIdentifier) + : ParametersBase<DIM, T>() + , m_surface{ nullptr } + , m_cIdentifier(cIdentifier) +{ + this->m_chargeDef.setCharge(charge); + this->m_covariance.reset(cov); + + // assign the parameters + this->m_parameters[Trk::locX] = 0.; + this->m_parameters[Trk::locY] = 0.; + this->m_parameters[Trk::phi] = mom.phi(); + this->m_parameters[Trk::theta] = mom.theta(); + + if (charge == 0.) { + charge = 1.; // such that below is 1./mom.mag() } - // copy constructor - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>::CurvilinearParametersT(const CurvilinearParametersT<DIM,T,S>& copy): - ParametersT<DIM,T,S>(copy), - m_cIdentifier(copy.m_cIdentifier) - {} - - // move constructor - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>::CurvilinearParametersT(CurvilinearParametersT<DIM,T,S>&& copy): - ParametersT<DIM,T,S>(std::move(copy)), - m_cIdentifier(copy.m_cIdentifier) - { + this->m_parameters[Trk::qOverP] = charge / mom.mag(); + this->m_position = pos; + this->m_momentum = mom; + + //we need all the above to create the surface + this->m_surface.reset(new S(this->m_position, curvilinearFrame())); +} + +// Copy constructor +template<int DIM, class T, class S> +CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( + const CurvilinearParametersT<DIM, T, S>& rhs) + : ParametersBase<DIM, T>(rhs.parameters(), + nullptr, + rhs.position(), + rhs.momentum(), + rhs.charge()) + , m_surface(nullptr) + , m_cIdentifier(rhs.m_cIdentifier) +{ + m_surface.reset((rhs.m_surface && rhs.m_surface->isFree() + ? rhs.m_surface->clone() + : rhs.m_surface.get())); + if (rhs.covariance()) { + m_covariance = std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()); } - - // Assignment operator - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>& CurvilinearParametersT<DIM,T,S>::operator=(const CurvilinearParametersT<DIM,T,S>& rhs) - { - if(this != &rhs) - { - ParametersT<DIM,T,S>::operator=(rhs); - // and the curvilinear identifier - m_cIdentifier = rhs.m_cIdentifier; - } - - return *this; +} + +// assignment operator +template<int DIM, class T, class S> +CurvilinearParametersT<DIM, T, S>& +CurvilinearParametersT<DIM, T, S>::operator=( + const CurvilinearParametersT<DIM, T, S>& rhs) +{ + if (this != &rhs) { + m_parameters = rhs.m_parameters; + m_covariance = rhs.covariance() + ? std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()) + : nullptr; + m_position = rhs.position(); + m_momentum = rhs.momentum(); + m_surface.reset((rhs.m_surface && rhs.m_surface->isFree()) + ? rhs.m_surface->clone() + : rhs.m_surface.get()); + m_chargeDef = rhs.m_chargeDef; + m_cIdentifier = rhs.m_cIdentifier; } + return *this; +} - // Move assignment operator - template<int DIM,class T,class S> - CurvilinearParametersT<DIM,T,S>& CurvilinearParametersT<DIM,T,S>::operator=(CurvilinearParametersT<DIM,T,S>&& rhs) - { - if(this != &rhs) - { - ParametersT<DIM,T,S>::operator=(std::move(rhs)); - // and the curvilinear identifier - m_cIdentifier = std::move(rhs.m_cIdentifier); - } - - return *this; +// equality operator +template<int DIM, class T, class S> +bool +CurvilinearParametersT<DIM, T, S>::operator==( + const ParametersBase<DIM, T>& rhs) const +{ + // tolerance for comparing matrices + constexpr double tolerance = 1e-8; + + // make sure we compare objects of same type + decltype(this) pCasted = dynamic_cast<decltype(this)>(&rhs); + if (!pCasted) { + return false; } - // equality operator - template<int DIM,class T,class S> - bool CurvilinearParametersT<DIM,T,S>::operator==(const ParametersBase<DIM,T>& rhs) const - { - // tolerance for comparing matrices/vector - static const double& tolerance = 1e-8; - - // make sure we compare objects of same type - decltype(this) pCasted = dynamic_cast<decltype(this)>(&rhs); - if(!pCasted) { - return false; - } - - // comparison to myself? - if(pCasted == this) { - return true; - } - - // compare identifier - if(cIdentifier() != pCasted->cIdentifier()) { - return false; - } - - // compare UVT frame - CurvilinearUVT local_curvilinearFrame=curvilinearFrame(); - CurvilinearUVT casted_curvilinearFrame=pCasted->curvilinearFrame(); - if(!local_curvilinearFrame.curvU().isApprox(casted_curvilinearFrame.curvU(),tolerance)) { - return false; - } - if(!local_curvilinearFrame.curvV().isApprox(casted_curvilinearFrame.curvV(),tolerance)) { - return false; - } - if(!local_curvilinearFrame.curvT().isApprox(casted_curvilinearFrame.curvT(),tolerance)) { - return false; - } - // compare equality of base class parts - return ParametersT<DIM,T,S>::operator==(rhs); + // comparison to myself? + if (pCasted == this) { + return true; } - - // Screen output dump - template<int DIM,class T,class S> - MsgStream& CurvilinearParametersT<DIM,T,S>::dump(MsgStream& out) const - { - out << "CurvilinearParametersT parameters:" << std::endl; - ParametersT<DIM,T,S>::dump(out); - - return out; + + // compare identifier + if (cIdentifier() != pCasted->cIdentifier()) { + return false; } - // Screen output dump - template<int DIM,class T,class S> - std::ostream& CurvilinearParametersT<DIM,T,S>::dump(std::ostream& out) const - { - out << "CurvilinearParametersT parameters:" << std::endl; - ParametersT<DIM,T,S>::dump(out); - - return out; + // compare UVT frame + CurvilinearUVT local_curvilinearFrame = curvilinearFrame(); + CurvilinearUVT casted_curvilinearFrame = pCasted->curvilinearFrame(); + if (!local_curvilinearFrame.curvU().isApprox(casted_curvilinearFrame.curvU(), + tolerance)) { + return false; + } + if (!local_curvilinearFrame.curvV().isApprox(casted_curvilinearFrame.curvV(), + tolerance)) { + return false; + } + if (!local_curvilinearFrame.curvT().isApprox(casted_curvilinearFrame.curvT(), + tolerance)) { + return false; + } + // compare surfaces + if (associatedSurface() != pCasted->associatedSurface()) { + return false; } + // return compatibility of base class parts + return ParametersBase<DIM, T>::operator==(rhs); +} - // Surface return (with on demand construction) - template <int DIM,class T,class S> - Amg::RotationMatrix3D CurvilinearParametersT<DIM,T,S>::measurementFrame() const - { - Amg::RotationMatrix3D mFrame; - // the columnes - CurvilinearUVT local_curvilinearFrame=curvilinearFrame(); - mFrame.col(0) = local_curvilinearFrame.curvU(); - mFrame.col(1) = local_curvilinearFrame.curvV(); - mFrame.col(2) = local_curvilinearFrame.curvT(); +// Screen output dump +template<int DIM, class T, class S> +MsgStream& +CurvilinearParametersT<DIM, T, S>::dump(MsgStream& out) const +{ + out << "CurvilinearParametersT parameters:" << std::endl; + ParametersBase<DIM, T>::dump(out); - // return the rotation matrix that defines the curvilinear parameters - return mFrame; - } + return out; +} - template<int DIM,class T,class S> - CurvilinearUVT CurvilinearParametersT<DIM,T,S>::curvilinearFrame() const - { - CurvilinearUVT curvilinFrame(this->momentum().unit()); - return curvilinFrame; - } +// Screen output dump +template<int DIM, class T, class S> +std::ostream& +CurvilinearParametersT<DIM, T, S>::dump(std::ostream& out) const +{ + out << "CurvilinearParametersT parameters:" << std::endl; + ParametersBase<DIM, T>::dump(out); - // private updateParametersHelper - template<int DIM, class T, class S> - void Trk::CurvilinearParametersT<DIM, T, S>::updateParametersHelper(const AmgVector(DIM) & updatedParameters) - { - // valid to use != here, because value is either copied or modified, - bool updateMomentum = (updatedParameters[Trk::phi] != this->m_parameters[Trk::phi]) || - (updatedParameters[Trk::theta] != this->m_parameters[Trk::theta]) || - (updatedParameters[Trk::qOverP] != this->m_parameters[Trk::qOverP]); - - // momentum update is needed - if (updateMomentum) { - double phi = updatedParameters[Trk::phi]; - double theta = updatedParameters[Trk::theta]; - double p = fabs(1. / updatedParameters[Trk::qOverP]); - this->m_chargeDef.setCharge(sgn(updatedParameters[Trk::qOverP])); - // assign them and update the momentum 3 vector - this->m_parameters[Trk::phi] = phi; - this->m_parameters[Trk::theta] = theta; - this->m_parameters[Trk::qOverP] = updatedParameters[Trk::qOverP]; - this->m_momentum = Amg::Vector3D(p * cos(phi) * sin(theta), p * sin(phi) * sin(theta), p * cos(theta)); - } - - // position update if needed - loc1 - if (updatedParameters[Trk::loc1] != 0.) { - this->m_position += updatedParameters[Trk::loc1] * curvilinearFrame().curvU(); - } - // position update if needed - loc2 - if (updatedParameters[Trk::loc2] != 0.) { - this->m_position += updatedParameters[Trk::loc2] * curvilinearFrame().curvV(); - } - // Reset also the surface - this->m_surface.reset(new S(this->m_position, curvilinearFrame())); - } + return out; +} + +// Surface return (with on demand construction) +template<int DIM, class T, class S> +Amg::RotationMatrix3D +CurvilinearParametersT<DIM, T, S>::measurementFrame() const +{ + Amg::RotationMatrix3D mFrame; + // the columnes + CurvilinearUVT local_curvilinearFrame = curvilinearFrame(); + mFrame.col(0) = local_curvilinearFrame.curvU(); + mFrame.col(1) = local_curvilinearFrame.curvV(); + mFrame.col(2) = local_curvilinearFrame.curvT(); - // Dedicated update method - template <int DIM,class T,class S> - void Trk::CurvilinearParametersT<DIM,T,S>::updateParameters(const AmgVector(DIM)& updatedParameters, - AmgSymMatrix(DIM)* updatedCovariance) - { - this->updateParametersHelper(updatedParameters); - // update the covariance - if (updatedCovariance) - { - //check if someone passed what we owm - if (updatedCovariance != this->m_covariance.get()){ - this->m_covariance.reset(updatedCovariance); - } - } + // return the rotation matrix that defines the curvilinear parameters + return mFrame; +} + +template<int DIM, class T, class S> +CurvilinearUVT +CurvilinearParametersT<DIM, T, S>::curvilinearFrame() const +{ + CurvilinearUVT curvilinFrame(this->momentum().unit()); + return curvilinFrame; +} + +// private updateParametersHelper +template<int DIM, class T, class S> +void +Trk::CurvilinearParametersT<DIM, T, S>::updateParametersHelper( + const AmgVector(DIM) & updatedParameters) +{ + // valid to use != here, because value is either copied or modified, + bool updateMomentum = + (updatedParameters[Trk::phi] != this->m_parameters[Trk::phi]) || + (updatedParameters[Trk::theta] != this->m_parameters[Trk::theta]) || + (updatedParameters[Trk::qOverP] != this->m_parameters[Trk::qOverP]); + + // momentum update is needed + if (updateMomentum) { + double phi = updatedParameters[Trk::phi]; + double theta = updatedParameters[Trk::theta]; + double p = fabs(1. / updatedParameters[Trk::qOverP]); + this->m_chargeDef.setCharge(sgn(updatedParameters[Trk::qOverP])); + // assign them and update the momentum 3 vector + this->m_parameters[Trk::phi] = phi; + this->m_parameters[Trk::theta] = theta; + this->m_parameters[Trk::qOverP] = updatedParameters[Trk::qOverP]; + this->m_momentum = Amg::Vector3D( + p * cos(phi) * sin(theta), p * sin(phi) * sin(theta), p * cos(theta)); } - // Dedicated update method - template <int DIM,class T,class S> - void Trk::CurvilinearParametersT<DIM,T,S>::updateParameters(const AmgVector(DIM)& updatedParameters, - const AmgSymMatrix(DIM)& updatedCovariance) - { - this->updateParametersHelper(updatedParameters); - // if the covariance is there update in place - if (this->m_covariance) { - (*(this->m_covariance)) = updatedCovariance; - } else { // otherwise create one - this->m_covariance = std::make_unique<AmgSymMatrix(DIM)>(updatedCovariance); - } + // position update if needed - loc1 + if (updatedParameters[Trk::loc1] != 0.) { + this->m_position += + updatedParameters[Trk::loc1] * curvilinearFrame().curvU(); + } + // position update if needed - loc2 + if (updatedParameters[Trk::loc2] != 0.) { + this->m_position += + updatedParameters[Trk::loc2] * curvilinearFrame().curvV(); } + // Reset also the surface + this->m_surface.reset(new S(this->m_position, curvilinearFrame())); +} } // end of namespace Trk diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Neutral.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Neutral.h index e72007d7111ca956c26ee8a350d6d1f1a1385e09..1c2ec6e8baf910eb1e4aa9354d6185c080dd4637 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Neutral.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/Neutral.h @@ -25,7 +25,7 @@ namespace Trk { public: /** Default constructor */ - Neutral() {} + Neutral() = default; /** Default constructor with dummy parameter */ Neutral(const double&) {} @@ -37,8 +37,8 @@ namespace Trk Neutral(Neutral&&) = default; /** Default destructor */ - ~Neutral() {} - + ~Neutral() = default; + /** Assignment operator */ Neutral& operator=(const Neutral&) = default; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h index f894892a96aedd644d0659ff2df3012156908f5a..904840d59163a2621d1cd61f534aa3c75a5453bd 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h @@ -16,6 +16,15 @@ class MsgStream; +template<typename T> +class TrackParametersCovarianceCnv; +class TrackParametersCnv_p2; +class MeasuredPerigeeCnv_p1; +template< class SURFACE_CNV, class ATA_SURFACE > +class AtaSurfaceCnv_p1; + + + namespace Trk { class Surface; @@ -34,6 +43,11 @@ namespace Trk Curvilinear = 1 }; + namespace InvalidParam{ + constexpr double INVALID = std::numeric_limits<double>::quiet_NaN(); + constexpr double INVALID_P(10e9); + constexpr double INVALID_QOP(10e-9); + } /** @class ParametersBase @@ -47,6 +61,7 @@ namespace Trk @tparam T charge of track (either <tt>Trk::Charged</tt> or <tt>Trk::Neutral</tt>) @author Andreas.Salzburger@cern.ch + @author Christos Anastopoulos (Athena MT modifications) */ template <int DIM,class T> @@ -59,9 +74,7 @@ namespace Trk */ /** virtual Destructor */ virtual ~ParametersBase()=default; - //** equality operator */ - virtual bool operator==(const ParametersBase<DIM,T>&) const = 0; - + /** Access method for the parameters */ const AmgVector(DIM)& parameters() const; @@ -82,16 +95,35 @@ namespace Trk /** Returns charge of concrete type (i.e. must be implemented in inheriting classes) */ double charge() const; - - /** Access method for the local coordinates, \f$(loc1,loc2)\f$ - local parameter definitions differ for each surface type. */ + + /** Access method for the local coordinates, \f$(loc1,loc2)\f$ + local parameter definitions differ for each surface type. */ Amg::Vector2D localPosition() const; - + + /** Update parameters and covariance. + * Uses NVI: Derived classes can override the + * implementation via updateParametersHelper + */ + void updateParameters(const AmgVector(DIM)&, AmgSymMatrix(DIM)* = nullptr); + + /** Update parameters and covariance , passing covariance by ref. A + * covariance is created if one does not exist. Otherwise in place update + * occurs via assignment. + * Uses NVI: Derived classes can override the + * implementation via updateParametersHelper + */ + void updateParameters(const AmgVector(DIM)&, const AmgSymMatrix(DIM)&); + + //** equality operator */ + virtual bool operator==(const ParametersBase<DIM,T>&) const; + /** Access to the Surface method */ virtual const Surface& associatedSurface() const = 0; - - /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface - - the default implementation is the the RotationMatrix3D of the transform */ + + /** Return the measurement frame - this is needed for alignment, in + particular for StraightLine and Perigee Surface + - the default implementation is the RotationMatrix3D of the + transform */ virtual Amg::RotationMatrix3D measurementFrame() const = 0; /** Pseudo constructor - avoids excessive type-casting. @@ -104,42 +136,44 @@ namespace Trk /** Test to see if there's a surface there. */ virtual bool hasSurface() const = 0 ; - /** Update parameters and covariance */ - virtual void updateParameters(const AmgVector(DIM)&, AmgSymMatrix(DIM)* = nullptr) = 0; - - /** Update parameters and covariance , passing covariance by ref. A covariance - * is created if one does not exist. Otherwise in place update occurs*/ - virtual void updateParameters(const AmgVector(DIM)&, const AmgSymMatrix(DIM)&) = 0; - /** Dumps relevant information about the track parameters into the ostream */ virtual MsgStream& dump(MsgStream& out) const; virtual std::ostream& dump(std::ostream& out) const; - /** DESIGN TO BE REVISITED */ - friend class MaterialEffectsEngine; - - protected : + protected : /* - * This has pure virtual functions - * so it is abstract class and we can not instanticate objects directly. + * This is an abstract class and we can not instanticate objects directly. * In the other hand derived classed can use ctors */ + ParametersBase()=default; + + /* Helper ctors for derived classes*/ ParametersBase(const AmgVector(DIM) parameters, AmgSymMatrix(DIM)* covariance, const Amg::Vector3D& position, const Amg::Vector3D& momentum, const T chargeDef); + + ParametersBase(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + AmgSymMatrix(DIM) * covariance = nullptr); + + ParametersBase(const AmgVector(DIM) & parameters, + AmgSymMatrix(DIM) * covariance = nullptr); + ParametersBase(ParametersBase&&)=default; ParametersBase& operator=(ParametersBase&&)=default; - + /* Helper to factor in update of parameters*/ + virtual void updateParametersHelper(const AmgVector(DIM) &) = 0; AmgVector(DIM) m_parameters; //!< contains the n parameters std::unique_ptr<AmgSymMatrix(DIM)> m_covariance; //!< contains the n x n covariance matrix Amg::Vector3D m_position; //!< point on track Amg::Vector3D m_momentum; //!< momentum at this point on track T m_chargeDef; //!< charge definition for this track + }; /**Overload of << operator for both, MsgStream and std::ostream for debug output*/ diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.icc index 0131e15552cb9808f3860571829d6a4eb45132b5..2bff34e886ff6118cca242ece47b482cdf6929e4 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.icc @@ -16,6 +16,8 @@ namespace Trk { + +//Helper protected ctor*/ template<int DIM, class T> ParametersBase<DIM, T>::ParametersBase( const AmgVector(DIM) parameters, @@ -30,6 +32,46 @@ ParametersBase<DIM, T>::ParametersBase( , m_chargeDef(chargeDef) {} +//Helper protected ctor +template<int DIM, class T > +Trk::ParametersBase<DIM, T>::ParametersBase(const Amg::Vector3D& position, + const Amg::Vector3D& momentum, + AmgSymMatrix(DIM) * covariance) + : m_parameters() + , m_covariance(covariance) + , m_position(position) + , m_momentum(momentum) + , m_chargeDef{} +{} +// Protected Constructor with local arguments - persistency only +template<int DIM, class T> +Trk::ParametersBase<DIM, T>::ParametersBase(const AmgVector(DIM) & parameters, + AmgSymMatrix(DIM) * covariance) + : m_parameters(parameters) + , m_covariance(covariance) + , m_position{} + , m_momentum{} + , m_chargeDef{} +{ + float qop = m_parameters[Trk::qOverP]; + // decide the sign of the charge + if (qop < 0.) { + m_chargeDef.setCharge(-1); + } + double p = 0.0; + if (qop != 0.) { + p = fabs(1. / qop); + } else { + // qop is unphysical. No momentum measurement. + p = InvalidParam::INVALID_P; + qop = InvalidParam::INVALID_QOP; + } + // fill momentum & then position using the surface + m_momentum = Amg::Vector3D( + p * cos(m_parameters[Trk::phi]) * sin(m_parameters[Trk::theta]), + p * sin(m_parameters[Trk::phi]) * sin(m_parameters[Trk::theta]), + p * cos(m_parameters[Trk::theta])); +} template<int DIM, class T> const AmgVector(DIM) & @@ -87,6 +129,75 @@ ParametersBase<DIM, T>::localPosition() const return Amg::Vector2D(parameters()[Trk::loc1], parameters()[Trk::loc2]); } +template<int DIM, class T> +void +ParametersBase<DIM, T>::updateParameters(const AmgVector(DIM) & updatedParameters, + AmgSymMatrix(DIM) * updatedCovariance) +{ + // update the covariance + if (updatedCovariance) { + // make sure we did not receive what we already hold + if (updatedCovariance != m_covariance.get()) { + m_covariance.reset(updatedCovariance); + } + } + this->updateParametersHelper(updatedParameters); +} + +// update function +template<int DIM, class T> +void +ParametersBase<DIM, T>::updateParameters(const AmgVector(DIM) & updatedParameters, + const AmgSymMatrix(DIM) & updatedCovariance) +{ + // if the covariance is there update in place + if (m_covariance) { + (*m_covariance) = updatedCovariance; + } else { // otherwise create one + m_covariance = std::make_unique<AmgSymMatrix(DIM)>(updatedCovariance); + } + this->updateParametersHelper(updatedParameters); +} +/** equality operator */ +template<int DIM, class T> +bool +ParametersBase<DIM, T>::operator==(const ParametersBase<DIM, T>& rhs) const +{ + // tolerance for comparisons + constexpr double tolerance = 1e-8; + + // compare parameters + if (!this->parameters().isApprox(rhs.parameters(), tolerance)) { + return false; + } + + // compare covariance + if (((this->covariance() != nullptr) && (rhs.covariance() != nullptr) && + !this->covariance()->isApprox(*rhs.covariance(), tolerance)) || + (!this->covariance() != + !rhs.covariance())) { // <-- this is: covariance() XOR + // pCast->covariance() + return false; + } + + // compare position + if (!this->position().isApprox(rhs.position(), tolerance)) { + return false; + } + + // compare momentum + if (!this->momentum().isApprox(rhs.momentum(), tolerance)) { + return false; + } + + // compare charge definition + if (m_chargeDef != rhs.m_chargeDef) { + return false; + } + + return true; +} + template<int DIM, class T> MsgStream& ParametersBase<DIM, T>::dump(MsgStream& sl) const diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h index f2cddeed4375438638d2146f4ad5fc88d67fceaa..db70d8e903ecd0e53c941371cf779e0d769c3679 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h @@ -15,12 +15,11 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" #include "TrkParametersBase/SurfaceUniquePtrT.h" -template<typename T> -class TrackParametersCovarianceCnv; -class TrackParametersCnv_p2; -class MeasuredPerigeeCnv_p1; -template< class SURFACE_CNV, class ATA_SURFACE > -class AtaSurfaceCnv_p1; + +/* + * Needed for persistency + * friends + */ namespace Trk { @@ -47,15 +46,16 @@ namespace Trk @tparam S type of surface @author edward.moyse@cern.ch, andreas.salzburger@cern.ch + @author Christos Anastopoulos (Athena MT modifications) */ template<int DIM,class T,class S> class ParametersT : public ParametersBase<DIM,T> { public: /** - * default constructor ONLY for POOL and derived classes + * default constructor ONLY for POOL */ - ParametersT(); + ParametersT() = default; /** Constructor with local arguments - uses global <-> local for parameters */ ParametersT(double loc1, @@ -69,7 +69,7 @@ namespace Trk /** Constructor with parameters - extract position and momentum */ ParametersT(const AmgVector(DIM)& parameters, const S& surface, - AmgSymMatrix(DIM)* covariance = 0); + AmgSymMatrix(DIM)* covariance = nullptr); /** Constructor with global arguments - uses global <-> local for parameters */ ParametersT(const Amg::Vector3D& position, @@ -85,17 +85,17 @@ namespace Trk AmgSymMatrix(DIM)* covariance = nullptr); /** Copy constructor */ - ParametersT(const ParametersT<DIM,T,S>& rhs); - + ParametersT(const ParametersT<DIM, T, S>& rhs); + /** Move constructor */ - ParametersT(ParametersT<DIM,T,S>&& rhs); - + ParametersT(ParametersT<DIM, T, S>&& rhs) = default; + /** Assignment operator */ - ParametersT<DIM,T,S>& operator=(const ParametersT<DIM,T,S>& rhs); + ParametersT<DIM, T, S>& operator=(const ParametersT<DIM, T, S>& rhs); /** Move assignment operator */ - ParametersT<DIM,T,S>& operator=(ParametersT<DIM,T,S>&& rhs); - + ParametersT<DIM, T, S>& operator=(ParametersT<DIM, T, S>&& rhs) = default; + //** Destructor */ virtual ~ParametersT()=default; @@ -106,29 +106,29 @@ namespace Trk virtual const S& associatedSurface() const override final {return *m_surface;} /** equality operator */ - virtual bool operator==(const ParametersBase<DIM,T>& rhs) const override; + virtual bool operator==(const ParametersBase<DIM,T>& rhs) const override final; /** Virtual clone */ - virtual ParametersT<DIM,T,S>* clone() const override {return new ParametersT<DIM,T,S>(*this);} + virtual ParametersT<DIM, T, S>* clone() const override final + { + return new ParametersT<DIM, T, S>(*this); + } /** Return the ParametersType enum */ - virtual ParametersType type() const override {return Trk::AtaSurface;} + virtual ParametersType type() const override final + { + return Trk::AtaSurface; + } /** Return the measurementFrame of the parameters */ - virtual Amg::RotationMatrix3D measurementFrame() const override; - - /** Update parameters and covariance */ - virtual void updateParameters(const AmgVector(DIM)&, AmgSymMatrix(DIM)* = nullptr) override; - - /** Update parameters and covariance , passing covariance by ref. A covariance - * is created if one does not exist. Otherwise in place update occurs*/ - virtual void updateParameters(const AmgVector(DIM)&, const AmgSymMatrix(DIM)&) override; + virtual Amg::RotationMatrix3D measurementFrame() const override final; private : /* Helper to factor in update of parameters*/ - void updateParametersHelper(const AmgVector(DIM)&); + virtual void updateParametersHelper(const AmgVector(DIM)&) override final; protected: + /* * Add dependent names into scope */ @@ -138,26 +138,24 @@ namespace Trk using ParametersBase<DIM,T>::m_momentum; using ParametersBase<DIM,T>::m_chargeDef; SurfaceUniquePtrT<const S> m_surface; //!< surface template - - protected: + + /** + * @brief Constructor for persistency + */ + ParametersT (const AmgVector(DIM)& parameters, + const S* surface, + AmgSymMatrix(DIM)* covariance = nullptr); + /* + * friends needed for Persistency + */ template<typename pars> friend class ::TrackParametersCovarianceCnv; friend class ::TrackParametersCnv_p2; friend class ::MeasuredPerigeeCnv_p1; template <class SURFACE_CNV, class ATA_SURFACE> friend class ::AtaSurfaceCnv_p1; - - /** --- Protected constructors : for persistency purpose only */ - ParametersT (const AmgVector(DIM)& parameters, - const S* surface, - AmgSymMatrix(DIM)* covariance = 0); - - ParametersT (const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - AmgSymMatrix(DIM)* covariance = 0); /** DESIGN TO BE REVISITED */ - protected: friend class MaterialEffectsEngine; }; } //end of namespace Trk diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc index 50a2b9ba6d65c1f044e0b1f2e8ee122cd816cacf..9c6cb0e145b1f2865739b62054b854a5c10ec7eb 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc @@ -12,14 +12,9 @@ // Trk #include "TrkEventPrimitives/ParamDefs.h" -namespace Trk -{ +namespace Trk { namespace { -static constexpr double INVALID = std::numeric_limits<double>::quiet_NaN(); -static constexpr double INVALID_P(10e9); -static constexpr double INVALID_QOP(10e-9); - template<typename T> int sgn(const T& val) @@ -28,7 +23,7 @@ sgn(const T& val) } } - // Constructor with local arguments - uses global <-> local for parameters +// Constructor with local arguments - uses global <-> local for parameters template<int DIM, class T, class S> ParametersT<DIM, T, S>::ParametersT(double loc1, double loc2, @@ -37,11 +32,7 @@ ParametersT<DIM, T, S>::ParametersT(double loc1, double qop, const S& surface, AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>({}, - cov, - {}, - {}, - sgn(qop)) + : ParametersBase<DIM, T>({}, cov, {}, {}, sgn(qop)) , m_surface(nullptr) { m_surface.reset((surface.isFree() ? surface.clone() : &surface)); @@ -51,8 +42,8 @@ ParametersT<DIM, T, S>::ParametersT(double loc1, p = fabs(1. / qop); } else { // qop is unphysical. No momentum measurement. - p = INVALID_P; - qop = INVALID_QOP; + p = InvalidParam::INVALID_P; + qop = InvalidParam::INVALID_QOP; } // fill the parameters @@ -63,373 +54,243 @@ ParametersT<DIM, T, S>::ParametersT(double loc1, m_momentum = Amg::Vector3D( p * cos(phi) * sin(theta), p * sin(phi) * sin(theta), p * cos(theta)); - m_surface->localToGlobal( - this->localPosition(), m_momentum, m_position); - } + m_surface->localToGlobal(this->localPosition(), m_momentum, m_position); +} - // Constructor with local arguments - uses global <-> local for parameters - template<int DIM, class T, class S> - ParametersT<DIM, T, S>::ParametersT(const AmgVector(DIM) & parameters, - const S& surface, - AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>(parameters, - cov, - {}, - {}, - sgn(parameters[Trk::qOverP])) - , m_surface(nullptr) - { - m_surface.reset((surface.isFree() ? surface.clone() : &surface)); - // decide the sign of the charge - double qop = m_parameters[Trk::qOverP]; - - // check qoverp is physical - double p = 0.; - if(qop != 0.) { - p = fabs(1./qop); - } else - { - // qop is unphysical. No momentum measurement. - p = INVALID_P; - qop = INVALID_QOP; - } - - // fill momentum & then position using the surface - m_momentum = Amg::Vector3D(p*cos(m_parameters[Trk::phi])*sin(m_parameters[Trk::theta]), - p*sin(m_parameters[Trk::phi])*sin(m_parameters[Trk::theta]), - p*cos(m_parameters[Trk::theta])); +// Constructor with local arguments - uses global <-> local for parameters +template<int DIM, class T, class S> +ParametersT<DIM, T, S>::ParametersT(const AmgVector(DIM) & parameters, + const S& surface, + AmgSymMatrix(DIM) * cov) + : ParametersBase<DIM, T>(parameters, + cov, + {}, + {}, + sgn(parameters[Trk::qOverP])) + , m_surface(nullptr) +{ + m_surface.reset((surface.isFree() ? surface.clone() : &surface)); + // decide the sign of the charge + double qop = m_parameters[Trk::qOverP]; - m_surface->localToGlobal( - this->localPosition(), m_momentum, m_position); + // check qoverp is physical + double p = 0.; + if (qop != 0.) { + p = fabs(1. / qop); + } else { + // qop is unphysical. No momentum measurement. + p = InvalidParam::INVALID_P; + qop = InvalidParam::INVALID_QOP; } - - // Constructor with global arguments - uses global <-> local for parameters */ - template<int DIM, class T, class S> - ParametersT<DIM, T, S>::ParametersT(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - double charge, - const S& surface, - AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>({}, - cov, - pos, - mom, - charge) - , m_surface(surface.isFree() ? surface.clone() : &surface) - { - // m_chargeDef->setCharge(charge); - - // get the local parameters via the surface - Amg::Vector2D lPosition; - const bool ok = - m_surface->globalToLocal(this->position(), this->momentum(), lPosition); - if(not ok) { - lPosition = Amg::Vector2D (INVALID,INVALID); - } - // For a neutral particle, last parm should be 1/p rather than q/p. - double qopnum = this->charge(); - if (qopnum == 0) { qopnum = 1; + // fill momentum & then position using the surface + m_momentum = Amg::Vector3D( + p * cos(m_parameters[Trk::phi]) * sin(m_parameters[Trk::theta]), + p * sin(m_parameters[Trk::phi]) * sin(m_parameters[Trk::theta]), + p * cos(m_parameters[Trk::theta])); + + m_surface->localToGlobal(this->localPosition(), m_momentum, m_position); } - // fill the vector now - m_parameters << lPosition[Trk::loc1], lPosition[Trk::loc2], this->momentum().phi(), - this->momentum().theta(), qopnum/this->momentum().norm(); +// Constructor with global arguments - uses global <-> local for parameters */ +template<int DIM, class T, class S> +ParametersT<DIM, T, S>::ParametersT(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + double charge, + const S& surface, + AmgSymMatrix(DIM) * cov) + : ParametersBase<DIM, T>({}, cov, pos, mom, charge) + , m_surface(surface.isFree() ? surface.clone() : &surface) +{ + // get the local parameters via the surface + Amg::Vector2D lPosition; + const bool ok = + m_surface->globalToLocal(this->position(), this->momentum(), lPosition); + if (not ok) { + lPosition = Amg::Vector2D(InvalidParam::INVALID, InvalidParam::INVALID); } - // Constructor with mixed arguments 1 - uses global <-> local for parameters - template<int DIM, class T, class S> - Trk::ParametersT<DIM, T, S>::ParametersT(const Amg::Vector3D& pos, - double phi, - double theta, - double qop, - const S& surface, - AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>({}, - cov, - pos, - {}, - 1.) - , m_surface(surface.isFree() ? surface.clone() : &surface) - { - // decide the sign of the charge - if(qop<0.) { - m_chargeDef.setCharge(-1); - } - - // fill momentum & then position using the surface - double p=0.0; - if (qop!=0.) { - p = fabs(1./qop); - } else { - // qop is unphysical. No momentum measurement. - p = INVALID_P; - qop = INVALID_QOP; - } - m_momentum = Amg::Vector3D(p*cos(phi)*sin(theta), - p*sin(phi)*sin(theta), - p*cos(theta)); - - // get the local parameters via the surface - Amg::Vector2D lPosition; - const bool ok = - m_surface->globalToLocal(this->position(), this->momentum(), lPosition); - if (not ok) { - lPosition = Amg::Vector2D (INVALID,INVALID); - } - // fill the vector now - // cppcheck-suppress constStatement - m_parameters << lPosition[Trk::loc1], lPosition[Trk::loc2], phi, theta, qop; - } - - // Copy constructor - template<int DIM, class T, class S> - ParametersT<DIM, T, S>::ParametersT(const ParametersT<DIM, T, S>& rhs) - : ParametersBase<DIM, T>(rhs.parameters(), - nullptr, - rhs.position(), - rhs.momentum(), - rhs.charge()) - , m_surface(nullptr) - { - m_surface.reset((rhs.m_surface && rhs.m_surface->isFree() ? rhs.m_surface->clone() : rhs.m_surface.get())); - if(rhs.covariance()) { - m_covariance = std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()); - } + // For a neutral particle, last parm should be 1/p rather than q/p. + double qopnum = this->charge(); + if (qopnum == 0) { + qopnum = 1; } - // Move constructor - template<int DIM, class T, class S> - ParametersT<DIM, T, S>::ParametersT(ParametersT<DIM, T, S>&& rhs) - : ParametersBase<DIM, T>(std::move(rhs)) - , m_surface(std::move(rhs.m_surface)) - { - // False positive: - // cppcheck-suppress useInitializationList - } + // fill the vector now + m_parameters << lPosition[Trk::loc1], lPosition[Trk::loc2], + this->momentum().phi(), this->momentum().theta(), + qopnum / this->momentum().norm(); +} - // assignment operator - template<int DIM,class T,class S> - ParametersT<DIM,T,S>& ParametersT<DIM,T,S>::operator=(const ParametersT<DIM,T,S>& rhs) - { - if(this != &rhs) - { - m_parameters = rhs.m_parameters; - m_covariance = rhs.covariance() ? - std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()) - : nullptr; - m_position = rhs.position(); - m_momentum = rhs.momentum(); - m_surface.reset((rhs.m_surface && rhs.m_surface->isFree()) - ? rhs.m_surface->clone() - : rhs.m_surface.get()); - m_chargeDef = rhs.m_chargeDef; - } - return *this; +// Constructor with mixed arguments 1 - uses global <-> local for parameters +template<int DIM, class T, class S> +Trk::ParametersT<DIM, T, S>::ParametersT(const Amg::Vector3D& pos, + double phi, + double theta, + double qop, + const S& surface, + AmgSymMatrix(DIM) * cov) + : ParametersBase<DIM, T>({}, cov, pos, {}, 1.) + , m_surface(surface.isFree() ? surface.clone() : &surface) +{ + // decide the sign of the charge + if (qop < 0.) { + m_chargeDef.setCharge(-1); } - // Move assignment - template<int DIM,class T,class S> - ParametersT<DIM,T,S>& ParametersT<DIM,T,S>::operator=(ParametersT<DIM,T,S>&& rhs) - { - if(this != &rhs) - { - ParametersBase<DIM,T>::operator=(std::move(rhs)); - m_surface = std::move(rhs.m_surface); - } - return *this; + // fill momentum & then position using the surface + double p = 0.0; + if (qop != 0.) { + p = fabs(1. / qop); + } else { + // qop is unphysical. No momentum measurement. + p = InvalidParam::INVALID_P; + qop = InvalidParam::INVALID_QOP; } + m_momentum = Amg::Vector3D( + p * cos(phi) * sin(theta), p * sin(phi) * sin(theta), p * cos(theta)); - /** equality operator */ - template<int DIM,class T,class S> - bool ParametersT<DIM,T,S>::operator==(const ParametersBase<DIM,T>& rhs) const - { - // tolerance for comparing matrices - static const double& tolerance = 1e-8; - - // make sure we compare objects of same type - decltype(this) pCasted = dynamic_cast<decltype(this)>(&rhs); - if(!pCasted) { - return false; - } - - // comparison to myself? - if(pCasted == this) { - return true; - } - - // compare parameters - if (!this->parameters().isApprox(pCasted->parameters(), tolerance)) { - return false; - } - - // compare covariance - if (((this->covariance() != nullptr) && - (pCasted->covariance() != nullptr) && - !this->covariance()->isApprox(*pCasted->covariance(), tolerance)) || - (!this->covariance() != - !pCasted->covariance())) { // <-- this is: covariance() XOR - // pCast->covariance() - return false; - } - - // compare position - if (!this->position().isApprox(pCasted->position(), tolerance)) { - return false; - } - - // compare momentum - if (!this->momentum().isApprox(pCasted->momentum(), tolerance)) { - return false; - } - - // compare surfaces - if (associatedSurface() != pCasted->associatedSurface()) { - return false; - } - - // compare charge definition - if (m_chargeDef != pCasted->m_chargeDef) { - return false; - } - - // return compatibility of base class parts - return true; + // get the local parameters via the surface + Amg::Vector2D lPosition; + const bool ok = + m_surface->globalToLocal(this->position(), this->momentum(), lPosition); + if (not ok) { + lPosition = Amg::Vector2D(InvalidParam::INVALID, InvalidParam::INVALID); } + // fill the vector now + // cppcheck-suppress constStatement + m_parameters << lPosition[Trk::loc1], lPosition[Trk::loc2], phi, theta, qop; +} - // return the measurementFrame - template<int DIM,class T,class S> - Amg::RotationMatrix3D ParametersT<DIM,T,S>::measurementFrame() const - { - return associatedSurface().measurementFrame(this->position(), - this->momentum()); +// Copy constructor +template<int DIM, class T, class S> +ParametersT<DIM, T, S>::ParametersT(const ParametersT<DIM, T, S>& rhs) + : ParametersBase<DIM, T>(rhs.parameters(), + nullptr, + rhs.position(), + rhs.momentum(), + rhs.charge()) + , m_surface(nullptr) +{ + m_surface.reset((rhs.m_surface && rhs.m_surface->isFree() + ? rhs.m_surface->clone() + : rhs.m_surface.get())); + if (rhs.covariance()) { + m_covariance = std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()); } +} - // private updateParametersHelper - template<int DIM, class T, class S> - void ParametersT<DIM, T, S>::updateParametersHelper(const AmgVector(DIM)& updatedParameters) - { - // valid to use != here, because value is either copied or modified, - bool updatePosition = (updatedParameters[Trk::loc1] != m_parameters[Trk::loc1]) || - (updatedParameters[Trk::loc2] != m_parameters[Trk::loc2]); - - bool updateMomentum = (updatedParameters[Trk::phi] != m_parameters[Trk::phi]) || - (updatedParameters[Trk::theta] != m_parameters[Trk::theta]) || - (updatedParameters[qOverP] != m_parameters[qOverP]); - - // update the parameters vector - m_parameters = updatedParameters; +// assignment operator +template<int DIM, class T, class S> +ParametersT<DIM, T, S>& +ParametersT<DIM, T, S>::operator=(const ParametersT<DIM, T, S>& rhs) +{ + if (this != &rhs) { + m_parameters = rhs.m_parameters; + m_covariance = rhs.covariance() + ? std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()) + : nullptr; + m_position = rhs.position(); + m_momentum = rhs.momentum(); + m_surface.reset((rhs.m_surface && rhs.m_surface->isFree()) + ? rhs.m_surface->clone() + : rhs.m_surface.get()); + m_chargeDef = rhs.m_chargeDef; + } + return *this; +} - //position or momentum update needed - if (updatePosition){ - if(m_surface) { - m_surface->localToGlobal( - this->localPosition(), m_momentum, m_position); - } else{ - m_momentum.setZero(); - m_position.setZero(); - } - } - // momentum update is needed - if (updateMomentum) { - double phi = m_parameters[Trk::phi]; - double theta = m_parameters[Trk::theta]; - double p = INVALID_P; - if (m_parameters[Trk::qOverP] != 0) { - m_chargeDef = sgn(m_parameters[Trk::qOverP]); - p = fabs(1. / m_parameters[Trk::qOverP]); - } - double sinTheta = sin(theta); - m_momentum = Amg::Vector3D(p * cos(phi) * sinTheta, p * sin(phi) * sinTheta, p * cos(theta)); - } +/** equality operator */ +template<int DIM, class T, class S> +bool +ParametersT<DIM, T, S>::operator==(const ParametersBase<DIM, T>& rhs) const +{ + // make sure we compare objects of same type + decltype(this) pCasted = dynamic_cast<decltype(this)>(&rhs); + if (!pCasted) { + return false; } - // update function - template<int DIM, class T, class S> - void ParametersT<DIM, T, S>::updateParameters(const AmgVector(DIM) & updatedParameters, - AmgSymMatrix(DIM) * updatedCovariance) - { - this->updateParametersHelper(updatedParameters); - // update the covariance - if (updatedCovariance) { - //make sure we did not receive what we already hold - if (updatedCovariance != m_covariance.get()) { - m_covariance.reset(updatedCovariance); - } - } + // comparison to myself? + if (pCasted == this) { + return true; } - // update function - template<int DIM, class T, class S> - void ParametersT<DIM, T, S>::updateParameters(const AmgVector(DIM) & updatedParameters, - const AmgSymMatrix(DIM) & updatedCovariance) - { - this->updateParametersHelper(updatedParameters); - // if the covariance is there update in place - if (m_covariance) { - (*m_covariance) = updatedCovariance; - } else { // otherwise create one - m_covariance= std::make_unique<AmgSymMatrix(DIM)>(updatedCovariance); - } + // compare surfaces + if (associatedSurface() != pCasted->associatedSurface()) { + return false; } - // Default constructor only for POOL and derived classes - template<int DIM, class T, class S> - ParametersT<DIM, T, S>::ParametersT() - : ParametersBase<DIM, T>({}, nullptr, {}, {}, {}) - , m_surface(nullptr) - {} + // return compatibility of base class parts + return ParametersBase<DIM, T>::operator==(rhs); +} +// return the measurementFrame +template<int DIM, class T, class S> +Amg::RotationMatrix3D +ParametersT<DIM, T, S>::measurementFrame() const +{ + return associatedSurface().measurementFrame(this->position(), + this->momentum()); +} - //Protected C-tor used by the curvilinear parameters - template<int DIM, class T, class S> - Trk::ParametersT<DIM, T, S>::ParametersT(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>({}, - cov, - pos, - mom, - {}) - , m_surface(nullptr) - {} - - // Protected Constructor with local arguments - persistency only, ownership of surface given - template<int DIM, class T, class S> - Trk::ParametersT<DIM, T, S>::ParametersT(const AmgVector(DIM) & pars, - const S* surface, - AmgSymMatrix(DIM) * cov) - : ParametersBase<DIM, T>(pars, - cov, - {}, - {}, - {}) - , m_surface(surface) - { - float qop = m_parameters[Trk::qOverP]; - // decide the sign of the charge - if (qop<0.) { m_chargeDef.setCharge(-1);} +// private updateParametersHelper +template<int DIM, class T, class S> +void +ParametersT<DIM, T, S>::updateParametersHelper(const AmgVector(DIM) & + updatedParameters) +{ + // valid to use != here, because value is either copied or modified, + bool updatePosition = + (updatedParameters[Trk::loc1] != m_parameters[Trk::loc1]) || + (updatedParameters[Trk::loc2] != m_parameters[Trk::loc2]); - double p=0.0; - if (qop!=0.) { - p = fabs(1./qop); - } else { - // qop is unphysical. No momentum measurement. - p = INVALID_P; - qop = INVALID_QOP; - } - // fill momentum & then position using the surface - m_momentum = Amg::Vector3D(p*cos(m_parameters[Trk::phi])*sin(m_parameters[Trk::theta]), - p*sin(m_parameters[Trk::phi])*sin(m_parameters[Trk::theta]), - p*cos(m_parameters[Trk::theta])); + bool updateMomentum = + (updatedParameters[Trk::phi] != m_parameters[Trk::phi]) || + (updatedParameters[Trk::theta] != m_parameters[Trk::theta]) || + (updatedParameters[qOverP] != m_parameters[qOverP]); + + // update the parameters vector + m_parameters = updatedParameters; + + // position or momentum update needed + if (updatePosition) { if (m_surface) { - m_surface->localToGlobal( - this->localPosition(), m_momentum, m_position); + m_surface->localToGlobal(this->localPosition(), m_momentum, m_position); } else { m_momentum.setZero(); m_position.setZero(); } } - - + // momentum update is needed + if (updateMomentum) { + double phi = m_parameters[Trk::phi]; + double theta = m_parameters[Trk::theta]; + double p = InvalidParam::INVALID_P; + if (m_parameters[Trk::qOverP] != 0) { + m_chargeDef = sgn(m_parameters[Trk::qOverP]); + p = fabs(1. / m_parameters[Trk::qOverP]); + } + double sinTheta = sin(theta); + m_momentum = Amg::Vector3D( + p * cos(phi) * sinTheta, p * sin(phi) * sinTheta, p * cos(theta)); + } +} + +// Protected Constructor with local arguments - persistency only +template<int DIM, class T, class S> +Trk::ParametersT<DIM, T, S>::ParametersT(const AmgVector(DIM) & pars, + const S* surface, + AmgSymMatrix(DIM) * cov) + : ParametersBase<DIM, T>(pars, cov) + , m_surface(surface) +{ + if (m_surface) { + m_surface->localToGlobal(this->localPosition(), m_momentum, m_position); + } else { + m_momentum.setZero(); + m_position.setZero(); + } +} + } // end of namespace Trk diff --git a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h index 884f042cf7733e3636053f8c4b314e9e10baf9bc..1d5a84e70952d1cb1297d5f2d93f81646d1b5592 100755 --- a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h +++ b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h @@ -206,9 +206,9 @@ namespace Trk { if (m_originalTrack.isValid()){ return *m_originalTrack; - } else { - return nullptr; } + return nullptr; + } inline @@ -216,10 +216,10 @@ namespace Trk { if (m_elVxCandidate.isValid()) { return *m_elVxCandidate; - } else - { + } + return nullptr; - } + } inline const ElementLink<VxContainer>& TrackParticleBase::reconstructedVertexLink() const diff --git a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h index a94beb4c7747c234559878564bc2749738fedf6f..fecd3e6527923fb6e4974496be09631fdd88f4d7 100755 --- a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h +++ b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h @@ -331,8 +331,8 @@ namespace Trk { inline double PatternTrackParameters::charge () const { - if(m_parameters[4] > 0.) { return 1.; } else { return -1.; -} + if(m_parameters[4] > 0.) { return 1.; } return -1.; + } inline double PatternTrackParameters::sinPhi () const diff --git a/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h b/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h index fdd1e0aa5a5dce68ba54d11d27297895c4ae2bf1..ccb5a1e16e964e90cf13946f7584e395ae1eabaf 100755 --- a/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h +++ b/Tracking/TrkEvent/TrkRIO_OnTrack/TrkRIO_OnTrack/RIO_OnTrack.h @@ -48,6 +48,16 @@ namespace Trk { @author Andreas.Salzburger@cern.ch */ + namespace RIO_OnTrackType{ + enum Type{ + SiCluster=0, + TRT_DriftCircle=1, + MdtDriftCircle=2, + MuonCluster=3, + PlanarCluster=4 + }; + } + class RIO_OnTrack : public MeasurementBase { friend class ITrkEventCnvTool; @@ -87,6 +97,9 @@ namespace Trk { return (type==MeasurementBaseType::RIO_OnTrack); } + /** Method checking the Rio On Track type*/ + virtual bool rioType(RIO_OnTrackType::Type type) const = 0; + /**returns the some information about this RIO_OnTrack. */ virtual MsgStream& dump( MsgStream& out ) const override; diff --git a/Tracking/TrkEvent/TrkSegment/CMakeLists.txt b/Tracking/TrkEvent/TrkSegment/CMakeLists.txt index 19a4ee5d3ec97751d9345dbf9238b6f3cc41ae2a..afe0c1378e924ca7612faf42e6037752b562aeb6 100644 --- a/Tracking/TrkEvent/TrkSegment/CMakeLists.txt +++ b/Tracking/TrkEvent/TrkSegment/CMakeLists.txt @@ -1,36 +1,16 @@ -################################################################################ -# Package: TrkSegment -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package name. atlas_subdir( TrkSegment ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - Control/AthContainers - DetectorDescription/Identifier - Tracking/TrkEvent/TrkMeasurementBase - PRIVATE - Control/AthLinks - GaudiKernel - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventPrimitives ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: +# Component(s) in the package. atlas_add_library( TrkSegment - src/*.cxx - PUBLIC_HEADERS TrkSegment - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers Identifier TrkMeasurementBase - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks GaudiKernel TrkSurfaces TrkEventPrimitives ) + TrkSegment/*.h src/*.cxx + PUBLIC_HEADERS TrkSegment + LINK_LIBRARIES AthenaKernel AthContainers Identifier TrkMeasurementBase + PRIVATE_LINK_LIBRARIES GaudiKernel TrkSurfaces TrkEventPrimitives ) atlas_add_dictionary( TrkSegmentDict - TrkSegment/TrkSegmentDict.h - TrkSegment/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers Identifier TrkMeasurementBase AthLinks GaudiKernel TrkSurfaces TrkEventPrimitives TrkSegment ) - + TrkSegment/TrkSegmentDict.h + TrkSegment/selection.xml + LINK_LIBRARIES AthContainers AthLinks TrkSegment ) diff --git a/Tracking/TrkEvent/TrkSegment/TrkSegment/TrkSegmentDict.h b/Tracking/TrkEvent/TrkSegment/TrkSegment/TrkSegmentDict.h index f182d1e2e70e8dfb62a6627e0a3c49ea5489b076..21e2c1794abeb2357e00e0f31bbb461612e94697 100755 --- a/Tracking/TrkEvent/TrkSegment/TrkSegment/TrkSegmentDict.h +++ b/Tracking/TrkEvent/TrkSegment/TrkSegment/TrkSegmentDict.h @@ -1,15 +1,18 @@ +// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef TRKSEGMENT_TRKSEGMENTDICT_H #define TRKSEGMENT_TRKSEGMENTDICT_H +// Local include(s). #include "TrkSegment/SegmentCollection.h" #include "TrkSegment/TrackSegment.h" #include "TrkSegment/Segment.h" + +// EDM include(s). +#include "AthContainers/tools/AuxTypeVectorFactory.h" #include "AthLinks/ElementLink.h" -#include "TrkSegment/SegmentCollection.h" class TrkSegmentDummyDict { class RIO_onTrack; @@ -18,6 +21,7 @@ class TrkSegmentDummyDict { std::vector<const Trk::RIO_OnTrack*> m_myRioVec; ElementLink< Trk::SegmentCollection > m_i3; std::vector<ElementLink< Trk::SegmentCollection > > m_i4; + SG::AuxTypeVectorFactory< ElementLink< Trk::SegmentCollection > > m_i5; }; -#endif +#endif // TRKSEGMENT_TRKSEGMENTDICT_H diff --git a/Tracking/TrkEvent/TrkSegment/TrkSegment/selection.xml b/Tracking/TrkEvent/TrkSegment/TrkSegment/selection.xml index a81525096bee193dc5e6d8fb13d4150f6acad393..e13dd7fb9350383abb21b2b514c5419faa84d65d 100755 --- a/Tracking/TrkEvent/TrkSegment/TrkSegment/selection.xml +++ b/Tracking/TrkEvent/TrkSegment/TrkSegment/selection.xml @@ -1,3 +1,4 @@ +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <class name="Trk::Segment" > <field name="s_numberOfInstantiations" transient="true" /> @@ -9,4 +10,5 @@ <class name="std::vector<Trk::Segment*>" /> <class name="ElementLink< Trk::SegmentCollection >" /> <class name="std::vector<ElementLink< Trk::SegmentCollection > >" /> + <class name="SG::AuxTypeVectorFactory<ElementLink<Trk::SegmentCollection> >" /> </lcgdict> diff --git a/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h b/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h index 1ce0588b6737bb4396eb8a743d7eafe05a9fe1a6..b299db70c05b1f0d4aa1b846ec2495e0f721ff20 100755 --- a/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h +++ b/Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -19,8 +19,8 @@ #include "Identifier/IdentifierHash.h" #include "TrkMeasurementBase/MeasurementBase.h" +#include <cassert> #include <iostream> -#include <assert.h> class MsgStream; diff --git a/Tracking/TrkEvent/TrkSpacePoint/src/SpacePoint.cxx b/Tracking/TrkEvent/TrkSpacePoint/src/SpacePoint.cxx index 6842742d566b7f12e301c9080e3505590b2e8778..5df5034ef909f7302c0b91548502b8004cf5fb90 100755 --- a/Tracking/TrkEvent/TrkSpacePoint/src/SpacePoint.cxx +++ b/Tracking/TrkEvent/TrkSpacePoint/src/SpacePoint.cxx @@ -11,14 +11,14 @@ // Version 2.0 /12/2005 Martin Siebel /////////////////////////////////////////////////////////////////// -#include <new> #include "TrkSpacePoint/SpacePoint.h" -#include "TrkPrepRawData/PrepRawData.h" #include "GaudiKernel/MsgStream.h" -#include "TrkEventPrimitives/LocalParameters.h" #include "TrkDetElementBase/TrkDetElementBase.h" +#include "TrkEventPrimitives/LocalParameters.h" +#include "TrkPrepRawData/PrepRawData.h" #include "TrkSurfaces/Surface.h" -#include <math.h> +#include <cmath> +#include <new> namespace Trk { diff --git a/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx b/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx index b2788a781c938eb536999722bdc86e7fbd066377..0d074bc45856b02c1fe5b21d45a3c75664b3f5b3 100644 --- a/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx +++ b/Tracking/TrkEvent/VxJetVertex/src/VxClusteringTable.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -41,7 +41,7 @@ namespace Trk { MsgStream& VxClusteringTable::dump(MsgStream& sl) const { sl << "Trk::VxClusteringTable:" << endmsg; - if (m_compatibilityPairOfVertices.size()==0) { + if (m_compatibilityPairOfVertices.empty()) { sl << "No couple of vertices contained in the table " << endmsg; } else { sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << endmsg; @@ -71,7 +71,7 @@ namespace Trk { std::ostream& VxClusteringTable::dump(std::ostream& sl) const { sl << "Trk::VxClusteringTable:" << std::endl; - if (m_compatibilityPairOfVertices.size()==0) { + if (m_compatibilityPairOfVertices.empty()) { sl << "No couple of vertices contained in the table " << std::endl; } else { sl << "Numbers of compatibilities store: " << m_compatibilityPairOfVertices.size() << std::endl; @@ -112,7 +112,7 @@ namespace Trk { PairOfVxVertexOnJetAxis VxClusteringTable::getMostCompatibleVertices(float & probability) const { - if (m_compatibilityPairOfVertices.size()==0) { + if (m_compatibilityPairOfVertices.empty()) { // std::cout << "Warning in VxClusteringTable: requested highest compatibility to an empty probability table" << std::endl; //GP 02-04-2007 Too verbose... happens too often... probability=0; diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h b/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h index 0945f62a3b8910922da409a44e6b91845db343a7..d9bde19a09628197a40b4d2b13f307bd41bead6c 100755 --- a/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h +++ b/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////// @@ -153,7 +153,7 @@ namespace Trk * Note that m_ExpectedCovarianceAtPOCA stores a covariance matrix, this function * will just invert it. No caching mechanism is implemented for now. */ - const AmgSymMatrix(5) expectedWeightAtPCA() const; + AmgSymMatrix(5) expectedWeightAtPCA() const; /** * Access to the parameters at point of closest approach diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h index d24f74e4b07d16bc72997bb43d04c012fc8fe04f..9381e152ca4df39d1fabcc0547f0df37d87e6949 100755 --- a/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h +++ b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -92,7 +92,7 @@ namespace Trk * Chi2 value. NOTE: using this constructor does not allow to store the * initial (before refit) Perigee parameters of the track. */ - VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex=NULL); + VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex=nullptr); /** * Constructor taking the perigee parameters of the track, chi2, @@ -106,9 +106,9 @@ namespace Trk * In addition to the previous ones, it asks for a pointer to the LinearizedTrack */ VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex, - double ndfPerTrk,LinearizedTrack * linState=0); + double ndfPerTrk,LinearizedTrack * linState=nullptr); VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, - double ndfPerTrk,LinearizedTrack * linState=0); + double ndfPerTrk,LinearizedTrack * linState=nullptr); /** * Constructor required for iterative vertex fitters only (with and without link to original track). @@ -116,9 +116,9 @@ namespace Trk * initial track parameters. */ VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex, const TrackParameters* initialPerigee, const NeutralParameters* initialNeutralPerigee, - double ndfPerTrk,LinearizedTrack * linState=0); + double ndfPerTrk,LinearizedTrack * linState=nullptr); VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, const TrackParameters* initialPerigee, - double ndfPerTrk,LinearizedTrack * linState=0); + double ndfPerTrk,LinearizedTrack * linState=nullptr); VxTrackAtVertex(ITrackLink* trackOrParticleLink); @@ -162,7 +162,7 @@ namespace Trk /** * Track Quality (Chi2 and ndf per track in a veretx fit) */ - const FitQuality trackQuality(void) const; + FitQuality trackQuality(void) const; /** * Perigee parameters with respect to fitted vertex @@ -376,16 +376,16 @@ namespace Trk inline const TrackParameters* VxTrackAtVertex::initialPerigee(void) const { - if (m_initialPerigee!=0) return m_initialPerigee;//as default always return the proper object (be consistent!) - if(m_trackOrParticleLink!=0) return m_trackOrParticleLink->parameters(); - return 0; + if (m_initialPerigee!=nullptr) return m_initialPerigee;//as default always return the proper object (be consistent!) + if(m_trackOrParticleLink!=nullptr) return m_trackOrParticleLink->parameters(); + return nullptr; } inline const NeutralParameters* VxTrackAtVertex::initialNeutralPerigee(void) const { - if (m_initialNeutralPerigee!=0) return m_initialNeutralPerigee;//as default always return the proper object (be consistent!) - if(m_trackOrParticleLink!=0) return m_trackOrParticleLink->neutralParameters(); - return 0; + if (m_initialNeutralPerigee!=nullptr) return m_initialNeutralPerigee;//as default always return the proper object (be consistent!) + if(m_trackOrParticleLink!=nullptr) return m_trackOrParticleLink->neutralParameters(); + return nullptr; } inline VxTrackAtVertex* VxTrackAtVertex::clone() const @@ -395,7 +395,7 @@ namespace Trk inline void VxTrackAtVertex::setImpactPoint3dAtaPlane(const AtaPlane * myIP3dAtaPlane) { - if (m_ImpactPoint3dAtaPlane != 0) delete m_ImpactPoint3dAtaPlane; + if (m_ImpactPoint3dAtaPlane != nullptr) delete m_ImpactPoint3dAtaPlane; m_ImpactPoint3dAtaPlane=myIP3dAtaPlane; } @@ -406,7 +406,7 @@ namespace Trk inline void VxTrackAtVertex::setImpactPoint3dNeutralAtaPlane(const NeutralAtaPlane * myIP3dNeutralAtaPlane) { - if (m_ImpactPoint3dNeutralAtaPlane != 0) delete m_ImpactPoint3dNeutralAtaPlane; + if (m_ImpactPoint3dNeutralAtaPlane != nullptr) delete m_ImpactPoint3dNeutralAtaPlane; m_ImpactPoint3dNeutralAtaPlane=myIP3dNeutralAtaPlane; } @@ -445,7 +445,7 @@ namespace Trk return m_linState; } - inline const FitQuality VxTrackAtVertex::trackQuality(void) const + inline FitQuality VxTrackAtVertex::trackQuality(void) const { return m_fitQuality; } @@ -467,19 +467,19 @@ namespace Trk inline void VxTrackAtVertex::setPerigeeAtVertex(TrackParameters * perigee) { - if (m_perigeeAtVertex != 0) delete m_perigeeAtVertex; + if (m_perigeeAtVertex != nullptr) delete m_perigeeAtVertex; m_perigeeAtVertex = perigee; } inline void VxTrackAtVertex::setPerigeeAtVertex(NeutralParameters * perigee) { - if (m_neutralPerigeeAtVertex != 0) delete m_neutralPerigeeAtVertex; + if (m_neutralPerigeeAtVertex != nullptr) delete m_neutralPerigeeAtVertex; m_neutralPerigeeAtVertex = perigee; } inline void VxTrackAtVertex::setLinTrack(LinearizedTrack * myLinTrack) { - if (m_linState != 0) delete m_linState; + if (m_linState != nullptr) delete m_linState; m_linState=myLinTrack; } @@ -491,7 +491,7 @@ namespace Trk //setting the initial perigee to be consistent with this // new track - if(trk != 0) + if(trk != nullptr) { // delete initialPerigee before, otherwise memleak!! // if (m_initialPerigee!=0) { delete m_initialPerigee; m_initialPerigee=0; } @@ -499,8 +499,8 @@ namespace Trk m_initialPerigee = trk->parameters(); m_initialNeutralPerigee = trk->neutralParameters(); }else { - m_initialPerigee = 0; - m_initialNeutralPerigee = 0; + m_initialPerigee = nullptr; + m_initialNeutralPerigee = nullptr; } }//end of setOrigTrack method @@ -515,12 +515,12 @@ namespace Trk inline void VxTrackAtVertex::setInitialPerigee(const TrackParameters * perigee) { - if(m_trackOrParticleLink == 0) m_initialPerigee = perigee; + if(m_trackOrParticleLink == nullptr) m_initialPerigee = perigee; } inline void VxTrackAtVertex::setInitialPerigee(const NeutralParameters * perigee) { - if(m_trackOrParticleLink == 0) m_initialNeutralPerigee = perigee; + if(m_trackOrParticleLink == nullptr) m_initialNeutralPerigee = perigee; } /**Overload of << operator for both, MsgStream and std::ostream for debug diff --git a/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx b/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx index feb6a1cec29350cdb83a43dbf1d19cfcc3354c63..6e5d5b08dabb9e176237d0655e5f469440f20920 100755 --- a/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx +++ b/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -101,7 +101,7 @@ namespace Trk { m_ExpectedPositionAtPOCA, m_ExpectedMomentumAtPOCA, m_ConstantTerm); - } else return new LinearizedTrack(); + } return new LinearizedTrack(); }//end of clone method const AmgSymMatrix(5) & LinearizedTrack::expectedCovarianceAtPCA() const @@ -109,7 +109,7 @@ namespace Trk { return m_ExpectedCovarianceAtPOCA; } - const AmgSymMatrix(5) LinearizedTrack::expectedWeightAtPCA() const + AmgSymMatrix(5) LinearizedTrack::expectedWeightAtPCA() const { //the m_ExpectedCovarianceAtPOCA stores a covariance matrix, need to invert to get weight matrix //note: no check if matrix is invertible diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/EventCnvSuperTool.h b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/EventCnvSuperTool.h index 4ccc5979c5b4e19b12df657f2042a24af521d0a8..4096ebc66743c372fcf40117cd08d1b045145663 100644 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/EventCnvSuperTool.h +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/EventCnvSuperTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRKEVENTCNVTOOLS_EVENTCNVSUPERTOOL @@ -23,7 +23,7 @@ namespace Trk /** Tool to handle TP conversions for Tracking EDM. This tool has sub tools that do the detector-specific conversions*/ - class EventCnvSuperTool : virtual public IEventCnvSuperTool, public AthAlgTool +class EventCnvSuperTool : public extends<AthAlgTool, IEventCnvSuperTool> { public: @@ -33,26 +33,31 @@ namespace Trk virtual ~EventCnvSuperTool (); - virtual StatusCode initialize(); + virtual StatusCode initialize() override; - virtual StatusCode finalize(); + virtual StatusCode finalize() override; - const Trk::ITrkEventCnvTool* getCnvTool(const Identifier& id) const; + virtual const Trk::ITrkEventCnvTool* getCnvTool(const Identifier& id) const override; /** From passed Identifier*/ - virtual const Trk::Surface* getSurface(const Identifier& id) const; + virtual const Trk::Surface* getSurface(const Identifier& id) const override; /** Take the passed RoT and recreate it (i.e. fill missing pointers etc)*/ - virtual void recreateRIO_OnTrack( RIO_OnTrack *RoT ) const; + virtual void recreateRIO_OnTrack( RIO_OnTrack *RoT ) const override; /** Take the passed RoT and prepare the PRD ElementLink for writing to disc*/ - virtual void prepareRIO_OnTrack( RIO_OnTrack* Rot) const; + virtual void prepareRIO_OnTrack( RIO_OnTrack* Rot) const override; - virtual bool canHandleInDet() const { return m_haveIdCnvTool;} - virtual bool canHandleMuonSpectrometer() const { return m_haveMuonCnvTool;} - virtual int maxNumberOfErrors() const { return m_maxErrCount;} + /** Take the passed RoT and return the EL components to write to disc */ + virtual void prepareRIO_OnTrackLink( const RIO_OnTrack* Rot, + ELKey_t& key, + ELIndex_t& index ) const override; + + virtual bool canHandleInDet() const override { return m_haveIdCnvTool;} + virtual bool canHandleMuonSpectrometer() const override { return m_haveMuonCnvTool;} + virtual int maxNumberOfErrors() const override { return m_maxErrCount;} - virtual bool noGeometry() const {return !(m_haveIdCnvTool&&m_haveMuonCnvTool);} + virtual bool noGeometry() const override {return !(m_haveIdCnvTool&&m_haveMuonCnvTool);} private: ToolHandle<Trk::ITrkEventCnvTool> m_idCnvTool {this, "IdCnvTool", "InDet::InDetEventCnvTool/InDetEventCnvTool", "Tool used to handle ID RoTs etc"}; //!< Tool used to handle ID RoTs etc diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/IEventCnvSuperTool.h b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/IEventCnvSuperTool.h index 6e16a4e456e4edd357db6d381b41da89c21cee7a..fc47a360b22d265cc10de6f2c3a64223febf423a 100644 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/IEventCnvSuperTool.h +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/IEventCnvSuperTool.h @@ -25,10 +25,13 @@ namespace Trk class IEventCnvSuperTool : virtual public IAlgTool { public: + /// Key and index types used for an EL to IdentifiableContainer. + typedef std::string ELKey_t; + typedef unsigned int ELIndex_t; - IEventCnvSuperTool() {}; + DeclareInterfaceID( IEventCnvSuperTool, 1, 0 ); - static const InterfaceID& interfaceID(); + IEventCnvSuperTool() {}; virtual const Trk::ITrkEventCnvTool* getCnvTool(const Identifier& id) const =0; @@ -41,6 +44,11 @@ namespace Trk /** Take the passed RoT and prepare the PRD ElementLink for writing to disc*/ virtual void prepareRIO_OnTrack( RIO_OnTrack* Rot) const = 0; + /** Take the passed RoT and return the EL components to write to disc */ + virtual void prepareRIO_OnTrackLink( const RIO_OnTrack* Rot, + ELKey_t& key, + ELIndex_t& index ) const = 0; + /**This templated method will return the hashAndIndex of the passed RIO_OnTrack.*/ template <class CONT, class ROT> bool getHashAndIndex(const ROT* rot, const SG::ReadHandleKey<CONT>& contName, @@ -61,11 +69,6 @@ namespace Trk }; } -inline const InterfaceID& Trk::IEventCnvSuperTool::interfaceID() -{ - return IID_IIEventCnvSuperTool; -} - #include "TrkEventCnvTools/IEventCnvSuperTool.icc" #endif diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.h b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.h index 7b8715dd66d5e47bc104539d31b0b3186215e0fb..7faa6e68ef6086131bb92faf65e0a33562dd9b1b 100755 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.h +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.h @@ -26,11 +26,16 @@ class TrkDetElementBase; class PrepRawData; class RIO_OnTrack; -static const InterfaceID IID_IITrkEventCnvTool("Trk::ITrkEventCnvTool", 1, 0); class ITrkEventCnvTool : virtual public IAlgTool { public: + /// Key and index types used for an EL to IdentifiableContainer. + typedef std::string ELKey_t; + typedef unsigned int ELIndex_t; + + DeclareInterfaceID( ITrkEventCnvTool, 1, 0 ); + ITrkEventCnvTool(): m_storeGate ( "StoreGateSvc", "ITrkEventCnvTool" ), @@ -39,8 +44,6 @@ class ITrkEventCnvTool : virtual public IAlgTool // m_log(&(*m_msgSvc), name() ); } - static const InterfaceID& interfaceID(); - /** check the passed RIO_OnTrack to make sure it is correctly filled*/ virtual void checkRoT( const Trk::RIO_OnTrack& rioOnTrack ) const =0; @@ -53,6 +56,13 @@ class ITrkEventCnvTool : virtual public IAlgTool /**This templated method will set the EL for the passed RIO_OnTrack.*/ template <class CONT, class ROT> void prepareRIO_OnTrackElementLink(ROT* rot) const; + + /**This templated method will find EL components for the passed RIO_OnTrack.*/ + template <class CONT, class ROT> + void prepareRIO_OnTrackElementLink(const ROT* rot, + ELKey_t& key, + ELIndex_t& index) const; + /**This templated method will return the hashAndIndex of the passed RIO_OnTrack.*/ template <class CONT, class ROT> bool getHashAndIndex(const ROT* rot, const SG::ReadHandleKey<CONT>& contName, @@ -66,6 +76,12 @@ class ITrkEventCnvTool : virtual public IAlgTool - Then set strings and index. - If any of the above failed, try the next container.*/ virtual void prepareRIO_OnTrack( Trk::RIO_OnTrack* rot) const =0; + + /** Similar, but just return the EL components rather then + changing ROT. */ + virtual void prepareRIO_OnTrackLink( const Trk::RIO_OnTrack* rot, + ELKey_t& key, + ELIndex_t& index ) const =0; /** Take the passed RoT and recreate it (i.e. fill missing pointers etc)*/ virtual void recreateRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const =0; @@ -83,11 +99,6 @@ class ITrkEventCnvTool : virtual public IAlgTool ServiceHandle<IMessageSvc> m_msgSvc; }; } - -inline const InterfaceID& Trk::ITrkEventCnvTool::interfaceID() -{ - return IID_IITrkEventCnvTool; -} #include "TrkEventCnvTools/ITrkEventCnvTool.icc" diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.icc b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.icc index d668d21e96fdfeb78c0c27e513e624c04c3db963..61043489583f864cb44c7d10d532aad0bf8c2c48 100644 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.icc +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/ITrkEventCnvTool.icc @@ -10,14 +10,21 @@ #include <typeinfo> + template <class CONT, class ROT> -void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(ROT* rot) const { +void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(const ROT* rot, + ELKey_t& key, + ELIndex_t& index) const +{ // verify pointer is ok // assume EL is correct // get data handles to convertors + key = rot->m_rio.dataID(); + index = rot->m_rio.index(); + bool isPersistifiable = (rot->m_rio.key() != 0 - and IdentContIndex(rot->m_rio.index()).isValid()); + and IdentContIndex(index).isValid()); if (isPersistifiable) { return; // Already set - bail out. @@ -30,7 +37,7 @@ void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(ROT* rot) const { return; } - const DataHandle<CONT> dh, dhEnd; + SG::ConstIterator<CONT> dh, dhEnd; StatusCode sc = m_storeGate->retrieve(dh, dhEnd); if (sc.isFailure()) { MsgStream log(&(*m_msgSvc), name()); @@ -41,20 +48,21 @@ void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(ROT* rot) const { // loop over dhs for ( ; dh!=dhEnd; dh++) { const Trk::PrepRawData* prd = rot->prepRawData(); - unsigned int index = prd->getHashAndIndex().objIndex(); // prd index within collection + unsigned int oindex = prd->getHashAndIndex().objIndex(); // prd index within collection IdentifierHash idHash = prd->getHashAndIndex().collHash(); // idHash of collection - CONT* cont = dh; // container - typename CONT::const_iterator coll = cont->indexFind(idHash); //matching collection + const CONT& cont = *dh; // container + typename CONT::const_iterator coll = cont.indexFind(idHash); //matching collection // does coll exist? // check prd exists in collection // check pointer value the same. - if ( (coll!=cont->end())&& ((*coll)->size()>index) && (prd==(**coll)[index]) ) { + if ( (coll!=cont.end())&& ((*coll)->size()>oindex) && (prd==(**coll)[oindex]) ) { // okay, so we found the correct PRD in the container. - // Now set EL correctly. dh.key() is the name of the container. index is the index withtin the collection. IdHash???? - rot->m_rio.resetWithKeyAndIndex(dh.key(), prd->getHashAndIndex().hashAndIndex() ); - + // Return EL components. + // dh.key() is the name of the container. oindex is the index within the collection. IdHash???? + key = dh.key(); + index = prd->getHashAndIndex().hashAndIndex(); return; //exit loop and function. We're done. } } @@ -66,6 +74,15 @@ void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(ROT* rot) const { return; } +template <class CONT, class ROT> +void Trk::ITrkEventCnvTool::prepareRIO_OnTrackElementLink(ROT* rot) const +{ + ELKey_t key; + ELIndex_t index; + prepareRIO_OnTrackElementLink<CONT> (rot, key, index); + rot->m_rio.resetWithKeyAndIndex (key, index); +} + inline void Trk::ITrkEventCnvTool::setRoT_Values(std::pair<const Trk::TrkDetElementBase *, const Trk::PrepRawData *>& pair, Trk::RIO_OnTrack *RoT) const { RoT->setValues(pair.first, pair.second); } diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/src/EventCnvSuperTool.cxx b/Tracking/TrkEventCnv/TrkEventCnvTools/src/EventCnvSuperTool.cxx index b7f5092c2f60add13ff259144845499a27656277..95ac725cc4c2697fc6aac91d66dc42005969299f 100644 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/src/EventCnvSuperTool.cxx +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/src/EventCnvSuperTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkEventCnvTools/EventCnvSuperTool.h" @@ -16,7 +16,7 @@ Trk::EventCnvSuperTool::EventCnvSuperTool( const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), + base_class(t,n,p), m_detID(0), m_haveIdCnvTool(false), // Will be set to true on retrieval m_haveMuonCnvTool(false), // Will be set to true on retrieval @@ -25,7 +25,6 @@ Trk::EventCnvSuperTool::EventCnvSuperTool( m_errCount(0), m_maxErrCount(10) { - declareInterface<IEventCnvSuperTool>(this); declareProperty("DoMuons",m_doMuons, "If true (default), attempt to retrieve Muon helper tool and convert Muon objects."); declareProperty("DoID",m_doID, "If true (default), attempt to retrieve Inner Detector helper tool and convert ID objects."); declareProperty("MaxErrorCount", m_maxErrCount, "Maximum number of errors that will be reported"); @@ -177,3 +176,17 @@ Trk::EventCnvSuperTool::prepareRIO_OnTrack( Trk::RIO_OnTrack *RoT ) const } return; } + +void +Trk::EventCnvSuperTool::prepareRIO_OnTrackLink ( const Trk::RIO_OnTrack *RoT, + ELKey_t& key, + ELIndex_t& index ) const +{ + const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify()); + if (cnvTool!=0) { + cnvTool->prepareRIO_OnTrackLink ( RoT, key, index ); + } else { + if ( (m_errCount++)<m_maxErrCount) msg()<< "prepareRIO_OnTrack could not find appropriate tool to prepare: "<<*RoT<<std::endl; + } + return; +} diff --git a/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx index 28dce057f02ee24fcc06be18677a85934eff07ab..fb09264c5b321366fd0941f3b813227039bb2c64 100644 --- a/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx +++ b/Tracking/TrkEventCnv/TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id$ /** * @file TrkEventTPCnv/test/SurfaceCnv_p2_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -37,6 +35,10 @@ public: { std::abort(); } virtual void prepareRIO_OnTrack( Trk::RIO_OnTrack* /*Rot*/) const override { std::abort(); } + virtual void prepareRIO_OnTrackLink( const Trk::RIO_OnTrack* /*Rot*/, + ELKey_t& /*key*/, + ELIndex_t& /*index*/ ) const override + { std::abort(); } virtual bool canHandleInDet() const override { std::abort(); } virtual bool canHandleMuonSpectrometer() const override diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/ExtrapolatorTest.h b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/ExtrapolatorTest.h index 1c5346eada7918631a0a59d794105ca921c6b90c..3d2683309a418e4f78dc137b39fb1832df1dc114 100755 --- a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/ExtrapolatorTest.h +++ b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/ExtrapolatorTest.h @@ -17,7 +17,6 @@ #include "GaudiKernel/ToolHandle.h" #include <string> #include <vector> -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkParameters/TrackParameters.h" namespace Trk @@ -67,8 +66,7 @@ namespace Trk /** The Extrapolator to be retrieved */ ToolHandle<IExtrapolator> m_extrapolator; ToolHandle<IPropagator> m_propagator; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; //!< helper tool to get the magnetic field - MagneticFieldProperties* m_magFieldProperties; //!< magnetic field properties + MagneticFieldProperties* m_magFieldProperties; //!< magnetic field properties /** Random Number setup */ Rndm::Numbers* m_gaussDist; diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/PropResultRootWriterSvc.h b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/PropResultRootWriterSvc.h index edbc78a276b0c752198a7ab0148f3a813f046828..420ca7a2f2fc413999e2e55b9185e63eb910822f 100644 --- a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/PropResultRootWriterSvc.h +++ b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/PropResultRootWriterSvc.h @@ -33,7 +33,7 @@ class PropResultRootWriterSvc : public AthService { return IID_PropResultRootWriterSvc; } - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) { + virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) override { ATH_MSG_DEBUG("in queryInterface()"); if (PropResultRootWriterSvc::interfaceID().versionMatch(riid)) { ATH_MSG_DEBUG("matched PropResultRootWriterSvc"); diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/RiddersAlgorithm.h b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/RiddersAlgorithm.h index 6098c4353d50e64ab195a89fd7d8e9857b41a3d1..0f374f1deebd8471d4f7c989e78f6af34a506bcf 100755 --- a/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/RiddersAlgorithm.h +++ b/Tracking/TrkExtrapolation/TrkExAlgs/TrkExAlgs/RiddersAlgorithm.h @@ -14,7 +14,7 @@ #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/IRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "GeoPrimitives/GeoPrimitives.h" #include <string> class AtlasDetectorID; @@ -65,7 +65,6 @@ namespace Trk /** member variables for algorithm properties: */ ToolHandle<IPropagator> m_propagator; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; bool m_useCustomField; bool m_useAlignedSurfaces; double m_fieldValue; diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx index 4af2d977a619e53e04d30910e827854ea37b651e..3fead037c0706dcd7f4501b3c1506dc6ee5d93d4 100755 --- a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx +++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx @@ -14,7 +14,6 @@ #include "TrkSurfaces/DiscSurface.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "EventPrimitives/EventPrimitives.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkGeometry/MagneticFieldProperties.h" #include "GaudiKernel/SystemOfUnits.h" // std @@ -27,7 +26,6 @@ Trk::ExtrapolatorTest::ExtrapolatorTest(const std::string& name, ISvcLocator* pS AthAlgorithm(name,pSvcLocator), m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"), m_propagator("Trk::RungeKuttaPropagator/RungeKuttaPropagator"), - m_magFieldSvc("AtlasFieldSvc",name), m_magFieldProperties(0), m_gaussDist(0), m_flatDist(0), @@ -48,7 +46,6 @@ Trk::ExtrapolatorTest::ExtrapolatorTest(const std::string& name, ISvcLocator* pS // used algorithms and alg tools declareProperty("Extrapolator", m_extrapolator); declareProperty("Propagator", m_propagator); - declareProperty("MagFieldSvc", m_magFieldSvc ); // algorithm steering declareProperty("StartPerigeeSigmaD0" , m_sigmaD0); @@ -109,10 +106,6 @@ StatusCode Trk::ExtrapolatorTest::initialize() return StatusCode::FAILURE; } - if (m_magFieldSvc.retrieve().isFailure()) { - msg(MSG::FATAL) << "Could not retrieve Tool " << m_magFieldSvc << ". Exiting."<<endmsg; - return StatusCode::FAILURE; - } m_magFieldProperties = new Trk::MagneticFieldProperties(); if (m_referenceSurfaceRadius.size() == m_referenceSurfaceHalflength.size()) { diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/PropResultRootWriterSvc.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/PropResultRootWriterSvc.cxx index a9905d4a8f90cac4332ec40dbd4d8bdad4f67b3b..1a3d6ba489ef81ca011266280e1bcfc5bda93720 100644 --- a/Tracking/TrkExtrapolation/TrkExAlgs/src/PropResultRootWriterSvc.cxx +++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/PropResultRootWriterSvc.cxx @@ -29,7 +29,7 @@ StatusCode Trk::PropResultRootWriterSvc::initialize() const std::string treeName = m_treeName; m_tree = new TTree(treeName.data(), "MyStudies"); - std::string fullNtupleName = m_ntupleDirName + m_treeName; + std::string fullNtupleName = static_cast<std::string>(m_ntupleDirName) + m_treeName; CHECK(m_thistSvc->regTree(fullNtupleName, m_tree)); if(m_tree == nullptr) { diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/RiddersAlgorithm.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/RiddersAlgorithm.cxx index be538cca3bd93c150dda2cd6b41e7abe5477e420..d72940c3b7d77558633a897d114aead4e7a57ef6 100755 --- a/Tracking/TrkExtrapolation/TrkExAlgs/src/RiddersAlgorithm.cxx +++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/RiddersAlgorithm.cxx @@ -10,7 +10,6 @@ // Trk stuff #include "TrkExInterfaces/IPropagator.h" #include "TrkExUtils/TransportJacobian.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkGeometry/MagneticFieldProperties.h" #include "TrkSurfaces/PlaneSurface.h" #include "TrkSurfaces/CylinderSurface.h" @@ -27,7 +26,6 @@ Trk::RiddersAlgorithm::RiddersAlgorithm(const std::string& name, ISvcLocator* pS : AthAlgorithm(name,pSvcLocator), m_propagator("Trk::RungeKuttaPropagator/RungeKuttaPropagator"), - m_magFieldSvc("AtlasFieldSvc",name), m_useCustomField(true), m_useAlignedSurfaces(true), m_fieldValue(2.*Gaudi::Units::tesla), @@ -91,7 +89,6 @@ Trk::RiddersAlgorithm::RiddersAlgorithm(const std::string& name, ISvcLocator* pS declareProperty("Propagator" , m_propagator); - declareProperty("MagFieldSvc" , m_magFieldSvc); declareProperty("CustomFieldValue" , m_fieldValue); declareProperty("UseCustomMagneticField" , m_useCustomField); declareProperty("UseAlignedSurfaces" , m_useAlignedSurfaces); @@ -143,12 +140,6 @@ StatusCode Trk::RiddersAlgorithm::initialize() return StatusCode::FAILURE; } - // Get the Magnetic Field Tool if needed - if (!m_useCustomField && m_magFieldSvc.retrieve().isFailure()) { - ATH_MSG_FATAL( "Could not retrieve Tool " << m_magFieldSvc << ". Exiting." ); - return StatusCode::FAILURE; - } - // Prepare the magnetic field properties if (!m_useCustomField) m_magFieldProperties = new Trk::MagneticFieldProperties(); diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/HelperStructs.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/HelperStructs.h index f5c5f1d252f10b5e004b726865e2dc221ff22660..290b5626e195a14f3e0b99d61b016f801ad57193 100644 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/HelperStructs.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/HelperStructs.h @@ -1,11 +1,13 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRKEXINTERFACES_HELPERSTRUCTS_H #define TRKEXINTERFACES_HELPERSTRUCTS_H -namespace Trk { +#include "TrkParameters/TrackParameters.h" + +namespace Trk { struct HitInfo { const Trk::TrackParameters* trackParms; // intersection diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IEnergyLossCalculator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IEnergyLossCalculator.h deleted file mode 100755 index f76bb871b51e58b93f068f4ef2d2a403b58fd754..0000000000000000000000000000000000000000 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IEnergyLossCalculator.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// IEnergyLossCalculator.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef TRKEXINTERFACES_IENERGYLOSSCALCULATOR_H -#define TRKEXINTERFACES_IENERGYLOSSCALCULATOR_H - -// Gaudi -#include "GaudiKernel/IAlgTool.h" -// Trk -#include "TrkEventPrimitives/PropDirection.h" -#include "TrkEventPrimitives/ParticleHypothesis.h" -#include "TrkExUtils/ElossInputBase.h" -// STL -#include <utility> - -namespace Trk { - - class EnergyLoss; - - /** Interface ID for IEnergyLossCalculator*/ - static const InterfaceID IID_IEnergyLossCalculator("IEnergyLossCalculator", 1, 0); - - /**@class IEnergyLossCalculator - - Interface class IEnergyLossCalculator - - @author David.Lopez@cern.ch - */ - class IEnergyLossCalculator : virtual public IAlgTool { - - public: - - /**Virtual destructor*/ - virtual ~IEnergyLossCalculator(){} - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_IEnergyLossCalculator; } - - /** deltaE calculation. It returns an EnergyLoss - The sign of the deltaE in the EnergyLoss returned - depends on the given propagation direction. Since the calculation can be - very complex, any extra parameters required in the calculation should be - given through a class inheriting from the abstract class ElossInputBase. - Dynamic casting will be required inside each time. extraParams is not owned - by this class. It is given as a pointer so that it can be defaulted to 0. - - Units: [MeV] - */ - virtual EnergyLoss* energyLoss(double dX0, - double p, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - ElossInputBase* extraParams = 0) const = 0; - - /** Validation Action: - Can be implemented optionally, outside access to internal validation steps */ - virtual void validationAction() const {} - - }; - -} // end of namespace - -#endif // TRKEXINTERFACES_IENERGYLOSSCALCULATOR_H diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h index cba70de1487d6e62904c45e48de9d288c436e796..99f6d3c11704a65aab57fa6d734d0b1fc579d2f8 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h @@ -11,6 +11,9 @@ // Gaudi #include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Trk #include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/ParticleHypothesis.h" @@ -21,6 +24,7 @@ #include "TrkParameters/TrackParameters.h" #include "TrkNeutralParameters/NeutralParameters.h" #include "TrkParametersBase/ParametersBase.h" + // xAOD #include "xAODTracking/TrackParticle.h" #include "xAODTracking/NeutralParticle.h" @@ -38,9 +42,6 @@ namespace Trk { Detailed information about private members and member functions can be found in the actual implementation class Extrapolator which inherits from this one. - The ParametersBase and NeutralParameters methods only exist in configured mode, - the strategy pattern is not really useful for straight line propagation. - @author Andreas.Salzburger@cern.ch */ @@ -75,15 +76,6 @@ namespace Trk { - /** xAOD 0) xAOD track particle */ - virtual const TrackParameters* extrapolate(const xAOD::TrackParticle& particleBase, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; - - /** [NeutralParameters] ------------------------------------------------------------- */ /** N 0) <b>Neutral parameters method </b> @@ -95,274 +87,342 @@ namespace Trk { PropDirection dir=anyDirection, const BoundaryCheck& bcheck = true) const = 0; - /** [TrackParameters] --------------------------------------------------------------- */ - - /** S 1) <b>Strategy Pattern extrapolation method</b> - - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), - 0 if extrapolation to destination surface does not suceed */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, - const TrackParameters& parm, + /** [TrackParameters] interfaces WITH EventContext ------------------------------------------ */ + + + /** xAOD 0) xAOD track particle */ + virtual const TrackParameters* extrapolate(const EventContext& ctx, + const xAOD::TrackParticle& particleBase, const Surface& sf, PropDirection dir=anyDirection, const BoundaryCheck& bcheck = true, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const = 0; - /** S 2) <b>Strategy Pattern extrapolation method</b> - - returns a vector of TrackParameters representing the tracking detector elements + + + /** 1) <b>Configured AlgTool extrapolation method</b>): + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + nullptr if extrapolation to destination surface does not succeed */ + virtual const TrackParameters* extrapolate(const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const = 0; + + /** 2) <b>Configured AlgTool extrapolation method</b>): + - returns a vector of TrackParameters representing the tracking detector elements hit in between and the TrackParameters at the destination Surface (if final extrapolation suceeds), empty if the extrapolation to the destination surface does not suceed*/ - virtual std::vector<std::unique_ptr<const TrackParameters> > extrapolateStepwise( - const IPropagator& prop, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const = 0; - - /** S 3) <b>Strategy Pattern extrapolation method</b>: + virtual std::vector<std::unique_ptr<const TrackParameters>> extrapolateStepwise( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const = 0; + + /** 3) <b>Configured AlgTool extrapolation method</b>): - searches the closest TrackParameters of the Track to the destination Surface - - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), - 0 if extrapolation to destination surface does not suceed */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + 0 if extrapolation to destination surface does not suceed */ + virtual const TrackParameters* extrapolate(const EventContext& ctx, const Track& trk, const Surface& sf, - PropDirection dir=anyDirection, + PropDirection dir = anyDirection, const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; - - - /** S 4) <b>Strategy Pattern extrapolation method</b>: - - direct extrapolation to the destination surface, no material effects - or intermediate steps are taken into account - */ - virtual const TrackParameters* extrapolateDirectly(const IPropagator& prop, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const = 0; - - /** S 5) <b>Strategy Pattern extrapolation method</b>: + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const = 0; + + /** 4) <b>Configured AlgTool extrapolation method</b>): + - direct extrapolation to the destination surface, no material effects + or intermediate steps are taken into account + */ + virtual TrackParameters* extrapolateDirectly(const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const = 0; + + /** 4.1) <b>Configured AlgTool extrapolation method</b>): + Same as 4 but with propagator arguement (needed by a single client TRT_TrackExtensionToolCosmics + */ + virtual TrackParameters* extrapolateDirectly(const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const = 0; + + /** 5) <b>Configured AlgTool extrapolation method</b>): - blind inside the given tracking Volume (boundaryVol), - if none is given the reference surface for destination is used - */ - virtual std::vector<std::unique_ptr<const TrackParameters> > extrapolateBlindly(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - const Volume* boundaryVol=0) const = 0; - - /** S 6) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to the next active layer, based on the extrapolation to the next layer - and layer identification - */ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayer(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayerM(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface*>& material, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - /** S 8) <b>Strategy Pattern extrapolation method</b>: - - Extrapolation using specific intermediate surfaces and energy loss effects to be accounted for at - each surface as specified by the corresponding MaterialEffectsOnTrack. The last propagation ends - at the last surface given, applying the corresponding MaterialEffectsOnTrack to the track parameters - before returning. + if none is given the reference surface for destination is used */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, - const TrackParameters& parm, - const std::vector< MaterialEffectsOnTrack >& sfMeff, - const Trk::TrackingVolume& tvol, - PropDirection dir, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + virtual std::vector<std::unique_ptr<const TrackParameters>> extrapolateBlindly( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + const Volume* boundaryVol = nullptr) const = 0; + + /** 6) <b>Configured AlgTool extrapolation method</b>): + *- extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification*/ + virtual std::pair<const TrackParameters*, const Trk::Layer*> extrapolateToNextActiveLayer( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** 7) <b>Configured AlgTool extrapolation method</b>):*/ + virtual std::pair<const TrackParameters*, const Trk::Layer*> extrapolateToNextActiveLayerM( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** 8) <b>Configured AlgTool extrapolation method</b> ): + - extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification + * */ + virtual const TrackParameters* extrapolateToVolume(const EventContext& ctx, + const TrackParameters& parm, + const Trk::TrackingVolume& vol, + PropDirection dir = anyDirection, + ParticleHypothesis particle = pion) const = 0; + + /** 9) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers in between. + */ + virtual std::vector<const TrackStateOnSurface*>* extrapolateM(const EventContext& ctx, + const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const = 0; + + /** 10) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in + between. + */ + virtual std::vector<const TrackParameters*>* extrapolateM(const EventContext& ctx, + const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<MaterialEffectsOnTrack>& material, + std::vector<Trk::TransportJacobian*>& jacs, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const = 0; + + virtual const Trk::TrackParameters* extrapolateWithPathLimit( + const EventContext& ctx, + const Trk::TrackParameters& parm, + double& pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackParameters*>*& parmOnSf, + std::vector<const Trk::TrackStateOnSurface*>*& material, + const Trk::TrackingVolume* boundaryVol = nullptr, + MaterialUpdateMode matupmod = Trk::addNoise) const = 0; + + /** extrapolation method collecting intersections with subdetector boundaries and active volumes/layers. + A primitive identification is provided - to be replaced with appropriate identifier, and possibly merged + with TrackParameters. Material collection in option. Destination (subdetector boundary) : geoID (exit) + */ + virtual const std::vector<std::pair<const Trk::TrackParameters*, int>>* extrapolate( + const EventContext& ctx, + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackStateOnSurface*>*& material, + int destination = 3) const = 0; + + /** Return the TrackingGeometry used by the Extrapolator (forwards information from Navigator) */ + virtual const TrackingGeometry* trackingGeometry() const = 0; + + /** Validation Action: + Can be implemented optionally, outside access to internal validation steps + */ + virtual void validationAction() const = 0; + + /** Access the subPropagator to the given volume*/ + virtual const IPropagator* subPropagator(const TrackingVolume& tvol) const = 0; + + + /** [TrackParameters] old interfaces WITHOUT EventContext ------------------------------------------ */ - /** S 9) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to the next active layer, based on the extrapolation to the next layer - and layer identification - */ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextStation(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - /** S 10) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to a volume boundary of an arbitrary tracking volume ( not necessarily part of a tracking geometry ) - */ - virtual const TrackParameters* extrapolateToVolume(const IPropagator& prop, - const TrackParameters& parm, - const Trk::TrackingVolume& vol, - PropDirection dir=anyDirection, - ParticleHypothesis particle=pion) const=0; - - /** C 1) <b>Configured AlgTool extrapolation method</b> of S 1):*/ - virtual const TrackParameters* extrapolate(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - Trk::ExtrapolationCache* cache = 0 ) const = 0; - - /** C 2) <b>Configured AlgTool extrapolation method</b> of S 2):*/ - virtual std::vector<std::unique_ptr<const TrackParameters> > extrapolateStepwise(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion ) const = 0; - - /** C 3) <b>Configured AlgTool extrapolation method</b> of S 3):*/ - virtual const TrackParameters* extrapolate(const Track& trk, + + /** xAOD 0) xAOD track particle */ + virtual const TrackParameters* extrapolate(const xAOD::TrackParticle& particleBase, const Surface& sf, PropDirection dir=anyDirection, const BoundaryCheck& bcheck = true, ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - Trk::ExtrapolationCache* cache = 0 ) const = 0; - - /** C 4) <b>Configured AlgTool extrapolation method</b> of S 4):*/ - virtual const TrackParameters* extrapolateDirectly(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const = 0; - - /** C 5) <b>Configured AlgTool extrapolation method</b> of S 5):*/ - virtual std::vector<std::unique_ptr<const TrackParameters> > extrapolateBlindly(const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - const Volume* boundaryVol=0) const = 0; - - /** C 6) <b>Configured AlgTool extrapolation method</b> of S 6):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayer( - const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - /** C 7) <b>Configured AlgTool extrapolation method</b> of S 7):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayerM( - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface*>& material, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - /** C 8) <b>Configured AlgTool extrapolation method</b> of S 8):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextStation( - const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const=0; - - /** C 9) <b>Configured AlgTool extrapolation method</b> of S 9):*/ - virtual const TrackParameters* extrapolateToVolume(const TrackParameters& parm, - const Trk::TrackingVolume& vol, - PropDirection dir=anyDirection, - ParticleHypothesis particle=pion) const=0; - - /** C 10) <b>Configured AlgTool extrapolation method</b>: - - Extrapolate to a destination surface, while collecting all the material layers in between. - */ - virtual std::vector<const TrackStateOnSurface*>* extrapolateM(const TrackParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - Trk::ExtrapolationCache* cache = 0) const = 0; - - /** C 11) <b>Configured AlgTool extrapolation method</b>: - - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in between. - */ - virtual std::vector<const TrackParameters*>* extrapolateM(const TrackParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<MaterialEffectsOnTrack> &material, - std::vector<Trk::TransportJacobian*> &jacs, - ParticleHypothesis particle=pion, - Trk::ExtrapolationCache* cache = 0) const = 0; - - - virtual const Trk::TrackParameters* extrapolateWithPathLimit( - const Trk::TrackParameters& parm, - double& pathLim, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackParameters*>*& parmOnSf, - std::vector<const Trk::TrackStateOnSurface*>*& material, - const Trk::TrackingVolume* boundaryVol=0, - MaterialUpdateMode matupmod = Trk::addNoise) const = 0; - - /** extrapolation method collecting intersections with subdetector boundaries and active volumes/layers. - A primitive identification is provided - to be replaced with appropriate identifier, and possibly merged - with TrackParameters. Material collection in option. Destination (subdetector boundary) : geoID (exit) - */ - virtual const std::vector< std::pair< const Trk::TrackParameters*, int > >* extrapolate( - const Trk::TrackParameters& parm, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackStateOnSurface*>*& material, - int destination = 3) const = 0; - - /** Return the TrackingGeometry used by the Extrapolator (forwards information from Navigator) */ - virtual const TrackingGeometry* trackingGeometry() const = 0; + MaterialUpdateMode matupmode=addNoise) const; - /** Validation Action: - Can be implemented optionally, outside access to internal validation steps - */ - virtual void validationAction() const = 0; - /** Access the subPropagator to the given volume*/ - virtual const IPropagator* subPropagator(const TrackingVolume& tvol) const = 0; - - }; + + /** 1) <b>Configured AlgTool extrapolation method</b>): + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + nullptr if extrapolation to destination surface does not succeed */ + virtual const TrackParameters* extrapolate(const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const; + + /** 2) <b>Configured AlgTool extrapolation method</b>): + - returns a vector of TrackParameters representing the tracking detector elements + hit in between and the TrackParameters at the destination Surface (if final extrapolation suceeds), + empty if the extrapolation to the destination surface does not suceed*/ + virtual std::vector<std::unique_ptr<const TrackParameters>> extrapolateStepwise( + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const; + + /** 3) <b>Configured AlgTool extrapolation method</b>): + - searches the closest TrackParameters of the Track to the destination Surface + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + 0 if extrapolation to destination surface does not suceed */ + virtual const TrackParameters* extrapolate(const Track& trk, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const; + + /** 4) <b>Configured AlgTool extrapolation method</b>): + - direct extrapolation to the destination surface, no material effects + or intermediate steps are taken into account + */ + virtual TrackParameters* extrapolateDirectly(const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const; + + /** 4.1) <b>Configured AlgTool extrapolation method</b>): + Same as 4 but with propagator arguement (needed by a single client TRT_TrackExtensionToolCosmics + */ + virtual TrackParameters* extrapolateDirectly(const IPropagator& prop, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const; + + /** 5) <b>Configured AlgTool extrapolation method</b>): + - blind inside the given tracking Volume (boundaryVol), + if none is given the reference surface for destination is used + */ + virtual std::vector<std::unique_ptr<const TrackParameters>> extrapolateBlindly( + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + const Volume* boundaryVol = 0) const; + + /** 6) <b>Configured AlgTool extrapolation method</b>): + *- extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification*/ + virtual std::pair<const TrackParameters*, const Trk::Layer*> extrapolateToNextActiveLayer( + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** 7) <b>Configured AlgTool extrapolation method</b>):*/ + virtual std::pair<const TrackParameters*, const Trk::Layer*> extrapolateToNextActiveLayerM( + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** 8) <b>Configured AlgTool extrapolation method</b> ): + - extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification + * */ + virtual const TrackParameters* extrapolateToVolume(const TrackParameters& parm, + const Trk::TrackingVolume& vol, + PropDirection dir = anyDirection, + ParticleHypothesis particle = pion) const; + + /** 9) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers in between. + */ + virtual std::vector<const TrackStateOnSurface*>* extrapolateM(const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const; + + /** 10) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in + between. + */ + virtual std::vector<const TrackParameters*>* extrapolateM(const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<MaterialEffectsOnTrack>& material, + std::vector<Trk::TransportJacobian*>& jacs, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const; + + virtual const Trk::TrackParameters* extrapolateWithPathLimit( + const Trk::TrackParameters& parm, + double& pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackParameters*>*& parmOnSf, + std::vector<const Trk::TrackStateOnSurface*>*& material, + const Trk::TrackingVolume* boundaryVol = 0, + MaterialUpdateMode matupmod = Trk::addNoise) const; + + /** extrapolation method collecting intersections with subdetector boundaries and active volumes/layers. + A primitive identification is provided - to be replaced with appropriate identifier, and possibly merged + with TrackParameters. Material collection in option. Destination (subdetector boundary) : geoID (exit) + */ + virtual const std::vector<std::pair<const Trk::TrackParameters*, int>>* extrapolate( + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackStateOnSurface*>*& material, + int destination = 3) const; - inline const Trk::TrackParameters* Trk::IExtrapolator::extrapolateWithPathLimit( - const Trk::TrackParameters& /*parm*/, - double& /*pathLim*/, - Trk::PropDirection /*dir*/, - Trk::ParticleHypothesis /*particle*/, - std::vector<const Trk::TrackParameters*>*& /*parmOnSf*/, - std::vector<const Trk::TrackStateOnSurface*>*& /*material*/, - const Trk::TrackingVolume* /*boundaryVol*/, - MaterialUpdateMode /*matupmod*/) const - { - std::cout << "CONFIGURATION ERROR: dummy version of extrapolation-with-path-limit method called " << std::endl; - return 0; - } - - inline const std::vector< std::pair< const Trk::TrackParameters*, int > >* - Trk::IExtrapolator::extrapolate( const Trk::TrackParameters& /*parm*/, - Trk::PropDirection /*dir*/, - Trk::ParticleHypothesis /*particle*/, - std::vector<const Trk::TrackStateOnSurface*>*& /*material*/, - int /*destination*/) const - { - std::cout << "CONFIGURATION ERROR: dummy version of extrapolation through active regions called " << std::endl; - return 0; - } + + }; } // end of namespace + +#include "TrkExInterfaces/IExtrapolator.icc" + + #endif // TRKEXINTERFACES_ITRKEXTRAPOLATOR_H diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.icc b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.icc new file mode 100644 index 0000000000000000000000000000000000000000..131c1957700fc8190bc69878931e06b44197a972 --- /dev/null +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.icc @@ -0,0 +1,319 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// IExtrapolator.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +/** [TrackParameters] old interfaces WITHOUT EventContext ------------------------------------------ */ + + +/** xAOD 0) xAOD track particle */ +inline const Trk::TrackParameters* +Trk::IExtrapolator::extrapolate(const xAOD::TrackParticle& particleBase, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + Trk::MaterialUpdateMode matupmode) const +{ + return extrapolate( Gaudi::Hive::currentContext(), + particleBase, + sf, + dir, + bcheck, + particle, + matupmode); +} + + + + +/** 1) <b>Configured AlgTool extrapolation method</b>): + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + nullptr if extrapolation to destination surface does not succeed */ +inline const Trk::TrackParameters* +Trk::IExtrapolator::extrapolate(const TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + Trk::MaterialUpdateMode matupmode, + Trk::ExtrapolationCache* cache) const +{ + return extrapolate( Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + particle, + matupmode, + cache); +} + + +/** 2) <b>Configured AlgTool extrapolation method</b>): + - returns a vector of TrackParameters representing the tracking detector elements + hit in between and the TrackParameters at the destination Surface (if final extrapolation suceeds), + empty if the extrapolation to the destination surface does not suceed*/ +inline std::vector<std::unique_ptr<const Trk::TrackParameters>> Trk::IExtrapolator::extrapolateStepwise( + const TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const +{ + return extrapolateStepwise(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + particle); +} + +/** 3) <b>Configured AlgTool extrapolation method</b>): + - searches the closest TrackParameters of the Track to the destination Surface + - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), + 0 if extrapolation to destination surface does not suceed */ +inline const Trk::TrackParameters* Trk::IExtrapolator::extrapolate(const Track& trk, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + Trk::MaterialUpdateMode matupmode, + Trk::ExtrapolationCache* cache) const +{ + return extrapolate(Gaudi::Hive::currentContext(), + trk, + sf, + dir, + bcheck, + particle, + matupmode, + cache); +} + +/** 4) <b>Configured AlgTool extrapolation method</b>): + - direct extrapolation to the destination surface, no material effects + or intermediate steps are taken into account +*/ +inline Trk::TrackParameters* Trk::IExtrapolator::extrapolateDirectly(const TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const +{ + return extrapolateDirectly(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + particle); +} + +/** 4.1) <b>Configured AlgTool extrapolation method</b>): + Same as 4 but with propagator arguement (needed by a single client TRT_TrackExtensionToolCosmics +*/ +inline Trk::TrackParameters* Trk::IExtrapolator::extrapolateDirectly(const IPropagator& prop, + const TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const +{ + return extrapolateDirectly(Gaudi::Hive::currentContext(), + prop, + parm, + sf, + dir, + bcheck, + particle); +} + +/** 5) <b>Configured AlgTool extrapolation method</b>): + - blind inside the given tracking Volume (boundaryVol), + if none is given the reference surface for destination is used +*/ +inline std::vector<std::unique_ptr<const Trk::TrackParameters>> Trk::IExtrapolator::extrapolateBlindly( + const TrackParameters& parm, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + const Volume* boundaryVol) const +{ + return extrapolateBlindly(Gaudi::Hive::currentContext(), + parm, + dir, + bcheck, + particle, + boundaryVol); +} + +/** 6) <b>Configured AlgTool extrapolation method</b>): + *- extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification*/ +inline std::pair<const Trk::TrackParameters*, const Trk::Layer*> Trk::IExtrapolator::extrapolateToNextActiveLayer( + const TrackParameters& parm, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + Trk::MaterialUpdateMode matupmode) const +{ + return extrapolateToNextActiveLayer(Gaudi::Hive::currentContext(), + parm, + dir, + bcheck, + particle, + matupmode); +} + +/** 7) <b>Configured AlgTool extrapolation method</b>):*/ +inline std::pair<const Trk::TrackParameters*, const Trk::Layer*> Trk::IExtrapolator::extrapolateToNextActiveLayerM( + const TrackParameters& parm, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + Trk::ParticleHypothesis particle, + Trk::MaterialUpdateMode matupmode) const +{ + return extrapolateToNextActiveLayerM(Gaudi::Hive::currentContext(), + parm, + dir, + bcheck, + material, + particle, + matupmode); +} + +/** 8) <b>Configured AlgTool extrapolation method</b> ): + - extrapolation to the next active layer, based on the extrapolation to the next layer + and layer identification + * */ +inline const Trk::TrackParameters* Trk::IExtrapolator::extrapolateToVolume(const TrackParameters& parm, + const Trk::TrackingVolume& vol, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle) const +{ + return extrapolateToVolume(Gaudi::Hive::currentContext(), + parm, + vol, + dir, + particle); +} + +/** 9) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers in between. +*/ +inline std::vector<const Trk::TrackStateOnSurface*>* Trk::IExtrapolator::extrapolateM(const TrackParameters& parameters, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + Trk::ExtrapolationCache* cache) const +{ + return extrapolateM(Gaudi::Hive::currentContext(), + parameters, + sf, + dir, + bcheck, + particle, + cache); +} + +/** 10) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in + between. +*/ +inline std::vector<const Trk::TrackParameters*>* Trk::IExtrapolator::extrapolateM(const TrackParameters& parameters, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<MaterialEffectsOnTrack>& material, + std::vector<Trk::TransportJacobian*>& jacs, + Trk::ParticleHypothesis particle, + Trk::ExtrapolationCache* cache) const +{ + return extrapolateM(Gaudi::Hive::currentContext(), + parameters, + sf, + dir, + bcheck, + material, + jacs, + particle, + cache); +} + +inline const Trk::TrackParameters* Trk::IExtrapolator::extrapolateWithPathLimit( + const Trk::TrackParameters& parm, + double& pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackParameters*>*& parmOnSf, + std::vector<const Trk::TrackStateOnSurface*>*& material, + const Trk::TrackingVolume* boundaryVol, + Trk::MaterialUpdateMode matupmod) const +{ + return extrapolateWithPathLimit(Gaudi::Hive::currentContext(), + parm, + pathLim, + dir, + particle, + parmOnSf, + material, + boundaryVol, + matupmod); +} + +/** extrapolation method collecting intersections with subdetector boundaries and active volumes/layers. + A primitive identification is provided - to be replaced with appropriate identifier, and possibly merged + with TrackParameters. Material collection in option. Destination (subdetector boundary) : geoID (exit) +*/ +inline const std::vector<std::pair<const Trk::TrackParameters*, int>>* Trk::IExtrapolator::extrapolate( + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackStateOnSurface*>*& material, + int destination) const +{ + return extrapolate(Gaudi::Hive::currentContext(), + parm, + dir, + particle, + material, + destination); +} + + + + + + + +inline const Trk::TrackParameters* +Trk::IExtrapolator::extrapolateWithPathLimit(const EventContext& /*ctx*/, + const Trk::TrackParameters& /*parm*/, + double& /*pathLim*/, + Trk::PropDirection /*dir*/, + Trk::ParticleHypothesis /*particle*/, + std::vector<const Trk::TrackParameters*>*& /*parmOnSf*/, + std::vector<const Trk::TrackStateOnSurface*>*& /*material*/, + const Trk::TrackingVolume* /*boundaryVol*/, + Trk::MaterialUpdateMode /*matupmod*/) const +{ + std::cout << "CONFIGURATION ERROR: dummy version of extrapolation-with-path-limit method called " << std::endl; + return 0; +} + +inline const std::vector<std::pair<const Trk::TrackParameters*, int>>* +Trk::IExtrapolator::extrapolate(const EventContext& /*ctx*/, + const Trk::TrackParameters& /*parm*/, + Trk::PropDirection /*dir*/, + Trk::ParticleHypothesis /*particle*/, + std::vector<const Trk::TrackStateOnSurface*>*& /*material*/, + int /*destination*/) const +{ + std::cout << "CONFIGURATION ERROR: dummy version of extrapolation through active regions called " << std::endl; + return 0; +} diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h index 8c8cc6843a32dc33054109e33903baa8c8e2e072..0f1ff35cb98d26594f498ba8a5461938b20f6c7a 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -12,8 +12,8 @@ // Gaudi #include "GaudiKernel/IAlgTool.h" // Trk -#include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/ParticleHypothesis.h" +#include "TrkEventPrimitives/PropDirection.h" #include "TrkExUtils/MaterialUpdateMode.h" #include "TrkParameters/TrackParameters.h" #include <memory> @@ -22,80 +22,82 @@ namespace Trk { class Layer; class MaterialProperties; -class MaterialEffectsOnTrack; +class MaterialEffectsOnTrack; -/** Interface ID for IMaterialEffectsUpdator*/ +/** Interface ID for IMaterialEffectsUpdator*/ static const InterfaceID IID_IMaterialEffectsUpdator("IMaterialEffectsUpdator", 1, 0); /** @class IMaterialEffectsUpdator Interface class for the updater AlgTool, it inherits from IAlgTool - Detailed information about private members and member functions can be found in the actual implementation class - MaterialUpdator which inherits from this one. + Detailed information about private members and member functions can be found in the actual + implementation class MaterialEffectsUpdator which inherits from this one. @author Andreas.Salzburger@cern.ch + @author Christos Anastopoulos (Athena MT) */ -class IMaterialEffectsUpdator : virtual public IAlgTool { +class IMaterialEffectsUpdator : virtual public IAlgTool +{ public: /**Virtual destructor*/ - virtual ~IMaterialEffectsUpdator(){} + virtual ~IMaterialEffectsUpdator() {} /** AlgTool and IAlgTool interface methods */ static const InterfaceID& interfaceID() { return IID_IMaterialEffectsUpdator; } - /** Updator interface (full update for a layer): The parmeters are given as a pointer, they are delete inside the update method. Layer-based material update */ - virtual const TrackParameters* update( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + virtual const TrackParameters* update(const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** User updator interface (full update for a layer): The parmeters are given as a pointer, they are deleted inside the update method. - Update occurs on the place where the parameters parm are according to the specified MaterialEffectsOnTrack + Update occurs on the place where the parameters parm are according to the specified + MaterialEffectsOnTrack */ - virtual const TrackParameters* update( const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0 ; + virtual const TrackParameters* update(const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): The parmeters are given as a pointer, they are delete inside the update method. Layer-based material update */ - virtual const TrackParameters* preUpdate( const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + virtual const TrackParameters* preUpdate(const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): The parmeters are given as a pointer, they are delete inside the update method. Layer-based material update if the postUpdate fails, it returns 0 */ - virtual const TrackParameters* postUpdate(const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + virtual const TrackParameters* postUpdate(const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface: The parmeters are given as a pointer, they are delete inside the update method. MaterialProperties based material update - used by all Layer-based methods */ - virtual const TrackParameters* update( const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + virtual const TrackParameters* update(const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Validation Action: - outside access to internal validation steps + outside access to internal validation steps Optional */ virtual void validationAction() const = 0; @@ -103,64 +105,73 @@ public: * doing non-local MaterialEffectsUpdates for different models * Optional */ - virtual void modelAction(const TrackParameters* parm=0) const = 0; + virtual void modelAction(const TrackParameters* parm = nullptr) const = 0; - /** Interfaces for clients using a local cache. - * Tools implementing these interface should derive from the ICache - * and then override the getCache method . - */ + /** Interfaces for clients using a local cache.*/ - class ICache{ + /** + * The cache class + */ + class ICache + { public: - virtual ~ICache(){} + enum MaterialCacheType + { + MaterialEffects = 0, + DummyMaterialEffects = 1 + }; + virtual MaterialCacheType type() const = 0; + virtual ~ICache() = default; + protected: - ICache()=default; + ICache() = default; }; - virtual std::unique_ptr<ICache> getCache() const =0; - - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0 ; - - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; - - - virtual const TrackParameters* preUpdate(ICache& icache, const TrackParameters* parm, + virtual std::unique_ptr<ICache> getCache() const = 0; + + virtual const TrackParameters* update(ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + virtual const TrackParameters* update(ICache& icache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + virtual const TrackParameters* preUpdate(ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + virtual const TrackParameters* postUpdate(ICache& icache, + const TrackParameters& parm, const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; - - virtual const TrackParameters* postUpdate(ICache& icache,const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; - - - virtual const TrackParameters* update(ICache& icache, const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const = 0; + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + virtual const TrackParameters* update(ICache& icache, + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Validation Action: */ - virtual void validationAction(ICache& icache) const = 0; + virtual void validationAction(ICache& icache) const = 0; /** Model Action:*/ - virtual void modelAction(ICache& icache,const TrackParameters* parm=0) const = 0; + virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const = 0; }; } // end of namespace - #endif // TRKEXINTERFACES_MATERIALEFFECTSUPDATOR_H - diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.h index e3cdf3ce4a01c88ce22ce8942005c75d852700ab..3fcfc1d67079db78d60663bddac0ccf2b7e0adc0 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.h @@ -9,124 +9,178 @@ #ifndef TRKDETDESCRINTERFACES_INAVIGATOR_H #define TRKDETDESCRINTERFACES_INAVIGATOR_H -// GeoPrimitives -#include "GeoPrimitives/GeoPrimitives.h" // Gaudi #include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ThreadLocalContext.h" +// GeoPrimitives +#include "GeoPrimitives/GeoPrimitives.h" // Trk #include "TrkEventPrimitives/ParticleHypothesis.h" +#include "TrkParameters/TrackParameters.h" #include "TrkVolumes/BoundarySurface.h" #include "TrkVolumes/BoundarySurfaceFace.h" -#include "TrkParameters/TrackParameters.h" // STL #include <utility> namespace Trk { - class IPropagator; - class Surface; - class Track; - //class TrackParameters; - class TrackingVolume; - class TrackingGeometry; - class DetachedTrackingVolume; - - /**useful struct for a single navigation cell*/ - struct NavigationCell { - - const TrackingVolume* nextVolume; - const TrackParameters* parametersOnBoundary; - BoundarySurfaceFace exitFace; - /** Constructor */ - NavigationCell(const TrackingVolume* nVol, - const TrackParameters* lPar, - BoundarySurfaceFace face=undefinedFace ) : - nextVolume(nVol), - parametersOnBoundary(lPar), - exitFace(face) - {} - - }; - - typedef std::pair<int,const NavigationCell*> IdNavigationCell; - - /** Interface ID for INavigator */ - static const InterfaceID IID_INavigator("INavigator", 1, 0); - - /** @class INavigator - Interface class for the navigation AlgTool, it inherits from IAlgTool - Detailed information about private members and member functions can be - found in the actual implementation class Trk::Navigator which inherits from this one. - - @author Andreas.Salzburger@cern.ch - */ - class INavigator : virtual public IAlgTool { - public: - - /**Virtual destructor*/ - virtual ~INavigator(){} - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_INavigator; } - - /** INavigator interface method - returns the TrackingGeometry used for navigation */ - virtual const TrackingGeometry* trackingGeometry() const = 0; - - /** INavigator interface method - global search for the Volume one is in */ - virtual const TrackingVolume* volume(const Amg::Vector3D& gp) const = 0; - - /** INavigator interface method - forward hightes TrackingVolume */ - virtual const TrackingVolume* highestVolume() const = 0; - - /** INavigator interface method - getting the next BoundarySurface not knowing the Volume*/ - virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir) const = 0; - - /** INavigator interface method - getting the next BoundarySurface when knowing the Volume*/ - virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir, - const TrackingVolume& vol ) const = 0; - - /** INavigator interface method - - getting the next Volume and the parameter for the next Navigation */ - virtual NavigationCell nextTrackingVolume(const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir, - const TrackingVolume& vol) const = 0; - - /** INavigator interface method - getting the next Volume and the parameter for the next Navigation - - contains full loop over volume boundaries - */ - virtual NavigationCell nextDenseTrackingVolume( const IPropagator& prop, - const TrackParameters& parms, - const Surface* destination, - PropDirection dir, - ParticleHypothesis particle, - const TrackingVolume& vol, - double& path) const=0; - - /** INavigator interface method - getting the closest TrackParameters from a Track to a Surface */ - virtual const TrackParameters* closestParameters( const Track& trk, - const Surface& sf, - const IPropagator* prop = 0) const = 0; - - /** INavigator method to resolve navigation at boundary */ - virtual bool atVolumeBoundary( const Trk::TrackParameters* parms, - const Trk::TrackingVolume* vol, - Trk::PropDirection dir, - const Trk::TrackingVolume*& nextVol, - double tol) const = 0; - - /** Validation Action: - Can be implemented optionally, outside access to internal validation steps */ - virtual void validationAction() const = 0; - - }; - +class IPropagator; +class Surface; +class Track; +// class TrackParameters; +class TrackingVolume; +class TrackingGeometry; +class DetachedTrackingVolume; + +/**useful struct for a single navigation cell*/ +struct NavigationCell +{ + + const TrackingVolume* nextVolume; + const TrackParameters* parametersOnBoundary; + BoundarySurfaceFace exitFace; + /** Constructor */ + NavigationCell(const TrackingVolume* nVol, + const TrackParameters* lPar, + BoundarySurfaceFace face = undefinedFace) + : nextVolume(nVol) + , parametersOnBoundary(lPar) + , exitFace(face) + {} +}; + +typedef std::pair<int, const NavigationCell*> IdNavigationCell; + +/** Interface ID for INavigator */ +static const InterfaceID IID_INavigator("INavigator", 1, 0); + +/** @class INavigator + Interface class for the navigation AlgTool, it inherits from IAlgTool + Detailed information about private members and member functions can be + found in the actual implementation class Trk::Navigator which inherits from + this one. + + @author Andreas.Salzburger@cern.ch + */ +class INavigator : virtual public IAlgTool +{ +public: + /**Virtual destructor*/ + virtual ~INavigator() {} + + /** AlgTool and IAlgTool interface methods */ + static const InterfaceID& interfaceID() { return IID_INavigator; } + + /** INavigator interface method - returns the TrackingGeometry used for + * navigation */ + virtual const TrackingGeometry* trackingGeometry() const = 0; + + /** INavigator interface method - global search for the Volume one is in */ + virtual const TrackingVolume* volume(const Amg::Vector3D& gp) const = 0; + + /** INavigator interface method - forward hightes TrackingVolume */ + virtual const TrackingVolume* highestVolume() const = 0; + + /** INavigator interface method - getting the closest TrackParameters from a + * Track to a Surface */ + virtual const TrackParameters* closestParameters( + const Track& trk, + const Surface& sf, + const IPropagator* prop = 0) const = 0; + + + /** INavigator method to resolve navigation at boundary */ + virtual bool atVolumeBoundary(const Trk::TrackParameters* parms, + const Trk::TrackingVolume* vol, + Trk::PropDirection dir, + const Trk::TrackingVolume*& nextVol, + double tol) const = 0; + + /** Validation Action: + Can be implemented optionally, outside access to internal validation + steps */ + virtual void validationAction() const = 0; + + + /** INavigator interface method - getting the next BoundarySurface not knowing + * the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir) const = 0; + + /** INavigator interface method - getting the next BoundarySurface when + * knowing the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const = 0; + + /** INavigator interface method - - getting the next Volume and the parameter + * for the next Navigation */ + virtual NavigationCell nextTrackingVolume( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const = 0; + + /** INavigator interface method - getting the next Volume and the parameter + for the next Navigation + - contains full loop over volume boundaries + */ + virtual NavigationCell nextDenseTrackingVolume(const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + const Surface* destination, + PropDirection dir, + ParticleHypothesis particle, + const TrackingVolume& vol, + double& path) const = 0; + + /** INavigator interface method - getting the next BoundarySurface not knowing + * the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir) const; + + /** INavigator interface method - getting the next BoundarySurface when + * knowing the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const; + + /** INavigator interface method - - getting the next Volume and the parameter + * for the next Navigation */ + virtual NavigationCell nextTrackingVolume( + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const; + + /** INavigator interface method - getting the next Volume and the parameter + for the next Navigation + - contains full loop over volume boundaries + */ + virtual NavigationCell nextDenseTrackingVolume(const IPropagator& prop, + const TrackParameters& parms, + const Surface* destination, + PropDirection dir, + ParticleHypothesis particle, + const TrackingVolume& vol, + double& path) const; + +}; } // end of namespace +#include "TrkExInterfaces/INavigator.icc" #endif // TRKDETDESCRINTERFACES_INAVIGATOR_H - diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.icc b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.icc new file mode 100644 index 0000000000000000000000000000000000000000..a9b9ddd34cf2afae18fdef2377b663090275f60a --- /dev/null +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/INavigator.icc @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/* + * Implementation of interfaces without Gaudi Context + * in terms of the Gaudi Context aware ones + */ +namespace Trk { +/** INavigator interface method - getting the next BoundarySurface not knowing + * the Volume*/ +inline const BoundarySurface<TrackingVolume>* +INavigator::nextBoundarySurface(const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir) const +{ + return nextBoundarySurface(Gaudi::Hive::currentContext(), prop, parms, dir); +} + +/** INavigator interface method - getting the next BoundarySurface when + * knowing the Volume*/ +inline const BoundarySurface<TrackingVolume>* +INavigator::nextBoundarySurface(const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const +{ + + return nextBoundarySurface( + Gaudi::Hive::currentContext(), prop, parms, dir, vol); +} + +/** INavigator interface method - - getting the next Volume and the parameter + * for the next Navigation */ +inline NavigationCell +INavigator::nextTrackingVolume(const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const +{ + + return nextTrackingVolume( + Gaudi::Hive::currentContext(),prop,parms, dir, vol); +} + +/** INavigator interface method - getting the next Volume and the parameter + for the next Navigation + - contains full loop over volume boundaries +*/ +inline NavigationCell +INavigator::nextDenseTrackingVolume(const IPropagator& prop, + const TrackParameters& parms, + const Surface* destination, + PropDirection dir, + ParticleHypothesis particle, + const TrackingVolume& vol, + double& path) const +{ + + return nextDenseTrackingVolume(Gaudi::Hive::currentContext(), + prop, + parms, + destination, + dir, + particle, + vol, + path); +} + + +} diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.h index d55c9dffc15b736caac180e6af23091ad4091e72..da03f25f14301e3198ba995bda968b481c7a1a5a 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.h @@ -10,899 +10,485 @@ #define TRKEXINTERFACES_IPROPAGATOR_H // Gaudi -#include "GaudiKernel/IAlgTool.h" #include "GaudiKernel/EventContext.h" +#include "GaudiKernel/IAlgTool.h" #include "GaudiKernel/ThreadLocalContext.h" // Trk -#include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/ParticleHypothesis.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkNeutralParameters/NeutralParameters.h" -#include "TrkSurfaces/BoundaryCheck.h" -#include "TrkExUtils/TrackSurfaceIntersection.h" +#include "TrkEventPrimitives/PropDirection.h" +#include "TrkExInterfaces/HelperStructs.h" #include "TrkExUtils/ExtrapolationCache.h" #include "TrkExUtils/TargetSurfaces.h" -#include "HelperStructs.h" +#include "TrkExUtils/TrackSurfaceIntersection.h" +#include "TrkNeutralParameters/NeutralParameters.h" +#include "TrkParameters/TrackParameters.h" +#include "TrkSurfaces/BoundaryCheck.h" // STL #include <utility> namespace Trk { - class Surface; - class CylinderBounds; - class MagneticFieldProperties; - class IntersectionSolution; - class TransportJacobian; - class TrackStateOnSurface; - - /** typedef for return type TrackParameters, pathlength */ - typedef std::pair< const TrackParameters*, double > TrackParametersWithPath; +class Surface; +class CylinderBounds; +class MagneticFieldProperties; +class IntersectionSolution; +class TransportJacobian; +class TrackStateOnSurface; - /** typedef for input surfaces, boundary check */ - typedef std::pair< const Surface*, BoundaryCheck > DestSurf; +/** typedef for return type TrackParameters, pathlength */ +typedef std::pair<const TrackParameters*, double> TrackParametersWithPath; +/** typedef for input surfaces, boundary check */ +typedef std::pair<const Surface*, BoundaryCheck> DestSurf; - /** Interface ID for IPropagators*/ - static const InterfaceID IID_IPropagator("IPropagator", 1, 0); - - /** @class IPropagator - Interface class IPropagators - It inherits from IAlgTool. +/** Interface ID for IPropagators*/ +static const InterfaceID IID_IPropagator("IPropagator", 1, 0); +/** @class IPropagator + Interface class IPropagators + It inherits from IAlgTool. + + */ +class IPropagator : virtual public IAlgTool +{ +public: + /**Virtual destructor*/ + virtual ~IPropagator() {} + + /** AlgTool and IAlgTool interface methods */ + static const InterfaceID& interfaceID() { return IID_IPropagator; } + + /** [NeutralParameters] + * ------------------------------------------------------------- */ + + /** N 0) <b>Neutral parameters method </b> + - returns a ParametersBase object as well, 0 if the extrapolation did not + succeed */ - class IPropagator : virtual public IAlgTool { - public: - - /**Virtual destructor*/ - virtual ~IPropagator(){} - - /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_IPropagator; } - - /** [NeutralParameters] ------------------------------------------------------------- */ - - /** N 0) <b>Neutral parameters method </b> - - returns a ParametersBase object as well, 0 if the extrapolation did not succeed - */ - - virtual NeutralParameters* propagate(const NeutralParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - bool returnCurv = false) const = 0; - - /** N 0) <b>Neutral parameters method </b> - - symmetric interface for new Extrapolation engine - */ - - NeutralParameters* propagate(const NeutralParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties&, - ParticleHypothesis, - bool returnCurv, - const TrackingVolume* tVol=nullptr) const - { //avoid warning for tVol - return propagate(parameters,sf,dir,bcheck,returnCurv); - if (tVol) return nullptr; - } - - /** [TrackParameters] new interfaces WITH EventContext ------------------------------------------ */ - - /** Propagation interface: - The propagation method called by the TrkExtrapolator. The extrapolator - is responsible for the underlying logic of which surface to go to. - */ - virtual TrackParameters* propagate( const EventContext& ctx, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr) const = 0; - - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. - */ - virtual TrackParameters* propagate( const EventContext& ctx, - const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - double& path, - bool usePathLim = false, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr) const = 0; - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. Timing included. - */ - virtual TrackParameters* propagateT( const EventContext& ctx, - const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - const TrackingVolume* tVol, - std::vector<Trk::HitInfo>*& hitVector) const; - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. Timing included. - */ - virtual TrackParameters* propagateT( const EventContext& ctx, - const TrackParameters& parm, - TargetSurfaces& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - TargetSurfaceVector& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - std::vector<Trk::HitInfo>*& hitVector) const; - - - /** Propagation interface: - - The propagation method called by the TrkExEngine. All options included. - */ - virtual Trk::ExtrapolationCode propagate( const EventContext& ctx, - Trk::ExCellCharged& eCell, - Trk::TargetSurfaces& sfs, - Trk::TargetSurfaceVector& solutions) const; - /** Propagation interface: - - The propagation method with internal material collection. The propagator - finds the closest surface. - */ - virtual TrackParameters* propagateM( const EventContext& ctx, - const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - std::vector<const Trk::TrackStateOnSurface*>*& matstates, - std::vector<std::pair<const Trk::TrackParameters*,int> >*& intersections, - double& path, - bool usePathLim = false, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr, - Trk::ExtrapolationCache* cache = nullptr) const; - - - /** Propagation interface: - - The propagation method including the return of the TransportJacobian matrix. - - */ - virtual TrackParameters* propagate( const EventContext& ctx, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - TransportJacobian*& jacob, - double& pathLength, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol = 0) const = 0; - - - /** Propagation interface without Covariance matrix propagation - the pathlength has to be returned for eventual following propagateCovariance - */ - - virtual TrackParameters* propagateParameters( const EventContext& ctx, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle=pion, - bool returnCurv = false, - const TrackingVolume* tVol=0) const = 0; - - virtual TrackParameters* propagateParameters( const EventContext& ctx, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - TransportJacobian*& jacob, - ParticleHypothesis particle=pion, - bool returnCurv = false, - const TrackingVolume* tVol=0) const = 0; - - - /** Intersection interface: - - The intersection interface might be used by the material service as well to estimate - the surfaces (sensitive and nonesensitive) while propagation - */ - virtual const IntersectionSolution* intersect( const EventContext& ctx, - const TrackParameters& parm, - const Surface& sf, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle=pion, - const TrackingVolume* tVol=0) const = 0; - - /** Intersection and Intersector interface: - */ - - virtual const TrackSurfaceIntersection* intersectSurface(const EventContext& ctx, - const Surface& surface, - const TrackSurfaceIntersection* trackIntersection, - const double qOverP, - const MagneticFieldProperties& mft, - ParticleHypothesis particle) const = 0; - - - /** GlobalPositions list interface: - This is used mostly in pattern recognition in the road finder, the propagation direction is intrinsically given - by the sign of the stepSize. - - To avoid memory fragmentation in multiple use of pattern recognition processes and respecting the possible iterative - filling of the positions list, the list of GlobalPositions is given by reference through the signature and a void - method has been chosen. - */ - virtual void globalPositions(const EventContext& ctx, - std::list<Amg::Vector3D>& positionslist, - const TrackParameters& parm, - const MagneticFieldProperties& mprop, - const CylinderBounds& cylbo, - double stepSize, - ParticleHypothesis particle=pion, - const TrackingVolume* tVol=0) const = 0; - - /** a very simple propagation along a given path length */ - virtual void propagateStep(const EventContext& ctx, - const Amg::Vector3D& inputPosition, - const Amg::Vector3D& inputMomentum, - double charge, - double step, - Amg::Vector3D& outputPosition, - Amg::Vector3D& outputMomentum, - const MagneticFieldProperties& mprop) const; - - - /** Validation Action: - Can be implemented optionally, outside access to internal validation steps */ - virtual void validationAction() const {} - - - /** [TrackParameters] old interfaces WITHOUT EventContext ------------------------------------------ */ - - /** Propagation interface: - The propagation method called by the TrkExtrapolator. The extrapolator - is responsible for the underlying logic of which surface to go to. - */ - virtual TrackParameters* propagate( const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol = 0) const; - - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. - */ - virtual TrackParameters* propagate( const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - double& path, - bool usePathLim = false, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr) const; - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. Timing included. - */ - virtual TrackParameters* propagateT( const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - const TrackingVolume* tVol, - std::vector<Trk::HitInfo>*& hitVector) const; - - /** Propagation interface: - - The propagation method called by the TrkExtrapolator. The propagator - finds the closest surface. Timing included. - - */ - virtual TrackParameters* propagateT( const TrackParameters& parm, - TargetSurfaces& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - TargetSurfaceVector& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - std::vector<Trk::HitInfo>*& hitVector) const; - - - /** Propagation interface: - - The propagation method called by the TrkExEngine. All options included. - */ - virtual Trk::ExtrapolationCode propagate( Trk::ExCellCharged& eCell, - Trk::TargetSurfaces& sfs, - Trk::TargetSurfaceVector& solutions) const; - /** Propagation interface: - - The propagation method with internal material collection. The propagator - finds the closest surface. - */ - virtual TrackParameters* propagateM( const TrackParameters& parm, - std::vector<DestSurf>& sfs, - PropDirection dir, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - std::vector<const Trk::TrackStateOnSurface*>*& matstates, - std::vector<std::pair<const Trk::TrackParameters*,int> >*& intersections, - double& path, - bool usePathLim = false, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr, - Trk::ExtrapolationCache* cache = nullptr) const; - - - /** Propagation interface: - - The propagation method including the return of the TransportJacobian matrix. - - */ - virtual TrackParameters* propagate( const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - TransportJacobian*&, - double& pathLength, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr) const; - - - /** Propagation interface without Covariance matrix propagation - the pathlength has to be returned for eventual following propagateCovariance - */ - - virtual TrackParameters* propagateParameters( const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol=nullptr) const; - - virtual TrackParameters* propagateParameters( const TrackParameters& parm, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - const MagneticFieldProperties& mprop, - TransportJacobian*&, - ParticleHypothesis particle = pion, - bool returnCurv = false, - const TrackingVolume* tVol = nullptr) const; - - - /** Intersection interface: - - The intersection interface might be used by the material service as well to estimate - the surfaces (sensitive and nonesensitive) while propagation - */ - virtual const IntersectionSolution* intersect( const TrackParameters& parm, - const Surface& sf, - const MagneticFieldProperties& mprop, - ParticleHypothesis particle = pion, - const TrackingVolume* tVol = nullptr) const; - - /** Intersection and Intersector interface: - */ - - virtual const TrackSurfaceIntersection* intersectSurface(const Surface& surface, - const TrackSurfaceIntersection* trackIntersection, - const double qOverP, - const MagneticFieldProperties& mft, - ParticleHypothesis particle) const; - - - /** GlobalPositions list interface: - This is used mostly in pattern recognition in the road finder, the propagation direction is intrinsically given - by the sign of the stepSize. - - To avoid memory fragmentation in multiple use of pattern recognition processes and respecting the possible iterative - filling of the positions list, the list of GlobalPositions is given by reference through the signature and a void - method has been chosen. - */ - virtual void globalPositions(std::list<Amg::Vector3D>& positionslist, - const TrackParameters& parm, - const MagneticFieldProperties& mprop, - const CylinderBounds& cylbo, - double stepSize, - ParticleHypothesis particle = pion, - const TrackingVolume* tVol = nullptr) const; - - /** a very simple propagation along a given path length */ - virtual void propagateStep(const Amg::Vector3D& inputPosition, - const Amg::Vector3D& inputMomentum, - double charge, - double step, - Amg::Vector3D& outputPosition, - Amg::Vector3D& outputMomentum, - const MagneticFieldProperties& mprop) const; - - - }; -} // end of namespace + virtual NeutralParameters* propagate(const NeutralParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + bool returnCurv = false) const = 0; -// default methods for some methods which will not always be implemented - -inline Trk::TrackParameters* Trk::IPropagator::propagate( const EventContext&, - const TrackParameters&, - std::vector<DestSurf>&, - PropDirection , - const MagneticFieldProperties&, - ParticleHypothesis, - std::vector<unsigned int>&, - double&, - bool, - bool, - const Trk::TrackingVolume*) const -{ - return nullptr; -} - -inline Trk::TrackParameters* Trk::IPropagator::propagateT( const EventContext&, - const TrackParameters&, - std::vector<DestSurf>&, - PropDirection , - const MagneticFieldProperties&, - ParticleHypothesis, - std::vector<unsigned int>&, - PathLimit&, TimeLimit&, - bool,const Trk::TrackingVolume*, - std::vector<Trk::HitInfo>*&) const -{ - return nullptr; -} - -inline Trk::TrackParameters* Trk::IPropagator::propagateT( const EventContext&, - const TrackParameters& , - Trk::TargetSurfaces& , - PropDirection , - const MagneticFieldProperties& , - ParticleHypothesis , - Trk::TargetSurfaceVector& , - PathLimit& , TimeLimit& , - bool,std::vector<Trk::HitInfo>*& ) const -{ - return nullptr; -} + /** N 0) <b>Neutral parameters method </b> + - symmetric interface for new Extrapolation engine + */ + + NeutralParameters* propagate(const NeutralParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties&, + ParticleHypothesis, + bool returnCurv, + const TrackingVolume* tVol = nullptr) const + { // avoid warning for tVol + return propagate(parameters, sf, dir, bcheck, returnCurv); + if (tVol) + return nullptr; + } + + /** [TrackParameters] new interfaces WITH EventContext + * ------------------------------------------ */ + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The extrapolator + is responsible for the underlying logic of which surface to go to. + */ + virtual TrackParameters* propagate( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const = 0; + + /** Propagation interface: -inline Trk::ExtrapolationCode Trk::IPropagator::propagate( const EventContext&, - Trk::ExCellCharged& , - Trk::TargetSurfaces&, - Trk::TargetSurfaceVector& ) const -{ - return Trk::ExtrapolationCode::FailureConfiguration; -} - -inline Trk::TrackParameters* Trk::IPropagator::propagateM( const EventContext&, - const TrackParameters&, - std::vector<DestSurf>&, - PropDirection , - const MagneticFieldProperties&, - ParticleHypothesis, - std::vector<unsigned int>&, - std::vector<const Trk::TrackStateOnSurface*>*&, - std::vector<std::pair<const Trk::TrackParameters*,int> >*& , - double&, - bool, - bool, - const Trk::TrackingVolume*, - Trk::ExtrapolationCache*) const -{ - return nullptr; -} - - -/** a very simple propagation along a given path length */ -inline void Trk::IPropagator::propagateStep(const EventContext&, - const Amg::Vector3D&, - const Amg::Vector3D&, - double, - double, - Amg::Vector3D&, - Amg::Vector3D&, - const MagneticFieldProperties&) const {} - - - -/** [TrackParameters] new interfaces WITH EventContext ------------------------------------------ */ -/** temporarily default to old interfaces, taking the EventContext from GaudiHive */ - -// Propagation interface: -// The propagation method called by the TrkExtrapolator. The extrapolator -// is responsible for the underlying logic of which surface to go to. - -inline Trk::TrackParameters* -Trk::IPropagator::propagate( const Trk::TrackParameters& parm, - const Trk::Surface& sf, - Trk::PropDirection dir, - const BoundaryCheck& bcheck, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - bool returnCurv, - const Trk::TrackingVolume* tVol) const -{ - return propagate( Gaudi::Hive::currentContext(), - parm, - sf, - dir, - bcheck, - mprop, - particle, - returnCurv, - tVol); -} - - - -/** Propagation interface: - The propagation method called by the TrkExtrapolator. The propagator finds the closest surface. -*/ -inline Trk::TrackParameters* -Trk::IPropagator::propagate( const Trk::TrackParameters& parm, - std::vector<Trk::DestSurf>& sfs, - Trk::PropDirection dir, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - double& path, - bool usePathLim, - bool returnCurv, - const Trk::TrackingVolume* tVol) const -{ - - return propagate( Gaudi::Hive::currentContext(), - parm, - sfs, - dir, - mprop, - particle, - solutions, - path, - usePathLim, - returnCurv, - tVol); -} - - -/** Propagation interface: - + */ + virtual TrackParameters* propagate( + const EventContext& ctx, + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + double& path, + bool usePathLim = false, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const = 0; + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator finds the closest surface. Timing included. -*/ -inline Trk::TrackParameters* -Trk::IPropagator::propagateT( const Trk::TrackParameters& parm, - std::vector<Trk::DestSurf>& sfs, - Trk::PropDirection dir, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - const Trk::TrackingVolume* tVol, - std::vector<Trk::HitInfo>*& hitVector) const -{ - - return propagateT( Gaudi::Hive::currentContext(), - parm, - sfs, - dir, - mprop, - particle, - solutions, - pathLim, timeLim, - returnCurv , - tVol, - hitVector); -} - - -/** Propagation interface: - + */ + virtual TrackParameters* propagateT( + const EventContext& ctx, + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + const TrackingVolume* tVol, + std::vector<Trk::HitInfo>*& hitVector) const; + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator finds the closest surface. Timing included. -*/ -inline Trk::TrackParameters* -Trk::IPropagator::propagateT( const Trk::TrackParameters& parm, - Trk::TargetSurfaces& sfs, - Trk::PropDirection dir, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - TargetSurfaceVector& solutions, - PathLimit& pathLim, TimeLimit& timeLim, - bool returnCurv , - std::vector<Trk::HitInfo>*& hitVector) const -{ - return propagateT( Gaudi::Hive::currentContext(), - parm, - sfs, - dir, - mprop, - particle, - solutions, - pathLim, timeLim, - returnCurv , - hitVector); -} - -/** Propagation interface: - + */ + virtual TrackParameters* propagateT( + const EventContext& ctx, + const TrackParameters& parm, + TargetSurfaces& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + TargetSurfaceVector& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + std::vector<Trk::HitInfo>*& hitVector) const; + + /** Propagation interface: + The propagation method called by the TrkExEngine. All options included. -*/ -inline Trk::ExtrapolationCode -Trk::IPropagator::propagate( Trk::ExCellCharged& eCell, - Trk::TargetSurfaces& sfs, - Trk::TargetSurfaceVector& solutions) const -{ - return propagate( Gaudi::Hive::currentContext(), - eCell, - sfs, - solutions); -} - -/** Propagation interface: - + */ + virtual Trk::ExtrapolationCode propagate( + const EventContext& ctx, + Trk::ExCellCharged& eCell, + Trk::TargetSurfaces& sfs, + Trk::TargetSurfaceVector& solutions) const; + /** Propagation interface: + The propagation method with internal material collection. The propagator - finds the closest surface. -*/ -inline Trk::TrackParameters* -Trk::IPropagator::propagateM( const Trk::TrackParameters& parm, - std::vector<Trk::DestSurf>& sfs, - Trk::PropDirection dir, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - std::vector<unsigned int>& solutions, - std::vector<const Trk::TrackStateOnSurface*>*& matstates, - std::vector<std::pair<const Trk::TrackParameters*,int> >*& intersections, - double& path, - bool usePathLim, - bool returnCurv, - const Trk::TrackingVolume* tVol, - Trk::ExtrapolationCache* cache) const -{ - return propagateM( Gaudi::Hive::currentContext(), - parm, - sfs, - dir, - mprop, - particle, - solutions, - matstates, - intersections, - path, - usePathLim, - returnCurv, - tVol, - cache); -} - - - -/** Propagation interface: - + finds the closest surface. + */ + virtual TrackParameters* propagateM( + const EventContext& ctx, + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + std::vector<const Trk::TrackStateOnSurface*>*& matstates, + std::vector<std::pair<const Trk::TrackParameters*, int>>*& intersections, + double& path, + bool usePathLim = false, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr, + Trk::ExtrapolationCache* cache = nullptr) const; + + /** Propagation interface: + The propagation method including the return of the TransportJacobian matrix. -*/ -inline Trk::TrackParameters* -Trk::IPropagator::propagate( const Trk::TrackParameters& parm, - const Trk::Surface& sf, - Trk::PropDirection dir, - const BoundaryCheck& bcheck, - const Trk::MagneticFieldProperties& mprop, - TransportJacobian*& jacob, - double& pathLength, - Trk::ParticleHypothesis particle, - bool returnCurv, - const Trk::TrackingVolume* tVol) const -{ - return propagate( Gaudi::Hive::currentContext(), - parm, - sf, - dir, - bcheck, - mprop, - jacob, - pathLength, - particle, - returnCurv, - tVol); -} - - - -/** Propagation interface without Covariance matrix propagation + */ + virtual TrackParameters* propagate( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + TransportJacobian*& jacob, + double& pathLength, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const = 0; + + /** Propagation interface without Covariance matrix propagation the pathlength has to be returned for eventual following propagateCovariance -*/ + */ -inline Trk::TrackParameters* -Trk::IPropagator::propagateParameters( const Trk::TrackParameters& parm, - const Trk::Surface& sf, - Trk::PropDirection dir, - const BoundaryCheck& bcheck, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - bool returnCurv, - const Trk::TrackingVolume* tVol) const -{ - return propagateParameters( Gaudi::Hive::currentContext(), - parm, - sf, - dir, - bcheck, - mprop, - particle=pion, - returnCurv, - tVol); -} - - -inline Trk::TrackParameters* -Trk::IPropagator::propagateParameters( const Trk::TrackParameters& parm, - const Trk::Surface& sf, - Trk::PropDirection dir, - const BoundaryCheck& bcheck, - const Trk::MagneticFieldProperties& mprop, - TransportJacobian*& jacob, - Trk::ParticleHypothesis particle, - bool returnCurv, - const Trk::TrackingVolume* tVol) const -{ - return propagateParameters( Gaudi::Hive::currentContext(), - parm, - sf, - dir, - bcheck, - mprop, - jacob, - particle=pion, - returnCurv, - tVol); -} - - - -/** Intersection interface: - - The intersection interface might be used by the material service as well to estimate - the surfaces (sensitive and nonesensitive) while propagation -*/ -inline const Trk::IntersectionSolution* -Trk::IPropagator::intersect( const Trk::TrackParameters& parm, - const Trk::Surface& sf, - const Trk::MagneticFieldProperties& mprop, - Trk::ParticleHypothesis particle, - const Trk::TrackingVolume* tVol) const -{ - return intersect( Gaudi::Hive::currentContext(), - parm, - sf, - mprop, - particle=pion, - tVol); -} - - -/** Intersection and Intersector interface: - */ - -inline const Trk::TrackSurfaceIntersection* -Trk::IPropagator::intersectSurface(const Trk::Surface& surface, - const TrackSurfaceIntersection* trackIntersection, - const double qOverP, - const Trk::MagneticFieldProperties& mft, - Trk::ParticleHypothesis particle) const -{ - return intersectSurface(Gaudi::Hive::currentContext(), - surface, - trackIntersection, - qOverP, - mft, - particle); -} - - - -/** GlobalPositions list interface: - This is used mostly in pattern recognition in the road finder, the propagation direction is intrinsically given - by the sign of the stepSize. - - To avoid memory fragmentation in multiple use of pattern recognition processes and respecting the possible iterative - filling of the positions list, the list of GlobalPositions is given by reference through the signature and a void - method has been chosen. -*/ -inline void -Trk::IPropagator::globalPositions(std::list<Amg::Vector3D>& positionslist, - const Trk::TrackParameters& parm, - const Trk::MagneticFieldProperties& mprop, - const CylinderBounds& cylbo, - double stepSize, - Trk::ParticleHypothesis particle, - const Trk::TrackingVolume* tVol) const -{ - globalPositions(Gaudi::Hive::currentContext(), - positionslist, - parm, - mprop, - cylbo, - stepSize, - particle=pion, - tVol); -} - - -/** a very simple propagation along a given path length */ -inline void -Trk::IPropagator::propagateStep(const Amg::Vector3D& inputPosition, - const Amg::Vector3D& inputMomentum, - double charge, - double step, - Amg::Vector3D& outputPosition, - Amg::Vector3D& outputMomentum, - const Trk::MagneticFieldProperties& mprop) const -{ - propagateStep(Gaudi::Hive::currentContext(), - inputPosition, - inputMomentum, - charge, - step, - outputPosition, - outputMomentum, - mprop); -} + virtual TrackParameters* propagateParameters( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const = 0; + + virtual TrackParameters* propagateParameters( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + TransportJacobian*& jacob, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const = 0; + + /** Intersection interface: + + The intersection interface might be used by the material service as well to + estimate the surfaces (sensitive and nonesensitive) while propagation + */ + virtual const IntersectionSolution* intersect( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + const TrackingVolume* tVol = nullptr) const = 0; + + /** Intersection and Intersector interface: + */ + + virtual const TrackSurfaceIntersection* intersectSurface( + const EventContext& ctx, + const Surface& surface, + const TrackSurfaceIntersection* trackIntersection, + const double qOverP, + const MagneticFieldProperties& mft, + ParticleHypothesis particle) const; + + /** GlobalPositions list interface: + This is used mostly in pattern recognition in the road finder, the + propagation direction is intrinsically given by the sign of the stepSize. + + To avoid memory fragmentation in multiple use of pattern recognition + processes and respecting the possible iterative filling of the positions + list, the list of GlobalPositions is given by reference through the + signature and a void method has been chosen. + */ + virtual void globalPositions(const EventContext& ctx, + std::list<Amg::Vector3D>& positionslist, + const TrackParameters& parm, + const MagneticFieldProperties& mprop, + const CylinderBounds& cylbo, + double stepSize, + ParticleHypothesis particle = pion, + const TrackingVolume* tVol = nullptr) const = 0; + + /** a very simple propagation along a given path length */ + virtual void propagateStep(const EventContext& ctx, + const Amg::Vector3D& inputPosition, + const Amg::Vector3D& inputMomentum, + double charge, + double step, + Amg::Vector3D& outputPosition, + Amg::Vector3D& outputMomentum, + const MagneticFieldProperties& mprop) const; + + /** Validation Action: + Can be implemented optionally, outside access to internal validation steps + */ + virtual void validationAction() const {} + + /** [TrackParameters] old interfaces WITHOUT EventContext + * ------------------------------------------ */ + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The extrapolator + is responsible for the underlying logic of which surface to go to. + */ + virtual TrackParameters* propagate( + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const; + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. + */ + virtual TrackParameters* propagate( + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + double& path, + bool usePathLim = false, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const; + + /** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. Timing included. + */ + virtual TrackParameters* propagateT( + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + const TrackingVolume* tVol, + std::vector<Trk::HitInfo>*& hitVector) const; + + /** Propagation interface: -#endif // TRKEXINTERFACES_PROPAGATOR_H + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. Timing included. + + */ + virtual TrackParameters* propagateT( + const TrackParameters& parm, + TargetSurfaces& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + TargetSurfaceVector& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + std::vector<Trk::HitInfo>*& hitVector) const; + + /** Propagation interface: + + The propagation method called by the TrkExEngine. All options included. + */ + virtual Trk::ExtrapolationCode propagate( + Trk::ExCellCharged& eCell, + Trk::TargetSurfaces& sfs, + Trk::TargetSurfaceVector& solutions) const; + /** Propagation interface: + + The propagation method with internal material collection. The propagator + finds the closest surface. + */ + virtual TrackParameters* propagateM( + const TrackParameters& parm, + std::vector<DestSurf>& sfs, + PropDirection dir, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + std::vector<const Trk::TrackStateOnSurface*>*& matstates, + std::vector<std::pair<const Trk::TrackParameters*, int>>*& intersections, + double& path, + bool usePathLim = false, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr, + Trk::ExtrapolationCache* cache = nullptr) const; + + /** Propagation interface: + + The propagation method including the return of the TransportJacobian matrix. + + */ + virtual TrackParameters* propagate( + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + TransportJacobian*&, + double& pathLength, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const; + + /** Propagation interface without Covariance matrix propagation + the pathlength has to be returned for eventual following propagateCovariance + */ + virtual TrackParameters* propagateParameters( + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const; + + virtual TrackParameters* propagateParameters( + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + const MagneticFieldProperties& mprop, + TransportJacobian*&, + ParticleHypothesis particle = pion, + bool returnCurv = false, + const TrackingVolume* tVol = nullptr) const; + + /** Intersection interface: + + The intersection interface might be used by the material service as well to + estimate the surfaces (sensitive and nonesensitive) while propagation + */ + virtual const IntersectionSolution* intersect( + const TrackParameters& parm, + const Surface& sf, + const MagneticFieldProperties& mprop, + ParticleHypothesis particle = pion, + const TrackingVolume* tVol = nullptr) const; + + /** Intersection and Intersector interface: + */ + + virtual const TrackSurfaceIntersection* intersectSurface( + const Surface& surface, + const TrackSurfaceIntersection* trackIntersection, + const double qOverP, + const MagneticFieldProperties& mft, + ParticleHypothesis particle) const; + + /** GlobalPositions list interface: + This is used mostly in pattern recognition in the road finder, the + propagation direction is intrinsically given by the sign of the stepSize. + + To avoid memory fragmentation in multiple use of pattern recognition + processes and respecting the possible iterative filling of the positions + list, the list of GlobalPositions is given by reference through the + signature and a void method has been chosen. + */ + virtual void globalPositions(std::list<Amg::Vector3D>& positionslist, + const TrackParameters& parm, + const MagneticFieldProperties& mprop, + const CylinderBounds& cylbo, + double stepSize, + ParticleHypothesis particle = pion, + const TrackingVolume* tVol = nullptr) const; + + /** a very simple propagation along a given path length */ + virtual void propagateStep(const Amg::Vector3D& inputPosition, + const Amg::Vector3D& inputMomentum, + double charge, + double step, + Amg::Vector3D& outputPosition, + Amg::Vector3D& outputMomentum, + const MagneticFieldProperties& mprop) const; +}; + +} // end of namespace + +#include "TrkExInterfaces/IPropagator.icc" + +#endif // TRKEXINTERFACES_PROPAGATOR_H diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.icc b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.icc new file mode 100644 index 0000000000000000000000000000000000000000..0e995ee311ddfb3b4433ca099acc8afd08ac4053 --- /dev/null +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IPropagator.icc @@ -0,0 +1,436 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/* + * default implementations + * for some methods which need to be always + * re-implemented. + * + * TODO: Check usage / design causing + * this + */ +inline Trk::TrackParameters* +Trk::IPropagator::propagate(const EventContext&, + const TrackParameters&, + std::vector<DestSurf>&, + PropDirection, + const MagneticFieldProperties&, + ParticleHypothesis, + std::vector<unsigned int>&, + double&, + bool, + bool, + const Trk::TrackingVolume*) const +{ + return nullptr; +} + +inline Trk::TrackParameters* +Trk::IPropagator::propagateT(const EventContext&, + const TrackParameters&, + std::vector<DestSurf>&, + PropDirection, + const MagneticFieldProperties&, + ParticleHypothesis, + std::vector<unsigned int>&, + PathLimit&, + TimeLimit&, + bool, + const Trk::TrackingVolume*, + std::vector<Trk::HitInfo>*&) const +{ + return nullptr; +} + +inline Trk::TrackParameters* +Trk::IPropagator::propagateT(const EventContext&, + const TrackParameters&, + Trk::TargetSurfaces&, + PropDirection, + const MagneticFieldProperties&, + ParticleHypothesis, + Trk::TargetSurfaceVector&, + PathLimit&, + TimeLimit&, + bool, + std::vector<Trk::HitInfo>*&) const +{ + return nullptr; +} + +inline Trk::ExtrapolationCode +Trk::IPropagator::propagate(const EventContext&, + Trk::ExCellCharged&, + Trk::TargetSurfaces&, + Trk::TargetSurfaceVector&) const +{ + return Trk::ExtrapolationCode::FailureConfiguration; +} + +inline Trk::TrackParameters* +Trk::IPropagator::propagateM( + const EventContext&, + const TrackParameters&, + std::vector<DestSurf>&, + PropDirection, + const MagneticFieldProperties&, + ParticleHypothesis, + std::vector<unsigned int>&, + std::vector<const Trk::TrackStateOnSurface*>*&, + std::vector<std::pair<const Trk::TrackParameters*, int>>*&, + double&, + bool, + bool, + const Trk::TrackingVolume*, + Trk::ExtrapolationCache*) const +{ + return nullptr; +} + // placeholder for compatibility with new interface +inline const Trk::TrackSurfaceIntersection* +Trk::IPropagator::intersectSurface(const EventContext&, + const Surface&, + const TrackSurfaceIntersection*, + const double, + const MagneticFieldProperties&, + ParticleHypothesis) const +{ + return nullptr; +} + +inline void +Trk::IPropagator::propagateStep(const EventContext&, + const Amg::Vector3D&, + const Amg::Vector3D&, + double, + double, + Amg::Vector3D&, + Amg::Vector3D&, + const MagneticFieldProperties&) const +{} + + +/* + * Implementation of interfaces without Gaudi Context + * in terms of the Gaudi Context aware ones + */ + +// Propagation interface: +// The propagation method called by the TrkExtrapolator. The extrapolator +// is responsible for the underlying logic of which surface to go to. +inline Trk::TrackParameters* +Trk::IPropagator::propagate(const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + bool returnCurv, + const Trk::TrackingVolume* tVol) const +{ + return propagate(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + mprop, + particle, + returnCurv, + tVol); +} + +/** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagate(const Trk::TrackParameters& parm, + std::vector<Trk::DestSurf>& sfs, + Trk::PropDirection dir, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + double& path, + bool usePathLim, + bool returnCurv, + const Trk::TrackingVolume* tVol) const +{ + + return propagate(Gaudi::Hive::currentContext(), + parm, + sfs, + dir, + mprop, + particle, + solutions, + path, + usePathLim, + returnCurv, + tVol); +} + +/** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. Timing included. +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagateT(const Trk::TrackParameters& parm, + std::vector<Trk::DestSurf>& sfs, + Trk::PropDirection dir, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + const Trk::TrackingVolume* tVol, + std::vector<Trk::HitInfo>*& hitVector) const +{ + + return propagateT(Gaudi::Hive::currentContext(), + parm, + sfs, + dir, + mprop, + particle, + solutions, + pathLim, + timeLim, + returnCurv, + tVol, + hitVector); +} + +/** Propagation interface: + The propagation method called by the TrkExtrapolator. The propagator + finds the closest surface. Timing included. +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagateT(const Trk::TrackParameters& parm, + Trk::TargetSurfaces& sfs, + Trk::PropDirection dir, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + TargetSurfaceVector& solutions, + PathLimit& pathLim, + TimeLimit& timeLim, + bool returnCurv, + std::vector<Trk::HitInfo>*& hitVector) const +{ + return propagateT(Gaudi::Hive::currentContext(), + parm, + sfs, + dir, + mprop, + particle, + solutions, + pathLim, + timeLim, + returnCurv, + hitVector); +} + +/** Propagation interface: + The propagation method called by the TrkExEngine. All options included. +*/ +inline Trk::ExtrapolationCode +Trk::IPropagator::propagate(Trk::ExCellCharged& eCell, + Trk::TargetSurfaces& sfs, + Trk::TargetSurfaceVector& solutions) const +{ + return propagate(Gaudi::Hive::currentContext(), eCell, sfs, solutions); +} + +/** Propagation interface: + The propagation method with internal material collection. The propagator + finds the closest surface. +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagateM( + const Trk::TrackParameters& parm, + std::vector<Trk::DestSurf>& sfs, + Trk::PropDirection dir, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + std::vector<unsigned int>& solutions, + std::vector<const Trk::TrackStateOnSurface*>*& matstates, + std::vector<std::pair<const Trk::TrackParameters*, int>>*& intersections, + double& path, + bool usePathLim, + bool returnCurv, + const Trk::TrackingVolume* tVol, + Trk::ExtrapolationCache* cache) const +{ + return propagateM(Gaudi::Hive::currentContext(), + parm, + sfs, + dir, + mprop, + particle, + solutions, + matstates, + intersections, + path, + usePathLim, + returnCurv, + tVol, + cache); +} + +/** Propagation interface: + The propagation method including the return of the TransportJacobian matrix. +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagate(const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + const Trk::MagneticFieldProperties& mprop, + TransportJacobian*& jacob, + double& pathLength, + Trk::ParticleHypothesis particle, + bool returnCurv, + const Trk::TrackingVolume* tVol) const +{ + return propagate(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + mprop, + jacob, + pathLength, + particle, + returnCurv, + tVol); +} + +/** Propagation interface without Covariance matrix propagation + the pathlength has to be returned for eventual following propagateCovariance +*/ +inline Trk::TrackParameters* +Trk::IPropagator::propagateParameters(const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + bool returnCurv, + const Trk::TrackingVolume* tVol) const +{ + return propagateParameters(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + mprop, + particle = pion, + returnCurv, + tVol); +} + +inline Trk::TrackParameters* +Trk::IPropagator::propagateParameters(const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const BoundaryCheck& bcheck, + const Trk::MagneticFieldProperties& mprop, + TransportJacobian*& jacob, + Trk::ParticleHypothesis particle, + bool returnCurv, + const Trk::TrackingVolume* tVol) const +{ + return propagateParameters(Gaudi::Hive::currentContext(), + parm, + sf, + dir, + bcheck, + mprop, + jacob, + particle = pion, + returnCurv, + tVol); +} + +/** Intersection interface: + The intersection interface might be used by the material service as well to + estimate the surfaces (sensitive and nonesensitive) while propagation +*/ +inline const Trk::IntersectionSolution* +Trk::IPropagator::intersect(const Trk::TrackParameters& parm, + const Trk::Surface& sf, + const Trk::MagneticFieldProperties& mprop, + Trk::ParticleHypothesis particle, + const Trk::TrackingVolume* tVol) const +{ + return intersect( + Gaudi::Hive::currentContext(), parm, sf, mprop, particle = pion, tVol); +} + +/** Intersection and Intersector interface: + */ + +inline const Trk::TrackSurfaceIntersection* +Trk::IPropagator::intersectSurface( + const Trk::Surface& surface, + const TrackSurfaceIntersection* trackIntersection, + const double qOverP, + const Trk::MagneticFieldProperties& mft, + Trk::ParticleHypothesis particle) const +{ + return intersectSurface(Gaudi::Hive::currentContext(), + surface, + trackIntersection, + qOverP, + mft, + particle); +} + +/** GlobalPositions list interface: + This is used mostly in pattern recognition in the road finder, the + propagation direction is intrinsically given by the sign of the stepSize. + To avoid memory fragmentation in multiple use of pattern recognition + processes and respecting the possible iterative filling of the positions + list, the list of GlobalPositions is given by reference through the signature + and a void method has been chosen. +*/ +inline void +Trk::IPropagator::globalPositions(std::list<Amg::Vector3D>& positionslist, + const Trk::TrackParameters& parm, + const Trk::MagneticFieldProperties& mprop, + const CylinderBounds& cylbo, + double stepSize, + Trk::ParticleHypothesis particle, + const Trk::TrackingVolume* tVol) const +{ + globalPositions(Gaudi::Hive::currentContext(), + positionslist, + parm, + mprop, + cylbo, + stepSize, + particle = pion, + tVol); +} + +/** a very simple propagation along a given path length */ +inline void +Trk::IPropagator::propagateStep(const Amg::Vector3D& inputPosition, + const Amg::Vector3D& inputMomentum, + double charge, + double step, + Amg::Vector3D& outputPosition, + Amg::Vector3D& outputMomentum, + const Trk::MagneticFieldProperties& mprop) const +{ + propagateStep(Gaudi::Hive::currentContext(), + inputPosition, + inputMomentum, + charge, + step, + outputPosition, + outputMomentum, + mprop); +} + diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/ITimedExtrapolator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/ITimedExtrapolator.h index 4f666e1d00cf8a2ccf53587ca08aa12bff8cb70c..c450ae13a7f0187a296d54a2e93afb3bfc7eee85 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/ITimedExtrapolator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/ITimedExtrapolator.h @@ -55,7 +55,7 @@ namespace Trk { Trk::ParticleHypothesis particle, std::vector<HitInfo>*& hitVector, Trk::GeometrySignature& nextGeoId, - const Trk::TrackingVolume* boundaryVol=0) const = 0; + const Trk::TrackingVolume* boundaryVol=nullptr) const = 0; /** Transport method for neutral and/or unstable particles. Search of intersections with active surfaces/layers on demand. The extrapolation is interrupted at subdetector boundary for surviving/stable particles. @@ -67,7 +67,7 @@ namespace Trk { Trk::ParticleHypothesis particle, std::vector<HitInfo>*& hitVector, Trk::GeometrySignature& nextGeoId, - const Trk::TrackingVolume* boundaryVol=0) const = 0; + const Trk::TrackingVolume* boundaryVol=nullptr) const = 0; /** Return the TrackingGeometry used by the Extrapolator (forwards information from Navigator) */ diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt index 369cbd51addbff5680b5582482016fa46f845cf5..ebb26c6c3eec9767902c6525d76be8db448c9f63 100644 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt @@ -45,7 +45,6 @@ atlas_add_test( RungeKuttaIntersector_test SOURCES test/RungeKuttaIntersector_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES TrkExUtils GaudiKernel TestTools PathResolver CxxUtils ${ROOT_LIBRARIES} MagFieldElements MagFieldConditions - LOG_IGNORE_PATTERN "^AtlasFieldSvc +INFO" PROPERTIES TIMEOUT 300 ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.ref b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.ref index 2bf2e191c4e7cfdf59b2541823bd68e4c9d613c1..a734d9bb82bec87d48561b0fd75ab33faf6c07dc 100644 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.ref +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.ref @@ -1,29 +1,21 @@ RungeKuttaIntersector_test -Initializing Gaudi ApplicationMgr using job opts /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt -JobOptionsSvc INFO # =======> /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt +Initializing Gaudi ApplicationMgr using job opts /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/athena/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt +JobOptionsSvc INFO Job options successfully read in from /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/athena/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on atdesy14 on Mon May 11 11:58:58 2020 + running on ccwige0002 on Tue May 26 22:52:36 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -ClassIDSvc INFO getRegistryEntries: read 1776 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1480 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 2267 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 2276 CLIDRegistry entries for module ALL test_plane test_line test_cylinder diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt index ce532aaa3b830d9f4a755d386296875e63b20929..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/share/RungeKuttaIntersector_test.txt @@ -1,3 +0,0 @@ -ApplicationMgr.ExtSvc={"MagField::AtlasFieldSvc/AtlasFieldSvc"}; -AtlasFieldSvc.UseDCS=false; -AtlasFieldSvc.UseMapsFromCool=false; diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h index 7cd43f637cb42c35ab84512f8d5cb3063bed0966..a273df8dc6a3b375c2d42f07daba47fef0883b6b 100755 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/TrkExRungeKuttaPropagator/RungeKuttaPropagator.h @@ -32,7 +32,6 @@ namespace Trk { class PatternTrackParameters ; /** -<<<<<<< HEAD @class RungeKuttaPropagator Trk::RungeKuttaPropagator is algorithm for track parameters propagation through @@ -104,18 +103,24 @@ namespace Trk { if pointer to const * = 0 algorithm will propagate track parameters and jacobian of transformation according straight line model - - @author Igor.Gavrilenko@cern.ch + @author Igor.Gavrilenko@cern.ch + + @authors AthenaMT modifications RD Schaffer C Anastopoulos */ - class RungeKuttaPropagator final: public AthAlgTool, virtual public IPropagator, - virtual public IPatternParametersPropagator + class RungeKuttaPropagator final + : public AthAlgTool + , virtual public IPropagator + , virtual public IPatternParametersPropagator { ///////////////////////////////////////////////////////////////////////////////// // Public methods: ///////////////////////////////////////////////////////////////////////////////// public: + /** This following "using" statements can be removed after the methods in IPropagator.h for the + * old interfaces WITHOUT EventContext are removed, i.e. only the new ones with EventContext are + * used throughout the sw */ using IPropagator::intersect; using IPropagator::propagate; using IPropagator::propagateParameters; @@ -310,38 +315,35 @@ namespace Trk { /** a very simple propagation along a given path length */ - virtual void propagateStep(const EventContext& ctx, - const Amg::Vector3D& inputPosition, - const Amg::Vector3D& inputMomentum, - double charge, - double step, - Amg::Vector3D& outputPosition, - Amg::Vector3D& outputMomentum, - const MagneticFieldProperties& mprop) const override final; + virtual void propagateStep( + const EventContext& ctx, + const Amg::Vector3D& inputPosition, + const Amg::Vector3D& inputMomentum, + double charge, + double step, + Amg::Vector3D& outputPosition, + Amg::Vector3D& outputMomentum, + const MagneticFieldProperties& mprop) const override final; - private: + private: struct Cache{ + MagField::AtlasFieldCache m_fieldCache; + double m_field[3]; double m_direction; double m_step; double m_maxPath = 10000; - double m_field[3]; bool m_maxPathLimit = false; bool m_mcondition = false; bool m_solenoid = true; bool m_needgradient = false; bool m_newfield = true; - - MagField::AtlasFieldCache m_fieldCache; }; - ///////////////////////////////////////////////////////////////////////////////// // Private methods: ///////////////////////////////////////////////////////////////////////////////// - /** Test quality Jacobian calculation */ - void JacobianTest (const TrackParameters &, const Surface &, @@ -428,7 +430,12 @@ namespace Trk { /** Step estimator with directions correction */ - double stepEstimatorWithCurvature(Cache& cache,int,double*,const double*,bool&) const; + double stepEstimatorWithCurvature( + Cache& cache, + int, + double*, + const double*, + bool&) const; /** Step reduction */ double stepReduction(const double*) const; @@ -466,51 +473,63 @@ namespace Trk { double *, std::pair<double,int> &) const; - void getField (Cache& cache, double*,double* ) const; - void getFieldGradient(Cache& cache, double*,double*,double*) const; - - //placeholder for compatibility with new interface - virtual - const TrackSurfaceIntersection* intersectSurface(const EventContext&, - const Surface&, - const TrackSurfaceIntersection*, - const double, - const MagneticFieldProperties&, - ParticleHypothesis) const override - {return nullptr;} - - ///////////////////////////////////////////////////////////////////////////////// - // Private data members: - ///////////////////////////////////////////////////////////////////////////////// + void getField( + Cache& cache, + double*, + double*) const; + + void getFieldGradient( + Cache& cache, + double*, + double*, + double*) const; + + void getFieldCacheObject( + Cache& cache, + const EventContext& ctx) const; + + // Private data members: + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey{ + this, + "AtlasFieldCacheCondObj", + "fieldCondObj", + "Name of the Magnetic Field conditions object key" + }; double m_dlt ; // accuracy parameter double m_helixStep ; // max step whith helix model double m_straightStep ; // max step whith srtaight line model bool m_usegradient ; // use magnetif field gradient - - // Read handle for conditions object to get the field cache - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; - void getFieldCacheObject(Cache& cache, const EventContext& ctx) const; - }; -///////////////////////////////////////////////////////////////////////////////// -// Inline methods for magnetic field information -///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// + // Inline methods for magnetic field information + ///////////////////////////////////////////////////////////////////////////////// - inline void RungeKuttaPropagator::getField(Cache& cache,double* R,double* H) const { + inline void + RungeKuttaPropagator::getField(Cache& cache, double* R, double* H) const + { - if(cache.m_solenoid) cache.m_fieldCache.getFieldZR(R, H); - else cache.m_fieldCache.getField (R, H); - + if (cache.m_solenoid) { + cache.m_fieldCache.getFieldZR(R, H); + } else { + cache.m_fieldCache.getField(R, H); + } } - inline void RungeKuttaPropagator::getFieldGradient(Cache& cache,double* R,double* H,double* dH) const { - - if(cache.m_solenoid) cache.m_fieldCache.getFieldZR(R, H, dH); - else cache.m_fieldCache.getField (R, H, dH); - + inline void + RungeKuttaPropagator::getFieldGradient(Cache& cache, + double* R, + double* H, + double* dH) const + { + if (cache.m_solenoid){ + cache.m_fieldCache.getFieldZR(R, H, dH); + } + else{ + cache.m_fieldCache.getField(R, H, dH); + } } -} - +}//end namespace Trk #endif // RungeKuttaPropagator_H diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx index 7f1c6d06c6ef1cd616e470f954c3a3ec1994c481..d3de51ca871a6ec81c54b3254e52cbc9b103f3b9 100755 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx @@ -52,7 +52,7 @@ StatusCode Trk::RungeKuttaPropagator::initialize() // Read handle for AtlasFieldCacheCondObj ATH_CHECK( m_fieldCondObjInputKey.initialize() ); - ATH_MSG_INFO("initialize() init key: " << m_fieldCondObjInputKey.key()); + ATH_MSG_DEBUG("initialize() init key: " << m_fieldCondObjInputKey.key()); return StatusCode::SUCCESS; } @@ -63,7 +63,7 @@ StatusCode Trk::RungeKuttaPropagator::initialize() StatusCode Trk::RungeKuttaPropagator::finalize() { - ATH_MSG_INFO(name() <<" finalize() successful"); + ATH_MSG_VERBOSE(name() <<" finalize() successful"); return StatusCode::SUCCESS; } diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/CMakeLists.txt index ec07ecae87684e398b8b9a85f44e8279172a4190..8f582373da5c1c8806071f59db4b79be7e596bb2 100644 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/CMakeLists.txt @@ -35,7 +35,7 @@ atlas_add_component( TrkExSTEP_Propagator src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives EventPrimitives MagFieldInterfaces TrkGeometry TrkEventPrimitives TrkMaterialOnTrack TrkParameters TrkExInterfaces TrkExUtils GaudiKernel TrkDetDescrUtils TrkSurfaces TrkTrack MagFieldElements MagFieldConditions ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives EventPrimitives TrkGeometry TrkEventPrimitives TrkMaterialOnTrack TrkParameters TrkExInterfaces TrkExUtils GaudiKernel TrkDetDescrUtils TrkSurfaces TrkTrack MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( TrkExSTEP_Propagator ) diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h index 79eaaccf79f46053e961630da3487b55435b6bd0..15545780fc84580c192b9ac6d98698834cfb7baf 100755 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h @@ -136,8 +136,17 @@ namespace Trk { // Public methods: ///////////////////////////////////////////////////////////////////////////////// public: + + /** This following "using" statements can be removed after the methods in IPropagator.h for the + * old interfaces WITHOUT EventContext are removed, i.e. only the new ones with EventContext are + * used throughout the sw */ using IPropagator::propagate; using IPropagator::propagateT; + using Trk::IPropagator::propagateM; + using Trk::IPropagator::propagateParameters; + using Trk::IPropagator::intersect; + using Trk::IPropagator::intersectSurface; + using Trk::IPropagator::globalPositions; STEP_Propagator(const std::string&,const std::string&,const IInterface*); @@ -217,7 +226,6 @@ namespace Trk { std::vector<Trk::HitInfo>*& hitVector) const override final; /** Propagate parameters and covariance with search of closest surface and material collection */ - using Trk::IPropagator::propagateM; virtual Trk::TrackParameters* propagateM (const EventContext& ctx, const Trk::TrackParameters& trackParameters, @@ -250,7 +258,6 @@ namespace Trk { /** Propagate parameters only */ - using Trk::IPropagator::propagateParameters; virtual Trk::TrackParameters* propagateParameters (const EventContext& ctx, const Trk::TrackParameters& trackParameters, @@ -278,7 +285,6 @@ namespace Trk { /** Propagate parameters and return path (Similar to propagateParameters */ - using Trk::IPropagator::intersect; virtual const IntersectionSolution* intersect (const EventContext& ctx, const Trk::TrackParameters& trackParameters, @@ -289,7 +295,6 @@ namespace Trk { /** Intersection and propagation: */ - using Trk::IPropagator::intersectSurface; virtual const TrackSurfaceIntersection* intersectSurface(const EventContext& ctx, const Surface& surface, const TrackSurfaceIntersection* trackIntersection, @@ -298,7 +303,6 @@ namespace Trk { ParticleHypothesis particle) const override final; /** Return a list of positions along the track */ - using Trk::IPropagator::globalPositions; virtual void globalPositions (const EventContext& ctx, std::list<Amg::Vector3D>& positionsList, diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/CMakeLists.txt index b634a52c8db565e242150580a753df2b0ce9957c..deada64b85e58a6e4705fcc4531fac56dd0dfba3 100644 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/CMakeLists.txt @@ -45,7 +45,6 @@ atlas_install_headers( TrkExSolenoidalIntersector ) atlas_add_test( SolenoidParametrization_test SOURCES test/SolenoidParametrization_test.cxx LINK_LIBRARIES TrkExUtils GaudiKernel TestTools PathResolver MagFieldElements MagFieldConditions - LOG_IGNORE_PATTERN "^AtlasFieldSvc +INFO" PROPERTIES TIMEOUT 300 ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) @@ -54,7 +53,6 @@ atlas_add_test( SolenoidalIntersector_test SOURCES test/SolenoidalIntersector_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES TrkExUtils GaudiKernel TestTools CxxUtils ${ROOT_LIBRARIES} MagFieldElements MagFieldConditions PathResolver TrkExSolenoidalIntersectorLib - LOG_IGNORE_PATTERN "^AtlasFieldSvc +INFO" PROPERTIES TIMEOUT 300 ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.ref b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.ref index b31f3b0810a4ba9e3734969d7cdb8f719d76af3a..c012ce52a5d452e7a6973c6ae723952cff04c947 100644 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.ref +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.ref @@ -1,38 +1,21 @@ SolenoidalIntersector_test -Initializing Gaudi ApplicationMgr using job opts /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt -JobOptionsSvc INFO # =======> /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /data/goetz/ws/MagneticFieldSvc/build/../source/athena/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt +Initializing Gaudi ApplicationMgr using job opts /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/athena/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt +JobOptionsSvc INFO Job options successfully read in from /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/athena/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on atdesy14 on Mon May 11 11:36:57 2020 + running on ccwige0002 on Tue May 26 23:03:57 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -ClassIDSvc INFO getRegistryEntries: read 1896 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1600 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully -ClassIDSvc INFO getRegistryEntries: read 2161 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 2170 CLIDRegistry entries for module ALL ToolSvc.Trk::So... INFO SolenoidalIntersector::initialize() - package version TrkExSolenoidalIntersector-00-00-00 ClassIDSvc INFO getRegistryEntries: read 163 CLIDRegistry entries for module ALL test_plane diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt index ce532aaa3b830d9f4a755d386296875e63b20929..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/share/SolenoidalIntersector_test.txt @@ -1,3 +1 @@ -ApplicationMgr.ExtSvc={"MagField::AtlasFieldSvc/AtlasFieldSvc"}; -AtlasFieldSvc.UseDCS=false; -AtlasFieldSvc.UseMapsFromCool=false; + diff --git a/Tracking/TrkExtrapolation/TrkExTools/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExTools/CMakeLists.txt index 4ecbb0fa3e8e9bfba22cf9a13c10b98856c07a75..ef8b3003cfcc065dfa1a7610198381e464de9e6d 100644 --- a/Tracking/TrkExtrapolation/TrkExTools/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExTools/CMakeLists.txt @@ -52,13 +52,14 @@ atlas_install_headers( TrkExTools ) atlas_install_python_modules( python/*.py ) atlas_add_test( ObjContainer_test - SOURCES test/ObjContainer_test.cxx) + SOURCES test/ObjContainer_test.cxx + LINK_LIBRARIES CxxUtils ) atlas_add_test( TrkExToolsStringUtility_test SOURCES test/TrkExToolsStringUtility_test.cxx src/TrkExToolsStringUtility.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} + LINK_LIBRARIES ${Boost_LIBRARIES} CxxUtils POST_EXEC_SCRIPT "nopost.sh" ) diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h index e4406c8006577fdd66a6a71096176639018aadb5..489252c532b886c36d905242df3c897d6782644f 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/DummyMaterialEffectsUpdator.h @@ -100,10 +100,16 @@ class DummyMaterialEffectsUpdator : public AthAlgTool, virtual void modelAction(const TrackParameters* parm=nullptr) const override{ if(parm) return; - } + } - typedef IMaterialEffectsUpdator::ICache ICache; - class Cache : public ICache{ + typedef IMaterialEffectsUpdator::ICache ICache; + class Cache : public ICache + { + public: + virtual MaterialCacheType type() const override final + { + return ICache::DummyMaterialEffects; + } }; virtual std::unique_ptr<ICache> getCache() const override{ diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h index 7a4d9caedb5b57fbd0385ff7c5fb1f1e20f39cf5..3d70a4026ae5f8057d4af74116818d09feb09d96 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h @@ -12,9 +12,12 @@ // Gaudi/StoreGate #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" -//#include "StoreGate/ReadCondHandleKey.h" + +//Event Context +#include "GaudiKernel/EventContext.h" // Trk +#include "TrkExInterfaces/IPropagator.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkExInterfaces/INavigator.h" #include "TrkExInterfaces/IMaterialEffectsUpdator.h" @@ -32,6 +35,8 @@ #include "TrkExUtils/ExtrapolationCache.h" // STL #include <cstring> +#include <utility> + #include <vector> #include <map> // Amg @@ -70,6 +75,7 @@ using TrackParmContainer = ObjContainer<const Trk::TrackParameters>; using TrackParmPtr = ObjRef<>; using ManagedTrackParmPtr = ObjPtr<const Trk::TrackParameters>; + /** @struct ParametersAtBoundarySurface has only three member - BoundarySurface @@ -98,8 +104,8 @@ struct ParametersNextVolume { BoundarySurfaceFace face=undefinedFace) { nextVolume = tvol; - nextParameters = nextPars; - navParameters = navPars; + nextParameters = std::move(nextPars); + navParameters = std::move(navPars); exitFace = face; } //!< reset the boundary information by invalidating it @@ -116,8 +122,6 @@ struct ParametersNextVolume { The Extrapolator can be used in different setups: - - <b>Strategy-pattern</b> usage - - <b>(Simple) Configured AlgTool</b> usage - <b>(Full) Configured AlgTool</b> usage @@ -137,6 +141,21 @@ VERBOSE : Method call sequence with values class Extrapolator : public AthAlgTool, virtual public IExtrapolator { public: + + /** This following "using" statements can be removed after the methods in IExtrapolator.h for the + * old interfaces WITHOUT EventContext are removed, i.e. only the new ones with EventContext are + * used throughout the sw */ + using IExtrapolator::extrapolate; + using IExtrapolator::extrapolateStepwise; + using IExtrapolator::extrapolateDirectly; + using IExtrapolator::extrapolateBlindly; + using IExtrapolator::extrapolateToNextActiveLayer; + using IExtrapolator::extrapolateToNextActiveLayerM; + using IExtrapolator::extrapolateToVolume; + using IExtrapolator::extrapolateM; + using IExtrapolator::extrapolateWithPathLimit; + + /**Constructor */ Extrapolator(const std::string&,const std::string&,const IInterface*); /**Destructor*/ @@ -154,21 +173,21 @@ VERBOSE : Method call sequence with values /** [xAOD] interface ------------------------------------------------------------------ */ /** xAOD 0) neutral xAOD particle */ - virtual const NeutralParameters* extrapolate(const xAOD::NeutralParticle& xnParticle, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true) const override final; - - + virtual const NeutralParameters* extrapolate( + const xAOD::NeutralParticle& xnParticle, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true) const override final; /** xAOD 0) neutral xAOD particle */ - virtual const TrackParameters* extrapolate(const xAOD::TrackParticle& particleBase, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - + virtual const TrackParameters* extrapolate( + const EventContext& ctx, + const xAOD::TrackParticle& particleBase, + const Surface& sf, + PropDirection dir=anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle=pion, + MaterialUpdateMode matupmode=addNoise) const override final; /** [NeutralParameters] ------------------------------------------------------------- */ @@ -176,399 +195,408 @@ VERBOSE : Method call sequence with values - returns a ParametersBase object as well, 0 if the extrapolation did not succeed */ - virtual const NeutralParameters* extrapolate(const NeutralParameters& parameters, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck=true) const override final; - - /** [TrackParameters] --------------------------------------------------------------- */ - - /** S 1) <b>Strategy Pattern extrapolation method</b> - - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), - 0 if extrapolation to destination surface does not suceed */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 2) <b>Strategy Pattern extrapolation method</b> - - returns a vector of TrackParameters representing the tracking detector elements - hit in between and the TrackParameters at the destination Surface (if final extrapolation suceeds), - empty if the extrapolation to the destination surface does not suceed*/ - virtual TrackParametersUVector extrapolateStepwise(const IPropagator& prop, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion ) const override final; - - /** S 3) <b>Strategy Pattern extrapolation method</b>: - - searches the closest TrackParameters of the Track to the destination Surface - - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), - 0 if extrapolation to destination surface does not suceed */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, - const Track& trk, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 4) <b>Strategy Pattern extrapolation method</b>: - - direct extrapolation to the destination surface, no material effects - or intermediate steps are taken into account - */ - virtual const TrackParameters* extrapolateDirectly(const IPropagator& prop, - const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const override final; - - /** S 5) <b>Strategy Pattern extrapolation method</b>: - - blind extrapolation inside the given TrackingVolume - */ - virtual TrackParametersUVector extrapolateBlindly(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - const Volume* boundaryVol=nullptr) const override final; - - - /** S 6) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to the next active layer, based on the extrapolation to the next (material) layer - and layer identification - */ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayer(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 7) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to the next active layer, based on the extrapolation to the next (material) layer - and layer identification - */ - - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayerM(const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface*>& material, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 8) <b>Strategy Pattern extrapolation method</b>: - - Extrapolation using specific intermediate surfaces and energy loss effects to be accounted for at - each surface as specified by the corresponding MaterialEffectsOnTrack - -Final boolean only relevant if LandauMode = true for the configured MaterialEffectsUpdator - */ - virtual const TrackParameters* extrapolate(const IPropagator& prop, - const TrackParameters& parm, - const std::vector< MaterialEffectsOnTrack >& sfMeff, - const TrackingVolume& tvol, - PropDirection dir, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 9) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to the next active layer, based on the extrapolation to the next (material) layer - and layer identification - */ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextStation (const IPropagator& prop, - const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** S 10) <b>Strategy Pattern extrapolation method</b>: - - extrapolation to a volume boundary of an arbitrary tracking volume ( not necessarily part of a tracking geometry ) - */ - virtual const TrackParameters* extrapolateToVolume(const IPropagator& prop, - const TrackParameters& parm, - const Trk::TrackingVolume& vol, - PropDirection dir=anyDirection, - ParticleHypothesis particle=pion) const override final; - - /** C 1) <b>Configured AlgTool extrapolation method</b> of S 1):*/ - virtual const TrackParameters* extrapolate(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - Trk::ExtrapolationCache* cache = nullptr) const override final; - - /** C 2) <b>Configured AlgTool extrapolation method</b> of S 2):*/ - virtual TrackParametersUVector extrapolateStepwise(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const override final; - - /** C 3) <b>Configured AlgTool extrapolation method</b> of S 3):*/ - virtual const TrackParameters* extrapolate(const Track& trk, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - Trk::ExtrapolationCache* cache = nullptr) const override final; - - /** C 4) <b>Configured AlgTool extrapolation method</b> of S 4):*/ - virtual const TrackParameters* extrapolateDirectly(const TrackParameters& parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion) const override final; - - /** C 5) <b>Configured AlgTool extrapolation method</b> of S 5):*/ - virtual TrackParametersUVector extrapolateBlindly(const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - const Volume* boundaryVol=nullptr) const override final; - - - /** C 6) <b>Configured AlgTool extrapolation method</b> of S 6):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayer(const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** C 7) <b>Configured AlgTool extrapolation method</b> of S 7):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextActiveLayerM(const TrackParameters& parm, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface*>& material, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** C 8) <b>Configured AlgTool extrapolation method</b> of S 8):*/ - virtual std::pair<const TrackParameters*,const Layer*> extrapolateToNextStation(const TrackParameters& parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override final; - - /** C 9) <b>Configured AlgTool extrapolation method</b> of S 9):*/ - virtual const TrackParameters* extrapolateToVolume(const TrackParameters& parm, - const Trk::TrackingVolume& vol, - PropDirection dir=anyDirection, - ParticleHypothesis particle=pion) const override final; - - /** C 10) <b>Configured AlgTool extrapolation method</b>: + virtual const NeutralParameters* extrapolate( + const NeutralParameters& parameters, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true) const override final; + + /** 1) <b>Configured AlgTool extrapolation method</b>):*/ + virtual const TrackParameters* extrapolate( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const override final; + + /** 2) <b>Configured AlgTool extrapolation method</b>):*/ + virtual TrackParametersUVector extrapolateStepwise( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const override final; + + /** 3) <b>Configured AlgTool extrapolation method</b>):*/ + virtual const TrackParameters* extrapolate( + const EventContext& ctx, + const Track& trk, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* cache = nullptr) const override final; + + /** 4) <b>Configured AlgTool extrapolation method</b>):*/ + virtual TrackParameters* extrapolateDirectly( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const override final; + + /** 4.1) <b>Configured AlgTool extrapolation method</b>):*/ + virtual TrackParameters* extrapolateDirectly( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const override final; + + /** 5) <b>Configured AlgTool extrapolation method</b>):*/ + virtual TrackParametersUVector extrapolateBlindly( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + const Volume* boundaryVol = nullptr) const override final; + + /** 6) <b>Configured AlgTool extrapolation method</b> ):*/ + virtual std::pair<const TrackParameters*, const Layer*> extrapolateToNextActiveLayer( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final; + + /** 7) <b>Configured AlgTool extrapolation method</b> ):*/ + virtual std::pair<const TrackParameters*, const Layer*> extrapolateToNextActiveLayerM( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override final; + + /** 8) <b>Configured AlgTool extrapolation method</b> ):*/ + virtual const TrackParameters* extrapolateToVolume( + const EventContext& ctx, + const TrackParameters& parm, + const Trk::TrackingVolume& vol, + PropDirection dir = anyDirection, + ParticleHypothesis particle = pion) const override final; + + /** 9) <b>Configured AlgTool extrapolation method</b>: - Extrapolate to a destination surface, while collecting all the material layers in between. */ - virtual std::vector<const TrackStateOnSurface*>* extrapolateM(const TrackParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - Trk::ExtrapolationCache* cache = nullptr) const override final; - - /** C 11) <b>Configured AlgTool extrapolation method</b>: - - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in between. + virtual std::vector<const TrackStateOnSurface*>* extrapolateM( + const EventContext& ctx, + const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const override final; + + /** 10) <b>Configured AlgTool extrapolation method</b>: + - Extrapolate to a destination surface, while collecting all the material layers and transport jacobians in + between. */ - virtual std::vector<const TrackParameters*>* extrapolateM(const TrackParameters& parameters, - const Surface& sf, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<MaterialEffectsOnTrack>& material, - std::vector<Trk::TransportJacobian *>& jacs, - ParticleHypothesis particle=pion, - Trk::ExtrapolationCache* cache = nullptr) const override final; - - virtual const Trk::TrackParameters* extrapolateWithPathLimit( - const Trk::TrackParameters& parm, - double& pathLim, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackParameters*>*& parmOnSf, - std::vector<const Trk::TrackStateOnSurface*>*& material, - const Trk::TrackingVolume* boundaryVol=nullptr, - MaterialUpdateMode matupmod=Trk::addNoise) const override final; - - - /** extrapolation method collecting intersections with subdetector boundaries and active volumes/layers. - A primitive identification is provided - to be replaced with appropriate identifier, and possibly merged - with TrackParameters. Material collection in option. Destination (subdetector boundary) : geoID (+ entry, -exit) - ( default MS exit ) + virtual std::vector<const TrackParameters*>* extrapolateM( + const EventContext& ctx, + const TrackParameters& parameters, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<MaterialEffectsOnTrack>& material, + std::vector<Trk::TransportJacobian*>& jacs, + ParticleHypothesis particle = pion, + Trk::ExtrapolationCache* cache = nullptr) const override final; + + virtual const Trk::TrackParameters* extrapolateWithPathLimit( + const EventContext& ctx, + const Trk::TrackParameters& parm, + double& pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackParameters*>*& parmOnSf, + std::vector<const Trk::TrackStateOnSurface*>*& material, + const Trk::TrackingVolume* boundaryVol = nullptr, + MaterialUpdateMode matupmod = Trk::addNoise) const override final; + + /** extrapolation method collecting intersections with subdetector + boundaries and active volumes/layers. A primitive identification is + provided - to be replaced with appropriate identifier, and possibly merged + with TrackParameters. Material collection in option. Destination + (subdetector boundary) : geoID (+ entry, -exit) ( default MS exit ) */ - virtual const std::vector< std::pair< const Trk::TrackParameters*, int > >* extrapolate(const Trk::TrackParameters& parm, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackStateOnSurface*>*& material, - int destination = 3 ) const override final; - - + virtual const std::vector<std::pair<const Trk::TrackParameters*, int>>* extrapolate( + const EventContext& ctx, + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackStateOnSurface*>*& material, + int destination = 3) const override final; /** Return the TrackingGeometry used by the Extrapolator (forward information from Navigator)*/ - virtual const TrackingGeometry* trackingGeometry() const override final; + virtual const TrackingGeometry* trackingGeometry() const override final; /** Validation Action: Can be implemented optionally, outside access to internal validation steps */ virtual void validationAction() const override final; private: - ServiceHandle<IIncidentSvc> m_incidentSvc{this, "IncidentService", "IncidentSvc"}; - /* + + /** * Cache to be passed to and between the private methods */ typedef std::vector< std::pair< const Trk::TrackParameters*, int > > identifiedParameters_t; struct Cache{ - unsigned int m_methodSequence = 0; - - bool m_dense=false; //!< internal switch for resolved configuration - bool m_recall=false; //!< Flag the recall solution - bool m_robustSampling=true; - unsigned int m_layerResolved{}; - - const Surface* m_destinationSurface=nullptr; - const Volume* m_boundaryVolume=nullptr; //!< the boundary volume check - const Surface* m_recallSurface=nullptr; //!< Destination Surface for recall - const Layer* m_recallLayer=nullptr; //!< Destination Layer for recall - const TrackingVolume* m_recallTrackingVolume=nullptr; //!< Destination TrackingVolume for recall - const Trk::TrackingVolume* m_currentStatic=nullptr; - const Trk::TrackingVolume* m_currentDense=nullptr; - const Trk::TrackingVolume* m_highestVolume=nullptr; - TrackParametersVector* m_parametersOnDetElements=nullptr; //!< return helper for parameters on detector elements - TrackParmContainer m_trackParmContainer; - ManagedTrackParmPtr m_lastValidParameters; //!< parameters to be used for final propagation in case of fallback - const Layer* m_lastMaterialLayer=nullptr; //!< cache layer with last material update - Trk::ExtrapolationCache* m_extrapolationCache=nullptr; //!< cache for collecting the total X0 ans Eloss - const Trk::EnergyLoss* m_cacheEloss=nullptr; //!< cache pointer for Eloss - std::vector<const Trk::TrackStateOnSurface*>* m_matstates=nullptr; //!< cache of TrackStateOnSurfaces - std::vector<Trk::TransportJacobian*>* m_jacs=nullptr; //!< cache of Transport Jacobians - std::unique_ptr<identifiedParameters_t> m_identifiedParameters; // for active volumes - - double m_path{}; - - std::pair<unsigned int, unsigned int> m_denseResolved; - std::vector<DestSurf> m_staticBoundaries; - std::vector<DestSurf> m_detachedBoundaries; - std::vector<DestSurf> m_denseBoundaries; - std::vector<DestSurf> m_navigBoundaries; - std::vector<DestSurf> m_layers; + + TrackParmContainer m_trackParmContainer; + //!< parameters to be used for final propagation in case of fallback + ManagedTrackParmPtr m_lastValidParameters; + //!< return helper for parameters and boundary + ParametersNextVolume m_parametersAtBoundary; + //!< Caches per MaterialUpdator + std::vector<std::unique_ptr<Trk::IMaterialEffectsUpdator::ICache>> m_MaterialUpCache; + //!< garbage collection during extrapolation + std::map<const Trk::TrackParameters*, bool> m_garbageBin; + //!< internal switch for resolved configuration + bool m_dense=false; + //!< Flag the recall solution + bool m_recall=false; + bool m_robustSampling=true; + bool m_ownParametersOnDetElements = true; + unsigned int m_layerResolved{}; + unsigned int m_methodSequence = 0; + const Surface* m_destinationSurface=nullptr; + //!< the boundary volume check + const Volume* m_boundaryVolume=nullptr; + //!< Destination Surface for recall + const Surface* m_recallSurface=nullptr; + //!< Destination Layer for recall + const Layer* m_recallLayer=nullptr; + //!< Destination TrackingVolume for recall + const TrackingVolume* m_recallTrackingVolume=nullptr; + const Trk::TrackingVolume* m_currentStatic=nullptr; + const Trk::TrackingVolume* m_currentDense=nullptr; + const Trk::TrackingVolume* m_highestVolume=nullptr; + //!< return helper for parameters on detector elements + TrackParametersVector* m_parametersOnDetElements=nullptr; + //!< cache layer with last material update + const Layer* m_lastMaterialLayer=nullptr; + //!< cache for collecting the total X0 ans Eloss + Trk::ExtrapolationCache* m_extrapolationCache=nullptr; + //!< cache pointer for Eloss + const Trk::EnergyLoss* m_cacheEloss=nullptr; + //!< cache of TrackStateOnSurfaces + std::vector<const Trk::TrackStateOnSurface*>* m_matstates=nullptr; + //!< cache of Transport Jacobians + std::vector<Trk::TransportJacobian*>* m_jacs=nullptr; + // for active volumes + std::unique_ptr<identifiedParameters_t> m_identifiedParameters; + + double m_path{}; + + std::pair<unsigned int, unsigned int> m_denseResolved; + + std::vector<DestSurf> m_staticBoundaries; + std::vector<DestSurf> m_detachedBoundaries; + std::vector<DestSurf> m_denseBoundaries; + std::vector<DestSurf> m_navigBoundaries; + std::vector<DestSurf> m_layers; + std::vector<std::pair<const Trk::DetachedTrackingVolume*,unsigned int> > m_detachedVols; std::vector<std::pair<const Trk::TrackingVolume*,unsigned int> > m_denseVols; std::vector<std::pair<const Trk::TrackingVolume*,const Trk::Layer*> > m_navigLays; std::vector<std::pair<const Trk::Surface*,Trk::BoundaryCheck> > m_navigSurfs; - std::vector<const Trk::DetachedTrackingVolume*> m_navigVols; - std::vector<std::pair<const Trk::TrackingVolume*,unsigned int> > m_navigVolsInt; - - std::map<const Trk::TrackParameters*, bool> m_garbageBin; //!< garbage collection during extrapolation - ParametersNextVolume m_parametersAtBoundary; //!< return helper for parameters and boundary + std::vector<const Trk::DetachedTrackingVolume*> m_navigVols; + std::vector<std::pair<const Trk::TrackingVolume*,unsigned int> > m_navigVolsInt; - bool m_ownParametersOnDetElements = true; - TrackParmContainer &trackParmContainer() { return m_trackParmContainer; } + TrackParmContainer& trackParmContainer() { return m_trackParmContainer; } - ManagedTrackParmPtr manage(const Trk::TrackParameters &parm) { return ManagedTrackParmPtr(trackParmContainer(),parm); } - ManagedTrackParmPtr manage(const Trk::TrackParameters *parm) { return ManagedTrackParmPtr(trackParmContainer(),parm); } - ManagedTrackParmPtr manage(TrackParmPtr parm) { return ManagedTrackParmPtr(trackParmContainer(),parm); } - ManagedTrackParmPtr manage() { return ManagedTrackParmPtr(trackParmContainer()); } + ManagedTrackParmPtr manage(const Trk::TrackParameters& parm) + { + return ManagedTrackParmPtr(trackParmContainer(), parm); + } + ManagedTrackParmPtr manage(const Trk::TrackParameters* parm) + { + return ManagedTrackParmPtr(trackParmContainer(), parm); + } + ManagedTrackParmPtr manage(TrackParmPtr parm) + { + return ManagedTrackParmPtr(trackParmContainer(), parm); + } + ManagedTrackParmPtr manage() + { + return ManagedTrackParmPtr(trackParmContainer()); + } Cache() - : m_trackParmContainer(128), // always reserve some space; still occasionally more slots are needed; above 150 there are very few cases the max in q431 was 257 - m_lastValidParameters(m_trackParmContainer), - m_parametersAtBoundary(m_trackParmContainer) + : m_trackParmContainer(128) + , // always reserve some space; still occasionally more slots are + // needed; above 150 there are very few cases the max in q431 was 257 + m_lastValidParameters(m_trackParmContainer) + , m_parametersAtBoundary(m_trackParmContainer) { - m_navigSurfs.reserve(1000); - m_navigVols.reserve(50); - m_navigVolsInt.reserve(50); + m_navigSurfs.reserve(1024); + m_navigVols.reserve(64); + m_navigVolsInt.reserve(64); } ~Cache() { - s_navigSurfsMax.update(m_navigSurfs.size()); - s_navigVolsMax.update(m_navigVols.size()) ; - s_navigVolsIntMax.update(m_navigVols.size()); - if (m_ownParametersOnDetElements && m_parametersOnDetElements) { - for (const Trk::TrackParameters *parm : *m_parametersOnDetElements) { - delete parm; - } - } + s_navigSurfsMax.update(m_navigSurfs.size()); + s_navigVolsMax.update(m_navigVols.size()); + s_navigVolsIntMax.update(m_navigVols.size()); + if (m_ownParametersOnDetElements && m_parametersOnDetElements) { + for (const Trk::TrackParameters* parm : *m_parametersOnDetElements) { + delete parm; + } + } s_containerSizeMax.update(trackParmContainer().size()); } - class AtomicMax { - public: - void update(size_t val) { - while (val>m_maxVal) { - val = m_maxVal.exchange(val); - } - } - size_t val() const { return m_maxVal; } - std::atomic<size_t> m_maxVal = 0; + /** + * struct for accumulating stat counters + */ + struct AtomicMax + { + void update(size_t val) + { + while (val > m_maxVal) { + val = m_maxVal.exchange(val); + } + } + size_t val() const { return m_maxVal; } + std::atomic<size_t> m_maxVal = 0; }; - static AtomicMax s_navigSurfsMax ATLAS_THREAD_SAFE; - static AtomicMax s_navigVolsMax ATLAS_THREAD_SAFE; - static AtomicMax s_navigVolsIntMax ATLAS_THREAD_SAFE; + static AtomicMax s_navigSurfsMax ATLAS_THREAD_SAFE; + static AtomicMax s_navigVolsMax ATLAS_THREAD_SAFE; + static AtomicMax s_navigVolsIntMax ATLAS_THREAD_SAFE; static AtomicMax s_containerSizeMax ATLAS_THREAD_SAFE; - static bool s_reported ATLAS_THREAD_SAFE; - + static bool s_reported ATLAS_THREAD_SAFE; }; /** - * Actual heavy lifting implementation for - * S 1) <b>Strategy Pattern extrapolation method</b> + * Actual heavy lifting implementation for * - returns the TrackParameters at the Destination Surface (if extrapolation succeeds), - * 0 if extrapolation to destination surface does not suceed + * 0 if extrapolation to destination surface does not suceed */ - ManagedTrackParmPtr extrapolateImpl(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; + ManagedTrackParmPtr extrapolateImpl( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** * Actual heavy lifting implementation for + - returns a vector of TrackParameters representing the tracking detector elements + hit in between and the TrackParameters at the destination Surface (if final extrapolation suceeds), + empty if the extrapolation to the destination surface does not suceed*/ + TrackParametersUVector extrapolateStepwiseImpl( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const; + /** - * Actual heavy lifting implementation for - * S 8) <b>Strategy Pattern extrapolation method</b>: + * Actual heavy lifting implementation for * - Extrapolation using specific intermediate surfaces and energy loss effects to be accounted for at * each surface as specified by the corresponding MaterialEffectsOnTrack * -Final boolean only relevant if LandauMode = true for the configured MaterialEffectsUpdator - */ - ManagedTrackParmPtr extrapolateImpl(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const std::vector< MaterialEffectsOnTrack >& sfMeff, - const TrackingVolume& tvol, - PropDirection dir, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const ; - + */ + ManagedTrackParmPtr extrapolateImpl( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const std::vector<MaterialEffectsOnTrack>& sfMeff, + const TrackingVolume& tvol, + PropDirection dir, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; /** Actual heavy lifting implementation for - * C 1) <b>Configured AlgTool extrapolation method</b> of S 1): + * 1) <b>Configured AlgTool extrapolation method</b>): * */ - virtual ManagedTrackParmPtr extrapolateImpl(Cache& cache, - TrackParmPtr parm, - const Surface& sf, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - Trk::ExtrapolationCache* extrapolationCache = nullptr) const; - + virtual ManagedTrackParmPtr extrapolateImpl( + const EventContext& ctx, + Cache& cache, + TrackParmPtr parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + Trk::ExtrapolationCache* extrapolationCache = nullptr) const; + + /** Actual heavy lifting implementation for + * 4) <b>Configured AlgTool extrapolation method</b>):*/ + TrackParameters* extrapolateDirectlyImpl( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion) const; + + /** Actual heavy lifting implementation for + * 5) <b>Configured AlgTool extrapolation method</b>):*/ + Trk::TrackParametersUVector extrapolateBlindlyImpl( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + const Volume* boundaryVol = nullptr) const; /** Actual heavy lifting implementation for - * C 5) <b>Configured AlgTool extrapolation method</b> of S 5):*/ - Trk::TrackParametersUVector extrapolateBlindlyImpl(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm, - PropDirection dir=anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - const Volume* boundaryVol=nullptr) const; - - + * 6) <b>Configured AlgTool extrapolation method</b>):*/ + std::pair<const TrackParameters*, const Layer*> + extrapolateToNextActiveLayerImpl( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** Actual heavy lifting implementation for + * 7) <b>Configured AlgTool extrapolation method</b> + */ + std::pair<const TrackParameters*, const Layer*> + extrapolateToNextActiveLayerMImpl( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** Actual heavy lifting implementation for + * 8) <b>Configured AlgTool extrapolation method</b> + */ + const TrackParameters* extrapolateToVolumeImpl( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const Trk::TrackingVolume& vol, + PropDirection dir = anyDirection, + ParticleHypothesis particle = pion) const; /** Private method for extrapolation in final volume to destination surface - Parameters are: IPropagator& prop ... propagator to be used @@ -579,76 +607,85 @@ VERBOSE : Method call sequence with values PropDirection dir ... propagation direction const BoundaryCheck& bcheck ... boolean for bounday check ParticleHypothesis particle ... the particle hypothesis - std::vector<const TrackParameters*>* dethits ... for blind extrapolation + std::vector<const TrackParameters*>* dethits ... for blind extrapolation it will call: - A) insideVolumeStaticLayers() for a TrackingVolume with static layers - C) insideVolumeDetachedVolumes() for a TrackingVolume with detached inner Volumes */ - ManagedTrackParmPtr extrapolateInsideVolume(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Surface& sf, - const Layer* associatedLayer, - const TrackingVolume& tvol, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const; - - + ManagedTrackParmPtr extrapolateInsideVolume( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Surface& sf, + const Layer* associatedLayer, + const TrackingVolume& tvol, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; /** A) call from extrapolateInsideVolume or toBoundary, if it is to boundary, the return parameters are the parameters at the boundary */ - ManagedTrackParmPtr insideVolumeStaticLayers(Cache& cache, - bool toBoundary, - const IPropagator& prop, - TrackParmPtr parm, - const Layer* associatedLayer, - const TrackingVolume& tvol, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const; + ManagedTrackParmPtr insideVolumeStaticLayers( + const EventContext& ctx, + Cache& cache, + bool toBoundary, + const IPropagator& prop, + TrackParmPtr parm, + const Layer* associatedLayer, + const TrackingVolume& tvol, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; /** C) call from extrapolateInsideVolume */ - ManagedTrackParmPtr extrapolateWithinDetachedVolumes(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Surface& sf, - const TrackingVolume& tvol, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const; - - ManagedTrackParmPtr extrapolateToNextMaterialLayer(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Trk::Surface* destSurf, - const Trk::TrackingVolume* vol, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const; - - ManagedTrackParmPtr extrapolateInAlignableTV(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Trk::Surface* destSurf, - const Trk::AlignableTrackingVolume* vol, - PropDirection dir, - ParticleHypothesis particle=pion) const; - - ManagedTrackParmPtr extrapolateToVolumeWithPathLimit(Cache& cache, - TrackParmPtr parm, - double pathLim, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - const Trk::TrackingVolume* destVol, - MaterialUpdateMode matupmod=addNoise) const; - + ManagedTrackParmPtr extrapolateWithinDetachedVolumes( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Surface& sf, + const TrackingVolume& tvol, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + ManagedTrackParmPtr extrapolateToNextMaterialLayer( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Trk::Surface* destSurf, + const Trk::TrackingVolume* vol, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + ManagedTrackParmPtr extrapolateInAlignableTV( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Trk::Surface* destSurf, + const Trk::AlignableTrackingVolume* vol, + PropDirection dir, + ParticleHypothesis particle = pion) const; + + ManagedTrackParmPtr extrapolateToVolumeWithPathLimit( + const EventContext& ctx, + Cache& cache, + TrackParmPtr parm, + double pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + const Trk::TrackingVolume* destVol, + MaterialUpdateMode matupmod = addNoise) const; /** Private method for extrapolation in intermediate volume to boundary surface - Parameters are: IPropagator& prop ... propagator to be used @@ -660,130 +697,151 @@ VERBOSE : Method call sequence with values const BoundaryCheck& bcheck ... boolean for bounday check ParticleHypothesis particle ... the particle hypothesis std::vector<const TrackParameters*>* dethits ... for blind extrapolation - it will call: - A) toVolumeBoundaryStaticLayers() for a TrackingVolume with static layers - C) toVolumeBoundaryDetachedVolumes() for a TrackingVolume with detached inner Volumes */ - void extrapolateToVolumeBoundary(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Layer* associatedLayer, - const TrackingVolume& tvol, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise - ) const; - - /** Private method to step from one to the last + void extrapolateToVolumeBoundary( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Layer* associatedLayer, + const TrackingVolume& tvol, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; + + /** Private method to step from one to the last layer and stop at last layer (before 0) or before destination layer */ - ManagedTrackParmPtr extrapolateFromLayerToLayer(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const TrackingVolume& tvol, - const Layer* nextLayer, - const Layer* destinationLayer, - TrackParmPtr navParameters, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise - ) const; + ManagedTrackParmPtr extrapolateFromLayerToLayer( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const TrackingVolume& tvol, + const Layer* nextLayer, + const Layer* destinationLayer, + TrackParmPtr navParameters, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; /** Private to extrapolate to the destination layer + surface - */ - ManagedTrackParmPtr extrapolateToDestinationLayer(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Surface& sf, - const Layer& lay, - const TrackingVolume& tvol, - const Layer* startLayer, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise - ) const; + */ + ManagedTrackParmPtr extrapolateToDestinationLayer( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Surface& sf, + const Layer& lay, + const TrackingVolume& tvol, + const Layer* startLayer, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const; /** Private to extrapolate to the destination layer + surface, special treatment for exit layer * @return valid track parameters or nullptr, as first element and in case of nullptr as second element * true to indicate to kill the loop from material update(?) - */ - std::pair<ManagedTrackParmPtr,bool> - extrapolateToIntermediateLayer(Cache& cache, - const IPropagator& prop, - TrackParmPtr parm, - const Layer& lay, - const TrackingVolume& tvol, - PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise, - bool perpendicularCheck = true) const; + */ + std::pair<ManagedTrackParmPtr, bool> extrapolateToIntermediateLayer( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Layer& lay, + const TrackingVolume& tvol, + PropDirection dir = anyDirection, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise, + bool perpendicularCheck = true) const; /** Private to search for overlap surfaces */ - void overlapSearch(Cache& cache, + void overlapSearch(const EventContext& ctx, + Cache& cache, const IPropagator& prop, TrackParmPtr parm, TrackParmPtr parsOnLayer, const Layer& lay, const TrackingVolume& tvol, PropDirection dir = anyDirection, - const BoundaryCheck& bcheck = true, - ParticleHypothesis particle=pion, + const BoundaryCheck& bcheck = true, + ParticleHypothesis particle = pion, bool startingLayer = false) const; - /** Private method for chosing the propagator in the simple/full configured mode */ unsigned int propagatorType(const TrackingVolume& tvol) const; - /** Private method for Initial Extrapolation setup + /** Private method for Initial Extrapolation setup -> overwrites the given pointers for the start and destination parameters -> returns a direction for the Navigation : - - usually dir if dir @f$ \in @f$ [ Trk::alongMomentum, Trk::oppositeMomentum ] + - usually dir if dir @f$ \in @f$ [ Trk::alongMomentum, Trk::oppositeMomentum ] - a chosen one if dir == Trk::anyDirection */ - PropDirection initializeNavigation(Cache& cache, - const Trk::IPropagator& prop, - TrackParmPtr startPars, - const Trk::Surface& destSurface, - Trk::PropDirection dir, - ParticleHypothesis particle, - ManagedTrackParmPtr& referenceParameters, - const Trk::Layer*& associatedLayer, - const Trk::TrackingVolume*& associatedVolume, - const Trk::TrackingVolume*& destinationVolume) const; - - /** RadialDirection helper method + PropDirection initializeNavigation( + const EventContext& ctx, + Cache& cache, + const Trk::IPropagator& prop, + TrackParmPtr startPars, + const Trk::Surface& destSurface, + Trk::PropDirection dir, + ParticleHypothesis particle, + ManagedTrackParmPtr& referenceParameters, + const Trk::Layer*& associatedLayer, + const Trk::TrackingVolume*& associatedVolume, + const Trk::TrackingVolume*& destinationVolume) const; + + /** RadialDirection helper method - inbound : -1 - outbound: 1 */ - int radialDirection(const Trk::TrackParameters& pars, PropDirection dir) const; + int radialDirection(const Trk::TrackParameters& pars, PropDirection dir) const; /** Check for punchThrough in case of radial (perpendicular) direction change, returns true if the radial direction change is actually ok (i.e. punch-through allowed) */ - bool radialDirectionCheck(const IPropagator& prop, + bool radialDirectionCheck(const EventContext& ctx, + const IPropagator& prop, const TrackParameters& startParm, const TrackParameters& parsOnLayer, const TrackingVolume& tvol, PropDirection dir = anyDirection, - ParticleHypothesis particle=pion) const; + ParticleHypothesis particle = pion) const; /** Access the subPropagator to the given volume*/ - virtual const IPropagator* subPropagator(const TrackingVolume& tvol) const override; + virtual const IPropagator* subPropagator( + const TrackingVolume& tvol) const override; /** Access the subPropagator to the given volume*/ - const IMaterialEffectsUpdator* subMaterialEffectsUpdator(const TrackingVolume& tvol) const; + const IMaterialEffectsUpdator* subMaterialEffectsUpdator( + const TrackingVolume& tvol) const; + /** Get the IMaterialEffectsUpdator::ICache for the MaterialEffectsUpdator*/ + IMaterialEffectsUpdator::ICache& subMaterialEffectsUpdatorCache( + Cache& cache, + const TrackingVolume& tvol) const; + + /** Prepare the IMaterialEffectsUpdator::ICache for each + * Material Effects updator */ + void populateMatEffUpdatorCache(Cache& cache) const; + + /** Private method for setting recall Information */ - void setRecallInformation(Cache& cache,const Surface&, const Layer&, const TrackingVolume&) const; + void setRecallInformation(Cache& cache, + const Surface&, + const Layer&, + const TrackingVolume&) const; /** Private method for resetting the recallInformation */ void resetRecallInformation(Cache& cache) const; /** Private method for throwing into the GarbageBin */ - void throwIntoGarbageBin(Cache& cache,const Trk::TrackParameters* garbage) const; + void throwIntoGarbageBin(Cache& cache, const Trk::TrackParameters* garbage) const; /** Private method for emptying the GarbageBin */ void emptyGarbageBin(Cache& cache) const; @@ -791,7 +849,7 @@ VERBOSE : Method call sequence with values /** Private method to return from extrapolate() main method, cleans up, calls model action or validation action, empties garbage bin and leaves */ - const Trk::TrackParameters *returnResult(Cache& cache,const Trk::TrackParameters* result) const; + const Trk::TrackParameters* returnResult(Cache& cache, const Trk::TrackParameters* result) const; /** For the output - layer */ std::string layerRZoutput(const Trk::Layer& lay) const; @@ -802,7 +860,8 @@ VERBOSE : Method call sequence with values std::string momentumOutput(const Amg::Vector3D& mom) const; /** helper method for MaterialEffectsOnTrack to be added */ - void addMaterialEffectsOnTrack(Cache& cache, + void addMaterialEffectsOnTrack(const EventContext& ctx, + Cache& cache, const Trk::IPropagator& prop, TrackParmPtr parm, const Trk::Layer& lay, @@ -810,168 +869,136 @@ VERBOSE : Method call sequence with values Trk::PropDirection propDir, Trk::ParticleHypothesis) const; - void dumpCache(Cache& cache,const std::string& txt) const; - bool checkCache(Cache& cache,const std::string& txt) const; + void dumpCache(Cache& cache, const std::string& txt) const; + bool checkCache(Cache& cache, const std::string& txt) const; - /** Private method for conversion of the synchronized geometry signature to the natural subdetector ordering */ - //unsigned int geoIDToDetOrder(Trk::GeometrySignature geoid) const; + /** Private method for conversion of the synchronized geometry signature to + * the natural subdetector ordering */ + // unsigned int geoIDToDetOrder(Trk::GeometrySignature geoid) const; // --------------- Used Tools ----------------------------- // - ToolHandleArray< IPropagator > m_propagators; //!< Array of Propagators - ToolHandle< IPropagator > m_stepPropagator; //!< Array of Propagators - ToolHandle< INavigator > m_navigator; //!< Navigator for TrackingGeometry and magnetic fiels acces - ToolHandleArray< IMaterialEffectsUpdator > m_updaters; //!< Array of Material updaters - ToolHandleArray< IMultipleScatteringUpdator > m_msupdaters; //!< Array of MultipleScattering updaters - ToolHandleArray< IEnergyLossUpdator > m_elossupdaters; //!< Array of EnergyLoss updaters + //!< Array of Propagators + ToolHandleArray<IPropagator> m_propagators{ this, "Propagators", {} }; + //!< Steo Propagator + ToolHandle<IPropagator> m_stepPropagator{ + this, + "STEP_Propagator", + "Trk::STEP_Propagator/AtlasSTEP_Propagator" + }; + //!< Navigator for TrackingGeometry and magnetic fiels acces + ToolHandle<INavigator> m_navigator{ this, + "Navigator", + "Trk::Navigator/AtlasNavigator" }; + //!< Array of Material updaters + ToolHandleArray<IMaterialEffectsUpdator> m_updaters{ + this, + "MaterialEffectsUpdators", + {} + }; + //!< Array of MultipleScattering updaters + ToolHandleArray<IMultipleScatteringUpdator> m_msupdaters{ + this, + "MultipleScatteringUpdators", + {} + }; + //!< Array of EnergyLoss updaters + ToolHandleArray<IEnergyLossUpdator> m_elossupdaters{ this, + "EnergyLossUpdators", + {} }; // ---------------- For Extrapolation handling ------------ // - std::vector<const IPropagator*> m_subPropagators; //!< Propagators to chose from (steered by signature) - std::vector<const IMaterialEffectsUpdator*> m_subupdaters; //!< updaters to chose from (steered by signature) + std::vector<const IPropagator*> m_subPropagators; //!< Propagators to chose from (steered by signature) + std::vector<const IMaterialEffectsUpdator*> m_subupdaters; //!< updaters to chose from (steered by signature) // ---------------- For Extrapolator configuration ------------ // - std::vector<std::string> m_propNames; //!< configuration of subPropagators - std::vector<std::string> m_updatNames; //!< configuration of subupdaters + std::vector<std::string> m_propNames; //!< configuration of subPropagators + std::vector<std::string> m_updatNames; //!< configuration of subupdaters // --------------- General steering & Navigation -------------- // - bool m_includeMaterialEffects; //!< boolean to switch on/off material effects - bool m_requireMaterialDestinationHit; //!< require the destination surface hit for material collection - bool m_stopWithNavigationBreak; //!< return 0 if navigation breaks - for validation reasons - bool m_stopWithUpdateZero; //!< return 0 if update kills the trajectory - bool m_subSurfaceLevel; //!< tep down to sub-surface level - bool m_skipInitialLayerUpdate; //!< skip the initial post-Update at the layer [Fatras conversion mode] - bool m_extendedLayerSearch; //!< extended layer search - bool m_robustSampling; - bool m_referenceMaterial; //!< use the reference material for the update - bool m_resolveActive; - bool m_resolveMultilayers; - bool m_cacheLastMatLayer; //!< steering of the material layer cache - bool m_returnPassiveLayers; - unsigned int m_meotpIndex; //!< if several meotps are available in a volume steer which one to use - unsigned int m_configurationLevel; //!< see the supported levels of configuration above - unsigned int m_searchLevel; //!< see the supported search levels above - unsigned int m_initialLayerAttempts; //!< allowed layer intersection attempts at the start of a volume - unsigned int m_successiveLayerAttempts; //!< layer intersection attemps after one layer has been hit sucessfully - unsigned int m_maxMethodSequence; - double m_tolerance; //!< surfacen & volume tolerance - // ------------------------------------------------------- // - bool m_activeOverlap; //!< consider overlaps between active muon volumes - bool m_useMuonMatApprox; //!< use approximative MS inert material - bool m_useDenseVolumeDescription; //!< use dense volume description when available in ID/Calo - bool m_checkForCompundLayers; //!< use the multi-layer tests for compound layers - - unsigned int m_maxNavigSurf; - unsigned int m_maxNavigVol; - bool m_dumpCache; + bool m_includeMaterialEffects; //!< boolean to switch on/off material effects + bool m_requireMaterialDestinationHit; //!< require the destination surface hit for material collection + bool m_stopWithNavigationBreak; //!< return 0 if navigation breaks - for validation reasons + bool m_stopWithUpdateZero; //!< return 0 if update kills the trajectory + bool m_subSurfaceLevel; //!< tep down to sub-surface level + bool m_skipInitialLayerUpdate; //!< skip the initial post-Update at the layer [Fatras conversion mode] + bool m_extendedLayerSearch; //!< extended layer search + bool m_robustSampling; + bool m_referenceMaterial; //!< use the reference material for the update + bool m_resolveActive; + bool m_resolveMultilayers; + bool m_cacheLastMatLayer; //!< steering of the material layer cache + bool m_returnPassiveLayers; + unsigned int m_meotpIndex; //!< if several meotps are available in a volume steer which one to use + unsigned int m_configurationLevel; //!< see the supported levels of configuration above + unsigned int m_searchLevel; //!< see the supported search levels above + unsigned int m_initialLayerAttempts; //!< allowed layer intersection attempts at the start of a volume + unsigned int m_successiveLayerAttempts; //!< layer intersection attemps after one layer has been hit sucessfully + unsigned int m_maxMethodSequence; + double m_tolerance; //!< surfacen & volume tolerance + // ------------------------------------------------------- // + bool m_activeOverlap; //!< consider overlaps between active muon volumes + bool m_useMuonMatApprox; //!< use approximative MS inert material + bool m_useDenseVolumeDescription; //!< use dense volume description when available in ID/Calo + bool m_checkForCompundLayers; //!< use the multi-layer tests for compound layers + unsigned int m_maxNavigSurf; + unsigned int m_maxNavigVol; + bool m_dumpCache; //------------ Magnetic field properties - bool m_fastField; - Trk::MagneticFieldProperties m_fieldProperties; - + bool m_fastField; + Trk::MagneticFieldProperties m_fieldProperties; //------------Reference surface -------------- - - Surface* m_referenceSurface; - + Surface* m_referenceSurface; //-------------------------- SCREEN output steering -------------------------------------------// - bool m_printHelpOutputAtInitialize; - bool m_printRzOutput; + bool m_printHelpOutputAtInitialize; + bool m_printRzOutput; //------------------------- VALIDATION SECTION ------------------------------------------// - //flags - bool m_navigationStatistics; //!< steer the output for the navigaiton statistics - bool m_navigationBreakDetails; //!< steer the output for the navigation break details - bool m_materialEffectsOnTrackValidation; //!< mat effects on track validation - //extrapolation counters - - mutable Gaudi::Accumulators::Counter<int> m_extrapolateCalls; //!< number of calls: extrapolate() method - mutable Gaudi::Accumulators::Counter<int> m_extrapolateBlindlyCalls; //!< number of calls: extrapolateBlindly() method - mutable Gaudi::Accumulators::Counter<int> m_extrapolateDirectlyCalls; //!< number of calls: extrapolateDirectly() method - mutable Gaudi::Accumulators::Counter<int> m_extrapolateStepwiseCalls; //!< number of calls: extrapolateStepwise() method - - mutable Gaudi::Accumulators::Counter<int> m_startThroughAssociation; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_startThroughRecall; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_startThroughGlobalSearch; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_destinationThroughAssociation; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_destinationThroughRecall; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_destinationThroughGlobalSearch; //!< navigation intialization - mutable Gaudi::Accumulators::Counter<int> m_layerSwitched; //!< number of layers that have been switched - - //navigation counters - mutable Gaudi::Accumulators::Counter<int> m_navigationBreakLoop; //!< number of navigation breaks due to loop - mutable Gaudi::Accumulators::Counter<int> m_navigationBreakOscillation; //!< number of navigation breaks due to oscillation - mutable Gaudi::Accumulators::Counter<int> m_navigationBreakNoVolume; //!< number of navigation breaks due no Volume found - mutable Gaudi::Accumulators::Counter<int> m_navigationBreakDistIncrease; //!< number of navigation breaks due to distance increase - mutable Gaudi::Accumulators::Counter<int> m_navigationBreakVolumeSignature; //!< number of navigation breaks due to distance increase - mutable Gaudi::Accumulators::Counter<int> m_overlapSurfaceHit; //!< number of OverlapSurfaces found - - mutable Gaudi::Accumulators::Counter<int> m_meotSearchCallsFw; //!< how often the meot search is called: forward - mutable Gaudi::Accumulators::Counter<int> m_meotSearchCallsBw; //!< how often the meot search is called: backward - mutable Gaudi::Accumulators::Counter<int> m_meotSearchSuccessfulFw; //!< how often the meot search was successful: forward - mutable Gaudi::Accumulators::Counter<int> m_meotSearchSuccessfulBw; //!< how often the meot search was successful: backward + // flags + bool m_navigationStatistics; //!< steer the output for the navigaiton statistics + bool m_navigationBreakDetails; //!< steer the output for the navigation break details + bool m_materialEffectsOnTrackValidation; //!< mat effects on track validation + + // extrapolation counters + mutable Gaudi::Accumulators::Counter<int> m_extrapolateCalls; //!< number of calls: extrapolate() method + mutable Gaudi::Accumulators::Counter<int> + m_extrapolateBlindlyCalls; //!< number of calls: extrapolateBlindly() method + mutable Gaudi::Accumulators::Counter<int> + m_extrapolateDirectlyCalls; //!< number of calls: extrapolateDirectly() method + mutable Gaudi::Accumulators::Counter<int> + m_extrapolateStepwiseCalls; //!< number of calls: extrapolateStepwise() method + + mutable Gaudi::Accumulators::Counter<int> m_startThroughAssociation; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_startThroughRecall; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_startThroughGlobalSearch; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_destinationThroughAssociation; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_destinationThroughRecall; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_destinationThroughGlobalSearch; //!< navigation intialization + mutable Gaudi::Accumulators::Counter<int> m_layerSwitched; //!< number of layers that have been switched + + // navigation counters + mutable Gaudi::Accumulators::Counter<int> m_navigationBreakLoop; //!< number of navigation breaks due to loop + mutable Gaudi::Accumulators::Counter<int> + m_navigationBreakOscillation; //!< number of navigation breaks due to oscillation + mutable Gaudi::Accumulators::Counter<int> + m_navigationBreakNoVolume; //!< number of navigation breaks due no Volume found + mutable Gaudi::Accumulators::Counter<int> + m_navigationBreakDistIncrease; //!< number of navigation breaks due to distance increase + mutable Gaudi::Accumulators::Counter<int> + m_navigationBreakVolumeSignature; //!< number of navigation breaks due to distance increase + mutable Gaudi::Accumulators::Counter<int> m_overlapSurfaceHit; //!< number of OverlapSurfaces found + + mutable Gaudi::Accumulators::Counter<int> m_meotSearchCallsFw; //!< how often the meot search is called: forward + mutable Gaudi::Accumulators::Counter<int> m_meotSearchCallsBw; //!< how often the meot search is called: backward + mutable Gaudi::Accumulators::Counter<int> + m_meotSearchSuccessfulFw; //!< how often the meot search was successful: forward + mutable Gaudi::Accumulators::Counter<int> + m_meotSearchSuccessfulBw; //!< how often the meot search was successful: backward }; -inline const TrackingGeometry* Extrapolator::trackingGeometry() const -{ - if (m_navigator) return m_navigator->trackingGeometry(); - return nullptr; -} - -inline const IPropagator* Extrapolator::subPropagator(const Trk::TrackingVolume& tvol) const -{ - const IPropagator* currentPropagator = (tvol.geometrySignature() < m_subPropagators.size()) ? - m_subPropagators[tvol.geometrySignature()] : nullptr; - - if (tvol.geometrySignature()==Trk::Calo && m_useDenseVolumeDescription) currentPropagator= (Trk::MS < m_subPropagators.size()) ? - m_subPropagators[Trk::MS] : nullptr; - - if (!currentPropagator) - msg(MSG::ERROR) << "[!] Configuration problem: no Propagator found for volumeSignature: " << tvol.geometrySignature() << endmsg; - return currentPropagator; -} - -inline const IMaterialEffectsUpdator* Extrapolator::subMaterialEffectsUpdator(const Trk::TrackingVolume& tvol) const -{ - return (tvol.geometrySignature() < m_subupdaters.size()) ? - m_subupdaters[tvol.geometrySignature()] : nullptr; -} - - -inline void Extrapolator::setRecallInformation(Cache& cache, - const Surface& rsf, - const Layer& rlay, - const TrackingVolume& rvol) const -{ - cache.m_recall = true; - cache.m_recallSurface = &rsf; - cache.m_recallLayer = &rlay; - cache.m_recallTrackingVolume = &rvol; -} - -inline void Extrapolator::resetRecallInformation(Cache& cache) const -{ - cache.m_recall = false; - cache.m_recallSurface = nullptr; - cache.m_recallLayer = nullptr; - cache.m_recallTrackingVolume = nullptr; -} - -inline void Extrapolator::throwIntoGarbageBin(Cache& cache, - const Trk::TrackParameters* pars) const -{ - if (pars) cache.m_garbageBin[pars] = true; -} - -inline const Trk::TrackParameters* Extrapolator::returnResult(Cache& cache, - const Trk::TrackParameters* result) const -{ - (void) cache; - // call the model action on the material effect updaters - for (unsigned int imueot = 0; imueot < m_subupdaters.size(); ++imueot){ - m_subupdaters[imueot]->modelAction(); - } - // return the result - return result; -} } // end of namespace +#include "TrkExTools/Extrapolator.icc" + #endif // TRKEXTOOLS_TRKEXTRAPOLATOR_H diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.icc b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.icc new file mode 100644 index 0000000000000000000000000000000000000000..ba4c099010a65ed28a73e11282dca4f896ed2f8e --- /dev/null +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.icc @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ +namespace Trk { + +inline const TrackingGeometry* +Extrapolator::trackingGeometry() const +{ + if (m_navigator) + return m_navigator->trackingGeometry(); + return nullptr; +} + +inline const IPropagator* +Extrapolator::subPropagator(const Trk::TrackingVolume& tvol) const +{ + const IPropagator* currentPropagator = + (tvol.geometrySignature() < m_subPropagators.size()) + ? m_subPropagators[tvol.geometrySignature()] + : nullptr; + + if (tvol.geometrySignature() == Trk::Calo && m_useDenseVolumeDescription) { + currentPropagator = + (Trk::MS < m_subPropagators.size()) ? m_subPropagators[Trk::MS] : nullptr; + } + if (!currentPropagator) { + ATH_MSG_ERROR( + "[!] Configuration problem: no Propagator found for volumeSignature: " + << tvol.geometrySignature()); + } + return currentPropagator; +} + +inline const IMaterialEffectsUpdator* +Extrapolator::subMaterialEffectsUpdator(const Trk::TrackingVolume& tvol) const +{ + return (tvol.geometrySignature() < m_subupdaters.size()) + ? m_subupdaters[tvol.geometrySignature()] + : nullptr; +} + +inline IMaterialEffectsUpdator::ICache& +Extrapolator::subMaterialEffectsUpdatorCache(Cache& cache, + const TrackingVolume& tvol) const +{ + return *(cache.m_MaterialUpCache[tvol.geometrySignature()]); +} + + +inline void +Extrapolator::populateMatEffUpdatorCache(Cache& cache) const +{ + size_t numUpdaters=m_subupdaters.size(); + cache.m_MaterialUpCache.reserve(numUpdaters); + for (size_t i=0; i< numUpdaters ; ++i) { + cache.m_MaterialUpCache.emplace_back(m_subupdaters[i]->getCache()); + } +} + +inline void +Extrapolator::setRecallInformation(Cache& cache, + const Surface& rsf, + const Layer& rlay, + const TrackingVolume& rvol) const +{ + cache.m_recall = true; + cache.m_recallSurface = &rsf; + cache.m_recallLayer = &rlay; + cache.m_recallTrackingVolume = &rvol; +} + +inline void +Extrapolator::resetRecallInformation(Cache& cache) const +{ + cache.m_recall = false; + cache.m_recallSurface = nullptr; + cache.m_recallLayer = nullptr; + cache.m_recallTrackingVolume = nullptr; +} + +inline void +Extrapolator::throwIntoGarbageBin(Cache& cache, + const Trk::TrackParameters* pars) const +{ + if (pars) + cache.m_garbageBin[pars] = true; +} + +inline const Trk::TrackParameters* +Extrapolator::returnResult(Cache& cache, + const Trk::TrackParameters* result) const +{ + (void)cache; + // call the model action on the material effect updaters + for (unsigned int imueot = 0; imueot < m_subupdaters.size(); ++imueot) { + m_subupdaters[imueot]->modelAction(); + } + // return the result + return result; +} +} diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h index 568864c4d5d3e8a3f8a630f4a4c9441ad70e88a7..148939e7c31e22b918e7909f61e8d0667f9d802f 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/MaterialEffectsUpdator.h @@ -74,26 +74,35 @@ class MaterialEffectsUpdator : public AthAlgTool, /* * The concrete cache class for this specialization of the IMaterialEffectsUpdator - */ - typedef IMaterialEffectsUpdator::ICache ICache; - class Cache : public ICache{ - public : - Cache():validationLayer{nullptr}, - validationSteps{0}, - validationPhi{0.}, - validationEta{0.}, - accumulatedElossSigma{0.}{ - } - const Trk::Layer* validationLayer{nullptr}; //!< layer in the current validation setp - int validationSteps{0}; //!< number of validation steps - double validationPhi{0.}; //!< theta - double validationEta{0.}; //!< eta - double accumulatedElossSigma{0.}; //!< Sigma of the eloss accumulated so far in the extrapolation. Used in Landau mode + */ + typedef IMaterialEffectsUpdator::ICache ICache; + class Cache : public ICache + { + public: + Cache() + : validationLayer{ nullptr } + , validationSteps{ 0 } + , validationPhi{ 0. } + , validationEta{ 0. } + , accumulatedElossSigma{ 0. } + {} + virtual MaterialCacheType type() const override final + { + return ICache::MaterialEffects; + } + //!< layer in the current validation step + const Trk::Layer* validationLayer{ nullptr }; + int validationSteps{ 0 }; //!< number of validation steps + double validationPhi{ 0. }; //!< theta + double validationEta{ 0. }; //!< eta + //!< Sigma of the eloss accumulated so far in the extrapolation. Used in Landau mode + double accumulatedElossSigma{ 0. }; }; - virtual std::unique_ptr<ICache> getCache() const override { + virtual std::unique_ptr<ICache> getCache() const override final + { return std::make_unique<Cache>(); - } + } /** Updator interface (full update for a layer) ---> ALWAYS the same pointer is returned @@ -105,8 +114,11 @@ class MaterialEffectsUpdator : public AthAlgTool, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const override { - - Cache& cache= dynamic_cast<Cache&> (icache); + if(icache.type()!=ICache::MaterialEffects){ + ATH_MSG_WARNING("Wrong cache Type"); + return nullptr; + } + Cache& cache= static_cast<Cache&> (icache); const TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode); return outparam; } @@ -115,75 +127,105 @@ class MaterialEffectsUpdator : public AthAlgTool, ---> ALWAYS the same pointer is returned the pointer to the same TrackParameters object is returned, it is manipulated - */ - virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { - - Cache& cache= dynamic_cast<Cache&> (icache); - const TrackParameters* outparam = updateImpl(cache,parm,meff,particle,matupmode); + */ + virtual const TrackParameters* update(ICache& icache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { + + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + return nullptr; + } + Cache& cache = static_cast<Cache&>(icache); + const TrackParameters* outparam = updateImpl(cache, parm, meff, particle, matupmode); return outparam; } /** Updator interface (pre-update for a layer): - ---> ALWAYS the same pointer is returned + ---> ALWAYS the same pointer is returned the pointer to the same TrackParametes object is returned, it is manipulated (if.preUpdateMaterial()) - */ - virtual const TrackParameters* preUpdate(ICache& icache, const TrackParameters* parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { - - Cache& cache= dynamic_cast<Cache&> (icache); - const TrackParameters* outparam = preUpdateImpl(cache,parm,sf,dir,particle,matupmode); + */ + virtual const TrackParameters* preUpdate(ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + return nullptr; + } + Cache& cache = static_cast<Cache&>(icache); + const TrackParameters* outparam = preUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } - /** Updator interface (post-update for a layer): + /** Updator interface (post-update for a layer): ---> ALWAYS pointer to new TrackParameters are returned if no postUpdate is to be done : return 0 - */ - virtual const TrackParameters* postUpdate(ICache& icache,const TrackParameters& parm, - const Layer& sf, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override{ - - Cache& cache= dynamic_cast<Cache&> (icache); - const TrackParameters* outparam = postUpdateImpl(cache,parm,sf,dir,particle,matupmode); + */ + virtual const TrackParameters* postUpdate( + ICache& icache, + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + return nullptr; + } + Cache& cache = static_cast<Cache&>(icache); + const TrackParameters* outparam = postUpdateImpl(cache, parm, sf, dir, particle, matupmode); return outparam; } /** Dedicated Updator interface:-> create new track parameters*/ - virtual const TrackParameters* update(ICache& icache, const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir=alongMomentum, - ParticleHypothesis particle=pion, - MaterialUpdateMode matupmode=addNoise) const override { - - Cache& cache= dynamic_cast<Cache&> (icache); - const TrackParameters* outparam = updateImpl(cache,parm,mprop,pathcorrection,dir,particle,matupmode); + virtual const TrackParameters* update(ICache& icache, + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const override + { + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + return nullptr; + } + Cache& cache = static_cast<Cache&>(icache); + const TrackParameters* outparam = + updateImpl(cache, parm, mprop, pathcorrection, dir, particle, matupmode); return outparam; } /** Validation Action - calls the writing and resetting of the TTree variables */ - virtual void validationAction(ICache& icache) const override { - - Cache& cache= dynamic_cast<Cache&> (icache); + virtual void validationAction(ICache& icache) const override + { + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + } + Cache& cache = static_cast<Cache&>(icache); validationActionImpl(cache); - } + } /** Only has an effect if m_landauMode == true. Resets mutable variables used for non-local calculation of energy loss if parm == 0. Otherwise, modifies parm with the final update of the covariance matrix*/ - virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const override { + virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const override + { - Cache& cache= dynamic_cast<Cache&> (icache); - modelActionImpl(cache,parm); - } + if (icache.type() != ICache::MaterialEffects) { + ATH_MSG_WARNING("Wrong cache Type"); + } + Cache& cache = static_cast<Cache&>(icache); + modelActionImpl(cache, parm); + } public: /* diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Navigator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Navigator.h index 9f797a7d8ebeaef61fa90be71458034d3aed7f0e..ce3a1fbb1d7bce42f0d308b786ae82bbfdc4b798 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Navigator.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Navigator.h @@ -63,68 +63,90 @@ namespace Trk { virtual public INavigator { public: /** Constructor */ - Navigator(const std::string&,const std::string&,const IInterface*); + Navigator(const std::string&, const std::string&, const IInterface*); /** Destructor */ virtual ~Navigator(); - + /** AlgTool initialize method.*/ virtual StatusCode initialize() override; /** AlgTool finalize method */ virtual StatusCode finalize() override; - - /** INavigator interface method - returns the TrackingGeometry used for navigation */ - virtual const TrackingGeometry* trackingGeometry() const override final; - - /** INavigator interface methods - global search for the Volume one is in */ - virtual const TrackingVolume* volume(const Amg::Vector3D& gp) const override final; - + + /** INavigator interface method - returns the TrackingGeometry used for + * navigation */ + virtual const TrackingGeometry* trackingGeometry() const override final; + + /** INavigator interface methods - global search for the Volume one is in + */ + virtual const TrackingVolume* volume( + const Amg::Vector3D& gp) const override final; + /** INavigator interface method - forward hightes TrackingVolume */ - virtual const TrackingVolume* highestVolume() const override final; - - /** INavigator interface methods - getting the next BoundarySurface not knowing the Volume*/ - virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir) const override final; - - /** INavigator interface methods - getting the next BoundarySurface when knowing the Volume*/ - virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir, - const TrackingVolume& vol ) const override final; - - /** INavigator interface method - getting the next Volume and the parameter for the next Navigation*/ - virtual NavigationCell nextTrackingVolume( const IPropagator& prop, - const TrackParameters& parms, - PropDirection dir, - const TrackingVolume& vol) const override final; - - /** INavigator interface method - getting the next Volume and the parameter for the next Navigation + virtual const TrackingVolume* highestVolume() const override final; + + /** INavigator interface method - getting the closest TrackParameters from + * a Track to a Surface*/ + virtual const TrackParameters* closestParameters( + const Track& trk, + const Surface& sf, + const IPropagator* prop = nullptr) const override final; + + /** INavigator method to resolve navigation at boundary */ + virtual bool atVolumeBoundary(const Trk::TrackParameters* parms, + const Trk::TrackingVolume* vol, + Trk::PropDirection dir, + const Trk::TrackingVolume*& nextVol, + double tol) const override final; + + /** Validation Action: + Can be implemented optionally, outside access to internal validation + steps */ + virtual void validationAction() const override {} + + using INavigator::nextBoundarySurface; + using INavigator::nextTrackingVolume; + using INavigator::nextDenseTrackingVolume; + + /** INavigator interface methods - getting the next BoundarySurface not + * knowing the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir) const override final; + + /** INavigator interface methods - getting the next BoundarySurface when + * knowing the Volume*/ + virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const override final; + + /** INavigator interface method - getting the next Volume and the + * parameter for the next Navigation*/ + virtual NavigationCell nextTrackingVolume( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + PropDirection dir, + const TrackingVolume& vol) const override final; + + /** INavigator interface method - getting the next Volume and the + parameter for the next Navigation - contains full loop over volume boundaries */ - virtual NavigationCell nextDenseTrackingVolume( const IPropagator& prop, - const TrackParameters& parms, - const Surface* destination, - PropDirection dir, - ParticleHypothesis particle, - const TrackingVolume& vol, - double& path) const override final; - - /** INavigator interface method - getting the closest TrackParameters from a Track to a Surface*/ - virtual const TrackParameters* closestParameters( const Track& trk, - const Surface& sf, - const IPropagator* prop = nullptr) const override final; + virtual NavigationCell nextDenseTrackingVolume( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parms, + const Surface* destination, + PropDirection dir, + ParticleHypothesis particle, + const TrackingVolume& vol, + double& path) const override final; - /** INavigator method to resolve navigation at boundary */ - virtual bool atVolumeBoundary( const Trk::TrackParameters* parms, - const Trk::TrackingVolume* vol, - Trk::PropDirection dir, - const Trk::TrackingVolume*& nextVol, - double tol) const override final; - - /** Validation Action: - Can be implemented optionally, outside access to internal validation steps */ - virtual void validationAction() const override{} - private: /* * Methods to be overriden by the NavigatorValidation @@ -137,7 +159,7 @@ namespace Trk { void updateTrackingGeometry() const; - bool m_validationMode; //!<This becomes a dummy option for now + bool m_validationMode; //!<This becomes a dummy option for now /* **************************************************************** * According to Goetz Gaycken this needs special attention marking as @@ -167,7 +189,6 @@ namespace Trk { mutable Gaudi::Accumulators::Counter<int> m_backwardThirdBoundSwitch; //!< counter for failed third backward nextBounday calls mutable Gaudi::Accumulators::Counter<int> m_outsideVolumeCase; //!< counter for navigation-break in outside volume cases (ovc) mutable Gaudi::Accumulators::Counter<int> m_sucessfulBackPropagation; //!< counter for sucessful recovery of navigation-break in ovc - }; } // end of namespace diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/ObjContainer.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/ObjContainer.h index 9450ddae1d332c671dcb53a8aada65e2f83afe2b..8c4b9e7899d53c0cd45e1b5dd77ad9c153c79a11 100644 --- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/ObjContainer.h +++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/ObjContainer.h @@ -326,6 +326,9 @@ protected: if (ref) { this->throwObjectAlreadyDeleted( ref.idx()); } + if (m_freeIdx == std::numeric_limits<T_index>::max()) { + m_freeIdx=ref.idx(); + } ref=ObjRef<T_index>(); } } @@ -454,8 +457,25 @@ private: } // return ref; } - ref=ObjRef(static_cast<T_index>(m_objs.size())); - m_objs.push_back(std::make_pair(obj, initial_count)); + if (m_freeIdx == std::numeric_limits<T_index>::max() && m_objs.size() >= m_objs.capacity()) { + for (typename std::vector< std::pair<T_Obj *, T_signed_count> >::const_reverse_iterator + iter =m_objs.rbegin(); + iter != m_objs.rend(); + ++iter) { + if (iter->second==0) { + m_freeIdx=m_objs.rend()-iter-1; + } + } + } + if (m_freeIdx == std::numeric_limits<T_index>::max()) { + ref=ObjRef(static_cast<T_index>(m_objs.size())); + m_objs.push_back(std::make_pair(obj, initial_count)); + } + else { + m_objs[m_freeIdx] = std::make_pair( obj,initial_count); + ref=ObjRef(m_freeIdx); + m_freeIdx = std::numeric_limits<T_index>::max(); + } ensureValidity(ref); return ref; } @@ -464,6 +484,7 @@ private: constexpr static T_signed_count s_releasedObj = -1; ///< "share count" of released objects std::vector< std::pair<T_Obj *, T_signed_count> > m_objs; ///< The storage for the object pointers + T_index m_freeIdx=std::numeric_limits<T_index>::max(); }; /** Pointer to objects managed by @ref ObjContainer diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/EnergyLossUpdator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/EnergyLossUpdator.cxx index f328681955b186de90945a8034124d7bdebcf8a3..e061f15c21647cb58474da23ad0e38524e7dbad0 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/EnergyLossUpdator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/EnergyLossUpdator.cxx @@ -14,7 +14,7 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" -#include <math.h> +#include <cmath> namespace{ // static particle masses diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx index 26ee2eafcd0ce9add525eb34b8e12a995051a858..1602fdc5ed25ff608bbc6f8beafb1917dcbace55 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx @@ -43,7 +43,6 @@ inline Trk::TrackParameters *cloneObj<Trk::TrackParameters>(const Trk::TrackPara } #include "TrkExTools/Extrapolator.h" -#include "TrkExInterfaces/IPropagator.h" #include "TrkExInterfaces/IMultipleScatteringUpdator.h" #include "TrkExInterfaces/IEnergyLossUpdator.h" #include "TrkExUtils/IntersectionSolution.h" @@ -80,7 +79,7 @@ inline Trk::TrackParameters *cloneObj<Trk::TrackParameters>(const Trk::TrackPara #include <memory> #include <utility> -namespace{ +namespace { constexpr double s_distIncreaseTolerance = 100. * Gaudi::Units::millimeter; } @@ -93,12 +92,6 @@ bool Trk::Extrapolator::Cache::s_reported {}; // constructor Trk::Extrapolator::Extrapolator(const std::string &t, const std::string &n, const IInterface *p) : AthAlgTool(t, n, p), - m_propagators(), - m_stepPropagator("Trk::STEP_Propagator/AtlasSTEP_Propagator"), - m_navigator("Trk::Navigator/AtlasNavigator"), - m_updaters(), - m_msupdaters(), - m_elossupdaters(), m_subPropagators(Trk::NumberOfSignatures), m_subupdaters(Trk::NumberOfSignatures), m_propNames(), @@ -166,20 +159,14 @@ Trk::Extrapolator::Extrapolator(const std::string &t, const std::string &n, cons declareProperty("SkipInitialPostUpdate", m_skipInitialLayerUpdate); declareProperty("MaximalMethodSequence", m_maxMethodSequence); // propagation steering - declareProperty("Propagators", m_propagators); declareProperty("SubPropagators", m_propNames); - declareProperty("STEP_Propagator", m_stepPropagator); // material effects handling declareProperty("ApplyMaterialEffects", m_includeMaterialEffects); declareProperty("RequireMaterialDestinationHit", m_requireMaterialDestinationHit); - declareProperty("MaterialEffectsUpdators", m_updaters); - declareProperty("MultipleScatteringUpdators", m_msupdaters); - declareProperty("EnergyLossUpdators", m_elossupdaters); declareProperty("SubMEUpdators", m_updatNames); declareProperty("CacheLastMaterialLayer", m_cacheLastMatLayer); // general behavior navigation declareProperty("SearchLevelClosestParameters", m_searchLevel); - declareProperty("Navigator", m_navigator); // muon system specifics declareProperty("UseMuonMatApproximation", m_useMuonMatApprox); declareProperty("UseDenseVolumeDescription", m_useDenseVolumeDescription); @@ -260,8 +247,9 @@ Trk::Extrapolator::initialize() { if (m_includeMaterialEffects && not m_updaters.empty()) { ATH_CHECK( m_updaters.retrieve() ); for (auto& tool : m_updaters) { - // @TODO tools, that are already used, should not be disabled. Those are currently disabled to silence the warning - // issued by the tool usage detection, which is circumvented in case of the m_updaters. + // @TODO tools, that are already used, should not be disabled. Those are + // currently disabled to silence the warning issued by the tool usage + // detection, which is circumvented in case of the m_updaters. tool.disable(); } } @@ -273,6 +261,7 @@ Trk::Extrapolator::initialize() { auto extractNameFromTool = [] (const auto & toolHndl ){return toolHndl->name();}; std::transform(m_propagators.begin(), m_propagators.end(), fullPropagatorNames.begin(), extractNameFromTool ); std::transform(m_updaters.begin(), m_updaters.end(), fullUpdatorNames.begin(), extractNameFromTool ); + // ----------------------------------------------------------- // Sanity check 1 if (m_propNames.empty() && not m_propagators.empty()) { @@ -331,13 +320,20 @@ Trk::Extrapolator::initialize() { ATH_MSG_FATAL("Configuration Problem of Extrapolator: " << " -- At least one IPropagator and IMaterialUpdator instance have to be given.! "); } - const std::string propStr = std::to_string(numberOfSubPropagatorsGiven)+" propagator" + std::string((numberOfSubPropagatorsGiven == 1)? "":"s"); - const std::string updStr = std::to_string(numberOfSubMatEffUpdatersGiven)+" updater" + std::string((numberOfSubMatEffUpdatersGiven == 1)? "":"s"); - std::string msgString{"\nThe extrapolator uses six sub-propagators and sub-material effects updaters:\n"}; + const std::string propStr = + std::to_string(numberOfSubPropagatorsGiven) + " propagator" + + std::string((numberOfSubPropagatorsGiven == 1) ? "" : "s"); + const std::string updStr = + std::to_string(numberOfSubMatEffUpdatersGiven) + " updater" + + std::string((numberOfSubMatEffUpdatersGiven == 1) ? "" : "s"); + std::string msgString{ "\nThe extrapolator uses six sub-propagators and " + "sub-material effects updaters:\n" }; msgString += propStr + " and "+updStr+" were given in the configuration,\n"; msgString += "the extrapolator sub-tools have been defined as follows: \n"; for (int i(0);i != int(Trk::NumberOfSignatures);++i){ - msgString += std::to_string(i)+") propagator: "+m_subPropagators[i]->name()+", updater: "+m_subupdaters[i]->name()+"\n"; + msgString += std::to_string(i) + + ") propagator: " + m_subPropagators[i]->name() + + ", updater: " + m_subupdaters[i]->name() + "\n"; } ATH_MSG_VERBOSE(msgString); ATH_CHECK( m_stepPropagator.retrieve() ); @@ -421,17 +417,18 @@ Trk::Extrapolator::extrapolate(const xAOD::NeutralParticle &xnParticle, } const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const xAOD::TrackParticle &xtParticle, +Trk::Extrapolator::extrapolate(const EventContext& ctx, + const xAOD::TrackParticle &xtParticle, const Surface &sf, PropDirection dir, const BoundaryCheck& bcheck, ParticleHypothesis particle, MaterialUpdateMode matupmode) const { const Trk::Perigee &tPerigee = xtParticle.perigeeParameters(); - - // !< @TODO: search for closest parameter in on new curvilinear x/y/z and surface distance ... + // !< @TODO: search for closest parameter in on new curvilinear + // x/y/z and surface distance ... // ... for the moment ... take the perigee - return extrapolate(tPerigee, sf, dir, bcheck, particle, matupmode); + return extrapolate(ctx, tPerigee, sf, dir, bcheck, particle, matupmode); } const Trk::NeutralParameters * @@ -440,38 +437,26 @@ Trk::Extrapolator::extrapolate(const NeutralParameters ¶meters, PropDirection dir, const BoundaryCheck& bcheck) const { if (m_configurationLevel < 10) { - const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; + const IPropagator* currentPropagator = + !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; if (currentPropagator) { - return currentPropagator->propagate(parameters, sf, dir, bcheck); + return currentPropagator->propagate( parameters, sf, dir, bcheck); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); return nullptr; } -// Stratetgy Pattern extrapolation methods -// ---------------------------------------------------------------------------------------/ -const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const IPropagator &prop, - const Trk::TrackParameters &parm, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { - Cache cache{}; - return extrapolateImpl(cache,prop,cache.manage(parm).index(),sf,dir,bcheck,particle,matupmode).release(); -} - - -//--------------------------------------------------------------- Trk::TrackParametersUVector -Trk::Extrapolator::extrapolateStepwise(const IPropagator &prop, - const Trk::TrackParameters &parm, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle) const { +Trk::Extrapolator::extrapolateStepwiseImpl( + const EventContext& ctx, + const IPropagator& prop, + const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const +{ Cache cache{}; // statistics && sequence output ---------------------------------------- @@ -483,8 +468,11 @@ Trk::Extrapolator::extrapolateStepwise(const IPropagator &prop, Trk::TrackParametersVector tmp; cache.m_parametersOnDetElements = &tmp; cache.m_ownParametersOnDetElements = true; + //Material effect updator cache + populateMatEffUpdatorCache(cache); // run the extrapolation - ManagedTrackParmPtr parameterOnSf(extrapolateImpl(cache,prop, cache.manage(parm).index(), sf, dir, bcheck, particle)); + ManagedTrackParmPtr parameterOnSf(extrapolateImpl( + ctx, cache, prop, cache.manage(parm).index(), sf, dir, bcheck, particle)); // assign the return parameter and set cache.m_parametersOnDetElements = 0; if (parameterOnSf) { tmp.push_back(parameterOnSf.release()); @@ -501,66 +489,23 @@ Trk::Extrapolator::extrapolateStepwise(const IPropagator &prop, } return Trk::TrackParametersUVector (tmp.begin(), tmp.end()); } -const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const IPropagator &prop, - const Trk::Track &trk, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { - - // intialize the starting propagator - const IPropagator *searchProp = nullptr; - // get the propagator depending on the volume - if (m_searchLevel < 2) { - unsigned int iprop = (m_searchLevel > m_configurationLevel) ? m_searchLevel : m_configurationLevel; - searchProp = &(*m_propagators[iprop]); - } - // call the navigator - // @TODO leak ? - const Trk::TrackParameters *closestTrackParameters = m_navigator->closestParameters(trk, sf, searchProp); - if (closestTrackParameters) { - return(extrapolate(prop, *closestTrackParameters, sf, dir, bcheck, particle, matupmode)); - } - return nullptr; -} - -const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const IPropagator &prop, - const TrackParameters &parm, - const std::vector< MaterialEffectsOnTrack > &sfMeff, - const TrackingVolume &tvol, - PropDirection dir, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { - Cache cache{}; - return extrapolateImpl(cache,prop,cache.manage(parm).index(),sfMeff,tvol,dir,particle,matupmode).release(); -} -Trk::TrackParametersUVector -Trk::Extrapolator::extrapolateBlindly( - const IPropagator &prop, - const Trk::TrackParameters &parm, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - const Trk::Volume *boundaryVol) const { - Cache cache{}; - return extrapolateBlindlyImpl(cache,prop,cache.manage(parm).index(),dir,bcheck,particle,boundaryVol); -} - -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextActiveLayer( - const IPropagator &prop, - const Trk::TrackParameters &parm, +std::pair<const Trk::TrackParameters*, const Trk::Layer*> +Trk::Extrapolator::extrapolateToNextActiveLayerImpl( + const EventContext& ctx, + const IPropagator& prop, + const Trk::TrackParameters& parm, PropDirection dir, - const BoundaryCheck& bcheck, + const BoundaryCheck& bcheck, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ Cache cache{}; // statistics && sequence output ---------------------------------------- ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateToNextActiveLayer(...) "); + //Material effect updator cache + populateMatEffUpdatorCache(cache); // initialize the return parameters vector ManagedTrackParmPtr currPar(cache.manage(parm)); const Trk::TrackingVolume *staticVol = nullptr; @@ -570,9 +515,9 @@ std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::e // ----------------------------------------------------------------------- // while (currPar) { - // staticVol = m_navigator->trackingGeometry()->lowestStaticTrackingVolume(currPar->position()); assocLayer = nullptr; - ManagedTrackParmPtr nextPar(extrapolateToNextMaterialLayer(cache, + ManagedTrackParmPtr nextPar(extrapolateToNextMaterialLayer(ctx, + cache, prop, currPar.index(), destSurface, @@ -618,17 +563,22 @@ std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::e return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(currPar.release(), assocLayer); } -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextActiveLayerM( - const IPropagator &prop, - const Trk::TrackParameters &parm, +std::pair<const Trk::TrackParameters*, const Trk::Layer*> +Trk::Extrapolator::extrapolateToNextActiveLayerMImpl( + const EventContext& ctx, + const IPropagator& prop, + const Trk::TrackParameters& parm, PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface *> &material, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ Cache cache{}; ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateToNextActiveLayerM(...) "); + //Material effect updator cache + populateMatEffUpdatorCache(cache); // initialize the return parameters vector ManagedTrackParmPtr currPar(cache.manage(parm)); const Trk::TrackingVolume *staticVol = nullptr; @@ -638,17 +588,17 @@ std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::e cache.m_matstates = &material; while (currPar) { - // staticVol = m_navigator->trackingGeometry()->lowestStaticTrackingVolume(currPar->position()); assocLayer = nullptr; - ManagedTrackParmPtr nextPar( extrapolateToNextMaterialLayer(cache, - prop, - currPar.index(), - destSurface, - staticVol, - dir, - bcheck, - particle, - matupmode)); + ManagedTrackParmPtr nextPar(extrapolateToNextMaterialLayer(ctx, + cache, + prop, + currPar.index(), + destSurface, + staticVol, + dir, + bcheck, + particle, + matupmode)); if (nextPar) { if (cache.m_lastMaterialLayer && cache.m_lastMaterialLayer->surfaceRepresentation().isOnSurface(nextPar->position(), bcheck, m_tolerance, @@ -690,15 +640,18 @@ std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::e } Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Trk::Surface *destSurf, - const Trk::TrackingVolume *vol, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { +Trk::Extrapolator::extrapolateToNextMaterialLayer( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Trk::Surface* destSurf, + const Trk::TrackingVolume* vol, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateToNextMaterialLayer(...) "); @@ -737,7 +690,8 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } else { staticVol = m_navigator->trackingGeometry()->lowestStaticTrackingVolume(gp); const Trk::TrackingVolume *nextStatVol = nullptr; - if (m_navigator->atVolumeBoundary(currPar.get(), staticVol, dir, nextStatVol, m_tolerance) && nextStatVol != staticVol) { + if (m_navigator->atVolumeBoundary(currPar.get(), staticVol, dir, nextStatVol, m_tolerance) && + nextStatVol != staticVol) { staticVol = nextStatVol; } } @@ -753,17 +707,21 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, // alignable frame volume ? if (staticVol && staticVol->geometrySignature() == Trk::Calo) { if (staticVol->isAlignable()){ - const Trk::AlignableTrackingVolume *alignTV = static_cast<const Trk::AlignableTrackingVolume *> (staticVol); - cache.m_identifiedParameters.reset(); - return extrapolateInAlignableTV(cache,prop, currPar.index(), destSurf, alignTV, dir, particle); + const Trk::AlignableTrackingVolume* alignTV = + static_cast<const Trk::AlignableTrackingVolume*>(staticVol); + cache.m_identifiedParameters.reset(); + return extrapolateInAlignableTV( + ctx, cache, prop, currPar.index(), destSurf, alignTV, dir, particle); } } // update if new static volume - if (staticVol && (staticVol != cache.m_currentStatic || resolveActive != m_resolveActive)) { // retrieve boundaries + if (staticVol && (staticVol != cache.m_currentStatic || resolveActive != m_resolveActive)) { + // retrieve boundaries cache.m_currentStatic = staticVol; cache.m_staticBoundaries.clear(); - const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > > &bounds = staticVol->boundarySurfaces(); + const std::vector<SharedObject<const BoundarySurface<TrackingVolume>>>& bounds = + staticVol->boundarySurfaces(); for (unsigned int ib = 0; ib < bounds.size(); ib++) { const Trk::Surface &surf = (bounds[ib].get())->surfaceRepresentation(); cache.m_staticBoundaries.emplace_back(&surf, true); @@ -787,8 +745,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, (*iTer)->trackingVolume()->boundarySurfaces(); if (active) { if (resolveActive) { - cache.m_detachedVols.emplace_back(*iTer, - detBounds.size()); + cache.m_detachedVols.emplace_back(*iTer, detBounds.size()); for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) { const Trk::Surface &surf = (detBounds[ibb].get())->surfaceRepresentation(); cache.m_detachedBoundaries.emplace_back(&surf, true); @@ -807,28 +764,30 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } } } else if (staticVol->geometrySignature() != Trk::MS || - !m_useMuonMatApprox || (*iTer)->name().substr((*iTer)->name().size() - 4, 4) == "PERM") { // retrieve - // inert - // detached - // objects - // only if - // needed + !m_useMuonMatApprox || + (*iTer)->name().substr((*iTer)->name().size() - 4, 4) == + "PERM") { // retrieve + // inert + // detached + // objects + // only if + // needed if ((*iTer)->trackingVolume()->zOverAtimesRho() != 0. && (!(*iTer)->trackingVolume()->confinedDenseVolumes() || (*iTer)->trackingVolume()->confinedDenseVolumes()->empty()) && (!(*iTer)->trackingVolume()->confinedArbitraryLayers() || (*iTer)->trackingVolume()->confinedArbitraryLayers()->empty())) { - cache.m_denseVols.emplace_back((*iTer)->trackingVolume(), - detBounds.size()); + cache.m_denseVols.emplace_back((*iTer)->trackingVolume(),detBounds.size()); + for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) { const Trk::Surface &surf = (detBounds[ibb].get())->surfaceRepresentation(); cache.m_denseBoundaries.emplace_back(&surf, true); } } const std::vector<const Trk::Layer *> *confLays = (*iTer)->trackingVolume()->confinedArbitraryLayers(); - if ((*iTer)->trackingVolume()->confinedDenseVolumes() || (confLays && confLays->size() > detBounds.size())) { - cache.m_detachedVols.emplace_back(*iTer, - detBounds.size()); + if ((*iTer)->trackingVolume()->confinedDenseVolumes() || + (confLays && confLays->size() > detBounds.size())) { + cache.m_detachedVols.emplace_back(*iTer, detBounds.size()); for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) { const Trk::Surface &surf = (detBounds[ibb].get())->surfaceRepresentation(); cache.m_detachedBoundaries.emplace_back(&surf, true); @@ -836,19 +795,21 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } else if (confLays) { std::vector<const Trk::Layer *>::const_iterator lIt = confLays->begin(); for (; lIt != confLays->end(); lIt++) { - cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()), - true); + cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()),true); cache.m_navigLays.emplace_back((*iTer)->trackingVolume(), *lIt); } } } } } - cache.m_denseResolved = std::pair<unsigned int, unsigned int> (cache.m_denseVols.size(), cache.m_denseBoundaries.size()); + cache.m_denseResolved = std::pair<unsigned int, unsigned int>( + cache.m_denseVols.size(), cache.m_denseBoundaries.size()); cache.m_layerResolved = cache.m_layers.size(); } - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_staticBoundaries.begin(), cache.m_staticBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_staticBoundaries.begin(), + cache.m_staticBoundaries.end()); // resolve the use of dense volumes if (staticVol) { @@ -864,12 +825,19 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, // current static may carry non-trivial material properties, their use is optional; // use highest volume as B field source // const Trk::TrackParameters* nextPar = - // prop.propagate(*currPar,cache.m_navigSurfs,dir,*propagVol,particle,solutions,path); - ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, - prop.propagate(*currPar, cache.m_navigSurfs, dir, m_fieldProperties, particle, - solutions, path, false, false, propagVol))); - ATH_MSG_VERBOSE(" [+] Propagation done"); + ManagedTrackParmPtr nextPar( + ManagedTrackParmPtr::recapture(currPar, + prop.propagate(ctx, + *currPar, + cache.m_navigSurfs, + dir, + m_fieldProperties, + particle, + solutions, + path, + false, + false, + propagVol))); if (nextPar) { ATH_MSG_DEBUG(" [+] Position after propagation - at " << positionOutput(nextPar->position())); } @@ -893,7 +861,10 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, 1. / currentqoverp), 1., dir, particle); ATH_MSG_DEBUG(" [M] Energy loss: STEP,EnergyLossUpdator:" << nextPar->momentum().mag() - currPar->momentum().mag() << "," << eloss->deltaE()); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -916,8 +887,9 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, ATH_MSG_DEBUG(" [M] Energy loss: STEP,EnergyLossUpdator:" << nextPar->momentum().mag() - currPar->momentum().mag() << "," << eloss->deltaE()); // use curvilinear TPs to simplify retrieval by fitters - const Trk::TrackParameters *cvlTP = replaceTrkParm(new Trk::CurvilinearParameters(nextPar->position(), - nextPar->momentum(), nextPar->charge())); + const Trk::TrackParameters* cvlTP = + replaceTrkParm(new Trk::CurvilinearParameters( + nextPar->position(), nextPar->momentum(), nextPar->charge())); Trk::MaterialEffectsOnTrack *mefot = new Trk::MaterialEffectsOnTrack(dInX0, newsa, eloss, cvlTP->associatedSurface()); cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, cvlTP, nullptr, mefot)); @@ -926,7 +898,10 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, dumpCache(cache," mat states extrapolateToNextMaterialLayer"); } cache.m_extrapolationCache->updateX0(dInX0); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1089,7 +1064,8 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, &(lay->surfaceRepresentation()), true); cache.m_navigLays.emplace_back(detVol, lay); } - const Trk::Layer *nextLayer = detVol->nextLayer(currPar->position(), dir * currPar->momentum().unit(), true); + const Trk::Layer* nextLayer = + detVol->nextLayer(currPar->position(), dir * currPar->momentum().unit(), true); if (nextLayer && nextLayer != lay) { cache.m_layers.emplace_back(&(nextLayer->surfaceRepresentation()), true); cache.m_navigLays.emplace_back(detVol, nextLayer); @@ -1108,16 +1084,23 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, if (not cache.m_layers.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_layers.begin(), cache.m_layers.end()); + cache.m_navigSurfs.insert( + cache.m_navigSurfs.end(), cache.m_layers.begin(), cache.m_layers.end()); } if (not cache.m_denseBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_denseBoundaries.begin(), cache.m_denseBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_denseBoundaries.begin(), + cache.m_denseBoundaries.end()); } if (not cache.m_navigBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_navigBoundaries.begin(), cache.m_navigBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_navigBoundaries.begin(), + cache.m_navigBoundaries.end()); } if (not cache.m_detachedBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_detachedBoundaries.begin(), cache.m_detachedBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_detachedBoundaries.begin(), + cache.m_detachedBoundaries.end()); } // current dense cache.m_currentDense = cache.m_highestVolume; @@ -1135,8 +1118,9 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } // ready to propagate - // till: A/ static volume boundary(bcheck=true) , B/ material layer(bcheck=true), C/ destination surface(bcheck=false) - // update of cache.m_navigSurfs required if I/ entry into new navig volume, II/ exit from currentActive without overlaps + // till: A/ static volume boundary(bcheck=true) , B/ material layer(bcheck=true), C/ destination + // surface(bcheck=false) update of cache.m_navigSurfs required if I/ entry into new navig volume, + // II/ exit from currentActive without overlaps nextVol = nullptr; while (currPar) { @@ -1158,23 +1142,33 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } } // propagate now - ATH_MSG_DEBUG(" [+] Starting propagation at position " << positionOutput(currPar->position()) - << " (current momentum: " << currPar->momentum().mag() << - ")"); - ATH_MSG_DEBUG(" [+] " << cache.m_navigSurfs.size() << " target surfaces in '" << cache.m_currentDense->volumeName() << "'."); - // const Trk::TrackParameters* nextPar = - // prop.propagate(*currPar,cache.m_navigSurfs,dir,*cache.m_currentDense,particle,solutions,path); - ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, - prop.propagate(*currPar, cache.m_navigSurfs, dir, m_fieldProperties, particle, - solutions, path, false, false, cache.m_currentDense))); - ATH_MSG_VERBOSE(" [+] Propagation done. "); + ATH_MSG_DEBUG(" [+] Starting propagation at position " + << positionOutput(currPar->position()) + << " (current momentum: " << currPar->momentum().mag() + << ")"); + ATH_MSG_DEBUG(" [+] " << cache.m_navigSurfs.size() + << " target surfaces in '" + << cache.m_currentDense->volumeName() << "'."); + ManagedTrackParmPtr nextPar( + ManagedTrackParmPtr::recapture(currPar, + prop.propagate(ctx, + *currPar, + cache.m_navigSurfs, + dir, + m_fieldProperties, + particle, + solutions, + path, + false, + false, + cache.m_currentDense))); if (nextPar) { ATH_MSG_DEBUG(" [+] Position after propagation - at " << positionOutput(nextPar->position())); } // check missing volume boundary - if (nextPar && !(cache.m_currentDense->inside(nextPar->position(), m_tolerance) - || m_navigator->atVolumeBoundary(nextPar.get(), cache.m_currentDense, dir, assocVol, m_tolerance))) { + if (nextPar && + !(cache.m_currentDense->inside(nextPar->position(), m_tolerance) || + m_navigator->atVolumeBoundary(nextPar.get(), cache.m_currentDense, dir, assocVol, m_tolerance))) { ATH_MSG_DEBUG(" [!] ERROR: missing volume boundary for volume" << cache.m_currentDense->volumeName()); if (cache.m_currentDense->zOverAtimesRho() != 0.) { ATH_MSG_DEBUG(" [!] ERROR: trying to recover: repeat the propagation step in" << @@ -1194,9 +1188,12 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, cache.m_extrapolationCache->updateX0(dInX0); Trk::MaterialProperties materialProperties(*cache.m_currentDense, fabs(path)); double currentqoverp = nextPar->parameters()[Trk::qOverP]; - Trk::EnergyLoss *eloss = m_elossupdaters[0]->energyLoss(materialProperties, fabs( - 1. / currentqoverp), 1., dir, particle); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + Trk::EnergyLoss* eloss = m_elossupdaters[0]->energyLoss( + materialProperties, fabs(1. / currentqoverp), 1., dir, particle); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1225,17 +1222,24 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, // use curvilinear TPs to simplify retrieval by fitters - const Trk::TrackParameters *cvlTP = replaceTrkParm(new Trk::CurvilinearParameters(nextPar->position(), - nextPar->momentum(), nextPar->charge())); - Trk::MaterialEffectsOnTrack *mefot = new Trk::MaterialEffectsOnTrack(dInX0, newsa, eloss, - cvlTP->associatedSurface()); + const Trk::TrackParameters* cvlTP = + replaceTrkParm(new Trk::CurvilinearParameters( + nextPar->position(), nextPar->momentum(), nextPar->charge())); + + Trk::MaterialEffectsOnTrack* mefot = new Trk::MaterialEffectsOnTrack( + dInX0, newsa, eloss, cvlTP->associatedSurface()); + cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, cvlTP, nullptr, mefot)); + if (cache.m_extrapolationCache) { if (m_dumpCache) { dumpCache(cache," extrapolateToNextMaterialLayer dense"); } cache.m_extrapolationCache->updateX0(dInX0); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1282,14 +1286,23 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, const Trk::Layer *mb = cache.m_navigSurfs[solutions[iSol]].first->materialLayer(); if (mb) { if (mb->layerMaterialProperties() && mb->layerMaterialProperties()->fullMaterial(nextPar->position())) { - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(*cache.m_currentStatic); + + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(*cache.m_currentStatic); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, *cache.m_currentStatic); + if (currentUpdator) { - nextPar=ManagedTrackParmPtr::recapture( - nextPar, - currentUpdator->update(nextPar.get(), *mb, dir, particle, matupmode) ); + nextPar = ManagedTrackParmPtr::recapture( + nextPar, + currentUpdator->update(currentUpdatorCache, + nextPar.get(), + *mb, + dir, + particle, + matupmode)); } if (!nextPar) { - ATH_MSG_VERBOSE(" [+] Update may have killed track - return."); cache.m_parametersAtBoundary.resetBoundaryInformation(); return ManagedTrackParmPtr(); } @@ -1318,10 +1331,12 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } cache.m_extrapolationCache->updateX0(dInX0); double currentqoverp = nextPar->parameters()[Trk::qOverP]; - EnergyLoss *eloss = m_elossupdaters[0]->energyLoss(*lmat, fabs( - 1. / currentqoverp), 1. / costr, dir, particle); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), - eloss->meanRad(), eloss->sigmaRad()); + EnergyLoss* eloss = m_elossupdaters[0]->energyLoss( + *lmat, fabs(1. / currentqoverp), 1. / costr, dir, particle); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1337,14 +1352,17 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, new Trk::ScatteringAngles(0, 0, scatsigma / sin(nextPar->parameters()[Trk::theta]), scatsigma); // energy loss double currentqoverp = nextPar->parameters()[Trk::qOverP]; - EnergyLoss *eloss = m_elossupdaters[0]->energyLoss(*lmat, fabs( - 1. / currentqoverp), 1. / costr, dir, particle); + EnergyLoss* eloss = m_elossupdaters[0]->energyLoss( + *lmat, fabs(1. / currentqoverp), 1. / costr, dir, particle); // use curvilinear TPs to simplify retrieval by fitters - const Trk::TrackParameters *cvlTP = replaceTrkParm(new Trk::CurvilinearParameters( - nextPar->position(), nextPar->momentum(), nextPar->charge())); - Trk::MaterialEffectsOnTrack *mefot = new Trk::MaterialEffectsOnTrack(dInX0, newsa, eloss, - cvlTP->associatedSurface()); + const Trk::TrackParameters* cvlTP = replaceTrkParm( + new Trk::CurvilinearParameters(nextPar->position(), + nextPar->momentum(), + nextPar->charge())); + Trk::MaterialEffectsOnTrack* mefot = + new Trk::MaterialEffectsOnTrack( + dInX0, newsa, eloss, cvlTP->associatedSurface()); if (cache.m_extrapolationCache) { if (checkCache(cache," mat states extrapolateToNextMaterialLayer thin")) { if (m_dumpCache) { @@ -1407,26 +1425,35 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, // material update HERE and NOW (pre/post udpdate ? ) // don't repeat if identical to last update && input parameters on the layer bool collect = true; - if (nextLayer == cache.m_lastMaterialLayer && nextLayer->surfaceRepresentation().type() != Trk::Surface::Cylinder) { - ATH_MSG_DEBUG( - " [!] This layer is identical to the one with last material update, return layer without repeating the update"); + if (nextLayer == cache.m_lastMaterialLayer && + nextLayer->surfaceRepresentation().type() != Trk::Surface::Cylinder) { + ATH_MSG_DEBUG(" [!] This layer is identical to the one with last material update, return layer " + "without repeating the update"); collect = false; if (!destSurf && (nextLayer->layerType() > 0 || m_returnPassiveLayers)) { return nextPar; } } double layThick = nextLayer->thickness(); - if (collect && layThick > 0.) { // collect material + if (collect && layThick > 0.) {// collect material + // get the right updator - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(*cache.m_currentStatic); + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(*cache.m_currentStatic); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, *cache.m_currentStatic); + if (currentUpdator) { - nextPar = ManagedTrackParmPtr::recapture( - nextPar, - currentUpdator->update(nextPar.get(), *nextLayer, dir, - particle, matupmode)); + nextPar = ManagedTrackParmPtr::recapture( + nextPar, + currentUpdator->update(currentUpdatorCache, + nextPar.get(), + *nextLayer, + dir, + particle, + matupmode)); } if (!nextPar) { - ATH_MSG_VERBOSE(" [+] Update may have killed track - return."); cache.m_parametersAtBoundary.resetBoundaryInformation(); return ManagedTrackParmPtr(); } @@ -1453,14 +1480,15 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, dumpCache(cache," extrapolateToNextMaterialLayer thin "); } cache.m_extrapolationCache->updateX0(dInX0); - Trk::MaterialProperties materialProperties(*nextLayer->fullUpdateMaterialProperties(*nextPar)); // !< - // @TODO - // check + Trk::MaterialProperties materialProperties( + *nextLayer->fullUpdateMaterialProperties(*nextPar)); // !<@TODO check double currentqoverp = nextPar->parameters()[Trk::qOverP]; EnergyLoss *eloss = m_elossupdaters[0]->energyLoss(materialProperties, fabs( 1. / currentqoverp), 1. / costr, dir, particle); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), - eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1470,9 +1498,8 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, if (cache.m_matstates) { double dInX0 = thick / lx0; - Trk::MaterialProperties materialProperties(*nextLayer->fullUpdateMaterialProperties(*nextPar)); // !< - // @TODO - // check + Trk::MaterialProperties materialProperties( + *nextLayer->fullUpdateMaterialProperties(*nextPar)); // !<@TODOcheck double scatsigma = sqrt(m_msupdaters[0]->sigmaSquare(materialProperties, 1. / fabs(nextPar->parameters()[qOverP]), 1., particle)); @@ -1496,8 +1523,10 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, dumpCache(cache," extrapolateToNextMaterialLayer thin"); } cache.m_extrapolationCache->updateX0(dInX0); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), - eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -1506,7 +1535,6 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, cvlTP, nullptr, mefot)); } // - ATH_MSG_VERBOSE(" [M] Collecting material at material layer t/X0 = " << thick / lx0); if (m_cacheLastMatLayer) { cache.m_lastMaterialLayer = nextLayer; } @@ -1526,11 +1554,13 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } } // not necessary: currPar = nextPar; since done outside the loop and currPar not used inside the loop - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size()) { // dense volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size(); - std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator dIter = cache.m_denseVols.begin(); + std::vector<std::pair<const Trk::TrackingVolume*, unsigned int>>::iterator dIter = + cache.m_denseVols.begin(); while (index >= (*dIter).second && dIter != cache.m_denseVols.end()) { index -= (*dIter).second; dIter++; @@ -1561,13 +1591,15 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, ATH_MSG_DEBUG(" [+] Next dense volume: '" << cache.m_currentDense->volumeName() << "'."); } } - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size() - + cache.m_navigBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size() + + cache.m_navigBoundaries.size()) { // navig volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size() - cache.m_denseBoundaries.size(); - std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator nIter = cache.m_navigVolsInt.begin(); + std::vector<std::pair<const Trk::TrackingVolume*, unsigned int>>::iterator nIter = + cache.m_navigVolsInt.begin(); while (index >= (*nIter).second && nIter != cache.m_navigVolsInt.end()) { index -= (*nIter).second; nIter++; @@ -1588,15 +1620,24 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } // not necessary: currPar = nextPar; since done outside the loop and currPar not used inside the loop // return only if detached volume boundaries not collected - // if ( nextVol || !detachedBoundariesIncluded ) if (nextVol) { - return extrapolateToNextMaterialLayer(cache,prop, nextPar.index(), destSurf, cache.m_currentStatic, dir, bcheck, particle, + return extrapolateToNextMaterialLayer(ctx, + cache, + prop, + nextPar.index(), + destSurf, + cache.m_currentStatic, + dir, + bcheck, + particle, matupmode); } } - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size() - + cache.m_navigBoundaries.size() + cache.m_detachedBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size() + + cache.m_navigBoundaries.size() + + cache.m_detachedBoundaries.size()) { // detached volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size() - cache.m_denseBoundaries.size() - cache.m_navigBoundaries.size(); @@ -1624,7 +1665,15 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, // not necessary: currPar = nextPar; since done outside the loop and currPar not used inside the loop // if ( nextVol || !detachedBoundariesIncluded) if (nextVol) { - return extrapolateToNextMaterialLayer(cache,prop, nextPar.index(), destSurf, cache.m_currentStatic, dir, bcheck, particle, + return extrapolateToNextMaterialLayer(ctx, + cache, + prop, + nextPar.index(), + destSurf, + cache.m_currentStatic, + dir, + bcheck, + particle, matupmode); } } @@ -1643,13 +1692,16 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(Cache& cache, } Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Trk::Surface *destSurf, - const Trk::AlignableTrackingVolume *vol, - PropDirection dir, - ParticleHypothesis particle) const { +Trk::Extrapolator::extrapolateInAlignableTV( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Trk::Surface* destSurf, + const Trk::AlignableTrackingVolume* vol, + PropDirection dir, + ParticleHypothesis particle) const +{ ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateInAlignableTV(...) "); @@ -1707,9 +1759,8 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, const Trk::IdentifiedMaterial *binIDMat = binMat->material(currPar->position()); if (binIDMat->second > 0) { ManagedTrackParmPtr identified_parm(currPar); // first create a copy, to not invalidate currPar on release - cache.m_identifiedParameters->push_back(std::pair<const Trk::TrackParameters *, int> (identified_parm.release(), - binIDMat - ->second)); + cache.m_identifiedParameters->push_back( + std::pair<const Trk::TrackParameters*, int>(identified_parm.release(), binIDMat->second)); } } } @@ -1733,7 +1784,9 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, cache.m_staticBoundaries.emplace_back(&surf, true); } - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_staticBoundaries.begin(), cache.m_staticBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_staticBoundaries.begin(), + cache.m_staticBoundaries.end()); // current dense cache.m_currentDense = staticVol; @@ -1746,13 +1799,16 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, double path = 0.; std::vector<unsigned int> solutions; // propagate now - ATH_MSG_DEBUG(" [+] Starting propagation at position " << positionOutput(currPar->position()) - << " (current momentum: " << currPar->momentum().mag() << - ")"); - ATH_MSG_DEBUG(" [+] " << cache.m_navigSurfs.size() << " target surfaces in '" << cache.m_currentDense->volumeName() << "'."); + ATH_MSG_DEBUG(" [+] Starting propagation at position " + << positionOutput(currPar->position()) + << " (current momentum: " << currPar->momentum().mag() + << ")"); + ATH_MSG_DEBUG(" [+] " << cache.m_navigSurfs.size() + << " target surfaces in '" + << cache.m_currentDense->volumeName() << "'."); // arguments : inputParameters, vector of navigation surfaces, propagation direction, b field service, particle // type, result, - // material collection, intersection collection, path limit, switch for use of path limit, switch for + // material collection, intersection collection, path limit, switch for use of path limit, switch for // curvilinear on return, current TG volume if (m_dumpCache && cache.m_extrapolationCache) { ATH_MSG_DEBUG(" prop.propagateM " << cache.m_extrapolationCache); @@ -1762,17 +1818,27 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, // should really be passed just by pointer. identifiedParameters_t *intersections = cache.m_identifiedParameters.get(); ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, - prop.propagateM(*currPar, cache.m_navigSurfs, dir, m_fieldProperties, particle, - solutions, - cache.m_matstates, intersections, path, false, false, - cache.m_currentDense, cache.m_extrapolationCache))); + currPar, + prop.propagateM(ctx, + *currPar, + cache.m_navigSurfs, + dir, + m_fieldProperties, + particle, + solutions, + cache.m_matstates, + intersections, + path, + false, + false, + cache.m_currentDense, + cache.m_extrapolationCache))); // does nothing - // can be used for debugging to instrument track parameters with some monitoring (e.g. construction and destruction) + // can be used for debugging to instrument track parameters with some monitoring (e.g. construction and + // destruction) replaceTrkParm(cache.m_identifiedParameters.get()); replaceTrkParm(cache.m_matstates); - ATH_MSG_VERBOSE(" [+] Propagation done. "); if (nextPar) { ATH_MSG_DEBUG(" [+] Position after propagation - at " << positionOutput(nextPar->position())); ATH_MSG_DEBUG(" [+] Number of intersection solutions: " << solutions.size()); @@ -1840,9 +1906,11 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, cache.m_identifiedParameters->back().second == binIDMat->second) { double s = (nextPar->position() - cache.m_identifiedParameters->back().first->position()).mag(); if (s > 0.001) { - ManagedTrackParmPtr identified_parm(nextPar); // first create a copy, to not invalidate nextPar on release - cache.m_identifiedParameters->push_back(std::pair<const Trk::TrackParameters *, int> (identified_parm.release(), - -binIDMat->second)); + // first create a copy, to not invalidate nextPar on release + ManagedTrackParmPtr identified_parm(nextPar); + cache.m_identifiedParameters->push_back( + std::pair<const Trk::TrackParameters*, int>( + identified_parm.release(), -binIDMat->second)); } } } @@ -1864,9 +1932,9 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, ATH_MSG_DEBUG(" [+] Crossing to next volume '" << nextVol->volumeName() << "'"); ATH_MSG_DEBUG(" [+] Crossing position is - at " << positionOutput(nextPar->position())); if (!destSurf) { - return nextPar; // return value differs between e->surface (cached boundary values used) + return nextPar; // return value differs between e->surface (cached boundary values used) } - // implicit : parameters at boundary returned + //implicit : parameters at boundary returned } return ManagedTrackParmPtr(); } @@ -1884,181 +1952,16 @@ Trk::Extrapolator::extrapolateInAlignableTV(Cache& cache, return ManagedTrackParmPtr(); } -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextStation( - const IPropagator &prop, - const Trk::TrackParameters &parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { - // material update on detached volume layer representation only - - // double tol = 0.001; - - Cache cache{}; - ++cache.m_methodSequence; - ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateToNextStation(...) "); - - // resolve position: static or detached ? - const Trk::TrackingVolume *currVol = m_navigator->trackingGeometry()->lowestStaticTrackingVolume(parm.position()); - const Trk::TrackingVolume *nextVol = nullptr; - if (m_navigator->atVolumeBoundary(&parm, currVol, dir, nextVol, m_tolerance) && nextVol != currVol) { - currVol = nextVol; - } - if (!cache.m_highestVolume) { - cache.m_highestVolume = m_navigator->highestVolume(); - } - - ManagedTrackParmPtr currPar(cache.manage(parm)); - double path = 0.; - while (currPar && currVol && !currVol->confinedDetachedVolumes()) { - const Trk::NavigationCell cross = m_navigator->nextDenseTrackingVolume(prop, *currPar, nullptr, dir, particle, *currVol, - path); - currPar = ManagedTrackParmPtr::recapture(currPar,cross.parametersOnBoundary); - currVol = cross.nextVolume; - } - - // no luck - if (!currPar || !currVol || !currVol->confinedDetachedVolumes()) { - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nullptr, nullptr); - } - - // prepare vector of surfaces - if (cache.m_navigSurfs.capacity() > m_maxNavigSurf) { - cache.m_navigSurfs.reserve(m_maxNavigSurf); - } - if (cache.m_navigVols.capacity() > m_maxNavigVol) { - cache.m_navigVols.reserve(m_maxNavigVol); - } - cache.m_navigSurfs.clear(); - cache.m_navigVols.clear(); - - // retrieve static volume boundary - const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > > &bounds = currVol->boundarySurfaces(); - for (unsigned int ib = 0; ib < bounds.size(); ib++) { - const Trk::Surface *nextSurface = &((bounds[ib].get())->surfaceRepresentation()); - cache.m_navigSurfs.emplace_back(nextSurface, true); - } - - // retrieve DV layer representations - const std::vector<const Trk::DetachedTrackingVolume *> *detVols = currVol->confinedDetachedVolumes(); - if (detVols) { - std::vector<const Trk::DetachedTrackingVolume *>::const_iterator dIter = detVols->begin(); - for (; dIter != detVols->end(); dIter++) { - const Trk::Layer *lay = (*dIter)->layerRepresentation(); - if (lay) { - const Trk::BoundaryCheck checkBounds = lay->layerType() > 0 ? bcheck : Trk::BoundaryCheck(true); - std::pair<const Trk::Surface *, const Trk::BoundaryCheck> newSurf(&(lay->surfaceRepresentation()), checkBounds); - cache.m_navigSurfs.push_back(newSurf); - cache.m_navigVols.push_back(*dIter); - } - } - } - // ready to propagate - // till: A/ static volume boundary (loop back) , B/ successful hit of an active layer representation - - // resolve the use of dense volumes - cache.m_dense = (currVol->geometrySignature() == Trk::MS && m_useMuonMatApprox) || - (currVol->geometrySignature() != Trk::MS && m_useDenseVolumeDescription); - - nextVol = nullptr; - double totalPath = 0.; - while (currPar) { - std::vector<unsigned int> solutions; - const Trk::TrackingVolume *propagVol = cache.m_dense ? currVol : cache.m_highestVolume; - // const Trk::TrackParameters* nextPar = - // prop.propagate(*currPar,cache.m_navigSurfs,dir,*propagVol,particle,solutions,path); - ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, - prop.propagate(*currPar, cache.m_navigSurfs, dir, m_fieldProperties, particle, - solutions, path, false, false, propagVol))); - totalPath += path; - if (nextPar) { - Amg::Vector3D gp = nextPar->position(); - // static volume boundary ? - if (m_navigator->atVolumeBoundary(nextPar.get(), currVol, dir, nextVol, m_tolerance)) { - if (nextVol != currVol) { - cache.m_parametersAtBoundary.boundaryInformation(nextVol, nextPar, nextPar); - if (!nextVol) { - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nextPar.release(), nullptr); - } - if (nextVol && nextPar) { - if (nextVol->geometrySignature() != Trk::MS) { - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nextPar.release(), nullptr); - } - ATH_MSG_DEBUG(" [+] Crossing to next volumat - at " << positionOutput(nextPar->position())); - return extrapolateToNextStation(prop, *nextPar, dir, bcheck, particle, matupmode); - } - } - } - // next layer representation ? active(->return) or passive(->loop back) ? - std::vector<std::pair<const Trk::Surface *,Trk::BoundaryCheck > >::iterator vsIter = cache.m_navigSurfs.begin(); - for (; vsIter != cache.m_navigSurfs.end(); vsIter++) { - if ((*vsIter).first->isOnSurface(gp, bcheck, m_tolerance, m_tolerance)) { - break; - } - } - if (vsIter != cache.m_navigSurfs.end()) { - bool identified = false; - std::vector<const Trk::DetachedTrackingVolume *>::const_iterator dIter = cache.m_navigVols.begin(); - for (; dIter != cache.m_navigVols.end(); dIter++) { - if ((*dIter)->layerRepresentation()->surfaceRepresentation().isOnSurface(nextPar->position(), bcheck, - m_tolerance, m_tolerance)) { - break; - } - } - if (dIter != cache.m_navigVols.end()) { - identified = true; - } - if (!identified) { - dIter = cache.m_navigVols.begin(); - for (; dIter != cache.m_navigVols.end(); dIter++) { - if ((*dIter)->trackingVolume()->inside((*vsIter).first->center(), m_tolerance)) { - break; - } - } - if (dIter != cache.m_navigVols.end()) { - identified = true; - } - } - if (identified) { - const Trk::Layer *lay = (*dIter)->layerRepresentation(); - if (lay && lay != cache.m_lastMaterialLayer) { - // material update (from detached trackingvolume) - const IMaterialEffectsUpdator *currentUpdator = m_subupdaters[(*dIter)->geometrySignature()]; - if (currentUpdator) { - nextPar = ManagedTrackParmPtr::recapture( - nextPar, - currentUpdator->update(nextPar.get(), *lay, dir, particle, matupmode)); - } - if (m_cacheLastMatLayer) { - cache.m_lastMaterialLayer = lay; - } - if (nextPar) { - if (lay->layerType() > 0) { - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nextPar.release(), lay); - } - } else { - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nextPar.release(), nullptr); - } - } - } - } - } else { - ATH_MSG_DEBUG(" [!] Propagation loop fails -> return 0."); - } - currPar = std::move(nextPar); - } - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(nullptr, nullptr); -} - -const Trk::TrackParameters * -Trk::Extrapolator::extrapolateDirectly(const IPropagator &prop, - const Trk::TrackParameters &parm, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle) const { +Trk::TrackParameters* +Trk::Extrapolator::extrapolateDirectlyImpl( + const EventContext& ctx, + const IPropagator& prop, + const Trk::TrackParameters& parm, + const Trk::Surface& sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const +{ // statistics && sequence output ---------------------------------------- ++m_extrapolateDirectlyCalls; @@ -2070,21 +1973,25 @@ Trk::Extrapolator::extrapolateDirectly(const IPropagator &prop, ATH_MSG_DEBUG("P-[?] extrapolateDirectly(...) inside '" << currentVolume->volumeName() << "' to destination surface. "); - // if (currentVolume) return prop.propagate(parm, sf, dir, bcheck, *currentVolume, particle); if (currentVolume) { - return prop.propagate(parm, sf, dir, bcheck, m_fieldProperties, particle); + return prop.propagate(ctx,parm, sf, dir, bcheck, m_fieldProperties, particle); } return nullptr; } -const Trk::TrackParameters * -Trk::Extrapolator::extrapolateToVolume(const IPropagator &prop, - const TrackParameters &parm, - const TrackingVolume &vol, - PropDirection dir, - ParticleHypothesis particle) const { - // @TODO in principle the cache should already be created here to correctly set cache.m_methodSequence for sub-sequent calls ... - ATH_MSG_DEBUG("V-[?" /*<< cache.m_methodSequence*/ << "] extrapolateToVolume(...) to volume '" << vol.volumeName() << "'."); +const Trk::TrackParameters* +Trk::Extrapolator::extrapolateToVolumeImpl(const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& parm, + const TrackingVolume& vol, + PropDirection dir, + ParticleHypothesis particle) const +{ + // @TODO in principle the cache should already be created + //here to correctly set cache.m_methodSequence for sub-sequent calls ... + ATH_MSG_DEBUG("V-[?" /*<< cache.m_methodSequence*/ + << "] extrapolateToVolume(...) to volume '" << vol.volumeName() + << "'."); const TrackParameters *returnParms=nullptr; Trk::PropDirection propDir = dir == Trk::oppositeMomentum ? dir : Trk::alongMomentum; double dist = 0.; @@ -2114,7 +2021,7 @@ Trk::Extrapolator::extrapolateToVolume(const IPropagator &prop, } sIter = surfaces.insert(sIter, (std::pair<const Trk::Surface *, double>(nextSurface, dist))); } else { - surfaces.push_back(std::pair<const Trk::Surface *, double>(nextSurface, dist)); + surfaces.emplace_back(nextSurface, dist); } } } @@ -2122,7 +2029,18 @@ Trk::Extrapolator::extrapolateToVolume(const IPropagator &prop, // solution along path for ( std::pair<const Trk::Surface *, double> & a_surface : surfaces) { if (a_surface.second > 0) { - returnParms = extrapolate(prop, parm, *(a_surface.first), propDir, true, particle); + Cache cache{}; + //Material effect updator cache + populateMatEffUpdatorCache(cache); + returnParms = extrapolateImpl(ctx, + cache, + prop, + cache.manage(parm).index(), + *(a_surface.first), + propDir, + true, + particle) + .release(); if (returnParms == &parm) { throw std::logic_error("Did not create new track parameters."); } @@ -2138,7 +2056,18 @@ Trk::Extrapolator::extrapolateToVolume(const IPropagator &prop, rsIter != surfaces.rend(); rsIter++) { if ((*rsIter).second < 0) { - returnParms = extrapolate(prop, parm, *((*rsIter).first), Trk::oppositeMomentum, true, particle); + Cache cache{}; + //Material effect updator cache + populateMatEffUpdatorCache(cache); + returnParms = extrapolateImpl(ctx, + cache, + prop, + cache.manage(parm).index(), + *((*rsIter).first), + Trk::oppositeMomentum, + true, + particle) + .release(); if (returnParms == &parm) { throw std::logic_error("Did not create new track parameters."); } @@ -2149,54 +2078,69 @@ Trk::Extrapolator::extrapolateToVolume(const IPropagator &prop, } } } - // cache.m_methodSequence=0; // originially m_methodSequence was reset here but cache not available here return returnParms; } // Configured AlgTool extrapolation methods // ---------------------------------------------------------------------------------------/ - const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const TrackParameters &parm, +Trk::Extrapolator::extrapolate(const EventContext& ctx, + const TrackParameters &parm, const Surface &sf, PropDirection dir, const BoundaryCheck& bcheck, ParticleHypothesis particle, MaterialUpdateMode matupmode, Trk::ExtrapolationCache *extrapolationCache) const { - Cache cache{}; - return extrapolateImpl(cache,cache.manage(parm).index(),sf,dir,bcheck,particle,matupmode,extrapolationCache).release(); + Cache cache{}; + //Material effect updator cache + populateMatEffUpdatorCache(cache); + return extrapolateImpl(ctx, + cache, + cache.manage(parm).index(), + sf, + dir, + bcheck, + particle, + matupmode, + extrapolationCache) + .release(); } Trk::TrackParametersUVector Trk::Extrapolator::extrapolateStepwise( + const EventContext& ctx, const Trk::TrackParameters &parm, const Trk::Surface &sf, Trk::PropDirection dir, const Trk::BoundaryCheck& bcheck, Trk::ParticleHypothesis particle) const { + if (m_configurationLevel < 10) { // set propagator to the sticky one, will be adopted if m_stickyConfiguration == false const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; if (currentPropagator) { - return extrapolateStepwise((*currentPropagator), parm, sf, dir, bcheck, particle); + return extrapolateStepwiseImpl( + ctx, (*currentPropagator), parm, sf, dir, bcheck, particle); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); return TrackParametersUVector(); } -const Trk::TrackParameters * -Trk::Extrapolator::extrapolate(const Trk::Track &trk, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - MaterialUpdateMode matupmode, - Trk::ExtrapolationCache *extrapolationCache) const { +const Trk::TrackParameters* +Trk::Extrapolator::extrapolate( + const EventContext& ctx, + const Trk::Track& trk, + const Trk::Surface& sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + MaterialUpdateMode matupmode, + Trk::ExtrapolationCache* extrapolationCache) const +{ const IPropagator *searchProp = nullptr; - // use global propagator for the search if (m_searchLevel < 2 && not m_subPropagators.empty()) { searchProp = m_subPropagators[Trk::Global]; @@ -2204,11 +2148,11 @@ Trk::Extrapolator::extrapolate(const Trk::Track &trk, const Trk::TrackParameters *closestTrackParameters = m_navigator->closestParameters(trk, sf, searchProp); if (closestTrackParameters) { - return(extrapolate(*closestTrackParameters, sf, dir, bcheck, particle, matupmode, extrapolationCache)); + return(extrapolate(ctx, *closestTrackParameters, sf, dir, bcheck, particle, matupmode, extrapolationCache)); } else { closestTrackParameters = *(trk.trackParameters()->begin()); if (closestTrackParameters) { - return(extrapolate(*closestTrackParameters, sf, dir, bcheck, particle, matupmode, extrapolationCache)); + return(extrapolate(ctx, *closestTrackParameters, sf, dir, bcheck, particle, matupmode, extrapolationCache)); } } @@ -2217,89 +2161,113 @@ Trk::Extrapolator::extrapolate(const Trk::Track &trk, Trk::TrackParametersUVector Trk::Extrapolator::extrapolateBlindly( - const Trk::TrackParameters &parm, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - const Trk::Volume *boundaryVol) const { + const EventContext& ctx, + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + const Trk::Volume* boundaryVol) const +{ if (m_configurationLevel < 10) { // set propagator to the global one - const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; + const IPropagator* currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; + if (currentPropagator) { - return extrapolateBlindly((*currentPropagator), parm, dir, bcheck, particle, boundaryVol); + Cache cache{}; + //Material effect updator cache + populateMatEffUpdatorCache(cache); + return extrapolateBlindlyImpl(ctx, + cache, + (*currentPropagator), + cache.manage(parm).index(), + dir, + bcheck, + particle, + boundaryVol); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); return TrackParametersUVector(); } -const Trk::TrackParameters * -Trk::Extrapolator::extrapolateDirectly(const Trk::TrackParameters &parm, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle) const { +Trk::TrackParameters * +Trk::Extrapolator::extrapolateDirectly( + const EventContext& ctx, + const Trk::TrackParameters &parm, + const Trk::Surface &sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const { + if (m_configurationLevel < 10) { // set propagator to the global one - can be reset inside the next methode (once volume information is there) const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; if (currentPropagator) { - return(extrapolateDirectly((*currentPropagator), parm, sf, dir, bcheck, particle)); + return (extrapolateDirectlyImpl( + ctx, (*currentPropagator), parm, sf, dir, bcheck, particle)); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); return nullptr; } -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextActiveLayer( - const TrackParameters &parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) -const { +Trk::TrackParameters * +Trk::Extrapolator::extrapolateDirectly( + const EventContext& ctx, + const IPropagator& prop, + const Trk::TrackParameters &parm, + const Trk::Surface &sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle) const { + + return extrapolateDirectlyImpl(ctx, prop, parm, sf, dir, bcheck, particle); +} + +std::pair<const Trk::TrackParameters*, const Trk::Layer*> +Trk::Extrapolator::extrapolateToNextActiveLayer( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ if (m_configurationLevel < 10) { // set propagator to the MS one - can be reset inside the next methode (once volume information is there) const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::MS] : nullptr; if (currentPropagator) { - return(extrapolateToNextActiveLayer((*currentPropagator), parm, dir, bcheck, particle, matupmode)); + return (extrapolateToNextActiveLayerImpl( + ctx, (*currentPropagator), parm, dir, bcheck, particle, matupmode)); } } ATH_MSG_ERROR("[!] No default Propagator is configured ! Please check jobOptions."); return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(0, 0); } -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextActiveLayerM( - const TrackParameters &parm, - PropDirection dir, - const BoundaryCheck& bcheck, - std::vector<const Trk::TrackStateOnSurface *> &material, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) -const { +std::pair<const Trk::TrackParameters*, const Trk::Layer*> +Trk::Extrapolator::extrapolateToNextActiveLayerM( + const EventContext& ctx, + const TrackParameters& parm, + PropDirection dir, + const BoundaryCheck& bcheck, + std::vector<const Trk::TrackStateOnSurface*>& material, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ if (m_configurationLevel < 10) { // set propagator to the MS one - can be reset inside the next methode (once volume information is there) // set propagator to the MS one - can be reset inside the next methode (once volume information is there) const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::MS] : nullptr; if (currentPropagator) { - return(extrapolateToNextActiveLayerM((*currentPropagator), parm, dir, bcheck, material, particle, matupmode)); - } - } - ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); - return std::pair<const Trk::TrackParameters *, const Trk::Layer *>(0, 0); -} - -std::pair<const Trk::TrackParameters *, const Trk::Layer *> Trk::Extrapolator::extrapolateToNextStation( - const TrackParameters &parm, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) -const { - if (m_configurationLevel < 10) { - // set propagator to the global one - can be reset inside the next methode (once volume information is there) - const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::MS] : nullptr; - if (currentPropagator) { - return(extrapolateToNextStation((*currentPropagator), parm, dir, bcheck, particle, matupmode)); + return (extrapolateToNextActiveLayerMImpl(ctx, + (*currentPropagator), + parm, + dir, + bcheck, + material, + particle, + matupmode)); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); @@ -2307,39 +2275,60 @@ const { } const Trk::TrackParameters * -Trk::Extrapolator::extrapolateToVolume(const Trk::TrackParameters &parm, - const Trk::TrackingVolume &vol, - PropDirection dir, - ParticleHypothesis particle) const { +Trk::Extrapolator::extrapolateToVolume( + const EventContext& ctx, + const Trk::TrackParameters &parm, + const Trk::TrackingVolume &vol, + PropDirection dir, + ParticleHypothesis particle) const { + if (m_configurationLevel < 10) { // take the volume signatrue to define the right propagator - const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[vol.geometrySignature()] : nullptr; + const IPropagator* currentPropagator = + !m_subPropagators.empty() ? m_subPropagators[vol.geometrySignature()] : nullptr; if (currentPropagator) { - return(extrapolateToVolume(*currentPropagator, parm, vol, dir, particle)); + return (extrapolateToVolumeImpl( + ctx, *currentPropagator, parm, vol, dir, particle)); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); return nullptr; } -std::vector<const Trk::TrackStateOnSurface *> * -Trk::Extrapolator::extrapolateM(const TrackParameters &parm, - const Surface &sf, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - Trk::ExtrapolationCache *extrapolationCache) const { +std::vector<const Trk::TrackStateOnSurface*>* +Trk::Extrapolator::extrapolateM( + const EventContext& ctx, + const TrackParameters& parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + Trk::ExtrapolationCache* extrapolationCache) const +{ + Cache cache{}; + //Material effect updator cache + populateMatEffUpdatorCache(cache); ATH_MSG_DEBUG("C-[" << cache.m_methodSequence << "] extrapolateM()"); // create a new vector for the material to be collected cache.m_matstates = new std::vector<const Trk::TrackStateOnSurface *>; if (m_dumpCache && extrapolationCache) { - ATH_MSG_DEBUG(" extrapolateM pointer extrapolationCache " << extrapolationCache<< " x0tot " << extrapolationCache->x0tot()); + ATH_MSG_DEBUG(" extrapolateM pointer extrapolationCache " + << extrapolationCache << " x0tot " + << extrapolationCache->x0tot()); } // collect the material - ManagedTrackParmPtr parameterAtDestination(extrapolateImpl(cache,cache.manage(parm).index(), sf, dir, bcheck, particle, Trk::addNoise, - extrapolationCache)); + ManagedTrackParmPtr parameterAtDestination( + extrapolateImpl(ctx, + cache, + cache.manage(parm).index(), + sf, + dir, + bcheck, + particle, + Trk::addNoise, + extrapolationCache)); // there are no parameters if (!parameterAtDestination && m_requireMaterialDestinationHit) { ATH_MSG_VERBOSE( @@ -2369,14 +2358,16 @@ Trk::Extrapolator::extrapolateM(const TrackParameters &parm, } std::vector<const Trk::TrackParameters *> * -Trk::Extrapolator::extrapolateM(const TrackParameters &, - const Surface &, - PropDirection, - const BoundaryCheck& , - std::vector<MaterialEffectsOnTrack> &, - std::vector<Trk::TransportJacobian *> &, - ParticleHypothesis, - Trk::ExtrapolationCache *) const { +Trk::Extrapolator::extrapolateM( + const EventContext& /*ctx*/, + const TrackParameters &, + const Surface &, + PropDirection, + const BoundaryCheck& , + std::vector<MaterialEffectsOnTrack> &, + std::vector<Trk::TransportJacobian *> &, + ParticleHypothesis, + Trk::ExtrapolationCache *) const { ATH_MSG_DEBUG("C-[?] extrapolateM(..) with jacobian collection - Not implemented yet."); return nullptr; } @@ -2402,14 +2393,17 @@ Trk::Extrapolator::validationAction() const { */ Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateImpl(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Trk::Surface &sf, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { +Trk::Extrapolator::extrapolateImpl( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Trk::Surface& sf, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ // set the model action of the material effects updaters for (unsigned int imueot = 0; imueot < m_subupdaters.size(); ++imueot) { m_subupdaters[imueot]->modelAction(); @@ -2422,10 +2416,12 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, // skip rest of navigation if particle hypothesis is nonInteracting if (particle == Trk::nonInteracting || int(dir) > 5) { if (cache.m_methodSequence) { - ++cache.m_methodSequence; // extrapolateDirectly does not have the cache and cannot increment m_methodSequence therefore do it here + ++cache.m_methodSequence; // extrapolateDirectly does not have the cache and cannot increment m_methodSequence + // therefore do it here } - return ManagedTrackParmPtr::recapture(parm, - extrapolateDirectly(prop, *parm, sf, dir, bcheck, particle)); + return ManagedTrackParmPtr::recapture( + parm, + extrapolateDirectlyImpl(ctx, prop, *parm, sf, dir, bcheck, particle)); } // statistics && sequence output ---------------------------------------- @@ -2443,7 +2439,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, ManagedTrackParmPtr nextParameters(parm); // initialize Navigation (calls as well initialize on garbe collection) ------------------------------------- - Trk::PropDirection navDir = initializeNavigation(cache, + Trk::PropDirection navDir = initializeNavigation(ctx, + cache, prop, nextParameters.index(), sf, @@ -2453,7 +2450,7 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, nextLayer, nextVolume, destVolume); - // ---------------------------------------------------------------------------------------------------------- + // --------------------------------------------------- // if anyDirection has been chosen as a start directive: // -> overwrite the dir with the navigation direction dir = (dir == Trk::anyDirection) ? navDir : dir; @@ -2463,13 +2460,15 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, ATH_MSG_VERBOSE(" [!] Navigation direction could not be resolved, switching to extrapolateDirectly()"); // the extrapolate directly call ++cache.m_methodSequence; // extrapolateDirectly does not have the cache and cannot increment m_methodSequence - return ManagedTrackParmPtr::recapture(parm,extrapolateDirectly(prop, *parm, sf, navDir, bcheck, particle)); + return ManagedTrackParmPtr::recapture( + parm, + extrapolateDirectlyImpl(ctx, prop, *parm, sf, navDir, bcheck, particle)); } - // ---------------------------------------------------------------------------------------------------------- + // ----------------------------------------------------- startVolume = nextVolume; - // fallback setup ------------------------------------------------------------------------------------------ + // fallback setup ------------------------------------- bool fallback = false; - // ------- initial distance estimation ---------------------------------------------------------------------- + // ------- initial distance estimation --------------- double currentDistance = 0.; double previousDistance = 0.; // reference parameters and distance solution: use consistently one of each @@ -2493,12 +2492,12 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, // ---------------------------------------------------------------------------------------------------------- std::string startVolumeName = (nextVolume) ? nextVolume->volumeName() : "Unknown (ERROR)"; std::string destVolumeName = destVolume ? destVolume->volumeName() : "Unknown (blind extrapolation)"; - if (msgLvl(MSG::VERBOSE)) { - ATH_MSG_VERBOSE(" [" << cache.m_methodSequence << "] extrapolate() " << startVolumeName << " -> " << destVolumeName); - ATH_MSG_VERBOSE(" [+] Starting position determined - at " << positionOutput(parm->position())); - if (nextLayer) { - ATH_MSG_VERBOSE(" [+] Starting layer determined - with " << layerRZoutput(*nextLayer)); - } + + ATH_MSG_VERBOSE(" [" << cache.m_methodSequence << "] extrapolate() " + << startVolumeName << " -> " << destVolumeName); + ATH_MSG_VERBOSE(" [+] Starting position determined - at " << positionOutput(parm->position())); + if (nextLayer) { + ATH_MSG_VERBOSE(" [+] Starting layer determined - with "<< layerRZoutput(*nextLayer)); } // ---------------------------------------------------------------------------------------------------------- @@ -2549,7 +2548,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } // re-initialize (will only overwrite destVolume) if (nextVolume->redoNavigation()) { - dir = initializeNavigation(cache, + dir = initializeNavigation(ctx, + cache, *currentPropagator, nextParameters.index(), sf, @@ -2574,15 +2574,19 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, if (cache.m_parametersAtBoundary.navParameters && cache.m_parametersAtBoundary.navParameters.get() != cache.m_parametersAtBoundary.nextParameters.get()) { // extrapolate to volume boundary to avoid navigation break - ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - cache.m_parametersAtBoundary.nextParameters, - currentPropagator->propagate(*cache.m_parametersAtBoundary.nextParameters, - cache.m_parametersAtBoundary.navParameters->associatedSurface(), - dir, - bcheck, - // *previousVolume, - m_fieldProperties, - particle, false, previousVolume))); + ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( + cache.m_parametersAtBoundary.nextParameters, + currentPropagator->propagate( + ctx, + *cache.m_parametersAtBoundary.nextParameters, + cache.m_parametersAtBoundary.navParameters->associatedSurface(), + dir, + bcheck, + // *previousVolume, + m_fieldProperties, + particle, + false, + previousVolume))); // set boundary and next parameters cache.m_parametersAtBoundary.boundaryInformation(nextVolume, nextPar, nextPar); nextParameters = cache.m_parametersAtBoundary.nextParameters; @@ -2595,15 +2599,17 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, ATH_MSG_ERROR("extrapolation in Calo/MS called without configured STEP propagator, aborting"); return ManagedTrackParmPtr(); } - resultParameters = extrapolateWithinDetachedVolumes(cache, - *m_stepPropagator, - nextParameters.index(), - sf, - *nextVolume, - dir, - bcheck, - particle, - matupmode); + resultParameters = + extrapolateWithinDetachedVolumes(ctx, + cache, + *m_stepPropagator, + nextParameters.index(), + sf, + *nextVolume, + dir, + bcheck, + particle, + matupmode); } if (resultParameters){ // destination reached : indicated through result parameters @@ -2623,7 +2629,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, // ------------------------------------------------------------------------------------------------ // standard loop over volumes (but last one) // extrapolate to volume boundary - void method as 'cache.m_parametersAtBoundary' hold the information - extrapolateToVolumeBoundary(cache, + extrapolateToVolumeBoundary(ctx, + cache, *currentPropagator, nextParameters.index(), nextLayer, @@ -2659,9 +2666,12 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } } } - ATH_MSG_VERBOSE(" [+] New 3D-distance to destination - d3 = " << currentDistance << " (from " << - (cache.m_parametersAtBoundary.navParameters ? "boundary parameters" : "last parameters within volume ") << - ")"); + ATH_MSG_VERBOSE(" [+] New 3D-distance to destination - d3 = " + << currentDistance << " (from " + << (cache.m_parametersAtBoundary.navParameters + ? "boundary parameters" + : "last parameters within volume ") + << ")"); // ------------------------------------------------------------------------------------------------------- // (1) NAVIGATION BREAK : next Volume is identical to last volume -- LOOP @@ -2672,8 +2682,11 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } else { // output ATH_MSG_DEBUG( " [X] Navigation break [X]" ); - if (nextParameters && lastParameters) ATH_MSG_DEBUG("last step:"<<(nextParameters->position()-lastParameters->position()).mag()); - ATH_MSG_DEBUG( " - Reason : Loop detected in TrackingVolume '"<< nextVolume->volumeName() << "'" ); + if (nextParameters && lastParameters) { + ATH_MSG_DEBUG("last step:" << (nextParameters->position() - lastParameters->position()).mag()); + } + ATH_MSG_DEBUG("- Reason : Loop detected in TrackingVolume '" + << nextVolume->volumeName() << "'"); // statistics ++m_navigationBreakLoop; // fallback flag @@ -2688,8 +2701,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, if (punchThroughDone) { // output ATH_MSG_DEBUG(" [X] Navigation break [X]"); - ATH_MSG_DEBUG( - " - Reason : Oscillation detected in TrackingVolume '" << nextVolume->volumeName() << "'"); + ATH_MSG_DEBUG("- Reason : Oscillation detected in TrackingVolume '" + << nextVolume->volumeName() << "'"); // statistics ++navigationBreakOscillation; // fallback flag @@ -2707,8 +2720,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, else if (!nextVolume && !cache.m_parametersOnDetElements && lastVolume && !m_stopWithUpdateZero) { // output ATH_MSG_VERBOSE(" [X] Navigation break [X]"); - ATH_MSG_VERBOSE( - " - Reason : No next volume found of TrackingVolume '" << lastVolume->volumeName() << "'"); + ATH_MSG_VERBOSE("- Reason : No next volume found of TrackingVolume '" + << lastVolume->volumeName() << "'"); // statistics ++navigationBreakNoVolume; // record the "no next" volume -- increase the counter for the (last) volume @@ -2740,8 +2753,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, // ------------------- the output interpretationn of the extrapolateToVolumeBoundary // (+) update killed track else if ((!nextParameters && m_stopWithUpdateZero) || !nextVolume) { - ATH_MSG_DEBUG( - " [+] Navigation stop : either the update killed the track, or end of detector/boundary volume reached"); + ATH_MSG_DEBUG(" [+] Navigation stop : either the update killed the " + "track, or end of detector/boundary volume reached"); return ManagedTrackParmPtr(); } // ------------------- the output interpretationn of the extrapolateToVolumeBoundary @@ -2788,16 +2801,29 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } // create the result now ManagedTrackParmPtr resultParameters(ManagedTrackParmPtr::recapture( - cache.m_lastValidParameters, - currentPropagator->propagate(*cache.m_lastValidParameters, sf, Trk::anyDirection, bcheck, - m_fieldProperties, particle, false, lastVolume))); - // desperate try + cache.m_lastValidParameters, + currentPropagator->propagate(ctx, + *cache.m_lastValidParameters, + sf, + Trk::anyDirection, + bcheck, + m_fieldProperties, + particle, + false, + lastVolume))); + // desperate try if (!resultParameters) { - resultParameters = ManagedTrackParmPtr::recapture( - parm, - currentPropagator->propagate(*parm, sf, dir, bcheck, - m_fieldProperties, particle, - false, startVolume)); + resultParameters = ManagedTrackParmPtr::recapture( + parm, + currentPropagator->propagate(ctx, + *parm, + sf, + dir, + bcheck, + m_fieldProperties, + particle, + false, + startVolume)); } return resultParameters; } @@ -2817,7 +2843,8 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, currentPropagator = subPropagator(*nextVolume); // extrapolate inside the volume if (currentPropagator) { - resultParameters = extrapolateInsideVolume(cache, + resultParameters = extrapolateInsideVolume(ctx, + cache, *currentPropagator, nextParameters.index(), sf, @@ -2838,29 +2865,35 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, return ManagedTrackParmPtr(); } ATH_MSG_DEBUG(" [-] Fallback to extrapolateDirectly triggered ! "); - resultParameters = ManagedTrackParmPtr::recapture( - finalNextParameters, - prop.propagate(*finalNextParameters, - sf, - dir, - bcheck, - // *startVolume, - m_fieldProperties, - particle, false, startVolume)); + resultParameters = + ManagedTrackParmPtr::recapture(finalNextParameters, + prop.propagate(ctx, + *finalNextParameters, + sf, + dir, + bcheck, + // *startVolume, + m_fieldProperties, + particle, + false, + startVolume)); } // return whatever you have return resultParameters; } Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateImpl(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm, - const std::vector< MaterialEffectsOnTrack > &sfMeff, - const TrackingVolume &tvol, - PropDirection dir, - ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { +Trk::Extrapolator::extrapolateImpl( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const std::vector<MaterialEffectsOnTrack>& sfMeff, + const TrackingVolume& tvol, + PropDirection dir, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ // statistics && sequence output ---------------------------------------- if (cache.m_methodSequence) { ++cache.m_methodSequence; @@ -2875,10 +2908,17 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, for (const MaterialEffectsOnTrack &a_sfMeff : sfMeff ) { // first propagate to the given surface // nextParameters = prop.propagate(*nextParameters, sfMeffI->associatedSurface(),dir,true,tvol, particle); - ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, - prop.propagate(*currPar, - a_sfMeff.associatedSurface(), dir, true, m_fieldProperties, particle, false, &tvol))); + ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( + currPar, + prop.propagate(ctx, + *currPar, + a_sfMeff.associatedSurface(), + dir, + true, + m_fieldProperties, + particle, + false, + &tvol))); // user might have not calculated well which surfaces are intersected ... break if break if (!nextPar) { return (currPar.index() != parm) ? currPar : ManagedTrackParmPtr(); // only return track parameters if at @@ -2886,13 +2926,18 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } currPar = std::move(nextPar); // then update - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(tvol); + + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(tvol); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, tvol); + ManagedTrackParmPtr upNext; if (currentUpdator) { - upNext= ManagedTrackParmPtr::recapture( - currPar, - currentUpdator->update(currPar.get(), a_sfMeff, particle, - matupmode)); + upNext = ManagedTrackParmPtr::recapture( + currPar, + currentUpdator->update( + currentUpdatorCache, currPar.get(), a_sfMeff, particle, matupmode)); } if (!upNext) { // update killed the track or config problem. Return @@ -2904,16 +2949,18 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, return currPar; } - Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateImpl(Cache& cache, - TrackParmPtr parm, - const Surface &sf, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode, - Trk::ExtrapolationCache *extrapolationCache) const { +Trk::Extrapolator::extrapolateImpl( + const EventContext& ctx, + Cache& cache, + TrackParmPtr parm, + const Surface& sf, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode, + Trk::ExtrapolationCache* extrapolationCache) const +{ cache.m_extrapolationCache = extrapolationCache; cache.m_cacheEloss = extrapolationCache ? extrapolationCache->eloss() : nullptr; @@ -2929,7 +2976,15 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, // chose the propagator fromt he geometry signature -- start with default const IPropagator *currentPropagator = !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr; if (currentPropagator) { - return extrapolateImpl(cache,(*currentPropagator), parm, sf, dir, bcheck, particle, matupmode); + return extrapolateImpl(ctx, + cache, + (*currentPropagator), + parm, + sf, + dir, + bcheck, + particle, + matupmode); } } ATH_MSG_ERROR(" [!] No default Propagator is configured ! Please check jobOptions."); @@ -2937,14 +2992,15 @@ Trk::Extrapolator::extrapolateImpl(Cache& cache, } Trk::TrackParametersUVector -Trk::Extrapolator::extrapolateBlindlyImpl( - Cache& cache, - const IPropagator &prop, - TrackParmPtr parm, - Trk::PropDirection dir, - const Trk::BoundaryCheck& bcheck, - Trk::ParticleHypothesis particle, - const Trk::Volume *boundaryVol) const { +Trk::Extrapolator::extrapolateBlindlyImpl(const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + Trk::PropDirection dir, + const Trk::BoundaryCheck& bcheck, + Trk::ParticleHypothesis particle, + const Trk::Volume* boundaryVol) const +{ // statistics && sequence output ---------------------------------------- ++m_extrapolateBlindlyCalls; ++cache.m_methodSequence; @@ -2958,7 +3014,8 @@ Trk::Extrapolator::extrapolateBlindlyImpl( cache.m_ownParametersOnDetElements = true; // run the extrapolation { - ManagedTrackParmPtr parameterOnSf(extrapolateImpl(cache,prop, parm, *m_referenceSurface, dir, bcheck, particle)); + ManagedTrackParmPtr parameterOnSf(extrapolateImpl( + ctx, cache, prop, parm, *m_referenceSurface, dir, bcheck, particle)); } // assign the return parameter and set cache.m_parametersOnDetElements = 0; cache.m_parametersOnDetElements = nullptr; @@ -2969,40 +3026,52 @@ Trk::Extrapolator::extrapolateBlindlyImpl( return Trk::TrackParametersUVector (tmp.begin(), tmp.end()); } - // ----------------------- The private Volume extrapolation methods ------------------------------------------------- Trk::ManagedTrackParmPtr -Trk::Extrapolator::extrapolateInsideVolume(Cache& cache, - const IPropagator &prop, +Trk::Extrapolator::extrapolateInsideVolume(const EventContext& ctx, + Cache& cache, + const IPropagator& prop, TrackParmPtr parm, - const Surface &sf, - const Layer *assLayer, - const TrackingVolume &tvol, + const Surface& sf, + const Layer* assLayer, + const TrackingVolume& tvol, PropDirection dir, - const BoundaryCheck& bcheck, + const BoundaryCheck& bcheck, ParticleHypothesis particle, - MaterialUpdateMode matupmode - ) const { + MaterialUpdateMode matupmode) const +{ // ---> C) detached volumes exist if (tvol.confinedDetachedVolumes()) { - return extrapolateWithinDetachedVolumes(cache,prop, parm, sf, tvol, dir, bcheck, particle, matupmode); + return extrapolateWithinDetachedVolumes( + ctx, cache, prop, parm, sf, tvol, dir, bcheck, particle, matupmode); } // ---> A) static layers exist - return insideVolumeStaticLayers(cache,false, prop, parm, assLayer, tvol, dir, bcheck, particle, matupmode); + return insideVolumeStaticLayers(ctx, + cache, + false, + prop, + parm, + assLayer, + tvol, + dir, + bcheck, + particle, + matupmode); } Trk::ManagedTrackParmPtr Trk::Extrapolator::extrapolateWithinDetachedVolumes( + const EventContext& ctx, Cache& cache, - const IPropagator &prop, + const IPropagator& prop, TrackParmPtr parm, - const Surface &sf, - const TrackingVolume &tvol, + const Surface& sf, + const TrackingVolume& tvol, PropDirection dir, - const BoundaryCheck& bcheck, + const BoundaryCheck& bcheck, ParticleHypothesis particle, - MaterialUpdateMode matupmode - ) const { + MaterialUpdateMode matupmode) const +{ // method sequence output --------------------------------- ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolateWithinDetachedVolumes() inside '" @@ -3035,19 +3104,33 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( ATH_MSG_DEBUG(" [-] Already at destination layer, distance:" << dist); // if ( dist >= 0 ) return prop.propagate(*nextParameters,sf, dir,bcheck,*currVol,particle); // const Trk::TrackParameters* fwd = prop.propagate(*nextParameters,sf, dir,bcheck,*currVol,particle); - ManagedTrackParmPtr fwd(ManagedTrackParmPtr::recapture( - nextParameters, - prop.propagate(*nextParameters, sf, dir, bcheck, m_fieldProperties, particle, - false, currVol))); + ManagedTrackParmPtr fwd( + ManagedTrackParmPtr::recapture(nextParameters, + prop.propagate(ctx, + *nextParameters, + sf, + dir, + bcheck, + m_fieldProperties, + particle, + false, + currVol))); if (fwd) { return fwd; } else { Trk::PropDirection oppDir = (dir != Trk::oppositeMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; // return prop.propagate(*nextParameters,sf,oppDir,bcheck,*currVol,particle); - return ManagedTrackParmPtr::recapture( - nextParameters, - prop.propagate(*nextParameters, sf, oppDir, bcheck, m_fieldProperties, particle, false, currVol)); + return ManagedTrackParmPtr::recapture(nextParameters, + prop.propagate(ctx, + *nextParameters, + sf, + oppDir, + bcheck, + m_fieldProperties, + particle, + false, + currVol)); } } @@ -3056,13 +3139,29 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( // if (dist >= 0.) return prop.propagate(*nextParameters,sf,dir,bcheck,*currVol,particle); if (dist >= 0.) { - return ManagedTrackParmPtr::recapture( - nextParameters,prop.propagate(*nextParameters, sf, dir, bcheck, m_fieldProperties, particle, false, currVol)); + return ManagedTrackParmPtr::recapture(nextParameters, + prop.propagate(ctx, + *nextParameters, + sf, + dir, + bcheck, + m_fieldProperties, + particle, + false, + currVol)); } else { Trk::PropDirection oppDir = (dir != Trk::oppositeMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; // return prop.propagate(*nextParameters,sf,oppDir,bcheck,*currVol,particle); - return ManagedTrackParmPtr::recapture( - nextParameters, prop.propagate(*nextParameters, sf, oppDir, bcheck, m_fieldProperties, particle, false, currVol)); + return ManagedTrackParmPtr::recapture(nextParameters, + prop.propagate(ctx, + *nextParameters, + sf, + oppDir, + bcheck, + m_fieldProperties, + particle, + false, + currVol)); } } else if (dist < 0.) { ATH_MSG_DEBUG(" [!] Initial 3D-distance to the surface negative (" << dist << ") -> skip extrapolation."); @@ -3072,24 +3171,27 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( ATH_MSG_DEBUG(" [+] Initial 3D-distance to destination - d3 = " << dist); - // loop over material layers till a/ destination layer found (accept solutions outside surface boundary) - // b/ boundary reached - // c/ negative distance to destination surface ( propagate directly to the surface ) + // loop over material layers till + // a/ destination layer found (accept solutions outside surface boundary) + // b/ boundary reached + // c/ negative distance to destination surface( propagate directly to the surface ) // ---------------------------- main loop over next material layers - // --------------------------------------------------- ManagedTrackParmPtr last_boundary_parameters; // used only to check whether parametersAtBoundary while (nextParameters) { const Trk::BoundaryCheck& bchk = false; - ManagedTrackParmPtr onNextLayer(extrapolateToNextMaterialLayer(cache, - prop, - nextParameters.index(), - &sf, - currVol, - dir, bchk, - particle, - matupmode)); + ManagedTrackParmPtr onNextLayer( + extrapolateToNextMaterialLayer(ctx, + cache, + prop, + nextParameters.index(), + &sf, + currVol, + dir, + bchk, + particle, + matupmode)); if (onNextLayer) { // solution with the destination surface ? // isOnSurface dummy for Perigee, use straightline distance estimate instead // if ( sf.isOnSurface(onNextLayer->position(),bchk,m_tolerance,m_tolerance) ) { @@ -3105,8 +3207,15 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( "mismatch in destination surface type:" << sf.type() << "," << onNextLayer->associatedSurface().type() << ":distance to the destination surface:" << currentDistance); - ManagedTrackParmPtr cParms(ManagedTrackParmPtr::recapture( - onNextLayer, prop.propagate(*onNextLayer, sf, dir, bchk, m_fieldProperties, particle))); + ManagedTrackParmPtr cParms( + ManagedTrackParmPtr::recapture(onNextLayer, + prop.propagate(ctx, + *onNextLayer, + sf, + dir, + bchk, + m_fieldProperties, + particle))); return cParms; } return onNextLayer; @@ -3136,7 +3245,6 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( dist = distSol.toPointOfClosestApproach(); } if (dist < 0.) { -// ATH_MSG_DEBUG( " [!] destination surface missed or distance unknown, propagate directly" ); cache.m_parametersAtBoundary.resetBoundaryInformation(); return ManagedTrackParmPtr(); } @@ -3170,43 +3278,55 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes( } void -Trk::Extrapolator::extrapolateToVolumeBoundary(Cache& cache, - const IPropagator &prop, - TrackParmPtr parm, - const Layer *assLayer, - const TrackingVolume &tvol, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode - ) const { +Trk::Extrapolator::extrapolateToVolumeBoundary( + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm, + const Layer* assLayer, + const TrackingVolume& tvol, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ // ---> C) detached volumes exist if (tvol.confinedDetachedVolumes()) { ATH_MSG_WARNING(" [!] toVolumeBoundaryDetachedVolumes(...) with confined detached volumes? This should not happen ! volume name and signature: " <<tvol.volumeName() <<":"<<tvol.geometrySignature() ); } // ---> A) static layers exist - ManagedTrackParmPtr inside_volume_static_layer(insideVolumeStaticLayers(cache,true, prop, parm, assLayer, tvol, dir, bcheck, particle, - matupmode)); + ManagedTrackParmPtr inside_volume_static_layer( + insideVolumeStaticLayers(ctx, + cache, + true, + prop, + parm, + assLayer, + tvol, + dir, + bcheck, + particle, + matupmode)); if ( inside_volume_static_layer && cache.m_parametersAtBoundary.navParameters) { ATH_MSG_VERBOSE(" [+] Boundary intersection - at " << positionOutput(cache.m_parametersAtBoundary.navParameters->position())); } - } +} Trk::ManagedTrackParmPtr -Trk::Extrapolator::insideVolumeStaticLayers( - Cache& cache, - bool toBoundary, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Trk::Layer *assLayer, - const TrackingVolume &tvol, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode - ) const { +Trk::Extrapolator::insideVolumeStaticLayers(const EventContext& ctx, + Cache& cache, + bool toBoundary, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Trk::Layer* assLayer, + const TrackingVolume& tvol, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode) const +{ // method sequence output --------------------------------- ++cache.m_methodSequence; // the next volume as given from the navigator @@ -3240,17 +3360,25 @@ Trk::Extrapolator::insideVolumeStaticLayers( if (!tvol.confinedLayers()) { ATH_MSG_VERBOSE(" [+] Volume does not contain layers, just propagate to destination surface."); // the final extrapolation to the destinationLayer - // nextParameters = prop.propagate(parm, *cache.m_destinationSurface, dir, bcheck, tvol, particle); nextParameters = ManagedTrackParmPtr::recapture( - parm, - prop.propagate(*parm, *cache.m_destinationSurface, dir, bcheck, m_fieldProperties, particle)); - // nextParameters = nextParameters ? nextParameters : prop.propagate(parm, *cache.m_destinationSurface, - // Trk::anyDirection, bcheck, tvol, particle); + parm, + prop.propagate(ctx, + *parm, + *cache.m_destinationSurface, + dir, + bcheck, + m_fieldProperties, + particle)); if (!nextParameters) { - nextParameters = ManagedTrackParmPtr::recapture( - parm, - prop.propagate(*parm, *cache.m_destinationSurface, Trk::anyDirection, - bcheck, m_fieldProperties, particle)); + nextParameters = ManagedTrackParmPtr::recapture( + parm, + prop.propagate(ctx, + *parm, + *cache.m_destinationSurface, + Trk::anyDirection, + bcheck, + m_fieldProperties, + particle)); } return nextParameters; } @@ -3274,8 +3402,10 @@ Trk::Extrapolator::insideVolumeStaticLayers( destinationLayer = cache.m_destinationSurface->associatedLayer(); if (!destinationLayer) { // (2) RECALL (very unlikely) // (3) GLOBAL SEARCH destinationLayer = - (cache.m_recallSurface == cache.m_destinationSurface && cache.m_destinationSurface->associatedDetectorElement()) ? - cache.m_recallLayer : tvol.associatedLayer(cache.m_destinationSurface->globalReferencePoint()); + (cache.m_recallSurface == cache.m_destinationSurface && + cache.m_destinationSurface->associatedDetectorElement()) + ? cache.m_recallLayer + : tvol.associatedLayer(cache.m_destinationSurface->globalReferencePoint()); } if (destinationLayer) { ATH_MSG_VERBOSE(" [+] Destination layer found - with " << layerRZoutput(*destinationLayer)); @@ -3308,22 +3438,42 @@ Trk::Extrapolator::insideVolumeStaticLayers( && associatedLayer->surfaceArray() && m_subSurfaceLevel) { ATH_MSG_VERBOSE(" [o] Calling overlapSearch() on start layer."); - overlapSearch(cache,prop, parm.index(), nextParameters.index(), *associatedLayer, tvol, dir, bcheck, particle, true); + overlapSearch(ctx, + cache, + prop, + parm.index(), + nextParameters.index(), + *associatedLayer, + tvol, + dir, + bcheck, + particle, + true); } // the post-update is valid ATH_MSG_VERBOSE(" [+] Calling postUpdate on inital track parameters."); - // do the post-update according to the associated Layer - parameters are either (&parm) or newly created ones - // chose current updator - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(tvol); + // do the post-update according to the associated Layer - parameters are + // either (&parm) or newly created ones chose current updator + + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(tvol); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, tvol); + if (currentUpdator) { - nextParameters = ManagedTrackParmPtr::recapture(nextParameters, - currentUpdator->postUpdate(*nextParameters, *associatedLayer, dir, - particle, matupmode)); + nextParameters = ManagedTrackParmPtr::recapture( + nextParameters, + currentUpdator->postUpdate(currentUpdatorCache, + *nextParameters, + *associatedLayer, + dir, + particle, + matupmode)); } // collect the material : either for extrapolateM or for the valdiation if (nextParameters && (cache.m_matstates || m_materialEffectsOnTrackValidation)) { - addMaterialEffectsOnTrack(cache,prop, nextParameters.index(), *associatedLayer, tvol, dir, particle); + addMaterialEffectsOnTrack(ctx, cache,prop, nextParameters.index(), *associatedLayer, tvol, dir, particle); } if (nextParameters && nextParameters.get() != parm.get()) { } else if (!m_stopWithUpdateZero) { // re-assign the start parameters @@ -3354,9 +3504,17 @@ Trk::Extrapolator::insideVolumeStaticLayers( ATH_MSG_VERBOSE(" [+] Entry layer to volume found with " << layerRZoutput(*associatedLayer)); // try to go to the entry Layer first - do not delete the parameters (garbage collection done by method) - set // entry flag - auto [new_track_parm,killed] - = extrapolateToIntermediateLayer(cache,prop, parm.index(), *associatedLayer, tvol, dir, bcheck, particle, - matupmode); + auto [new_track_parm, killed] = + extrapolateToIntermediateLayer(ctx, + cache, + prop, + parm.index(), + *associatedLayer, + tvol, + dir, + bcheck, + particle, + matupmode); nextParameters=std::move(new_track_parm); // ------------------------------------------------------------------------------ if (m_stopWithUpdateZero && killed) { @@ -3412,17 +3570,19 @@ Trk::Extrapolator::insideVolumeStaticLayers( ATH_MSG_VERBOSE(" [+] First layer for layer2layer with " << layerRZoutput(*associatedLayer)); // now do the loop from the associatedLayer to one before the destinationLayer - ManagedTrackParmPtr updateNext(extrapolateFromLayerToLayer(cache, - prop, - nextParameters.index(), - tvol, - associatedLayer, - destinationLayer, - navParameters.index(), - dir, - bcheck, - particle, - matupmode)); + ManagedTrackParmPtr updateNext( + extrapolateFromLayerToLayer(ctx, + cache, + prop, + nextParameters.index(), + tvol, + associatedLayer, + destinationLayer, + navParameters.index(), + dir, + bcheck, + particle, + matupmode)); // kill the track when the update --------------------------------------------- if (m_stopWithUpdateZero && !updateNext) { ATH_MSG_VERBOSE(" [+] Update may have killed track - return."); @@ -3445,17 +3605,19 @@ Trk::Extrapolator::insideVolumeStaticLayers( // Case Ia: To Destination after LayerToLayer sequence if (!toBoundary) { // the final extrapolation to the destinationLayer - nextParameters = extrapolateToDestinationLayer(cache, - prop, - nextParameters.index(), - *cache.m_destinationSurface, - *destinationLayer, - tvol, - assLayerReference, - dir, - bcheck, - particle, - matupmode); + nextParameters = + extrapolateToDestinationLayer(ctx, + cache, + prop, + nextParameters.index(), + *cache.m_destinationSurface, + *destinationLayer, + tvol, + assLayerReference, + dir, + bcheck, + particle, + matupmode); // set the recallInformation <- everything went fine setRecallInformation(cache,*cache.m_destinationSurface, *destinationLayer, tvol); @@ -3466,9 +3628,15 @@ Trk::Extrapolator::insideVolumeStaticLayers( // Case Ib: To Destination directly since no destination layer has been found } else if (!toBoundary) { // nextParameters = prop.propagate(*nextParameters,*cache.m_destinationSurface,dir,bcheck,tvol,particle); - nextParameters = ManagedTrackParmPtr::recapture( - nextParameters, - prop.propagate(*nextParameters, *cache.m_destinationSurface, dir, bcheck, m_fieldProperties, particle)); + nextParameters = + ManagedTrackParmPtr::recapture(nextParameters, + prop.propagate(ctx, + *nextParameters, + *cache.m_destinationSurface, + dir, + bcheck, + m_fieldProperties, + particle)); // job done: cleanup and go home // reset the recallInformation resetRecallInformation(cache); @@ -3489,26 +3657,37 @@ Trk::Extrapolator::insideVolumeStaticLayers( if (m_configurationLevel < 10) { // loop over propagators to do the search while (navprop <= m_configurationLevel) { - const IPropagator *navPropagator = &(*m_propagators[navprop]); + const IPropagator* navPropagator = &(*m_propagators[navprop]); // we veto the navigaiton parameters for calo-volumes with calo dynamic - bool vetoNavParameters = false; // (tvol.geometrySignature() == Trk::Calo && m_doCaloDynamic); - // the next Parameters are usually better, because they're closer to the boundary - // --- in the initial volume (assLayerReference!=0), the parm are good if no action taken + bool vetoNavParameters = + false; // (tvol.geometrySignature() == Trk::Calo && m_doCaloDynamic); + // the next Parameters are usually better, because they're closer to the + // boundary + // --- in the initial volume (assLayerReference!=0), the parm are good if + // no action taken if (nextParameters.get() != parm.get() || assLayerReference) { navParameters = nextParameters; } else { - navParameters = (cache.m_parametersAtBoundary.navParameters && !vetoNavParameters) ? - cache.m_parametersAtBoundary.navParameters : nextParameters; + navParameters = + (cache.m_parametersAtBoundary.navParameters && !vetoNavParameters) + ? cache.m_parametersAtBoundary.navParameters + : nextParameters; } - ATH_MSG_VERBOSE(" [+] Starting next boundary search from " << positionOutput(navParameters->position())); - ATH_MSG_VERBOSE(" [+] Starting next boundary search with " << momentumOutput(navParameters->momentum())); + ATH_MSG_VERBOSE(" [+] Starting next boundary search from " + << positionOutput(navParameters->position())); + ATH_MSG_VERBOSE(" [+] Starting next boundary search with " + << momentumOutput(navParameters->momentum())); // get the new navigaiton cell from the Navigator - Trk::NavigationCell nextNavCell = m_navigator->nextTrackingVolume(*navPropagator, *navParameters, dir, tvol); + Trk::NavigationCell nextNavCell = m_navigator->nextTrackingVolume( + ctx, *navPropagator, *navParameters, dir, tvol); nextVolume = nextNavCell.nextVolume; - navParameters = ManagedTrackParmPtr::recapture(navParameters,nextNavCell.parametersOnBoundary); + + navParameters = ManagedTrackParmPtr::recapture( + navParameters, nextNavCell.parametersOnBoundary); + bParameters = navParameters; // set the new exit Cell exitFace = nextNavCell.exitFace; @@ -3518,15 +3697,18 @@ Trk::Extrapolator::insideVolumeStaticLayers( } } } else { - Trk::NavigationCell nextNavCell = m_navigator->nextTrackingVolume(prop, *navParameters, dir, tvol); + Trk::NavigationCell nextNavCell = + m_navigator->nextTrackingVolume(ctx, prop, *navParameters, dir, tvol); + nextVolume = nextNavCell.nextVolume; - navParameters = ManagedTrackParmPtr::recapture(navParameters,nextNavCell.parametersOnBoundary); + + navParameters = ManagedTrackParmPtr::recapture( + navParameters, nextNavCell.parametersOnBoundary); bParameters = navParameters; // set the new exit Cell exitFace = nextNavCell.exitFace; } - if (!nextVolume && !cache.m_parametersOnDetElements) { ATH_MSG_DEBUG(" [-] Cannot find nextVolume of TrackingVolume: " << tvol.volumeName()); if (navParameters) { @@ -3541,20 +3723,34 @@ Trk::Extrapolator::insideVolumeStaticLayers( if (bParameters && bParameters->associatedSurface().materialLayer()) { ATH_MSG_VERBOSE(" [+] parameters on BoundarySurface with material."); if (m_includeMaterialEffects) { - const IMaterialEffectsUpdator *currentUpdator = m_subupdaters[tvol.geometrySignature()]; + + const IMaterialEffectsUpdator* currentUpdator = + m_subupdaters[tvol.geometrySignature()]; + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, tvol); + if (currentUpdator) { - bParameters = ManagedTrackParmPtr::recapture( - bParameters, - currentUpdator->update(bParameters.get(), - *(bParameters->associatedSurface().materialLayer()), - dir, - particle, - matupmode)); + bParameters = ManagedTrackParmPtr::recapture( + bParameters, + currentUpdator->update( + currentUpdatorCache, + bParameters.get(), + *(bParameters->associatedSurface().materialLayer()), + dir, + particle, + matupmode)); } // collect the material if (bParameters && (cache.m_matstates || m_materialEffectsOnTrackValidation)) { - addMaterialEffectsOnTrack(cache,prop, bParameters.index(), - *(bParameters->associatedSurface().materialLayer()), tvol, dir, particle); + addMaterialEffectsOnTrack( + ctx, + cache, + prop, + bParameters.index(), + *(bParameters->associatedSurface().materialLayer()), + tvol, + dir, + particle); } // the bParameters need to be put into the gargabe bin if they differ from the navParmaeters @@ -3563,10 +3759,8 @@ Trk::Extrapolator::insideVolumeStaticLayers( } // set the new boundary information - cache.m_parametersAtBoundary.boundaryInformation(nextVolume, - nextParameters, - navParameters, - exitFace); + cache.m_parametersAtBoundary.boundaryInformation( + nextVolume, nextParameters, navParameters, exitFace); // return the navParameters return navParameters; @@ -3576,17 +3770,19 @@ Trk::Extrapolator::insideVolumeStaticLayers( Trk::ManagedTrackParmPtr Trk::Extrapolator::extrapolateFromLayerToLayer( + const EventContext& ctx, Cache& cache, - const IPropagator &prop, + const IPropagator& prop, TrackParmPtr parm, - const TrackingVolume &tvol, - const Layer *startLayer, - const Layer *destinationLayer, + const TrackingVolume& tvol, + const Layer* startLayer, + const Layer* destinationLayer, TrackParmPtr navParm, PropDirection dir, - const BoundaryCheck& bcheck, + const BoundaryCheck& bcheck, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // method sequence output --------------------------------- ++cache.m_methodSequence; ATH_MSG_DEBUG("S-[" << cache.m_methodSequence << "] extrapolateFromLayerToLayer(...) in '" << tvol.volumeName() << "'. "); @@ -3637,17 +3833,18 @@ Trk::Extrapolator::extrapolateFromLayerToLayer( // skip the navigation layers if (nextLayer->layerMaterialProperties() || (cache.m_parametersOnDetElements && nextLayer->surfaceArray())) { // the next step - do not delete the parameters (garbage collection done by method) - auto [new_track_parm,killed] - = extrapolateToIntermediateLayer(cache, - prop, - currPar.index(), - *nextLayer, - tvol, - dir, - bcheck, - particle, - matupmode, - perpCheck); + auto [new_track_parm, killed] = + extrapolateToIntermediateLayer(ctx, + cache, + prop, + currPar.index(), + *nextLayer, + tvol, + dir, + bcheck, + particle, + matupmode, + perpCheck); ManagedTrackParmPtr nextPar(std::move(new_track_parm)); // previous and last layer setting for loop and oscillation protection previousLayer = lastLayer; @@ -3698,17 +3895,19 @@ Trk::Extrapolator::extrapolateFromLayerToLayer( Trk::ManagedTrackParmPtr Trk::Extrapolator::extrapolateToDestinationLayer( + const EventContext& ctx, Cache& cache, - const IPropagator &prop, + const IPropagator& prop, TrackParmPtr parm_ref, - const Surface &sf, - const Layer &lay, - const TrackingVolume &tvol, - const Layer *startLayer, + const Surface& sf, + const Layer& lay, + const TrackingVolume& tvol, + const Layer* startLayer, PropDirection dir, - const BoundaryCheck& bcheck, + const BoundaryCheck& bcheck, ParticleHypothesis particle, - MaterialUpdateMode matupmode) const { + MaterialUpdateMode matupmode) const +{ // method sequence output --------------------------------- ++cache.m_methodSequence; ATH_MSG_DEBUG("S-[" << cache.m_methodSequence << "] extrapolateToDestinationLayer(...) in '" << tvol.volumeName() << @@ -3718,41 +3917,63 @@ Trk::Extrapolator::extrapolateToDestinationLayer( Trk::TransportJacobian *jac = nullptr; // get the Parameters on the destination surface - // const Trk::TrackParameters* destParameters = cache.m_jacs ? prop.propagate(parm, sf, dir, bcheck, tvol, jac, particle) - // : prop.propagate(parm, sf, dir, bcheck, tvol, particle); double pathLimit = -1.; ManagedTrackParmPtr parm(cache.manage(parm_ref)); - ManagedTrackParmPtr destParameters( ManagedTrackParmPtr::recapture( - parm, - cache.m_jacs ? prop.propagate(*parm, sf, dir, bcheck, - MagneticFieldProperties(), jac, pathLimit, - particle) - : prop.propagate(*parm, sf, dir, bcheck, - MagneticFieldProperties(), particle))); + ManagedTrackParmPtr destParameters(ManagedTrackParmPtr::recapture( + parm, + cache.m_jacs + ? prop.propagate(ctx, + *parm, + sf, + dir, + bcheck, + MagneticFieldProperties(), + jac, + pathLimit, + particle) + : prop.propagate( + ctx, *parm, sf, dir, bcheck, MagneticFieldProperties(), particle))); // fallback to anyDirection // destParameters = destParameters ? destParameters : ( cache.m_jacs ? prop.propagate(parm, sf, Trk::anyDirection, bcheck, // tvol, jac, particle) : prop.propagate(parm, sf, Trk::anyDirection, bcheck, tvol, particle)); if (!destParameters) { - destParameters = ManagedTrackParmPtr::recapture(parm, - (cache.m_jacs - ? prop.propagate(*parm, sf, Trk::anyDirection, bcheck, - MagneticFieldProperties(), jac, pathLimit, - particle) - : prop.propagate(*parm, sf, Trk::anyDirection, - bcheck, - m_fieldProperties, - particle))); + destParameters = ManagedTrackParmPtr::recapture( + parm, + (cache.m_jacs ? prop.propagate(ctx, + *parm, + sf, + Trk::anyDirection, + bcheck, + MagneticFieldProperties(), + jac, + pathLimit, + particle) + : prop.propagate(ctx, + *parm, + sf, + Trk::anyDirection, + bcheck, + m_fieldProperties, + particle))); } // return the pre-updated ones - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(tvol); + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(tvol); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, tvol); ManagedTrackParmPtr preUpdatedParameters(cache.manage()); if (currentUpdator && destParameters && !startIsDestLayer) { preUpdatedParameters = ManagedTrackParmPtr::recapture( - destParameters, - currentUpdator->preUpdate(destParameters.get(), lay, dir, particle, matupmode)); + destParameters, + currentUpdator->preUpdate(currentUpdatorCache, + destParameters.get(), + lay, + dir, + particle, + matupmode)); } else { preUpdatedParameters = destParameters; @@ -3761,7 +3982,7 @@ Trk::Extrapolator::extrapolateToDestinationLayer( // collect the material : either for extrapolateM or for the valdiation if ((cache.m_matstates || m_materialEffectsOnTrackValidation) && preUpdatedParameters && currentUpdator && !startIsDestLayer && lay.preUpdateMaterialFactor(*destParameters, dir) >= 0.01) { - addMaterialEffectsOnTrack(cache,prop, preUpdatedParameters.index(), lay, tvol, dir, particle); + addMaterialEffectsOnTrack(ctx, cache,prop, preUpdatedParameters.index(), lay, tvol, dir, particle); } // call the overlap search on the destination parameters - we are at the surface already @@ -3771,7 +3992,17 @@ Trk::Extrapolator::extrapolateToDestinationLayer( && m_subSurfaceLevel) { ATH_MSG_VERBOSE(" [o] Calling overlapSearch() on destination layer."); // start is destination layer - overlapSearch(cache,prop, parm.index(), preUpdatedParameters.index(), lay, tvol, dir, bcheck, particle, startIsDestLayer); + overlapSearch(ctx, + cache, + prop, + parm.index(), + preUpdatedParameters.index(), + lay, + tvol, + dir, + bcheck, + particle, + startIsDestLayer); } if (preUpdatedParameters) { @@ -3782,18 +4013,19 @@ Trk::Extrapolator::extrapolateToDestinationLayer( return preUpdatedParameters; } -std::pair<Trk::ManagedTrackParmPtr,bool> -Trk::Extrapolator::extrapolateToIntermediateLayer( - Cache& cache, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Layer &lay, - const TrackingVolume &tvol, - PropDirection dir, - const BoundaryCheck& bcheck, - ParticleHypothesis particle, - MaterialUpdateMode matupmode, - bool doPerpCheck) const { +std::pair<Trk::ManagedTrackParmPtr, bool> +Trk::Extrapolator::extrapolateToIntermediateLayer(const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Layer& lay, + const TrackingVolume& tvol, + PropDirection dir, + const BoundaryCheck& bcheck, + ParticleHypothesis particle, + MaterialUpdateMode matupmode, + bool doPerpCheck) const +{ // method sequence output --------------------------------- ++cache.m_methodSequence; ATH_MSG_DEBUG( @@ -3801,7 +4033,10 @@ Trk::Extrapolator::extrapolateToIntermediateLayer( << tvol.volumeName() << "'."); // chose the current updator - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(tvol); + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(tvol); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, tvol); // then go onto the Layer ManagedTrackParmPtr parm(cache.manage(parm_ref)); ManagedTrackParmPtr parsOnLayer(cache.trackParmContainer()); @@ -3812,19 +4047,35 @@ Trk::Extrapolator::extrapolateToIntermediateLayer( // try each surface in turn const std::vector<const Surface *> cs = cl->constituentSurfaces(); for (unsigned int i = 0; i < cs.size(); ++i) { - // parsOnLayer = prop.propagate(parm,*(cs[i]),dir,true,tvol,particle); - parsOnLayer = ManagedTrackParmPtr::recapture( parm, prop.propagate(*parm, *(cs[i]), dir, true, m_fieldProperties, particle)); + parsOnLayer = ManagedTrackParmPtr::recapture( + parm, + prop.propagate( + ctx, *parm, *(cs[i]), dir, true, m_fieldProperties, particle)); if (parsOnLayer) { break; } } } else { - // parsOnLayer = prop.propagate(parm,lay.surfaceRepresentation(),dir,true,tvol,particle); - parsOnLayer = ManagedTrackParmPtr::recapture(parm, prop.propagate(*parm, lay.surfaceRepresentation(), dir, true, m_fieldProperties, particle)); + parsOnLayer = ManagedTrackParmPtr::recapture( + parm, + prop.propagate(ctx, + *parm, + lay.surfaceRepresentation(), + dir, + true, + m_fieldProperties, + particle)); } } else { - // parsOnLayer = prop.propagate(parm,lay.surfaceRepresentation(),dir,true,tvol,particle); - parsOnLayer = ManagedTrackParmPtr::recapture(parm,prop.propagate(*parm, lay.surfaceRepresentation(), dir, true, m_fieldProperties, particle)); + parsOnLayer = + ManagedTrackParmPtr::recapture(parm, + prop.propagate(ctx, + *parm, + lay.surfaceRepresentation(), + dir, + true, + m_fieldProperties, + particle)); } // return if there is nothing to do @@ -3840,7 +4091,7 @@ Trk::Extrapolator::extrapolateToIntermediateLayer( ATH_MSG_DEBUG(" [!] Perpendicular direction of track has changed -- checking"); // reset the nextParameters if the radial change is not allowed // resetting is ok - since the parameters are in the garbage bin already - if (!radialDirectionCheck(prop, *parm, *parsOnLayer, tvol, dir, particle)) { + if (!radialDirectionCheck(ctx, prop, *parm, *parsOnLayer, tvol, dir, particle)) { ATH_MSG_DEBUG(" [+] Perpendicular direction check cancelled this layer intersection."); return std::make_pair(ManagedTrackParmPtr(),false); } @@ -3857,7 +4108,16 @@ Trk::Extrapolator::extrapolateToIntermediateLayer( size_t sizeBeforeSearch = cache.m_parametersOnDetElements->size(); // perform the overlap Search on this layer ATH_MSG_VERBOSE(" [o] Calling overlapSearch() on intermediate layer."); - overlapSearch(cache,prop, parm.index(), parsOnLayer.index(), lay, tvol, dir, bcheck, particle); + overlapSearch(ctx, + cache, + prop, + parm.index(), + parsOnLayer.index(), + lay, + tvol, + dir, + bcheck, + particle); size_t sizeAfterSearch = cache.m_parametersOnDetElements->size(); // the Fatras mode was successful -> postUpdate and garbage collection int lastElement = (int) cache.m_parametersOnDetElements->size() - 1; @@ -3879,35 +4139,39 @@ Trk::Extrapolator::extrapolateToIntermediateLayer( // return the full-updated ones - may create a new object if (lay.layerMaterialProperties() && currentUpdator) { - parsOnLayer = ManagedTrackParmPtr::recapture(parsOnLayer, currentUpdator->update(parsOnLayer.get(), lay, dir, particle, matupmode)); + parsOnLayer = ManagedTrackParmPtr::recapture( + parsOnLayer, + currentUpdator->update( + currentUpdatorCache, parsOnLayer.get(), lay, dir, particle, matupmode)); } // there are layers that have a surfaceArray but no material properties if (parsOnLayer && lay.layerMaterialProperties() && (cache.m_matstates || m_materialEffectsOnTrackValidation)) { - addMaterialEffectsOnTrack(cache,prop, parsOnLayer.index(), lay, tvol, dir, particle); + addMaterialEffectsOnTrack(ctx, cache,prop, parsOnLayer.index(), lay, tvol, dir, particle); } // kill the track if the update killed the track // ----------------------------------------------------------------------- if (!parsOnLayer && m_stopWithUpdateZero) { return std::make_pair(ManagedTrackParmPtr(),true); // the indicator to kill the loopfrom material update - // ---------------------------------- } // ------------ the return of the parsOnLayer --- they're in the garbage bin already return std::make_pair(parsOnLayer,false); } void -Trk::Extrapolator::overlapSearch(Cache& cache, - const IPropagator &prop, +Trk::Extrapolator::overlapSearch(const EventContext& ctx, + Cache& cache, + const IPropagator& prop, TrackParmPtr parm_ref, TrackParmPtr parsOnLayer_ref, - const Layer &lay, - const TrackingVolume & /*tvol*/, + const Layer& lay, + const TrackingVolume& /*tvol*/, PropDirection dir, - const BoundaryCheck& bcheck, // bcheck + const BoundaryCheck& bcheck, // bcheck ParticleHypothesis particle, - bool startingLayer) const { + bool startingLayer) const +{ // indicate destination layer ManagedTrackParmPtr parm(cache.manage(parm_ref)); ManagedTrackParmPtr parsOnLayer(cache.manage(parsOnLayer_ref)); @@ -3953,30 +4217,31 @@ Trk::Extrapolator::overlapSearch(Cache& cache, } else if (isStartLayer) { detParameters = parm; } else if (detSurface) { - // detParameters = prop.propagate(*parm, *detSurface, dir, false, tvol, particle); - detParameters = ManagedTrackParmPtr::recapture(parm, prop.propagate(*parm, *detSurface, dir, false, m_fieldProperties, particle)); + detParameters = ManagedTrackParmPtr::recapture( + parm, + prop.propagate( + ctx, *parm, *detSurface, dir, false, m_fieldProperties, particle)); } // set the surface hit to true, it is anyway overruled bool surfaceHit = true; - ManagedTrackParmPtr track_parm_for_overlap(detParameters); // circumvents pointer management - // to allow using detParameters after detParameters.release() - if (detParameters && - !isStartLayer && - !isDestinationLayer) { + // circumvents pointer management + // to allow using detParameters after detParameters.release() + ManagedTrackParmPtr track_parm_for_overlap(detParameters); + if (detParameters && !isStartLayer && !isDestinationLayer) { ATH_MSG_VERBOSE(" [o] First intersection with Detector surface: " << *detParameters); // for the later use in the overlapSearch - surfaceHit = detParameters && detSurface ? detSurface->isOnSurface(detParameters->position()) : 0; // ,bcheck) - - // creates - // problems on - // start layer; + surfaceHit = detParameters && detSurface + ? detSurface->isOnSurface(detParameters->position()) + : 0; // ,bcheck) -creates problems on start layer; // check also for start/endSurface on this level surfaceHit = (surfaceHit && startSurface) ? ((detParameters->position() - parm->position()).dot(dir * parm->momentum().normalized()) > 0) : surfaceHit; - surfaceHit = (surfaceHit && endSurface) ? - ((detParameters->position() - parsOnLayer->position()).dot(dir * parsOnLayer->momentum().normalized()) < - 0) : surfaceHit; + surfaceHit = (surfaceHit && endSurface) + ? ((detParameters->position() - parsOnLayer->position()) + .dot(dir * parsOnLayer->momentum().normalized()) < 0) + : surfaceHit; // surface is hit within bounds (or at least with given boundary check directive) -> it counts // surface hit also survived start/endsurface search // @@ -4000,7 +4265,8 @@ Trk::Extrapolator::overlapSearch(Cache& cache, if (track_parm_for_overlap) { // retrive compatible subsurfaces std::vector<Trk::SurfaceIntersection> cSurfaces; - size_t ncSurfaces = lay.compatibleSurfaces(cSurfaces, *track_parm_for_overlap, Trk::anyDirection, bcheck, false); + size_t ncSurfaces = lay.compatibleSurfaces( + cSurfaces, *track_parm_for_overlap, Trk::anyDirection, bcheck, false); // import from StaticEngine.icc if (ncSurfaces) { @@ -4010,27 +4276,33 @@ Trk::Extrapolator::overlapSearch(Cache& cache, auto overlapSurfaceHit=m_overlapSurfaceHit.buffer(); for (auto &csf : cSurfaces) { - // propagate to the compatible surface, return types are (pathLimit failure is excluded by Trk::anyDirection for - // the moment): - ManagedTrackParmPtr overlapParameters( ManagedTrackParmPtr::recapture( - parm, - prop.propagate(*parm, - *(csf.object), - Trk::anyDirection, - true, - m_fieldProperties, - particle))); + // propagate to the compatible surface, return types are (pathLimit + // failure is excluded by Trk::anyDirection for the moment): + ManagedTrackParmPtr overlapParameters( + ManagedTrackParmPtr::recapture(parm, + prop.propagate(ctx, + *parm, + *(csf.object), + Trk::anyDirection, + true, + m_fieldProperties, + particle))); if (overlapParameters) { ATH_MSG_VERBOSE(" [+] Overlap surface was hit, checking start/end surface condition."); // check on start / end surface for on-layer navigaiton action - surfaceHit = (startSurface) ? - ((overlapParameters->position() - parm->position()).dot(dir * parm->momentum().normalized()) > - 0) : true; - surfaceHit = (surfaceHit && endSurface) ? - ((overlapParameters->position() - parsOnLayer->position()).dot(dir * - parsOnLayer->momentum().normalized()) - < 0) : surfaceHit; + + surfaceHit = (startSurface) + ? ((overlapParameters->position() - parm->position()) + .dot(dir * parm->momentum().normalized()) > 0) + : true; + + surfaceHit = + (surfaceHit && endSurface) + ? ((overlapParameters->position() - parsOnLayer->position()) + .dot(dir * parsOnLayer->momentum().normalized()) < 0) + : surfaceHit; + if (surfaceHit) { ATH_MSG_VERBOSE(" [H] Hit with detector surface recorded !"); // count the overlap Surfaces hit @@ -4071,16 +4343,18 @@ Trk::Extrapolator::propagatorType(const Trk::TrackingVolume &tvol) const { // ----------------------- The Initialization ------------------------------------------------- Trk::PropDirection Trk::Extrapolator::initializeNavigation( - Cache& cache, - const IPropagator &prop, - TrackParmPtr parm_ref, - const Surface &sf, - PropDirection dir, - ParticleHypothesis particle, - ManagedTrackParmPtr &refParameters, - const Layer * &associatedLayer, - const TrackingVolume * &associatedVolume, - const TrackingVolume * &destVolume) const { + const EventContext& ctx, + Cache& cache, + const IPropagator& prop, + TrackParmPtr parm_ref, + const Surface& sf, + PropDirection dir, + ParticleHypothesis particle, + ManagedTrackParmPtr& refParameters, + const Layer*& associatedLayer, + const TrackingVolume*& associatedVolume, + const TrackingVolume*& destVolume) const +{ ManagedTrackParmPtr parm(cache.manage(parm_ref)); // @TODO parm shared ? @@ -4166,9 +4440,16 @@ Trk::Extrapolator::initializeNavigation( // refParameters = prop.propagateParameters(parm,sf,dir,false,*associatedVolume); refParameters = ManagedTrackParmPtr::recapture( - parm, - prop.propagateParameters(*parm, sf, dir, false, m_fieldProperties, particle, false, - associatedVolume)); + parm, + prop.propagateParameters(ctx, + *parm, + sf, + dir, + false, + m_fieldProperties, + particle, + false, + associatedVolume)); // chose on projective method if (refParameters) { // check the direction on basis of a vector projection @@ -4216,11 +4497,17 @@ Trk::Extrapolator::initializeNavigation( // if the propagation has not been done already (for direction estimation) // do the global search always with a reference propagation if (!refParameters && associatedVolume) { - // refParameters = prop.propagateParameters(parm, sf, dir, false, *associatedVolume); refParameters = ManagedTrackParmPtr::recapture( - parm, - prop.propagateParameters(*parm, sf, dir, false, m_fieldProperties, particle, false, - associatedVolume)); + parm, + prop.propagateParameters(ctx, + *parm, + sf, + dir, + false, + m_fieldProperties, + particle, + false, + associatedVolume)); } // get the destination Volume if (refParameters) { @@ -4263,12 +4550,16 @@ Trk::Extrapolator::radialDirection(const Trk::TrackParameters &pars, PropDirecti } bool -Trk::Extrapolator::radialDirectionCheck(const IPropagator &prop, - const TrackParameters &startParm, - const TrackParameters &parsOnLayer, - const TrackingVolume &tvol, - PropDirection dir, - ParticleHypothesis particle) const { +Trk::Extrapolator::radialDirectionCheck( + const EventContext& ctx, + const IPropagator& prop, + const TrackParameters& startParm, + const TrackParameters& parsOnLayer, + const TrackingVolume& tvol, + PropDirection dir, + ParticleHypothesis particle) const +{ + const Amg::Vector3D &startPosition = startParm.position(); const Amg::Vector3D &onLayerPosition = parsOnLayer.position(); @@ -4279,14 +4570,13 @@ Trk::Extrapolator::radialDirectionCheck(const IPropagator &prop, // only for tubes the crossing makes sense to check for validity if (boundarySurfaces.size() == 4) { - // propagate to the inside surface and compare the distance: // it can be either the next layer from the initial point, or the inner tube boundary surface const Trk::Surface &insideSurface = (boundarySurfaces[Trk::tubeInnerCover].get())->surfaceRepresentation(); // const Trk::TrackParameters* parsOnInsideSurface = - // prop.propagateParameters(startParm,insideSurface,dir,true,tvol,particle); - std::unique_ptr<const Trk::TrackParameters> - parsOnInsideSurface(prop.propagateParameters(startParm, insideSurface, dir, true, - m_fieldProperties, particle)); + std::unique_ptr<const Trk::TrackParameters> parsOnInsideSurface( + prop.propagateParameters( + ctx, startParm, insideSurface, dir, true, m_fieldProperties, particle)); + double distToInsideSurface = parsOnInsideSurface ? (startPosition - (parsOnInsideSurface->position())).mag() : 10e10; @@ -4336,13 +4626,17 @@ Trk::Extrapolator::momentumOutput(const Amg::Vector3D &mom) const { } void -Trk::Extrapolator::addMaterialEffectsOnTrack(Cache& cache, - const Trk::IPropagator &prop, - TrackParmPtr parm_ref, - const Trk::Layer &lay, - const Trk::TrackingVolume & /*tvol*/, - Trk::PropDirection propDir, - Trk::ParticleHypothesis particle) const { +Trk::Extrapolator::addMaterialEffectsOnTrack( + const EventContext& ctx, + Cache& cache, + const Trk::IPropagator& prop, + TrackParmPtr parm_ref, + const Trk::Layer& lay, + const Trk::TrackingVolume& /*tvol*/, + Trk::PropDirection propDir, + Trk::ParticleHypothesis particle) const +{ + ManagedTrackParmPtr parms(cache.manage(parm_ref)); ATH_MSG_VERBOSE(" [+] addMaterialEffectsOnTrack() - at " << positionOutput(parms->position())); // statistics counter Fw/Bw @@ -4363,31 +4657,38 @@ Trk::Extrapolator::addMaterialEffectsOnTrack(Cache& cache, // try each surface in turn const std::vector<const Surface *> cs = cl->constituentSurfaces(); for (unsigned int i = 0; i < cs.size(); ++i) { - // parsOnLayer = prop.propagateParameters(parms,*(cs[i]),Trk::anyDirection,false,tvol); parsOnLayer = ManagedTrackParmPtr::recapture( - parms, - prop.propagateParameters(*parms, *(cs[i]), Trk::anyDirection, false, m_fieldProperties)); + parms, + prop.propagateParameters(ctx, + *parms, + *(cs[i]), + Trk::anyDirection, + false, + m_fieldProperties)); if (parsOnLayer) { break; } } } else { - // parsOnLayer = prop.propagateParameters(parms,lay.surfaceRepresentation(),Trk::anyDirection,false,tvol); parsOnLayer = ManagedTrackParmPtr::recapture( - parms, - prop.propagateParameters(*parms, - lay.surfaceRepresentation(), Trk::anyDirection, false, - m_fieldProperties)); + parms, + prop.propagateParameters(ctx, + *parms, + lay.surfaceRepresentation(), + Trk::anyDirection, + false, + m_fieldProperties)); } } else { - // parsOnLayer = prop.propagateParameters(parms,lay.surfaceRepresentation(),Trk::anyDirection,false,tvol); parsOnLayer = ManagedTrackParmPtr::recapture( - parms, - prop.propagateParameters(*parms, - lay.surfaceRepresentation(), Trk::anyDirection, false, m_fieldProperties)); + parms, + prop.propagateParameters(ctx, + *parms, + lay.surfaceRepresentation(), + Trk::anyDirection, + false, + m_fieldProperties)); } - // originally, the code for the enclosing if was just - // parsOnLayer = prop.propagateParameters(*parms,lay.surfaceRepresentation(),Trk::anyDirection,false,tvol); } else { parsOnLayer = parms; } @@ -4441,25 +4742,32 @@ Trk::Extrapolator::addMaterialEffectsOnTrack(Cache& cache, Trk::EnergyLoss *energyLoss = m_elossupdaters[0]->energyLoss(*materialProperties, fabs( 1. / currentQoP), pathCorrection, propDir, particle); // get the scattering angle - double sigmaMS = - sqrt(m_msupdaters[0]->sigmaSquare(*materialProperties, fabs(1. / currentQoP), pathCorrection, particle)); - Trk::ScatteringAngles *scatAngles = new ScatteringAngles(0, 0, sigmaMS / sin(parsOnLayer->parameters()[Trk::theta]), sigmaMS); - Trk::MaterialEffectsOnTrack *meot = new Trk::MaterialEffectsOnTrack(tInX0, scatAngles, energyLoss, + double sigmaMS = sqrt(m_msupdaters[0]->sigmaSquare( + *materialProperties, fabs(1. / currentQoP), pathCorrection, particle)); + Trk::ScatteringAngles* scatAngles = new ScatteringAngles( + 0, 0, sigmaMS / sin(parsOnLayer->parameters()[Trk::theta]), sigmaMS); + + Trk::MaterialEffectsOnTrack* meot = new Trk::MaterialEffectsOnTrack(tInX0, + scatAngles, + energyLoss, *lay.surfaceRepresentation().baseSurface()); // push it to the material states cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, parsOnLayer.release(), nullptr, meot)); // update cache if (cache.m_extrapolationCache) { if (energyLoss->meanIoni() == 0. && tInX0 > 0.) { - ATH_MSG_WARNING( - " Extrapolator: the ExtrapolationCache cannot work because the ElossUpdator is wrongly configured: switch joboption DetailedEloss on "); + ATH_MSG_WARNING(" Extrapolator: the ExtrapolationCache cannot work " + "because the ElossUpdator is wrongly configured: " + "switch joboption DetailedEloss on "); } if (m_dumpCache) { dumpCache(cache," addMaterialEffectsOnTrack"); } cache.m_extrapolationCache->updateX0(tInX0); - cache.m_extrapolationCache->updateEloss(energyLoss->meanIoni(), energyLoss->sigmaIoni(), - energyLoss->meanRad(), energyLoss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(energyLoss->meanIoni(), + energyLoss->sigmaIoni(), + energyLoss->meanRad(), + energyLoss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -4477,11 +4785,13 @@ Trk::Extrapolator::dumpCache(Cache& cache, const std::string& txt) const { } ATH_MSG_DEBUG( - txt << " X0 " << cache.m_extrapolationCache->x0tot() << " Eloss deltaE " << cache.m_extrapolationCache->eloss()->deltaE() - << " Eloss sigma " << cache.m_extrapolationCache->eloss()->sigmaDeltaE() << " meanIoni " - << cache.m_extrapolationCache->eloss()->meanIoni() << " sigmaIoni " << cache.m_extrapolationCache->eloss()->sigmaIoni() << " meanRad " - << cache.m_extrapolationCache->eloss()->meanRad() << " sigmaRad " << - cache.m_extrapolationCache->eloss()->sigmaRad()); + txt << " X0 " << cache.m_extrapolationCache->x0tot() << " Eloss deltaE " + << cache.m_extrapolationCache->eloss()->deltaE() << " Eloss sigma " + << cache.m_extrapolationCache->eloss()->sigmaDeltaE() << " meanIoni " + << cache.m_extrapolationCache->eloss()->meanIoni() << " sigmaIoni " + << cache.m_extrapolationCache->eloss()->sigmaIoni() << " meanRad " + << cache.m_extrapolationCache->eloss()->meanRad() << " sigmaRad " + << cache.m_extrapolationCache->eloss()->sigmaRad()); } bool @@ -4496,16 +4806,19 @@ Trk::Extrapolator::checkCache(Cache& cache,const std:: string& txt) const { } } -const std::vector< std::pair< const Trk::TrackParameters *, int > > * +const std::vector<std::pair<const Trk::TrackParameters*, int>>* Trk::Extrapolator::extrapolate( - const Trk::TrackParameters &parm, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackStateOnSurface *> * &material, - int destination) const { + const EventContext& ctx, + const Trk::TrackParameters& parm, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackStateOnSurface*>*& material, + int destination) const +{ + + // extrapolation method intended for collection of intersections with active layers/volumes // extrapolation stops at indicated geoID subdetector exit - Cache cache{}; ++cache.m_methodSequence; ATH_MSG_DEBUG("M-[" << cache.m_methodSequence << "] extrapolate(through active volumes), from " << parm.position()); @@ -4520,9 +4833,11 @@ Trk::Extrapolator::extrapolate( const Trk::TrackingVolume *boundaryVol = nullptr; // cleanup cache.m_parametersAtBoundary.resetBoundaryInformation(); - + //Material effect updator cache + populateMatEffUpdatorCache(cache); // extrapolate to subdetector boundary - ManagedTrackParmPtr subDetBounds(extrapolateToVolumeWithPathLimit(cache,cache.manage(parm).index(), -1., dir, particle, boundaryVol)); + ManagedTrackParmPtr subDetBounds(extrapolateToVolumeWithPathLimit( + ctx, cache, cache.manage(parm).index(), -1., dir, particle, boundaryVol)); while (subDetBounds) { ATH_MSG_DEBUG(" Identified subdetector boundary crossing saved " << positionOutput(subDetBounds->position())); @@ -4537,28 +4852,35 @@ Trk::Extrapolator::extrapolate( if (!cache.m_parametersAtBoundary.nextVolume) { break; // world boundary } - subDetBounds = extrapolateToVolumeWithPathLimit(cache,nextPar.index(), -1., dir, particle, boundaryVol); + subDetBounds = extrapolateToVolumeWithPathLimit( + ctx, cache, nextPar.index(), -1., dir, particle, boundaryVol); } return !cache.m_identifiedParameters->empty() ? cache.m_identifiedParameters.release() : nullptr; } -const Trk::TrackParameters * +const Trk::TrackParameters* Trk::Extrapolator::extrapolateWithPathLimit( - const Trk::TrackParameters &parm, - double &pathLim, - Trk::PropDirection dir, - Trk::ParticleHypothesis particle, - std::vector<const Trk::TrackParameters *> * &parmOnSf, - std::vector<const Trk::TrackStateOnSurface *> * &material, - const Trk::TrackingVolume *boundaryVol, - MaterialUpdateMode matupmod) const { -// extrapolation method intended for simulation of particle decay; collects intersections with active layers -// possible outcomes:1/ returns curvilinear parameters after reaching the maximal path -// 2/ returns parameters at destination volume boundary -// 3/ returns 0 ( particle stopped ) but keeps vector of hits - + const EventContext& ctx, + const Trk::TrackParameters& parm, + double& pathLim, + Trk::PropDirection dir, + Trk::ParticleHypothesis particle, + std::vector<const Trk::TrackParameters*>*& parmOnSf, + std::vector<const Trk::TrackStateOnSurface*>*& material, + const Trk::TrackingVolume* boundaryVol, + MaterialUpdateMode matupmod) const +{ + // extrapolation method intended for simulation of particle decay; collects + // intersections with active layers possible outcomes:1/ returns curvilinear + // parameters after reaching the maximal path + // 2/ returns parameters at destination volume boundary + // 3/ returns 0 ( particle stopped ) but keeps vector of + // hits ATH_MSG_DEBUG( - "M-[" << 1 /* should be ++cache.m_methodSequence but cache not yet created */ << "] extrapolateWithPathLimit(...) " << pathLim << ", from " << parm.position()); + "M-[" + << 1 /* should be ++cache.m_methodSequence but cache not yet created */ + << "] extrapolateWithPathLimit(...) " << pathLim << ", from " + << parm.position()); if (!m_stepPropagator) { // Get the STEP_Propagator AlgTool @@ -4569,7 +4891,6 @@ Trk::Extrapolator::extrapolateWithPathLimit( } } Cache cache{}; - // reset the path cache.m_path = 0.; ++cache.m_methodSequence; @@ -4583,7 +4904,9 @@ Trk::Extrapolator::extrapolateWithPathLimit( cache.m_matstates = material; // cleanup cache.m_parametersAtBoundary.resetBoundaryInformation(); - + //Material effect updator cache + populateMatEffUpdatorCache(cache); + // if no input volume, define as highest volume // const Trk::TrackingVolume* destVolume = boundaryVol ? boundaryVol : m_navigator->highestVolume(); cache.m_currentStatic = nullptr; @@ -4600,8 +4923,15 @@ Trk::Extrapolator::extrapolateWithPathLimit( } // extrapolate to destination volume boundary with path limit - ManagedTrackParmPtr returnParms(extrapolateToVolumeWithPathLimit(cache,cache.manage(parm).index(), pathLim, dir, particle, boundaryVol, - matupmod)); + ManagedTrackParmPtr returnParms( + extrapolateToVolumeWithPathLimit(ctx, + cache, + cache.manage(parm).index(), + pathLim, + dir, + particle, + boundaryVol, + matupmod)); // folr debugging cache.m_robustSampling = m_robustSampling; @@ -4614,34 +4944,40 @@ Trk::Extrapolator::extrapolateWithPathLimit( Trk::ManagedTrackParmPtr Trk::Extrapolator::extrapolateToVolumeWithPathLimit( + const EventContext& ctx, Cache& cache, TrackParmPtr parm_ref, double pathLim, Trk::PropDirection dir, Trk::ParticleHypothesis particle, - const Trk::TrackingVolume *destVol, - MaterialUpdateMode matupmod) const { + const Trk::TrackingVolume* destVol, + MaterialUpdateMode matupmod) const +{ + // returns: // A) curvilinear track parameters if path limit reached // B) boundary parameters (at destination volume boundary) - // initialize the return parameters vector ManagedTrackParmPtr parm(cache.manage(parm_ref)); ManagedTrackParmPtr currPar(parm); - const Trk::TrackingVolume *currVol = nullptr; + const Trk::TrackingVolume* currVol = nullptr; const Trk::TrackingVolume *nextVol = nullptr; std::vector<unsigned int> solutions; const Trk::TrackingVolume *assocVol = nullptr; unsigned int iDest = 0; // destination volume boundary ? - if (destVol && m_navigator->atVolumeBoundary(currPar.get(), destVol, dir, nextVol, m_tolerance) && nextVol != destVol) { + if (destVol && + m_navigator->atVolumeBoundary( + currPar.get(), destVol, dir, nextVol, m_tolerance) && + nextVol != destVol) { pathLim = cache.m_path; return currPar; } bool resolveActive = true; - if (cache.m_lastMaterialLayer && !cache.m_lastMaterialLayer->isOnLayer(parm->position())) { + if (cache.m_lastMaterialLayer && + !cache.m_lastMaterialLayer->isOnLayer(parm->position())) { cache.m_lastMaterialLayer = nullptr; } if (!cache.m_highestVolume) { @@ -4709,11 +5045,25 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( // alignable volume ? if (cache.m_currentStatic && cache.m_currentStatic->geometrySignature() == Trk::Calo) { if(cache.m_currentStatic->isAlignable()){ - const Trk::AlignableTrackingVolume *alignTV = static_cast<const Trk::AlignableTrackingVolume *> (cache.m_currentStatic); - ManagedTrackParmPtr nextPar(extrapolateInAlignableTV(cache,*m_stepPropagator, currPar.index(), nullptr, alignTV, dir, + const Trk::AlignableTrackingVolume* alignTV = + static_cast<const Trk::AlignableTrackingVolume*>(cache.m_currentStatic); + ManagedTrackParmPtr nextPar(extrapolateInAlignableTV(ctx, + cache, + *m_stepPropagator, + currPar.index(), + nullptr, + alignTV, + dir, particle)); if (nextPar) { - return extrapolateToVolumeWithPathLimit(cache,nextPar.index(), pathLim, dir, particle, destVol, matupmod); + return extrapolateToVolumeWithPathLimit(ctx, + cache, + nextPar.index(), + pathLim, + dir, + particle, + destVol, + matupmod); }else { return ManagedTrackParmPtr(); } @@ -4748,8 +5098,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > > &detBounds = (*iTer)->trackingVolume()->boundarySurfaces(); if (active) { - cache.m_detachedVols.emplace_back(*iTer, - detBounds.size()); + cache.m_detachedVols.emplace_back(*iTer, detBounds.size()); for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) { const Trk::Surface &surf = (detBounds[ibb].get())->surfaceRepresentation(); cache.m_detachedBoundaries.emplace_back(&surf, true); @@ -4771,8 +5120,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( } const std::vector<const Trk::Layer *> *confLays = (*iTer)->trackingVolume()->confinedArbitraryLayers(); if ((*iTer)->trackingVolume()->confinedDenseVolumes() || (confLays && confLays->size() > detBounds.size())) { - cache.m_detachedVols.emplace_back(*iTer, - detBounds.size()); + cache.m_detachedVols.emplace_back(*iTer, detBounds.size()); for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) { const Trk::Surface &surf = (detBounds[ibb].get())->surfaceRepresentation(); cache.m_detachedBoundaries.emplace_back(&surf, true); @@ -4781,14 +5129,15 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( std::vector<const Trk::Layer *>::const_iterator lIt = confLays->begin(); for (; lIt != confLays->end(); lIt++) { cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()), - true); + true); cache.m_navigLays.emplace_back((*iTer)->trackingVolume(), *lIt); } } } } } - cache.m_denseResolved = std::pair<unsigned int, unsigned int> (cache.m_denseVols.size(), cache.m_denseBoundaries.size()); + cache.m_denseResolved = std::pair<unsigned int, unsigned int>( + cache.m_denseVols.size(), cache.m_denseBoundaries.size()); cache.m_layerResolved = cache.m_layers.size(); } @@ -4966,45 +5315,46 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( } else { // * this does not work - debug ! const Trk::Layer *lay = cache.m_currentStatic->associatedLayer(gp); - // if (!lay) { - // lay = cache.m_currentStatic->associatedLayer(gp+m_tolerance*parm->momentum().unit()); - // std::cout<<" find input associated layer, second attempt:"<< lay<< std::endl; - // } if (lay) { cache.m_layers.emplace_back(&(lay->surfaceRepresentation()), false); cache.m_navigLays.emplace_back(cache.m_currentStatic, lay); - const Trk::Layer *nextLayer = lay->nextLayer(currPar->position(), dir * currPar->momentum().normalized()); + const Trk::Layer* nextLayer = lay->nextLayer( + currPar->position(), dir * currPar->momentum().normalized()); if (nextLayer && nextLayer != lay) { cache.m_layers.emplace_back(&(nextLayer->surfaceRepresentation()), - false); - cache.m_navigLays.emplace_back(cache.m_currentStatic, - nextLayer); + false); + cache.m_navigLays.emplace_back(cache.m_currentStatic, nextLayer); } - const Trk::Layer *backLayer = lay->nextLayer(currPar->position(), -dir * currPar->momentum().normalized()); + const Trk::Layer* backLayer = lay->nextLayer( + currPar->position(), -dir * currPar->momentum().normalized()); if (backLayer && backLayer != lay) { cache.m_layers.emplace_back(&(backLayer->surfaceRepresentation()), - false); - cache.m_navigLays.emplace_back(cache.m_currentStatic, - backLayer); + false); + cache.m_navigLays.emplace_back(cache.m_currentStatic, backLayer); } } } } - // cache.m_navigSurfs contains destination surface (if it exists), static volume boundaries - // complete with TG cache.m_layers/dynamic layers, cache.m_denseBoundaries, cache.m_navigBoundaries, cache.m_detachedBoundaries if (!cache.m_layers.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_layers.begin(), cache.m_layers.end()); + cache.m_navigSurfs.insert( + cache.m_navigSurfs.end(), cache.m_layers.begin(), cache.m_layers.end()); } if (!cache.m_denseBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_denseBoundaries.begin(), cache.m_denseBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_denseBoundaries.begin(), + cache.m_denseBoundaries.end()); } if (!cache.m_navigBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_navigBoundaries.begin(), cache.m_navigBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_navigBoundaries.begin(), + cache.m_navigBoundaries.end()); } if (!cache.m_detachedBoundaries.empty()) { - cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), cache.m_detachedBoundaries.begin(), cache.m_detachedBoundaries.end()); + cache.m_navigSurfs.insert(cache.m_navigSurfs.end(), + cache.m_detachedBoundaries.begin(), + cache.m_detachedBoundaries.end()); } @@ -5024,9 +5374,10 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( } // ready to propagate - // till: A/ static volume boundary(bcheck=true) , B/ material layer(bcheck=true), C/ destination surface(bcheck=false) - // update of cache.m_navigSurfs required if I/ entry into new navig volume, II/ exit from currentActive without overlaps - + // till: A/ static volume boundary(bcheck=true) , B/ material + // layer(bcheck=true), C/ destination surface(bcheck=false) update of + // cache.m_navigSurfs required if I/ entry into new navig volume, II/ exit + // from currentActive without overlaps nextVol = nullptr; while (currPar) { double path = 0.; @@ -5034,27 +5385,32 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( path = pathLim; } std::vector<unsigned int> solutions; - ATH_MSG_DEBUG(" [+] Starting propagation at position " << positionOutput(currPar->position()) - << " (current momentum: " << currPar->momentum().mag() << - ")"); - ATH_MSG_DEBUG(" [+] " << cache.m_navigSurfs.size() << " target surfaces in '" << cache.m_currentDense->volumeName() << "'."); // - // verify - // that - // material - // input - // makes - // sense - ATH_MSG_DEBUG(" [+] " << " with path limit" << pathLim << ","); // verify that material input makes sense - ATH_MSG_DEBUG(" [+] " << " in the direction" << dir << "."); // verify that material input makes sense + ATH_MSG_DEBUG(" [+] Starting propagation at position " + << positionOutput(currPar->position()) + << " (current momentum: " << currPar->momentum().mag() + << ")"); + ATH_MSG_DEBUG( + " [+] " << cache.m_navigSurfs.size() << " target surfaces in '" + << cache.m_currentDense->volumeName() << "'."); // verify that material input makes sense + ATH_MSG_DEBUG(" [+] " << " with path limit" << pathLim << ","); // verify that material input makes sense + ATH_MSG_DEBUG(" [+] " << " in the direction" << dir << "."); // verify that material input makes sense if (!(cache.m_currentDense->inside(currPar->position(), m_tolerance) || m_navigator->atVolumeBoundary(currPar.get(), cache.m_currentDense, dir, assocVol, m_tolerance))) { cache.m_currentDense = cache.m_highestVolume; } ManagedTrackParmPtr nextPar(ManagedTrackParmPtr::recapture( - currPar, m_stepPropagator->propagate(*currPar, cache.m_navigSurfs, dir, m_fieldProperties, - particle, solutions, path, true, false, - cache.m_currentDense))); - ATH_MSG_VERBOSE(" [+] Propagation done. "); + currPar, + m_stepPropagator->propagate(ctx, + *currPar, + cache.m_navigSurfs, + dir, + m_fieldProperties, + particle, + solutions, + path, + true, + false, + cache.m_currentDense))); if (nextPar) { ATH_MSG_DEBUG(" [+] Position after propagation - at " << positionOutput(nextPar->position())); ATH_MSG_DEBUG(" [+] Momentum after propagation - " << nextPar->momentum()); @@ -5065,8 +5421,9 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( return nextPar; } // check missing volume boundary - if (nextPar && !(cache.m_currentDense->inside(nextPar->position(), m_tolerance) - || m_navigator->atVolumeBoundary(nextPar.get(), cache.m_currentDense, dir, assocVol, m_tolerance))) { + if (nextPar && + !(cache.m_currentDense->inside(nextPar->position(), m_tolerance) || + m_navigator->atVolumeBoundary(nextPar.get(), cache.m_currentDense, dir, assocVol, m_tolerance))) { ATH_MSG_DEBUG(" [!] ERROR: missing volume boundary for volume" << cache.m_currentDense->volumeName()); if (cache.m_currentDense->zOverAtimesRho() != 0.) { ATH_MSG_DEBUG(" [!] ERROR: trying to recover: repeat the propagation step in" << @@ -5097,7 +5454,10 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( dumpCache(cache," extrapolateToVolumeWithPathLimit"); } cache.m_extrapolationCache->updateX0(dInX0); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -5112,8 +5472,8 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( nextPar->parameters()[Trk::theta]), scatsigma); // energy loss double currentqoverp = nextPar->parameters()[Trk::qOverP]; - Trk::EnergyLoss *eloss = m_elossupdaters[0]->energyLoss(materialProperties, fabs( - 1. / currentqoverp), 1., dir, particle); + Trk::EnergyLoss* eloss = m_elossupdaters[0]->energyLoss( + materialProperties, fabs(1. / currentqoverp), 1., dir, particle); // compare energy loss ATH_MSG_DEBUG(" [M] Energy loss: STEP , EnergyLossUpdator:" << nextPar->momentum().mag() - currPar->momentum().mag() << "," << eloss->deltaE()); @@ -5123,16 +5483,20 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( // Trk::EnergyLoss* eloss = new Trk::EnergyLoss(adj*eloss0->deltaE(),adj*eloss0->sigmaDeltaE()); // delete eloss0; - Trk::MaterialEffectsOnTrack *mefot = new Trk::MaterialEffectsOnTrack(dInX0, newsa, eloss, - *((nextPar->associatedSurface()).baseSurface())); + Trk::MaterialEffectsOnTrack* mefot = new Trk::MaterialEffectsOnTrack( + dInX0, newsa, eloss, *((nextPar->associatedSurface()).baseSurface())); - cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, ManagedTrackParmPtr(nextPar).release(), nullptr, mefot)); + cache.m_matstates->push_back(new TrackStateOnSurface( + nullptr, ManagedTrackParmPtr(nextPar).release(), nullptr, mefot)); if (cache.m_extrapolationCache) { if (m_dumpCache) { dumpCache(cache," extrapolateToVolumeWithPathLimit"); } cache.m_extrapolationCache->updateX0(dInX0); - cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), eloss->sigmaIoni(), eloss->meanRad(), eloss->sigmaRad()); + cache.m_extrapolationCache->updateEloss(eloss->meanIoni(), + eloss->sigmaIoni(), + eloss->meanRad(), + eloss->sigmaRad()); if (m_dumpCache) { dumpCache(cache," After"); } @@ -5153,9 +5517,19 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( if (mb) { if (mb->layerMaterialProperties() && mb->layerMaterialProperties()->fullMaterial(nextPar->position())) { double pIn = nextPar->momentum().mag(); - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(*cache.m_currentStatic); + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(*cache.m_currentStatic); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, *cache.m_currentStatic); if (currentUpdator) { - nextPar = ManagedTrackParmPtr::recapture(nextPar,currentUpdator->update(nextPar.get(), *mb, dir, particle, matupmod)); + nextPar = ManagedTrackParmPtr::recapture( + nextPar, + currentUpdator->update(currentUpdatorCache, + nextPar.get(), + *mb, + dir, + particle, + matupmod)); } if (!nextPar) { ATH_MSG_VERBOSE(" [+] Update may have killed track - return."); @@ -5165,7 +5539,14 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( ATH_MSG_VERBOSE( " Update energy loss:" << nextPar->momentum().mag() - pIn << "at position:" << nextPar->position()); if (cache.m_matstates) { - addMaterialEffectsOnTrack(cache,*m_stepPropagator, nextPar.index(), *mb, *cache.m_currentStatic, dir, particle); + addMaterialEffectsOnTrack(ctx, + cache, + *m_stepPropagator, + nextPar.index(), + *mb, + *cache.m_currentStatic, + dir, + particle); } } } @@ -5178,8 +5559,10 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( nextPar->position(), nextPar->momentum(), dir); if (nextVol != cache.m_currentStatic) { cache.m_parametersAtBoundary.boundaryInformation(nextVol, nextPar, nextPar); - ATH_MSG_DEBUG(" [+] StaticVol boundary reached of '" << cache.m_currentStatic->volumeName() << "', geoID: " - << cache.m_currentStatic->geometrySignature()); + ATH_MSG_DEBUG(" [+] StaticVol boundary reached of '" + << cache.m_currentStatic->volumeName() << "', geoID: " + << cache.m_currentStatic->geometrySignature()); + if (m_navigator->atVolumeBoundary(nextPar.get(), cache.m_currentStatic, dir, assocVol, m_tolerance) && assocVol != cache.m_currentStatic) { cache.m_currentDense = cache.m_dense ? nextVol : cache.m_highestVolume; @@ -5203,7 +5586,14 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( return nextPar; } } - return extrapolateToVolumeWithPathLimit(cache,nextPar.index(), pathLim, dir, particle, destVol, matupmod); + return extrapolateToVolumeWithPathLimit(ctx, + cache, + nextPar.index(), + pathLim, + dir, + particle, + destVol, + matupmod); } } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size()) { @@ -5222,31 +5612,48 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( } // material update: pre-update - const IMaterialEffectsUpdator *currentUpdator = subMaterialEffectsUpdator(*cache.m_currentStatic); + const IMaterialEffectsUpdator* currentUpdator = + subMaterialEffectsUpdator(*cache.m_currentStatic); + IMaterialEffectsUpdator::ICache& currentUpdatorCache = + subMaterialEffectsUpdatorCache(cache, *cache.m_currentStatic); + if (matUp && nextLayer->surfaceArray()) { double pIn = nextPar->momentum().mag(); if (currentUpdator) { - nextPar=ManagedTrackParmPtr::recapture( - nextPar, - currentUpdator->preUpdate(nextPar.get(), *nextLayer, dir, particle, matupmod)); + nextPar = ManagedTrackParmPtr::recapture( + nextPar, + currentUpdator->preUpdate(currentUpdatorCache, + nextPar.get(), + *nextLayer, + dir, + particle, + matupmod)); } if (!nextPar) { ATH_MSG_VERBOSE(" [+] Update may have killed track - return."); cache.m_parametersAtBoundary.resetBoundaryInformation(); return ManagedTrackParmPtr(); } else { // the MEOT will be saved at the end - ATH_MSG_VERBOSE( - " Pre-update energy loss:" << nextPar->momentum().mag() - pIn << "at position:" << nextPar->position() << ", current momentum:" << - nextPar->momentum()); + ATH_MSG_VERBOSE(" Pre-update energy loss:" + << nextPar->momentum().mag() - pIn + << "at position:" << nextPar->position() + << ", current momentum:" << nextPar->momentum()); } } // active surface intersections ( Fatras hits ...) if (cache.m_parametersOnDetElements && particle != Trk::neutron) { if (nextLayer->surfaceArray()) { - // perform the overlap Search on this layer ATH_MSG_VERBOSE(" [o] Calling overlapSearch() on layer."); - overlapSearch(cache,*m_subPropagators[0], currPar.index(), nextPar.index(), - *nextLayer, *cache.m_currentStatic, dir, true, particle); + overlapSearch(ctx, + cache, + *m_subPropagators[0], + currPar.index(), + nextPar.index(), + *nextLayer, + *cache.m_currentStatic, + dir, + true, + particle); } else if (nextLayer->layerType() > 0 && nextLayer->isOnLayer(nextPar->position())) { ATH_MSG_VERBOSE(" [o] Collecting intersection with active layer."); cache.m_parametersOnDetElements->push_back(nextPar->clone()); @@ -5289,12 +5696,20 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( cache.m_parametersAtBoundary.resetBoundaryInformation(); return ManagedTrackParmPtr(); } else { // the MEOT will be saved at the end - ATH_MSG_VERBOSE( - " Update energy loss:" << nextPar->momentum().mag() - pIn << "at position:" << nextPar->position()); + ATH_MSG_VERBOSE(" Update energy loss:" + << nextPar->momentum().mag() - pIn + << "at position:" << nextPar->position()); } } if (cache.m_matstates) { - addMaterialEffectsOnTrack(cache,*m_stepPropagator, nextPar.index(), *nextLayer, *cache.m_currentStatic, dir, particle); + addMaterialEffectsOnTrack(ctx, + cache, + *m_stepPropagator, + nextPar.index(), + *nextLayer, + *cache.m_currentStatic, + dir, + particle); } if (m_cacheLastMatLayer) { cache.m_lastMaterialLayer = nextLayer; @@ -5303,8 +5718,8 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( if (!cache.m_robustSampling) { if (cache.m_navigLays[index].first && cache.m_navigLays[index].first->confinedLayers()) { - const Trk::Layer *newLayer = nextLayer->nextLayer(nextPar->position(), - dir * nextPar->momentum().normalized()); + const Trk::Layer* newLayer = nextLayer->nextLayer( + nextPar->position(), dir * nextPar->momentum().normalized()); if (newLayer && newLayer != nextLayer) { bool found = false; int replace = -1; @@ -5323,15 +5738,23 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( cache.m_navigSurfs[solutions[iSol] + replace - index].first = &(newLayer->surfaceRepresentation()); } else { // can't insert a surface in middle - return extrapolateToVolumeWithPathLimit(cache,nextPar.index(), pathLim, dir, particle, destVol, matupmod); + return extrapolateToVolumeWithPathLimit(ctx, + cache, + nextPar.index(), + pathLim, + dir, + particle, + destVol, + matupmod); } } } } } currPar = nextPar; - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size()) { // dense volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size(); std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator dIter = cache.m_denseVols.begin(); @@ -5365,9 +5788,10 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( ATH_MSG_DEBUG(" [+] Next dense volume: '" << cache.m_currentDense->volumeName() << "'."); } } - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size() - + cache.m_navigBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size() + + cache.m_navigBoundaries.size()) { // navig volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size() - cache.m_denseBoundaries.size(); @@ -5393,13 +5817,22 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( // return only if detached volume boundaries not collected // if ( nextVol || !detachedBoundariesIncluded ) if (nextVol) { - return extrapolateToVolumeWithPathLimit(cache,nextPar.index(), pathLim, dir, particle, destVol, matupmod); + return extrapolateToVolumeWithPathLimit(ctx, + cache, + nextPar.index(), + pathLim, + dir, + particle, + destVol, + matupmod); } currPar = nextPar; } - } - else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + cache.m_layers.size() + cache.m_denseBoundaries.size() - + cache.m_navigBoundaries.size() + cache.m_detachedBoundaries.size()) { + } else if (solutions[iSol] < iDest + cache.m_staticBoundaries.size() + + cache.m_layers.size() + + cache.m_denseBoundaries.size() + + cache.m_navigBoundaries.size() + + cache.m_detachedBoundaries.size()) { // detached volume boundary unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size() - cache.m_denseBoundaries.size() - cache.m_navigBoundaries.size(); @@ -5426,7 +5859,14 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit( } // if ( nextVol || !detachedBoundariesIncluded) if (nextVol) { - return extrapolateToVolumeWithPathLimit(cache,nextPar.index(), pathLim, dir, particle, destVol, matupmod); + return extrapolateToVolumeWithPathLimit(ctx, + cache, + nextPar.index(), + pathLim, + dir, + particle, + destVol, + matupmod); } currPar = nextPar; // cannot move both currPar and nextPar are used and may be different. } diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Navigator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Navigator.cxx index 68fd8fa6de673a2acf1f6645c10f411f8307ba65..e44d71848a99aaa59a87b8a99d88df533af8e1d5 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/Navigator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/Navigator.cxx @@ -120,32 +120,35 @@ Trk::Navigator::highestVolume() const { return(m_trackingGeometry->highestTrackingVolume()); } -const Trk::BoundarySurface<Trk::TrackingVolume> * -Trk::Navigator::nextBoundarySurface(const Trk::IPropagator &prop, - const Trk::TrackParameters &parms, - Trk::PropDirection dir) const { - const Trk::TrackingVolume *trackingVolume = volume(parms.position()); +const Trk::BoundarySurface<Trk::TrackingVolume>* +Trk::Navigator::nextBoundarySurface(const EventContext& ctx, + const Trk::IPropagator& prop, + const Trk::TrackParameters& parms, + Trk::PropDirection dir) const +{ + const Trk::TrackingVolume* trackingVolume = volume(parms.position()); if (trackingVolume) { - return(nextBoundarySurface(prop, parms, dir, *trackingVolume)); + return (nextBoundarySurface(ctx,prop, parms, dir, *trackingVolume)); } return nullptr; } -const Trk::BoundarySurface<Trk::TrackingVolume> * -Trk::Navigator::nextBoundarySurface(const Trk::IPropagator &prop, - const Trk::TrackParameters &parms, +const Trk::BoundarySurface<Trk::TrackingVolume>* +Trk::Navigator::nextBoundarySurface(const EventContext& ctx, + const Trk::IPropagator& prop, + const Trk::TrackParameters& parms, Trk::PropDirection dir, - const Trk::TrackingVolume &vol) const { + const Trk::TrackingVolume& vol) const +{ if (!m_trackingGeometry) { updateTrackingGeometry(); } - // get the surface accessor - Trk::ObjectAccessor surfAcc = - vol.boundarySurfaceAccessor(parms.position(), dir * parms.momentum().normalized()); + Trk::ObjectAccessor surfAcc = vol.boundarySurfaceAccessor( + parms.position(), dir * parms.momentum().normalized()); // initialize the currentBoundary surface - const Trk::BoundarySurface<Trk::TrackingVolume> *currentBoundary = nullptr; + const Trk::BoundarySurface<Trk::TrackingVolume>* currentBoundary = nullptr; bool outsideVolume = surfAcc.inverseRetrieval(); // attempt counter int tryBoundary = 0; @@ -153,36 +156,38 @@ Trk::Navigator::nextBoundarySurface(const Trk::IPropagator &prop, // set the prop direction according to inverseRetrieval result Trk::PropDirection searchDir = dir; if (outsideVolume) { - searchDir = (dir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; + searchDir = + (dir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; } // debug version ATH_MSG_VERBOSE("g [N] Starting parameters are :" << parms); // loop over the the boundary surfaces according to the accessor type - for (const Trk::ObjectAccessor::value_type &surface_id : surfAcc) { + for (const Trk::ObjectAccessor::value_type& surface_id : surfAcc) { ++tryBoundary; // ----------------- output to screen if outputLevel() says so -------- - ATH_MSG_VERBOSE(" [N] " << tryBoundary << ". try - BoundarySurface " << surface_id - << " of Volume: '" << vol.volumeName() << "'."); + ATH_MSG_VERBOSE(" [N] " << tryBoundary << ". try - BoundarySurface " + << surface_id << " of Volume: '" + << vol.volumeName() << "'."); // get the boundary Surface according to the surfaceAccessor currentBoundary = vol.boundarySurface(surface_id); - const Trk::Surface ¤tSurface = currentBoundary->surfaceRepresentation(); - - const Trk::TrackParameters *trackPar = nullptr; - // do either RungeKutta (always after first unsuccessful try) or straight line - trackPar = (!m_useStraightLineApproximation || tryBoundary > 1) ? - prop.propagateParameters(parms, - currentSurface, - searchDir, true, - m_fieldProperties) : - prop.propagateParameters(parms, - currentSurface, - searchDir, true, - s_zeroMagneticField); + const Trk::Surface& currentSurface = + currentBoundary->surfaceRepresentation(); + + const Trk::TrackParameters* trackPar = nullptr; + // do either RungeKutta (always after first unsuccessful try) or straight + // line + trackPar = + (!m_useStraightLineApproximation || tryBoundary > 1) + ? prop.propagateParameters( + ctx, parms, currentSurface, searchDir, true, m_fieldProperties) + : prop.propagateParameters( + ctx, parms, currentSurface, searchDir, true, s_zeroMagneticField); if (trackPar) { - ATH_MSG_VERBOSE(" [N] --> next BoundarySurface found with Parameters: " << *trackPar); + ATH_MSG_VERBOSE( + " [N] --> next BoundarySurface found with Parameters: " << *trackPar); validationFill(trackPar); delete trackPar; return currentBoundary; @@ -199,10 +204,12 @@ Trk::Navigator::nextBoundarySurface(const Trk::IPropagator &prop, } Trk::NavigationCell -Trk::Navigator::nextTrackingVolume(const Trk::IPropagator &prop, - const Trk::TrackParameters &parms, +Trk::Navigator::nextTrackingVolume(const EventContext& ctx, + const Trk::IPropagator& prop, + const Trk::TrackParameters& parms, Trk::PropDirection dir, - const Trk::TrackingVolume &vol) const { + const Trk::TrackingVolume& vol) const +{ if (!m_trackingGeometry) { updateTrackingGeometry(); } @@ -219,106 +226,114 @@ Trk::Navigator::nextTrackingVolume(const Trk::IPropagator &prop, // --------------------------------------------------- // get the object accessor from the Volume - Trk::ObjectAccessor surfAcc = - vol.boundarySurfaceAccessor(parms.position(), dir * parms.momentum().normalized()); + Trk::ObjectAccessor surfAcc = vol.boundarySurfaceAccessor( + parms.position(), dir * parms.momentum().normalized()); // the object accessor already solved the outside question bool outsideVolume = surfAcc.inverseRetrieval(); // initialize the boundary pointer / tracking volume pointer - const Trk::BoundarySurface<Trk::TrackingVolume> *currentBoundary = nullptr; - const Trk::TrackingVolume *nextVolume = nullptr; + const Trk::BoundarySurface<Trk::TrackingVolume>* currentBoundary = nullptr; + const Trk::TrackingVolume* nextVolume = nullptr; // debug version ATH_MSG_VERBOSE(" [N] Starting parameters are : " << parms); - ATH_MSG_VERBOSE( - " [N] This corresponds to [r,z] = [ " << parms.position().perp() << ", " << parms.position().z() << "]"); + ATH_MSG_VERBOSE(" [N] This corresponds to [r,z] = [ " + << parms.position().perp() << ", " << parms.position().z() + << "]"); ATH_MSG_VERBOSE(" [N] Boundary Surface accessor : " << surfAcc); // set the prop direction according to inverseRetrieval result Trk::PropDirection searchDir = dir; if (outsideVolume) { ATH_MSG_VERBOSE(" [N] Parameters have been flagged as being outside !"); - searchDir = (dir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; + searchDir = + (dir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; } // loop over boundary surfaces int tryBoundary = 0; - /* local counted to increment in the loop*/ - auto forwardFirstBoundSwitch=m_forwardFirstBoundSwitch.buffer(); - auto forwardSecondBoundSwitch=m_forwardSecondBoundSwitch.buffer(); - auto forwardThirdBoundSwitch=m_forwardThirdBoundSwitch.buffer(); - auto backwardFirstBoundSwitch=m_backwardFirstBoundSwitch.buffer(); - auto backwardSecondBoundSwitch=m_backwardSecondBoundSwitch.buffer(); - auto backwardThirdBoundSwitch=m_backwardThirdBoundSwitch.buffer(); + /* local counted to increment in the loop*/ + auto forwardFirstBoundSwitch = m_forwardFirstBoundSwitch.buffer(); + auto forwardSecondBoundSwitch = m_forwardSecondBoundSwitch.buffer(); + auto forwardThirdBoundSwitch = m_forwardThirdBoundSwitch.buffer(); + auto backwardFirstBoundSwitch = m_backwardFirstBoundSwitch.buffer(); + auto backwardSecondBoundSwitch = m_backwardSecondBoundSwitch.buffer(); + auto backwardThirdBoundSwitch = m_backwardThirdBoundSwitch.buffer(); - for (const Trk::ObjectAccessor::value_type &surface_id : surfAcc) { + for (const Trk::ObjectAccessor::value_type& surface_id : surfAcc) { ++tryBoundary; // get the boundary surface associated to the surfaceAccessor currentBoundary = vol.boundarySurface(surface_id); // ----------------- output to screen if outputLevel() says so -------- if (!currentBoundary) { - ATH_MSG_WARNING(" [N] " << tryBoundary << ". try - BoundarySurface " << surface_id - << " of Volume: '" << vol.volumeName() << "' NOT FOUND."); + ATH_MSG_WARNING(" [N] " << tryBoundary << ". try - BoundarySurface " + << surface_id << " of Volume: '" + << vol.volumeName() << "' NOT FOUND."); continue; } else { - ATH_MSG_VERBOSE(" [N] " << tryBoundary << ". try - BoundarySurface " << surface_id - << " of Volume: '" << vol.volumeName() << "'."); + ATH_MSG_VERBOSE(" [N] " << tryBoundary << ". try - BoundarySurface " + << surface_id << " of Volume: '" + << vol.volumeName() << "'."); } - const Trk::Surface ¤tSurface = currentBoundary->surfaceRepresentation(); + const Trk::Surface& currentSurface = + currentBoundary->surfaceRepresentation(); // try the propagation - const Trk::TrackParameters *trackPar = nullptr; - // do either RungeKutta (always after first unsuccessful try) or straight line + const Trk::TrackParameters* trackPar = nullptr; + // do either RungeKutta (always after first unsuccessful try) or straight + // line if (!currentSurface.isOnSurface(parms.position(), true, 0., 0.)) { - trackPar = (!m_useStraightLineApproximation || tryBoundary > 1) ? - prop.propagateParameters(parms, - currentSurface, - searchDir, true, - m_fieldProperties) : - prop.propagateParameters(parms, - currentSurface, - searchDir, true, - s_zeroMagneticField); + trackPar = + (!m_useStraightLineApproximation || tryBoundary > 1) + ? prop.propagateParameters( + ctx, parms, currentSurface, searchDir, true, m_fieldProperties) + : prop.propagateParameters( + ctx, parms, currentSurface, searchDir, true, s_zeroMagneticField); } else { trackPar = parms.clone(); } if (trackPar) { // the next volume pointer - nextVolume = currentBoundary->attachedVolume(trackPar->position(), trackPar->momentum().normalized(), dir); + nextVolume = currentBoundary->attachedVolume( + trackPar->position(), trackPar->momentum().normalized(), dir); // ----------------- output to screen if outputLevel() says so -------- if (msgLvl(MSG::VERBOSE)) { - ATH_MSG_VERBOSE(" [N] --> next BoundarySurface found with Parameters: " << *trackPar); - ATH_MSG_VERBOSE( - " [N] This corresponds to [r,z] = [ " << trackPar->position().perp() << ", " << trackPar->position().z() << - "]"); + ATH_MSG_VERBOSE(" [N] --> next BoundarySurface found with Parameters: " + << *trackPar); + ATH_MSG_VERBOSE(" [N] This corresponds to [r,z] = [ " + << trackPar->position().perp() << ", " + << trackPar->position().z() << "]"); // log of the boundary surface currentBoundary->debugInfo(msg(MSG::VERBOSE)); - ATH_MSG_VERBOSE(" [N] --> Quering the BoundarySurface for the associated TrackingVolume: "); - ATH_MSG_VERBOSE('\t' << '\t' << (nextVolume ? nextVolume->volumeName() : "None")); + ATH_MSG_VERBOSE("[N] --> Quering the BoundarySurface for the " + "associated TrackingVolume: "); + ATH_MSG_VERBOSE( + '\t' << '\t' << (nextVolume ? nextVolume->volumeName() : "None")); } validationFill(trackPar); - return Trk::NavigationCell(nextVolume, trackPar, Trk::BoundarySurfaceFace(surface_id)); + return Trk::NavigationCell( + nextVolume, trackPar, Trk::BoundarySurfaceFace(surface_id)); } // --------------------------------------------------- if (!first && searchDir == Trk::alongMomentum) { ++forwardFirstBoundSwitch; first = true; - }else if (!second && searchDir == Trk::alongMomentum) { + } else if (!second && searchDir == Trk::alongMomentum) { ++forwardSecondBoundSwitch; second = true; - }else if (searchDir == Trk::alongMomentum) { + } else if (searchDir == Trk::alongMomentum) { ++forwardThirdBoundSwitch; - }else if (!first && searchDir == Trk::oppositeMomentum) { + } else if (!first && searchDir == Trk::oppositeMomentum) { ++backwardFirstBoundSwitch; first = true; - }else if (!second && searchDir == Trk::oppositeMomentum) { + } else if (!second && searchDir == Trk::oppositeMomentum) { ++backwardSecondBoundSwitch; second = true; - }else if (searchDir == Trk::oppositeMomentum) { + } else if (searchDir == Trk::oppositeMomentum) { ++backwardThirdBoundSwitch; } // --------------------------------------------------- @@ -329,6 +344,7 @@ Trk::Navigator::nextTrackingVolume(const Trk::IPropagator &prop, Trk::NavigationCell Trk::Navigator::nextDenseTrackingVolume( + const EventContext& ctx, const Trk::IPropagator &prop, const Trk::TrackParameters &parms, const Trk::Surface *destinationSurface, @@ -336,8 +352,8 @@ Trk::Navigator::nextDenseTrackingVolume( Trk::ParticleHypothesis particle, const Trk::TrackingVolume &vol, double &path) const { - ATH_MSG_DEBUG( - " [N] nextDenseTrackingVolume() to volume '" << vol.volumeName() << "', starting from " << parms.position()); + ATH_MSG_DEBUG(" [N] nextDenseTrackingVolume() to volume '" + << vol.volumeName() << "', starting from " << parms.position()); if (!m_trackingGeometry) { updateTrackingGeometry(); @@ -379,8 +395,17 @@ Trk::Navigator::nextDenseTrackingVolume( // propagate std::vector<unsigned int> solutions; // const Trk::TrackParameters* nextPar = prop.propagate(parms,*surfaces,dir,vol,particle,solutions,path); - const Trk::TrackParameters *nextPar = prop.propagate(parms, *surfaces, dir, m_fieldProperties, particle, solutions, - path, false, false, &vol); + const Trk::TrackParameters* nextPar = prop.propagate(ctx, + parms, + *surfaces, + dir, + m_fieldProperties, + particle, + solutions, + path, + false, + false, + &vol); // if (nextPar) throwIntoGarbageBin(nextPar); if (nextPar) { Amg::Vector3D gp = nextPar->position(); @@ -404,8 +429,12 @@ Trk::Navigator::nextDenseTrackingVolume( } bool -Trk::Navigator::atVolumeBoundary(const Trk::TrackParameters *parms, const Trk::TrackingVolume *vol, - Trk::PropDirection dir, const Trk::TrackingVolume * &nextVol, double tol) const { +Trk::Navigator::atVolumeBoundary(const Trk::TrackParameters* parms, + const Trk::TrackingVolume* vol, + Trk::PropDirection dir, + const Trk::TrackingVolume*& nextVol, + double tol) const +{ bool isAtBoundary = false; nextVol = nullptr; @@ -448,10 +477,11 @@ Trk::Navigator::atVolumeBoundary(const Trk::TrackParameters *parms, const Trk::T return isAtBoundary; } -const Trk::TrackParameters * -Trk::Navigator::closestParameters(const Trk::Track &trk, - const Trk::Surface &sf, - const Trk::IPropagator *propptr) const { +const Trk::TrackParameters* +Trk::Navigator::closestParameters(const Trk::Track& trk, + const Trk::Surface& sf, + const Trk::IPropagator* propptr) const +{ if (!m_trackingGeometry) { updateTrackingGeometry(); } diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/TrkExToolsStringUtility.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/TrkExToolsStringUtility.cxx index 90055246367464a13dcfd7ec6f72891630921f96..2ae580d44f96ac5fc496dddf939e9b7b8e15ae0c 100644 --- a/Tracking/TrkExtrapolation/TrkExTools/src/TrkExToolsStringUtility.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/TrkExToolsStringUtility.cxx @@ -12,7 +12,7 @@ namespace TrkExTools{ std::string getToolSuffix(const std::string& fullToolName){ - return fullToolName.substr(fullToolName.find_last_of(".") + 1); + return fullToolName.substr(fullToolName.find_last_of('.') + 1); } std::vector<std::string> diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ElossInputBase.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ElossInputBase.h deleted file mode 100755 index 03e21904471dd6c73f40f19c151f4e63d29f052c..0000000000000000000000000000000000000000 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ElossInputBase.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// ElossInputBase.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef TRKEXUTILS_ELOSSINPUTBASE_H -#define TRKEXUTILS_ELOSSINPUTBASE_H - -class MsgStream; - -namespace Trk { - - /** @class ElossInputBase - - Abstract class meant to provide common base for all possible - inputs that we may want to give as an input to an IEnergyLossCalculator - for calculating energy losses - - @author David.Lopez@cern.ch - */ - class ElossInputBase { - - public: - /**Constructor */ - ElossInputBase() {} - /** Destructor */ - virtual ~ElossInputBase() {} - - /** Common dump method */ - virtual MsgStream& dump( MsgStream& out ) const = 0; - - }; - -} // end of namespace - -#endif // TRKEXUTILS_ELOSSINPUTBASE_H - diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.h index 3b3c7120ad8bf5f448852f43861b20d1f9649571..4f6c811cbf8ca6f550eae62ee4fbc9ab316c63f1 100644 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.h +++ b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,8 +9,12 @@ #ifndef TRKEXUTILS_EXTRAPOLATIONCACHE_H #define TRKEXUTILS_EXTRAPOLATIONCACHE_H -/** Cache for the extrapolator to keep track of the total X0 traversed - and the total extended energy loss (Eloss (error) ,Ionization (error), Radiation (error)) */ +/** + * Cache for the extrapolator to keep track of the total X0 traversed + and the total extended energy loss (Eloss (error) ,Ionization (error), + Radiation (error)) + +*/ #include "TrkMaterialOnTrack/EnergyLoss.h" @@ -24,15 +28,18 @@ public: // // Constructor // - ExtrapolationCache(); + ExtrapolationCache()=default; + ExtrapolationCache(const ExtrapolationCache& other) = default; + ExtrapolationCache(ExtrapolationCache&& other) = default; + ExtrapolationCache& operator=(const ExtrapolationCache& other)=default; + ExtrapolationCache& operator=(ExtrapolationCache&& other) = default; + ExtrapolationCache(double x0tot); ExtrapolationCache(double x0tot, EnergyLoss* eloss); - - //! Copy constructor - ExtrapolationCache(const ExtrapolationCache& cache); + ~ExtrapolationCache() = default; + //! Destructor - virtual ~ExtrapolationCache() = default; - virtual ExtrapolationCache* clone() const; + ExtrapolationCache* clone() const; // total X0 @@ -48,28 +55,10 @@ public: private: double m_x0tot; - EnergyLoss* m_eloss; - -}; - -inline ExtrapolationCache* ExtrapolationCache::clone() const -{ return new ExtrapolationCache(*this); } - + EnergyLoss* m_eloss;//We do not own this ptr -inline double ExtrapolationCache::x0tot() const -{ return m_x0tot; } -inline const EnergyLoss* ExtrapolationCache::eloss() const -{ return m_eloss; } - -inline void ExtrapolationCache::reset() -{ m_x0tot = 0.; m_eloss->update(-m_eloss->meanIoni(),-m_eloss->sigmaIoni(),-m_eloss->meanRad(),-m_eloss->sigmaRad(),false); } - -inline void ExtrapolationCache::updateX0(double x0) -{ m_x0tot += x0; } - -inline void ExtrapolationCache::updateEloss(double ioni, double sigi, double rad, double sigr) -{ m_eloss->update(ioni,sigi,rad,sigr,false); } +}; } - +#include "TrkExUtils/ExtrapolationCache.icc" #endif diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.icc b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.icc new file mode 100644 index 0000000000000000000000000000000000000000..9738f4dbb384c12ec7d79350a4aa4a94482326db --- /dev/null +++ b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCache.icc @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +namespace Trk { +inline ExtrapolationCache::ExtrapolationCache(double x0tot) + : m_x0tot(x0tot) + , m_eloss(nullptr) +{} + +inline ExtrapolationCache::ExtrapolationCache(double x0tot, EnergyLoss* eloss) + : m_x0tot(x0tot) + , m_eloss(eloss) +{} + +inline ExtrapolationCache* +ExtrapolationCache::clone() const +{ + return new ExtrapolationCache(*this); +} + +inline double +ExtrapolationCache::x0tot() const +{ + return m_x0tot; +} + +inline const EnergyLoss* +ExtrapolationCache::eloss() const +{ + return m_eloss; +} + +inline void +ExtrapolationCache::reset() +{ + m_x0tot = 0.; + m_eloss->update(-m_eloss->meanIoni(), + -m_eloss->sigmaIoni(), + -m_eloss->meanRad(), + -m_eloss->sigmaRad(), + false); +} + +inline void +ExtrapolationCache::updateX0(double x0) +{ + m_x0tot += x0; +} + +inline void +ExtrapolationCache::updateEloss(double ioni, + double sigi, + double rad, + double sigr) +{ + m_eloss->update(ioni, sigi, rad, sigr, false); +} + +} diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCell.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCell.h index 7fb3a03d09f36b2149344aaa8ef834ef4e162651..c7981ecb04228e8b264a1378d4ce1ddaae3bd049 100644 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCell.h +++ b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/ExtrapolationCell.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ #ifndef TRKEXUTILS_CHECKPATHMACRO #define TRKEXUTILS_CHECKPATHMACRO -#define reachedLimit(current, limit, tolerance) ( limit > 0 && ((current<limit) ? (current-limit)*(current-limit)/(limit*limit) < tolerance*tolerance : true)) +#define reachedLimit(current, limit, tolerance) ( (limit) > 0 && (((current)<(limit)) ? ((current)-(limit))*((current)-(limit))/((limit)*(limit)) < (tolerance)*(tolerance) : true)) #endif namespace Trk { @@ -177,14 +177,14 @@ namespace Trk { float time; //!< timing info ExtrapolationStep(const T* pars = 0, - const Surface* sf = 0, - ExtrapolationConfig eConfig = ExtrapolationConfig(), - const MaterialProperties* mprop=0, - const TransportJacobian* tjac=0, + const Surface* sf = nullptr, + const ExtrapolationConfig& eConfig = ExtrapolationConfig(), + const MaterialProperties* mprop=nullptr, + const TransportJacobian* tjac=nullptr, double pLength = -1.) : parameters(pars), surface(sf), - layer(0), + layer(nullptr), stepConfiguration(eConfig), material(mprop), materialPosition(Amg::Vector3D(0.,0.,0.)), @@ -260,18 +260,18 @@ namespace Trk { /** start parameters are compulsory */ ExtrapolationCell(const T& sParameters, PropDirection pDir=alongMomentum, unsigned int econfig=1) : startParameters(&sParameters), - startVolume(0), - startLayer(0), + startVolume(nullptr), + startLayer(nullptr), endParameters(0), - endVolume(0), - endLayer(0), - endSurface(0), + endVolume(nullptr), + endLayer(nullptr), + endSurface(nullptr), leadParameters(&sParameters), - leadVolume(0), - leadLayer(0), - leadLayerSurface(0), + leadVolume(nullptr), + leadLayer(nullptr), + leadLayerSurface(nullptr), lastBoundaryParameters(0), - lastBoundarySurface(0), + lastBoundarySurface(nullptr), lastLeadParameters(&sParameters), propDirection(pDir), radialDirection(1), @@ -291,7 +291,7 @@ namespace Trk { sensitiveCurvilinear(false), destinationCurvilinear(false), extrapolationConfiguration(econfig), - eLoss(0), + eLoss(nullptr), zOaTrX(0.), zX(0.) {} @@ -316,7 +316,7 @@ namespace Trk { /** fill transport information - path length and TransportJacobian - jacobians need to be cleared */ - void stepTransport(const Surface& sf, double pathLength=0., const TransportJacobian* tjac=0); + void stepTransport(const Surface& sf, double pathLength=0., const TransportJacobian* tjac=nullptr); /** fill or attach material, jacobian, step length - material is just a pointer copy */ @@ -557,5 +557,5 @@ namespace Trk { } // end of namespace -#endif // TRKEXUTILS_SOLUTIONSELECTOR_H +#endif // TRKEXUTILS_EXTRAPOLATIONCELL_H diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RealLinearEquation.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RealLinearEquation.h index fab16d9e53ba5eee129b06ab3b5d50716f76d121..a7c8c1dcbdd77043ca1866a178d8d5d8254f1e6a 100755 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RealLinearEquation.h +++ b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RealLinearEquation.h @@ -1,48 +1,49 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// RealLinearEquation.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef TRKEXUTILS_REALLINEAREQUATION_H -#define TRKEXUTILS_REALLINEAREQUATION_H - -#include <utility> -#include <cmath> - -namespace Trk { - - /** @struct RealLinearEquation - Mathematic struct for solving real linear equation - - <b>Mathematical motivation</b>:<br> - - - 2D: The equation is given by:<br> - @f$ y(x') = k \cdot x' + d @f$ - - The constructor is called from a point @f$ p=(p_x,p_y) @f$ that fullfills - the equation, an incline @f$ k @f$ and a parameter @f$ x' @f$. - - @author Andreas.Salzburger@cern.ch - */ - - struct RealLinearEquation { - - double yOfX; //!< the result of x - double segLength; //!< length of the line segment - - RealLinearEquation(double px, double py, double k, double xprime) { - double deltax = xprime-px; - yOfX = py + k*(deltax); - double deltay = yOfX-py; - segLength = sqrt(deltax*deltax+deltay*deltay); - } - - }; - -} // end of namespace - -#endif - +/////////////////////////////////////////////////////////////////// +// RealLinearEquation.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef TRKEXUTILS_REALLINEAREQUATION_H +#define TRKEXUTILS_REALLINEAREQUATION_H + +#include <utility> +#include <cmath> + +namespace Trk { + + /** @struct RealLinearEquation + Mathematic struct for solving real linear equation + + <b>Mathematical motivation</b>:<br> + + - 2D: The equation is given by:<br> + @f$ y(x') = k \cdot x' + d @f$ + + The constructor is called from a point @f$ p=(p_x,p_y) @f$ that fullfills + the equation, an incline @f$ k @f$ and a parameter @f$ x' @f$. + + @author Andreas.Salzburger@cern.ch + */ + +struct RealLinearEquation +{ + + double yOfX; //!< the result of x + double segLength; //!< length of the line segment + + RealLinearEquation(double px, double py, double k, double xprime) + { + double deltax = xprime - px; + yOfX = py + k * (deltax); + double deltay = yOfX - py; + segLength = sqrt(deltax * deltax + deltay * deltay); + } +}; + +} // end of namespace + +#endif + diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RungeKuttaUtils.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RungeKuttaUtils.h index 6c33ea0621ec4bf4f664a95db7922a74f13f6997..940308372258988781e918551f2f794bee06a5e5 100755 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RungeKuttaUtils.h +++ b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/RungeKuttaUtils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -132,16 +132,6 @@ namespace RungeKuttaUtils bool transformLocalToGlobal(bool, const Trk::PatternTrackParameters&, double*); - ///////////////////////////////////////////////////////////////////////////////// - // Transformations from local to global system coordinates - // for different surfaces - ///////////////////////////////////////////////////////////////////////////////// - - void transformDiscToGlobal(bool, const Trk::Surface*, const double* ATH_RESTRICT, double* ATH_RESTRICT); - void transformPlaneToGlobal(bool, const Trk::Surface*, const double* ATH_RESTRICT, double* ATH_RESTRICT); - void transformCylinderToGlobal(bool, const Trk::Surface*, const double* ATH_RESTRICT, double* ATH_RESTRICT); - void transformLineToGlobal(bool, const Trk::Surface*, const double* ATH_RESTRICT, double* ATH_RESTRICT); - ///////////////////////////////////////////////////////////////////////////////// // Transformations from global to local system coordinates ///////////////////////////////////////////////////////////////////////////////// @@ -152,32 +142,6 @@ namespace RungeKuttaUtils double* ATH_RESTRICT, double* ATH_RESTRICT, double* ATH_RESTRICT); - void transformGlobalToCone(const Trk::Surface*, - bool, - const double* ATH_RESTRICT, - double* ATH_RESTRICT, - double* ATH_RESTRICT); - void transformGlobalToDisc(const Trk::Surface*, - bool, - double* ATH_RESTRICT, - double* ATH_RESTRICT, - double* ATH_RESTRICT); - void transformGlobalToPlane(const Trk::Surface*, - bool, - double* ATH_RESTRICT, - double* ATH_RESTRICT, - double* ATH_RESTRICT); - void transformGlobalToCylinder(const Trk::Surface*, - bool, - double* ATH_RESTRICT, - double* ATH_RESTRICT, - double* ATH_RESTRICT); - void transformGlobalToLine(const Trk::Surface*, - bool, - double* ATH_RESTRICT, - double* ATH_RESTRICT, - double* ATH_RESTRICT); - ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/SolutionSelector.h b/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/SolutionSelector.h deleted file mode 100755 index 42ee8ff79076b80498a5781cf91a0d5a1cb84c89..0000000000000000000000000000000000000000 --- a/Tracking/TrkExtrapolation/TrkExUtils/TrkExUtils/SolutionSelector.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// SolutionSelector.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef TRKEXUTILS_SOLUTIONSELECTOR_H -#define TRKEXUTILS_SOLUTIONSELECTOR_H - -#include "TrkEventPrimitives/PropDirection.h" - -namespace Trk { - - enum SelectedSolution { first=0, second=1, none=2 }; - - /** @class SolutionSelector - - Given a PropDirection and two pathlengths it will chose the solution - - @author Andreas.Salzburger@cern.ch - */ - class SolutionSelector { - public: - /**Constructor */ - SolutionSelector(); - /** Destructor */ - virtual ~SolutionSelector(); - - /** Seclect method */ - SelectedSolution select(Trk::PropDirection dir, double pl1, double pl2); - - }; - -} // end of namespace - -#endif // TRKEXUTILS_SOLUTIONSELECTOR_H - diff --git a/Tracking/TrkExtrapolation/TrkExUtils/src/ExtrapolationCache.cxx b/Tracking/TrkExtrapolation/TrkExUtils/src/ExtrapolationCache.cxx deleted file mode 100644 index 4687997b2ab341e24b7e9927856a592ec59488c3..0000000000000000000000000000000000000000 --- a/Tracking/TrkExtrapolation/TrkExUtils/src/ExtrapolationCache.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// ExtrapolationCache.cxx -/////////////////////////////////////////////////////////////////// - -#include "TrkExUtils/ExtrapolationCache.h" -#include "TrkMaterialOnTrack/EnergyLoss.h" - - -Trk::ExtrapolationCache::ExtrapolationCache() : - m_x0tot(0), m_eloss(nullptr) { } - -Trk::ExtrapolationCache::ExtrapolationCache(double x0tot) : - m_x0tot(x0tot), m_eloss(nullptr) { } - -Trk::ExtrapolationCache::ExtrapolationCache(double x0tot, EnergyLoss* eloss): - m_x0tot(x0tot), - m_eloss(eloss) { } - -Trk::ExtrapolationCache::ExtrapolationCache(const Trk::ExtrapolationCache& cache) - = default; - - diff --git a/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx b/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx index 3f65f1a2b4a7d40a5e076099913367eb63563648..dd9aab60994f91836694ac22adab578932007ffb 100755 --- a/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx +++ b/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -20,102 +20,19 @@ #include "CxxUtils/vectorize.h" ATH_ENABLE_VECTORIZATION; -///////////////////////////////////////////////////////////////////////////////// -// Common transformation from local to global system coordinates for all surfaces -// for charged track parameters -///////////////////////////////////////////////////////////////////////////////// - -bool Trk::RungeKuttaUtils::transformLocalToGlobal -(bool useJac,const Trk::TrackParameters& Tp,double* P) -{ - const Trk::TrackParameters* pTp = &Tp; if(!pTp) return false; - - const AmgVector(5) Vp = Tp.parameters(); - double p[5] = {Vp[0],Vp[1],Vp[2],Vp[3],Vp[4]}; - - return transformLocalToGlobal(useJac,&Tp.associatedSurface(),p,P); -} - -///////////////////////////////////////////////////////////////////////////////// -// Common transformation from local to global system coordinates for all surfaces -// for neutral track parameters -///////////////////////////////////////////////////////////////////////////////// - -bool Trk::RungeKuttaUtils::transformLocalToGlobal -(bool useJac,const Trk::NeutralParameters& Tp,double* P) -{ - const Trk::NeutralParameters* pTp = &Tp; if(!pTp) return false; - - const AmgVector(5) Vp = Tp.parameters(); - double p[5] = {Vp[0],Vp[1],Vp[2],Vp[3],Vp[4]}; - - return transformLocalToGlobal(useJac,&Tp.associatedSurface(),p,P); -} - -///////////////////////////////////////////////////////////////////////////////// -// Common transformation from local to global system coordinates for all surfaces -// for pattern parameters -///////////////////////////////////////////////////////////////////////////////// - -bool Trk::RungeKuttaUtils::transformLocalToGlobal -(bool useJac,const Trk::PatternTrackParameters& Tp,double* P) -{ - return transformLocalToGlobal(useJac,Tp.associatedSurface(),Tp.par(),P); -} - -///////////////////////////////////////////////////////////////////////////////// -// Common transformation from global to local system coordinates for all surfaces -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformGlobalToLocal -(double*ATH_RESTRICT P,double*ATH_RESTRICT par) -{ - par[2] = atan2(P[4],P[3]); - par[3] = acos (P[5]); - par[4] = P[6]; -} - -void Trk::RungeKuttaUtils::transformGlobalToLocal -(const Trk::Surface* su,bool useJac, double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) -{ - par[2] = atan2(P[4],P[3]); - par[3] = acos (P[5]); - par[4] = P[6]; - - const unsigned int ty = su->type(); - - if (ty == Trk::Surface::Plane ) transformGlobalToPlane (su,useJac,P,par,Jac); - else if(ty == Trk::Surface::Line ) transformGlobalToLine (su,useJac,P,par,Jac); - else if(ty == Trk::Surface::Cylinder) transformGlobalToCylinder(su,useJac,P,par,Jac); - else if(ty == Trk::Surface::Perigee ) transformGlobalToLine (su,useJac,P,par,Jac); - else if(ty == Trk::Surface::Disc ) transformGlobalToDisc (su,useJac,P,par,Jac); - else transformGlobalToCone (su,useJac,P,par,Jac); - if(!useJac) return; - - double P3,P4, C = P[3]*P[3]+P[4]*P[4]; - if(C > 1.e-20) {C= 1./C ; P3 = P[3]*C; P4 =P[4]*C; C =-sqrt(C);} - else {C=-1.e10; P3 = 1. ; P4 =0. ; } - - Jac[10] = P3*P[11]-P4*P[10]; // dPhi/dL0 - Jac[11] = P3*P[18]-P4*P[17]; // dPhi/dL1 - Jac[12] = P3*P[25]-P4*P[24]; // dPhi/dPhi - Jac[13] = P3*P[32]-P4*P[31]; // dPhi/dThe - Jac[14] = P3*P[39]-P4*P[38]; // dPhi/dCM - Jac[15] = C*P[12]; // dThe/dL0 - Jac[16] = C*P[19]; // dThe/dL1 - Jac[17] = C*P[26]; // dThe/dPhi - Jac[18] = C*P[33]; // dThe/dThe - Jac[19] = C*P[40]; // dThe/dCM - Jac[20] = P [41]; // dCM /dCM -} - -///////////////////////////////////////////////////////////////////////////////// -// Global position transformation to local Plane system coordinate -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformGlobalToPlane -(const Trk::Surface* su,bool useJac,double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +/* + * Hide internal implementation methods to anonymous + * namespace +*/ +namespace{ + +void +transformGlobalToPlane(const Trk::Surface* su, + bool useJac, + double* ATH_RESTRICT P, + double* ATH_RESTRICT par, + double* ATH_RESTRICT Jac) { const Amg::Transform3D& T = su->transform(); @@ -172,8 +89,12 @@ void Trk::RungeKuttaUtils::transformGlobalToPlane // Global position transformation to local Disc system coordinate ///////////////////////////////////////////////////////////////////////////////// -void Trk::RungeKuttaUtils::transformGlobalToDisc -(const Trk::Surface* su,bool useJac,double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +void +transformGlobalToDisc(const Trk::Surface* su, + bool useJac, + double* ATH_RESTRICT P, + double* ATH_RESTRICT par, + double* ATH_RESTRICT Jac) { const Amg::Transform3D& T = su->transform(); @@ -240,9 +161,12 @@ void Trk::RungeKuttaUtils::transformGlobalToDisc ///////////////////////////////////////////////////////////////////////////////// // Global position transformation to local Cylinder system coordinate ///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformGlobalToCylinder -(const Trk::Surface* su,bool useJac,double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +void +transformGlobalToCylinder(const Trk::Surface* su, + bool useJac, + double* ATH_RESTRICT P, + double* ATH_RESTRICT par, + double* ATH_RESTRICT Jac) { const Amg::Transform3D& T = su->transform(); @@ -311,8 +235,12 @@ void Trk::RungeKuttaUtils::transformGlobalToCylinder // Global position transformation to local Straight line system coordinate ///////////////////////////////////////////////////////////////////////////////// -void Trk::RungeKuttaUtils::transformGlobalToLine -(const Trk::Surface* su,bool useJac,double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +void +transformGlobalToLine(const Trk::Surface* su, + bool useJac, + double* ATH_RESTRICT P, + double* ATH_RESTRICT par, + double* ATH_RESTRICT Jac) { const Amg::Transform3D& T = su->transform(); @@ -377,8 +305,12 @@ void Trk::RungeKuttaUtils::transformGlobalToLine // Global position transformation to local Cone system coordinate ///////////////////////////////////////////////////////////////////////////////// -void Trk::RungeKuttaUtils::transformGlobalToCone -(const Trk::Surface* su,bool useJac,const double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +void +transformGlobalToCone(const Trk::Surface* su, + bool useJac, + const double* ATH_RESTRICT P, + double* ATH_RESTRICT par, + double* ATH_RESTRICT Jac) { const Amg::Transform3D& T = su->transform(); @@ -410,6 +342,231 @@ void Trk::RungeKuttaUtils::transformGlobalToCone Jac[ 9] = 0.; // dL1/dCM } +///////////////////////////////////////////////////////////////////////////////// +// Plane local position transformation to global system coordinate +///////////////////////////////////////////////////////////////////////////////// + +void +transformPlaneToGlobal(bool useJac, + const Trk::Surface* Su, + const double* ATH_RESTRICT p, + double* ATH_RESTRICT P) +{ + const Amg::Transform3D& T = Su->transform(); + const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; + const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; + + P[ 0] = p[0]*Ax[0]+p[1]*Ay[0]+T(0,3); // X + P[ 1] = p[0]*Ax[1]+p[1]*Ay[1]+T(1,3); // Y + P[ 2] = p[0]*Ax[2]+p[1]*Ay[2]+T(2,3); // Z + + if(!useJac) return; + + // /dL1 | /dL2 | /dPhi | /dThe | + P[ 7] = Ax[0]; P[14] = Ay[0]; P[21] = 0.; P[28] = 0.; // dX/ + P[ 8] = Ax[1]; P[15] = Ay[1]; P[22] = 0.; P[29] = 0.; // dY/ + P[ 9] = Ax[2]; P[16] = Ay[2]; P[23] = 0.; P[30] = 0.; // dZ/ + +} + + +///////////////////////////////////////////////////////////////////////////////// +// Disc local position transformation to global system coordinate +///////////////////////////////////////////////////////////////////////////////// + +void +transformDiscToGlobal(bool useJac, + const Trk::Surface* Su, + const double* ATH_RESTRICT p, + double* ATH_RESTRICT P) +{ + const Amg::Transform3D& T = Su->transform(); + const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; + const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; + double Sf,Cf; sincos(p[1],&Sf,&Cf); + + const double d0 = Cf*Ax[0]+Sf*Ay[0]; + const double d1 = Cf*Ax[1]+Sf*Ay[1]; + const double d2 = Cf*Ax[2]+Sf*Ay[2]; + P[ 0] = p[0]*d0+T(0,3) ; // X + P[ 1] = p[0]*d1+T(1,3) ; // Y + P[ 2] = p[0]*d2+T(2,3) ; // Z + + if(!useJac) return; + + // /dL1 | /dL2 | /dPhi | /dThe | + P[ 7] = d0; P[14] = p[0]*(Cf*Ay[0]-Sf*Ax[0]); P[21]=0.; P[28]=0.; // dX/ + P[ 8] = d1; P[15] = p[0]*(Cf*Ay[1]-Sf*Ax[1]); P[22]=0.; P[29]=0.; // dY/ + P[ 9] = d2; P[16] = p[0]*(Cf*Ay[2]-Sf*Ax[2]); P[23]=0.; P[30]=0.; // dZ/ +} + +///////////////////////////////////////////////////////////////////////////////// +// Cylinder local position transformation to global system coordinate +///////////////////////////////////////////////////////////////////////////////// + +void +transformCylinderToGlobal(bool useJac, + const Trk::Surface* Su, + const double* ATH_RESTRICT p, + double* ATH_RESTRICT P) +{ + const Amg::Transform3D& T = Su->transform(); + const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; + const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; + const double Az[3] = {T(0,2),T(1,2),T(2,2)}; + + const double R = static_cast<const Trk::CylinderSurface*>(Su)->bounds().r(); + + const double fr = p[0]/R; + double Sf,Cf; sincos(fr,&Sf,&Cf); + + P[ 0] = R*(Cf*Ax[0]+Sf*Ay[0])+p[1]*Az[0]+T(0,3); // X + P[ 1] = R*(Cf*Ax[1]+Sf*Ay[1])+p[1]*Az[1]+T(1,3); // Y + P[ 2] = R*(Cf*Ax[2]+Sf*Ay[2])+p[1]*Az[2]+T(2,3); // Z + + if(!useJac) return; + + // /dL1 | /dL2 | /dPhi | /dThe | + P[ 7] = Cf*Ay[0]-Sf*Ax[0]; P[14] = Az[0]; P[21] = 0.; P[28] = 0.; // dX/ + P[ 8] = Cf*Ay[1]-Sf*Ax[1]; P[15] = Az[1]; P[22] = 0.; P[29] = 0.; // dY/ + P[ 9] = Cf*Ay[2]-Sf*Ax[2]; P[16] = Az[2]; P[23] = 0.; P[30] = 0.; // dZ/ +} + +///////////////////////////////////////////////////////////////////////////////// +// Straight line local position transformation to global system coordinate +///////////////////////////////////////////////////////////////////////////////// + +void +transformLineToGlobal(bool useJac, + const Trk::Surface* Su, + const double* ATH_RESTRICT p, + double* ATH_RESTRICT P) +{ + const Amg::Transform3D& T = Su->transform(); + const double A[3] = {T(0,2),T(1,2),T(2,2)}; + + double Bx = A[1]*P[5]-A[2]*P[4]; + double By = A[2]*P[3]-A[0]*P[5]; + double Bz = A[0]*P[4]-A[1]*P[3]; + const double Bn = 1./sqrt(Bx*Bx+By*By+Bz*Bz); + Bx*=Bn; By*=Bn; Bz*=Bn; + P[ 0] = p[1]*A[0]+Bx*p[0]+T(0,3); // X + P[ 1] = p[1]*A[1]+By*p[0]+T(1,3); // Y + P[ 2] = p[1]*A[2]+Bz*p[0]+T(2,3); // Z + + if(!useJac) return; + + double Bx2 = -A[2]*P[25], Bx3 = A[1]*P[33]-A[2]*P[32]; + double By2 = A[2]*P[24] , By3 = A[2]*P[31]-A[0]*P[33]; + double Bz2 = A[0]*P[25]-A[1]*P[24], Bz3 = A[0]*P[32]-A[1]*P[31]; + double B2 = Bx*Bx2+By*By2+Bz*Bz2 , B3 = Bx*Bx3+By*By3+Bz*Bz3 ; + Bx2 =(Bx2-Bx*B2)*Bn ; Bx3 =(Bx3-Bx*B3)*Bn ; + By2 =(By2-By*B2)*Bn ; By3 =(By3-By*B3)*Bn ; + Bz2 =(Bz2-Bz*B2)*Bn ; Bz3 =(Bz3-Bz*B3)*Bn ; + + // /dL1 | /dL2 | /dPhi | /dThe | + P[ 7] = Bx; P[14] = A[0]; P[21] = Bx2*p[0]; P[28] = Bx3*p[0]; // dX/ + P[ 8] = By; P[15] = A[1]; P[22] = By2*p[0]; P[29] = By3*p[0]; // dY/ + P[ 9] = Bz; P[16] = A[2]; P[23] = Bz2*p[0]; P[30] = Bz3*p[0]; // dZ/ +} + +}//end of anonymous namespace for internal implementation methods + + +///////////////////////////////////////////////////////////////////////////////// +// Common transformation from local to global system coordinates for all surfaces +// for charged track parameters +///////////////////////////////////////////////////////////////////////////////// + +bool Trk::RungeKuttaUtils::transformLocalToGlobal +(bool useJac,const Trk::TrackParameters& Tp,double* P) +{ + const Trk::TrackParameters* pTp = &Tp; if(!pTp) return false; + + const AmgVector(5) Vp = Tp.parameters(); + double p[5] = {Vp[0],Vp[1],Vp[2],Vp[3],Vp[4]}; + + return transformLocalToGlobal(useJac,&Tp.associatedSurface(),p,P); +} + +///////////////////////////////////////////////////////////////////////////////// +// Common transformation from local to global system coordinates for all surfaces +// for neutral track parameters +///////////////////////////////////////////////////////////////////////////////// + +bool Trk::RungeKuttaUtils::transformLocalToGlobal +(bool useJac,const Trk::NeutralParameters& Tp,double* P) +{ + const Trk::NeutralParameters* pTp = &Tp; if(!pTp) return false; + + const AmgVector(5) Vp = Tp.parameters(); + double p[5] = {Vp[0],Vp[1],Vp[2],Vp[3],Vp[4]}; + + return transformLocalToGlobal(useJac,&Tp.associatedSurface(),p,P); +} + +///////////////////////////////////////////////////////////////////////////////// +// Common transformation from local to global system coordinates for all surfaces +// for pattern parameters +///////////////////////////////////////////////////////////////////////////////// + +bool Trk::RungeKuttaUtils::transformLocalToGlobal +(bool useJac,const Trk::PatternTrackParameters& Tp,double* P) +{ + return transformLocalToGlobal(useJac,Tp.associatedSurface(),Tp.par(),P); +} + +///////////////////////////////////////////////////////////////////////////////// +// Common transformation from global to local system coordinates for all surfaces +///////////////////////////////////////////////////////////////////////////////// + +void Trk::RungeKuttaUtils::transformGlobalToLocal +(double*ATH_RESTRICT P,double*ATH_RESTRICT par) +{ + par[2] = atan2(P[4],P[3]); + par[3] = acos (P[5]); + par[4] = P[6]; +} + +void Trk::RungeKuttaUtils::transformGlobalToLocal +(const Trk::Surface* su,bool useJac, double*ATH_RESTRICT P,double*ATH_RESTRICT par,double*ATH_RESTRICT Jac) +{ + par[2] = atan2(P[4],P[3]); + par[3] = acos (P[5]); + par[4] = P[6]; + + const unsigned int ty = su->type(); + + if (ty == Trk::Surface::Plane ) transformGlobalToPlane (su,useJac,P,par,Jac); + else if(ty == Trk::Surface::Line ) transformGlobalToLine (su,useJac,P,par,Jac); + else if(ty == Trk::Surface::Cylinder) transformGlobalToCylinder(su,useJac,P,par,Jac); + else if(ty == Trk::Surface::Perigee ) transformGlobalToLine (su,useJac,P,par,Jac); + else if(ty == Trk::Surface::Disc ) transformGlobalToDisc (su,useJac,P,par,Jac); + else transformGlobalToCone (su,useJac,P,par,Jac); + + if(!useJac) return; + + double P3,P4, C = P[3]*P[3]+P[4]*P[4]; + if(C > 1.e-20) {C= 1./C ; P3 = P[3]*C; P4 =P[4]*C; C =-sqrt(C);} + else {C=-1.e10; P3 = 1. ; P4 =0. ; } + + Jac[10] = P3*P[11]-P4*P[10]; // dPhi/dL0 + Jac[11] = P3*P[18]-P4*P[17]; // dPhi/dL1 + Jac[12] = P3*P[25]-P4*P[24]; // dPhi/dPhi + Jac[13] = P3*P[32]-P4*P[31]; // dPhi/dThe + Jac[14] = P3*P[39]-P4*P[38]; // dPhi/dCM + Jac[15] = C*P[12]; // dThe/dL0 + Jac[16] = C*P[19]; // dThe/dL1 + Jac[17] = C*P[26]; // dThe/dPhi + Jac[18] = C*P[33]; // dThe/dThe + Jac[19] = C*P[40]; // dThe/dCM + Jac[20] = P [41]; // dCM /dCM +} + +///////////////////////////////////////////////////////////////////////////////// +// Global position transformation to local Plane system coordinate +///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// // Main program for step estimation to surfaces ///////////////////////////////////////////////////////////////////////////////// @@ -642,7 +799,7 @@ std::pair<double,int> Trk::RungeKuttaUtils::stepEstimator int j = (*i).second; Trk::DistanceSolution ds = SU[j].first->straightLineDistanceEstimate(pos,dir,SU[j].second); - LD.push_back(std::make_pair(ds.currentDistance(false)+W,j)); + LD.emplace_back(ds.currentDistance(false)+W,j); int n = ds.numberOfSolutions(); if(!n) continue; @@ -682,7 +839,7 @@ std::pair<double,int> Trk::RungeKuttaUtils::stepEstimator //if(sa < So ) {next = true; return std::make_pair(s,N);} next = true; return std::make_pair(s,N); } - else if(sa < Sm ) { + if(sa < Sm ) { Sm = s; next = true; } /* @@ -772,122 +929,6 @@ AmgSymMatrix(5)* Trk::RungeKuttaUtils::newCovarianceMatrix return nM; } -///////////////////////////////////////////////////////////////////////////////// -// Plane local position transformation to global system coordinate -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformPlaneToGlobal -(bool useJac,const Trk::Surface* Su, const double*ATH_RESTRICT p ,double*ATH_RESTRICT P) -{ - const Amg::Transform3D& T = Su->transform(); - const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; - const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; - - P[ 0] = p[0]*Ax[0]+p[1]*Ay[0]+T(0,3); // X - P[ 1] = p[0]*Ax[1]+p[1]*Ay[1]+T(1,3); // Y - P[ 2] = p[0]*Ax[2]+p[1]*Ay[2]+T(2,3); // Z - - if(!useJac) return; - - // /dL1 | /dL2 | /dPhi | /dThe | - P[ 7] = Ax[0]; P[14] = Ay[0]; P[21] = 0.; P[28] = 0.; // dX/ - P[ 8] = Ax[1]; P[15] = Ay[1]; P[22] = 0.; P[29] = 0.; // dY/ - P[ 9] = Ax[2]; P[16] = Ay[2]; P[23] = 0.; P[30] = 0.; // dZ/ - -} - - -///////////////////////////////////////////////////////////////////////////////// -// Disc local position transformation to global system coordinate -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformDiscToGlobal -(bool useJac,const Trk::Surface* Su,const double*ATH_RESTRICT p, double*ATH_RESTRICT P) -{ - const Amg::Transform3D& T = Su->transform(); - const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; - const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; - double Sf,Cf; sincos(p[1],&Sf,&Cf); - - const double d0 = Cf*Ax[0]+Sf*Ay[0]; - const double d1 = Cf*Ax[1]+Sf*Ay[1]; - const double d2 = Cf*Ax[2]+Sf*Ay[2]; - P[ 0] = p[0]*d0+T(0,3) ; // X - P[ 1] = p[0]*d1+T(1,3) ; // Y - P[ 2] = p[0]*d2+T(2,3) ; // Z - - if(!useJac) return; - - // /dL1 | /dL2 | /dPhi | /dThe | - P[ 7] = d0; P[14] = p[0]*(Cf*Ay[0]-Sf*Ax[0]); P[21]=0.; P[28]=0.; // dX/ - P[ 8] = d1; P[15] = p[0]*(Cf*Ay[1]-Sf*Ax[1]); P[22]=0.; P[29]=0.; // dY/ - P[ 9] = d2; P[16] = p[0]*(Cf*Ay[2]-Sf*Ax[2]); P[23]=0.; P[30]=0.; // dZ/ -} - -///////////////////////////////////////////////////////////////////////////////// -// Cylinder local position transformation to global system coordinate -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformCylinderToGlobal -(bool useJac,const Trk::Surface* Su,const double*ATH_RESTRICT p,double*ATH_RESTRICT P) -{ - const Amg::Transform3D& T = Su->transform(); - const double Ax[3] = {T(0,0),T(1,0),T(2,0)}; - const double Ay[3] = {T(0,1),T(1,1),T(2,1)}; - const double Az[3] = {T(0,2),T(1,2),T(2,2)}; - - const double R = static_cast<const Trk::CylinderSurface*>(Su)->bounds().r(); - - const double fr = p[0]/R; - double Sf,Cf; sincos(fr,&Sf,&Cf); - - P[ 0] = R*(Cf*Ax[0]+Sf*Ay[0])+p[1]*Az[0]+T(0,3); // X - P[ 1] = R*(Cf*Ax[1]+Sf*Ay[1])+p[1]*Az[1]+T(1,3); // Y - P[ 2] = R*(Cf*Ax[2]+Sf*Ay[2])+p[1]*Az[2]+T(2,3); // Z - - if(!useJac) return; - - // /dL1 | /dL2 | /dPhi | /dThe | - P[ 7] = Cf*Ay[0]-Sf*Ax[0]; P[14] = Az[0]; P[21] = 0.; P[28] = 0.; // dX/ - P[ 8] = Cf*Ay[1]-Sf*Ax[1]; P[15] = Az[1]; P[22] = 0.; P[29] = 0.; // dY/ - P[ 9] = Cf*Ay[2]-Sf*Ax[2]; P[16] = Az[2]; P[23] = 0.; P[30] = 0.; // dZ/ -} - -///////////////////////////////////////////////////////////////////////////////// -// Straight line local position transformation to global system coordinate -///////////////////////////////////////////////////////////////////////////////// - -void Trk::RungeKuttaUtils::transformLineToGlobal -(bool useJac,const Trk::Surface* Su,const double*ATH_RESTRICT p,double*ATH_RESTRICT P) -{ - const Amg::Transform3D& T = Su->transform(); - const double A[3] = {T(0,2),T(1,2),T(2,2)}; - - double Bx = A[1]*P[5]-A[2]*P[4]; - double By = A[2]*P[3]-A[0]*P[5]; - double Bz = A[0]*P[4]-A[1]*P[3]; - const double Bn = 1./sqrt(Bx*Bx+By*By+Bz*Bz); - Bx*=Bn; By*=Bn; Bz*=Bn; - P[ 0] = p[1]*A[0]+Bx*p[0]+T(0,3); // X - P[ 1] = p[1]*A[1]+By*p[0]+T(1,3); // Y - P[ 2] = p[1]*A[2]+Bz*p[0]+T(2,3); // Z - - if(!useJac) return; - - double Bx2 = -A[2]*P[25], Bx3 = A[1]*P[33]-A[2]*P[32]; - double By2 = A[2]*P[24] , By3 = A[2]*P[31]-A[0]*P[33]; - double Bz2 = A[0]*P[25]-A[1]*P[24], Bz3 = A[0]*P[32]-A[1]*P[31]; - double B2 = Bx*Bx2+By*By2+Bz*Bz2 , B3 = Bx*Bx3+By*By3+Bz*Bz3 ; - Bx2 =(Bx2-Bx*B2)*Bn ; Bx3 =(Bx3-Bx*B3)*Bn ; - By2 =(By2-By*B2)*Bn ; By3 =(By3-By*B3)*Bn ; - Bz2 =(Bz2-Bz*B2)*Bn ; Bz3 =(Bz3-Bz*B3)*Bn ; - - // /dL1 | /dL2 | /dPhi | /dThe | - P[ 7] = Bx; P[14] = A[0]; P[21] = Bx2*p[0]; P[28] = Bx3*p[0]; // dX/ - P[ 8] = By; P[15] = A[1]; P[22] = By2*p[0]; P[29] = By3*p[0]; // dY/ - P[ 9] = Bz; P[16] = A[2]; P[23] = Bz2*p[0]; P[30] = Bz3*p[0]; // dZ/ -} - ///////////////////////////////////////////////////////////////////////////////// // Tramsform from local to global for all track parameters ///////////////////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkExtrapolation/TrkExUtils/src/SolutionSelector.cxx b/Tracking/TrkExtrapolation/TrkExUtils/src/SolutionSelector.cxx deleted file mode 100755 index b576aff9edf29ce9124920059aafb59f7402707a..0000000000000000000000000000000000000000 --- a/Tracking/TrkExtrapolation/TrkExUtils/src/SolutionSelector.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// SolutionSelector.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - - -#include "TrkExUtils/SolutionSelector.h" -#include <math.h> - -Trk::SolutionSelector::SolutionSelector() -= default; - -Trk::SolutionSelector::~SolutionSelector() -= default; - -Trk::SelectedSolution Trk::SolutionSelector::select(Trk::PropDirection dir, double pl1, double pl2) -{ - Trk::SelectedSolution sol = Trk::none; - switch (dir) { - case alongMomentum : - { - if (pl1 > 0. && pl2 > 0.) sol = (pl1 < pl2 ) ? Trk::first : Trk::second; - else if (pl1 > 0.) sol = Trk::first; - else if (pl2 > 0.) sol = Trk::second; - - } break; - case oppositeMomentum : - { - if (pl1 < 0. && pl2 < 0.) sol = (pl1 > pl2 ) ? Trk::first : Trk::second; - else if (pl1 < 0.) sol = Trk::first; - else if (pl2 < 0.) sol = Trk::second; - - } break; - case anyDirection : - default : - { - sol = (fabs(pl1) < fabs(pl2)) ? Trk::first : Trk::second; - } - - } - - return sol; -} - - diff --git a/Tracking/TrkExtrapolation/TrkExUtils/src/TargetSurfaces.cxx b/Tracking/TrkExtrapolation/TrkExUtils/src/TargetSurfaces.cxx index 7701ca9a542a760c9b70fd539cf17ed19690d9f5..04bad767a5215ca095014eac11ceb191d642ec2a 100755 --- a/Tracking/TrkExtrapolation/TrkExUtils/src/TargetSurfaces.cxx +++ b/Tracking/TrkExtrapolation/TrkExUtils/src/TargetSurfaces.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ Trk::ExtrapolationCode Trk::TargetSurfaces::setOnInput(const Trk::ExCellCharged } if ( initFrameVolume(position,direction,fVol) ) return Trk::ExtrapolationCode::InProgress; - else return Trk::ExtrapolationCode::FailureLoop; // failure navigation? + return Trk::ExtrapolationCode::FailureLoop; // failure navigation? } @@ -84,7 +84,7 @@ Trk::TargetSurfaceVector Trk::TargetSurfaces::orderedIntersections(const Amg::V } if ( initFrameVolume(position,direction,fVol) ) return orderIntersections(); - else return empty; // failure navigation? + return empty; // failure navigation? } diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h index 816e9f34d07afe82efda23148d09ffd9fd7b1dd1..8d2a7346050d30d03f513aef1b4753395791ffd5 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -68,10 +68,13 @@ public: DeterministicAnnealingFilter(); ~DeterministicAnnealingFilter(); // standard Athena methods - StatusCode initialize(); - StatusCode finalize(); - - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; /** refit a track (the main method; it uses most information from pattern recognition): This function should normally be called with tracks containing Trk::CompetingRIOsOnTrack. @@ -80,7 +83,7 @@ public: runOutlier has no meaning in all of the DAF's fitting methods */ virtual Track* fit (const Track&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** refit a track adding a PrepRawDataSet: Trk::ICompetingRIOsOnTrackCreator is used to create Trk::CompetingRIOsOnTrack out of the additional PrepRawData first. @@ -90,7 +93,7 @@ public: virtual Track* fit(const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** fit a track to a PrepRawDataSet: Trk::ICompetingRIOsOnTrackCreator is used to create Trk::CompetingRIOsOnTrack out of the additional PrepRawData first. @@ -100,7 +103,7 @@ public: virtual Track* fit(const PrepRawDataSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** re-fit a track, adding a fittable measurement set: This function should normally be called with a MeasurementSet containing @@ -109,7 +112,7 @@ public: virtual Track* fit(const Track&, const MeasurementSet&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** fit a track to a set of measurementBase. This function should normally be called with a MeasurementSet containing @@ -120,7 +123,7 @@ public: virtual Track* fit(const MeasurementSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** not implemented: makes no sense for the DAF (always returns a NULL pointer) */ virtual Track* fit(const SpacePointSet&, @@ -132,7 +135,7 @@ public: virtual Track* fit(const Track&, const Track&, const RunOutlierRemoval, - const ParticleHypothesis) const; + const ParticleHypothesis) const override; /////////////////////////////////////////////////////////////////// // Private methods: /////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx index ef04a120660c4587656b1e87e0ee116d88a5e99d..c3bcaae2c2a9ea3e02fefa7be3df7fd6f8f3b7ac 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -72,7 +72,7 @@ const std::vector< Trk::CompetingRIOsOnTrack::AssignmentProb >* Trk::DAF_SimpleW if ( ROTs->size() != trkPars->size() ) { ATH_MSG_ERROR("vector of RIO_OnTrack and TrackParameters do not have the same size: assignmentProbabilities cannot be calculated"); delete assgnProbVec; - return 0; + return nullptr; } else { // ----------------------------- // loop over ROTs to calc non-normalized assignment probabilities diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx index fd2497591761e63ef1487e8167a1b86a6785feda..42d86ad40d0ac7178db00706d66b7c459cd20a85 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ const std::vector< Trk::CompetingRIOsOnTrack::AssignmentProb >* Trk::DAF_WeightC if ( ROTs->size() != trkPars->size() ) { ATH_MSG_ERROR("vector of RIO_OnTrack and TrackParameters do not have the same size: assignmentProbabilities cannot be calculated"); delete assgnProbVec; - return 0; + return nullptr; } else { // ----------------------------- // loop over ROTs to calc non-normalized assignment probbailities diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx index 807b2a89ff6d51bc6bb115d81a30562bf85aafc8..f6da1c324d8e396e658c865b9ce9ff626f27e014 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -64,8 +64,8 @@ m_FitterValidationTool(""), m_doValidation(false), m_haveValidationTool(false), m_option_callValidationToolForFailedFitsOnly(false), -m_tparScaleSetter(0), -m_utility(0), +m_tparScaleSetter(nullptr), +m_utility(nullptr), //m_inputPreparator(0), m_directionToPerigee(Trk::oppositeMomentum), m_fitStatistics(0), @@ -186,17 +186,17 @@ StatusCode Trk::DeterministicAnnealingFilter::initialize() { } // configure ForwardKalmanFitter - sc = m_forwardFitter->configureWithTools((m_extrapolator?(&(*m_extrapolator)):0), + sc = m_forwardFitter->configureWithTools((m_extrapolator?(&(*m_extrapolator)):nullptr), &(*m_updator), - 0, // no ROT creator needed! - (!m_dna.empty()?(&(*m_dna)):0), // dynamic noise adjustment tool - 0); // no alignable Surface Provider + nullptr, // no ROT creator needed! + (!m_dna.empty()?(&(*m_dna)):nullptr), // dynamic noise adjustment tool + nullptr); // no alignable Surface Provider if(sc.isFailure()) return sc; // configure KalmanSmoother - sc = m_smoother->configureWithTools( (m_extrapolator?(&(*m_extrapolator)):0), + sc = m_smoother->configureWithTools( (m_extrapolator?(&(*m_extrapolator)):nullptr), &(*m_updator), - (!m_dna.empty()?(&(*m_dna)):0), // dynamic noise adjustment tool - 0, // no alignable Surface Provider + (!m_dna.empty()?(&(*m_dna)):nullptr), // dynamic noise adjustment tool + nullptr, // no alignable Surface Provider true, // always do smoothing false); // no creation of FitQualityOnSurface objects, because the Kalman smoother // does not take assignment probabilities into account, @@ -233,7 +233,7 @@ StatusCode Trk::DeterministicAnnealingFilter::initialize() { if (msgLvl(MSG::DEBUG)) { // Set up ATLAS ID helper to be able to identify the measurement's det-subsystem. - const AtlasDetectorID* idHelper = 0; + const AtlasDetectorID* idHelper = nullptr; if (detStore()->retrieve(idHelper, "AtlasID").isFailure()) { ATH_MSG_ERROR ("Could not get AtlasDetectorID helper"); return StatusCode::FAILURE; @@ -264,14 +264,14 @@ StatusCode Trk::DeterministicAnnealingFilter::finalize() { std::cout << "-------------------------------------------------------------------------------" << std::endl; std::cout << " track fits by eta range ------All---Barrel---Trans.-- Endcap-- " << std::endl; std::vector<std::string> statusNames(0); - statusNames.push_back(" Number of fitter calls :"); - statusNames.push_back(" Number of successful track fits :"); - statusNames.push_back(" Number of calls with bad input :"); - statusNames.push_back(" Number of extrapolation failures:"); - statusNames.push_back(" fits with failed forward filter :"); - statusNames.push_back(" fits with failed smoother :"); - statusNames.push_back(" fits w/ failed outlier strategy :"); - statusNames.push_back(" fits w/ failed perigee making :"); + statusNames.emplace_back(" Number of fitter calls :"); + statusNames.emplace_back(" Number of successful track fits :"); + statusNames.emplace_back(" Number of calls with bad input :"); + statusNames.emplace_back(" Number of extrapolation failures:"); + statusNames.emplace_back(" fits with failed forward filter :"); + statusNames.emplace_back(" fits with failed smoother :"); + statusNames.emplace_back(" fits w/ failed outlier strategy :"); + statusNames.emplace_back(" fits w/ failed perigee making :"); for (unsigned int i=0; i<statusNames.size(); i++) { std::cout << (statusNames[i]) << std::setiosflags(std::ios::dec) << std::setw(iw) << (m_fitStatistics[i])[iAll] << std::setiosflags(std::ios::dec) << std::setw(iw) @@ -308,14 +308,14 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::Track& inputTrack ATH_MSG_FATAL( "need estimated track parameters near origin, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection against not having measurements on the input track if (!inputTrack.trackStateOnSurfaces() || inputTrack.trackStateOnSurfaces()->size() < 2) { ATH_MSG_WARNING( "called to refit empty track or track with too little information, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // determine the Track Parameter which is the start of the trajectory, @@ -382,7 +382,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::Track& inputTrack // ------------------------ // start the DAF procedure: - Track* theTrack = 0; + Track* theTrack = nullptr; if (minPar) { ATH_MSG_VERBOSE( "got track parameters near origine" ); // do the DAF fit @@ -420,7 +420,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::PrepRawDataSet& , //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(PRDset, , ) not implemented" ); - return 0; + return nullptr; } ////////////////////////////////////////////// @@ -435,7 +435,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::MeasurementSet& if ( inputMeasSet.empty() ) { monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } //monitorTrackFits( Call, estimatedStartParameters.eta() ); @@ -516,7 +516,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Track&, const ParticleHypothesis) const { //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(Track, PRDset, , ) not implemented" ); - return 0; + return nullptr; } ////////////////////////////////////////////// @@ -538,21 +538,21 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track& ATH_MSG_ERROR( "need estimated track parameters near origine, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection against not having Measurements if (inputTrack.measurementsOnTrack()->empty()) { ATH_MSG_ERROR( "try to fit track+vec<MB> with an empty track, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection, if empty MeasurementSet if (addMeasColl.empty()) { ATH_MSG_ERROR( "try to add an empty MeasurementSet to the track, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } @@ -602,7 +602,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track& ATH_MSG_WARNING( "Cannot get valid track parameters from input track, reject fit!" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // fit set of MeasurementBase using main method, // start with first TrkParameter in inputTrack @@ -633,7 +633,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const SpacePointSet&, //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(SpacePointSet, , , ) does not make sense for the Deterministic Annealing Filter, return NULL" ); - return 0; + return nullptr; } /////////////////////////////////////// // combined fit of two tracks @@ -643,7 +643,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track&, const Trk::RunOutlierRemoval, const Trk::ParticleHypothesis ) const { ATH_MSG_ERROR( "fit(Track, Track, ...) not implemented yet, return NULL pointer" ); - return 0; + return nullptr; } ///////////////////////////////// @@ -757,8 +757,8 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( ATH_MSG_VERBOSE( "-----> enter DeterministicAnnealingFilter::doDAFfit()" ); const TrackParameters* estimatedStartParameters = &trkPar; - const TrackParameters* clonedParameters = 0; - FitQuality* fitQual = 0; + const TrackParameters* clonedParameters = nullptr; + FitQuality* fitQual = nullptr; KalmanMatEffectsController controlledMatEff(matEffects, !m_dna.empty()); //---------------------------------- @@ -801,7 +801,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( // extrapolate previous track parameters to the surface of the outlier: // TODO search of the next valid TrackParameters can be coded more elegantly: - const Trk::TrackParameters* previousTrkPar = 0; + const Trk::TrackParameters* previousTrkPar = nullptr; Trk::PropDirection direction = Trk::alongMomentum; Trajectory::const_iterator it2 = it; while (!previousTrkPar) { @@ -842,7 +842,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( CompetingRIOsOnTrack* newCompROT = compROT->clone(); m_compROTcreator->updateCompetingROT(*newCompROT, *extrapolatedTrkPar, m_option_annealingScheme[annealingIteration]); delete extrapolatedTrkPar; - extrapolatedTrkPar = 0; + extrapolatedTrkPar = nullptr; it->replaceMeasurement(newCompROT); compROT = newCompROT; } @@ -889,7 +889,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( } //m_smoother->clearFitResultsAfterOutlier(m_trajectory,fitQual,1); delete fitQual; - fitQual = 0; + fitQual = nullptr; ATH_MSG_VERBOSE( endmsg << "********** call forward kalman filter, iteration #"<< annealingIteration << " **********" << endmsg ); } // end if(annealingIteration > 0 ) @@ -906,7 +906,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( ATH_MSG_DEBUG( "forward fitter #" << annealingIteration << " rejected fit" << endmsg << endmsg ); monitorTrackFits( ForwardFilterFailure, estimatedStartParameters->eta(), annealingIteration); if (m_doValidation) callValidation(annealingIteration, matEffects, fitstatus); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg << "********** Forward fit passed, now call smoother #" @@ -921,7 +921,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( if (fitstatus.isFailure()) { ATH_MSG_DEBUG( "smoother #" << annealingIteration << " rejected fit" << endmsg << endmsg ); monitorTrackFits( SmootherFailure, estimatedStartParameters->eta(), annealingIteration ); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) { msg(MSG::VERBOSE) << endmsg @@ -932,12 +932,12 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( //if (m_option_doValidationAction) m_extrapolator->validationAction(); delete clonedParameters; - clonedParameters = 0; + clonedParameters = nullptr; } // end for: annealing iteration loop // FitQuality is calculate in makeTrack() to take assignment probabilties into account, delete the one // made by the smoother delete fitQual; - fitQual = 0; + fitQual = nullptr; return makeTrack(matEffects); } @@ -1103,7 +1103,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::makeTrack(const Trk::ParticleHypo const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMakePerigee( const Trk::PerigeeSurface& perSurf, const Trk::ParticleHypothesis matEffects) const { - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); while (!nearestParam) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1111,7 +1111,7 @@ const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMak } else { if (it == m_trajectory.end()) { ATH_MSG_ERROR( "Perigee-making failed: no useful parameters on track!" ); - return 0; + return nullptr; } } ++it; @@ -1121,13 +1121,13 @@ const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMak m_directionToPerigee, false, matEffects); if (!per) { ATH_MSG_WARNING( "Perigee-making failed: extrapolation did not succeed." ); - return 0; + return nullptr; } else { ATH_MSG_VERBOSE( "Perigee parameters have been made." ); } std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(0, per, 0, 0, typePattern); + TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(nullptr, per, nullptr, nullptr, typePattern); return tsos; } @@ -1216,22 +1216,22 @@ void Trk::DeterministicAnnealingFilter::addToTrajectory(const MeasurementBase* m const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::createStateFromProtoState(ProtoTrackStateOnSurface& protoState) const { - if (!(protoState.measurement())) return 0; + if (!(protoState.measurement())) return nullptr; // set correct TrackStateOnSurfaceType std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0); // create the TrackStateOnSurface const Trk::MaterialEffectsBase* mefot = protoState.dnaMaterialEffects() ? - protoState.dnaMaterialEffects()->makeMEFOT() : 0; + protoState.dnaMaterialEffects()->makeMEFOT() : nullptr; if (protoState.isOutlier()) { typePattern.set(TrackStateOnSurface::Outlier); // do not use the track parameters for outliers return new TrackStateOnSurface( protoState.checkoutMeasurement(), - 0,0,0,typePattern ); + nullptr,nullptr,nullptr,typePattern ); } else { typePattern.set(TrackStateOnSurface::Measurement); return new TrackStateOnSurface( protoState.checkoutMeasurement(), // the measurement protoState.checkoutSmoothedPar(), // smoothed track parameter - 0, // no fit quality + nullptr, // no fit quality mefot, // no material effects typePattern ); // type pattern } @@ -1263,7 +1263,7 @@ void Trk::DeterministicAnnealingFilter::callValidation( int iterationIndex, ATH_MSG_DEBUG( "call validation for track iteration " << iterationIndex << "with status " << fitStatCode.getCode() << "/" << fitStatCode ); // extrapolate to perigee at origin for validation data const Trk::PerigeeSurface perSurf; // default perigee at origin - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); for ( ; it != m_trajectory.end(); it++ ) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1279,8 +1279,8 @@ void Trk::DeterministicAnnealingFilter::callValidation( int iterationIndex, } } } - const Trk::Perigee* per = 0; - const Trk::TrackParameters* perPar = 0; + const Trk::Perigee* per = nullptr; + const Trk::TrackParameters* perPar = nullptr; if (nearestParam) { // extrapolate to perigee perPar = m_extrapolator->extrapolate( *nearestParam, perSurf, diff --git a/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h b/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h index 06a21e3500a60cce2a2f513366910592ae2703c9..8598627a48969774b41995ce88116fb2fbab64d5 100755 --- a/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h +++ b/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h @@ -56,7 +56,12 @@ namespace Trk { // Filter settings: // RunOutlierRemoval - use logic to remove bad hits // ParticleHypothesis - allow for multiple scattering and energy loss? - + + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; virtual Track* fit(const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting) const; diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt b/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt index a51e02ba0ce5e7b3e840d421c21e800b933f4f9d..ab951dad449bd7cee8985834fbc9c7116d4b5ca8 100644 --- a/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt @@ -12,10 +12,11 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters + Tracking/TrkEvent/TrkTrack Tracking/TrkFitter/TrkFitterUtils ) # Component(s) in the package: atlas_add_library( TrkFitterInterfaces PUBLIC_HEADERS TrkFitterInterfaces - LINK_LIBRARIES AthContainers EventPrimitives GaudiKernel TrkEventPrimitives TrkParameters TrkFitterUtils ) + LINK_LIBRARIES AthContainers EventPrimitives GaudiKernel TrkEventPrimitives TrkParameters TrkTrack TrkFitterUtils ) diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h index 7fe90ce80a6b7e1ea28967f3204e421e8f9bf429..a74ce0a9d3d6c2bef1442d45d80c5e55be8551fa 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -56,7 +56,7 @@ public: const MeasurementBase*, const Trk::KalmanMatEffectsController&, PropDirection, - const DNA_MaterialEffects* = 0) const = 0; + const DNA_MaterialEffects* = nullptr) const = 0; // virtual double calculateDna(double, double, double) const = 0; diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h index 2f58fbeaf367822128e07898cb20d5cd357df963..30e7fc7bb1967b2261a98a2ec69496e2f6c1e72a 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -62,10 +62,10 @@ namespace Trk { */ virtual StatusCode configureWithTools(const IExtrapolator*, const IUpdator*, const IRIO_OnTrackCreator*, - const IDynamicNoiseAdjustor* = 0, - const IAlignableSurfaceProvider* = 0, - const IMeasurementRecalibrator* = 0, - const IKalmanPiecewiseAnnealingFilter* =0 ) = 0; + const IDynamicNoiseAdjustor* = nullptr, + const IAlignableSurfaceProvider* = nullptr, + const IMeasurementRecalibrator* = nullptr, + const IKalmanPiecewiseAnnealingFilter* =nullptr ) = 0; /** @brief forward kalman filter working on a set of PrepRawData, for example intended for fitting during pattern regognition diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h index 0bcdc675208ce2ae4611507b055f6965971e715a..37bf69d7ed9545d99078fb4f4951c0663e276917 100644 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ namespace Trk const IUpdator*, const IMeasurementRecalibrator*, const ProtoTrajectoryUtility*, - const IDynamicNoiseAdjustor* = 0 ) = 0; + const IDynamicNoiseAdjustor* = nullptr ) = 0; /** @brief run DAF on the full trajectory, starting from first fittable state and parameters therein, do not do last smoother */ diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h index 7342e6a52a2bd8f2a72b76cf56bbda8ccb54e5e2..7a4be5035f1028f33291a0c28b2a02db3b2bc813 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -17,14 +17,14 @@ #include "TrkFitterUtils/FitterStatusCode.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkParameters/TrackParameters.h" - +#include "GaudiKernel/EventContext.h" +#include "TrkTrack/Track.h" namespace Trk { - class Track; //!> ATLAS standard track class + class Track; //!> ATLAS standard track class static const InterfaceID IID_ITrackFitter("ITrackFitter",1,0); - /** @class ITrackFitter provides the abstract interface for track fitting in the common @@ -37,7 +37,18 @@ namespace Trk { Regarding athena, it is implemented using the IAlgTool inheritance, so fitter implementations should be a component_library. + Athena MT notes: + There are 2 sets of methods + 1. EventContext aware returning unique_ptr + 2. Without EventContext returning plain ptr. + + By default the methods of the one set call the methods of the other. + So a Fitter implementation needs to implement only one of the two sets. + A client can use any of the two. + For MT it might be preferable to migrate to the EventContext aware. + @author M. Elsing, W. Liebig <http://consult.cern.ch/xwho> + @author C. Anastopoulos (Athena MT) */ class ITrackFitter : virtual public IAlgTool { @@ -50,22 +61,150 @@ namespace Trk { { return IID_ITrackFitter; } - /** RE-FIT A TRACK. - Since it is not our but the fitter model's decision if to - re-fit on PRD or ROT level, it is made pure virtual. */ - virtual Track* fit (const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + /* + * First the context aware retun unique_ptr + * methods. + * If this set is not overloaded , it + * will call the methods without EventContext + */ + + /** Event context aware (Athena MT) RE-FIT A TRACK. */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>(fit(track, runOutlier, matEffects)); + } + /** Event context aware (Athena MT) RE-FIT A TRACK, ADDING A PRD SET. + this method will disintegrate the track back to PRD + and call the fit(PRDset) method. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const PrepRawDataSet& prepRawSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + + (void)(ctx); + return std::unique_ptr<Track>( + fit(track, prepRawSet, runOutlier, matEffects)); + } + /** Event context aware FIT A TRACK TO A SET OF PrepRawData. + Main fit method. The TrackParameters is a first + estimate for the track, represented close to the origin. + Use-cases can be thought of that make it necessary + to control toggling outlier removal and material effects not + via job options (once-per-job) but at each call (toggle + within event, large set of fast fit followed by one final full fit). + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const PrepRawDataSet& prepRawSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(prepRawSet, params, runOutlier, matEffects)); + } + + /** Event context aware RE-FIT A TRACK, ADDING A FITTABLE MEASUREMENT SET. + this method will use the vector of measurements from the + existing track and refit adding the new measurements. The code + is in this class, but can be overwritten by inheriting classes. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const MeasurementSet& measSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(track, measSet, runOutlier, matEffects)); + } + + /** Event context aware FIT A TRACK TO A SET OF MEASUREMENTBASE. + Main fit method. The TrackParameters is a first + estimate for the track, represented close to the origin. + */ + virtual std::unique_ptr<Track> fit( + const ::EventContext& ctx, + const MeasurementSet& measSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(measSet, params, runOutlier, matEffects)); + } + + /** Event context aware COMBINE TWO TRACKS BY REFITTING. + Specifically designed for combined muon fits, allowing to extract + extra informations (ID-exit & MS-entrance parameters, layers, Mefos) + from already fitted tracks. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track1, + const Track& track2, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(track1, track2, runOutlier, matEffects)); + } + + /* + * Then the context unaware retun unique_ptr + * methods. + * If this set is not overloaded , it + * will call the methods with EventContext + */ + + /** RE-FIT A TRACK. + It is the fitter model's decision if to + re-fit on PRD or ROT level*/ + virtual Track* fit( + const Track& track, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track, + runOutlier, + matEffects).release(); + } /** RE-FIT A TRACK, ADDING A PRD SET. this method will disintegrate the track back to PRD and call the fit(PRDset) method. The code is in this class, but can be overwritten by inheriting classes. */ - virtual Track* fit(const Track&, - const PrepRawDataSet&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const Track& track, + const PrepRawDataSet& prepRawSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + + return fit(Gaudi::Hive::currentContext(), + track, + prepRawSet, + runOutlier, + matEffects) + .release(); + } + /** FIT A TRACK TO A SET OF PrepRawData. Main fit method. The TrackParameters is a first estimate for the track, represented close to the origin. @@ -74,48 +213,85 @@ namespace Trk { via job options (once-per-job) but at each call (toggle within event, large set of fast fit followed by one final full fit). */ - virtual Track* fit(const PrepRawDataSet&, - const TrackParameters&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const PrepRawDataSet& prepRawSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + prepRawSet, + params, + runOutlier, + matEffects) + .release(); + } + /** RE-FIT A TRACK, ADDING A FITTABLE MEASUREMENT SET. this method will use the vector of measurements from the existing track and refit adding the new measurements. The code is in this class, but can be overwritten by inheriting classes. */ - - virtual Track* fit(const Track&, - const MeasurementSet&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const Track& track, + const MeasurementSet& measSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track, + measSet, + runOutlier, + matEffects) + .release(); + } /** FIT A TRACK TO A SET OF MEASUREMENTBASE. Main fit method. The TrackParameters is a first estimate for the track, represented close to the origin. */ - virtual Track* fit(const MeasurementSet&, - const TrackParameters&, + virtual Track* fit(const MeasurementSet& measSet, + const TrackParameters& params, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + const ParticleHypothesis matEffects=Trk::nonInteracting) const + { + + return fit(Gaudi::Hive::currentContext(), + measSet, + params, + runOutlier, + matEffects) + .release(); + } /** COMBINE TWO TRACKS BY REFITTING. Specifically designed for combined muon fits, allowing to extract extra informations (ID-exit & MS-entrance parameters, layers, Mefos) from already fitted tracks. */ - virtual Track* fit(const Track&, - const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; - - /** provides way of getting more detailed information about failing fits than NULL track pointer */ - virtual FitterStatusCode statusCodeOfLastFit() const; + virtual Track* fit( + const Track& track1, + const Track& track2, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track1, + track2, + runOutlier, + matEffects) + .release(); + } + /** provides way of getting more detailed information about failing fits + * than NULL track pointer */ + virtual FitterStatusCode statusCodeOfLastFit() const; - }; // end of class + }; // end of class } // end of namespace // wait until all fitters have it implemented -inline Trk::FitterStatusCode Trk::ITrackFitter::statusCodeOfLastFit() const +inline Trk::FitterStatusCode +Trk::ITrackFitter::statusCodeOfLastFit() const { return Trk::FitterStatusCode::Success; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt b/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt index 248bdb7638ff33a87901cfc123a501b5d81d3200..6a5436c4e1da6ffff7e7cbd660640729bf713017 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/CMakeLists.txt @@ -54,6 +54,7 @@ atlas_add_component( TrkGaussianSumFilter atlas_install_headers( TrkGaussianSumFilter ) atlas_install_runtime( Data/*.par ) +#Executables for tests atlas_add_executable( GSF_testFindMinimumIndex test/testFindMinimumIndex.cxx src/KLGaussianMixtureReduction.cxx) @@ -63,9 +64,13 @@ atlas_add_executable( GSF_testAlignedDynArray atlas_add_executable( GSF_testMergeComponents test/testMergeComponents.cxx src/KLGaussianMixtureReduction.cxx) +#Tests atlas_add_test(ut_GSF_testFindMinimumIndex SCRIPT GSF_testFindMinimumIndex) atlas_add_test(ut_GSF_testAlignedDynArray SCRIPT GSF_testAlignedDynArray) +atlas_add_test(ut_GSF_testMergeComponents + SCRIPT GSF_testMergeComponents) + diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h index 590ebe0af589e53b895cb9c4287efbd0ae4e98ce..5809bbd07bcaac4f9a2d9c8e223f21bfb71949e8 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h @@ -17,11 +17,14 @@ namespace GSFUtils { template<typename T, size_t Alignment> /** * A wrapper around std::aligned_alloc + * + * The main usage is to create an alligned buffer + * array to be used with vector instructions * * Provides * - Additional RAII functionality * - Default initialization of elements - * - Initialization with copies of elements with value value. + * - Value initialization of elements. */ class AlignedDynArray @@ -40,26 +43,26 @@ public: explicit AlignedDynArray(size_t n, const T& value); /// Move copy constructor - AlignedDynArray(AlignedDynArray&&); + AlignedDynArray(AlignedDynArray&&) noexcept; /// Move assignment operator - AlignedDynArray& operator=(AlignedDynArray&&); + AlignedDynArray& operator=(AlignedDynArray&&) noexcept; /// Destructor ~AlignedDynArray(); - /// Conversions to T* - operator T*(); - /// Conversions to const T* - operator const T*() const; + /// Get the underlying buffer + T* buffer () noexcept; + /// Get the underlying buffer + const T* buffer() const noexcept; /// index array operators - T& operator[](const std::size_t pos); - const T& operator[](const std::size_t pos) const; + T& operator[](const std::size_t pos) noexcept; + const T& operator[](const std::size_t pos) const noexcept; /// size of allocated buffer - std::size_t size() const; + std::size_t size() const noexcept; private: - void cleanup(); + void cleanup() noexcept; T* m_buffer = nullptr; size_t m_size = 0; }; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc index 9dfec97c5e15787eda80046ec7706eba559fdce2..e47f9028a1c73b3da64f84bab4c01326afd037b1 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc @@ -9,7 +9,6 @@ * @brief AlignedDynArray implementation */ - namespace GSFUtils { template<typename T, size_t Alignment> @@ -33,7 +32,8 @@ inline AlignedDynArray<T, Alignment>::AlignedDynArray(size_t n, const T& value) } template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::AlignedDynArray(AlignedDynArray&& other) +inline AlignedDynArray<T, Alignment>::AlignedDynArray( + AlignedDynArray&& other) noexcept : m_buffer(nullptr) , m_size(0) { @@ -47,19 +47,17 @@ inline AlignedDynArray<T, Alignment>::AlignedDynArray(AlignedDynArray&& other) template<typename T, size_t Alignment> inline AlignedDynArray<T, Alignment>& -AlignedDynArray<T, Alignment>::operator=(AlignedDynArray&& other) +AlignedDynArray<T, Alignment>::operator=(AlignedDynArray&& other) noexcept { + // cleanup this object + cleanup(); + // copy over other + m_buffer = other.m_buffer; + m_size = other.m_size; + // set other to invalid + other.m_buffer = nullptr; + other.m_size = 0; - if (this != &other) { - // cleanup this object - cleanup(); - // copy over other - m_buffer = other.m_buffer; - m_size = other.m_size; - // set other to invalid - other.m_buffer = nullptr; - other.m_size = 0; - } return *this; } @@ -70,40 +68,43 @@ inline AlignedDynArray<T, Alignment>::~AlignedDynArray() } template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::operator T*() +inline T* +AlignedDynArray<T, Alignment>::buffer() noexcept { return m_buffer; } template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::operator const T*() const +inline const T* +AlignedDynArray<T, Alignment>::buffer() const noexcept { return m_buffer; } template<typename T, size_t Alignment> -inline T& AlignedDynArray<T, Alignment>::operator[](const std::size_t pos) +inline T& AlignedDynArray<T, Alignment>::operator[]( + const std::size_t pos) noexcept { return m_buffer[pos]; } template<typename T, size_t Alignment> inline const T& AlignedDynArray<T, Alignment>::operator[]( - const std::size_t pos) const + const std::size_t pos) const noexcept { return m_buffer[pos]; } template<typename T, size_t Alignment> inline std::size_t -AlignedDynArray<T, Alignment>::size() const +AlignedDynArray<T, Alignment>::size() const noexcept { return m_size; } template<typename T, size_t Alignment> inline void -AlignedDynArray<T, Alignment>::cleanup() +AlignedDynArray<T, Alignment>::cleanup() noexcept { if (m_buffer) { for (std::size_t pos = 0; pos < m_size; ++pos) { diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h index 3fee5b8a477265ee0e72597666d174c9a71100df..160dcea5aa5e442f31e82db531a4a802871c9989 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h @@ -21,6 +21,7 @@ #include "GaudiKernel/IChronoStatSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" #include <atomic> @@ -55,31 +56,38 @@ public: /** Refit a track using the Gaussian Sum Filter */ - virtual Track* fit(const Track&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Fit a collection of 'PrepRawData' objects using the Gaussian Sum Filter - This requires that an trackParameters object be supplied also as an initial guess */ - virtual Track* fit(const PrepRawDataSet&, - const TrackParameters&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const PrepRawDataSet&, + const TrackParameters&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Fit a collection of 'RIO_OnTrack' objects using the Gaussian Sum Filter - This requires that an trackParameters object be supplied also as an initial guess */ - virtual Track* fit(const MeasurementSet&, - const TrackParameters&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const MeasurementSet&, + const TrackParameters&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Refit a track adding a PrepRawDataSet - Not done! */ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier = false, @@ -88,14 +96,16 @@ public: /** Refit a track adding a RIO_OnTrack set - This has no form of outlier rejection and will use all hits on orginal track... i.e. very basic impleneation at the moment*/ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const MeasurementSet&, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting) const override final; /** Combine two tracks by refitting - Not done! */ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const Track&, const RunOutlierRemoval runOutlier = false, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h index ff5603c547ac017ad4bab0a25059acf0e83ac00c..2d40c26d26c73bb2b59a61bbfc24c13b1cee7d67 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h @@ -73,7 +73,6 @@ #define KLGaussianMixReductionUtils_H #include "CxxUtils/features.h" -#include "CxxUtils/restrict.h" #include <cstdint> #include <utility> #include <vector> @@ -106,17 +105,12 @@ struct triangularToIJ int32_t J = -1; }; -/// typedef for float* restrict -typedef float* ATH_RESTRICT floatPtrRestrict; -/// typedef for Component1D* restrict -typedef Component1D* ATH_RESTRICT componentPtrRestrict; - /** * @brief Merge the componentsIn and return * which componets got merged */ std::vector<std::pair<int32_t, int32_t>> -findMerges(componentPtrRestrict componentsIn, +findMerges(Component1D* componentsIn, const int32_t inputSize, const int32_t reducedSize); @@ -127,16 +121,16 @@ findMerges(componentPtrRestrict componentsIn, #if HAVE_FUNCTION_MULTIVERSIONING #if defined(__x86_64__) __attribute__((target("avx2"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +findMinimumIndex(const float* distancesIn, const int32_t n); __attribute__((target("sse4.1"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +findMinimumIndex(const float* distancesIn, const int32_t n); __attribute__((target("sse2"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +findMinimumIndex(const float* distancesIn, const int32_t n); #endif // x86_64 specific targets __attribute__((target("default"))) #endif // function multiversioning std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int32_t n); +findMinimumIndex(const float* distancesIn, const int32_t n); } // namespace KLGaussianMixtureReduction diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h index 7666e2cbd71ef7b8feb8f5e36e76072284e4838c..ed057e1133c89168c18739980843d3b6cbf4cabd 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h @@ -7,7 +7,7 @@ * @date Friday 25th February 2005 * @author Tom Atkinson, Anthony Morley, Christos Anastopoulos * - * Class to calculate the weighting of state components + * Helper to calculate the weighting of state components * after an update from a measurement. The information for * the measurement is provided through the RIO_OnTrack * object. @@ -16,83 +16,14 @@ #ifndef PosteriorWeightsCalculator_H #define PosteriorWeightsCalculator_H -#include "TrkEventPrimitives/LocalParameters.h" -#include "TrkEventPrimitives/ProjectionMatricesSet.h" #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" -#include "TrkParameters/TrackParameters.h" namespace Trk { -class PosteriorWeightsCalculator -{ -public: +namespace PosteriorWeightsCalculator{ std::vector<Trk::ComponentParameters> weights(MultiComponentState&&, - const MeasurementBase&) const; - -private: - /** Function to calculate the determinant and chi2 of a measurement for a 1D - * hit */ - std::pair<double, double> calculateWeight_1D( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const double measPar, - const double measCov, - int paramKey) const; - - /** Function to calculate the determinant and chi2 of a measurement for a 2D - hit specially when the measurements are when local x and local y */ - std::pair<double, double> calculateWeight_2D_3( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const AmgVector(2) & measPar, - const AmgSymMatrix(2) & measCov) const; - - /** Tempplated Function to calculate the determinant and chi2 of a - * measurement for a N'D hit */ - template<int DIM> - std::pair<double, double> calculateWeight_T( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const AmgVector(DIM) & measPar, - const AmgSymMatrix(DIM) & measCov, - int paramKey) const; -}; - -template<int DIM> -std::pair<double, double> -PosteriorWeightsCalculator::calculateWeight_T( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const AmgVector(DIM) & measPar, - const AmgSymMatrix(DIM) & measCov, - int paramKey) const -{ - - static const ProjectionMatricesSet reMatrices( - 5); //!< expansion and reduction matrices set - // Define the expansion matrix - const AmgMatrix(DIM, 5) H = - reMatrices.expansionMatrix(paramKey).block<DIM, 5>(0, 0); - - // Calculate the residual - AmgVector(DIM) r = measPar - H * componentTrackParameters->parameters(); - - // Residual covariance. Posterior weights is calculated used predicted state - // and measurement. Therefore add covariances - AmgSymMatrix(DIM) R(measCov + H * (*predictedCov) * H.transpose()); - - // compute determinant of residual - const double det = R.determinant(); - - if (det == 0) { - // ATH_MSG_WARNING( "Determinant is 0, cannot invert matrix... Ignoring - // component" ); - return std::pair<double, double>(0, 0); - } - // Compute Chi2 - return std::pair<double, double>( - det, (1. / (double)DIM) * ((r.transpose() * R.inverse() * r)(0, 0))); + const MeasurementBase&); } } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents new file mode 100644 index 0000000000000000000000000000000000000000..e65fd184211ecf15761053ed454b47b5c8650c7c --- /dev/null +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testMergeComponents @@ -0,0 +1,60 @@ +[61, 19] +[18, 6] +[62, 20] +[61, 7] +[36, 24] +[13, 1] +[12, 0] +[37, 25] +[61, 13] +[60, 48] +[47, 46] +[22, 11] +[8, 2] +[60, 18] +[60, 12] +[63, 29] +[38, 26] +[61, 37] +[14, 8] +[35, 34] +[67, 31] +[59, 58] +[63, 9] +[41, 28] +[40, 15] +[36, 30] +[62, 14] +[61, 49] +[68, 45] +[68, 32] +[71, 70] +[63, 41] +[69, 35] +[66, 60] +[64, 22] +[17, 4] +[39, 27] +[63, 21] +[47, 38] +[65, 23] +[53, 52] +[64, 10] +[40, 3] +[63, 40] +[67, 43] +[62, 47] +[66, 36] +[62, 50] +[17, 5] +[65, 64] +[67, 61] +[65, 17] +[71, 39] +[69, 33] +[59, 57] +[68, 44] +[66, 54] +[65, 16] +[65, 51] +[71, 63] diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx index eff345b24e9fbc0c5e08a26d1d1f471974ad583b..84097f46c88a6e2930267b25884c5a9c1a62ea75 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx @@ -170,8 +170,9 @@ Trk::GaussianSumFitter::finalize() /* * Refitting of a track */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::Track& inputTrack, const Trk::RunOutlierRemoval outlierRemoval, const Trk::ParticleHypothesis particleHypothesis) const @@ -227,7 +228,8 @@ Trk::GaussianSumFitter::fit( } // Apply GSF fit to MeasurementBase objects - return fit(measurementSet, + return fit(ctx, + measurementSet, *parametersNearestReference, outlierRemoval, particleHypothesis); @@ -275,7 +277,8 @@ Trk::GaussianSumFitter::fit( } // Apply GSF fit to PrepRawData objects - return fit(prepRawDataSet, + return fit(ctx, + prepRawDataSet, *parametersNearestReference, outlierRemoval, particleHypothesis); @@ -285,8 +288,9 @@ Trk::GaussianSumFitter::fit( Fitting of a set of PrepRawData objects */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::PrepRawDataSet& prepRawDataSet, const Trk::TrackParameters& estimatedParametersNearOrigin, const Trk::RunOutlierRemoval outlierRemoval, @@ -320,7 +324,6 @@ Trk::GaussianSumFitter::fit( prdComparisonFunction); } - const EventContext& ctx= Gaudi::Hive::currentContext(); // Perform GSF forwards fit ForwardTrajectory* forwardTrajectory = m_forwardGsfFitter @@ -365,8 +368,6 @@ Trk::GaussianSumFitter::fit( return nullptr; } - Track* fittedTrack = nullptr; - if (m_makePerigee) { const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface = this->makePerigee(ctx,smoothedTrajectory, particleHypothesis); @@ -393,17 +394,16 @@ Trk::GaussianSumFitter::fit( Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis); info.setTrackProperties(TrackInfo::BremFit); info.setTrackProperties(TrackInfo::BremFitSuccessful); - fittedTrack = new Track(info, smoothedTrajectory, fitQuality); - - return fittedTrack; + return std::make_unique<Track>(info, smoothedTrajectory, fitQuality); } /* * Fitting of a set of MeasurementBase objects */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::MeasurementSet& measurementSet, const Trk::TrackParameters& estimatedParametersNearOrigin, const Trk::RunOutlierRemoval outlierRemoval, @@ -465,7 +465,6 @@ Trk::GaussianSumFitter::fit( measurementBaseComparisonFunction); } - const EventContext& ctx = Gaudi::Hive::currentContext(); // Perform GSF forwards fit - new memory allocated in forwards fitter ForwardTrajectory* forwardTrajectory = m_forwardGsfFitter @@ -540,13 +539,12 @@ Trk::GaussianSumFitter::fit( Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis); info.setTrackProperties(TrackInfo::BremFit); info.setTrackProperties(TrackInfo::BremFitSuccessful); - Track* fittedTrack = new Track(info, smoothedTrajectory, fitQuality); - - return fittedTrack; + return std::make_unique<Track>(info, smoothedTrajectory, fitQuality); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& intrk, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& intrk, const PrepRawDataSet& addPrdColl, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -556,7 +554,7 @@ Trk::GaussianSumFitter::fit(const Track& intrk, if (addPrdColl.empty()) { ATH_MSG_WARNING( "client tries to add an empty PrepRawDataSet to the track fit."); - return fit(intrk, runOutlier, matEffects); + return fit(ctx, intrk, runOutlier, matEffects); } /* determine the Track Parameter which is the start of the trajectory, @@ -584,11 +582,13 @@ Trk::GaussianSumFitter::fit(const Track& intrk, delete inputPreparator; - return fit(orderedPRDColl, *estimatedStartParameters, runOutlier, matEffects); + return fit( + ctx, orderedPRDColl, *estimatedStartParameters, runOutlier, matEffects); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& inputTrack, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& inputTrack, const MeasurementSet& measurementSet, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -598,7 +598,7 @@ Trk::GaussianSumFitter::fit(const Track& inputTrack, if (measurementSet.empty()) { ATH_MSG_WARNING( "Client tries to add an empty MeasurementSet to the track fit."); - return fit(inputTrack, runOutlier, matEffects); + return fit(ctx, inputTrack, runOutlier, matEffects); } // Check that the input track has well defined parameters @@ -624,11 +624,13 @@ Trk::GaussianSumFitter::fit(const Track& inputTrack, inputTrack, measurementSet, true, false); // Apply GSF fit to MeasurementBase objects - return fit(combinedMS, *parametersNearestReference, runOutlier, matEffects); + return fit( + ctx, combinedMS, *parametersNearestReference, runOutlier, matEffects); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& intrk1, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& intrk1, const Track& intrk2, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -690,7 +692,7 @@ Trk::GaussianSumFitter::fit(const Track& intrk1, ms.push_back((*itStates2)->measurementOnTrack()); } - return fit(ms, *minPar, runOutlier, matEffects); + return fit(ctx, ms, *minPar, runOutlier, matEffects); } const Trk::MultiComponentStateOnSurface* diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx index 80513e339cb2ab7739e1472944e4f88d9934fe4e..0dfb08aefafa805c97f66a89de89ec7343c3b7e0 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx @@ -697,8 +697,12 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary( continue; } - nextNavigationCell = m_navigator->nextTrackingVolume( - *navigationPropagator, *navigationParameters, direction, trackingVolume); + nextNavigationCell = m_navigator->nextTrackingVolume(ctx, + *navigationPropagator, + *navigationParameters, + direction, + trackingVolume); + nextVolume = nextNavigationCell.nextVolume; if (navigationPropagatorIndex >= 1) { delete navigationParameters; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx index 40148d8932a38d58810d4d78070e41e436043d53..5300da13fe4504ecf5598e5616d0ecc36bbe5d88 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx @@ -167,9 +167,10 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( } // Calculate the weight of each component after the measurement - PosteriorWeightsCalculator pwc; std::vector<Trk::ComponentParameters> stateWithNewWeights = - pwc.weights(std::move(stateBeforeUpdate), measurement); + PosteriorWeightsCalculator::weights(std::move(stateBeforeUpdate), + measurement); + if (stateWithNewWeights.empty()) { ATH_MSG_DEBUG("Cacluation of state posterior weights failed... Exiting!"); return {}; @@ -293,9 +294,9 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( } // Calculate the weight of each component after the measurement - PosteriorWeightsCalculator pwc; std::vector<Trk::ComponentParameters> stateWithNewWeights = - pwc.weights(std::move(stateBeforeUpdate), measurement); + PosteriorWeightsCalculator::weights(std::move(stateBeforeUpdate), + measurement); if (stateWithNewWeights.empty()) { ATH_MSG_DEBUG("Cacluation of state posterior weights failed... Exiting!"); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx index a783836e913e4398fce7bc7cd72cc7b0bce57951..a95dc5998ea29c27c37158389597d35c37b36054 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx @@ -36,34 +36,21 @@ using namespace GSFUtils; * Based on * https://www.sciencedirect.com/science/article/pii/089812218990103X * equation (16) + * or + * https://arxiv.org/pdf/2001.00727.pdf + * equation (10) * but not accounting for weights * covI * invCovJ + covJ * invCovI + (mean1-mean2) (invcov+invcov) (mean1-mean2) */ -[[maybe_unused]] float +float symmetricKL(const Component1D& componentI, const Component1D& componentJ) { const double meanDifference = componentI.mean - componentJ.mean; const double inverCovSum = componentI.invCov + componentJ.invCov; - return componentI.invCov * componentJ.cov + - componentJ.invCov * componentI.cov + - meanDifference * inverCovSum * meanDifference; -} -/** - * https://arxiv.org/pdf/2001.00727.pdf - * equation (10) - * Same as above but accounting for weights - */ -[[maybe_unused]] float -weightedSymmetricKL(const Component1D& componentI, - const Component1D& componentJ) -{ - const double meanDifference = componentI.mean - componentJ.mean; - const double inverCovSum = componentI.invCov + componentJ.invCov; - const double weightMul = componentI.weight * componentJ.weight; - const double symmetricDis = componentI.invCov * componentJ.cov + - componentJ.invCov * componentI.cov + - meanDifference * inverCovSum * meanDifference; - return weightMul * symmetricDis; + const double term1 = componentI.invCov * componentJ.cov; + const double term2 = componentJ.invCov * componentI.cov; + const double term3 = meanDifference * inverCovSum * meanDifference; + return term1 + term2 + term3; } /** @@ -109,8 +96,8 @@ combine(GSFUtils::Component1D& updated, GSFUtils::Component1D& removed) * new component */ void -recalculateDistances(const componentPtrRestrict componentsIn, - floatPtrRestrict distancesIn, +recalculateDistances(const Component1D* componentsIn, + float* distancesIn, const int32_t mini, const int32_t n) { @@ -140,8 +127,8 @@ recalculateDistances(const componentPtrRestrict componentsIn, * Calculate the distances for all component pairs */ void -calculateAllDistances(const componentPtrRestrict componentsIn, - floatPtrRestrict distancesIn, +calculateAllDistances(const Component1D* componentsIn, + float* distancesIn, const int32_t n) { @@ -163,7 +150,7 @@ calculateAllDistances(const componentPtrRestrict componentsIn, * Reset the distances wrt to a mini index */ void -resetDistances(floatPtrRestrict distancesIn, +resetDistances(float* distancesIn, const int32_t minj, const int32_t n) { @@ -189,7 +176,7 @@ namespace GSFUtils { * which componets got merged */ std::vector<std::pair<int32_t, int32_t>> -findMerges(componentPtrRestrict componentsIn, +findMerges(Component1D* componentsIn, const int32_t inputSize, const int32_t reducedSize) { @@ -219,13 +206,14 @@ findMerges(componentPtrRestrict componentsIn, std::vector<std::pair<int32_t, int32_t>> merges; merges.reserve(inputSize - reducedSize); // initial distance calculation - calculateAllDistances(components, distances, n); + calculateAllDistances(components, distances.buffer(), n); // merge loop int32_t numberOfComponentsLeft = n; while (numberOfComponentsLeft > reducedSize) { // see if we have the next already - const std::pair<int32_t, float> minDis = findMinimumIndex(distances, nn2); + const std::pair<int32_t, float> minDis = + findMinimumIndex(distances.buffer(), nn2); const int32_t minIndex = minDis.first; const triangularToIJ conversion = convert[minIndex]; const int32_t mini = conversion.I; @@ -233,15 +221,16 @@ findMerges(componentPtrRestrict componentsIn, // Combine the 2 components combine(components[mini], components[minj]); // re-calculate distances wrt the new component at mini - recalculateDistances(components, distances, mini, n); + recalculateDistances(components, distances.buffer(), mini, n); // Reset old weights wrt the minj position - resetDistances(distances, minj, n); + resetDistances(distances.buffer(), minj, n); // keep track and decrement merges.emplace_back(mini, minj); --numberOfComponentsLeft; } // end of merge while return merges; } + /** * findMinimumIndex * @@ -286,7 +275,7 @@ findMerges(componentPtrRestrict componentsIn, * in dst. */ __attribute__((target("avx2"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int n) +findMinimumIndex(const float* distancesIn, const int n) { float* array = (float*)__builtin_assume_aligned(distancesIn, alignment); const __m256i increment = _mm256_set1_epi32(8); @@ -348,7 +337,7 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) * latency. */ __attribute__((target("sse4.1"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int n) +findMinimumIndex(const float* distancesIn, const int n) { float* array = (float*)__builtin_assume_aligned(distancesIn, alignment); // Do 2 vectors of 4 elements , so 8 at time @@ -375,17 +364,21 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) minindices2 = _mm_blendv_epi8(minindices2, indices2, lt2); minvalues2 = _mm_min_ps(values2, minvalues2); } - // Do the final calculation scalar way - alignas(alignment) float distances[8]; - alignas(alignment) int32_t indices[8]; + + // Compare //1 with //2 + __m128i lt = _mm_castps_si128(_mm_cmplt_ps(minvalues1, minvalues2)); + minindices1 = _mm_blendv_epi8(minindices2, minindices1, lt); + minvalues1 = _mm_min_ps(minvalues2, minvalues1); + + // Do the final 4 scalar way + alignas(alignment) float distances[4]; + alignas(alignment) int32_t indices[4]; _mm_store_ps(distances, minvalues1); - _mm_store_ps(distances + 4, minvalues2); _mm_store_si128((__m128i*)(indices), minindices1); - _mm_store_si128((__m128i*)(indices + 4), minindices2); int32_t minIndex = indices[0]; float minDistance = distances[0]; - for (int i = 1; i < 8; ++i) { + for (int i = 1; i < 4; ++i) { if (distances[i] < minDistance) { minIndex = indices[i]; minDistance = distances[i]; @@ -395,7 +388,7 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) } /* * SSE2 does not have a blend/select instruction. - * Instruction describes in + * To create one * We AND & * - a with the NOT of the mask * - b with the mask @@ -407,7 +400,7 @@ SSE2_mm_blendv_epi8(__m128i a, __m128i b, __m128i mask) return _mm_or_si128(_mm_andnot_si128(mask, a), _mm_and_si128(mask, b)); } __attribute__((target("sse2"))) std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int n) +findMinimumIndex(const float* distancesIn, const int n) { float* array = (float*)__builtin_assume_aligned(distancesIn, alignment); // Do 2 vectors of 4 elements, so 8 at a time @@ -434,22 +427,27 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) minindices2 = SSE2_mm_blendv_epi8(minindices2, indices2, lt2); minvalues2 = _mm_min_ps(values2, minvalues2); } - // Do the final calculation scalar way - alignas(alignment) float distances[8]; - alignas(alignment) int32_t indices[8]; + + // Compare //1 with //2 + __m128i lt = _mm_castps_si128(_mm_cmplt_ps(minvalues1, minvalues2)); + minindices1 = SSE2_mm_blendv_epi8(minindices2, minindices1, lt); + minvalues1 = _mm_min_ps(minvalues2, minvalues1); + + // Do the final 4 scalar way + alignas(alignment) float distances[4]; + alignas(alignment) int32_t indices[4]; _mm_store_ps(distances, minvalues1); - _mm_store_ps(distances + 4, minvalues2); _mm_store_si128((__m128i*)(indices), minindices1); - _mm_store_si128((__m128i*)(indices + 4), minindices2); int32_t minIndex = indices[0]; float minDistance = distances[0]; - for (int i = 1; i < 8; ++i) { + for (int i = 1; i < 4; ++i) { if (distances[i] < minDistance) { minIndex = indices[i]; minDistance = distances[i]; } } + return { minIndex, minDistance }; } #endif // end of x86_64 versions @@ -457,7 +455,7 @@ findMinimumIndex(const floatPtrRestrict distancesIn, const int n) __attribute__((target("default"))) #endif // HAVE_FUNCTION_MULTIVERSIONING std::pair<int32_t, float> -findMinimumIndex(const floatPtrRestrict distancesIn, const int n) +findMinimumIndex(const float* distancesIn, const int n) { float* array = (float*)__builtin_assume_aligned(distancesIn, alignment); float minDistance = array[0]; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx index 09bb2cadce6b33d7fe637a0d0ca79503738e9631..6a7df3538a3181e8e1d5a6b71e940b1d7c319e27 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx @@ -15,7 +15,7 @@ #include "TrkParameters/TrackParameters.h" namespace { -constexpr double invsqrt2PI = 1. / sqrt(2. * M_PI); +const double invsqrt2PI = 1. / sqrt(2. * M_PI); /** bried method to determine the value of the a gaussian distribution at a * given value */ diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx index 23fc5777c24b1a964ef07b8fa9fe60eba5737163..feca067010681660ae3981f9f3616103e91110d5 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx @@ -2,36 +2,129 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/********************************************************************************* - PosteriorWeightsCalculator.cxx - description - ----------------------------------------------- -created : Wednesday 22nd December 2004 -author : amorley, atkinson -email : Anthony.Morley@cern.ch, Tom.Atkinson@cern.ch -description : Implementation code for PosteriorWeightsCalculator class -*********************************************************************************/ - +/** + * @file PosteriorWeightsCalculator.cxx + * @date Wednesday 22nd December 2004 + * @author Tom Atkinson Anthony Morley, Christos Anastopoulos + * + * Implementation of PosteriorWeightsCalculator.cxx + */ #include "TrkGaussianSumFilter/PosteriorWeightsCalculator.h" +#include "TrkEventPrimitives/LocalParameters.h" +#include "TrkEventPrimitives/ProjectionMatricesSet.h" #include "TrkEventPrimitives/FitQuality.h" #include "TrkEventPrimitives/LocalParameters.h" -#include "TrkMeasurementBase/MeasurementBase.h" #include "TrkParameters/TrackParameters.h" +namespace { + +using namespace Trk; +// expansion and reduction matrices set +static const ProjectionMatricesSet reMatrices(5); + +template<int DIM> +std::pair<double, double> +calculateWeight_T(const TrackParameters* componentTrackParameters, + const AmgSymMatrix(5) * predictedCov, + const AmgVector(DIM) & measPar, + const AmgSymMatrix(DIM) & measCov, + int paramKey) +{ + // Define the expansion matrix + const AmgMatrix(DIM, 5) H = + reMatrices.expansionMatrix(paramKey).block<DIM, 5>(0, 0); + + // Calculate the residual + AmgVector(DIM) r = measPar - H * componentTrackParameters->parameters(); + // Residual covariance. Posterior weights is calculated used predicted state + // and measurement. Therefore add covariances + AmgSymMatrix(DIM) R(measCov + H * (*predictedCov) * H.transpose()); + // compute determinant of residual + const double det = R.determinant(); + if (det == 0) { + return std::pair<double, double>(0, 0); + } + // Compute Chi2 + return std::pair<double, double>( + det, (1. / (double)DIM) * ((r.transpose() * R.inverse() * r)(0, 0))); +} + +std::pair<double, double> +calculateWeight_1D(const TrackParameters* componentTrackParameters, + const AmgSymMatrix(5) * predictedCov, + const double measPar, + const double measCov, + int paramKey) +{ + // use measuring coordinate (variable "mk") instead of reduction matrix + int mk = 0; + if (paramKey != 1) { + for (int i = 0; i < 5; ++i) { + if (paramKey & (1 << i)) { + mk = i; + break; + } + } + } + + // Calculate the residual + const double r = measPar - (componentTrackParameters->parameters())(mk); + // Residual covariance. Posterior weights is calculated used predicted state + // and measurement. Therefore add covariances + const double R = measCov + (*predictedCov)(mk, mk); + if (R == 0) { + return std::pair<double, double>(0, 0); + } + // Compute Chi2 + return std::pair<double, double>(R, r * r / R); +} + +std::pair<double, double> +calculateWeight_2D_3(const TrackParameters* componentTrackParameters, + const AmgSymMatrix(5) * predictedCov, + const AmgVector(2) & measPar, + const AmgSymMatrix(2) & measCov) +{ + // Calculate the residual + AmgVector(2) r = + measPar - componentTrackParameters->parameters().block<2, 1>(0, 0); + // Residual covariance. Posterior weights is calculated used predicted state + // and measurement. Therefore add covariances + AmgSymMatrix(2) R(measCov + predictedCov->block<2, 2>(0, 0)); + // compute determinant of residual + const double det = R.determinant(); + if (det == 0) { + return std::pair<double, double>(0, 0); + } + // Compute Chi2 + return std::pair<double, double>( + det, 0.5 * ((r.transpose() * R.inverse() * r)(0, 0))); +} + +}//end of anonymous namespace + std::vector<Trk::ComponentParameters> -Trk::PosteriorWeightsCalculator::weights( - MultiComponentState&& predictedState, - const MeasurementBase& measurement) const +Trk::PosteriorWeightsCalculator::weights(MultiComponentState&& predictedState, + const MeasurementBase& measurement) { const size_t predictedStateSize = predictedState.size(); if (predictedStateSize == 0) { return {}; } + const Trk::LocalParameters& measurementLocalParameters = + measurement.localParameters(); + int nLocCoord = measurement.localParameters().dimension(); + + if (nLocCoord < 1 || nLocCoord > 5) { + return {}; + } + std::vector<Trk::ComponentParameters> returnMultiComponentState{}; - std::vector<double> componentDeterminantR; - std::vector<double> componentChi2; returnMultiComponentState.reserve(predictedStateSize); + std::vector<double> componentDeterminantR; componentDeterminantR.reserve(predictedStateSize); + std::vector<double> componentChi2; componentChi2.reserve(predictedStateSize); // Calculate chi2 and determinant of each component. @@ -39,7 +132,6 @@ Trk::PosteriorWeightsCalculator::weights( // Loop over all components in the prediction state Trk::MultiComponentState::iterator component = predictedState.begin(); - for (; component != predictedState.end(); ++component) { const Trk::TrackParameters* componentTrackParameters = @@ -55,55 +147,57 @@ Trk::PosteriorWeightsCalculator::weights( if (!predictedCov) { continue; } - - const Trk::LocalParameters& measurementLocalParameters = - measurement.localParameters(); std::pair<double, double> result(0, 0); - int nLocCoord = measurement.localParameters().dimension(); - if (nLocCoord == 1) { - result = calculateWeight_1D(componentTrackParameters, - predictedCov, - measurementLocalParameters(0), - measurement.localCovariance()(0, 0), - measurementLocalParameters.parameterKey()); - } else if (nLocCoord == 2) { - if (measurementLocalParameters.parameterKey() == 3) { + switch (nLocCoord) { + case 1: { + result = calculateWeight_1D(componentTrackParameters, + predictedCov, + measurementLocalParameters(0), + measurement.localCovariance()(0, 0), + measurementLocalParameters.parameterKey()); + } break; + case 2: { + if (measurementLocalParameters.parameterKey() == 3) { + result = calculateWeight_2D_3( + componentTrackParameters, + predictedCov, + measurementLocalParameters.block<2, 1>(0, 0), + measurement.localCovariance().block<2, 2>(0, 0)); + } else { + result = calculateWeight_T<2>( + componentTrackParameters, + predictedCov, + measurementLocalParameters.block<2, 1>(0, 0), + measurement.localCovariance().block<2, 2>(0, 0), + measurementLocalParameters.parameterKey()); + } + } break; + case 3: { + result = + calculateWeight_T<3>(componentTrackParameters, + predictedCov, + measurementLocalParameters.block<3, 1>(0, 0), + measurement.localCovariance().block<3, 3>(0, 0), + measurementLocalParameters.parameterKey()); + } break; + case 4: { result = - calculateWeight_2D_3(componentTrackParameters, + calculateWeight_T<4>(componentTrackParameters, predictedCov, - measurementLocalParameters.block<2, 1>(0, 0), - measurement.localCovariance().block<2, 2>(0, 0)); - } else { + measurementLocalParameters.block<4, 1>(0, 0), + measurement.localCovariance().block<4, 4>(0, 0), + measurementLocalParameters.parameterKey()); + } break; + case 5: { result = - calculateWeight_T<2>(componentTrackParameters, + calculateWeight_T<5>(componentTrackParameters, predictedCov, - measurementLocalParameters.block<2, 1>(0, 0), - measurement.localCovariance().block<2, 2>(0, 0), + measurementLocalParameters.block<5, 1>(0, 0), + measurement.localCovariance().block<5, 5>(0, 0), measurementLocalParameters.parameterKey()); + } break; + default: { } - } else if (nLocCoord == 3) { - result = - calculateWeight_T<3>(componentTrackParameters, - predictedCov, - measurementLocalParameters.block<3, 1>(0, 0), - measurement.localCovariance().block<3, 3>(0, 0), - measurementLocalParameters.parameterKey()); - } else if (nLocCoord == 4) { - result = - calculateWeight_T<4>(componentTrackParameters, - predictedCov, - measurementLocalParameters.block<4, 1>(0, 0), - measurement.localCovariance().block<4, 4>(0, 0), - measurementLocalParameters.parameterKey()); - } else if (nLocCoord == 5) { - result = - calculateWeight_T<5>(componentTrackParameters, - predictedCov, - measurementLocalParameters.block<5, 1>(0, 0), - measurement.localCovariance().block<5, 5>(0, 0), - measurementLocalParameters.parameterKey()); - } else { - break; } if (result.first == 0) { @@ -116,17 +210,14 @@ Trk::PosteriorWeightsCalculator::weights( if (result.second < minimumChi2) { minimumChi2 = result.second; } - } // end loop over components if (componentDeterminantR.size() != predictedState.size() || componentChi2.size() != predictedState.size()) { - returnMultiComponentState.clear(); return {}; } // Calculate posterior weights. - unsigned int index(0); double sumWeights(0.); @@ -168,64 +259,6 @@ Trk::PosteriorWeightsCalculator::weights( (*returnComponent).second = component->second; } } - return returnMultiComponentState; } -std::pair<double, double> -Trk::PosteriorWeightsCalculator::calculateWeight_1D( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const double measPar, - const double measCov, - int paramKey) const -{ - // use measuring coordinate (variable "mk") instead of reduction matrix - int mk = 0; - if (paramKey != 1) { - for (int i = 0; i < 5; ++i) { - if (paramKey & (1 << i)) { - mk = i; - break; - } - } - } - - // Calculate the residual - const double r = measPar - (componentTrackParameters->parameters())(mk); - - // Residual covariance. Posterior weights is calculated used predicted state - // and measurement. Therefore add covariances - const double R = measCov + (*predictedCov)(mk, mk); - - if (R == 0) { - return std::pair<double, double>(0, 0); - } - // Compute Chi2 - return std::pair<double, double>(R, r * r / R); -} - -std::pair<double, double> -Trk::PosteriorWeightsCalculator::calculateWeight_2D_3( - const TrackParameters* componentTrackParameters, - const AmgSymMatrix(5) * predictedCov, - const AmgVector(2) & measPar, - const AmgSymMatrix(2) & measCov) const -{ - // Calculate the residual - AmgVector(2) r = - measPar - componentTrackParameters->parameters().block<2, 1>(0, 0); - // Residual covariance. Posterior weights is calculated used predicted state - // and measurement. Therefore add covariances - AmgSymMatrix(2) R(measCov + predictedCov->block<2, 2>(0, 0)); - // compute determinant of residual - const double det = R.determinant(); - if (det == 0) { - // ATH_MSG_WARNING( "Determinant is 0, cannot invert matrix... Ignoring - // component" ); - return std::pair<double, double>(0, 0); - } - // Compute Chi2 - return std::pair<double, double>( - det, 0.5 * ((r.transpose() * R.inverse() * r)(0, 0))); -} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx index 92e9d07c9e5027992f71bb559f0d4e8717d24007..6b8f537fcd5f7547d7b65aaf0ccb5ccd8771fee2 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx @@ -84,7 +84,7 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray( // Gather the merges const std::vector<std::pair<int32_t, int32_t>> merges = - findMerges(components, n, maximumNumberOfComponents); + findMerges(components.buffer(), n, maximumNumberOfComponents); // Do the full 5D calculations of the merge for (const auto& mergePair : merges) { diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/test/testMergeComponents.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testMergeComponents.cxx index f4149e21e9e7c71b8f7b98cd161f2caff97237c3..59e02333896165f79e1641b62a2c45153a4fb4ad 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/test/testMergeComponents.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testMergeComponents.cxx @@ -97,7 +97,8 @@ main() components[i].invCov = input[i].invCov; components[i].weight = input[i].weight; } - std::vector<std::pair<int32_t, int32_t>> mergeOrder=findMerges(components,n,12); + std::vector<std::pair<int32_t, int32_t>> mergeOrder = + findMerges(components.buffer(), n, 12); for (const auto& i : mergeOrder){ std::cout << "[" << i.first << ", " << i.second << "]" << '\n'; } diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h index eed6c07f1cae6489a33f290f41e66765b8f17936..4298bfdabba3a3df77893f9d1c39ee3977944901 100755 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h @@ -148,56 +148,61 @@ namespace Trk { virtual ~ GlobalChi2Fitter(); - StatusCode initialize(); - StatusCode finalize(); - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + virtual Track *fit( const PrepRawDataSet &, - const TrackParameters &, + const TrackParameters &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const MeasurementSet &, const TrackParameters &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override ; virtual Track *fit( const Track &, const PrepRawDataSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const MeasurementSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track* alignmentFit( AlignmentCache&, const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; private: void calculateJac( diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 214e26d174a3995d7ee3b32d3e250237d4c0e079..8f8fa3cca2aeac0d633408bdf1689d7274ee23c3 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -53,7 +53,6 @@ #include "TrkExInterfaces/IExtrapolator.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkExInterfaces/INavigator.h" -#include "TrkExInterfaces/IEnergyLossCalculator.h" #include "TrkExInterfaces/IMultipleScatteringUpdator.h" #include "TrkExInterfaces/IEnergyLossUpdator.h" #include "TrkExInterfaces/IMaterialEffectsUpdator.h" diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h index 869cca2e2d6ddebc39ca531307a9cbb864e313c0..5626b399f11d7d5383e9cf50c53ced5fd48a6f26 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h @@ -67,10 +67,10 @@ public: */ virtual StatusCode configureWithTools(const Trk::IExtrapolator*, const Trk::IUpdator*, const Trk::IRIO_OnTrackCreator*, - const Trk::IDynamicNoiseAdjustor* = 0, - const Trk::IAlignableSurfaceProvider* = 0, - const Trk::IMeasurementRecalibrator* = 0, - const Trk::IKalmanPiecewiseAnnealingFilter* = 0); + const Trk::IDynamicNoiseAdjustor* = nullptr, + const Trk::IAlignableSurfaceProvider* = nullptr, + const Trk::IMeasurementRecalibrator* = nullptr, + const Trk::IKalmanPiecewiseAnnealingFilter* = nullptr); //! standard athena AlgTool initialize StatusCode initialize(); @@ -131,7 +131,7 @@ private: //! internal method printing the current state void printGlobalParams(int istate, std::string ptype, const TrackParameters*, - const DNA_MaterialEffects* = 0) const; + const DNA_MaterialEffects* = nullptr) const; // all toolhandles are passed in through a configure method, for reasons of // consistency among the KF-subtools and to avoid recursive tool retrieval diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h index ae91959aca55516bda0d3cd5eb585e84011a68de..5e1ef675f133ee25ea486b98515ee9ff926d87e9 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -68,10 +68,10 @@ public: */ virtual StatusCode configureWithTools(const Trk::IExtrapolator*, const Trk::IUpdator*, const Trk::IRIO_OnTrackCreator*, - const Trk::IDynamicNoiseAdjustor* = 0, - const Trk::IAlignableSurfaceProvider* =0, - const Trk::IMeasurementRecalibrator* = 0, - const Trk::IKalmanPiecewiseAnnealingFilter* =0); + const Trk::IDynamicNoiseAdjustor* = nullptr, + const Trk::IAlignableSurfaceProvider* =nullptr, + const Trk::IMeasurementRecalibrator* = nullptr, + const Trk::IKalmanPiecewiseAnnealingFilter* =nullptr); //! standard athena AlgTool initialize StatusCode initialize(); diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h index a8323a0950873d6b39b1a81cdc6c483256a30fa2..6b405e93df0fdd5b115ef9e0c1047fe515d51831 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -72,56 +72,61 @@ namespace Trk { virtual ~KalmanFitter(); // standard Athena methods - StatusCode initialize(); - StatusCode finalize(); - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + //! refit a track virtual Track* fit(const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! fit a set of PrepRawData objects virtual Track* fit(const PrepRawDataSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! fit a set of MeasurementBase objects virtual Track* fit(const MeasurementSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! extend a track fit including a new set of PrepRawData objects virtual Track* fit(const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! extend a track fit including a new set of MeasurementBase objects virtual Track* fit(const Track&, const MeasurementSet&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! combined track fit virtual Track* fit(const Track&, const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; /** @brief retrieve statuscode of last fit. particularly designed for accessing a more detailed reason for failed fits, which otherwise are indicated only by the returned NULL pointer. */ - virtual Trk::FitterStatusCode statusCodeOfLastFit() const; + virtual Trk::FitterStatusCode statusCodeOfLastFit() const override; /////////////////////////////////////////////////////////////////// // Private methods: diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h index 6641f8efaedf43b17092014e43e97aa081bfa846..54719f5163546608eaff2f224c853e70aeeb774f 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ private: //! internal method printing the current state (debugging) void printGlobalParams(int istate, std::string ptype, const TrackParameters*, - const DNA_MaterialEffects* = 0) const; + const DNA_MaterialEffects* = nullptr) const; /** @brief method trying to define inital error for bw smoother in a smart way. diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx index d62ceec819a4b95d30d0ecd95102bd862e737d1a..83d12fba83811c42d25128f5194c50fb801b7ac7 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx @@ -179,7 +179,7 @@ Trk::ForwardKalmanFitter::fit(Trk::Trajectory& trajectory, ATH_MSG_VERBOSE ("Prepare the old start parameters..."); // copy input TrkParameter into prediction without Errors const TrackParameters* updatedPar = estParamNear0.clone(); - Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = 0; + Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = nullptr; // loop over all PreRawData objects in Set int itcounter=1; @@ -253,8 +253,8 @@ Trk::ForwardKalmanFitter::fit(Trk::Trajectory& trajectory, } if (allowRecalibrate) m_utility->identifyMeasurements(trajectory); Trk::Trajectory::iterator it = m_utility->firstFittableState(trajectory); - const TrackParameters* updatedPar = 0; // delete & remake during filter - Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = 0; + const TrackParameters* updatedPar = nullptr; // delete & remake during filter + Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = nullptr; ATH_MSG_DEBUG ("-F- entering FwFilter with matEff="<<controlledMatEffects.particleType()<< ", "<<(allowRecalibrate?"recalibrate:yes":"recalibrate:no")<< " and start state "<<filterStartState); @@ -375,7 +375,7 @@ const Trk::TrackParameters* Trk::ForwardKalmanFitter::predict m_alignableSurfaceProvider->retrieveAlignableSurface(nominalDestSurface): nominalDestSurface ; - const Trk::TrackParameters* predPar = 0; + const Trk::TrackParameters* predPar = nullptr; if (filterCounter == 1) { //////////////////////////////////////////////////////////////////////////// @@ -468,7 +468,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory Trk::ProtoTrackStateOnSurface*& bremEffectsState, const bool allowRecalibrate) const { - bremEffectsState = 0; // means no brem + bremEffectsState = nullptr; // means no brem const MeasurementBase* fittableMeasurement = predictedState->measurement(); int I = predictedState->positionOnTrajectory(); @@ -497,7 +497,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory if(!predPar) { ATH_MSG_DEBUG ((I<10?"T0":"T") << I << " --- missed surface with " << "extrapolation, flag state as outlier --- " ); - if (0 != dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(fittableMeasurement) ) { + if (nullptr != dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(fittableMeasurement) ) { ATH_MSG_INFO ("lost PseudoMeasurement during fwd extrapolation - " << "PM-surface or sorting problem."); if (msgLvl(MSG::DEBUG)) { @@ -535,7 +535,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory // search for brem and adjust the error according to target measurement (brem fit) if (filterCounter>2) { const Trk::DNA_MaterialEffects* updMomNoise = - !controlledMatEffects.doDNA() ? 0 : + !controlledMatEffects.doDNA() ? nullptr : m_dynamicNoiseAdjustor->DNA_Adjust(predPar, // change according to where meas is updatedPar, // re-start from old pars fittableMeasurement, // the meas't @@ -610,7 +610,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::updateOrSkip // if extrapolation had failed, skip this method altogether. if (predPar==nullptr) return FitterStatusCode::Success; const MeasurementBase* fittableMeasurement = predictedState->measurement(); - FitQualityOnSurface* fitQuality=0; + FitQualityOnSurface* fitQuality=nullptr; delete updatedPar; //////////////////////////////////////////////////////////////////// @@ -683,7 +683,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::updateOrSkip ); fittableMeasurement = predictedState->measurement(); ATH_MSG_DEBUG ("Broadened TRT hit instead of outlier"); - delete updatedPar; delete fitQuality; fitQuality=0; + delete updatedPar; delete fitQuality; fitQuality=nullptr; //////////////////////////////////////////////////////////////////// // make the update updatedPar = m_updator->addToState(*predPar, fittableMeasurement->localParameters(), @@ -758,7 +758,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::enterSeedIntoTrajectory return FitterStatusCode::BadInput; } const Trk::Surface& startSurface = ffs->measurement()->associatedSurface(); - const Trk::TrackParameters* inputParAtStartSurface = 0; + const Trk::TrackParameters* inputParAtStartSurface = nullptr; // chk if TPar are already in correct local frame: first pointer check (quick) then geometric if ( &startSurface == &inputPar.associatedSurface() || diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx index 8a65a3ec6ae5ea75b4e616e22f76b436d7dfaef1..5ae320df75642846fe84ea5bfa112b54f1d0e098 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx @@ -11,6 +11,10 @@ // Markus.Elsing@cern.ch /////////////////////////////////////////////////////////////////// +#include <memory> + + + #include "TrkKalmanFitter/ForwardRefTrackKalmanFitter.h" #include "AtlasDetDescr/AtlasDetectorID.h" #include "TrkFitterUtils/FitterStatusCode.h" @@ -193,15 +197,15 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, return FitterStatusCode::BadInput; } - const TransportJacobian* jacobian = 0; + const TransportJacobian* jacobian = nullptr; ////////////////////////////////////////////////////////////////////////////////////////// // the regular filter loop after finding the correct initialisation for( ; it!=trajectory.end(); it++) { - const AmgVector(5)* predDiffPar = 0; - const AmgSymMatrix(5)* predDiffCov = 0; - if (jacobian==0) { + const AmgVector(5)* predDiffPar = nullptr; + const AmgSymMatrix(5)* predDiffCov = nullptr; + if (jacobian==nullptr) { ATH_MSG_DEBUG ("-F- beginning of trajectory, have already predPar"); predDiffPar = it->parametersDifference(); predDiffCov = it->parametersCovariance(); @@ -239,15 +243,14 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, const MeasurementBase* fittableMeasurement = it->measurement(); if ((!fittableMeasurement) || it->isOutlier()) { // pure material state - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(*predDiffPar,*predDiffCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(*predDiffPar,*predDiffCov) ); } else { // Posibly re-calibrate. TRT extension finder leaves many TRT hits as wire-hits w/o LR solution if (allowRecalibrate && m_recalibrator && it->measurementType() == TrackState::TRT) { const AmgVector(5) x = it->referenceParameters()->parameters()+(*predDiffPar); - const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,nullptr); Trk::TrackState::CalibrationType oldType = it->calibrationType(); // the replaceMeas.-method does ownership right and detects if the @@ -261,14 +264,14 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, delete param; } - Trk::FitQualityOnSurface* fitQS=0; + Trk::FitQualityOnSurface* fitQS=nullptr; updatedDifference.reset( m_updator->updateParameterDifference(*predDiffPar, *predDiffCov, *(it->measurementDifference()), fittableMeasurement->localCovariance(), fittableMeasurement->localParameters().parameterKey(), fitQS, /*doFQ=*/true ) ); - if (!updatedDifference || fitQS == 0) { + if (!updatedDifference || fitQS == nullptr) { delete fitQS; ATH_MSG_DEBUG("update in reference-parameter formalism failed."); return FitterStatusCode::UpdateFailure; @@ -290,7 +293,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, // allow making of wire-hits for TRT fits with L/R-solving on the fly if ( m_recalibrator && it->measurementType() == TrackState::TRT) { const AmgVector(5) x = it->referenceParameters()->parameters()+(*predDiffPar); - const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,nullptr); if ( Trk::SensorBoundsCheck::areParamsInside (*fittableMeasurement, param->parameters(), *predDiffCov, 1.0, -1.0)) { Trk::TrackState::CalibrationType oldType = it->calibrationType(); @@ -301,7 +304,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, fittableMeasurement = it->measurement(); ATH_MSG_VERBOSE ("TRT ROT calibration changed, from "<<oldType<<" to broad hit "<< it->calibrationType()<< " instead of outlier"); - delete fitQS; fitQS=0; + delete fitQS; fitQS=nullptr; updatedDifference.reset( m_updator->updateParameterDifference(*predDiffPar, *predDiffCov, *(it->measurementDifference()), @@ -344,8 +347,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, return FitterStatusCode::BadInput; } // copy over prePar to updatedPar because we ignore this update - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(*predDiffPar,*predDiffCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(*predDiffPar,*predDiffCov) ); } // @TODO fitQS maybe NULL in case it points to an outlier. // Shall this part of the code be reached for outliers ? @@ -398,13 +400,13 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory "trajectory is EMPTY.\n This can not work!"); return FitterStatusCode::BadInput; } - if (ffs->measurement() == NULL) { + if (ffs->measurement() == nullptr) { ATH_MSG_WARNING ("-Fe mess-up in enterSeedIntoTraj: can not find a first measurement!"); trajectory.clear(); return FitterStatusCode::BadInput; } const Trk::Surface& startSurface = ffs->measurement()->associatedSurface(); - const Trk::TrackParameters* inputParAtStartSurface = 0; + const Trk::TrackParameters* inputParAtStartSurface = nullptr; // chk if TPar are already in correct local frame: first pointer check (quick) then geometric if ( &startSurface == &inputPar.associatedSurface() || @@ -418,7 +420,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory startSurface, Trk::anyDirection, false, Trk::nonInteracting); - if (inputParAtStartSurface == NULL) { + if (inputParAtStartSurface == nullptr) { ATH_MSG_WARNING ("-Fe can not transport input param to first measurement => extrap problem or bad input"); ATH_MSG_INFO ("-Fe parameters R="<< inputPar.position().perp() << ", z="<< inputPar.position().z()<<" q/p="<<inputPar.parameters()[Trk::qOverP]<< @@ -431,7 +433,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory } // make first seed for filtering - AmgVector(5)* diffPar = 0; + AmgVector(5)* diffPar = nullptr; if (ffs->referenceParameters()) diffPar = new AmgVector(5)(inputParAtStartSurface->parameters() -ffs->referenceParameters()->parameters()); @@ -452,15 +454,15 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory // lazy initialization because the tracking geometry is built after conditions are there Trk::MagneticFieldProperties useFullField(Trk::FullField); - if (m_idEnclosingVolume == 0 ) m_idEnclosingVolume = + if (m_idEnclosingVolume == nullptr ) m_idEnclosingVolume = m_extrapolator->trackingGeometry()->trackingVolume("InDet::Containers::InnerDetector"); - if (m_msCompleteVolume == 0 ) m_msCompleteVolume = + if (m_msCompleteVolume == nullptr ) m_msCompleteVolume = m_extrapolator->trackingGeometry()->trackingVolume("All::Container::CompleteDetector"); - if (m_idEnclosingVolume==0 && m_msCompleteVolume == 0) { + if (m_idEnclosingVolume==nullptr && m_msCompleteVolume == nullptr) { ATH_MSG_WARNING ("Could not get any detector enclosing volume from tracking geometry."); return FitterStatusCode::BadInput; } - const IPropagator* propagator = 0; + const IPropagator* propagator = nullptr; bool isInsideID = true; if (m_idEnclosingVolume && m_idEnclosingVolume->inside(inputParAtStartSurface->position())) { ATH_MSG_VERBOSE ("subPropagator detection: found id volume of signature ID " << @@ -478,12 +480,12 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory const Trk::TrackParameters* lastPropagatedPar = CREATE_PARAMETERS((*inputParAtStartSurface), - inputParAtStartSurface->parameters(), 0); // remove covariance + inputParAtStartSurface->parameters(), nullptr); // remove covariance for (auto it=m_utility->firstFittableState ( trajectory ); it!=trajectory.end(); ++it) { if (!it->referenceParameters()) { it->checkinReferenceParameters (lastPropagatedPar); } else { - delete lastPropagatedPar; lastPropagatedPar=0; + delete lastPropagatedPar; lastPropagatedPar=nullptr; // FIXME study this further, whether cov really not needed and how close in param // space the old and new references are. ATH_MSG_VERBOSE("At state T"<<it->positionOnTrajectory()<<" have already reference."); @@ -503,7 +505,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory propagator = m_extrapolator->subPropagator(*m_idEnclosingVolume); ATH_MSG_DEBUG ("changed from MS to ID propagator."); } - TransportJacobian* jac = 0; + TransportJacobian* jac = nullptr; double pathLimit = -1.; if (!propagator) { ATH_MSG_WARNING("NO propagator!!"); @@ -538,7 +540,7 @@ void Trk::ForwardRefTrackKalmanFitter::printGlobalParams(int istate, std::string const AmgVector(5)& diff) const { const AmgVector(5) x = ref.parameters()+diff; - const Trk::TrackParameters* param = CREATE_PARAMETERS(ref,x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(ref,x,nullptr); char tt[80]; snprintf(tt,79,"T%.2d",istate); msg(MSG::VERBOSE) << tt << ptype << " GP:" << std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right ) diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx index 02b235cbcbe49efeb161b452f4ec905dd6178ec6..d6ad48c74cb9d2b73240dff9527cc78ca09f3cf1 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx @@ -70,11 +70,11 @@ Trk::KalmanFitter::KalmanFitter(const std::string& t,const std::string& n, m_callValidationTool(false), m_haveValidationTool(false), m_doDNAForElectronsOnly(false), - m_tparScaleSetter(0), + m_tparScaleSetter(nullptr), m_sortingRefPoint(0., 0., 0.), - m_idHelper(0), - m_utility(0), - m_inputPreparator(0), + m_idHelper(nullptr), + m_utility(nullptr), + m_inputPreparator(nullptr), m_cov0(std::vector<double>(0)), m_fitStatus(Trk::FitterStatusCode::BadInput), m_maximalNdof(0), @@ -260,13 +260,13 @@ StatusCode Trk::KalmanFitter::initialize() // main helper to convert different type of inputs into unified trajectory m_inputPreparator = new TrackFitInputPreparator(m_sortingRefPoint, m_forwardFitter->needsReferenceTrajectory()? - (&(*m_extrapolator)) : 0); + (&(*m_extrapolator)) : nullptr); // configure internal DAF if (!m_internalDAF.empty() && - m_internalDAF->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0), + m_internalDAF->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr), m_utility ).isFailure()) { ATH_MSG_WARNING ("failure while configuring internal DAF!"); ATH_MSG_INFO ("debugging info: ex = " << m_extrapolator << " up = " << m_updator << @@ -275,42 +275,42 @@ StatusCode Trk::KalmanFitter::initialize() } // configure ForwardKalmanFitter - StatusCode sc = m_forwardFitter->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_ROTcreator.empty()?(&(*m_ROTcreator)):0), - (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):0), - (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):0), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0), - 0 // for hybrid-fitter use: (!m_internalDAF.empty()?(&(*m_internalDAF)):0) + StatusCode sc = m_forwardFitter->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_ROTcreator.empty()?(&(*m_ROTcreator)):nullptr), + (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):nullptr), + (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):nullptr), + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr), + nullptr // for hybrid-fitter use: (!m_internalDAF.empty()?(&(*m_internalDAF)):0) ); if(sc.isFailure()) return sc; // configure KalmanSmoother - sc = m_smoother->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):0), - (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):0), + sc = m_smoother->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):nullptr), + (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):nullptr), m_option_doSmoothing, true); if(sc.isFailure()) return sc; // configure outlier logic sc = m_outlierLogic->configureWithTools(&(*m_extrapolator), &(*m_updator), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0)); + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr)); if(sc.isFailure()) return sc; // configure outlier logic if (!m_outlierRecovery.empty()) { sc = m_outlierRecovery->configureWithTools(&(*m_extrapolator), &(*m_updator), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0)); + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr)); if(sc.isFailure()) return sc; } // configure DNA tool (if present) if (!m_dynamicNoiseAdjustor.empty()) { - sc = m_dynamicNoiseAdjustor->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0)); + sc = m_dynamicNoiseAdjustor->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr)); if(sc.isFailure()) return sc; } if (!m_dynamicNoiseAdjustor.empty() && !m_alignableSfProvider.empty()) { @@ -414,14 +414,14 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // protection against not having measurements on the input track if (!inputTrack.trackStateOnSurfaces() || inputTrack.trackStateOnSurfaces()->size() < 2) { ATH_MSG_INFO ("called to refit empty track or track with too little information, reject fit"); - return 0; + return nullptr; } /* determine the Track Parameter which is the start of the trajectory, i.e. closest to the reference point */ if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { ATH_MSG_INFO ("input fails to provide track parameters for seeding the KF, reject fit"); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) { ATH_MSG_VERBOSE( "list of parameters as they are on the input track:"); @@ -435,13 +435,13 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, << (m_option_enforceSorting? "via STL sort" : "as first TP (convention)")); } // fill internal trajectory through external preparator class - const TrackParameters* minPar = 0; + const TrackParameters* minPar = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, minPar, inputTrack,m_option_enforceSorting, m_option_reintegrateOutliers, prtHypothesis) == StatusCode::FAILURE) { ATH_MSG_WARNING ("Could not decode input track!"); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -462,12 +462,12 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- perform first forward filter on measurement set extracted from track ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*minPar,m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; m_fitStatus = m_forwardFitter->fit(m_trajectory,*minPar,runOutlier,kalMec,true); if (m_callValidationTool) callValidation(0, kalMec.particleType(), m_fitStatus); // call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(minPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(minPar, fitQual, runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -489,7 +489,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, m_callValidationTool = false; } ATH_MSG_DEBUG( "fit(track) during iterations failed." ); - return 0; + return nullptr; } } @@ -502,7 +502,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, const Trk::ParticleHypothesis prtHypothesis) const { m_fitStatus = Trk::FitterStatusCode::BadInput; - if (!check_operability(1, runOutlier, prtHypothesis,inputPRDColl.empty())) return 0; + if (!check_operability(1, runOutlier, prtHypothesis,inputPRDColl.empty())) return nullptr; bool doDNA = !m_dynamicNoiseAdjustor.empty(); if (m_doDNAForElectronsOnly && prtHypothesis != Trk::electron) doDNA = false; Trk::KalmanMatEffectsController kalMec(prtHypothesis, doDNA); @@ -552,7 +552,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, // call KalmanFilter with iterations on the outliers const Trk::TrackParameters* startPar = &estimatedStartParameters; - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(startPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(startPar, fitQual, runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -564,7 +564,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, } else { delete fitQual; m_trajectory.clear(); - return 0; + return nullptr; } } @@ -576,7 +576,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, const Trk::ParticleHypothesis matEffects) const { m_fitStatus = Trk::FitterStatusCode::BadInput; - if (!check_operability(2 ,runOutlier, matEffects,inputMeasSet.empty())) return 0; + if (!check_operability(2 ,runOutlier, matEffects,inputMeasSet.empty())) return nullptr; bool doDNA = !m_dynamicNoiseAdjustor.empty(); if (m_doDNAForElectronsOnly && matEffects != Trk::electron) doDNA = false; Trk::KalmanMatEffectsController kalMec(matEffects, doDNA); @@ -641,7 +641,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,estimatedStartParameters, m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory, estimatedStartParameters, runOutlier, kalMec, false); @@ -649,7 +649,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, // --- call KalmanFilter with iterations on the outliers const Trk::TrackParameters* startPar = &estimatedStartParameters; - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(startPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(startPar,fitQual,runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory: @@ -670,7 +670,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, m_callValidationTool = false; } ATH_MSG_DEBUG( "fit(vec<MB>) during iteration failed." ); - return 0; + return nullptr; } } @@ -734,14 +734,14 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, } // fill internal trajectory through external preparator class - const TrackParameters* estimatedStartParameters = 0; + const TrackParameters* estimatedStartParameters = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, estimatedStartParameters, inputTrack,addMeasColl, m_option_enforceSorting, m_option_reintegrateOutliers, matEffects) == StatusCode::FAILURE) { ATH_MSG_WARNING( "Could not decode input track!" ); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -763,7 +763,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- perform first forward filter on measurement set extracted from track if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*estimatedStartParameters,m_cov0, kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory, *estimatedStartParameters, runOutlier, kalMec, true); @@ -771,7 +771,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(estimatedStartParameters, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(estimatedStartParameters, fitQual, runOutlier, kalMec, this_eta) ) { @@ -783,7 +783,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, return fittedTrack; } else { delete fitQual; - fitQual = 0; + fitQual = nullptr; m_trajectory.clear(); // iterations failed: // if m_option_callValidationToolForFailedFitsOnly repeat the track fit with calls of validation tool @@ -797,7 +797,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, m_callValidationTool = false; } ATH_MSG_DEBUG ("fit(track,vec<MB>) during iteration failed."); - return 0; + return nullptr; } } @@ -819,7 +819,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, intrk1.trackStateOnSurfaces()->size() < 2) { ATH_MSG_WARNING ("called to refit empty track or track with too little information," << " reject fit"); - return 0; + return nullptr; } /* determine the Track Parameter which is the start of the trajectory, @@ -829,17 +829,17 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) { ATH_MSG_WARNING( "input #1 fails to provide track parameters for seeding the " << "KF, reject fit" ); - return 0; + return nullptr; } // fill internal trajectory through external preparator class - const TrackParameters* minPar = 0; + const TrackParameters* minPar = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, minPar, intrk1,intrk2,m_option_enforceSorting, m_option_reintegrateOutliers, matEffects) == StatusCode::FAILURE) { ATH_MSG_WARNING( "Could not decode input tracks!" ); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -861,13 +861,13 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, // --- perform first forward filter on measurement set extracted from track if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*minPar,m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory,*minPar,runOutlier, kalMec, true); if (m_callValidationTool) callValidation(0, kalMec.particleType(), m_fitStatus); // call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(minPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(minPar,fitQual,runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -890,7 +890,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, } m_callValidationTool = false; } - return 0; + return nullptr; } } @@ -1202,7 +1202,7 @@ bool Trk::KalmanFitter::prepareNextIteration(const unsigned int& upcomingIterati int& iFilterBeginState, const Trk::TrackParameters& backupParams) const { - const Trk::TrackParameters* newSeedPars = 0; + const Trk::TrackParameters* newSeedPars = nullptr; ATH_MSG_VERBOSE ("In ::prepareNextIteration with filterBeginState = "<<iFilterBeginState); // get chi2 asymmetry @@ -1286,7 +1286,7 @@ Trk::Track* Trk::KalmanFitter::makeTrack(const Trk::FitQuality* FQ, << "to form track! **********\n"); if (msgLvl(MSG::DEBUG)) monitorTrackFits( MinimalTrackFailure, this_eta ); m_fitStatus = Trk::FitterStatusCode::FewFittableMeasurements; - return 0; + return nullptr; } else { SmoothedTrajectory* finalTrajectory = new SmoothedTrajectory(); @@ -1299,7 +1299,7 @@ Trk::Track* Trk::KalmanFitter::makeTrack(const Trk::FitQuality* FQ, ATH_MSG_DEBUG ("********** perigee making failed, drop track"); if (msgLvl(MSG::DEBUG)) monitorTrackFits( Trk::KalmanFitter::PerigeeMakingFailure, this_eta ); m_fitStatus = Trk::FitterStatusCode::PerigeeMakingFailure; - delete finalTrajectory; return 0; + delete finalTrajectory; return nullptr; } } else { const TrackStateOnSurface* refState = makeReferenceState(refPar.associatedSurface(), @@ -1366,7 +1366,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee const Trk::ParticleHypothesis matEffects) const { Trajectory::const_iterator it = m_trajectory.begin(); - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; // --- simple case to get "first" track parameters: ID track if (!it->isOutlier() && (it->smoothedTrackParameters()) && @@ -1381,7 +1381,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee } if (parameterTrajectory.empty()) { ATH_MSG_WARNING ("Perigee-making failed: no useful parameters on track!"); - return 0; + return nullptr; } nearestParam = *(std::min_element(parameterTrajectory.begin(), parameterTrajectory.end(), @@ -1395,12 +1395,12 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee false, matEffects); if (!per) { ATH_MSG_DEBUG ("Perigee-making failed: extrapolation did not succeed."); - return 0; + return nullptr; } else ATH_MSG_VERBOSE ("Perigee parameters have been made."); std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(TrackStateOnSurface::Perigee); - return new TrackStateOnSurface(0 , per, 0, 0, typePattern ); + return new TrackStateOnSurface(nullptr , per, nullptr, nullptr, typePattern ); } const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState @@ -1408,11 +1408,11 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState const Trk::ParticleHypothesis matEffects) const { Trajectory::const_iterator it = m_trajectory.begin(); - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; // --- simple case: ref surface was entered at first measurement if (!it->isOutlier() && (&(it->measurement()->associatedSurface()) == &refSurface) ) - return 0; + return nullptr; Trk::TrkParametersComparisonFunction nearestSurfaceDefinition(refSurface.center()); std::vector<const Trk::TrackParameters*> parameterTrajectory; for ( ; it!= m_trajectory.end(); ++it) @@ -1420,7 +1420,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState parameterTrajectory.push_back(it->smoothedTrackParameters()); if (parameterTrajectory.empty()) { ATH_MSG_WARNING ("Reference state making failed: no useful parameters on track!"); - return 0; + return nullptr; } nearestParam = *(std::min_element(parameterTrajectory.begin(), parameterTrajectory.end(), @@ -1432,12 +1432,12 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState false, matEffects); if (!fittedRefParams) { ATH_MSG_DEBUG (" No ref-params made: extrapolation failed."); - return 0; + return nullptr; } else ATH_MSG_VERBOSE ("Reference parameters have been made."); std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(TrackStateOnSurface::Perigee); - return new TrackStateOnSurface(0, fittedRefParams, 0, 0, typePattern ); + return new TrackStateOnSurface(nullptr, fittedRefParams, nullptr, nullptr, typePattern ); } void Trk::KalmanFitter::monitorTrackFits(FitStatisticsCode code, const double& eta) const { @@ -1526,7 +1526,7 @@ void Trk::KalmanFitter::callValidation( int iterationIndex, ATH_MSG_DEBUG( "call validation for track iteration " << iterationIndex << "with status " << fitStatCode.getCode() ); // extrapolate to perigee at origin for validation data const Trk::PerigeeSurface perSurf; // default perigee at origin - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); for ( ; it != m_trajectory.end(); it++ ) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1542,8 +1542,8 @@ void Trk::KalmanFitter::callValidation( int iterationIndex, } } } - const Trk::Perigee* per = 0; - const Trk::TrackParameters* perPar = 0; + const Trk::Perigee* per = nullptr; + const Trk::TrackParameters* perPar = nullptr; if (nearestParam) { // extrapolate to perigee perPar = m_extrapolator->extrapolate( *nearestParam, perSurf, diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx index fbdb638880260941ec430a816f0078dc7c27ae42..505a37674aeb5194f61e56056569f983f80b7a2f 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx @@ -260,7 +260,7 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, "with AFB "<<chi2_AFB<<" trying if this comes from problem in last hits"); int nLastCandidates = 0; double candidateChi2 = 0.0; - Trk::ProtoTrackStateOnSurface* suspiciousState = 0; + Trk::ProtoTrackStateOnSurface* suspiciousState = nullptr; Trk::Trajectory::reverse_iterator rit = Trk::Trajectory::reverse_iterator(++(m_utility->lastFittableState(T))); for( ; rit!=T.rend(); ++rit) { diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx index 70d50cea5ef85c2ed87237e970f959e8c479923e..9732e4d7d5da48aaffda2c6ac2ffd20f33c0e4f6 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -164,7 +164,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, ") -- " << c_outSct<<"("<< c_allSct<<") -- " << c_outTrt<<"("<<c_allTrt<<")"); // === part 1: pixel === recover occas. pixel outliers as broad clusters if SCT is reliable - if (fitIteration <= 2 && m_recalibrator!=NULL + if (fitIteration <= 2 && m_recalibrator!=nullptr && c_allPix > 0 && 2*c_outPix <= c_allPix && 2*c_outSct < c_allSct ) { @@ -178,7 +178,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, m_extrapolator->extrapolate(*restartState->smoothedTrackParameters(), it->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::nonInteracting) : - NULL ); + nullptr ); if (!smoothedParAtOutlier) continue; if ( (it->measurement()->localCovariance()(Trk::locX,Trk::locX) < 0.02*0.02) @@ -186,7 +186,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::MeasurementBase* broadPixel = m_recalibrator->makeBroadMeasurement(*it->measurement(), *smoothedParAtOutlier, Pixel); - if (broadPixel!=NULL) { + if (broadPixel!=nullptr) { if (( broadPixel->localCovariance()(Trk::locX,Trk::locX) > 1.05*1.05* it->measurement()->localCovariance()(Trk::locX,Trk::locX)) && ( broadPixel->localCovariance()(Trk::locY,Trk::locY) @@ -213,7 +213,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, // === part 2: SCT === recover lost SCT filtering (again using broad pixels clusters) // int nSCT = m_utility->numberOfSpecificStates(T,SCT,AnyState); - if (m_recalibrator!=NULL + if (m_recalibrator!=nullptr && (fabs(filterInputPar->parameters()[Trk::qOverP])<0.00125) // dont try on lowPT && (c_allPix - c_outPix > 1 ) && (c_allSct + c_allPix > 7 ) @@ -240,7 +240,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, lastSctState->measurement()->associatedSurface(), Trk::alongMomentum, false, Trk::nonInteracting); - if (sctExitTemp == NULL) { + if (sctExitTemp == nullptr) { ATH_MSG_DEBUG ("-O- can not reproduce trajectory in SCT recovery!"); for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) it->isOutlier(GeneralOutlier,fitIteration); @@ -282,12 +282,12 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, for( ; rit!=T.rend(); ++rit) { if ( rit->measurementType() == SCT) { const Trk::TrackParameters* predPar = - (sctFitResult!=NULL ? + (sctFitResult!=nullptr ? m_extrapolator->extrapolate(*sctFitResult, rit->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::muon) : - NULL); + nullptr); delete sctFitResult; if (!predPar) { ATH_MSG_DEBUG ("-O- internal mini-filter failed in SCT recovery!"); @@ -309,22 +309,22 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, int numberOfChangedStates=0; const Trk::TrackParameters* updatedPar = sctFitResult; - sctFitResult=NULL; + sctFitResult=nullptr; rit = firstSctState_r + 1; // now on last Pixel state! for( ; rit!=T.rend(); ++rit) { const Trk::TrackParameters* filteredPar = - ( updatedPar != NULL ? + ( updatedPar != nullptr ? m_extrapolator->extrapolate(*updatedPar, rit->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::muon) : - NULL ); + nullptr ); delete updatedPar; - const Trk::FitQualityOnSurface* testQuality = (filteredPar==NULL)? NULL : + const Trk::FitQualityOnSurface* testQuality = (filteredPar==nullptr)? nullptr : m_updator->predictedStateFitQuality(*filteredPar, rit->measurement()->localParameters(), rit->measurement()->localCovariance()); - if (testQuality == NULL) { + if (testQuality == nullptr) { ATH_MSG_DEBUG ("-O- can not reproduce trajectory at the end of SCT recovery!"); for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) it->isOutlier(GeneralOutlier,fitIteration); @@ -340,7 +340,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, && (rit->measurement()->localCovariance()(Trk::locY) < 0.2) ) { const Trk::MeasurementBase* broadPixel = m_recalibrator->makeBroadMeasurement(*rit->measurement(), *filteredPar, Pixel); - if (broadPixel!=NULL) { + if (broadPixel!=nullptr) { if (( broadPixel->localCovariance()(Trk::locX) > rit->measurement()->localCovariance()(Trk::locX)) && ( broadPixel->localCovariance()(Trk::locY) @@ -372,14 +372,14 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, if (!testQuality || testQuality->chiSquared() > 4*m_State_Chi2PerNdfCut * testQuality->numberDoF() ) { updatedPar = filteredPar; - filteredPar=NULL; + filteredPar=nullptr; ATH_MSG_DEBUG ("At "<<rit->positionOnTrajectory() <<": decided not to use this state, chi2="<< (testQuality ? testQuality->chiSquared() : -1.0) ); } else { updatedPar = m_updator->addToState(*filteredPar, rit->measurement()->localParameters(), rit->measurement()->localCovariance()); - if (updatedPar==NULL) updatedPar=filteredPar; else delete filteredPar; + if (updatedPar==nullptr) updatedPar=filteredPar; else delete filteredPar; ATH_MSG_DEBUG ("At "<<rit->positionOnTrajectory()<<": using this state to proceed."); } if (!testQuality || @@ -426,15 +426,15 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, } // stop recovery for bad cases // === part 3: TRT === - if (c_allTrt-c_outTrt > 0 && m_recalibrator!=NULL ) { + if (c_allTrt-c_outTrt > 0 && m_recalibrator!=nullptr ) { if (numberOfRejections > 0 ) { for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) { if (msgLvl(MSG::VERBOSE)) { - const Trk::RIO_OnTrack* rot=0; + const Trk::RIO_OnTrack* rot=nullptr; Trk::RoT_Extractor::extract(rot,it->measurement()); - if (it->isDriftCircle() && rot!=NULL && rot->prepRawData()!=NULL) + if (it->isDriftCircle() && rot!=nullptr && rot->prepRawData()!=nullptr) msg(MSG::VERBOSE) << "Testing L/R of " << (it->isOutlier() ? "Outl." : "Hit " ) << it->positionOnTrajectory() << " : Par = " << (it->smoothedTrackParameters() ? @@ -447,7 +447,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::TrackParameters* refTrkPar = it->smoothedTrackParameters(); // step 1 - try re-integrating drift radius outliers as tube hit inlayers - if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=NULL + if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=nullptr && (it->trackStateType() == Trk::TrackState::StateOutlier || it->trackStateType() == Trk::TrackState::TrackOutlier) && it->iterationShowingThisOutlier() == fitIteration @@ -457,7 +457,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::RIO_OnTrack* recalibratedROT = m_recalibrator->makeBroadMeasurement(*it->measurement(),*refTrkPar, Trk::TrackState::TRT); - if (recalibratedROT!=NULL) { + if (recalibratedROT!=nullptr) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "-O- re-integrating drift circle outlier dR=" << it->measurement()->localCovariance()(Trk::locR); it->replaceMeasurement(recalibratedROT,Trk::TrackState::TubeHit); @@ -468,7 +468,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, } else // step 2 - try re-integrating tube hits as drift radius hits - if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=NULL + if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=nullptr && !it->isOutlier() && (Trk::TrackState::TubeHit == m_recalibrator->calibrationStatus(*it->measurement(),Trk::TrackState::TRT)) @@ -508,7 +508,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) { const Trk::RIO_OnTrack* trt=dynamic_cast<const Trk::RIO_OnTrack*>(it->measurement()); if (it->measurementType() == Trk::TrackState::TRT - && !it->isOutlier() && it->smoothedTrackParameters()!=NULL + && !it->isOutlier() && it->smoothedTrackParameters()!=nullptr && trt && trt->prepRawData() ) { bool tubeHitMade=false; if ( (m_recalibrator->calibrationStatus(*it->measurement(),Trk::TrackState::TRT) diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx index 36e305113270114d79fefb7953f5d5a6c11f9a60..90da23c3f950914a4703263d057f179b05274d6e 100644 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx @@ -1,11 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// // KalmanPiecewiseAnnealingFilter.cxx, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// +#include <memory> + + + #include "TrkKalmanFitter/KalmanPiecewiseAnnealingFilter.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" @@ -101,7 +105,7 @@ StatusCode Trk::KalmanPiecewiseAnnealingFilter::configureWithTools const Trk::ProtoTrajectoryUtility* utility, const Trk::IDynamicNoiseAdjustor* dna) { - if (extrap==NULL || updator == NULL || recalibrator == NULL || utility==NULL) + if (extrap==nullptr || updator == nullptr || recalibrator == nullptr || utility==nullptr) return StatusCode::FAILURE; m_extrapolator = extrap; m_updator = updator; @@ -112,12 +116,12 @@ StatusCode Trk::KalmanPiecewiseAnnealingFilter::configureWithTools // configure piecewise ForwardKalmanFitter StatusCode sc; sc = m_forwardFitter->configureWithTools(const_cast<Trk::IExtrapolator*>(m_extrapolator), m_updator, - 0 /* no rot-creator needed */, m_dynamicNoiseAdjustor); + nullptr /* no rot-creator needed */, m_dynamicNoiseAdjustor); if(sc.isFailure()) return sc; sc = m_smoother->configureWithTools(const_cast<Trk::IExtrapolator*>(m_extrapolator), m_updator, m_dynamicNoiseAdjustor, - 0, // no alignable Surface Provider + nullptr, // no alignable Surface Provider true, // always do smoothing false); // no creation of FitQualityOnSurface objects (DAF-like) if(sc.isFailure()) return sc; @@ -217,7 +221,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT == NULL || it->isOutlier()) continue; + if (compROT == nullptr || it->isOutlier()) continue; double assPrb = compROT->assignmentProbability(compROT->indexOfMaxAssignProb()); double msErrX = sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)); @@ -238,7 +242,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all const Trk::RIO_OnTrack* broadCluster = m_recalibrator->makeBroadMeasurement(*compROT, *refPars, it->measurementType()); - if (broadCluster!=NULL) { + if (broadCluster!=nullptr) { ATH_MSG_DEBUG ("annealing in silicon deemed to be failing, replace CompROT-cluster dLocX="<< sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)) <<" by hit with dLocX="<<sqrt(broadCluster->localCovariance()(Trk::locX,Trk::locX))); @@ -289,7 +293,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT == NULL || it->isOutlier()) continue; + if (compROT == nullptr || it->isOutlier()) continue; double msErrX = sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)); double msErrY = (compROT->localParameters().contains(Trk::locY) ? @@ -307,7 +311,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all const Trk::RIO_OnTrack* broadCluster = m_recalibrator->makeBroadMeasurement(*compROT, *refPars, it->measurementType()); - if (broadCluster!=NULL) { + if (broadCluster!=nullptr) { ATH_MSG_DEBUG ("annealing in silicon deemed to be failing, replace CompROT-cluster dLocX="<< sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)) @@ -333,8 +337,8 @@ const Trk::FitterStatusCode Trk::KalmanPiecewiseAnnealingFilter::filterTrajectory (Trajectory& trajectory, const ParticleHypothesis& particleType) const { - const Trk::TrackParameters* predPar = 0; - const Trk::TrackParameters* updPar = 0; + const Trk::TrackParameters* predPar = nullptr; + const Trk::TrackParameters* updPar = nullptr; Trk::Trajectory::iterator start = m_utility->firstFittableState(trajectory); return this->filterTrajectoryPiece(trajectory, start, updPar, predPar, trajectory.size(), particleType); @@ -359,14 +363,14 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece msg(MSG::DEBUG) << endmsg; } if (pieceSize<3) pieceSize=8; // some reasonable size for annealing - Trk::KalmanMatEffectsController dafMec(particleType, m_dynamicNoiseAdjustor!=NULL); + Trk::KalmanMatEffectsController dafMec(particleType, m_dynamicNoiseAdjustor!=nullptr); ////////////////////////////////////////////////////////////////////////////// // step 1: make first loop while turning ROT/PRDs into competing ones ////////////////////////////////////////////////////////////////////////////// - const TrackParameters* predPar = 0; + const TrackParameters* predPar = nullptr; std::unique_ptr<const AmgVector(5)> predDiffPar; - const TrackParameters* updatedPar = 0; + const TrackParameters* updatedPar = nullptr; bool end_reached = false; bool hadAnnealingProblemDC = false; bool hadAnnealingProblem = false; @@ -380,8 +384,8 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (input_it->referenceParameters()) { if (start_predPar) { predPar = start_predPar->clone(); - predDiffPar.reset( new AmgVector(5)(start_predPar->parameters() - - start->referenceParameters()->parameters() ) ); + predDiffPar = std::make_unique<AmgVector(5)>( start_predPar->parameters() + - start->referenceParameters()->parameters() ); } else { predDiffPar.reset( start->checkoutParametersDifference() ); predPar = CREATE_PARAMETERS(*start->referenceParameters(), @@ -405,7 +409,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece const TransportJacobian& jac = *m_trajPiece.back().jacobian(); AmgVector(5) updDiffPar = updatedPar->parameters() - m_trajPiece.back().referenceParameters()->parameters(); - predDiffPar.reset( new AmgVector(5)(jac*updDiffPar) ); + predDiffPar = std::make_unique<AmgVector(5)>( jac*updDiffPar ); AmgSymMatrix(5)* C = new AmgSymMatrix(5) (jac*(*updatedPar->covariance())*jac.transpose()); // add uncertainties from material effects: if (input_it->materialEffects()) { @@ -438,7 +442,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece const Trk::RIO_OnTrack* testROT = dynamic_cast<const Trk::RIO_OnTrack*>(input_it->measurement()); - if (input_it->isOutlier() || testROT==NULL || input_it->measurement()==NULL) { + if (input_it->isOutlier() || testROT==nullptr || input_it->measurement()==nullptr) { // outlier, material and unambiguous hits: *COPY* into piecewise trajectory. if (input_it->measurement()) @@ -491,11 +495,11 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (input_it->isOutlier() || !m_trajPiece.back().measurement() ) { delete updatedPar; updatedPar = predPar; - predPar = 0; + predPar = nullptr; } else { m_trajPiece.back().checkinForwardPar(predPar); delete updatedPar; - FitQualityOnSurface* fitQuality=0; + FitQualityOnSurface* fitQuality=nullptr; updatedPar = m_updator->addToState(*predPar, m_trajPiece.back().measurement()->localParameters(), m_trajPiece.back().measurement()->localCovariance(), @@ -506,7 +510,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece delete fitQuality; return Trk::FitterStatusCode::UpdateFailure; } - if (fitQuality != NULL) { + if (fitQuality != nullptr) { m_trajPiece.back().setForwardStateFitQuality(*fitQuality); delete fitQuality; } @@ -523,7 +527,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece ////////////////////////////////////////////////////////////////////////////// // === step 2: enter annealing loop acting on pairs of forward-backward filters ////////////////////////////////////////////////////////////////////////////// - FitQuality* newFitQuality = 0; + FitQuality* newFitQuality = nullptr; FitQuality savedForwardFQ = m_utility->forwardFilterQuality(m_trajPiece); for (unsigned int annealer=0; annealer < m_option_annealingScheme.size(); ++annealer) { @@ -577,7 +581,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT != NULL && !it->isOutlier()) assgnProbSum += + if (compROT != nullptr && !it->isOutlier()) assgnProbSum += compROT->assignmentProbability(compROT->indexOfMaxAssignProb()); } if (assgnProbSum < 0.5) { @@ -628,7 +632,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - const Trk::FitQuality* testFQ = 0; + const Trk::FitQuality* testFQ = nullptr; if (it->smoothedTrackParameters() && it->measurement()) { testFQ = m_updator->fullStateFitQuality(*(it->smoothedTrackParameters()), it->measurement()->localParameters(), @@ -733,7 +737,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (it->parametersCovariance()) itForKF->checkinParametersCovariance(it->checkoutParametersCovariance()); itForKF->setForwardStateFitQuality(it->forwardStateChiSquared(),it->forwardStateNumberDoF()); - if (it->dnaMaterialEffects()!=NULL) + if (it->dnaMaterialEffects()!=nullptr) itForKF->checkinDNA_MaterialEffects(it->checkoutDNA_MaterialEffects()); // } } diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx index ee9dd181296e4725c477af79cdc0ee1992c55ad9..b0f52fae4a6df55e68782946ab18720bfa4ba731 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx @@ -25,10 +25,12 @@ #include "TrkFitterUtils/ProtoMaterialEffects.h" // common tracking tools +#include "TrkDetDescrInterfaces/IAlignableSurfaceProvider.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "TrkToolInterfaces/IUpdator.h" #include "TrkFitterInterfaces/IDynamicNoiseAdjustor.h" -#include "TrkDetDescrInterfaces/IAlignableSurfaceProvider.h" +#include "TrkToolInterfaces/IUpdator.h" +#include <memory> + #include <sstream> #include <iomanip> @@ -193,8 +195,8 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fit(Trk::Trajectory& tra // take care of different fit Quality objects in place during smoothing: // - Trk::FitQualityOnSurface* fitQual = 0; // FQ of a given smoothed state - Trk::FitQualityOnSurface* trackQualityIncrement = 0; // increment to build total fitQ + Trk::FitQualityOnSurface* fitQual = nullptr; // FQ of a given smoothed state + Trk::FitQualityOnSurface* trackQualityIncrement = nullptr; // increment to build total fitQ if (trackFitQuality) { // object to hold total fit quality ATH_MSG_WARNING ("fitQuality pointer is not NULL, cancel Kalman fit to prevent mem leak!"); if (msgLvl(MSG::INFO)) monitorTrackFits( Call, 1000. ); @@ -346,7 +348,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fit(Trk::Trajectory& tra //////////////////////////////////////////////////////////////////// // adjust the momentum + error according to target measurement (brem fit) - const Trk::DNA_MaterialEffects* detectedMomentumNoise = 0; + const Trk::DNA_MaterialEffects* detectedMomentumNoise = nullptr; Trk::Trajectory::reverse_iterator stateWithNoise = m_utility->previousFittableState(trajectory, rit); if (kalMec.doDNA() && stateWithNoise!=trajectory.rend()) { @@ -457,8 +459,8 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& // take care of different fit Quality objects in place during smoothing: // - Trk::FitQualityOnSurface* fitQual = 0; // FQ of a given smoothed state - Trk::FitQualityOnSurface* trackQualityIncrement = 0; // increment to build total fitQ + Trk::FitQualityOnSurface* fitQual = nullptr; // FQ of a given smoothed state + Trk::FitQualityOnSurface* trackQualityIncrement = nullptr; // increment to build total fitQ if (trackFitQuality) { // object to hold total fit quality ATH_MSG_WARNING ("fitQuality pointer is not NULL, cancel Kalman fit to prevent mem leak!"); if (msgLvl(MSG::INFO)) monitorTrackFits( BadInput, 1000. ); @@ -498,7 +500,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& const AmgVector(5) x = lastPredictedState->referenceParameters()->parameters() + updatedDifference->first; smooPar.reset( updatedDifference? CREATE_PARAMETERS(*lastPredictedState->referenceParameters(), - x,new AmgSymMatrix(5)(updatedDifference->second)) : 0 ); + x,new AmgSymMatrix(5)(updatedDifference->second)) : nullptr ); if (msgLvl(MSG::INFO)) monitorTrackFits( Call, ( smooPar ? smooPar->eta() : 1000. ) ); if (!smooPar || !fitQual) { ATH_MSG_WARNING ("first smoother update failed, reject track"); @@ -575,15 +577,14 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& updatedDifference.reset(); if (msgLvl(MSG::DEBUG)) { const AmgVector(5) x = rit->referenceParameters()->parameters()+predDiffPar; - const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,nullptr); printGlobalParams( rit->positionOnTrajectory(), " extrp", param ); delete param; } const MeasurementBase* fittableMeasurement = rit->measurement(); if (!fittableMeasurement || rit->isOutlier() ) { // pure material state or outlier - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(predDiffPar,predCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(predDiffPar,predCov) ); } else { updatedDifference.reset( m_updator->updateParameterDifference(predDiffPar, predCov, @@ -591,7 +592,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& fittableMeasurement->localCovariance(), fittableMeasurement->localParameters().parameterKey(), trackQualityIncrement, /*doFQ=*/true ) ); - if (!updatedDifference || trackQualityIncrement == 0) { + if (!updatedDifference || trackQualityIncrement == nullptr) { if (msgLvl(MSG::INFO)) monitorTrackFits( UpdateFailure, rit->referenceParameters()->eta() ); ATH_MSG_INFO ("could not update Track Parameters, reject track"); delete trackQualityIncrement; @@ -615,7 +616,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& if (msgLvl(MSG::DEBUG)) { const AmgVector(5) x = rit->referenceParameters()->parameters() + updatedDifference->first; - const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,nullptr); printGlobalParams (rit->positionOnTrajectory()," updat", param ); delete param; } @@ -666,7 +667,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& if (msgLvl(MSG::INFO)) monitorTrackFits( FitQualityFailure, rit->smoothedTrackParameters()->eta()); return FitterStatusCode::FitQualityFailure; } - rit->checkinFitQuality(fitQual);fitQual=0; + rit->checkinFitQuality(fitQual);fitQual=nullptr; } if (rit->smoothedTrackParameters()) { smooPar_eta_for_monitoring = rit->smoothedTrackParameters()->eta(); @@ -745,7 +746,7 @@ void Trk::KalmanSmoother::addChi2IncrementAndDelete(Trk::FitQualityOnSurface*& f totalChi2 += fitQualIncrement->chiSquared(); totalNdof += fitQualIncrement->numberDoF(); delete fitQualIncrement; - fitQualIncrement = 0; + fitQualIncrement = nullptr; } else if (msgLvl(MSG::INFO)) { ATH_MSG_DEBUG ("incremental fitQuality object does not exist, assuming zero increment."); } diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx index e386eeb8484ad3712392e45358968f614fef2d5b..777c4a4656a4bc2e1ae50848a6f07e968a36adda 100644 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -33,8 +33,8 @@ Trk::MeasRecalibSteeringTool::MeasRecalibSteeringTool(const std::string& t, m_trtTubeHitCreator("InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_StrawTubeOnTrackTool"), m_haveInDetTools(true), //m_haveMuonTools(false), - m_idHelper(0), - m_mbHelper(0) + m_idHelper(nullptr), + m_mbHelper(nullptr) { declareInterface<IMeasurementRecalibrator>(this); @@ -119,16 +119,16 @@ Trk::MeasRecalibSteeringTool::makePreciseMeasurement const MeasurementType inputMtype) const { // prepare guaranteed input - const Trk::RIO_OnTrack* rot = 0; + const Trk::RIO_OnTrack* rot = nullptr; Trk::RoT_Extractor::extract( rot, &meas); // std and competing ROTs - if (rot==NULL) { + if (rot==nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: no recalibration input!" ); - return 0; + return nullptr; } - if (rot->prepRawData() == NULL) { + if (rot->prepRawData() == nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: re-calibration called " << "on data without PrepRawData objects available." ); - return 0; + return nullptr; } MeasurementType mType = inputMtype; if (inputMtype == unidentified) mType = m_mbHelper->defineType(&meas); @@ -162,7 +162,7 @@ Trk::MeasRecalibSteeringTool::makePreciseMeasurement return newrot; // } } - return 0; + return nullptr; } else { return m_rotCreator->correct(*(rot->prepRawData()), trkPar); } @@ -204,16 +204,16 @@ Trk::MeasRecalibSteeringTool::makeBroadMeasurement(const MeasurementBase& meas, const { // prepare guaranteed input - const Trk::RIO_OnTrack* rot = 0; + const Trk::RIO_OnTrack* rot = nullptr; Trk::RoT_Extractor::extract( rot, &meas); // std and competing ROTs - if (rot==NULL) { + if (rot==nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: no recalibration input!" ); - return 0; + return nullptr; } - if (rot->prepRawData() == NULL) { + if (rot->prepRawData() == nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: re-calibration called " << "on data without PrepRawData objects available." ); - return 0; + return nullptr; } MeasurementType mType = inputMtype; if (inputMtype == unidentified) mType = m_mbHelper->defineType(&meas); @@ -232,7 +232,7 @@ Trk::MeasRecalibSteeringTool::makeBroadMeasurement(const MeasurementBase& meas, return m_trtTubeHitCreator->correct(*rot->prepRawData(), trkPar); } - return 0; + return nullptr; } //================================================================================ diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h index 6f269e8329b491fa51be717a4ecb50519520b202..2d87fb1779f42915aa388ff22a3ae2eb05daf40a 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h @@ -52,11 +52,15 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; - // using TrackFitter::fit; - // iPat Fitter settings (FIXME: to provide??): - // RunOutlierRemoval - use logic to remove bad hits - + // RunOutlierRemoval - use logic to remove bad hits + + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + // refit a track virtual Track* fit (const Track&, const RunOutlierRemoval runOutlier=false, diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx index 1443a9166da43219623b87f6d8fbd1924081f926..be5e4226be8957662d3a8701ee332597b551edca 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx @@ -53,10 +53,10 @@ namespace Trk m_scatteringLogCoeff(0.038), // Coulomb scattering constant m_sectorMaxPhi(0.28), m_stationMaxGap(0.6 * Gaudi::Units::meter), - m_calorimeterVolume(0), - m_indetVolume(0), - m_spectrometerEntrance(0), - m_messageHelper(0) { + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), + m_spectrometerEntrance(nullptr), + m_messageHelper(nullptr) { m_messageHelper = new MessageHelper(*this); declareInterface<IMaterialAllocator>(this); declareProperty("Extrapolator", m_extrapolator); @@ -184,9 +184,9 @@ namespace Trk // check if leading scatterer(s) already present or need to be added (up to delimiter) bool energyGain = false; bool haveDelimiter = false; - const TrackSurfaceIntersection* intersection = 0; + const TrackSurfaceIntersection* intersection = nullptr; int leadingScatterers = 0; - Trk::FitMeasurement* leadingScatterer = 0; + Trk::FitMeasurement* leadingScatterer = nullptr; for (std::vector<Trk::FitMeasurement*>::const_iterator m = measurements.begin(); m != measurements.end(); ++m) { @@ -209,10 +209,10 @@ namespace Trk // find first measurement after delimiter haveDelimiter = false; Amg::Vector3D endPosition = fitParameters.vertex(); - const Surface* firstMeasurementSurface = 0; - Trk::FitMeasurement* leadingOutlier = 0; + const Surface* firstMeasurementSurface = nullptr; + Trk::FitMeasurement* leadingOutlier = nullptr; std::vector<Trk::FitMeasurement*> leadingOutliers; - const Surface* surface = 0; + const Surface* surface = nullptr; for (std::vector<Trk::FitMeasurement*>::const_iterator m = measurements.begin(); m != measurements.end(); ++m) { @@ -248,7 +248,7 @@ namespace Trk charge, fitParameters.vertex()); bool haveMaterial = false; - const std::vector<const TrackStateOnSurface*>* indetMaterial = 0; + const std::vector<const TrackStateOnSurface*>* indetMaterial = nullptr; if (haveDelimiter && intersection && surface && m_indetVolume->inside(endPosition)) { // debug if (msgLvl(MSG::VERBOSE)) { @@ -292,10 +292,10 @@ namespace Trk // clean up after previous attempt deleteMaterial(indetMaterial, garbage); - indetMaterial = 0; + indetMaterial = nullptr; - std::vector<const TrackStateOnSurface*>* indetMaterialF = 0; - const std::vector<const TrackStateOnSurface*>* indetMaterialR = 0; + std::vector<const TrackStateOnSurface*>* indetMaterialF = nullptr; + const std::vector<const TrackStateOnSurface*>* indetMaterialR = nullptr; CurvilinearUVT uvt(intersection->direction()); Amg::Vector2D localPos; PlaneSurface* plane = new PlaneSurface(intersection->position(), uvt); @@ -336,7 +336,7 @@ namespace Trk haveMaterial = true; } indetMaterial = indetMaterialF; - indetMaterialF = 0; + indetMaterialF = nullptr; } } delete indetMaterialR; @@ -402,7 +402,7 @@ namespace Trk // create scatterer FitMeasurement's corresponding to leading material // (intersector running inwards to give parameters with qOverP update) - FitMeasurement* leadingMeas = 0; + FitMeasurement* leadingMeas = nullptr; if (indetMaterial && !indetMaterial->empty()) { std::vector<const TrackStateOnSurface*>::const_reverse_iterator r = indetMaterial->rbegin(); for (; r != indetMaterial->rend(); ++r) { @@ -492,7 +492,7 @@ namespace Trk if (leadingOutliers.size()) { leadingOutlier = leadingOutliers.back(); } else { - leadingOutlier = 0; + leadingOutlier = nullptr; } } } @@ -545,11 +545,11 @@ namespace Trk } } else { delete intersection; - intersection = 0; + intersection = nullptr; } delete perigee; deleteMaterial(indetMaterial, garbage); - indetMaterial = 0; + indetMaterial = nullptr; } // integrate X0, energy loss and contribution to covariance (from leading scatterer towards perigee) @@ -722,14 +722,14 @@ namespace Trk if (!m_trackingGeometrySvc) { // missing TrackingGeometrySvc - no leading material will be added m_messageHelper->printWarning(0); - return 0; + return nullptr; } else { createSpectrometerEntranceOnce(); } } // check input parameters are really in the spectrometer - if (m_calorimeterVolume->inside(spectrometerParameters.position())) return 0; + if (m_calorimeterVolume->inside(spectrometerParameters.position())) return nullptr; const TrackParameters* entranceParameters = m_extrapolator->extrapolateToVolume(spectrometerParameters, @@ -745,7 +745,7 @@ namespace Trk << spectrometerParameters.position().z() << " with p " << std::setw(8) << std::setprecision(3) << spectrometerParameters.momentum().mag() / Gaudi::Units::GeV); - return 0; + return nullptr; } const Surface& entranceSurface = entranceParameters->associatedSurface(); @@ -770,7 +770,7 @@ namespace Trk << " with p " << std::setw(8) << std::setprecision(3) << spectrometerParameters.momentum().mag() / Gaudi::Units::GeV); delete extrapolatedTSOS; - return 0; + return nullptr; } std::vector<FitMeasurement*> leadingMeasurements; @@ -796,9 +796,9 @@ namespace Trk // convert back to TSOS std::vector<FitMeasurement*>::iterator m = leadingMeasurements.begin(); for (; m != leadingMeasurements.end(); ++m) - leadingTSOS->push_back(new TrackStateOnSurface(0, - 0, - 0, + leadingTSOS->push_back(new TrackStateOnSurface(nullptr, + nullptr, + nullptr, (**m).materialEffects()->clone())); deleteMaterial(extrapolatedTSOS, garbage); @@ -843,8 +843,8 @@ namespace Trk startDirection.dot((**m).intersection(FittedTrajectory).position() - startPosition); if (distance < previousDistance) distance += m_orderingTolerance; previousDistance = distance - m_orderingTolerance; - measurementOrder.push_back(std::make_pair(distance, *m)); - originalOrder.push_back(std::make_pair(distance, *m)); + measurementOrder.emplace_back(distance, *m); + originalOrder.emplace_back(distance, *m); } std::sort(measurementOrder.begin(), measurementOrder.end(), compareByDistance()); std::vector< std::pair<double, FitMeasurement*> >::const_iterator orig = originalOrder.begin(); @@ -937,7 +937,7 @@ namespace Trk parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], - parameterVector[Trk::qOverP], 0); + parameterVector[Trk::qOverP], nullptr); for (std::vector<Trk::FitMeasurement*>::reverse_iterator r = measurements.rbegin(); r != measurements.rend(); @@ -1005,7 +1005,7 @@ namespace Trk // FIXME: modify aggregation function: no aggregation in EC toroid region (~11m) // FIXME: single scatterer in outer delimited pair //printMeasurements(measurements); - FitMeasurement* previous = 0; + FitMeasurement* previous = nullptr; double previousDistance = 0.; Amg::Vector3D startDirection; @@ -1124,7 +1124,7 @@ namespace Trk if (!TGMaterial || TGMaterial->empty()) return TGMaterial; - std::vector<const TrackStateOnSurface*>* duplicates = 0; + std::vector<const TrackStateOnSurface*>* duplicates = nullptr; std::vector<const TrackStateOnSurface*>* material = new std::vector<const TrackStateOnSurface*>; material->reserve(TGMaterial->size()); std::vector<const TrackStateOnSurface*>::const_iterator tg = TGMaterial->begin(); @@ -1167,7 +1167,7 @@ namespace Trk // loop over measurements to define portions of track needing indet material double endIndetDistance = 0.; - FitMeasurement* endIndetMeasurement = 0; + FitMeasurement* endIndetMeasurement = nullptr; double qOverP = startParameters.charge() / startParameters.momentum().mag(); Amg::Vector3D startDirection = startParameters.momentum().unit(); @@ -1349,7 +1349,7 @@ namespace Trk } // firstly: add the material belonging to each measurement layer (and skip leading material) - FitMeasurement* leadingDelimiter = 0; + FitMeasurement* leadingDelimiter = nullptr; Amg::Vector3D nextMomentum(0., 0., 0.); Amg::Vector3D nextPosition(0., 0., 0.); m = measurements.begin(); @@ -1361,9 +1361,9 @@ namespace Trk Amg::Vector3D direction = (**m).intersection(FittedTrajectory).direction(); Amg::Vector3D position = (**m).intersection(FittedTrajectory).position(); double closestDistance = direction.dot(position - startPosition); - const MaterialEffectsOnTrack* materialEffects = 0; - const TrackParameters* materialParameters = 0; - const Surface* materialSurface = 0; + const MaterialEffectsOnTrack* materialEffects = nullptr; + const TrackParameters* materialParameters = nullptr; + const Surface* materialSurface = nullptr; // find the closest material TSOS (inside radial tolerance) for (; s != indetMaterialEnd; ++s) { @@ -1384,7 +1384,7 @@ namespace Trk --m; if (std::abs(nextDistance) < distance && distance > tolerance) { if (s != indetMaterial->begin()) --s; - materialSurface = 0; + materialSurface = nullptr; break; } closestDistance = distance; @@ -1427,7 +1427,7 @@ namespace Trk // insert material at measurement surface const std::bitset<MaterialEffectsBase::NumberOfMaterialEffectsTypes> typePattern; - const Trk::EnergyLoss* energyLoss = 0; + const Trk::EnergyLoss* energyLoss = nullptr; if (materialEffects->energyLoss()) energyLoss = materialEffects->energyLoss()->clone(); MaterialEffectsOnTrack* meot = new MaterialEffectsOnTrack(materialEffects->thicknessInX0(), energyLoss, @@ -1537,11 +1537,11 @@ namespace Trk double /*particleMass*/) const { // aggregation possible in indet and MS. Frequent occurrence in MS ATH_MSG_INFO("segment material aggregation " << material.size()); - FitMeasurement* measurement1 = 0; - FitMeasurement* measurement2 = 0; + FitMeasurement* measurement1 = nullptr; + FitMeasurement* measurement2 = nullptr; if (!material.size()) return std::pair<FitMeasurement*, FitMeasurement*>(measurement1, measurement2); - Amg::Vector3D* referencePosition = 0; + Amg::Vector3D* referencePosition = nullptr; int adjacentScatterers = 0; @@ -1775,8 +1775,8 @@ namespace Trk bool haveAggregation = false; bool makeAggregation = false; double maxDistance = 0.; - FitMeasurement* measurement1 = 0; - FitMeasurement* measurement2 = 0; + FitMeasurement* measurement1 = nullptr; + FitMeasurement* measurement2 = nullptr; double totalDistance = 0.; double totalDistanceSq = 0.; double totalEnergyDeposit = 0.; @@ -1870,7 +1870,7 @@ namespace Trk // msg() << " distance out of bounds: range " << distance // << " to " << 0. << endmsg; } else { - FitMeasurement* after = 0; + FitMeasurement* after = nullptr; FitMeasurement* before = *start; double previousDistance = 0.; haveAggregation = true; @@ -1960,8 +1960,8 @@ namespace Trk if (measurement1) aggregateScatterers.push_back(measurement1); if (measurement2) aggregateScatterers.push_back(measurement2); if (keepCurrentMeas) aggregateScatterers.push_back(*m); - measurement1 = 0; - measurement2 = 0; + measurement1 = nullptr; + measurement2 = nullptr; break; } before = *s; @@ -2091,7 +2091,7 @@ namespace Trk MaterialAllocator::measurementFromTSOS(const TrackStateOnSurface& tsos, double outgoingEnergy, double particleMass) const { - if (!tsos.trackParameters() || !tsos.materialEffectsOnTrack()) return 0; + if (!tsos.trackParameters() || !tsos.materialEffectsOnTrack()) return nullptr; double deltaE = outgoingEnergy - tsos.trackParameters()->momentum().mag(); double thicknessInX0 = tsos.materialEffectsOnTrack()->thicknessInX0(); @@ -2296,8 +2296,8 @@ namespace Trk ATH_MSG_DEBUG(" spectrometerMaterial: ALARM no material found on track can happen for MuGirl"); // material has to be added: need inner and outer TrackParameters - FitMeasurement* innerMeasurement = 0; - FitMeasurement* outerMeasurement = 0; + FitMeasurement* innerMeasurement = nullptr; + FitMeasurement* outerMeasurement = nullptr; for (m = measurements.begin(); m != measurements.end(); ++m) { if (!(**m).isPositionMeasurement() || (**m).isOutlier()) continue; Amg::Vector3D position = (**m).intersection(FittedTrajectory).position(); @@ -2326,7 +2326,7 @@ namespace Trk } // entranceParameters are at the MS entrance surface (0 if perigee downstream) - TrackSurfaceIntersection* entranceIntersection = 0; + TrackSurfaceIntersection* entranceIntersection = nullptr; std::unique_ptr<const TrackParameters> entranceParameters; MsgStream log(msgSvc(), name()); if (m_calorimeterVolume->inside(startParameters.position())) { @@ -2398,7 +2398,7 @@ namespace Trk double endSpectrometerDistance = startDirection.dot( measurements.back()->intersection(FittedTrajectory).position() - startPosition); - const std::vector<const TrackStateOnSurface*>* spectrometerMaterial = 0; + const std::vector<const TrackStateOnSurface*>* spectrometerMaterial = nullptr; // protect the momentum to avoid excessive Eloss @@ -2416,7 +2416,7 @@ namespace Trk parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], - parameterVector[Trk::qOverP], 0)); + parameterVector[Trk::qOverP], nullptr)); if (entranceParameters) { const Surface& entranceSurface = entranceParameters->associatedSurface(); @@ -2480,7 +2480,7 @@ namespace Trk if (!spectrometerMaterial || spectrometerMaterial->empty()) { m_messageHelper->printWarning(5); delete spectrometerMaterial; - spectrometerMaterial = 0; + spectrometerMaterial = nullptr; } else { std::vector<const TrackStateOnSurface*>::const_reverse_iterator s = spectrometerMaterial->rbegin(); diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx index faf22e2e7c3f99fc88d72cd0f03ad13deb068bd8..05b7a54a139069f1df081997d010d4806a67a9d3 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx @@ -426,7 +426,7 @@ namespace Trk const Perigee* indetPerigee = dynamic_cast<const Perigee*>(indetTrack.perigeeParameters()); const Perigee* spectrometerPerigee = dynamic_cast<const Perigee*>(spectrometerTrack.perigeeParameters()); if (spectrometerPerigee - && !m_indetVolume->inside(spectrometerPerigee->associatedSurface().center())) { spectrometerPerigee = 0; } + && !m_indetVolume->inside(spectrometerPerigee->associatedSurface().center())) { spectrometerPerigee = nullptr; } if (!spectrometerTrack.info().trackProperties(Trk::TrackInfo::StraightTrack) && spectrometerPerigee) { if (indetTrack.info().trackProperties(Trk::TrackInfo::StraightTrack) diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx index 19730ec79700779d6328158bb20a475326a4394f..ab2a1f12ecae3455e389fef671c8014f3616a650 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ namespace Trk rows += m->numberDoF(); } - if (!numberParameters || !rows) { return 0; } + if (!numberParameters || !rows) { return nullptr; } ATH_MSG_VERBOSE(" DerivMatrix : " << fitState.getMeasurements().size() << " measurement objects giving " << rows << " rows and " << numberParameters << " columns (parameters)"); diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h b/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h index 9593752fd29587b62729818682bdd44347a90005..42a39dcd85937e31909099adcdc2989570af6ff2 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h @@ -1,31 +1,30 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - CLASS_DEF for InDet dR map - ------------------------------ - ATLAS Collaboration - ***************************************************************************/ - -#ifndef DRMAP_H -#define DRMAP_H 1 - -//<<<<<< INCLUDES >>>>>> -#include "AthenaKernel/CLASS_DEF.h" -#include <map> -#include "InDetPrepRawData/PixelCluster.h" - -//<<<<<< PUBLIC DEFINES >>>>>> - -namespace InDet{ - - typedef std::map<const InDet::PixelCluster*, std::pair<float,float> > - DRMap; -} - -CLASS_DEF( InDet::DRMap , 193676466 , 1 ) - - - -#endif // DRMAP_H +/*************************************************************************** + CLASS_DEF for InDet dR map + ------------------------------ + ATLAS Collaboration + ***************************************************************************/ + +#ifndef DRMAP_H +#define DRMAP_H 1 + +//<<<<<< INCLUDES >>>>>> +#include "AthenaKernel/CLASS_DEF.h" +#include <map> +#include "InDetPrepRawData/PixelCluster.h" + + +namespace InDet{ + + typedef std::map<const InDet::PixelCluster*, std::pair<float,float> > + DRMap; +} + +CLASS_DEF( InDet::DRMap , 193676466 , 1 ) + + + +#endif // DRMAP_H diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx index 15bdfca674fac05fe53585d09819b5f21be355cc..eaf84cf9f9bd29fccc5e4b07596c98b52857482b 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx @@ -21,6 +21,7 @@ #include "InDetPrepRawData/PixelCluster.h" #include "InDetPrepRawData/SCT_Cluster.h" #include "InDetIdentifier/PixelID.h" +#include <cmath> //TODO: to be improved bool Trk::DenseEnvironmentsAmbiguityProcessorTool::checkTrack( const Trk::Track *track) const { @@ -112,20 +113,8 @@ StatusCode Trk::DenseEnvironmentsAmbiguityProcessorTool::initialize() } ATH_CHECK( m_extrapolatorTool.retrieve()); - - sc = detStore()->retrieve(m_pixelId, "PixelID"); - if (sc.isFailure()) - { - ATH_MSG_FATAL( "Could not get PixelID helper !" ); - return StatusCode::FAILURE; - } - - sc = detStore()->retrieve(m_idHelper, "AtlasID"); - if (sc.isFailure()) - { - ATH_MSG_FATAL( "Could not get AtlasDetectorID helper" ); - return StatusCode::FAILURE; - } + ATH_CHECK( detStore()->retrieve(m_pixelId, "PixelID")); + ATH_CHECK( detStore()->retrieve(m_idHelper, "AtlasID")); // Configuration of the material effects Trk::ParticleSwitcher particleSwitch; @@ -165,7 +154,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::statistics() m_stat.dump(out, m_tryBremFit); out << endmsg; } - } +} void Trk::DenseEnvironmentsAmbiguityProcessorTool::TrackStat::dump(MsgStream &out, bool try_brem_fit) const { @@ -176,7 +165,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::TrackStat::dump(MsgStream &ou return fullname.substr(slashPosition, stringLength); }; // @TODO restore ios - std::streamsize ss = std::cout.precision(); + std::streamsize ss = out.precision(); int iw=9; out << "Output from "; out << parseFileName(__FILE__); @@ -303,80 +292,55 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::addTrack(Trk::Track* track, c // @TODO create track summary for track score = m_scoringTool->score( *track, suppressHoleSearch ); - // do we accept the track ? - if (score!=0) - { + if (score!=0){ ATH_MSG_DEBUG ("Track ("<< track <<") has score "<<score); // add track to map, map is sorted small to big ! scoreTrackFitflagMap.emplace(-score, TrackPtr(track, fitted) ); return; } - // do we try to recover the track ? - if (score==0 && fitted && m_tryBremFit && + if ( fitted && m_tryBremFit && !track->info().trackProperties(Trk::TrackInfo::BremFit) && track->trackParameters()->front()->pT() > m_pTminBrem && (!m_caloSeededBrem || track->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))) { - ATH_MSG_DEBUG ("Track score is zero, try to recover it via brem fit"); // run track fit using electron hypothesis Trk::Track* bremTrack = fit(*track,true,Trk::electron); - - if (!bremTrack) - { + if (!bremTrack){ ATH_MSG_DEBUG ("Brem refit failed, drop track"); stat.increment_by_eta(TrackStat::kNscoreZeroBremRefitFailed,track); stat.increment_by_eta(TrackStat::kNfailedFits,track); - // clean up cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(track) ); track=nullptr; - - } - else - { + } else { if (m_trackSummaryTool.isEnabled()) { - m_trackSummaryTool->computeAndReplaceTrackSummary(*bremTrack, - &prd_to_track_map, - m_suppressHoleSearch); + m_trackSummaryTool->computeAndReplaceTrackSummary(*bremTrack,&prd_to_track_map,m_suppressHoleSearch); } - stat.increment_by_eta(TrackStat::kNgoodFits,bremTrack); - // rerun score score = m_scoringTool->score( *bremTrack, suppressHoleSearch ); - cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(track) ); track=nullptr; - // do we accept the track ? - if (score!=0) - { + if (score!=0){ ATH_MSG_DEBUG ("Brem refit successful, recovered track ("<< track <<") has score "<<score); stat.increment_by_eta(TrackStat::kNscoreZeroBremRefit,bremTrack); - // add track to map, map is sorted small to big ! scoreTrackFitflagMap.emplace( -score, TrackPtr(bremTrack, true) ); return; - } - else - { + } else { ATH_MSG_DEBUG ("Brem refit gave still track score zero, reject it"); stat.increment_by_eta(TrackStat::kNscoreZeroBremRefitScoreZero,bremTrack); - // clean up cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(bremTrack) ); } } - } - else - { + } else { ATH_MSG_DEBUG ("Track score is zero, reject it"); - stat.increment_by_eta(TrackStat::kNscoreZero,track); - // @TODO can delete this track ? cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(track) ); } @@ -414,7 +378,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::solveTracks(const TracksScore std::unique_ptr<Trk::Track> cleanedTrack; auto [cleanedTrack_tmp, keep_orig] = m_selectionTool->getCleanedOutTrack( atrack.track() , -ascore, prd_to_track_map); cleanedTrack.reset(cleanedTrack_tmp); - ATH_MSG_DEBUG ("--- cleand next track "<< cleanedTrack.get()); + ATH_MSG_DEBUG ("--- cleaned next track "<< cleanedTrack.get()); // cleaned track is input track and fitted @@ -702,8 +666,8 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC } else{ ATH_MSG_VERBOSE("Distance dR map recorded as '" << m_dRMap.key() <<"'."); } - - for (auto track : tracks){ + constexpr double twoPi = 2.*M_PI; + for (const auto & track : tracks){ bool refit = false; const DataVector<const TrackStateOnSurface>* tsosVec = track->trackStateOnSurfaces(); if(!tsosVec){ @@ -711,17 +675,16 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC continue; } ATH_MSG_VERBOSE("---> Looping over TSOS's to allow for cluster updates: "<< tsosVec->size() ); - for(auto tsos : *tsosVec){ + for(const auto & tsos : *tsosVec){ const MeasurementBase* measurement = tsos->measurementOnTrack(); if(!measurement || ! tsos->trackParameters()){ ATH_MSG_VERBOSE("---- TSOS has either no measurement or parameters: "<< measurement << " " << tsos->trackParameters() ); continue; } - if(!tsos->type(Trk::TrackStateOnSurface::Measurement)) {continue;} - auto globalPosition = measurement->globalPosition(); - double radius = sqrt(globalPosition[0]*globalPosition[0]+globalPosition[1]*globalPosition[1]); + const double radius = std::sqrt(globalPosition[0]*globalPosition[0]+globalPosition[1]*globalPosition[1]); + const double invRadius{1./radius}; // get the associated prd const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*> ( measurement ); if(!rio){ @@ -737,37 +700,35 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC double yOnPix = trackParams->position().y(); double zOnPix = trackParams->position().z(); - - double Pi = acos(0); - double twoPi = 2.*Pi; - + // now, find closest track - double dr = 0.; double mindR = 99999999.; double mindX = 99999999.; double mindZ = 99999999.; - - for (auto track2 : tracks){ + // + const double eta1{track->perigeeParameters()->momentum().eta()}; + const double phi1{track->perigeeParameters()->momentum().phi()}; + for (const auto & track2 : tracks){ if(track==track2) continue; - float dEta = track->perigeeParameters()->momentum().eta() - track2->perigeeParameters()->momentum().eta(); - float dPhi2 = track->perigeeParameters()->momentum().phi() - track2->perigeeParameters()->momentum().phi(); - dr = sqrtf(dEta*dEta + dPhi2*dPhi2); + float dEta = eta1 - track2->perigeeParameters()->momentum().eta(); + float dPhi2 = phi1 - track2->perigeeParameters()->momentum().phi(); + double dr = std::sqrt(dEta*dEta + dPhi2*dPhi2); if(dr>0.4) continue; //extrapolation to pixel hit radius const TrackParameters * track2Params = m_extrapolatorTool->extrapolate(*track2,iblSurface); - double y2OnPix = track2Params->position().y(); - double z2OnPix = track2Params->position().z(); + const double y2OnPix = track2Params->position().y(); + const double z2OnPix = track2Params->position().z(); - float dPhi = asin(yOnPix/radius) -asin(y2OnPix/radius); - if (dPhi >= Pi) dPhi -= twoPi; - if (dPhi < -Pi) dPhi += twoPi; + float dPhi = std::asin(yOnPix*invRadius) - std::asin(y2OnPix*invRadius); + if (dPhi >= M_PI) dPhi -= twoPi; + if (dPhi < -M_PI) dPhi += twoPi; - double dx = fabs(radius*dPhi); - double dz = fabs(zOnPix - z2OnPix); + const double dx = std::abs(radius*dPhi); + const double dz = std::abs(zOnPix - z2OnPix); if(dx>mindX && dz>mindZ) continue; - dr = sqrt(dx*dx + dz*dz); + dr = std::sqrt(dx*dx + dz*dz); if(dr<mindR && dr > 1.e-4){ mindR = dr; @@ -781,9 +742,8 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC ret = dRMapHandle->insert ( std::pair<const InDet::PixelCluster*,std::pair<float,float> >(pixel,min)); // if we already have a dR for this prd, we update it, if current value is smaller if (!ret.second) { - InDet::DRMap::iterator it; - it = dRMapHandle->find(pixel); - if(sqrt(pow((*it).second.first,2)+pow((*it).second.second,2)) > (float)mindR) { + InDet::DRMap::iterator it{dRMapHandle->find(pixel)}; + if(std::sqrt(std::pow((*it).second.first,2)+std::pow((*it).second.second,2)) > (float)mindR) { (*it).second.first = (float)mindX; (*it).second.second = (float)mindZ; } @@ -830,14 +790,13 @@ bool Trk::DenseEnvironmentsAmbiguityProcessorTool::isHadCaloCompatible(const Trk double E = Tp.eta(); for(; f!=fe; ++f) { - double df = fabs(F-(*f)); - if(df > pi ) df = fabs(pi2-df); + double df = std::abs(F-(*f)); + if(df > pi ) df = std::abs(pi2-df); if(df < m_phiWidth) { //Correct eta of cluster to take into account the z postion of the track double newZ = *z - Tp.position().z(); - double newEta = atanh( newZ / sqrt( (*r) * (*r) + newZ*newZ ) ); - - double de = fabs(E-newEta); + double newEta = std::atanh( newZ / std::sqrt( (*r) * (*r) + newZ*newZ ) ); + double de = std::abs(E-newEta); if(de < m_etaWidth) return true; } ++e; diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx index 7b96be420d1981a88ddb13ac2b48b3130bd6703f..2cde819f306115493f2c991225e3bed0dc2f13f1 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx @@ -101,7 +101,6 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::TrackStat::dump(MsgStrea auto stringLength = dotPosition - slashPosition; return fullname.substr(slashPosition, stringLength); }; - // @TODO restore ios std::streamsize ss = out.precision(); int iw=9; out << "Output from "; @@ -193,16 +192,15 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::addNewTracks(std::vector for(const Track* a_track : *tracks) { ATH_MSG_DEBUG ("Processing track candidate "<<a_track); stat.increment_by_eta(TrackStat::kNcandidates,a_track); // @TODO should go to the score processor - + // only fitted tracks get hole search, input is not fitted float score = m_scoringTool->score( *a_track, true); ATH_MSG_DEBUG ("Track Score is "<< score); // veto tracks with score 0 bool reject = score==0; - - // double track rejection - if (!reject) { + if (reject){ stat.increment_by_eta(TrackStat::kNcandScoreZero,a_track); + } else {// double track rejection std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(*prd_to_track_map, *a_track); // convert to set PrdSignature prdSig( prds.begin(),prds.end() ); @@ -218,7 +216,6 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::addNewTracks(std::vector if (!reject) { // add track to map, map is sorted small to big ! set if fitted - ATH_MSG_VERBOSE ("Track ("<< a_track <<" --> "<< *a_track << ") has score "<<score); trackScoreTrackMap->push_back( std::make_pair(a_track, -score)); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx index 5abd655dd347a23abf10216a8c4d5eb609201f47..1366f6274c322bb8367915945fcd6dc862ba65f2 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx @@ -288,81 +288,54 @@ void Trk::SimpleAmbiguityProcessorTool::addNewTracks(const std::vector<const Tra Trk::SimpleAmbiguityProcessorTool::Counter &stat) const { using namespace std; - DEBUG_CODE( findTrueTracks(&tracks) ); - ATH_MSG_DEBUG ("Number of tracks at Input: "<<tracks.size()); - /** signature map to drop double track. */ PrdSignatureSet prdSigSet; - for(const Track *a_track : tracks) { - - DEBUG_CODE( resetTrackOutliers() ); - - ATH_MSG_DEBUG ("Processing track candidate "<<a_track); - // statistics - increment_by_eta(Counter::kNcandidates,stat,a_track); - - bool reject = false; - - // only fitted tracks get hole search, input is not fitted - TrackScore score = m_scoringTool->score( *a_track, true); - - DEBUG_CODE( setBarcodeStats(a_track,score) ); - // veto tracks with score 0 - if (score==0) { - ATH_MSG_DEBUG ("Candidate score is zero, reject it"); - // statistic - increment_by_eta(Counter::kNcandScoreZero,stat,a_track); - - reject = true; - - DEBUG_CODE(fillBadTrack(a_track,prd_to_track_map) ); - - } else { - - ATH_MSG_DEBUG ("Track Score is "<< score); - - // double track rejection - if (m_dropDouble) { - std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prd_to_track_map, *a_track); - - // unfortunately PrepRawDataSet is not a set ! - PrdSignature prdSig; - prdSig.insert( prds.begin(),prds.end() ); - - // we try to insert it into the set, if we fail (pair.second), it then exits already - if ( !(prdSigSet.insert(prdSig)).second ) { - - ATH_MSG_DEBUG ("Double track, reject it !"); - // statistic - increment_by_eta(Counter::kNcandDouble,stat,a_track); - - reject = true; - - DEBUG_CODE(fillDuplicateTrack(a_track) ); - } else { - ATH_MSG_DEBUG ("Insert new track in PrdSignatureSet"); - } - } - } - - if (!reject) { - - // DEBUG_CODE( associateToOrig ( new_track, a_track) ); - - // add track to map, map is sorted small to big ! set if fitted - ATH_MSG_VERBOSE ("Track ("<< a_track <<") has score "<<score); - TrackPtr ptr(a_track); - if (!m_forceRefit) ptr.forceFitted(); - trackScoreTrackMap.insert( make_pair(-score,std::move(ptr)) ); - - // DEBUG_CODE( keepTrackOfTracks(a_track,new_track) ); - + DEBUG_CODE( resetTrackOutliers() ); + ATH_MSG_DEBUG ("Processing track candidate "<<a_track); + // statistics + increment_by_eta(Counter::kNcandidates,stat,a_track); + bool reject = false; + // only fitted tracks get hole search, input is not fitted + TrackScore score = m_scoringTool->score( *a_track, true); + DEBUG_CODE( setBarcodeStats(a_track,score) ); + // veto tracks with score 0 + if (score==0) { + ATH_MSG_DEBUG ("Candidate score is zero, reject it"); + // statistic + increment_by_eta(Counter::kNcandScoreZero,stat,a_track); + reject = true; + DEBUG_CODE(fillBadTrack(a_track,prd_to_track_map) ); + } else { + ATH_MSG_DEBUG ("Track Score is "<< score); + // double track rejection + if (m_dropDouble) { + std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prd_to_track_map, *a_track); + // unfortunately PrepRawDataSet is not a set ! + PrdSignature prdSig; + prdSig.insert( prds.begin(),prds.end() ); + // we try to insert it into the set, if we fail (pair.second), it then exits already + if ( !(prdSigSet.insert(prdSig)).second ) { + ATH_MSG_DEBUG ("Double track, reject it !"); + // statistic + increment_by_eta(Counter::kNcandDouble,stat,a_track); + reject = true; + DEBUG_CODE(fillDuplicateTrack(a_track) ); + } else { + ATH_MSG_DEBUG ("Insert new track in PrdSignatureSet"); + } } } - + if (!reject) { + // add track to map, map is sorted small to big ! set if fitted + ATH_MSG_VERBOSE ("Track ("<< a_track <<") has score "<<score); + TrackPtr ptr(a_track); + if (!m_forceRefit) ptr.forceFitted(); + trackScoreTrackMap.insert( make_pair(-score,std::move(ptr)) ); + } + } ATH_MSG_DEBUG ("Number of tracks in map:"<<trackScoreTrackMap.size()); DEBUG_CODE( countTrueTracksInMap( trackScoreTrackMap ) ); } @@ -390,81 +363,58 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, score = m_scoringTool->score( *atrack, suppressHoleSearch ); // do we accept the track ? - if (score!=0) - { - ATH_MSG_DEBUG ("Track ("<< atrack.get() <<") has score "<<score); - // statistic - increment_by_eta(Counter::kNscoreOk,stat,atrack.get()); - - // add track to map, map is sorted small to big ! - trackScoreTrackMap.insert( make_pair(-score, TrackPtr(atrack.release(), fitted)) ); - - return; - } - + if (score!=0){ + ATH_MSG_DEBUG ("Track ("<< atrack.get() <<") has score "<<score); + // statistic + increment_by_eta(Counter::kNscoreOk,stat,atrack.get()); + // add track to map, map is sorted small to big ! + trackScoreTrackMap.insert( make_pair(-score, TrackPtr(atrack.release(), fitted)) ); + return; + } + //track score is zero here... // do we try to recover the track ? - if (score==0 && fitted && m_tryBremFit && - !atrack->info().trackProperties(Trk::TrackInfo::BremFit) && - atrack->trackParameters()->front()->pT() > m_pTminBrem && - (!m_caloSeededBrem || atrack->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))) - { - - ATH_MSG_DEBUG ("Track score is zero, try to recover it via brem fit"); - - // run track fit using electron hypothesis - std::unique_ptr<Trk::Track> bremTrack( m_fitterTool->fit(*atrack,true,Trk::electron) ); - - if (!bremTrack) - { - ATH_MSG_DEBUG ("Brem refit failed, drop track"); - // statistic - increment_by_eta(Counter::kNscoreZeroBremRefitFailed,stat,atrack.get()); - increment_by_eta(Counter::kNfailedFits,stat,atrack.get()); - - // clean up - cleanup_tracks.push_back(std::move(atrack)); - - } - else - { - + if (fitted && m_tryBremFit && + !atrack->info().trackProperties(Trk::TrackInfo::BremFit) && + atrack->trackParameters()->front()->pT() > m_pTminBrem && + (!m_caloSeededBrem || atrack->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))){ + ATH_MSG_DEBUG ("Track score is zero, try to recover it via brem fit"); + // run track fit using electron hypothesis + std::unique_ptr<Trk::Track> bremTrack( m_fitterTool->fit(*atrack,true,Trk::electron) ); + if (!bremTrack){ + ATH_MSG_DEBUG ("Brem refit failed, drop track"); + // statistic + increment_by_eta(Counter::kNscoreZeroBremRefitFailed,stat,atrack.get()); + increment_by_eta(Counter::kNfailedFits,stat,atrack.get()); + // clean up + cleanup_tracks.push_back(std::move(atrack)); + } else { // statistic - increment_by_eta(Counter::kNgoodFits,stat,bremTrack.get()); - + increment_by_eta(Counter::kNgoodFits,stat,bremTrack.get()); // rerun score score = m_scoringTool->score( *bremTrack, suppressHoleSearch ); - // do we accept the track ? - if (score!=0) - { - ATH_MSG_DEBUG ("Brem refit successful, recovered track ("<< atrack.get() <<") has score "<<score); + if (score!=0){ + ATH_MSG_DEBUG ("Brem refit successful, recovered track ("<< atrack.get() <<") has score "<<score); // statistics increment_by_eta(Counter::kNscoreZeroBremRefit,stat,bremTrack.get()); - // add track to map, map is sorted small to big ! trackScoreTrackMap.insert( make_pair(-score, TrackPtr(bremTrack.release(), fitted)) ); return; - } - else - { + } else { ATH_MSG_DEBUG ("Brem refit gave still track score zero, reject it"); // statistic increment_by_eta(Counter::kNscoreZeroBremRefitScoreZero,stat,bremTrack.get()); - } - cleanup_tracks.push_back(std::move(atrack)); - } - } - else - { - ATH_MSG_DEBUG ("Track score is zero, reject it"); - // statistic - increment_by_eta(Counter::kNscoreZero,stat,atrack.get()); - - DEBUG_CODE( rejectedTrack(atrack.get(), prd_to_track_map) ); cleanup_tracks.push_back(std::move(atrack)); - } + } + } else { + ATH_MSG_DEBUG ("Track score is zero, reject it"); + // statistic + increment_by_eta(Counter::kNscoreZero,stat,atrack.get()); + DEBUG_CODE( rejectedTrack(atrack.get(), prd_to_track_map) ); + cleanup_tracks.push_back(std::move(atrack)); } +} //================================================================================================== TrackCollection *Trk::SimpleAmbiguityProcessorTool::solveTracks(TrackScoreMap& trackScoreTrackMap, @@ -559,19 +509,15 @@ TrackCollection *Trk::SimpleAmbiguityProcessorTool::solveTracks(TrackScoreMap& t ATH_MSG_DEBUG ("Track "<< atrack.track() << " is excluded, no subtrack, reject"); // statistic increment_by_eta(Counter::kNnoSubTrack,stat,atrack.track()); - - if (atrack.newTrack()) { - cleanup_tracks.push_back( std::unique_ptr<Trk::Track>(atrack.release()) ); - } + if (atrack.newTrack()) { + cleanup_tracks.push_back( std::unique_ptr<Trk::Track>(atrack.release()) ); + } // don't forget to drop track from map } } ATH_MSG_DEBUG ("Finished, number of track on output: "<<final_tracks->size()); - - DEBUG_CODE( eventSummary(final_tracks) ); - return final_tracks.release(); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx index f7bf61dde11fd830fe1c394e52d016b490cbea71..73207c3fc786dbb696028c7cb9f8abf49acc143f 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx @@ -12,8 +12,7 @@ #include "TrkTrackSummary/TrackSummary.h" #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" -#include <cassert> -#include <vector> +#include <cmath> //for log10 Trk::TrackScoringTool::TrackScoringTool(const std::string& t, const std::string& n, @@ -61,25 +60,15 @@ Trk::TrackScoringTool::~TrackScoringTool() StatusCode Trk::TrackScoringTool::initialize() { - StatusCode sc = AlgTool::initialize(); - if (sc.isFailure()) return sc; - - sc = m_trkSummaryTool.retrieve(); - if (sc.isFailure()) - { - msg(MSG::FATAL)<< "Failed to retrieve tool " << m_trkSummaryTool << endmsg; - return sc; - } - else - msg(MSG::INFO)<< "Retrieved tool " << m_trkSummaryTool << endmsg; - + ATH_CHECK( AlgTool::initialize()); + ATH_CHECK( m_trkSummaryTool.retrieve()); + ATH_MSG_VERBOSE("Retrieved tool " << m_trkSummaryTool ); return StatusCode::SUCCESS; } StatusCode Trk::TrackScoringTool::finalize() { - StatusCode sc = AlgTool::finalize(); - return sc; + return AlgTool::finalize(); } Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool suppressHoleSearch ) const @@ -97,20 +86,17 @@ Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool sup Trk::TrackScore Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trackSummary ) const { - - // --- reject bad tracks if (track.fitQuality() && track.fitQuality()->numberDoF() < 0) { - msg(MSG::VERBOSE)<<"numberDoF < 0, reject it"<<endmsg; + ATH_MSG_VERBOSE("numberDoF < 0, reject it"); return TrackScore(0); } - // --- now start scoring TrackScore score(100); // score of 100 per track // --- prob(chi2,NDF), protect for chi2<0 if (track.fitQuality()!=nullptr && track.fitQuality()->chiSquared() > 0 && track.fitQuality()->numberDoF() > 0) { - score+= log10(1.0-Genfun::CumulativeChiSquare(track.fitQuality()->numberDoF())(track.fitQuality()->chiSquared())); + score+= std::log10(1.0-Genfun::CumulativeChiSquare(track.fitQuality()->numberDoF())(track.fitQuality()->chiSquared())); } // --- summary score analysis @@ -120,7 +106,7 @@ Trk::TrackScore Trk::TrackScoringTool::simpleScore( const Track& track, const Tr //value is -1 if undefined. if (value>0) { score+=m_summaryTypeScore[i]*value; - msg(MSG::VERBOSE)<<"\tType ["<<i<<"], value \t= "<<value<<"], score \t="<<score<<endmsg; + ATH_MSG_VERBOSE("\tType ["<<i<<"], value \t= "<<value<<"], score \t="<<score); } } return score; diff --git a/Tracking/TrkTools/TrkMaterialProvider/CMakeLists.txt b/Tracking/TrkTools/TrkMaterialProvider/CMakeLists.txt index e322885cd6baa538a9dbe120edcf7ac0016d3651..922d47f5cf90b0e757bf5d2c30b8ac848d877096 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/CMakeLists.txt +++ b/Tracking/TrkTools/TrkMaterialProvider/CMakeLists.txt @@ -20,13 +20,15 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier Event/EventPrimitives GaudiKernel - MagneticField/MagFieldInterfaces Reconstruction/MuonIdentification/MuidEvent Reconstruction/MuonIdentification/MuidInterfaces Reconstruction/MuonIdentification/muonEvent Reconstruction/RecoTools/RecoToolInterfaces Tracking/TrkEvent/TrkEventUtils - Tracking/TrkEvent/TrkMaterialOnTrack ) + Tracking/TrkEvent/TrkMaterialOnTrack + MagneticField/MagFieldElements + MagneticField/MagFieldConditions + ) # External dependencies: find_package( CLHEP ) @@ -36,7 +38,7 @@ atlas_add_component( TrkMaterialProvider src/TrkMaterialProviderTool.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps TrkDetDescrInterfaces TrkGeometry TrkSurfaces TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces AtlasDetDescr Identifier EventPrimitives GaudiKernel MagFieldInterfaces MuidEvent MuidInterfaces muonEvent RecoToolInterfaces TrkEventUtils TrkMaterialOnTrack ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps TrkDetDescrInterfaces TrkGeometry TrkSurfaces TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces AtlasDetDescr Identifier EventPrimitives GaudiKernel MuidEvent MuidInterfaces muonEvent RecoToolInterfaces TrkEventUtils TrkMaterialOnTrack MagFieldElements MagFieldConditions ) # Install files from the package: atlas_install_headers( TrkMaterialProvider ) diff --git a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h index 3d504d695acb562d6314273ab74895d6d5911efe..636a4cc0938fdab44c4ae1aa3e208a5bc3fa0f11 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h +++ b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h @@ -29,13 +29,11 @@ #include "TrkExInterfaces/IMultipleScatteringUpdator.h" #include "TrkGeometry/TrackingVolume.h" #include "TrkGeometry/MagneticFieldProperties.h" +// For magneticfield +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "RecoToolInterfaces/IMuonCaloEnergyTool.h" -namespace MagField { - class IMagFieldSvc; -} - namespace Trk { class Surface; } @@ -194,7 +192,9 @@ namespace Trk{ const Trk::Volume* m_calorimeterVolume; const Trk::Volume* m_indetVolume; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", + "Name of the Magnetic Field conditions object key"}; bool m_applyTGScaling; bool m_repositionTSOS; diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx index b66cb97b6bdb359bd779470dab76bee7d6f62e7a..178ae4e435bf8418b72276cbb9cb9f9955e3a32e 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx +++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx @@ -15,7 +15,6 @@ #include "AtlasDetDescr/AtlasDetectorID.h" #include "Identifier/Identifier.h" #include "TrkEventUtils/IdentifierExtractor.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "muonEvent/CaloEnergy.h" @@ -50,7 +49,6 @@ Trk::TrkMaterialProviderTool::TrkMaterialProviderTool(const std::string& t, cons m_DetID(nullptr), m_calorimeterVolume(nullptr), m_indetVolume(nullptr), - m_magFieldSvc ("AtlasFieldSvc",n), m_maxNTracksIso(2), m_paramPtCut(15.0*Gaudi::Units::GeV), m_useCaloEnergyMeasurement(true), @@ -68,7 +66,6 @@ Trk::TrkMaterialProviderTool::TrkMaterialProviderTool(const std::string& t, cons declareProperty("CaloMeasTool", m_caloMeasTool); declareProperty("CaloParamTool", m_caloParamTool); declareProperty("TrackIsolationTool", m_trackIsolationTool); - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("MaxNTracksIso", m_maxNTracksIso); declareProperty("ParamPtCut", m_paramPtCut); declareProperty("UseCaloEnergyMeasurement", m_useCaloEnergyMeasurement); @@ -110,7 +107,8 @@ Trk::TrkMaterialProviderTool::initialize() m_trackIsolationTool.disable(); } - ATH_CHECK(m_magFieldSvc.retrieve()); + /// handle to the magnetic field cache + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); // need an Atlas id-helper to identify sub-detectors, take the one from detStore if (detStore()->retrieve(m_DetID, "AtlasID").isFailure()) { @@ -475,13 +473,26 @@ void Trk::TrkMaterialProviderTool::getCaloMEOT(const Trk::Track& idTrack, const ATH_MSG_WARNING("Unable to find first MS TSOS with Track Parameters!"); #endif + MagField::AtlasFieldCache fieldCache; + // Get field cache object + EventContext ctx = Gaudi::Hive::currentContext(); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + if (fieldCondObj == nullptr) { + ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key()); + return; + } + fieldCondObj->getInitializedCache (fieldCache); + + double Eloss = 0.; double X0ScaleMS = 0.; double ElossScaleMS = 0.; // get calorimeter TSOS from TG DataVector<const Trk::TrackStateOnSurface>* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(), // idTrack, - m_magFieldSvc->toroidOn() ? msTrack : idTrack, + fieldCache.toroidOn() ? msTrack : idTrack, (*firstMSnotPerigee)->surface(), Trk::alongMomentum, Trk::muon, @@ -491,10 +502,10 @@ void Trk::TrkMaterialProviderTool::getCaloMEOT(const Trk::Track& idTrack, const true); if(!caloTSOS || caloTSOS->size()!=3) { - if((!m_magFieldSvc->toroidOn()&&fabs(idTrack.perigeeParameters()->parameters()[Trk::qOverP])*4000.<1)|| (m_magFieldSvc->toroidOn()&&msTrack.perigeeParameters()->parameters()[Trk::qOverP]!=1/100000.&&msTrack.perigeeParameters()->parameters()[Trk::qOverP]!=0)) { + if((!fieldCache.toroidOn()&&fabs(idTrack.perigeeParameters()->parameters()[Trk::qOverP])*4000.<1)|| (fieldCache.toroidOn()&&msTrack.perigeeParameters()->parameters()[Trk::qOverP]!=1/100000.&&msTrack.perigeeParameters()->parameters()[Trk::qOverP]!=0)) { // Warnings only for high momentum ID tracks and MS tracks that have measured curvature (Straight track has pq= 100000) - if(!m_magFieldSvc->toroidOn()) ATH_MSG_WARNING(" Toroid off q*momentum of ID track " << 1./idTrack.perigeeParameters()->parameters()[Trk::qOverP]); - if(m_magFieldSvc->toroidOn()) ATH_MSG_WARNING(" Toroid on q*momentum of MS track " << 1./msTrack.perigeeParameters()->parameters()[Trk::qOverP]); + if(!fieldCache.toroidOn()) ATH_MSG_WARNING(" Toroid off q*momentum of ID track " << 1./idTrack.perigeeParameters()->parameters()[Trk::qOverP]); + if(fieldCache.toroidOn()) ATH_MSG_WARNING(" Toroid on q*momentum of MS track " << 1./msTrack.perigeeParameters()->parameters()[Trk::qOverP]); ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM+aggregation (null or !=3)"); if(!caloTSOS) { ATH_MSG_WARNING(" Zero Calorimeter TSOS from extrapolateM+aggregation"); diff --git a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..3afa22a2246f540678a92313526fb367cc9ac516 --- /dev/null +++ b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkTools/TrkParticleCreator diff --git a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h index 0664cebf9db68c0d43ffaa7f2e7c141798e5532b..dd2a055675c52fe35df9ce8edefad0c07628046a 100644 --- a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h +++ b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -14,27 +14,27 @@ changes : 11.02.04 added docu #ifndef TRKPARTICLECREATOR_PARTICLECREATORTOOL_H #define TRKPARTICLECREATOR_PARTICLECREATORTOOL_H +#include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/EventContext.h" #include "TrkToolInterfaces/ITrackParticleCreatorTool.h" -#include "AthenaBaseComps/AthAlgTool.h" #include "AthContainers/AuxElement.h" #include "EventPrimitives/EventPrimitivesHelpers.h" -#include "InDetIdentifier/PixelID.h" #include "ITrackToVertex/ITrackToVertex.h" +#include "InDetIdentifier/PixelID.h" #include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" #include "PixelGeoModel/IBLParameterSvc.h" #include "TrkEventPrimitives/FitQuality.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "TrkParticleBase/TrackParticleBase.h" // for TrackParticleOrigin enum #include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBase.h" // for TrackParticleOrigin enum #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" #include "TrkTrack/TrackInfo.h" -#include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/MuonTrackSummary.h" -#include "xAODTracking/TrackingPrimitives.h" +#include "TrkTrackSummary/TrackSummary.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/TrackingPrimitives.h" #include "xAODTracking/VertexFwd.h" #include "GaudiKernel/ToolHandle.h" @@ -42,104 +42,115 @@ changes : 11.02.04 added docu #include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MagFieldElements/AtlasFieldCache.h" -namespace Rec -{ - class TrackParticle; +namespace Rec { +class TrackParticle; } namespace InDet { - class BeamSpotData; +class BeamSpotData; } namespace Trk { - class Track; - class VxCandidate; +class Track; +class VxCandidate; class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreatorTool> - { - public: - - TrackParticleCreatorTool(const std::string&,const std::string&,const IInterface*); - - virtual ~TrackParticleCreatorTool() = default; - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - /** Method to construct a TrackParticle from a passed Track. Currently, it will ONLY fill the MeasuredPerigee - i.e. the TrackParticle will not be complete - @param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) - @param vxCandidate Pointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) - @param bsdata BeamSpot data - can be obtained with CondHandle or from a tool. - @param prtOrigin - @warning In my opinion, the interface is not optimal - we're not taking ownership of the Trk::Track or Vx::Candidate, - so they should be passed by reference. - */ - virtual - Rec::TrackParticle* createParticle( const Trk::Track* track, - const Trk::VxCandidate* vxCandidate, - Trk::TrackParticleOrigin prtOrigin) const override; - - /** Method to construct a xAOD::TrackParticle from a Rec::TrackParticle. - @param track particle - @param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership - */ - virtual - xAOD::TrackParticle* createParticle( const Rec::TrackParticle& trackParticle, xAOD::TrackParticleContainer* container ) const override; - - /** Method to construct a xAOD::TrackParticle from a passed Track. Currently, it will ONLY fill the MeasuredPerigee - i.e. the TrackParticle will not be complete - @param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) - @param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership - @param xAOD::Vertex Pointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) - @param prtOrigin Particle type - @param prd_to_track_map an optional PRD-to-track map to compute shared hits. - */ - virtual - xAOD::TrackParticle* createParticle( const Trk::Track& track, - xAOD::TrackParticleContainer* container, - const xAOD::Vertex* vxCandidate, - xAOD::ParticleHypothesis prtOrigin, - const Trk::PRDtoTrackMap *prd_to_track_map) const override; - - /** Method to construct a TrackParticle from a passed Track. Currently, it will ONLY fill the MeasuredPerigee - i.e. the TrackParticle will not be complete - @param track element link to a valid track (i.e. do not pass a zero!). - @param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership - @param xAOD::Vertex Pointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted) - @param prtOrigin - @param prd_to_track_map an optional PRD-to-track map to compute shared hits. - */ - virtual - xAOD::TrackParticle* createParticle( const ElementLink<TrackCollection>& trackLink, - xAOD::TrackParticleContainer* container, - const xAOD::Vertex* vxCandidate, - xAOD::ParticleHypothesis prtOrigin, - const Trk::PRDtoTrackMap *prd_to_track_map) const override; - - /** create a xAOD::TrackParticle out of constituents */ - virtual - xAOD::TrackParticle* createParticle( const Perigee* perigee, const FitQuality* fq, const TrackInfo* trackInfo, const TrackSummary* summary, - const std::vector<const Trk::TrackParameters*>& parameters, - const std::vector< xAOD::ParameterPosition>& positions, - xAOD::ParticleHypothesis prtOrigin, - xAOD::TrackParticleContainer* container ) const override; - - /** Method to set FitQuality of a xAOD::TrackParticle */ - void setFitQuality( xAOD::TrackParticle& tp, const FitQuality& fq ) const; - - /** Method to set TrackInfo of a xAOD::TrackParticle */ - void setTrackInfo( xAOD::TrackParticle& tp, const TrackInfo& trackInfo, xAOD::ParticleHypothesis prtOrigin ) const; - - /** Method to set TrackSummary of a xAOD::TrackParticle */ - void setTrackSummary( xAOD::TrackParticle& tp, const TrackSummary& summary ) const; - - /** Method to set Defining parameters of a xAOD::TrackParticle */ - void setDefiningParameters( xAOD::TrackParticle& tp, const Perigee& perigee ) const; - - /** Method to set parameters of a xAOD::TrackParticle */ - void setParameters( xAOD::TrackParticle& tp, const std::vector<const Trk::TrackParameters*>& parameters, const std::vector< xAOD::ParameterPosition>& positions ) const; +{ +public: + TrackParticleCreatorTool(const std::string&, const std::string&, const IInterface*); + + virtual ~TrackParticleCreatorTool() = default; + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + /** Method to construct a TrackParticle from a passed Track. Currently, it + will ONLY fill the MeasuredPerigee i.e. the TrackParticle will not be complete + @param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is + not taken (i.e. it will not be deleted) + @param vxCandidate Pointer to a valid vxCandidate (i.e. do not pass a zero!). + Ownership is not taken (i.e. it will not be deleted) + @param bsdata BeamSpot data - can be obtained with CondHandle or from a tool. + @param prtOrigin + @warning In my opinion, the interface is not optimal - we're not taking + ownership of the Trk::Track or Vx::Candidate, so they should be passed by + reference. + */ + virtual Rec::TrackParticle* createParticle(const Trk::Track* track, + const Trk::VxCandidate* vxCandidate, + Trk::TrackParticleOrigin prtOrigin) const override; + + /** Method to construct a xAOD::TrackParticle from a Rec::TrackParticle. + @param track particle + @param TrackParticleContainer needed to have an AuxStore, if provided particle + will be added to store which takes ownership + */ + virtual xAOD::TrackParticle* createParticle(const Rec::TrackParticle& trackParticle, + xAOD::TrackParticleContainer* container) const override; + + /** Method to construct a xAOD::TrackParticle from a passed Track. Currently, + it will ONLY fill the MeasuredPerigee i.e. the TrackParticle will not be + complete + @param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is + not taken (i.e. it will not be deleted) + @param TrackParticleContainer needed to have an AuxStore, if provided particle + will be added to store which takes ownership + @param xAOD::Vertex Pointer to a valid vxCandidate (i.e. do not pass a zero!). + Ownership is not taken (i.e. it will not be deleted) + @param prtOrigin Particle type + @param prd_to_track_map an optional PRD-to-track map to compute shared hits. + */ + virtual xAOD::TrackParticle* createParticle(const Trk::Track& track, + xAOD::TrackParticleContainer* container, + const xAOD::Vertex* vxCandidate, + xAOD::ParticleHypothesis prtOrigin, + const Trk::PRDtoTrackMap* prd_to_track_map) const override; + + /** Method to construct a TrackParticle from a passed Track. Currently, it + will ONLY fill the MeasuredPerigee i.e. the TrackParticle will not be complete + @param track element link to a valid track (i.e. do not pass a zero!). + @param TrackParticleContainer needed to have an AuxStore, if provided particle + will be added to store which takes ownership + @param xAOD::Vertex Pointer to a valid vxCandidate (i.e. do not pass a zero!). + Ownership is not taken (i.e. it will not be deleted) + @param prtOrigin + @param prd_to_track_map an optional PRD-to-track map to compute shared hits. + */ + virtual xAOD::TrackParticle* createParticle(const ElementLink<TrackCollection>& trackLink, + xAOD::TrackParticleContainer* container, + const xAOD::Vertex* vxCandidate, + xAOD::ParticleHypothesis prtOrigin, + const Trk::PRDtoTrackMap* prd_to_track_map) const override; + + /** create a xAOD::TrackParticle out of constituents */ + virtual xAOD::TrackParticle* createParticle(const Perigee* perigee, + const FitQuality* fq, + const TrackInfo* trackInfo, + const TrackSummary* summary, + const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector<xAOD::ParameterPosition>& positions, + xAOD::ParticleHypothesis prtOrigin, + xAOD::TrackParticleContainer* container) const override; + + /** Method to set FitQuality of a xAOD::TrackParticle */ + void setFitQuality(xAOD::TrackParticle& tp, const FitQuality& fq) const; + + /** Method to set TrackInfo of a xAOD::TrackParticle */ + void setTrackInfo(xAOD::TrackParticle& tp, + const TrackInfo& trackInfo, + xAOD::ParticleHypothesis prtOrigin) const; + + /** Method to set TrackSummary of a xAOD::TrackParticle */ + void setTrackSummary(xAOD::TrackParticle& tp, const TrackSummary& summary) const; + + /** Method to set Defining parameters of a xAOD::TrackParticle */ + void setDefiningParameters(xAOD::TrackParticle& tp, const Perigee& perigee) const; + + /** Method to set parameters of a xAOD::TrackParticle */ + void setParameters(xAOD::TrackParticle& tp, + const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector<xAOD::ParameterPosition>& positions) const; void setTilt(xAOD::TrackParticle& tp, float tiltx, float tilty) const; @@ -149,121 +160,90 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato void setNumberOfOverflowHits(xAOD::TrackParticle& tp, int overflows) const; - /** Get the name used for the decoration of the track particle with the number of used hits for TRT dE/dx computation.*/ - static const std::string & trtdEdxUsedHitsAuxName() { return s_trtdEdxUsedHitsDecorationName; } - virtual const InDet::BeamSpotData* CacheBeamSpotData(const ::EventContext &ctx) const override; + /** Get the name used for the decoration of the track particle with the number + * of used hits for TRT dE/dx computation.*/ + static const std::string& trtdEdxUsedHitsAuxName() { return s_trtdEdxUsedHitsDecorationName; } + virtual const InDet::BeamSpotData* CacheBeamSpotData(const ::EventContext& ctx) const override; private: - - void compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const; - void compare( const TrackParameters& tp1, const TrackParameters& tp2 ) const; + void compare(const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx) const; + void compare(const TrackParameters& tp1, const TrackParameters& tp2) const; /**atlas id helper*/ const AtlasDetectorID* m_detID; const PixelID* m_pixelID; - //Need to change to private when is safe to do so - PublicToolHandle<IExtendedTrackSummaryTool> m_trackSummaryTool{this, - "TrackSummaryTool","Trk::TrackSummaryTool/AtlasTrackSummaryTool"}; - - PublicToolHandle<IExtrapolator> m_extrapolator{this, - "Extrapolator","Trk::Extrapolator/AtlasExtrapolator"}; + // Need to change to private when is safe to do so + PublicToolHandle<IExtendedTrackSummaryTool> m_trackSummaryTool{ + this, + "TrackSummaryTool", + "Trk::TrackSummaryTool/AtlasTrackSummaryTool" + }; - ToolHandle<Reco::ITrackToVertex> m_trackToVertex{this, - "TrackToVertex","Reco::TrackToVertex/TrackToVertex"}; - ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool{this, - "MuonSummaryTool","Muon::MuonHitSummaryTool/MuonHitSummaryTool"}; + PublicToolHandle<IExtrapolator> m_extrapolator{ this, + "Extrapolator", + "Trk::Extrapolator/AtlasExtrapolator" }; + ToolHandle<Reco::ITrackToVertex> m_trackToVertex{ this, + "TrackToVertex", + "Reco::TrackToVertex/TrackToVertex" }; + ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool{ this, + "MuonSummaryTool", + "Muon::MuonHitSummaryTool/MuonHitSummaryTool" }; /** to query magnetic field configuration */ - //ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - ServiceHandle <IBLParameterSvc> m_IBLParameterSvc; - - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", - "Name of the Magnetic Field conditions object key"}; + // ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - /** Configurable to set the eProbabilities and extra track summary types which are to be copied from the track summary.*/ - std::vector<std::string> m_copyExtraSummaryName; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey{ + this, + "AtlasFieldCacheCondObj", + "fieldCondObj", + "Name of the Magnetic Field conditions object key" + }; - /** Enums of an eProbability which are set in the xAOD::TrackSummary.*/ - std::vector<Trk::eProbabilityType> m_copyEProbabilities; + /** Configurable to set the eProbabilities and extra track summary types which + * are to be copied from the track summary.*/ + std::vector<std::string> m_copyExtraSummaryName; - /** The pairs if enums of an eProbability which is added as a decoration to the track particle and the name of the decoration.*/ - std::vector<std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> > m_decorateEProbabilities; - std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> > m_decorateSummaryTypes; + /** Enums of an eProbability which are set in the xAOD::TrackSummary.*/ + std::vector<Trk::eProbabilityType> m_copyEProbabilities; + /** The pairs if enums of an eProbability which is added as a decoration to + * the track particle and the name of the decoration.*/ + std::vector<std::pair<SG::AuxElement::Decorator<float>, Trk::eProbabilityType>> m_decorateEProbabilities; + std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>, Trk::SummaryType>> m_decorateSummaryTypes; /** Name used for the decoration of the track particle with TRT dE/dx .*/ static const std::string s_trtdEdxUsedHitsDecorationName; static const SG::AuxElement::Decorator<uint8_t> s_trtdEdxUsedHitsDecoration; - bool m_doIBL; bool m_useTrackSummaryTool; bool m_useMuonSummaryTool; - bool m_forceTrackSummaryUpdate; /** use to force an update of the track summary - rather than using the cached summary */ - bool m_computeAdditionalInfo; ///< if the track contains a summary, the shared, expected hit, and PID information will be recomputed. The summary of the track is not updated. - /** the following keep options are mutually exclusive **/ - bool m_keepParameters; /** keep all TrackParameters */ - bool m_keepFirstParameters; ///< keep the first parameters when creating track particles. - bool m_keepAllPerigee; /** keep all MeasuredPerigee parameters - (e.g. adding those that may exist at Volume boundaries) */ + ///< if the track contains a summary, the shared, expected hit, and PID + ///< information will be recomputed. The summary of the track is not updated. + bool m_computeAdditionalInfo; + /** the following keep options are mutually exclusive **/ + /** keep all TrackParameters */ + bool m_keepParameters; + ///< keep the first parameters when creating track particles. + bool m_keepFirstParameters; + /** keep all MeasuredPerigee parameters (e.g. adding those that may exist at + * Volume boundaries) */ + bool m_keepAllPerigee; bool m_expressPerigeeToBeamSpot; int m_badclusterID; std::string m_perigeeExpression; - std::vector<std::string> m_perigeeOptions{"BeamLine", "BeamSpot", "Vertex", "Origin"}; + std::vector<std::string> m_perigeeOptions{ "BeamLine", "BeamSpot", "Vertex", "Origin" }; bool m_checkConversion; int m_minSiHits; double m_minPt; - bool castPerigeeAndCheck(const Trk::Track* track, const Trk::Perigee* &aPer) const; - bool m_updateTrack; + bool castPerigeeAndCheck(const Trk::Track* track, const Trk::Perigee*& aPer) const; }; -inline void TrackParticleCreatorTool::setFitQuality( xAOD::TrackParticle& tp, const FitQuality& fq ) const { - tp.setFitQuality(fq.chiSquared(), static_cast<float>(fq.doubleNumberDoF ())); -} - -inline void TrackParticleCreatorTool::setTrackInfo( xAOD::TrackParticle& tp, const TrackInfo& trackInfo, xAOD::ParticleHypothesis prtOrigin ) const { - unsigned int properties=0; - for (unsigned int i = 0; i< Trk::TrackInfo::NumberOfTrackProperties ; i++){ - if (trackInfo.trackProperties(static_cast<Trk::TrackInfo::TrackProperties>(i))) properties |= (1<<i); - } - tp.setTrackProperties(static_cast<xAOD::TrackProperties>(properties)); - uint64_t patternReco=0; - const uint64_t c1=1; - - for (unsigned int i = 0; i< xAOD::NumberOfTrackRecoInfo ; i++){ - if (trackInfo.patternRecoInfo(static_cast<Trk::TrackInfo::TrackPatternRecoInfo>(i))) patternReco |= c1 << i; - } - - tp.setPatternRecognitionInfo(patternReco); - - if( prtOrigin == xAOD::noHypothesis ) tp.setParticleHypothesis(static_cast<xAOD::ParticleHypothesis>(trackInfo.particleHypothesis () ) ); - else tp.setParticleHypothesis(prtOrigin); - tp.setTrackFitter(static_cast<xAOD::TrackFitter>(trackInfo.trackFitter () ) ); -} - - -inline void TrackParticleCreatorTool::setDefiningParameters( xAOD::TrackParticle& tp, const Perigee& perigee ) const { - tp.setDefiningParameters(perigee.parameters()[Trk::d0], - perigee.parameters()[Trk::z0], - perigee.parameters()[Trk::phi0], - perigee.parameters()[Trk::theta], - perigee.parameters()[Trk::qOverP]); - const AmgSymMatrix(5)* covMatrix = perigee.covariance(); - // see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to comment out the following line - // assert(covMatrix && covMatrix->rows()==5&& covMatrix->cols()==5); - std::vector<float> covMatrixVec; - if( !covMatrix ) ATH_MSG_WARNING("Setting Defining parameters without error matrix"); - else Amg::compress(*covMatrix,covMatrixVec); - tp.setDefiningParametersCovMatrixVec(covMatrixVec); - const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center(); - tp.setParametersOrigin(surfaceCenter.x(), surfaceCenter.y(), surfaceCenter.z() ); -} - } // end of namespace Trk - +#include "TrkParticleCreator/TrackParticleCreatorTool.icc" #endif diff --git a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.icc b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.icc new file mode 100644 index 0000000000000000000000000000000000000000..a1f3aaee224453cf2547038345748e71df2f5e9d --- /dev/null +++ b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.icc @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +namespace Trk { +inline void +TrackParticleCreatorTool::setFitQuality(xAOD::TrackParticle& tp, const FitQuality& fq) const +{ + tp.setFitQuality(fq.chiSquared(), static_cast<float>(fq.doubleNumberDoF())); +} + +inline void +TrackParticleCreatorTool::setTrackInfo(xAOD::TrackParticle& tp, + const TrackInfo& trackInfo, + xAOD::ParticleHypothesis prtOrigin) const +{ + unsigned int properties = 0; + for (unsigned int i = 0; i < Trk::TrackInfo::NumberOfTrackProperties; i++) { + if (trackInfo.trackProperties(static_cast<Trk::TrackInfo::TrackProperties>(i))) + properties |= (1 << i); + } + tp.setTrackProperties(static_cast<xAOD::TrackProperties>(properties)); + uint64_t patternReco = 0; + const uint64_t c1 = 1; + + for (unsigned int i = 0; i < xAOD::NumberOfTrackRecoInfo; i++) { + if (trackInfo.patternRecoInfo(static_cast<Trk::TrackInfo::TrackPatternRecoInfo>(i))){ + patternReco |= c1 << i; + } + } + + tp.setPatternRecognitionInfo(patternReco); + + if (prtOrigin == xAOD::noHypothesis){ + tp.setParticleHypothesis(static_cast<xAOD::ParticleHypothesis>(trackInfo.particleHypothesis())); + } + else{ + tp.setParticleHypothesis(prtOrigin); + } + tp.setTrackFitter(static_cast<xAOD::TrackFitter>(trackInfo.trackFitter())); +} + +inline void +TrackParticleCreatorTool::setDefiningParameters(xAOD::TrackParticle& tp, + const Perigee& perigee) const +{ + tp.setDefiningParameters(perigee.parameters()[Trk::d0], + perigee.parameters()[Trk::z0], + perigee.parameters()[Trk::phi0], + perigee.parameters()[Trk::theta], + perigee.parameters()[Trk::qOverP]); + const AmgSymMatrix(5)* covMatrix = perigee.covariance(); + // see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to + // comment out the following line assert(covMatrix && covMatrix->rows()==5&& + // covMatrix->cols()==5); + std::vector<float> covMatrixVec; + if (!covMatrix) + ATH_MSG_WARNING("Setting Defining parameters without error matrix"); + else + Amg::compress(*covMatrix, covMatrixVec); + tp.setDefiningParametersCovMatrixVec(covMatrixVec); + const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center(); + tp.setParametersOrigin(surfaceCenter.x(), surfaceCenter.y(), surfaceCenter.z()); +} +} + diff --git a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx index e813b8206e49e134bbc876a4b488dd729f0da2a7..fa11afe73f8be91a4809b169b69340d8fc67d8eb 100644 --- a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx +++ b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx @@ -68,79 +68,81 @@ inline MsgStream& operator<<( MsgStream& msg_stream, const std::vector<std::stri return msg_stream; } -namespace Trk -{ - const std::string TrackParticleCreatorTool::s_trtdEdxUsedHitsDecorationName {"TRTdEdxUsedHits"}; - - namespace { - void createEProbabilityMap(std::map<std::string,std::pair<Trk::eProbabilityType, bool> > &eprob_map) { - // key: name to be used to activate copying of the electron probability values to the xAOD TrackParticle - // abd for those which are added as decoration the name to be used for the decoration - // value.first: enum of the electron probability value - // value.second: false is a non dynamic element of the xAOD TrackParticle and added via setTrackSummary - // true will be added as a decoration. - eprob_map.insert( std::make_pair("eProbabilityComb",std::make_pair(Trk::eProbabilityComb,false)) ); - eprob_map.insert( std::make_pair("eProbabilityHT",std::make_pair(Trk::eProbabilityHT,false)) ); - - // added as decorations - eprob_map.insert( std::make_pair("eProbabilityToT",std::make_pair(Trk::eProbabilityToT,true)) ); - eprob_map.insert( std::make_pair("eProbabilityBrem",std::make_pair(Trk::eProbabilityBrem,true)) ); - eprob_map.insert( std::make_pair("TRTTrackOccupancy",std::make_pair(Trk::numberOfeProbabilityTypes,true)) ); - eprob_map.insert( std::make_pair("TRTdEdx",std::make_pair(static_cast<Trk::eProbabilityType>(Trk::numberOfeProbabilityTypes+1), - true)) ); - } +namespace Trk { +const std::string TrackParticleCreatorTool::s_trtdEdxUsedHitsDecorationName{ "TRTdEdxUsedHits" }; - void createExtraSummaryTypeMap(std::map<std::string,Trk::SummaryType > &extra_summary_type_map) { - extra_summary_type_map.insert( std::make_pair("TRTdEdxUsedHits",Trk::numberOfTRTHitsUsedFordEdx)); - } - } +namespace { +void +createEProbabilityMap(std::map<std::string, std::pair<Trk::eProbabilityType, bool>>& eprob_map) +{ + // key: name to be used to activate copying of the electron probability values to the xAOD TrackParticle + // abd for those which are added as decoration the name to be used for the decoration + // value.first: enum of the electron probability value + // value.second: false is a non dynamic element of the xAOD TrackParticle and added via setTrackSummary + // true will be added as a decoration. + eprob_map.insert(std::make_pair("eProbabilityComb", std::make_pair(Trk::eProbabilityComb, false))); + eprob_map.insert(std::make_pair("eProbabilityHT", std::make_pair(Trk::eProbabilityHT, false))); + + // added as decorations + eprob_map.insert(std::make_pair("eProbabilityToT", std::make_pair(Trk::eProbabilityToT, true))); + eprob_map.insert(std::make_pair("eProbabilityBrem", std::make_pair(Trk::eProbabilityBrem, true))); + eprob_map.insert(std::make_pair("TRTTrackOccupancy", std::make_pair(Trk::numberOfeProbabilityTypes, true))); + eprob_map.insert(std::make_pair( + "TRTdEdx", std::make_pair(static_cast<Trk::eProbabilityType>(Trk::numberOfeProbabilityTypes + 1), true))); +} +void +createExtraSummaryTypeMap(std::map<std::string, Trk::SummaryType>& extra_summary_type_map) +{ + extra_summary_type_map.insert(std::make_pair("TRTdEdxUsedHits", Trk::numberOfTRTHitsUsedFordEdx)); +} +} - const SG::AuxElement::Decorator<uint8_t> TrackParticleCreatorTool::s_trtdEdxUsedHitsDecoration(TrackParticleCreatorTool::trtdEdxUsedHitsAuxName()) ; - - TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, const std::string& n, const IInterface* p ) - : base_class(t,n,p), - m_detID(nullptr), - m_pixelID(nullptr), - m_IBLParameterSvc("IBLParameterSvc",n), - m_copyExtraSummaryName {"eProbabilityComb","eProbabilityHT","TRTTrackOccupancy","TRTdEdx","TRTdEdxUsedHits"}, - m_copyEProbabilities{}, - m_decorateEProbabilities{}, - m_decorateSummaryTypes{}, - m_doIBL(false), - m_useTrackSummaryTool (true), - m_useMuonSummaryTool (false), - m_forceTrackSummaryUpdate (false), - m_computeAdditionalInfo (false), - m_keepParameters (false), - m_keepFirstParameters(false), - m_keepAllPerigee (false), - m_expressPerigeeToBeamSpot(true), - m_perigeeExpression("BeamLine") - { - declareProperty("ForceTrackSummaryUpdate", m_forceTrackSummaryUpdate ); - declareProperty("ComputeAdditionalInfo", m_computeAdditionalInfo); - declareProperty("UpdateTrack", m_updateTrack=true ); - declareProperty("UseTrackSummaryTool" , m_useTrackSummaryTool); - declareProperty("UseMuonSummaryTool" , m_useMuonSummaryTool); - declareProperty("KeepParameters", m_keepParameters); - declareProperty("KeepFirstParameters", m_keepFirstParameters); - declareProperty("KeepAllPerigee", m_keepAllPerigee); - declareProperty("ExpressPerigeeToBeamSpot", m_expressPerigeeToBeamSpot); - declareProperty("CheckConversion", m_checkConversion=true); - declareProperty("MinSiHitsForCaloExtrap", m_minSiHits = 4 ); - declareProperty("MinPtForCaloExtrap", m_minPt = 1000. ); - declareProperty("PerigeeExpression", m_perigeeExpression); - declareProperty("BadClusterID", m_badclusterID = 0); //0 = off, 1 = OOT, 2 = dE/dx, 3 = combination of OOT and dE/dx, 4 = combination of OOT, dE/dx, and size - declareProperty("ExtraSummaryTypes", m_copyExtraSummaryName); - } +const SG::AuxElement::Decorator<uint8_t> TrackParticleCreatorTool::s_trtdEdxUsedHitsDecoration( + TrackParticleCreatorTool::trtdEdxUsedHitsAuxName()); + +TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, const std::string& n, const IInterface* p) + : base_class(t, n, p) + , m_detID(nullptr) + , m_pixelID(nullptr) + , m_IBLParameterSvc("IBLParameterSvc", n) + , m_copyExtraSummaryName{ "eProbabilityComb", "eProbabilityHT", "TRTTrackOccupancy", "TRTdEdx", "TRTdEdxUsedHits" } + , m_copyEProbabilities{} + , m_decorateEProbabilities{} + , m_decorateSummaryTypes{} + , m_doIBL(false) + , m_useTrackSummaryTool(true) + , m_useMuonSummaryTool(false) + , m_computeAdditionalInfo(false) + , m_keepParameters(false) + , m_keepFirstParameters(false) + , m_keepAllPerigee(false) + , m_expressPerigeeToBeamSpot(true) + , m_perigeeExpression("BeamLine") +{ + declareProperty("ComputeAdditionalInfo", m_computeAdditionalInfo); + declareProperty("UseTrackSummaryTool", m_useTrackSummaryTool); + declareProperty("UseMuonSummaryTool", m_useMuonSummaryTool); + declareProperty("KeepParameters", m_keepParameters); + declareProperty("KeepFirstParameters", m_keepFirstParameters); + declareProperty("KeepAllPerigee", m_keepAllPerigee); + declareProperty("ExpressPerigeeToBeamSpot", m_expressPerigeeToBeamSpot); + declareProperty("CheckConversion", m_checkConversion = true); + declareProperty("MinSiHitsForCaloExtrap", m_minSiHits = 4); + declareProperty("MinPtForCaloExtrap", m_minPt = 1000.); + declareProperty("PerigeeExpression", m_perigeeExpression); + // 0 = off, 1 = OOT, 2 = dE/dx, 3 = combination of OOT and dE/dx, 4 = combination of OOT, dE/dx, and size + declareProperty("BadClusterID", m_badclusterID = 0); + declareProperty("ExtraSummaryTypes", m_copyExtraSummaryName); +} StatusCode TrackParticleCreatorTool::initialize() { ATH_MSG_DEBUG("initialize TrackParticleCreatorTool"); - if (std::find(std::begin(m_perigeeOptions), std::end(m_perigeeOptions), m_perigeeExpression) == std::end(m_perigeeOptions)){ + if (std::find(std::begin(m_perigeeOptions), std::end(m_perigeeOptions), m_perigeeExpression) == + std::end(m_perigeeOptions)) { ATH_MSG_ERROR("Unknown Configuration for Perigee Expression - please use one of " << m_perigeeOptions); return StatusCode::FAILURE; } @@ -243,7 +245,7 @@ namespace Trk } else { m_decorateSummaryTypes.emplace_back(SG::AuxElement::Decorator<uint8_t>(extra_summary_type_iter->first), - extra_summary_type_iter->second); + extra_summary_type_iter->second); } } else { @@ -251,13 +253,15 @@ namespace Trk m_copyEProbabilities.push_back(eprob_iter->second.first); } else{ - m_decorateEProbabilities.emplace_back(SG::AuxElement::Decorator<float>(eprob_iter->first),eprob_iter->second.first); + m_decorateEProbabilities.emplace_back(SG::AuxElement::Decorator<float>(eprob_iter->first), + eprob_iter->second.first); } } } if (!errors.empty()) { - ATH_MSG_ERROR( "Error in configuration. Unknown electron probability name: " << errors << ". known are " << eprob_map << " " << extra_summary_type_map); + ATH_MSG_ERROR("Error in configuration. Unknown electron probability name: " + << errors << ". known are " << eprob_map << " " << extra_summary_type_map); sc = StatusCode::FAILURE; } } @@ -308,14 +312,15 @@ namespace Trk } else if (m_perigeeExpression == "BeamSpot"){ //Express parameters at beamspot - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamspot( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); - if (!result){ + const Trk::Perigee* result = + m_trackToVertex->perigeeAtBeamspot(*track, CacheBeamSpotData(Gaudi::Hive::currentContext())); + if (!result) { - ATH_MSG_WARNING("Failed to extrapolate to first Beamspot"); - if ( !track->perigeeParameters() ){ - return nullptr; - } - aPer = track->perigeeParameters()->clone(); + ATH_MSG_WARNING("Failed to extrapolate to first Beamspot"); + if (!track->perigeeParameters()) { + return nullptr; + } + aPer = track->perigeeParameters()->clone(); } else { aPer = result; } @@ -342,7 +347,8 @@ namespace Trk } } else if (m_perigeeExpression == "BeamLine"){ - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline( *track, CacheBeamSpotData(Gaudi::Hive::currentContext()) ); + const Trk::Perigee* result = + m_trackToVertex->perigeeAtBeamline(*track, CacheBeamSpotData(Gaudi::Hive::currentContext())); if (!result){ ATH_MSG_WARNING("Failed to extrapolate to Beamline"); @@ -357,11 +363,6 @@ namespace Trk std::unique_ptr<const Trk::TrackSummary> summary; if (m_trackSummaryTool.get()!=nullptr) { - if (m_forceTrackSummaryUpdate) { - // Do we really need to update const Trk::Track* track? - Trk::Track& nonConstTrack = const_cast<Trk::Track&>(*track); - m_trackSummaryTool->updateTrack(nonConstTrack); - } summary.reset(m_trackSummaryTool->createSummary(*track)); if (summary == nullptr) { ATH_MSG_DEBUG ("No proper TrackSummary was returned. Creating TrackParticle with a dummy TrackSummary"); @@ -376,9 +377,6 @@ namespace Trk summary = std::make_unique<Trk::TrackSummary>(); } } - if (m_forceTrackSummaryUpdate || m_updateTrack) { - ATH_MSG_WARNING("Updating tracks violates const-ness and is most likely not thread safe!"); - } // find the first and the last hit in track // we do that the same way as in the track slimming tool! @@ -405,18 +403,19 @@ namespace Trk } // search last valid TSOS first - for ( DataVector<const TrackStateOnSurface>::const_reverse_iterator rItTSoS = trackStates->rbegin(); rItTSoS != trackStates->rend(); ++rItTSoS) - { + for (DataVector<const TrackStateOnSurface>::const_reverse_iterator rItTSoS = trackStates->rbegin(); + rItTSoS != trackStates->rend(); + ++rItTSoS) { if ( (*rItTSoS)->type(TrackStateOnSurface::Measurement) && (*rItTSoS)->trackParameters()!=nullptr && (*rItTSoS)->measurementOnTrack()!=nullptr && !dynamic_cast<const Trk::PseudoMeasurementOnTrack*>((*rItTSoS)->measurementOnTrack())) { - if (!(first == (*rItTSoS)->trackParameters())) parameters.push_back((*rItTSoS)->trackParameters()->clone()); - break; + if (!(first == (*rItTSoS)->trackParameters())) + parameters.push_back((*rItTSoS)->trackParameters()->clone()); + break; } } - // security check: if (parameters.size() > 2) ATH_MSG_WARNING ("More than two additional track parameters to be stored in TrackParticle!"); @@ -466,7 +465,8 @@ namespace Trk } const Trk::FitQuality* fitQuality = new FitQuality( (*track->fitQuality()) ); - Rec::TrackParticle* tp = new Rec::TrackParticle(track, prtOrigin, vxCandidate, summary.release(), parameters, aPer, fitQuality); + Rec::TrackParticle* tp = + new Rec::TrackParticle(track, prtOrigin, vxCandidate, summary.release(), parameters, aPer, fitQuality); return tp; } @@ -519,7 +519,8 @@ namespace Trk } } else if (m_perigeeExpression == "BeamLine"){ - const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); + const Trk::Perigee* result = + m_trackToVertex->perigeeAtBeamline(track, CacheBeamSpotData(Gaudi::Hive::currentContext())); if (!result){ ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created."); return nullptr; @@ -529,31 +530,27 @@ namespace Trk aPer = result; } } - std::unique_ptr<Trk::TrackSummary> cleanup_summary; - const Trk::TrackSummary *summary=track.trackSummary(); + /* + * We start from the existing summary + * and see what we want to add + */ + std::unique_ptr<Trk::TrackSummary> updated_summary; + const Trk::TrackSummary* summary = track.trackSummary(); if (m_trackSummaryTool.get() != nullptr) { - if (m_updateTrack) { - if (m_forceTrackSummaryUpdate || !track.trackSummary()){ - // Do we really need to update const Trk::Track& track? - Trk::Track& nonConstTrack = const_cast<Trk::Track&>(track); - m_trackSummaryTool->updateTrack(nonConstTrack); // @TODO will not take PRD-to-track map into account. - } - summary=track.trackSummary(); - } - else if (!track.trackSummary()) { - cleanup_summary = m_trackSummaryTool->summary(track, prd_to_track_map); - summary=cleanup_summary.get(); + if (!track.trackSummary()) { + updated_summary = m_trackSummaryTool->summary(track, prd_to_track_map); + summary = updated_summary.get(); + } else if (m_computeAdditionalInfo) { + updated_summary = std::make_unique<Trk::TrackSummary>(*track.trackSummary()); + m_trackSummaryTool->updateAdditionalInfo(track, prd_to_track_map, *updated_summary); + summary = updated_summary.get(); } - else if (m_computeAdditionalInfo) { - cleanup_summary = std::make_unique<Trk::TrackSummary>(*track.trackSummary()); - m_trackSummaryTool->updateAdditionalInfo(track, prd_to_track_map,*cleanup_summary); - summary = cleanup_summary.get(); - } - }else{ - ATH_MSG_VERBOSE ("No proper TrackSummaryTool found. Creating TrackParticle with a TrackSummary on track"); + } else { + ATH_MSG_VERBOSE( + "No proper TrackSummaryTool found. Creating TrackParticle with a TrackSummary on track"); } if (!summary) { - ATH_MSG_WARNING ("Track particle created for a track without a track summary"); + ATH_MSG_WARNING("Track particle created for a track without a track summary"); } // find the first and the last hit in track @@ -577,11 +574,16 @@ namespace Trk if (m_badclusterID!=0) { for (const TrackStateOnSurface* tsos : *trackStates) { - if ( tsos->type(TrackStateOnSurface::Measurement) && tsos->trackParameters()!=nullptr && - tsos->measurementOnTrack()!=nullptr && !dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tsos->measurementOnTrack())) { + if (tsos->type(TrackStateOnSurface::Measurement) && + tsos->trackParameters() != nullptr && + tsos->measurementOnTrack() != nullptr && + !dynamic_cast<const Trk::PseudoMeasurementOnTrack*>( + tsos->measurementOnTrack())) { tp = tsos->trackParameters(); - const InDet::SiClusterOnTrack *clus = dynamic_cast< const InDet::SiClusterOnTrack*>(tsos->measurementOnTrack()); + const InDet::SiClusterOnTrack* clus = + dynamic_cast<const InDet::SiClusterOnTrack*>( + tsos->measurementOnTrack()); if (!clus){ ATH_MSG_DEBUG( "Failed dynamic_cast to InDet::SiClusterOnTrack "); continue; @@ -591,7 +593,8 @@ namespace Trk if (!prdc){ ATH_MSG_DEBUG( "No PRD for Si cluster" ); } - const InDet::SiCluster *RawDataClus = dynamic_cast< const InDet::SiCluster*>(clus->prepRawData()); + const InDet::SiCluster* RawDataClus = + dynamic_cast<const InDet::SiCluster*>(clus->prepRawData()); if (!RawDataClus){ ATH_MSG_DEBUG( "No RDC for Si cluster" ); continue; @@ -601,7 +604,8 @@ namespace Trk if (RawDataClus->detectorElement()->isPixel()) { const InDetDD::SiDetectorElement* element = nullptr; - const InDet::PixelCluster* pixelCluster=dynamic_cast<const InDet::PixelCluster*>(RawDataClus); + const InDet::PixelCluster* pixelCluster = + dynamic_cast<const InDet::PixelCluster*>(RawDataClus); if (!pixelCluster){ ATH_MSG_DEBUG( "Pixel cluster null though detector element matches pixel" ); } @@ -657,7 +661,10 @@ namespace Trk } int isIBLclus =false; - if (m_doIBL && m_pixelID->barrel_ec(surfaceID) == 0 && m_pixelID->layer_disk(surfaceID) == 0){isIBLclus = true;} + if (m_doIBL && m_pixelID->barrel_ec(surfaceID) == 0 && + m_pixelID->layer_disk(surfaceID) == 0) { + isIBLclus = true; + } //count bad clusters if (!isIBLclus){ @@ -665,14 +672,18 @@ namespace Trk isBC_A1=true; nbc_meas_A1++; } - if (charge<13750./cos(theta)-22500.){ // Need to replace these magic numbers with constexpr with meaning full names + // Need to replace these magic numbers with constexpr with meaning full names + if (charge<13750./cos(theta)-22500.){ isBC_B3=true; nbc_meas_B3++; } if (isBC_A1 || isBC_B3){ nbc_meas_A1_or_B3++; } - if ((zWidth==1 && cotthetaz>5.8) || (zWidth==2 && cotthetaz>5.8) || (zWidth==3 && cotthetaz>6.2) || (zWidth>3 && cotthetaz<2.5)){ + if ((zWidth == 1 && cotthetaz > 5.8) || + (zWidth == 2 && cotthetaz > 5.8) || + (zWidth == 3 && cotthetaz > 6.2) || + (zWidth > 3 && cotthetaz < 2.5)) { isBC_C=true; } if (isBC_A1 || isBC_B3 || isBC_C){ @@ -682,7 +693,6 @@ namespace Trk } } } - } } if (m_keepParameters || m_keepFirstParameters) { @@ -701,7 +711,8 @@ namespace Trk if (!m_keepFirstParameters) { // search last valid TSOS first - for ( DataVector<const TrackStateOnSurface>::const_reverse_iterator rItTSoS = trackStates->rbegin(); rItTSoS != trackStates->rend(); ++rItTSoS) { + for (DataVector<const TrackStateOnSurface>::const_reverse_iterator + rItTSoS = trackStates->rbegin(); rItTSoS != trackStates->rend(); ++rItTSoS) { if ( (*rItTSoS)->type(TrackStateOnSurface::Measurement) && (*rItTSoS)->trackParameters()!=nullptr && (*rItTSoS)->measurementOnTrack()!=nullptr && @@ -759,7 +770,14 @@ namespace Trk } } - xAOD::TrackParticle* trackparticle = createParticle(aPer,track.fitQuality(),&track.info(),summary,parameters,parameterPositions,prtOrigin,container); + xAOD::TrackParticle* trackparticle = createParticle(aPer, + track.fitQuality(), + &track.info(), + summary, + parameters, + parameterPositions, + prtOrigin, + container); switch (m_badclusterID) { case 1: { trackparticle->auxdecor<int>("nBC_meas")=nbc_meas_A1; @@ -785,7 +803,9 @@ namespace Trk return trackparticle; } - xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const Rec::TrackParticle& trackParticle, xAOD::TrackParticleContainer* container ) const { + xAOD::TrackParticle* TrackParticleCreatorTool::createParticle(const Rec::TrackParticle& trackParticle, + xAOD::TrackParticleContainer* container) const + { // Attempt to fill the position enums - will necessarily be a bit of a hack, since we don't have all the information. std::vector< xAOD::ParameterPosition> positions; @@ -803,9 +823,16 @@ namespace Trk } } - xAOD::TrackParticle* trackparticle = createParticle(trackParticle.measuredPerigee(),trackParticle.fitQuality(), - &trackParticle.info(),trackParticle.trackSummary(),trackParticle.trackParameters(),positions, - static_cast<xAOD::ParticleHypothesis>(trackParticle.info().particleHypothesis()),container); + xAOD::TrackParticle* trackparticle = + createParticle(trackParticle.measuredPerigee(), + trackParticle.fitQuality(), + &trackParticle.info(), + trackParticle.trackSummary(), + trackParticle.trackParameters(), + positions, + static_cast<xAOD::ParticleHypothesis>( + trackParticle.info().particleHypothesis()), + container); if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); @@ -819,13 +846,16 @@ namespace Trk return trackparticle; } - xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const ElementLink<TrackCollection>& trackLink, - xAOD::TrackParticleContainer* container, - const xAOD::Vertex* vxCandidate, - xAOD::ParticleHypothesis prtOrigin, - const Trk::PRDtoTrackMap *prd_to_track_map) const { + xAOD::TrackParticle* + TrackParticleCreatorTool::createParticle(const ElementLink<TrackCollection>& trackLink, + xAOD::TrackParticleContainer* container, + const xAOD::Vertex* vxCandidate, + xAOD::ParticleHypothesis prtOrigin, + const Trk::PRDtoTrackMap* prd_to_track_map) const + { - xAOD::TrackParticle* trackparticle = createParticle( **trackLink, container, vxCandidate, prtOrigin, prd_to_track_map ); + xAOD::TrackParticle* trackparticle = createParticle( + **trackLink, container, vxCandidate, prtOrigin, prd_to_track_map); if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); @@ -837,12 +867,16 @@ namespace Trk return trackparticle; } - - xAOD::TrackParticle* TrackParticleCreatorTool::createParticle( const Perigee* perigee, const FitQuality* fq, const TrackInfo* trackInfo, const TrackSummary* summary, - const std::vector<const Trk::TrackParameters*>& parameters, - const std::vector< xAOD::ParameterPosition>& positions, - xAOD::ParticleHypothesis prtOrigin, - xAOD::TrackParticleContainer* container ) const { + xAOD::TrackParticle* + TrackParticleCreatorTool::createParticle(const Perigee* perigee, + const FitQuality* fq, + const TrackInfo* trackInfo, + const TrackSummary* summary, + const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector<xAOD::ParameterPosition>& positions, + xAOD::ParticleHypothesis prtOrigin, + xAOD::TrackParticleContainer* container) const + { xAOD::TrackParticle* trackparticle = new xAOD::TrackParticle; if (!trackparticle){ @@ -894,7 +928,6 @@ namespace Trk return trackparticle; } - //W.L. 2013-10-29: Since no dcast is needed any more the whole function could be removed bool TrackParticleCreatorTool::castPerigeeAndCheck( const Trk::Track* track, @@ -940,8 +973,11 @@ namespace Trk } } - - void TrackParticleCreatorTool::setParameters( xAOD::TrackParticle& tp, const std::vector<const Trk::TrackParameters*>& parameters, const std::vector< xAOD::ParameterPosition>& positions ) const { + void + TrackParticleCreatorTool::setParameters(xAOD::TrackParticle& tp, + const std::vector<const Trk::TrackParameters*>& parameters, + const std::vector<xAOD::ParameterPosition>& positions) const + { std::vector< std::vector < float > > parametersVec; parametersVec.resize(parameters.size()); unsigned int numParam=0; @@ -1051,13 +1087,14 @@ namespace Trk } // now the eProbabilities which are set as a decoration. - for (const std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> &decoration : m_decorateEProbabilities ) { + for (const std::pair<SG::AuxElement::Decorator<float>, Trk::eProbabilityType>& decoration : + m_decorateEProbabilities) { float fvalue = summary.getPID(decoration.second); decoration.first(tp) = fvalue; } // now the extra summary types - for (const std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> &decoration : m_decorateSummaryTypes) { + for (const std::pair<SG::AuxElement::Decorator<uint8_t>, Trk::SummaryType>& decoration : m_decorateSummaryTypes) { uint8_t summary_value = summary.get(decoration.second); decoration.first(tp) = summary_value; } @@ -1093,4 +1130,4 @@ namespace Trk // return m_lastBeamSpot; } -} // end of namespace Trk + } // end of namespace Trk diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h index 5c5a90bb577efd4b9bbb2000aa5f43dfbcb4efbb..33aa95a172126e00a2ef1dd118a160ddef523749 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryTool.h @@ -22,44 +22,54 @@ static const InterfaceID IID_ITrackSummaryTool("Trk::ITrackSummaryTool", 1, 0); @author Edward Moyse, Martin Siebel <http://consult.cern.ch/xwho> */ -class ITrackSummaryTool : virtual public IAlgTool { - public: - static const InterfaceID& interfaceID( ) ; +class ITrackSummaryTool : virtual public IAlgTool +{ +public: + static const InterfaceID& interfaceID(); /** create a summary object from passed Track. The summary object belongs to you, the user, and so you must take care of deletion of it. If the track has a summary already a clone is returned back. - @param onlyUpdateTrack If false (default) then the summary is cloned and added to the track, - and a separate summary returned. If true, only update track and return nullptr */ - virtual const Trk::TrackSummary* createSummary ATLAS_NOT_THREAD_SAFE ( const Track& track, bool onlyUpdateTrack=false ) const = 0; - - /** create a summary object of passed track without doing the tedious hole search. - Same comments as for createSummary apply here, of course, too. */ - virtual const Trk::TrackSummary* createSummaryNoHoleSearch ATLAS_NOT_THREAD_SAFE ( const Track& track ) const = 0; - + @param onlyUpdateTrack If false (default) then the summary is cloned and + added to the track, and a separate summary returned. If true, only update + track and return nullptr */ + virtual const Trk::TrackSummary* createSummary + ATLAS_NOT_THREAD_SAFE(const Track& track, + bool onlyUpdateTrack = false) const = 0; + + /** create a summary object of passed track without doing the tedious hole + search. Same comments as for createSummary apply here, of course, too. */ + virtual const Trk::TrackSummary* createSummaryNoHoleSearch + ATLAS_NOT_THREAD_SAFE(const Track& track) const = 0; + /** create a summary object from a passed Track. If the track has a summary already a clone is returned back. */ - virtual std::unique_ptr<Trk::TrackSummary> summary( const Track& track ) const = 0; + virtual std::unique_ptr<Trk::TrackSummary> summary( + const Track& track) const = 0; + + /** create a summary object of passed track without doing the tedious hole + search. If the track has a summary already a clone is returned back.*/ + virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( + const Track& track) const = 0; - /** create a summary object of passed track without doing the tedious hole search. - If the track has a summary already a clone is returned back.*/ - virtual std::unique_ptr<Trk::TrackSummary> summaryNoHoleSearch( const Track& track ) const = 0; - /** method which can be used to update the track and add a summary to it. - This can be used to add a summary to a track and then retrieve it from it without the need to clone. */ + This can be used to add a summary to a track and then retrieve it from it + without the need to clone. */ virtual void updateTrack(Track& track) const = 0; - - /** method which can be used to update the track and add a summary to it,without doing the tedious hole search. - This can be used to add a summary to a track and then retrieve it from it without the need to clone. */ - virtual void updateTrackNoHoleSearch(Track& track) const = 0; - - /** method to update the shared hit content only, this is optimised for track collection merging. */ + + /** method which can be used to update a refitted track and add a summary to + * it, without doing shard hit/ or hole search. Adds a summary to a track and + * then retrieve it from it without the need to clone. */ + virtual void updateRefittedTrack(Track& track) const = 0; + + /** method to update the shared hit content only, this is optimised for track + * collection merging. */ virtual void updateSharedHitCount(Track& track) const = 0; - - /** method to update additional information (PID,shared hits, dEdX), this is optimised for track collection merging. */ + + /** method to update additional information (PID,shared hits, dEdX), this is + * optimised for track collection merging. */ virtual void updateAdditionalInfo(Track& track) const = 0; - }; inline const InterfaceID& Trk::ITrackSummaryTool::interfaceID() diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h index 463b7e5ab9472c4e574bfcc2fe48f442b75f579c..32e0ef07081d9fe81ac08449f6d43bd233668500 100755 --- a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h +++ b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.h @@ -20,8 +20,6 @@ #include <vector> -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Woverloaded-virtual" #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" class AtlasDetectorID; @@ -124,9 +122,13 @@ public: Because it is taken from the track the ownership stays with the track */ virtual void updateTrack(Track& track) const override { updateTrack(track, nullptr); } - /** method which can be used to update the track and add a summary to it,without doing the tedious hole search. - This can be used to add a summary to a track and then retrieve it from it without the need to clone. */ - virtual void updateTrackNoHoleSearch(Track& track) const override { updateTrackNoHoleSearch(track, nullptr); } + /** method which can be used to update a refitted track and add a summary to + * it, without doing shard hit/ or hole search. Adds a summary to a track and + * then retrieve it from it without the need to clone. */ + virtual void updateRefittedTrack(Track& track) const override + { + updateTrackNoHoleSearch(track, nullptr); + } /** Update the shared hit count of the given track summary. * @param summary the summary to be updated i.e. a copy of the track summary of the given track. @@ -279,5 +281,4 @@ private: }; } -#pragma GCC diagnostic pop #endif diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx index 4f06504fd714ec2d3bf5048291eaef9a3f84674f..bb5bd5aba05865b9e2295647004ab62b311e7354 100755 --- a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx +++ b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx @@ -331,14 +331,15 @@ void Trk::TrackSummaryTool::updateTrack(Track& track,const Trk::PRDtoTrackMap *p computeAndReplaceTrackSummary(track,prd_to_track_map,false /*DO NOT suppress hole search*/); } -void Trk::TrackSummaryTool::updateTrackNoHoleSearch(Track& track, const Trk::PRDtoTrackMap *prd_to_track_map) const +void +Trk::TrackSummaryTool::updateTrackNoHoleSearch(Track& track, + const Trk::PRDtoTrackMap* prd_to_track_map) const { // first check if track has summary already. - computeAndReplaceTrackSummary(track,prd_to_track_map,true /*suppress hole search*/); - m_idTool->updateExpectedHitInfo(track, *track.m_trackSummary); // @TODO why ? + computeAndReplaceTrackSummary(track, prd_to_track_map, true /*suppress hole search*/); + m_idTool->updateExpectedHitInfo(track, *track.m_trackSummary); /*Needed for expected B-Layer*/ } - void Trk::TrackSummaryTool::updateSharedHitCount(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map,TrackSummary &summary) const { // first check if track has no summary - then it is recreated diff --git a/Tracking/TrkValidation/TrkValHistUtils/Root/IDHitPlots.cxx b/Tracking/TrkValidation/TrkValHistUtils/Root/IDHitPlots.cxx index 1a8433b37234e9ad1b49ab89d46c97761a125810..57a29a5f01a7799ae77d3df51a32dba78f3ece00 100644 --- a/Tracking/TrkValidation/TrkValHistUtils/Root/IDHitPlots.cxx +++ b/Tracking/TrkValidation/TrkValHistUtils/Root/IDHitPlots.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkValHistUtils/IDHitPlots.h" @@ -10,28 +10,28 @@ namespace Trk { void IDHitPlots::init() { - nBLayerHits = NULL; - nPixelHits = NULL; - nPixelHoles = NULL; - nSCTHits = NULL; - nSCTHoles = NULL; - nTRTHits = NULL; - nTRTHighThresholdHits = NULL; + nBLayerHits = nullptr; + nPixelHits = nullptr; + nPixelHoles = nullptr; + nSCTHits = nullptr; + nSCTHoles = nullptr; + nTRTHits = nullptr; + nTRTHighThresholdHits = nullptr; - nBLayerOutliers = NULL; - nBLayerSharedHits = NULL; - nBLayerSplitHits = NULL; - nPixelOutliers = NULL; - nPixelContribLayers = NULL; - nPixelSharedHits = NULL; - nPixelSplitHits = NULL; - nPixelGangedHits = NULL; - nSCTOutliers = NULL; - nSCTDoubleHoles = NULL; - nSCTSharedHits = NULL; - nTRTOutliers = NULL; - nTRTHighThresholdOutliers = NULL; - nPixelGangedHitsFlaggedFakes = NULL; + nBLayerOutliers = nullptr; + nBLayerSharedHits = nullptr; + nBLayerSplitHits = nullptr; + nPixelOutliers = nullptr; + nPixelContribLayers = nullptr; + nPixelSharedHits = nullptr; + nPixelSplitHits = nullptr; + nPixelGangedHits = nullptr; + nSCTOutliers = nullptr; + nSCTDoubleHoles = nullptr; + nSCTSharedHits = nullptr; + nTRTOutliers = nullptr; + nTRTHighThresholdOutliers = nullptr; + nPixelGangedHitsFlaggedFakes = nullptr; } void diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/share/TrkVKalVrtFitter_test.ref b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/share/TrkVKalVrtFitter_test.ref index e8a24697df3f2c207bed1747cb0de9adff67fa4f..29b1c8207ea6bbb57998f1d66e16ae7f3ac4ebf0 100644 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/share/TrkVKalVrtFitter_test.ref +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/share/TrkVKalVrtFitter_test.ref @@ -1,18 +1,18 @@ -Sat Mar 7 20:24:30 CET 2020 +Tue May 26 23:17:55 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.12] [x86_64-centos7-gcc8-opt] [atlas-work3/d935ebad997] -- built on [2020-03-07T1716] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [magFieldCache-fixes-testCleanupAgain/836569f] -- built on [2020-05-26T2311] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" Py:Athena INFO including file "TrkVKalVrtFitter/TrkVKalVrtFitter_test.py" Py:Athena INFO SetGeometryVersion.py obtained major release version 22 Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -Py:ConfigurableDb INFO Read module info for 5514 configurables from 60 genConfDb files +Py:ConfigurableDb INFO Read module info for 5528 configurables from 15 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version Athena-22.0.12 +EventInfoMgtInit: Got release version Athena-22.0.14 Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 -Py:ConfiguredFactory INFO imported 138 confDb modules in 1.79 seconds +Py:ConfiguredFactory INFO imported 135 confDb modules in 2.19 seconds Py:Athena INFO Importing MagFieldServices.SetupField Py:Athena INFO Importing MagFieldServices.MagFieldServicesSetup [ TrackingGeometrySvc ] base material tag : AtlasLayerMat_v21_ @@ -22,12 +22,11 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v33r0) - running on lxplus719.cern.ch on Sat Mar 7 20:24:45 2020 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on ccwige0002 on Tue May 26 23:18:09 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize AthDictLoaderSvc INFO in initialize... AthDictLoaderSvc INFO acquired Dso-registry ClassIDSvc INFO getRegistryEntries: read 3736 CLIDRegistry entries for module ALL @@ -38,9 +37,9 @@ AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version Athena PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2020-03-06T2133/Athena/22.0.12/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus719.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier01.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier05.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier2-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier1-ai.cern.ch:8000/atlr)(proxyurl=http://ccatlassquid.in2p3.fr:3128)(proxyurl=http://ccatlassquid02.in2p3.fr:3128)(proxyurl=http://ccatlassquid04.in2p3.fr:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-25T2141/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 1 servers found for host ccwige0002.in2p3.fr [ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -58,7 +57,7 @@ IOVDbFolder INFO Read from meta data only for folder /TagInfo IOVDbFolder INFO Inputfile tag override disabled for /GLOBAL/BField/Maps IOVDbSvc INFO Initialised with 5 connections and 8 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully -ClassIDSvc INFO getRegistryEntries: read 1914 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1967 CLIDRegistry entries for module ALL IOVDbSvc INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found. IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" @@ -298,24 +297,34 @@ SCTDetectorManager INFO Registering alignment channel with key /Indet/Align/SC SCTDetectorManager INFO Registering alignment channel with key /Indet/Align/SCTEC9, level 1, with frame local. ClassIDSvc INFO getRegistryEntries: read 3566 CLIDRegistry entries for module ALL AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 2837 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 1169 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 2841 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1232 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 291 CLIDRegistry entries for module ALL CondInputLoader INFO Initializing CondInputLoader... CondInputLoader INFO Adding base classes: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) -> no bases + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) -> no bases + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) -> + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) -> + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) -> no bases CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL xAODMaker::Even... INFO Initializing - Package version: xAODEventInfoCnv-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 1176 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1202 CLIDRegistry entries for module ALL xAODMaker::Even... INFO Initializing - Package version: xAODEventInfoCnv-00-00-00 xAODMaker::Even...WARNING Beam conditions service not available xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo @@ -323,30 +332,29 @@ testalg1 DEBUG Property update for OutputLevel : new value = 1 testalg1 VERBOSE ServiceLocatorHelper::service: found service EventDataSvc testalg1 VERBOSE ServiceLocatorHelper::service: found service TimelineSvc testalg1.TrkVKa... DEBUG Property update for OutputLevel : new value = 1 -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO maps will be chosen reading COOL folder /GLOBAL/BField/Maps -ClassIDSvc INFO getRegistryEntries: read 163 CLIDRegistry entries for module ALL -AtlasFieldSvc INFO magnet currents will be read from COOL folder /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO Booked callback for /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO initialize() successful -ToolSvc.AtlasRu... INFO ToolSvc.AtlasRungeKuttaPropagator initialize() successful -ClassIDSvc INFO getRegistryEntries: read 1697 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 668 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 111 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 926 CLIDRegistry entries for module ALL AtlasTrackingGe... INFO initialize() successful! -ToolSvc.AtlasNa... INFO Successfully retrieved TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc') -ToolSvc.AtlasMa... INFO Minimal momentum cut for material update : 50 MeV +testalg1.TrkVKa... INFO Successfully retrieved TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc') +testalg1.TrkVKa... INFO Minimal momentum cut for material update : 50 MeV ToolSvc.AtlasEn... INFO initialize() ToolSvc.AtlasMu... INFO initialize() successful -ToolSvc.AtlasMa... INFO Minimal momentum cut for material update : 50 MeV +testalg1.TrkVKa... INFO Minimal momentum cut for material update : 50 MeV +testalg1.TrkVKa... INFO initialize() successful +testalg1.TrkVKa... INFO initialize() testalg1.TrkVKa... INFO TrkVKalVrtFitter initialize() successful testalg1 VERBOSE ServiceLocatorHelper::service: found service AlgExecStateSvc testalg1 DEBUG input handles: 0 testalg1 DEBUG output handles: 0 testalg1 DEBUG Adding private ToolHandle tool testalg1.TrkVKalVrtFitter (Trk::TrkVKalVrtFitter) testalg1 DEBUG Data Deps for testalg1 + + INPUT ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) ApplicationMgr INFO Application Manager Initialized successfully CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/Indet/Align' CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/TRT/Align' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/GLOBAL/BField/Maps' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/Indet/IBLDist' CondInputLoader INFO created CondCont<DetCondCFloat> with key 'ConditionStore+/Indet/PixelDist' ApplicationMgr INFO Application Manager Started successfully @@ -354,12 +362,6 @@ AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL -IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA -IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 -IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps -IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to InDetAlign_IOVDEP-03 for folder /Indet/Align IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to IBLDist-NULL for folder /Indet/IBLDist @@ -373,20 +375,6 @@ PixelDetectorMa...WARNING Subsequent WARNINGS will be printed at DEBUG level. PixelDetectorMa... INFO Processing IBLDist alignment container with key (/Indet/IBLDist) and alignment folder pointing to /Indet/Align PixelDetectorMa...WARNING Invalid HashID for identifier [2.1.0.0.0] PixelDetectorMa...WARNING No IBLDist corrections can be applied for invalid HashID's - exiting -AtlasFieldSvc INFO reading magnetic field map filenames from COOL -AtlasFieldSvc INFO found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) -AtlasFieldSvc INFO found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) -AtlasFieldSvc INFO found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) -AtlasFieldSvc INFO no need to update map set -AtlasFieldSvc INFO Attempt 1 at reading currents from DCS (using channel name) -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 -AtlasFieldSvc INFO Currents read from DCS: solenoid 7730 toroid 20400 -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root ToolSvc.Trackin... INFO initialize() ToolSvc.Trackin... INFO initialize() ToolSvc.LayerAr... INFO initialize() @@ -413,6 +401,9 @@ ToolSvc.InDetTr... INFO Retrieved tool TrackingVolumeArrayCreator = PublicTool ToolSvc.InDetCy... INFO initialize() successful AtlasTrackingGe... INFO Retrieved tool LayerArrayCreator = PublicToolHandle('Trk::LayerArrayCreator/InDetLayerArrayCreator') AtlasTrackingGe... INFO initialize() succesful +IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps +IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 ElementTableCnv INFO LayerMaterialMapCnv::initialize() Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000126.gen.COND/cond09_mc.000126.gen.COND._0001.pool.root @@ -427,6 +418,7 @@ Warning in <TClass::Init>: no dictionary for class DataHeader_p1 is available Warning in <TClass::Init>: no dictionary for class DataHeaderElement_p1 is available RootDatabase.open INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0029.pool.root__DQ2-1250194490 File version:51000 IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 8C5D7155-23E9-DC11-99B4-001320DCF58D Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.recon.pool.v0000/oflcond.000001.conditions.recon.pool.v0000._0058.pool.root @@ -439,6 +431,31 @@ SCT_DetectorEle... INFO recorded new CDO SCT_DetectorElementCollection with ra PixelDetectorMa... INFO Processing IBLDist alignment container with key /Indet/IBLDist PixelAlignCondAlg INFO recorded new CDO PixelAlignmentStore with range {[0,t:0,l:0] - [1,l:4294967294]} into Conditions Store PixelDetectorEl... INFO recorded new CDO PixelDetectorElementCollection with range {[0,t:0,l:0] - [1,l:4294967294]} with size of 2048 into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:0] - [t:4294967294.854775807]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7730 toroid 20400 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7730,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20400,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 testalg1 VERBOSE execute AthenaEventLoopMgr INFO ===>>> done processing event #1, run #1 1 events processed so far <<<=== AthenaEventLoopMgr INFO ===>>> start processing event #2, run #1 1 events processed so far <<<=== @@ -447,32 +464,33 @@ AthenaEventLoopMgr INFO ===>>> done processing event #2, run #1 2 events pr /cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] D0709FD7-6A55-E011-925D-002481043EC0 /cvmfs/atlas-co... INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E +/cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 0E3CF1E5-143D-DB11-92C7-000CF1DA62DD /cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 8C5D7155-23E9-DC11-99B4-001320DCF58D -/cvmfs/atlas-co... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] ApplicationMgr INFO Application Manager Stopped successfully IncidentProcAlg1 INFO Finalize CondInputLoader INFO Finalizing CondInputLoader... +AtlasFieldMapCo... INFO in finalize +AtlasFieldCache... INFO in finalize IncidentProcAlg2 INFO Finalize AtlasTrackingGe... INFO finalize() successful. -AtlasFieldSvc INFO finalize() successful IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 2/2 objs/chan/bytes 8/4/40 (( 0.08 ))s -IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.05 ))s -IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/1 objs/chan/bytes 1/1/231 (( 0.01 ))s -IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.05 ))s -IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 0.02 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 0.04 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.12 ))s +IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/1 objs/chan/bytes 1/1/231 (( 0.03 ))s +IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.08 ))s +IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 0.03 ))s IOVDbFolder INFO Folder /Indet/PixelDist (PoolRef) db-read 1/1 objs/chan/bytes 1/1/179 (( 0.02 ))s -IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.03 ))s -IOVDbSvc INFO bytes in (( 0.26 ))s +IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.09 ))s +IOVDbSvc INFO bytes in (( 0.42 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 0.08 ))s -IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.03 ))s -IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 0.06 ))s -IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 3 nFolders: 1 ReadTime: (( 0.08 ))s +IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 0.13 ))s +IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.09 ))s +IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 0.15 ))s +IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.04 ))s AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc ToolSvc.InDetTr... INFO finalize() successful @@ -480,21 +498,27 @@ ToolSvc.InDetTr... INFO finalize() successful ToolSvc.InDetCy... INFO finalize() successful AtlasTrackingGe... INFO finalize() successful ToolSvc.Trackin... INFO finalize() successful -ToolSvc.AtlasNa... INFO finalize() successful -ToolSvc.AtlasRu... INFO ToolSvc.AtlasRungeKuttaPropagator finalize() successful +testalg1.TrkVKa... INFO finalize() successful +testalg1.TrkVKa... INFO finalize() successful +testalg1.TrkVKa... INFO finalize() successful +testalg1.TrkVKa... INFO Trk::Extrapolator::Cache s_navigSurfsMax = 0 +testalg1.TrkVKa... INFO Trk::Extrapolator::Cache s_navigSurfsMax = 0 +testalg1.TrkVKa... INFO Trk::Extrapolator::Cache s_navigVolsMax = 0 +testalg1.TrkVKa... INFO Trk::Extrapolator::Cache s_navigVolsIntMax = 0 +testalg1.TrkVKa... INFO Trk::Extrapolator::Cache s_containerSizeMax = 3 testalg1.TrkVKa... INFO finalize() successful testalg1.TrkVKa... INFO TrkVKalVrtFitter finalize() successful ToolSvc.InDetLa... INFO finalize() successful ToolSvc.LayerAr... INFO finalize() successful -ToolSvc.Trackin... INFO finalize() successful ToolSvc.AtlasMu... INFO finalize() successful ToolSvc.AtlasEn... INFO finalize() successful +ToolSvc.Trackin... INFO finalize() successful *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -cObjR_ALL INFO Time User : Tot= 150 [ms] Ave/Min/Max= 1.47(+- 10.2)/ 0/ 100 [ms] #=102 -cObj_ALL INFO Time User : Tot= 190 [ms] Ave/Min/Max= 19(+- 35.1)/ 0/ 120 [ms] #= 10 -ChronoStatSvc INFO Time User : Tot= 3.61 [s] #= 1 +cObjR_ALL INFO Time User : Tot= 160 [ms] Ave/Min/Max= 1.57(+- 12)/ 0/ 120 [ms] #=102 +cObj_ALL INFO Time User : Tot= 190 [ms] Ave/Min/Max= 21.1(+- 43.1)/ 0/ 140 [ms] #= 9 +ChronoStatSvc INFO Time User : Tot= 2.89 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx index d4c558396640f8e19d0ac511f4477f022173d37e..da8f97a79741cc9831df3362bd1c3d80eaff858d 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx @@ -38,7 +38,6 @@ TrkVKalVrtFitter:: TrkVKalVrtFitter(const std::string& type, m_IDsizeZ(3000.), m_extPropagator(this), // Internal propagator // m_extPropagator("Trk::Extrapolator/InDetExtrapolator"), // External propagator - //m_magFieldAthenaSvc("AtlasFieldSvc", name), //Athena magnetic field m_firstMeasuredPoint(false), m_firstMeasuredPointLimit(false), m_makeExtendedVertex(false), diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt index 2bf80d78e42d8ea1f8462812826fc425e9e80d41..64b3821107d739fa78540bd3947c81270c3915b7 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt @@ -47,16 +47,16 @@ atlas_add_test( DummyAnnealingMaker_test SOURCES test/DummyAnnealingMaker_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools - LOG_IGNORE_PATTERN "AtlasFieldSvc" ) + ) atlas_add_test( DetAnnealingMaker_test SOURCES test/DetAnnealingMaker_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools - LOG_IGNORE_PATTERN "AtlasFieldSvc" ) + ) atlas_add_test( ImpactPoint3dEstimator_test SOURCES test/ImpactPoint3dEstimator_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools - LOG_IGNORE_PATTERN "AtlasFieldSvc" ) + ) diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..1856d57e1c18048eb8be1c5630ff9ea79ce9609f --- /dev/null +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkVertexFitter/TrkVertexFitterUtils diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/DetAnnealingMaker_test.ref b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/DetAnnealingMaker_test.ref index d5e1fbe44ceeeb0398d01ed45b855555f6cdb770..32f8869d6a851a7189f7306a1ece529a2e5d6aba 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/DetAnnealingMaker_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/DetAnnealingMaker_test.ref @@ -1,26 +1,18 @@ TrkVertexFitterUtils/DetAnnealingMaker_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO # (5,1): ToolSvc.Trk::DetAnnealingMaker.SetOfTemperatures = [3, 2, 1] -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt +JobOptionsSvc INFO # =======> /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt +JobOptionsSvc INFO # (1,1): ToolSvc.Trk::DetAnnealingMaker.SetOfTemperatures = [3, 2, 1] +JobOptionsSvc INFO Job options successfully read in from /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Wed Jul 24 16:27:31 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on ccwige0002 on Wed May 27 19:01:56 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref index 46f04da88980ff8bac688c1729decd03464f4738..3c785584c0fa8756412a6edeea2d3ff0c3b74d75 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/ImpactPoint3dEstimator_test.ref @@ -1,45 +1,18 @@ TrkVertexFitterUtils/ImpactPoint3dEstimator_test -Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt -JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc", "StoreGateSvc/ConditionStore"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO # (5,1): ToolSvc.Trk::DetAnnealingMaker.SetOfTemperatures = [3, 2, 1] -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus775.cern.ch on Fri Apr 10 21:18:03 2020 -==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful -ClassIDSvc INFO getRegistryEntries: read 1690 CLIDRegistry entries for module ALL EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully -ClassIDSvc INFO getRegistryEntries: read 1879 CLIDRegistry entries for module ALL -ToolSvc.Default... INFO initialize() init key: fieldCondObj ServiceManager FATAL No Service factory for AtlasTrackingGeometrySvc available. -ToolSvc.AtlasNa... ERROR ServiceLocatorHelper::service: can not locate service AtlasTrackingGeometrySvc -ToolSvc.AtlasNa...WARNING Couldn't retrieve TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc'). -ToolSvc.AtlasNa...WARNING -> Trying to retrieve default 'AtlasTrackingGeometry' from DetectorStore. -ToolSvc.Default... INFO Minimal momentum cut for material update : 50 MeV +ToolSvc.Trk::Ex... ERROR ServiceLocatorHelper::service: can not locate service AtlasTrackingGeometrySvc +ToolSvc.Trk::Ex...WARNING Couldn't retrieve TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc'). +ToolSvc.Trk::Ex...WARNING -> Trying to retrieve default 'AtlasTrackingGeometry' from DetectorStore. +ToolSvc.Trk::Ex... INFO Minimal momentum cut for material update : 50 MeV ToolSvc.AtlasEn... INFO initialize() ToolSvc.AtlasMu... INFO initialize() successful -ClassIDSvc INFO getRegistryEntries: read 111 CLIDRegistry entries for module ALL +ToolSvc.Trk::Ex... INFO initialize() successful +ToolSvc.Trk::Ex... INFO initialize() test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/CrossDistancesSeedFinder.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/CrossDistancesSeedFinder.ref index 2970da82f87d4cf799a36fa38fbc6f005fdb930c..99bf7e85348910b48e025c3a365f0c43891ea708 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/CrossDistancesSeedFinder.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/CrossDistancesSeedFinder.ref @@ -39,9 +39,9 @@ AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version Athena PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2020-03-06T2143/Athena/22.0.12/InstallArea/x86_64-centos7-gcc8-dbg/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus7100.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier01.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier05.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier2-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier1-ai.cern.ch:8000/atlr)(proxyurl=http://ccatlassquid.in2p3.fr:3128)(proxyurl=http://ccatlassquid02.in2p3.fr:3128)(proxyurl=http://ccatlassquid04.in2p3.fr:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-26T2140/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 1 servers found for host ccwige0002.in2p3.fr [ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -314,6 +314,13 @@ CondInputLoader INFO Will create WriteCondHandle dependencies for the follo + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 764 CLIDRegistry entries for module ALL xAODMaker::Even... INFO Initializing - Package version: xAODEventInfoCnv-00-00-00 @@ -326,12 +333,7 @@ testalg1 VERBOSE ServiceLocatorHelper::service: found service TimelineS testalg1.CrossD... DEBUG Property update for OutputLevel : new value = 1 testalg1.CrossD... INFO Initialize successfull testalg1.CrossD... INFO Initialize successfull -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO maps will be chosen reading COOL folder /GLOBAL/BField/Maps -ClassIDSvc INFO getRegistryEntries: read 1116 CLIDRegistry entries for module ALL -AtlasFieldSvc INFO magnet currents will be read from COOL folder /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO Booked callback for /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO initialize() successful +ClassIDSvc INFO getRegistryEntries: read 967 CLIDRegistry entries for module ALL testalg1.CrossD... INFO Initialize successful testalg1 VERBOSE ServiceLocatorHelper::service: found service AlgExecStateSvc testalg1 DEBUG input handles: 0 @@ -350,12 +352,6 @@ AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL -IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA -IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 -IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps -IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to InDetAlign_IOVDEP-03 for folder /Indet/Align IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to IBLDist-NULL for folder /Indet/IBLDist @@ -369,20 +365,6 @@ PixelDetectorMa...WARNING Subsequent WARNINGS will be printed at DEBUG level. PixelDetectorMa... INFO Processing IBLDist alignment container with key (/Indet/IBLDist) and alignment folder pointing to /Indet/Align PixelDetectorMa...WARNING Invalid HashID for identifier [2.1.0.0.0] PixelDetectorMa...WARNING No IBLDist corrections can be applied for invalid HashID's - exiting -AtlasFieldSvc INFO reading magnetic field map filenames from COOL -AtlasFieldSvc INFO found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) -AtlasFieldSvc INFO found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) -AtlasFieldSvc INFO found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) -AtlasFieldSvc INFO no need to update map set -AtlasFieldSvc INFO Attempt 1 at reading currents from DCS (using channel name) -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 -AtlasFieldSvc INFO Currents read from DCS: solenoid 7730 toroid 20400 -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root AthenaEventLoopMgr INFO ===>>> start processing event #1, run #1 0 events processed so far <<<=== IOVDbSvc INFO Opening COOL connection for COOLOFL_TRT/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to TRTAlign_Nominal2 for folder /TRT/Align @@ -405,6 +387,31 @@ SCT_DetectorEle... INFO recorded new CDO SCT_DetectorElementCollection with ra PixelDetectorMa... INFO Processing IBLDist alignment container with key /Indet/IBLDist PixelAlignCondAlg INFO recorded new CDO PixelAlignmentStore with range {[0,t:0,l:0] - [1,l:4294967294]} into Conditions Store PixelDetectorEl... INFO recorded new CDO PixelDetectorElementCollection with range {[0,t:0,l:0] - [1,l:4294967294]} with size of 2048 into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:0] - [t:4294967294.854775807]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7730 toroid 20400 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7730,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20400,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 testalg1 VERBOSE execute testalg1 VERBOSE testing 1 testalg1 VERBOSE testing 2 @@ -427,22 +434,21 @@ ApplicationMgr INFO Application Manager Stopped successfully IncidentProcAlg1 INFO Finalize CondInputLoader INFO Finalizing CondInputLoader... IncidentProcAlg2 INFO Finalize -AtlasFieldSvc INFO finalize() successful IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 2/2 objs/chan/bytes 8/4/40 (( 0.09 ))s -IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.07 ))s -IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/0 objs/chan/bytes 1/1/231 (( 0.02 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 3.56 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 6.30 ))s +IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/0 objs/chan/bytes 1/1/231 (( 0.10 ))s IOVDbFolder WARNING Folder /GLOBAL/TrackingGeo/LayerMaterialV2 is requested but no data retrieved -IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.05 ))s -IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 0.03 ))s -IOVDbFolder INFO Folder /Indet/PixelDist (PoolRef) db-read 1/1 objs/chan/bytes 1/1/179 (( 0.03 ))s -IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.04 ))s -IOVDbSvc INFO bytes in (( 0.33 ))s +IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.09 ))s +IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 2.75 ))s +IOVDbFolder INFO Folder /Indet/PixelDist (PoolRef) db-read 1/1 objs/chan/bytes 1/1/179 (( 0.04 ))s +IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.09 ))s +IOVDbSvc INFO bytes in (( 12.93 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 0.11 ))s -IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.04 ))s -IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 0.08 ))s -IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 3 nFolders: 1 ReadTime: (( 0.09 ))s +IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 2.87 ))s +IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.09 ))s +IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 6.40 ))s +IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 3.56 ))s AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc testalg1.CrossD... INFO Finalize successfull diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/IndexedCrossDistancesSeedFinder.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/IndexedCrossDistancesSeedFinder.ref index 09c9a7596682c7475f103b0c76b35d2461296c8c..3f63932aed14704cda44203f52b0c2466d619996 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/IndexedCrossDistancesSeedFinder.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/IndexedCrossDistancesSeedFinder.ref @@ -39,9 +39,9 @@ AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version Athena PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2020-03-06T2143/Athena/22.0.12/InstallArea/x86_64-centos7-gcc8-dbg/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus7100.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier01.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier05.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier2-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier1-ai.cern.ch:8000/atlr)(proxyurl=http://ccatlassquid.in2p3.fr:3128)(proxyurl=http://ccatlassquid02.in2p3.fr:3128)(proxyurl=http://ccatlassquid04.in2p3.fr:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-26T2140/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 1 servers found for host ccwige0002.in2p3.fr [ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -306,14 +306,23 @@ CondInputLoader INFO Adding base classes: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) -> no bases + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) -> no bases + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) -> + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) -> + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) -> no bases CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 764 CLIDRegistry entries for module ALL xAODMaker::Even... INFO Initializing - Package version: xAODEventInfoCnv-00-00-00 @@ -325,23 +334,20 @@ testalg1 VERBOSE ServiceLocatorHelper::service: found service EventData testalg1 VERBOSE ServiceLocatorHelper::service: found service TimelineSvc testalg1.Indexe... DEBUG Property update for OutputLevel : new value = 1 testalg1.Indexe... INFO Initialize successful -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO maps will be chosen reading COOL folder /GLOBAL/BField/Maps -ClassIDSvc INFO getRegistryEntries: read 1116 CLIDRegistry entries for module ALL -AtlasFieldSvc INFO magnet currents will be read from COOL folder /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO Booked callback for /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO initialize() successful +ClassIDSvc INFO getRegistryEntries: read 967 CLIDRegistry entries for module ALL testalg1.Indexe... INFO Initialize successful testalg1 VERBOSE ServiceLocatorHelper::service: found service AlgExecStateSvc testalg1 DEBUG input handles: 0 testalg1 DEBUG output handles: 1 testalg1 DEBUG Adding private ToolHandle tool testalg1.IndexedCrossDistancesSeedFinder (Trk::IndexedCrossDistancesSeedFinder) testalg1 DEBUG Data Deps for testalg1 + + INPUT ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) + OUTPUT IGNORED ( 'McEventCollection' , '' ) ApplicationMgr INFO Application Manager Initialized successfully CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/Indet/Align' CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/TRT/Align' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/GLOBAL/BField/Maps' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/Indet/IBLDist' CondInputLoader INFO created CondCont<DetCondCFloat> with key 'ConditionStore+/Indet/PixelDist' ApplicationMgr INFO Application Manager Started successfully @@ -349,12 +355,6 @@ AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL -IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA -IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 -IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps -IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to InDetAlign_IOVDEP-03 for folder /Indet/Align IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to IBLDist-NULL for folder /Indet/IBLDist @@ -368,20 +368,6 @@ PixelDetectorMa...WARNING Subsequent WARNINGS will be printed at DEBUG level. PixelDetectorMa... INFO Processing IBLDist alignment container with key (/Indet/IBLDist) and alignment folder pointing to /Indet/Align PixelDetectorMa...WARNING Invalid HashID for identifier [2.1.0.0.0] PixelDetectorMa...WARNING No IBLDist corrections can be applied for invalid HashID's - exiting -AtlasFieldSvc INFO reading magnetic field map filenames from COOL -AtlasFieldSvc INFO found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) -AtlasFieldSvc INFO found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) -AtlasFieldSvc INFO found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) -AtlasFieldSvc INFO no need to update map set -AtlasFieldSvc INFO Attempt 1 at reading currents from DCS (using channel name) -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 -AtlasFieldSvc INFO Currents read from DCS: solenoid 7730 toroid 20400 -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root AthenaEventLoopMgr INFO ===>>> start processing event #1, run #1 0 events processed so far <<<=== IOVDbSvc INFO Opening COOL connection for COOLOFL_TRT/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to TRTAlign_Nominal2 for folder /TRT/Align @@ -392,7 +378,11 @@ Warning in <TClass::Init>: no dictionary for class DataHeader_p1 is available Warning in <TClass::Init>: no dictionary for class DataHeaderElement_p1 is available RootDatabase.open INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0029.pool.root__DQ2-1250194490 File version:51000 IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 +IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps +IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 8C5D7155-23E9-DC11-99B4-001320DCF58D Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.recon.pool.v0000/oflcond.000001.conditions.recon.pool.v0000._0058.pool.root Warning in <TClass::Init>: no dictionary for class DataHeader_p2 is available @@ -404,6 +394,31 @@ SCT_DetectorEle... INFO recorded new CDO SCT_DetectorElementCollection with ra PixelDetectorMa... INFO Processing IBLDist alignment container with key /Indet/IBLDist PixelAlignCondAlg INFO recorded new CDO PixelAlignmentStore with range {[0,t:0,l:0] - [1,l:4294967294]} into Conditions Store PixelDetectorEl... INFO recorded new CDO PixelDetectorElementCollection with range {[0,t:0,l:0] - [1,l:4294967294]} with size of 2048 into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:0] - [t:4294967294.854775807]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7730 toroid 20400 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7730,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20400,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 testalg1 VERBOSE execute testalg1 VERBOSE testing 1 testalg1 VERBOSE testing 2 @@ -425,12 +440,13 @@ Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] ApplicationMgr INFO Application Manager Stopped successfully IncidentProcAlg1 INFO Finalize CondInputLoader INFO Finalizing CondInputLoader... +AtlasFieldMapCo... INFO in finalize +AtlasFieldCache... INFO in finalize IncidentProcAlg2 INFO Finalize -AtlasFieldSvc INFO finalize() successful IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 2/2 objs/chan/bytes 8/4/40 (( 0.09 ))s -IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.06 ))s -IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/0 objs/chan/bytes 1/1/231 (( 0.02 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 0.17 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.09 ))s +IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/0 objs/chan/bytes 1/1/231 (( 0.05 ))s IOVDbFolder WARNING Folder /GLOBAL/TrackingGeo/LayerMaterialV2 is requested but no data retrieved IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.04 ))s IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 0.02 ))s diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder.ref index 9e11aca00f1a20001bb6fb4eb286ebb2c8d2e85d..a36511c0190095704b510fd2bd65c71f914b620b 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder.ref @@ -1,7 +1,7 @@ -Sat Mar 7 19:12:30 CET 2020 +Wed May 27 21:26:22 CEST 2020 Preloading tcmalloc_minimal.so Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.12] [x86_64-centos7-gcc8-dbg] [atlas-work3/d935ebad997] -- built on [2020-03-07T1715] +Py:Athena INFO using release [WorkDir-22.0.14] [x86_64-centos7-gcc8-opt] [magFieldCache-fixes-testCleanupAgain/836569f] -- built on [2020-05-27T1922] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup Py:Athena INFO including file "AthenaCommon/Execution.py" @@ -9,11 +9,11 @@ Py:Athena INFO including file "TrkVertexSeedFinderTools/ZScanSeedFind Py:Athena INFO including file "TrkVertexSeedFinderTools/VertexSeedFinderTestCommon.py" Py:Athena INFO SetGeometryVersion.py obtained major release version 22 Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -Py:ConfigurableDb INFO Read module info for 5514 configurables from 60 genConfDb files +Py:ConfigurableDb INFO Read module info for 5528 configurables from 19 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version Athena-22.0.12 +EventInfoMgtInit: Got release version Athena-22.0.14 Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 -Py:ConfiguredFactory INFO imported 138 confDb modules in 1.32 seconds +Py:ConfiguredFactory INFO imported 269 confDb modules in 1.07 seconds Py:Athena INFO Importing MagFieldServices.SetupField Py:Athena INFO Importing MagFieldServices.MagFieldServicesSetup [ TrackingGeometrySvc ] base material tag : AtlasLayerMat_v21_ @@ -23,12 +23,11 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v33r0) - running on lxplus7100.cern.ch on Sat Mar 7 19:12:42 2020 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on ccwige0002 on Wed May 27 21:26:37 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize AthDictLoaderSvc INFO in initialize... AthDictLoaderSvc INFO acquired Dso-registry ClassIDSvc INFO getRegistryEntries: read 3736 CLIDRegistry entries for module ALL @@ -39,9 +38,9 @@ AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version Athena PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy-atlas.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data -DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2020-03-06T2143/Athena/22.0.12/InstallArea/x86_64-centos7-gcc8-dbg/share/dbreplica.config -DBReplicaSvc INFO Total of 10 servers found for host lxplus7100.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] +DBReplicaSvc INFO Frontier server at (serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier01.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccfrontier05.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier2-ai.cern.ch:8000/atlr)(serverurl=http://atlasfrontier1-ai.cern.ch:8000/atlr)(proxyurl=http://ccatlassquid.in2p3.fr:3128)(proxyurl=http://ccatlassquid02.in2p3.fr:3128)(proxyurl=http://ccatlassquid04.in2p3.fr:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-05-26T2140/Athena/22.0.14/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config +DBReplicaSvc INFO Total of 1 servers found for host ccwige0002.in2p3.fr [ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables @@ -59,7 +58,7 @@ IOVDbFolder INFO Read from meta data only for folder /TagInfo IOVDbFolder INFO Inputfile tag override disabled for /GLOBAL/BField/Maps IOVDbSvc INFO Initialised with 5 connections and 8 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully -ClassIDSvc INFO getRegistryEntries: read 1914 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1967 CLIDRegistry entries for module ALL IOVDbSvc INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found. IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" @@ -299,21 +298,31 @@ SCTDetectorManager INFO Registering alignment channel with key /Indet/Align/SC SCTDetectorManager INFO Registering alignment channel with key /Indet/Align/SCTEC9, level 1, with frame local. ClassIDSvc INFO getRegistryEntries: read 3566 CLIDRegistry entries for module ALL AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 2837 CLIDRegistry entries for module ALL -ClassIDSvc INFO getRegistryEntries: read 1169 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 2841 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1232 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 291 CLIDRegistry entries for module ALL CondInputLoader INFO Initializing CondInputLoader... CondInputLoader INFO Adding base classes: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) -> no bases + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) -> no bases + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) -> + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) -> + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) -> + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) -> no bases CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: + ( 'AlignableTransformContainer' , 'ConditionStore+/Indet/Align' ) + ( 'AlignableTransformContainer' , 'ConditionStore+/TRT/Align' ) + ( 'CondAttrListCollection' , 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' ) + + ( 'CondAttrListCollection' , 'ConditionStore+/GLOBAL/BField/Maps' ) + ( 'CondAttrListCollection' , 'ConditionStore+/Indet/IBLDist' ) + ( 'DetCondCFloat' , 'ConditionStore+/Indet/PixelDist' ) +AtlasFieldMapCo... INFO Initialize +AtlasFieldMapCo... INFO Initialize: Key ( 'AtlasFieldMapCondObj' , 'ConditionStore+fieldMapCondObj' ) has been succesfully registered +AtlasFieldMapCo... INFO Initialize: Will update the field map from conditions +AtlasFieldCache... INFO Initialize +AtlasFieldCache... INFO Initialize: Key ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) has been succesfully registered +AtlasFieldCache... INFO Initialize: Will update current from conditions +AtlasFieldCache... INFO Initialize: useDCS, useSoleCurrent, useToroCurrent. 1, 'UseSoleCurrent':7730.0000, 'UseToroCurrent':20400.000 LockMapCurrents 0 ClassIDSvc INFO getRegistryEntries: read 440 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 764 CLIDRegistry entries for module ALL xAODMaker::Even... INFO Initializing - Package version: xAODEventInfoCnv-00-00-00 @@ -325,22 +334,22 @@ testalg1 VERBOSE ServiceLocatorHelper::service: found service EventData testalg1 VERBOSE ServiceLocatorHelper::service: found service TimelineSvc testalg1.ZScanS... DEBUG Property update for OutputLevel : new value = 1 testalg1.ZScanS... INFO Initialize successfull -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO maps will be chosen reading COOL folder /GLOBAL/BField/Maps -ClassIDSvc INFO getRegistryEntries: read 2443 CLIDRegistry entries for module ALL -AtlasFieldSvc INFO magnet currents will be read from COOL folder /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO Booked callback for /EXT/DCS/MAGNETS/SENSORDATA -AtlasFieldSvc INFO initialize() successful -ToolSvc.Default... INFO ToolSvc.DefaultPropagator initialize() successful +ClassIDSvc INFO getRegistryEntries: read 2304 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 926 CLIDRegistry entries for module ALL AtlasTrackingGe... INFO initialize() successful! -ToolSvc.AtlasNa... INFO Successfully retrieved TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc') -ToolSvc.Default... INFO Minimal momentum cut for material update : 50 MeV +testalg1.ZScanS... INFO Successfully retrieved TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc') +testalg1.ZScanS... INFO Minimal momentum cut for material update : 50 MeV ToolSvc.AtlasEn... INFO initialize() ToolSvc.AtlasMu... INFO initialize() successful +ClassIDSvc INFO getRegistryEntries: read 111 CLIDRegistry entries for module ALL +testalg1.ZScanS... INFO initialize() successful +testalg1.ZScanS... INFO initialize() testalg1.ZScanS... INFO Retrieved tool Extrapolator = PrivateToolHandle('Trk::Extrapolator/Trk::Extrapolator') testalg1.ZScanS... INFO Retrieved tool VertexUpdator = PrivateToolHandle('Trk::KalmanVertexUpdator/Trk::KalmanVertexUpdator') -testalg1.ZScanS... INFO Retrieved tool Extrapolator = PrivateToolHandle('Trk::Extrapolator/Trk::Extrapolator') +testalg1.ZScanS... INFO Successfully retrieved TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc') +testalg1.ZScanS... INFO Minimal momentum cut for material update : 50 MeV +testalg1.ZScanS... INFO initialize() successful +testalg1.ZScanS... INFO initialize() testalg1.ZScanS... INFO Initialize successful testalg1.ZScanS... INFO Retrieved tool LinearizedTrackFactory = PrivateToolHandle('Trk::FullLinearizedTrackFactory/Trk::FullLinearizedTrackFactory') testalg1.ZScanS... INFO Retrieved tools Mode1dFinder = PrivateToolHandle('Trk::FsmwMode1dFinder/Trk::FsmwMode1dFinder') and IPEstimator = PrivateToolHandle('Trk::TrackToVertexIPEstimator/Trk::TrackToVertexIPEstimator') @@ -349,13 +358,14 @@ testalg1 DEBUG input handles: 0 testalg1 DEBUG output handles: 1 testalg1 DEBUG Adding private ToolHandle tool testalg1.ZScanSeedFinder (Trk::ZScanSeedFinder) testalg1 DEBUG Data Deps for testalg1 + + INPUT ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' ) + INPUT ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ) + OUTPUT IGNORED ( 'McEventCollection' , '' ) ApplicationMgr INFO Application Manager Initialized successfully -ClassIDSvc INFO getRegistryEntries: read 107 CLIDRegistry entries for module ALL CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/Indet/Align' CondInputLoader INFO created CondCont<AlignableTransformContainer> with key 'ConditionStore+/TRT/Align' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/EXT/DCS/MAGNETS/SENSORDATA' +CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/GLOBAL/BField/Maps' CondInputLoader INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/Indet/IBLDist' CondInputLoader INFO created CondCont<DetCondCFloat> with key 'ConditionStore+/Indet/PixelDist' ApplicationMgr INFO Application Manager Started successfully @@ -363,12 +373,6 @@ AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL -IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA -IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 -IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 -IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps -IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 IOVDbSvc INFO Opening COOL connection for COOLOFL_INDET/OFLP200 IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to InDetAlign_IOVDEP-03 for folder /Indet/Align IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to IBLDist-NULL for folder /Indet/IBLDist @@ -382,20 +386,6 @@ PixelDetectorMa...WARNING Subsequent WARNINGS will be printed at DEBUG level. PixelDetectorMa... INFO Processing IBLDist alignment container with key (/Indet/IBLDist) and alignment folder pointing to /Indet/Align PixelDetectorMa...WARNING Invalid HashID for identifier [2.1.0.0.0] PixelDetectorMa...WARNING No IBLDist corrections can be applied for invalid HashID's - exiting -AtlasFieldSvc INFO reading magnetic field map filenames from COOL -AtlasFieldSvc INFO found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) -AtlasFieldSvc INFO found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) -AtlasFieldSvc INFO found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) -AtlasFieldSvc INFO no need to update map set -AtlasFieldSvc INFO Attempt 1 at reading currents from DCS (using channel name) -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 -AtlasFieldSvc INFO Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 -AtlasFieldSvc INFO Currents read from DCS: solenoid 7730 toroid 20400 -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root ToolSvc.Trackin... INFO initialize() ToolSvc.Trackin... INFO initialize() ToolSvc.LayerAr... INFO initialize() @@ -422,6 +412,9 @@ ToolSvc.InDetTr... INFO Retrieved tool TrackingVolumeArrayCreator = PublicTool ToolSvc.InDetCy... INFO initialize() successful AtlasTrackingGe... INFO Retrieved tool LayerArrayCreator = PublicToolHandle('Trk::LayerArrayCreator/InDetLayerArrayCreator') AtlasTrackingGe... INFO initialize() succesful +IOVDbSvc INFO Opening COOL connection for COOLOFL_GLOBAL/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to BFieldMap-Run1-14m-v01 for folder /GLOBAL/BField/Maps +IOVDbSvc INFO Disconnecting from COOLOFL_GLOBAL/OFLP200 ElementTableCnv INFO LayerMaterialMapCnv::initialize() Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000126.gen.COND/cond09_mc.000126.gen.COND._0001.pool.root @@ -436,6 +429,7 @@ Warning in <TClass::Init>: no dictionary for class DataHeader_p1 is available Warning in <TClass::Init>: no dictionary for class DataHeaderElement_p1 is available RootDatabase.open INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0029.pool.root__DQ2-1250194490 File version:51000 IOVDbSvc INFO Opening COOL connection for COOLOFL_DCS/OFLP200 +IOVDbFolder INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA IOVDbSvc INFO Disconnecting from COOLOFL_DCS/OFLP200 Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 8C5D7155-23E9-DC11-99B4-001320DCF58D Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.recon.pool.v0000/oflcond.000001.conditions.recon.pool.v0000._0058.pool.root @@ -448,6 +442,31 @@ SCT_DetectorEle... INFO recorded new CDO SCT_DetectorElementCollection with ra PixelDetectorMa... INFO Processing IBLDist alignment container with key /Indet/IBLDist PixelAlignCondAlg INFO recorded new CDO PixelAlignmentStore with range {[0,t:0,l:0] - [1,l:4294967294]} into Conditions Store PixelDetectorEl... INFO recorded new CDO PixelDetectorElementCollection with range {[0,t:0,l:0] - [1,l:4294967294]} with size of 2048 into Conditions Store +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions +AtlasFieldMapCo... INFO updateFieldMap: Update map from conditions: Range of input/output is {[0,l:0] - [INVALID]} +AtlasFieldMapCo... INFO updateFieldMap: reading magnetic field map filenames from COOL +AtlasFieldMapCo... INFO updateFieldMap: found map of type GlobalMap with soleCur=7730 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_7730_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type SolenoidMap with soleCur=7730 toroCur=0 (path file:MagneticFieldMaps/bfieldmap_7730_0_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: found map of type ToroidMap with soleCur=0 toroCur=20400 (path file:MagneticFieldMaps/bfieldmap_0_20400_14m.root) +AtlasFieldMapCo... INFO updateFieldMap: tagInfoH ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) is valid. +AtlasFieldMapCo... INFO updateFieldMap: DID NOT reset currents from TagInfo +AtlasFieldMapCo... INFO updateFieldMap: Set map currents from FieldSvc: solenoid/toroid 7730,20400 +AtlasFieldMapCo... INFO updateFieldMap: Use map file MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO updateFieldMap: Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root +AtlasFieldMapCo... INFO execute: solenoid zone id 7000 +AtlasFieldMapCo... INFO execute: recored AtlasFieldMapCondObj with field map +AtlasFieldCache... INFO UpdateCurrentFromConditions +AtlasFieldCache... INFO UpdateCurrentFromConditions: Range of input/output is {[0,0,t:0] - [t:4294967294.854775807]} +AtlasFieldCache... INFO UpdateCurrentFromConditions: Attempt 1 at reading currents from DCS (using channel name) +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_Current , 1 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] CentralSol_SCurrent , 2 , 7730 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_Current , 3 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Trying to read from DCS: [channel name, index, value] Toroids_SCurrent , 4 , 20400 +AtlasFieldCache... INFO UpdateCurrentFromConditions: Currents read from DCS - solenoid 7730 toroid 20400 +AtlasFieldCache... INFO scaleField: Solenoid field scale factor 1. Solenoid and map currents: 7730,7730 +AtlasFieldCache... INFO scaleField: Toroid field scale factor 1. Toroid and map currents: 20400,20400 +AtlasFieldCache... INFO execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor 1/1 +AtlasFieldCache... INFO execute: solenoid zone id 7000 testalg1 VERBOSE execute testalg1 VERBOSE testing 1 testalg1 VERBOSE testing 2 @@ -462,32 +481,33 @@ AthenaEventLoopMgr INFO ===>>> done processing event #2, run #1 2 events pr /cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] D0709FD7-6A55-E011-925D-002481043EC0 /cvmfs/atlas-co... INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E +/cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 0E3CF1E5-143D-DB11-92C7-000CF1DA62DD /cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 8C5D7155-23E9-DC11-99B4-001320DCF58D -/cvmfs/atlas-co... INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 2B8BB54A-2F81-7B49-8484-60F83666998E Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] ApplicationMgr INFO Application Manager Stopped successfully IncidentProcAlg1 INFO Finalize CondInputLoader INFO Finalizing CondInputLoader... +AtlasFieldMapCo... INFO in finalize +AtlasFieldCache... INFO in finalize IncidentProcAlg2 INFO Finalize AtlasTrackingGe... INFO finalize() successful. -AtlasFieldSvc INFO finalize() successful IdDictDetDescrCnv INFO in finalize -IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 2/2 objs/chan/bytes 8/4/40 (( 0.09 ))s -IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.06 ))s -IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/1 objs/chan/bytes 1/1/231 (( 0.02 ))s -IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.04 ))s -IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 0.02 ))s -IOVDbFolder INFO Folder /Indet/PixelDist (PoolRef) db-read 1/1 objs/chan/bytes 1/1/179 (( 0.02 ))s -IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.05 ))s -IOVDbSvc INFO bytes in (( 0.30 ))s +IOVDbFolder INFO Folder /EXT/DCS/MAGNETS/SENSORDATA (AttrListColl) db-read 1/1 objs/chan/bytes 4/4/20 (( 0.17 ))s +IOVDbFolder INFO Folder /GLOBAL/BField/Maps (AttrListColl) db-read 1/1 objs/chan/bytes 3/3/202 (( 0.15 ))s +IOVDbFolder INFO Folder /GLOBAL/TrackingGeo/LayerMaterialV2 (PoolRef) db-read 1/1 objs/chan/bytes 1/1/231 (( 0.08 ))s +IOVDbFolder INFO Folder /Indet/Align (PoolRefColl) db-read 1/2 objs/chan/bytes 34/43/5440 (( 0.39 ))s +IOVDbFolder INFO Folder /Indet/IBLDist (AttrListColl) db-read 1/2 objs/chan/bytes 14/14/280 (( 2.82 ))s +IOVDbFolder INFO Folder /Indet/PixelDist (PoolRef) db-read 1/1 objs/chan/bytes 1/1/179 (( 0.08 ))s +IOVDbFolder INFO Folder /TRT/Align (PoolRefColl) db-read 1/1 objs/chan/bytes 32/32/5120 (( 0.21 ))s +IOVDbSvc INFO bytes in (( 3.90 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 0.08 ))s -IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.05 ))s -IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 0.08 ))s -IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 3 nFolders: 1 ReadTime: (( 0.09 ))s +IOVDbSvc INFO Connection COOLOFL_INDET/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: (( 3.29 ))s +IOVDbSvc INFO Connection COOLOFL_TRT/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.21 ))s +IOVDbSvc INFO Connection COOLOFL_GLOBAL/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: (( 0.23 ))s +IOVDbSvc INFO Connection COOLOFL_DCS/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.17 ))s AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc ToolSvc.InDetTr... INFO finalize() successful @@ -496,24 +516,33 @@ ToolSvc.InDetCy... INFO finalize() successful AtlasTrackingGe... INFO finalize() successful ToolSvc.Trackin... INFO finalize() successful testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO Trk::Extrapolator::Cache s_navigSurfsMax = 0 +testalg1.ZScanS... INFO Trk::Extrapolator::Cache s_navigSurfsMax = 0 +testalg1.ZScanS... INFO Trk::Extrapolator::Cache s_navigVolsMax = 0 +testalg1.ZScanS... INFO Trk::Extrapolator::Cache s_navigVolsIntMax = 0 +testalg1.ZScanS... INFO Trk::Extrapolator::Cache s_containerSizeMax = 3 +testalg1.ZScanS... INFO finalize() successful testalg1.ZScanS... INFO Finalize successful testalg1.ZScanS... INFO Finalize successful testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO finalize() successful +testalg1.ZScanS... INFO finalize() successful testalg1.ZScanS... INFO Finalize successful testalg1.ZScanS... INFO Finalize successfull ToolSvc.InDetLa... INFO finalize() successful ToolSvc.LayerAr... INFO finalize() successful -ToolSvc.AtlasNa... INFO finalize() successful -ToolSvc.Default... INFO ToolSvc.DefaultPropagator finalize() successful -ToolSvc.Trackin... INFO finalize() successful ToolSvc.AtlasMu... INFO finalize() successful ToolSvc.AtlasEn... INFO finalize() successful +ToolSvc.Trackin... INFO finalize() successful *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -cObjR_ALL INFO Time User : Tot= 250 [ms] Ave/Min/Max= 2.45(+- 16.4)/ 0/ 160 [ms] #=102 -cObj_ALL INFO Time User : Tot= 320 [ms] Ave/Min/Max= 32(+- 56.7)/ 0/ 190 [ms] #= 10 -ChronoStatSvc INFO Time User : Tot= 25.6 [s] #= 1 +cObjR_ALL INFO Time User : Tot= 130 [ms] Ave/Min/Max= 1.27(+- 9.97)/ 0/ 100 [ms] #=102 +cObj_ALL INFO Time User : Tot= 160 [ms] Ave/Min/Max= 17.8(+- 33.9)/ 0/ 110 [ms] #= 9 +ChronoStatSvc INFO Time User : Tot= 2.86 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder_test.ref deleted file mode 100644 index ee1970efb9812fbbbaf592bdfbffcf915dd8bfab..0000000000000000000000000000000000000000 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderTools/share/ZScanSeedFinder_test.ref +++ /dev/null @@ -1,49 +0,0 @@ -TrkVertexSeedFinderTools/ZScanSeedFinder_test - - -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderTools/TrkVertexSeedFinderTools_tests.txt -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Sun Jun 16 22:36:29 2019 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /home/sss/nobackup/atlas/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /home/sss/nobackup/atlas/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully -ClassIDSvc INFO getRegistryEntries: read 3408 CLIDRegistry entries for module ALL -ToolSvc.Trk::ZS... INFO Initialize successfull -ToolSvc.Default... INFO ToolSvc.DefaultPropagator initialize() successful -ServiceManager FATAL No Service factory for AtlasTrackingGeometrySvc available. -ToolSvc.AtlasNa... ERROR ServiceLocatorHelper::service: can not locate service AtlasTrackingGeometrySvc -ToolSvc.AtlasNa...WARNING Couldn't retrieve TrackingGeometrySvc = ServiceHandle('AtlasTrackingGeometrySvc'). -ToolSvc.AtlasNa...WARNING -> Trying to retrieve default 'AtlasTrackingGeometry' from DetectorStore. -ToolSvc.Default... INFO Minimal momentum cut for material update : 50 MeV -ToolSvc.AtlasEn... INFO initialize() -ToolSvc.AtlasMu... INFO initialize() successful -ToolSvc.Trk::ZS... INFO Retrieved tool Extrapolator = PrivateToolHandle('Trk::Extrapolator') -ToolSvc.Trk::ZS... INFO Retrieved tool VertexUpdator = PrivateToolHandle('Trk::KalmanVertexUpdator') -ToolSvc.Trk::ZS... INFO Retrieved tool Extrapolator = PrivateToolHandle('Trk::Extrapolator') -ToolSvc.Trk::ZS... INFO Initialize successful -ToolSvc.Trk::ZS... INFO Retrieved tool LinearizedTrackFactory = PrivateToolHandle('Trk::FullLinearizedTrackFactory') -ToolSvc.Trk::ZS... INFO Retrieved tools Mode1dFinder = PrivateToolHandle('Trk::FsmwMode1dFinder') and IPEstimator = PrivateToolHandle('Trk::TrackToVertexIPEstimator') -test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..d2701dee85b4c711767a16cbc4cfb2619504a1e2 --- /dev/null +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigDetCalib/CMakeLists.txt deleted file mode 100644 index 16b27f0abb50bb81d68eae4d53f6fb743a32a0d6..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# Package: TrigDetCalib -################################################################################ - -# Declare the package name: -atlas_subdir( TrigDetCalib ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - DetectorDescription/IRegionSelector - GaudiKernel - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigSteeringEvent - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/CxxUtils - Event/EventInfo - Event/xAOD/xAODEventInfo - Event/xAOD/xAODMuon - Tracking/TrkEvent/TrkTrack - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigSteer/TrigSteering - Trigger/TrigT1/TrigT1Result - Trigger/TrigTools/TrigTimeAlgs - Trigger/TrigEvent/TrigMuonEvent ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) -find_package( tdaq-common ) - -# Component(s) in the package: -atlas_add_component( TrigDetCalib - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} IRegionSelector GaudiKernel TrigInDetEvent TrigSteeringEvent AthenaBaseComps AthenaKernel EventInfo TrkTrack TrigInterfacesLib TrigSteeringLib TrigT1Result TrigTimeAlgsLib TrigMuonEvent) - -# Install files from the package: -atlas_install_headers( TrigDetCalib ) -atlas_install_python_modules( python/*.py ) - diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index eaa981fd24ffdb72b37ad6fffe61ec2ed4e26a91..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/TrigAlgorithms/TrigDetCalib diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ITrigROBSelector.h b/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ITrigROBSelector.h deleted file mode 100644 index 6a024ba00fe3994e3af343244b401db560f3fa1d..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/TrigDetCalib/ITrigROBSelector.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @Project: LAr Calibration - * @Package: TrigDetCalib - * @class : ITrigROBSelector - * - * @brief : interface for TrigROBSelector - * - * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN - * - * File and Version Information: - * $Id: ITrigROBSelector.h,v 1.1 2008-10-14 12:03:47 nberger Exp $ - **********************************************************************************/ - -#ifndef TrigEgammaHypo_ITrigROBSelector_H -#define TrigEgammaHypo_ITrigROBSelector_H - -#include "GaudiKernel/IAlgTool.h" -#include "TrigSteeringEvent/Enums.h" -#include "IRegionSelector/RegSelEnums.h" - -class PartialEventBuildingInfo; -class IRoiDescriptor; - -/** - @class ITrigROBSelector - interface for TrigROBSelector - @author Nicolas Berger <Nicolas.Berger@cern.ch> -*/ - -static const InterfaceID IID_ITrigROBSelector ( "ITrigROBSelector", 1, 0 ); - - -class ITrigROBSelector : virtual public IAlgTool -{ - public: - - static const InterfaceID& interfaceID() { return IID_ITrigROBSelector; } - - virtual HLT::ErrorCode fillPEBInfo(PartialEventBuildingInfo& pebInfo, - const IRoiDescriptor& roi, - std::vector<DETID>* dets = 0, std::vector<int>* nRobs = 0) = 0; - virtual HLT::ErrorCode setupMonitoring() = 0; - virtual bool reset() = 0; -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibConfig.py b/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibConfig.py deleted file mode 100755 index d102358dba3715415b841380a0552dbd979546b8..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibConfig.py +++ /dev/null @@ -1,593 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# -*- coding: utf-8 -*- -from TrigDetCalib.TrigDetCalibConf import TrigROBListWriter, TrigSubDetListWriter -from TrigDetCalib.TrigDetCalibConf import TrigROBSelector -from TrigDetCalib.TrigDetCalibConf import ScoutingStreamWriter -from TrigDetCalib.TrigDetCalibConf import TrigEtaHypo -from TrigDetCalib.TrigDetCalibConf import TrigCheckForTracks -from TrigDetCalib.TrigDetCalibConf import TrigCheckForMuons -from TrigDetCalib.TrigDetCalibMonitoring import setCalibMonTools - -from AthenaCommon.Logging import logging - - -class LArROBSelector(TrigROBSelector) : - __slots__ = [] - def __init__(self, name = 'LArROBSelector'): - super( LArROBSelector, self ).__init__( name ) - self.Subdetectors = 'LAr,ID' - - -class TrkROBSelector(TrigROBSelector) : - __slots__ = [] - def __init__(self, name = 'TrkROBSelector'): - super( TrkROBSelector, self ).__init__( name ) - self.Subdetectors = 'ID' - - -class TileROBSelector(TrigROBSelector) : - __slots__ = [] - def __init__(self, name = 'TileROBSelector'): - super( TileROBSelector, self ).__init__( name ) - self.Subdetectors = 'TILE' - -class GenericROBSelector(TrigROBSelector) : - __slots__ = [] - def __init__(self, name = 'GenericROBSelector', subDets = ''): - super( GenericROBSelector, self ).__init__( name ) - self.Subdetectors = subDets - - -class L2ROBListWriter(TrigROBListWriter): - __slots__ = [] - def __init__(self, name = 'L2ROBListWriter', addCTPResult = False, addL2Result = False, - etaWidth = 0.1, phiWidth = 0.1): - super( L2ROBListWriter, self ).__init__( name ) - self.AddCTPResult = addCTPResult - self.AddL2Result = addL2Result - self.etaWidth = etaWidth - self.phiWidth = phiWidth - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterValidationMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterOnlineMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterCosmicMonitoring - validation = TrigROBListWriterValidationMonitoring() - online = TrigROBListWriterOnlineMonitoring() - cosmic = TrigROBListWriterCosmicMonitoring() - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig(name + '_Time') - self.AthenaMonTools = [ validation, online, time, cosmic ] - - -class GenericL2ROBListWriter(L2ROBListWriter): - __slots__ = [] - def __init__(self, name = 'GenericL2ROBListWriter', subDets = '', roILabels = [ 'initialRoI' ], addCTPResult = True, addL2Result = True, - etaWidth = 0.1, phiWidth = 0.1): - super( GenericL2ROBListWriter, self ).__init__( name, addCTPResult, addL2Result, etaWidth, phiWidth) - self.MaxRoIsPerEvent = 5 - self.RoIDescriptorLabels = roILabels - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = GenericROBSelector(self.name + '_ROBSelector_L2', subDets) - - -class LArL2ROBListWriter(L2ROBListWriter): - __slots__ = [] - def __init__(self, name = 'LArL2ROBListWriter', addCTPResult = True, addL2Result = True, - etaWidth = 0.1, phiWidth = 0.1): - super( LArL2ROBListWriter, self ).__init__( name, addCTPResult, addL2Result, etaWidth, phiWidth) - self.MaxRoIsPerEvent = 5 - self.RoIDescriptorLabels = [ 'TrigT2CaloEgamma', 'initialRoI' ] - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = LArROBSelector('LArROBSelector_L2') - -class TrkROBListWriter(L2ROBListWriter): - __slots__ = [] - def __init__(self, name = 'TrkROBListWriter', etaWidth = 0.1, phiWidth = 0.1): - super( TrkROBListWriter, self ).__init__( name, addCTPResult = True, addL2Result = True) - self.MaxRoIsPerEvent = -1 - self.RoIDescriptorLabels = [ 'TrigT2CaloEgamma', 'initialRoI' ] - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = TrkROBSelector() - - -class EFROBListWriter(TrigROBListWriter): - __slots__ = [] - def __init__(self, name = 'EFROBListWriter', addCTPResult = False, addL2Result = False, addEFResult = False, - etaWidth = 0.1, phiWidth = 0.1): - super( EFROBListWriter, self ).__init__(name) - self.AddCTPResult = addCTPResult - self.AddL2Result = addL2Result - self.AddEFResult = addEFResult - self.etaWidth = etaWidth - self.phiWidth = phiWidth - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterValidationMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterOnlineMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterCosmicMonitoring - validation = TrigROBListWriterValidationMonitoring() - online = TrigROBListWriterOnlineMonitoring() - cosmic = TrigROBListWriterCosmicMonitoring() - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig( name + '_Time' ) - self.AthenaMonTools = [ validation, online, time, cosmic ] - - -class GenericEFROBListWriter(EFROBListWriter): - __slots__ = [] - def __init__(self, name = 'GenericEFROBListWriter', subDets = '', roILabels = [ 'initialRoI' ], - addCTPResult = True, addL2Result = True, addEFResult = True, - etaWidth = 0.1, phiWidth = 0.1): - super( LArEFROBListWriter, self ).__init__( name, addCTPResult, addL2Result, addEFResult, etaWidth, phiWidth) - self.MaxRoIsPerEvent = 5 - self.RoIDescriptorLabels = roILabels - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = GenericROBSelector(self.name + '_ROBSelector_EF', subDets) - - -class LArEFROBListWriter (EFROBListWriter): - __slots__ = [] - def __init__(self, name = 'LArEFROBListWriter', addCTPResult = True, addL2Result = True, addEFResult = True, - etaWidth = 0.1, phiWidth = 0.1): - super( LArEFROBListWriter, self ).__init__( name, addCTPResult, addL2Result, addEFResult, etaWidth, phiWidth) - self.MaxRoIsPerEvent = 5 - self.RoIDescriptorLabels = [ 'TrigT2CaloEgamma', 'initialRoI' ] - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = LArROBSelector('LArROBSelector_EF') - - -class TileSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TileSubDetListWriter'): - super( TileSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('TileSubDetListWriter_Time') - self.SubdetId= ['Tile','TDAQ_CTP'] - self.MaxRoIsPerEvent = 1 - self.extraROBs = [ 5373984 ] # 0x520020 - self.AthenaMonTools = [ time ] - - #self.MonitoringHistoPath = '/EXPERT/TileSubDetListWriter/' - - -class CSCSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'CSCSubDetListWriter'): - super( CSCSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('CSCSubDetListWriter_Time') - self.SubdetId= [ 'CSC' ] # should match the code in TrigSubDetListWriter.cxx - self.MaxRoIsPerEvent = 1 - self.AthenaMonTools = [ time ] - -class IBLSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'IBLSubDetListWriter'): - super( IBLSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('IBLSubDetListWriter_Time') - self.SubdetId= ['IBL','DBM','TDAQ_CTP'] - self.MaxRoIsPerEvent = 1 - self.AthenaMonTools = [ time ] - -class PixelSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'PixelSubDetListWriter'): - super( PixelSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('PixelSubDetListWriter_Time') - self.SubdetId= ['Pixel','TDAQ_CTP'] - self.MaxRoIsPerEvent = 1 - self.AthenaMonTools = [ time ] - #self.MonitoringHistoPath = '/EXPERT/PixelSubDetListWriter/' - -class L1CaloSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'L1CaloSubDetListWriter'): - super( L1CaloSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('L1CaloSubDetListWriter_Time') - self.SubdetId= ['TDAQ_L1CALO'] - self.MaxRoIsPerEvent = 1 - self.AthenaMonTools = [ time ] - #self.MonitoringHistoPath = '/EXPERT/L1CaloSubDetListWriter/' - -class GenericSubDetListWriter(TrigSubDetListWriter) : - __slots__ = [] - def __init__(self, name = 'GenericSubDetListWriter', subDetIds = [], maxRoIsPerEvent = 1): - super( GenericSubDetListWriter, self ).__init__( name ) - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig('GenericSubDetListWriter_Time') - self.SubdetId = subDetIds - self.MaxRoIsPerEvent = maxRoIsPerEvent - self.AthenaMonTools = [ time ] - - -## Hypothesis algos to select only a particular eta range - -class EtaHypo_HEC(TrigEtaHypo) : - __slots__ = [] - def __init__(self, name = 'EtaHypo_HEC'): - super( EtaHypo_HEC, self ).__init__( name ) - self.EtaMinCut = 1.4 - self.EtaMaxCut = 3.3 - -class EtaHypo_FCAL(TrigEtaHypo) : - __slots__ = [] - def __init__(self, name = 'EtaHypo_FCAL'): - super( EtaHypo_FCAL, self ).__init__( name ) - self.EtaMinCut = 2.9 - self.EtaMaxCut = 5.1 - - -#### TrkIDAlign from StoreGate --> - -class CheckForTracks(TrigCheckForTracks) : - __slots__ = [] - def __init__(self, name = 'CheckForTracks'): - super(CheckForTracks, self ).__init__( name ) - - def setDefaults(self, handle): - if not hasattr( handle, 'ROBSelector' ) : - handle.ROBSelector = TrkROBSelector() - - -class CheckForTracks_Trk9_Central(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Central'): - super(CheckForTracks_Trk9_Central, self ).__init__( name ) - self.pT_min = 9000. - self.etaLowEdge = 0.0 - self.etaEdge = 1.4 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - -class CheckForTracks_Trk9_Fwd(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Fwd'): - super(CheckForTracks_Trk9_Fwd, self ).__init__( name ) - self.pT_min = 9000. - self.etaLowEdge = 1.35 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - -class CheckForTracks_Trk9_Central_Beamspot(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Central_Beamspot'): - super(CheckForTracks_Trk9_Central_Beamspot, self ).__init__( name ) - self.pT_min = 3000. - self.etaLowEdge = 0.0 - self.etaEdge = 1.4 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_BeamSpot' - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - self.lookForAnyTracks = True - - setCalibMonTools(self) - -class CheckForTracks_Trk9_Fwd_Beamspot(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Fwd_Beamspot'): - super(CheckForTracks_Trk9_Fwd_Beamspot, self ).__init__( name ) - self.pT_min = 3000. - self.etaLowEdge = 1.35 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_BeamSpot' - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - self.lookForAnyTracks = True - - setCalibMonTools(self) - -class CheckForTracks_Trk9_Central_SiTrack(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Central_SiTrack'): - super(CheckForTracks_Trk9_Central_SiTrack, self ).__init__( name ) - self.pT_min = 9000. - self.etaLowEdge = 0.0 - self.etaEdge = 1.4 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - -class CheckForTracks_Trk9_Fwd_SiTrack(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk9_Fwd_SiTrack'): - super(CheckForTracks_Trk9_Fwd_SiTrack, self ).__init__( name ) - self.pT_min = 9000. - self.etaLowEdge = 1.35 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - - - -class CheckForTracks_Trk16_Central(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk16_Central'): - super(CheckForTracks_Trk16_Central, self ).__init__( name ) - self.pT_min = 16000. - self.etaLowEdge = 0.0 - self.etaEdge = 1.4 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - -class CheckForTracks_Trk16_Fwd(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk16_Fwd'): - super(CheckForTracks_Trk16_Fwd, self ).__init__( name ) - self.pT_min = 16000. - self.etaLowEdge = 1.35 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - - -class CheckForTracks_Trk29_Central(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk29_Central'): - super(CheckForTracks_Trk29_Central, self ).__init__( name ) - self.pT_min = 29000. - self.etaLowEdge = 0.0 - self.etaEdge = 1.4 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - -class CheckForTracks_Trk29_Fwd(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk29_Fwd'): - super(CheckForTracks_Trk29_Fwd, self ).__init__( name ) - self.pT_min = 29000. - self.etaLowEdge = 1.35 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - - -class CheckForTracks_Trk_All(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_Trk_All'): - super(CheckForTracks_Trk_All, self ).__init__( name ) - self.pT_min = 1000. - self.etaLowEdge = 0.0 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrackCollection_TrigFastTrackFinder_TauIso' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - - setCalibMonTools(self) - - -class CheckForTracks_eGamma(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_eGamma_SiTrk'): - super(CheckForTracks_eGamma_SiTrk, self ).__init__( name ) - self.pT_min = 2000. - self.etaLowEdge = 0.0 - self.etaEdge = 5.0 - self.tracksName = 'HLT_TrigFastTrackFinder_eGamma' - self.lookForAnyTracks = True - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - setCalibMonTools(self) - - -class CheckForTracks_FullScan(CheckForTracks): - __slots__ = [] - def __init__(self, name = 'CheckForTracks_FullScan_SiTrk'): - super(CheckForTracks_FullScan_SiTrk, self ).__init__( name ) - self.pT_min = 2000. - self.etaLowEdge = 0.0 - self.etaEdge = 5.0 - self.lookForAnyTracks = True - self.tracksName = 'HLT_TrigFastTrackFinder_FullScan' - #self.extraROBs = [ 7798784, 8060928, 8126464 ] - self.AddCTPResult = True - self.AddL2Result = False - self.AddEFResult = False - setCalibMonTools(self) - - -#### TrkIDAlign from StoreGate <-- - - - -class TDAQ_L1SubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_L1SubDetListWriter'): - super( TDAQ_L1SubDetListWriter, self ).__init__( name ) - self.SubdetId= ['HLTResult','TDAQ_CTP'] - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - #self.extraROBs = [ 7798784 ] # ROB ID for eformat::TDAQ_CTP - - -class TDAQ_L2SubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_L2SubDetListWriter'): - super( TDAQ_L2SubDetListWriter, self ).__init__( name ) - self.SubdetId= ['TDAQ_LVL2','TDAQ_CTP'] - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - #self.extraROBs = [ 7798784 ] # ROB ID for eformat::TDAQ_CTP, need CTP (hardware) ROB for HLT result - - -class TDAQ_EFSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_EFSubDetListWriter'): - super( TDAQ_EFSubDetListWriter, self ).__init__( name ) - self.SubdetId= ['L2EFResult'] - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - #self.extraROBs = [ 7798784 ] # ROB ID for eformat::TDAQ_CTP, need CTP (hardware) ROB for HLT result - -class TDAQ_HLTSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_HLTSubDetListWriter'): - super( TDAQ_HLTSubDetListWriter, self ).__init__( name ) - self.SubdetId= ['HLTResult'] - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - #self.extraROBs = [ 7798784 ] # ROB ID for eformat::TDAQ_CTP, need CTP (hardware) ROB for HLT result - -class TDAQ_TrigResultSubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_EFSubDetListWriter'): - super( TDAQ_TrigResultSubDetListWriter, self ).__init__( name ) - self.SubdetId= ['HLTResult'] - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - #self.extraROBs = [ 7798784 ] # ROB ID for eformat::TDAQ_CTP, need CTP (hardware) ROB for HLT result - - -class TDAQ_ROB_SubDetListWriter(TrigSubDetListWriter): - __slots__ = [] - def __init__(self, name = 'TDAQ_ROB_SubDetListWriter', config = ''): - super( TDAQ_EFSubDetListWriter, self ).__init__( name ) - self.Subdetectors = '' - self.MaxRoIsPerEvent = 1 - self.addL1Calo = False - - log = logging.getLogger( 'TrigDetCalibConfig.py' ) - - if config == 'L1': - #self.extraROBs = [ 7798784 ] # ROB ID (code) for eformat::TDAQ_LVL1 - self.SubdetId= ['TDAQ_CTP'] - elif config == 'L2': - #self.extraROBs = [ 8060928 ] # ROB ID (code) for eformat::TDAQ_LVL2 - self.SubdetId= ['TDAQ_LVL2'] - elif config == 'EF': - #self.extraROBs = [ 8126464 ] # ROB ID (code) for eformat::TDAQ_EVENT_FILTER - self.SubdetId= ['TDAQ_EVENT_FILTER'] - elif config == 'SFI': - #self.extraROBs = [ 7929856 ] # ROB ID (code) for eformat::TDAQ_SFI - self.SubdetId= ['TDAQ_SFI'] - else: - log.warning('Unknown configuration string: '+config) - log.warning('Will reset to config=SFI') - #self.extraROBs = [ 7929856 ] # ROB ID (code) for eformat::TDAQ_SFI - -class ScoutTestAlg(ScoutingStreamWriter): - __slots__ = [] - def __init__(self, name = 'ScoutTestAlg', CollTypeName = []): - super( ScoutTestAlg, self ).__init__( name ) - self.CollectionTypeName = CollTypeName - - #For Example: - self.CollectionTypeName = ["TrigRoiDescriptor#secondaryRoI_EF", "TrigMuonEFContainer#MuonEF","TrigOperationalInfo#DataScouting"] - - - - - -class TrigCheckForMuons_pebM(TrigCheckForMuons): - __slots__ = [] - def __init__(self, name = 'TrigCheckForMuons_pebM', - etaWidth = 0.3, phiWidth = 0.3): - super( TrigCheckForMuons_pebM , self ).__init__( name ) - - self.AddCTPResult = True - self.AddHLTResult = True - self.etaWidth = etaWidth - self.phiWidth = phiWidth - self.MaxRoIsPerEvent = -1 - self.muonLabels = ["MuonEFInfo",""] - self.PEBInfoLabel = "pebM" - - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterValidationMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterOnlineMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterCosmicMonitoring - validation = TrigROBListWriterValidationMonitoring(name+"ValidationMonitoring") - online = TrigROBListWriterOnlineMonitoring(name+"OnlineMonitoring") - cosmic = TrigROBListWriterCosmicMonitoring(name+"CosmicMonitoring") - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig(name + '_Time') - self.AthenaMonTools = [ validation, online, time, cosmic ] - -class TrigCheckForMuons_peb075(TrigCheckForMuons): - __slots__ = [] - def __init__(self, name = 'TrigCheckForMuons_peb075', - etaWidth = 0.75, phiWidth = 0.75): - super( TrigCheckForMuons_peb075 , self ).__init__( name ) - - self.AddCTPResult = True - self.AddHLTResult = True - self.etaWidth = etaWidth - self.phiWidth = phiWidth - self.MaxRoIsPerEvent = -1 - self.muonLabels = ["MuonEFInfo",""] - self.PEBInfoLabel = "peb075" - - #self.ROBSelector.Subdetectors = "All" # this allows to modify list of subdetectors to include - - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterValidationMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterOnlineMonitoring - from TrigDetCalib.TrigDetCalibMonitoring import TrigROBListWriterCosmicMonitoring - validation = TrigROBListWriterValidationMonitoring(name+"ValidationMonitoring") - online = TrigROBListWriterOnlineMonitoring(name+"OnlineMonitoring") - cosmic = TrigROBListWriterCosmicMonitoring(name+"CosmicMonitoring") - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig(name + '_Time') - self.AthenaMonTools = [ validation, online, time, cosmic ] diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibMonitoring.py b/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibMonitoring.py deleted file mode 100644 index 755476ae7349fbd1fdd56e6680a7f5ed0925f8fc..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/python/TrigDetCalibMonitoring.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -#Definitions of the monitoring classes - -from __future__ import print_function - -from TrigMonitorBase.TrigGenericMonitoringToolConfig import defineHistogram, TrigGenericMonitoringToolConfig - -detectors = [ -"PIXEL", "SCT","TRT","LAR","TTEM","TTHEC","TILE","MDT","RPC","TGC","CSC","FCALEM","FCALHAD" -] - -detlabels='' -for a in detectors: - detlabels += a+':' - -nROBs = defineHistogram('nROBs', type='TH1I', title="No. of ROBs;#ROBs", xbins=300, xmin=0, xmax=300) -detVsNRobs = defineHistogram('detectors, nROBs', type='TH2I', title="No. of ROBs vs detectors;;#ROBs", xbins=13, xmin=20, xmax=33, ybins=300, ymin=0, ymax=300, labels=detlabels) -etaPhi = defineHistogram('roIEta, roIPhi', type='TH2F', title="position of processed RoI;eta;phi", xbins=100, xmin=-5, xmax=5, ybins=100, ymin=-3.2, ymax=3.2) - -## For CheckForTracks: - -eta_nROBs = defineHistogram('eta_tracks_ISO, nROBs', type='TH2F', title="eta position of processed tracks vs nROBs;eta;nROBs", xbins=50, xmin=-5, xmax=5, ybins=300, ymin=0, ymax=300) - -PtTrk = defineHistogram('PtTrk', type='TH1F', title="Track Pt;pT", xbins=100, xmin=-100000., xmax=100000.) -PtTrk_ISO = defineHistogram('PtTrk_ISO', type='TH1F', title="Track Pt ISO;pT", xbins=100, xmin=-100000., xmax=100000.) -dR_Tracks = defineHistogram('dR_tracks', type='TH1F', title="dR Tracks;DR", xbins=60, xmin=0., xmax=6.) -eta_Tracks = defineHistogram('eta_tracks', type='TH1F', title="Eta Tracks;eta", xbins=50, xmin=-5., xmax=5.) -phi_Tracks = defineHistogram('phi_tracks', type='TH1F', title="Phi Tracks;phi", xbins=50, xmin=-5., xmax=5.) -eta_Tracks_ISO = defineHistogram('eta_tracks_ISO', type='TH1F', title="Eta Tracks Iso;eta", xbins=50, xmin=-5., xmax=5.) -phi_Tracks_ISO = defineHistogram('phi_tracks_ISO', type='TH1F', title="Phi Tracks Iso;phi", xbins=50, xmin=-5., xmax=5.) -IsoTracks = defineHistogram('iso_Tracks', type='TH1I', title="N Iso Tracks;# tracks", xbins=30, xmin=0, xmax=30) - -eta_pt_ISO = defineHistogram('eta_tracks_ISO, PtTrk_ISO', type='TH2F', title="Tracks Iso;eta;pT", xbins=20, xmin=-5., xmax=5., ybins=20, ymin=0., ymax=100000.) -phi_pt_ISO = defineHistogram('phi_tracks_ISO, PtTrk_ISO', type='TH2F', title="Tracks Iso;phi;pT", xbins=20, xmin=-5., xmax=5., ybins=20, ymin=0., ymax=100000.) -phi_eta_ISO = defineHistogram('phi_tracks_ISO, eta_tracks_ISO', type='TH2F', title="Tracks Iso;phi;eta", xbins=20, xmin=-5., xmax=5., ybins=20, ymin=-5., ymax=5.) -n_pt_ISO = defineHistogram('iso_Tracks, PtTrk_ISO', type='TH2F', title="Tracks Iso;# tracks;pT", xbins=20, xmin=0., xmax=20, ybins=20, ymin=0., ymax=100000.) -n_eta_ISO = defineHistogram('iso_Tracks, eta_tracks_ISO', type='TH2F', title="Tracks Iso;# tracks;eta", xbins=20, xmin=0., xmax=20, ybins=20, ymin=-5., ymax=5.) -n_phi_ISO = defineHistogram('iso_Tracks, phi_tracks_ISO', type='TH2F', title="Tracks Iso;# tracks;phi", xbins=20, xmin=0., xmax=20, ybins=20, ymin=-5., ymax=5.) - -class TrigROBListWriterValidationMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name="TrigROBListWriter_Validation"): - super(TrigROBListWriterValidationMonitoring, self).__init__(name) - self.defineTarget("Validation") - self.Histograms = [ nROBs, detVsNRobs, etaPhi ] - - -class TrigROBListWriterOnlineMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name="TrigROBListWriter_Online"): - super(TrigROBListWriterOnlineMonitoring, self).__init__(name) - self.defineTarget("Online") - self.Histograms = [ nROBs, detVsNRobs, etaPhi ] - -class TrigROBListWriterCosmicMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name="TrigROBListWriter_Cosmic"): - super(TrigROBListWriterCosmicMonitoring, self).__init__(name) - self.defineTarget("Cosmic") - self.Histograms = [ nROBs, detVsNRobs, etaPhi ] - -class TrigCheckForTracksValidationMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name): - super(TrigCheckForTracksValidationMonitoring, self).__init__(name) - self.defineTarget("Validation") - self.Histograms = [ nROBs, detVsNRobs, PtTrk, PtTrk_ISO, dR_Tracks, eta_Tracks, phi_Tracks, eta_Tracks_ISO, phi_Tracks_ISO, IsoTracks, eta_pt_ISO, phi_pt_ISO, phi_eta_ISO] - - -class TrigCheckForTracksOnlineMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name): - super(TrigCheckForTracksOnlineMonitoring, self).__init__(name) - self.defineTarget("Online") - self.Histograms = [ nROBs, detVsNRobs, PtTrk, PtTrk_ISO, dR_Tracks, eta_Tracks, phi_Tracks, eta_Tracks_ISO, phi_Tracks_ISO, IsoTracks, eta_pt_ISO, phi_pt_ISO, phi_eta_ISO] - - -class TrigCheckForTracksCosmicMonitoring(TrigGenericMonitoringToolConfig): - def __init__ (self, name): - super(TrigCheckForTracksCosmicMonitoring, self).__init__(name) - self.defineTarget("Cosmic") - self.Histograms = [ nROBs, detVsNRobs, PtTrk, PtTrk_ISO, dR_Tracks, eta_Tracks, phi_Tracks, eta_Tracks_ISO, phi_Tracks_ISO, IsoTracks, eta_pt_ISO, phi_pt_ISO, phi_eta_ISO] - - - -def setCalibMonTools( algoObject ): - algoName=algoObject.getName() - print ("Monitoring for "+algoName) - - from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - time = TrigTimeHistToolConfig(algoName+"Time") - time.TimerHistLimits = [0,3] - - nameOnl = algoName+"_Onl" - onlTool = TrigCheckForTracksOnlineMonitoring(nameOnl ) - - nameVal = algoName+"_Val" - valTool = TrigCheckForTracksValidationMonitoring(nameVal) - - nameCos = algoName+"_Cos" - cosTool = TrigCheckForTracksCosmicMonitoring(nameCos) - - algoObject.AthenaMonTools = [ time, onlTool, valTool, cosTool ] diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.cxx deleted file mode 100755 index b212cd36fcbdcb97deed62aef86586685c595c54..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AthenaKernel/IClassIDSvc.h" -#include "AthenaKernel/errorcheck.h" -#include "ScoutingStreamWriter.h" -#include "TrigSteeringEvent/ScoutingInfo.h" - - -ScoutingStreamWriter::ScoutingStreamWriter(const std::string& name, ISvcLocator* pSvcLocator): - //HLT::AllTEAlgo(name, pSvcLocator), - HLT::HypoAlgo(name, pSvcLocator), - m_clidSvc("ClassIDSvc", name){ - declareProperty("CollectionTypeName", m_collectionTypeName); -} - -ScoutingStreamWriter::~ScoutingStreamWriter(){ -} - -HLT::ErrorCode ScoutingStreamWriter::hltInitialize(){ - - if (!m_clidSvc.retrieve().isSuccess()) { - msg() << MSG::FATAL << "Cannot get ClassIDSvc " << m_clidSvc << endmsg; - return HLT::FATAL; - } - - std::vector< std::string> coll = m_collectionTypeName.value(); - - std::vector< std::string> types; - std::vector<std::string> names; - - types.clear(); - names.clear(); - - for (std::vector<std::string>::const_iterator it = coll.begin(), it_e = coll.end(); it != it_e; it++) { - std::size_t found = (*it).find_first_of('#'); - - if (found != std::string::npos) - { - types.push_back((*it).substr(0,found)); - names.push_back((*it).substr(found+1,(*it).size()-found+1)); - }else{ - - msg() << MSG::FATAL << "Collection type and collection name not configured correctly. " << endmsg; - return HLT::FATAL; - } - } - - if (types.size() != names.size()){ - msg() << MSG::FATAL << "Collection type and collection name vectors have different size. " << endmsg; - return HLT::FATAL; - } - - return HLT::OK; - -} - -HLT::ErrorCode ScoutingStreamWriter::hltExecute(const HLT::TriggerElement*, bool& pass){ - //std::vector<std::vector<HLT::TriggerElement*> >& input, - //unsigned int output){ - - - std::vector< std::string> coll = m_collectionTypeName.value(); - - std::vector< std::string> types; - std::vector<std::string> names; - - types.clear(); - names.clear(); - - for (std::vector<std::string>::const_iterator it = coll.begin(), it_e = coll.end(); it != it_e; it++) { - std::size_t found = (*it).find_first_of('#'); - if (found != std::string::npos) - { - types.push_back((*it).substr(0,found)); - names.push_back((*it).substr(found+1,(*it).size()-found+1)); - }else{ - - msg() << MSG::FATAL << "Collection type and collection name not configured correctly. " << endmsg; - return HLT::FATAL; - } - } - - if (types.size() != names.size()){ - msg() << MSG::FATAL << "Collection type and collection name vectors have different size. " << endmsg; - return HLT::FATAL; - } - - std::vector<CLID> clid; - clid.clear(); - - for (std::vector<std::string>::const_iterator it = types.begin(), it_e = types.end(); it != it_e; it++) { - CLID classid; - if (!m_clidSvc->getIDOfTypeName(*it, classid).isSuccess()){ - msg() << MSG::WARNING << "Cannot convert type. No CLID for " << (*it) << endmsg; - } else { - clid.push_back(classid); - } - } - - ScoutingInfo* ScoutInfo = config()->getScoutingInfo(); - if(!ScoutInfo){ - msg() << MSG::DEBUG << "*** Not Executing this ScoutingStreamWriter " << name() << endmsg; - return HLT::OK; - } else { - for(unsigned int i = 0; i < clid.size(); ++i) - ScoutInfo->add(clid.at(i), names.at(i)); - } - - pass = true; - - return HLT::OK; - -} - -HLT::ErrorCode ScoutingStreamWriter::hltFinalize(){ - - return HLT::OK; - -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.h deleted file mode 100755 index 4cb62dd7d44a3203eac62f370824b58797f495cb..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/ScoutingStreamWriter.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @class : ScoutingStreamWriter - * - * - * @author Noemi Calace <noemi.calace@cern.ch> - CERN - * - **********************************************************************************/ - -#ifndef TrigEgammaHypo_ScoutingStreamWriter_H -#define TrigEgammaHypo_ScoutingStreamWriter_H - -//#include "TrigInterfaces/AllTEAlgo.h" -#include "TrigInterfaces/HypoAlgo.h" -#include "GaudiKernel/ServiceHandle.h" -#include <vector> -#include <string> - -class ScoutingInfo; - -/* - @class ScoutingStreamWriter -*/ - -class ScoutingStreamWriter : public HLT::HypoAlgo //public HLT::AllTEAlgo -{ - public: - - ScoutingStreamWriter(const std::string& name, ISvcLocator* pSvcLocator); //!< std Gaudi algorthm constructor - ~ScoutingStreamWriter(); - - HLT::ErrorCode hltInitialize(); - - HLT::ErrorCode hltExecute(const HLT::TriggerElement* outputTE, bool& pass); - //std::vector<std::vector<HLT::TriggerElement*> >& input, - //unsigned int output); - - HLT::ErrorCode hltFinalize(); - - private: - - ServiceHandle<IClassIDSvc> m_clidSvc; - StringArrayProperty m_collectionTypeName; - - -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.cxx deleted file mode 100644 index f9235caa6df21bfec5e7f13bf5c6494305424322..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.cxx +++ /dev/null @@ -1,312 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/PartialEventBuildingInfo.h" -#include "IRegionSelector/IRegSelSvc.h" -#include "xAODMuon/MuonContainer.h" - - -#include "TrigCheckForMuons.h" - -using namespace std; - -TrigCheckForMuons::TrigCheckForMuons(const std::string& name, ISvcLocator* pSvcLocator) - : HLT::AllTEAlgo(name, pSvcLocator), - //m_clidSvc("ClassIDSvc", name), - //m_types(), m_names(), m_momType(), m_clid(), - m_robSelector("TrigROBSelector", this ), - m_addCTPResult(1), m_addHLTResult(1), - m_addOppositePhiRoI(false), m_addOppositeEtaPhiRoI(false), - m_nRoIs(0), - m_mindRSqr(0.01*0.01) -{ - declareProperty("muonLabels", m_muonLabels, "List of labels for xAOD::Muon collection"); - declareProperty("ROBSelector", m_robSelector, "The ROB Selector Tool"); - declareProperty("AddCTPResult", m_addCTPResult, "Add the CTP result to the list of ROBs"); - declareProperty("AddOppositePhiRoI", m_addOppositePhiRoI = false, "Add also RoIs opposite in phi but same eta"); - declareProperty("AddOppositeEtaPhiRoI", m_addOppositeEtaPhiRoI = false, "Add also RoIs opposite in phi and opposite in eta"); - declareProperty("AddHLTResult", m_addHLTResult, "Add the HLT result to the list of ROBs"); - declareProperty("etaEdge", m_etaEdge = 5.0, "Upper limit of |eta| range"); - declareProperty("etaWidth", m_etaWidth = 0.1, "Width of the RoI in eta"); - declareProperty("phiWidth", m_phiWidth = 0.1, "Width of the RoI in phi"); - declareProperty("PEBInfoLabel", m_pebLabel = "dunno", "The label under which the PartialEventBuildingInfo object is stored"); - declareProperty("MaxRoIsPerEvent", m_maxRoIsPerEvent = -1); - declareProperty("extraROBs", m_extraROBs); - declareProperty("rejectAll", m_rejectAll = false); - declareProperty("overlapdR" , m_mindRSqr = 0.01*0.01 ); - - - declareMonitoredStdContainer("nROBs", m_nROBs); - declareMonitoredStdContainer("detectors", m_dets); - declareMonitoredVariable("roIEta", m_roIEta); - declareMonitoredVariable("roIPhi", m_roIPhi); -} - - -HLT::ErrorCode TrigCheckForMuons::hltInitialize() -{ - msg() << MSG::INFO << "Initializing CPTResult "<<m_addCTPResult - << " HLTResult "<< m_addHLTResult<< endmsg; - if (m_addCTPResult){ - m_trigResults.push_back(eformat::TDAQ_CTP); - m_trigResults.push_back(eformat::TDAQ_MUON_CTP_INTERFACE); - msg() << MSG::INFO << " Will add TDAQ_CTP, TDAQ_MUON_CTP_INTERFACE to event record" << endmsg; - } - if (m_addHLTResult){ - m_trigResults.push_back(eformat::TDAQ_HLT); - msg() << MSG::INFO << " Will add TDAQ_HLT to event record " << endmsg; - } - return HLT::OK; -} - - -HLT::ErrorCode TrigCheckForMuons::hltBeginRun() -{ - msg() << MSG::INFO << "in hltBeginRun() " << endmsg; - return m_robSelector->setupMonitoring(); -} - - -HLT::ErrorCode TrigCheckForMuons::hltFinalize() -{ - /* OI-- Not using this so far - if (!m_clidSvc.retrieve().isSuccess()) { - msg() << MSG::FATAL << "Cannot get ClassIDSvc " << m_clidSvc << endmsg; - return HLT::FATAL; - } - - std::vector< std::string> coll = m_collectionTypeName.value(); - - m_types.clear(); - m_names.clear(); - - for (std::vector<std::string>::const_iterator it = coll.begin(), it_e = coll.end(); it != it_e; it++) { - std::size_t found = (*it).find_first_of('#'); - - if (found != std::string::npos) - { - m_types.push_back((*it).substr(0,found)); - m_names.push_back((*it).substr(found+1,(*it).size()-found+1)); - if (msgLvl()<=MSG::DEBUG) msg() << MSG::DEBUG << "Will look for Collection " << m_types.back() << " with " << m_names.back() << " for PEB stream"<< endmsg; - }else{ - - msg() << MSG::FATAL << "Collection type and collection name not configured correctly. " << endmsg; - return HLT::BAD_ALGO_CONFIG; - } - } - - if (m_types.size() != m_names.size()){ - msg() << MSG::FATAL << "Collection type and collection name vectors have different size. " << endmsg; - return HLT::BAD_ALGO_CONFIG; - } - - m_clid.clear(); - - for (std::vector<std::string>::const_iterator it = m_types.begin(), it_e = m_types.end(); it != it_e; it++) { - CLID classid; - if (!m_clidSvc->getIDOfTypeName(*it, classid).isSuccess()){ - msg() << MSG::WARNING << "Cannot convert type. No CLID for " << (*it) << endmsg; - return HLT::BAD_ALGO_CONFIG; - } else { - int momType = -1; - const SG::BaseInfoBase* baseInfo = SG::BaseInfoBase::find( classid ); - if( ! baseInfo ){ - msg() << MSG::FATAL << "Please fix me: Cannot convert type. No BaseInfo for " << (*it) << endmsg; - return HLT::BAD_ALGO_CONFIG; - } - - if( baseInfo->is_base( ClassID_traits< xAOD::IParticleContainer >::ID() ) ) { - momType = 0; - } else if( baseInfo->is_base( ClassID_traits< I4MomentumContainer >::ID() ) ) { - // this is an "old" container, handle it through I4MomentumContainer - momType = 1; - } else { - msg() << MSG::FATAL << "Please fix me: I do not know how to extract eta/phi for this class " << (*it) << endmsg; - return HLT::BAD_ALGO_CONFIG; - } - - m_clid.push_back(classid); - m_momType.push_back(momType); - if (msgLvl()<=MSG::DEBUG) msg() << MSG::DEBUG << "CLID "<< classid << " is OK, accept for PEB " << endmsg; - - } - } - */ - return HLT::OK; -} - -//------------------------------------------------------------------------------------- -HLT::ErrorCode TrigCheckForMuons::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& inputTE, unsigned int output) -{ - - bool debug = msg().level()<=MSG::DEBUG; - - m_nRoIs++; - if( debug ){ - msg() << MSG::DEBUG << "Executing this TrigCheckForMuons " ; - if (m_maxRoIsPerEvent > -1) msg() << " RoI " << m_nRoIs << "/" << m_maxRoIsPerEvent; - msg() << endmsg; - } - - if (m_maxRoIsPerEvent > -1 && m_nRoIs > m_maxRoIsPerEvent) { - if( debug ) - msg() << MSG::DEBUG << "RoI limit (" << m_maxRoIsPerEvent - << ") reached for this event : will not process this RoI" << endmsg; - return HLT::OK; - } - - // Get Objects - - //HLT::ErrorCode status = HLT::BAD_ALGO_CONFIG; - - - // create new partial EB directive - PartialEventBuildingInfo* pebInfo = config()->getPEBI(); - if(!pebInfo){ - if( debug ) - msg() << MSG::DEBUG << "*** Not Executing this TrigCheckForMuons " << name() << ", not a calib chain" << endmsg; - return HLT::OK; - } - - - //--------- Get list of eta/phi of interesting objects ---------- - - // FIXME : can trace number of recorded muons per event and only add new once - - ElementLinkVector<xAOD::MuonContainer> elvmuon; - std::vector<ElementLink<xAOD::MuonContainer> > muonVec; - - for( auto mLabel : m_muonLabels ){ - bool foundLabel = false; - size_t nMu0 = muonVec.size(); - size_t nMu1 = 0; - for( auto TEvec : inputTE) - for( auto oneTE : TEvec ){ - // use getFeatureLinks instead of "Link" to get them all recursively, otherwise Bphys topo will stop search - HLT::ErrorCode status = getFeaturesLinks<xAOD::MuonContainer,xAOD::MuonContainer>(oneTE, elvmuon); - if(status==HLT::OK ) { - foundLabel = true; - bool found = false; - nMu1 += elvmuon.size(); - for( const auto & efmu : elvmuon ){ - if( found ) break; - for(const auto& part : muonVec ){ - if( (*part)->charge() * (*efmu)->charge() < 0 ) continue; - double deta = (*part)->eta() - (*efmu)->eta(); - double dphi = (*part)->phi() - (*efmu)->phi(); - double deltaR2 = deta*deta +dphi*dphi; - if( deltaR2 <= m_mindRSqr){ - found = true; - if(debug) msg() << MSG::DEBUG << " SKIP (Already have) muon with pt="<<(*efmu)->pt() << " eta=" - << (*efmu)->eta() << " phi=" << (*efmu)->phi() << " charge="<< (*efmu)->charge() << endmsg; - break; - } - } // loop over muonVec - if( !found ){ - muonVec.push_back(efmu); - if(debug) msg() << MSG::DEBUG << " Found muon pt="<<(*efmu)->pt() << " eta=" - << (*efmu)->eta() << " phi=" << (*efmu)->phi() << " charge="<< (*efmu)->charge() << endmsg; - } - }// end loop over muons - if(debug){ - if( !foundLabel ) msg() << " No collection with label "<< mLabel << " is found " << endmsg; - else - msg() << MSG::DEBUG << " Found "<< nMu1 << " muons with label "<< mLabel - <<" recorded "<< muonVec.size() - nMu0 << endmsg; - } - - } - }// end loop over TEs - } // end loop over labels - - - for(const auto& muon : muonVec ){ - - m_roIEta = (*muon)->eta(); - m_roIPhi = (*muon)->phi(); - - if (debug) msg() << MSG::DEBUG << "Processing muon " << m_roIEta << " " << m_roIPhi << endmsg; - - double etaMin = std::max(-m_etaEdge,m_roIEta - m_etaWidth); - double etaMax = std::min( m_etaEdge,m_roIEta + m_etaWidth); - - double phiMin = m_roIPhi - m_phiWidth; - double phiMax = m_roIPhi + m_phiWidth; - while (phiMin < 0) phiMin += 2*M_PI; - while (phiMax > 2*M_PI) phiMax -= 2*M_PI; // AH HA!! This is wrong! Need in the range -pi .. pi - - TrigRoiDescriptor roi( m_roIEta, etaMin, etaMax, m_roIPhi, phiMin, phiMax ); - - // now add ROBs - HLT::ErrorCode ec = m_robSelector->fillPEBInfo(*pebInfo, roi, &m_dets, &m_nROBs); - if (ec != HLT::OK) { - if (debug) msg() << MSG::DEBUG << "Failed to record PEB " << endmsg; - return ec; - } - - if( m_addOppositePhiRoI || m_addOppositeEtaPhiRoI) { - m_roIPhi_2 = (*muon)->phi(); - while (m_roIPhi_2 < 0) m_roIPhi_2 += 2*M_PI; - while (m_roIPhi_2 > 2*M_PI) m_roIPhi_2 -= 2*M_PI; - - double phiMin_2 =( m_roIPhi_2 + M_PI) - m_phiWidth; //Making a few redefintions of phi to look at muons produced in the oppoisite direction. Keeping eta the same, but changing phi. - double phiMax_2 = (m_roIPhi_2 + M_PI) + m_phiWidth; - while (phiMin_2 < 0) phiMin_2 += 2*M_PI; - while (phiMax_2 > 2*M_PI) phiMax_2 -= 2*M_PI; - - if( m_addOppositePhiRoI ) { //To now look for muons in the opposite phi direction, create a second TrigRoiDescriptor - TrigRoiDescriptor roi2( m_roIEta, etaMin, etaMax, m_roIPhi_2 + M_PI, phiMin_2, phiMax_2 ); - - // now add ROBs - ec = m_robSelector->fillPEBInfo(*pebInfo, roi2, &m_dets, &m_nROBs); - if (ec != HLT::OK) { - if (debug) msg() << MSG::DEBUG << "Failed to record PEB for roi2" << endmsg; - return ec; - } - } - if( m_addOppositeEtaPhiRoI ) {//To now look for muons in the opposite eta and phi direction, - double etaMin_2 = std::max(-m_etaEdge,-m_roIEta - m_etaWidth); - double etaMax_2 = std::min( m_etaEdge,-m_roIEta + m_etaWidth); - TrigRoiDescriptor roi2( m_roIEta, etaMax_2, etaMin_2, m_roIPhi_2 + M_PI, phiMin_2, phiMax_2 ); - - // now add ROBs - ec = m_robSelector->fillPEBInfo(*pebInfo, roi2, &m_dets, &m_nROBs); - if (ec != HLT::OK) { - if (debug) msg() << MSG::DEBUG << "Failed to record PEB for roi2" << endmsg; - return ec; - } - } - } - - - if (debug) msg() << MSG::DEBUG << "Recorded " << m_nROBs.back() << " ROBs " << endmsg; - - - } // end loop over muons - - // Add extra ROBs - for (std::vector<uint32_t>::const_iterator rob = m_extraROBs.begin(); rob != m_extraROBs.end(); rob++) - pebInfo->add(*rob); - - // Add trig results as specified in properties - pebInfo->addSubDetector(m_trigResults); - - if(! m_rejectAll){ // Flag used for commissioning - HLT::TriggerElement* te = addRoI(output); - te->setActiveState(true); - } - return HLT::OK; -} - - -HLT::ErrorCode TrigCheckForMuons::hltEndEvent() -{ - m_robSelector->reset(); - m_dets.clear(); - m_nROBs.clear(); - m_nRoIs = 0; - return HLT::OK; -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.h deleted file mode 100644 index 21ecd56eccefe50eb8b46991bf86206dfdb52944..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForMuons.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @Project: LAr Calibration - * @Package: TrigEgammaHypo - * @Class : TrigCheckForMuons - * - * @brief : Algorithm to write out a list of ROBs around muons - * - * @author Olya Igonkina, Amy Tee - * - * File and Version Information: - * $Id: TrigCheckForMuons.h 707504 2015-11-12 16:33:46Z fwinkl $ - **********************************************************************************/ - -#ifndef TrigDetCalib_TrigCheckForMuons_H -#define TrigDetCalib_TrigCheckForMuons_H - -#include "TrigInterfaces/AllTEAlgo.h" - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include <vector> -#include <string> - -#include "IRegionSelector/RegSelEnums.h" -#include "GaudiKernel/ITHistSvc.h" -#include "TrigDetCalib/ITrigROBSelector.h" - -#include "eformat/SourceIdentifier.h" -#include "TrigNavStructure/Types.h" - -class IRegSelSvc; -class MsgStream; -class PartialEventBuildingInfo; -class TH1I; - -namespace HLT { - class TriggerElement; -} - -/** - @class TrigCheckForMuons - Algorithm to write out a list of ROBs around all muons. - In principle, we could also run it only once per event. - However, if there is another chain that also wants all muons and is not yet finished, then we risk to miss some muons. - It is very quick, and every ROB will be written only once, so it should not be a problem to repeat it.. - - @author Olya Igonkina -*/ -class TrigCheckForMuons : public HLT::AllTEAlgo -{ - public: - - TrigCheckForMuons(const std::string& name, ISvcLocator* pSvcLocator); //!< std Gaudi algorthm constructor - - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - - /** @brief take one input TriggerElement and process it - It tries to retrieve any attached TrigRoIDescriptor features and prints them. - @param input TriggerElement to be processed - @param output TriggerElement coming out of the algorithm - */ - - HLT::ErrorCode hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& inputTE, unsigned int output); - - HLT::ErrorCode hltBeginRun(); - - HLT::ErrorCode hltEndEvent(); - - - private: - - ToolHandle<ITrigROBSelector> m_robSelector; - bool m_addCTPResult, m_addHLTResult; - bool m_addOppositePhiRoI; - bool m_addOppositeEtaPhiRoI; - - double m_etaEdge, m_etaWidth, m_phiWidth; - - std::string m_pebLabel; - std::vector<std::string> m_muonLabels; - - int m_maxRoIsPerEvent, m_nRoIs; - - // Hardcoded extra ROBs that should be shipped in all cases - std::vector<uint32_t> m_extraROBs; - - // Monitored variables - std::vector<DETID> m_dets; - std::vector<eformat::SubDetector> m_trigResults; - std::vector<int> m_nROBs; - double m_roIEta, m_roIPhi, m_roIPhi_2; - float m_mindRSqr; - - bool m_rejectAll; -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.cxx deleted file mode 100755 index 411cc2678e7f080028949d8dae1617945b9cd50c..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.cxx +++ /dev/null @@ -1,302 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: TrigCheckForTracks.cxx -// PACKAGE: Trigger/TrigAlgorithms/TrigDetCalib -// -// ******************************************************************** - -#include "TrigCheckForTracks.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/IJobOptionsSvc.h" - -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrkTrack/TrackCollection.h" - -#include "TrigSteeringEvent/PartialEventBuildingInfo.h" -#include "IRegionSelector/IRegSelSvc.h" - -#include <string> -#include <vector> - - - -class ISvcLocator; - - -TrigCheckForTracks::TrigCheckForTracks(const std::string& name, ISvcLocator* pSvcLocator): - HLT::AllTEAlgo(name, pSvcLocator), - m_executedEvent(false), - m_robSelector("TrigROBSelector", this ) -{ - - declareProperty("ROBSelector", m_robSelector, "The ROB Selector Tool"); - declareProperty("PEBInfoLabel", m_pebLabel = "dunno", "The label under which the PartialEventBuildingInfo object is stored"); - declareProperty("extraROBs", m_extraROBs); - - // declareProperty("doMonitoring", m_doMonitoring = true, "switch on/off monitoring" ); - declareProperty("AcceptAll", m_acceptAll = false); - declareProperty("dR0" , m_dR0 = 0.3); - declareProperty("dR0_overlap", m_dR0_overlap = 0.005); - declareProperty("pT_min", m_pT_min = 1000.); - declareProperty("pT_min_iso", m_pT_min_iso = 1000.); - declareProperty("phi_Width", m_phiWidth = 0.1); - declareProperty("eta_Width", m_etaWidth = 0.1); - declareProperty("etaEdge", m_etaEdge = 5.0, "Upper limit of |eta| range"); - declareProperty("etaLowEdge", m_etaLowEdge = 0.0, "Lower limit of |eta| range"); - declareProperty("tracksName", m_tracksName = "HLT_TrigFastTrackFinder_Tau"); - declareProperty("doNotPass", m_doNotPass = false); // pass through flag for initial beam items. - declareProperty("lookForAnyTracks", m_lookForAnyTracks = false); // any vs isolated. any is needed for initial beam items. - declareProperty("AddCTPResult", m_addCTPResult = false, "Add the CTP result to the list of ROBs"); - declareProperty("AddL2Result", m_addL2Result = false, "Add the L2 result to the list of ROBs"); - declareProperty("AddEFResult", m_addEFResult = false, "Add the EF result to the list of ROBs"); - declareProperty("AddHLTResult", m_addHLTResult = false, "Add the EF result to the list of ROBs"); - - declareMonitoredStdContainer("nROBs", m_nROBs); - declareMonitoredStdContainer("detectors", m_dets); - - declareMonitoredStdContainer("PtTrk", m_pT); - declareMonitoredStdContainer("PtTrk_ISO", m_pT_Iso); - declareMonitoredStdContainer("dR_tracks", m_dR); - declareMonitoredStdContainer("eta_tracks", m_eta); - declareMonitoredStdContainer("phi_tracks", m_phi); - declareMonitoredStdContainer("eta_tracks_ISO", m_ROB_eta); - declareMonitoredStdContainer("phi_tracks_ISO", m_ROB_phi); - declareMonitoredVariable("iso_Tracks", m_n_IsoTracks); - -} - - -TrigCheckForTracks::~TrigCheckForTracks() -{ } - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigCheckForTracks::hltInitialize() -// ---------------------------------------------------------------------- -{ - // Initialize timing service - //------------------------------ - if( service( "TrigTimerSvc", m_timerSvc).isFailure() ) { - ATH_MSG_WARNING( name() - << ": Unable to locate TrigTimer Service" ); - } - if (m_timerSvc) - m_timers.push_back(m_timerSvc->addItem("TrigCheckForTracks.TrigCheckForTracksTot")); - - m_acceptedEvts = 0; - m_rejectedEvts = 0; - m_errorEvts = 0; - - if (m_addCTPResult) m_trigResults.push_back(eformat::TDAQ_CTP); - if (m_addL2Result) m_trigResults.push_back(eformat::TDAQ_LVL2); - if (m_addEFResult) m_trigResults.push_back(eformat::TDAQ_EVENT_FILTER); - if (m_addEFResult) m_trigResults.push_back(eformat::TDAQ_HLT); - - return HLT::OK; -} - - -HLT::ErrorCode TrigCheckForTracks::hltStart() -{ - return m_robSelector->setupMonitoring(); -} - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigCheckForTracks::hltFinalize(){ -// ---------------------------------------------------------------------- - - ATH_MSG_INFO( "Events accepted/rejected/errors: "<< m_acceptedEvts <<" / "<< m_rejectedEvts << " / "<< m_errorEvts ); - return HLT::OK; -} - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigCheckForTracks::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& /*tes_in*/, unsigned int output) { -// ---------------------------------------------------------------------- - - if (m_executedEvent) { - ATH_MSG_DEBUG( "*** Not Executing this TrigCheckForTracks " << name() << ", already executed" ); - return HLT::OK; - } - - ATH_MSG_DEBUG( "*** Executing this TrigCheckForTracks : " << name() ); - - - //--> PEB Related Stuff - - PartialEventBuildingInfo* pebInfo = config()->getPEBI(); - if(!pebInfo){ - ATH_MSG_DEBUG( "*** Not Executing this TrigCheckForTracks " << name() << ", not a calib chain" ); - return HLT::OK; - } - //--< PEB Related Stuff - - beforeExecMonitors().ignore(); - - - // The code retrieves tracks from the StoreGate. Please note that - // this is not compatible with the caching model implemented by - // Tomasz and Rustem for the fex and combo algorithms. - // AllTE algorithms are not included in the caching model. - // Retrieving objects from the StoreGate is not something that - // should be done for other algorithms than AllTE - // - so retrieving objects from the StoreGate is - // **not** allowed in fex or combo algorithms. - // More on caching: - // https://twiki.cern.ch/twiki/bin/view/Atlas/HltAlgorithmsCaching - - - // Retrieve Tracks from StoreGate: - - const TrackCollection* tracks = 0; - - if (evtStore()->transientContains<TrackCollection>(m_tracksName)) { - ATH_MSG_DEBUG( MSG::DEBUG << "*** TrackCollection with name "<< m_tracksName <<" found in StoreGate (transientContains)" ); - } - else { - ATH_MSG_DEBUG( "*** No TrackCollection with name" << m_tracksName << " found in StoreGate (transientContains)" ); - return HLT::OK; - } - - StatusCode sc = evtStore()->retrieve(tracks,m_tracksName); - - ATH_MSG_DEBUG( "***** Status code: "<< sc << " for key: " << m_tracksName ); - - if (sc.isFailure()) { - ATH_MSG_DEBUG( "No TrackCollection with name "<<m_tracksName<<" found in StoreGate" ); - m_errorEvts++; - m_rejectedEvts++; - } else { - ATH_MSG_DEBUG( "TrackCollection with name "<<m_tracksName<<" found in StoreGate" ); - ATH_MSG_DEBUG( "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" ); - - // Have found tracks... - // Now loop over the tracks to find the isolated ones. - - if (tracks->size()!=0) { - - - int count_IsoTracks = 0; - - for (TrackCollection::const_iterator it = tracks->begin(); it!=tracks->end(); ++it) - { - - const Trk::Perigee *ip = (*it)->perigeeParameters(); - if (!ip) continue; - - - m_pT.push_back(ip->pT()); - m_eta.push_back(ip->eta()); - m_phi.push_back(ip->parameters()[Trk::phi]); - - - ATH_MSG_DEBUG( "pT " << ip->pT() << " eta " << ip->eta()); - - if (fabs(ip->pT()) < m_pT_min || fabs(ip->eta())>m_etaEdge || fabs(ip->eta())<m_etaLowEdge ) continue; - - bool gotIsoTrack = true; - - if (!m_lookForAnyTracks) - { - - for (TrackCollection::const_iterator jt = tracks->begin(); jt!=tracks->end(); ++jt) - { - - - const Trk::Perigee *jp = (*jt)->perigeeParameters(); - - - double dphi = fabs(ip->parameters()[Trk::phi] - jp->parameters()[Trk::phi]); - if(dphi>M_PI) dphi = 2*M_PI-dphi; - - double dR = sqrt(pow((ip->eta() - jp->eta()),2) + pow(dphi,2)); - m_dR.push_back(dR); - - if ((fabs(jp->pT()) > m_pT_min_iso) && (dR > m_dR0_overlap) && (dR < m_dR0 ) ) { - gotIsoTrack = false; - continue; - } - } - } - - if (gotIsoTrack){ - - count_IsoTracks += 1; - - m_ROB_eta.push_back(ip->eta()); - m_ROB_phi.push_back(ip->parameters()[Trk::phi]); - m_pT_Iso.push_back(ip->pT()); - - - double etaMIN = ip->eta() - m_etaWidth; - double etaMAX = ip->eta() + m_etaWidth; - - double phiMIN = ip->parameters()[Trk::phi] - m_phiWidth; - double phiMAX = ip->parameters()[Trk::phi] + m_phiWidth; - while (phiMIN < 0) phiMIN += 2*M_PI; - while (phiMAX > 2*M_PI) phiMAX -= 2*M_PI; - - TrigRoiDescriptor roi( ip->eta(), etaMIN, etaMAX, ip->parameters()[Trk::phi], phiMIN, phiMAX ); - - // now add ROBs - HLT::ErrorCode ec = m_robSelector->fillPEBInfo(*pebInfo, roi, &m_dets, &m_nROBs); - if (ec != HLT::OK) return ec; - - - // Add extra ROBs - for (std::vector<uint32_t>::const_iterator rob = m_extraROBs.begin(); rob != m_extraROBs.end(); rob++) - pebInfo->add(*rob); - - if(m_trigResults.size()!=0) - pebInfo->addSubDetector(m_trigResults); - - if (!m_doNotPass){ - //generate output here - //addRoI(output); - HLT::TriggerElement* te = addRoI(output); - te->setActiveState(true); - }// else - // te->setActiveState(false); - - } - } - - m_acceptedEvts++; - m_n_IsoTracks = count_IsoTracks ; - ATH_MSG_DEBUG( "Found "<< m_n_IsoTracks <<" Isolated ("<< m_lookForAnyTracks <<") Tracks" ); - } - else { - m_rejectedEvts++; - } - } - - - m_executedEvent = true; - - - afterExecMonitors().ignore(); - - return HLT::OK; -} - -HLT::ErrorCode TrigCheckForTracks::hltEndEvent() { - m_executedEvent = false; - m_robSelector->reset(); - m_dets.clear(); - m_nROBs.clear(); - m_pT.clear(); - m_pT_Iso.clear(); - m_dR.clear(); - m_eta.clear(); - m_phi.clear(); - m_ROB_eta.clear(); - m_ROB_phi.clear(); - return HLT::OK; - } - diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.h deleted file mode 100644 index 4bdc864d6ea797773a9e0376419a41dada661023..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigCheckForTracks.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrigCheckForTracks_H -#define TrigCheckForTracks_H - -///////////////////////////////////////////////////////////////////////////////////////////////////// -/// Name : TrigCheckForTracks.h -/// Package : Trigger/TrigAlgorithms/TrigDetCalib -/// Author : Nicolas Berger -/// Created : Sep. 2008 -/// -/// DESCRIPTION: simple hypo algorithms to limit eta range -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// -#include <vector> -#include <string> - -#include "TrigInterfaces/AllTEAlgo.h" -#include "TrigTimeAlgs/TrigTimerSvc.h" - -#include "TrigDetCalib/ITrigROBSelector.h" -#include "eformat/SourceIdentifier.h" - -class TriggerElement; -class PartialEventBuildingInfo; - -class TrigCheckForTracks : public HLT::AllTEAlgo { - - public: - - TrigCheckForTracks(const std::string& name, ISvcLocator* pSvcLocator); - ~TrigCheckForTracks(); - - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - HLT::ErrorCode hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& input, unsigned int output); - - - HLT::ErrorCode hltStart(); - HLT::ErrorCode hltEndEvent(); - - private: - - bool m_executedEvent ; // This will ensure we don't execute the algorithm more than once in the event. - - -ToolHandle<ITrigROBSelector> m_robSelector; - - int m_acceptedEvts; - int m_rejectedEvts; - int m_errorEvts; - - // Switch to accept all the events. - bool m_acceptAll; - - // Save HLT results - bool m_addCTPResult, m_addL2Result, m_addEFResult, m_addHLTResult; - - // Switch on Monitoring: - - int m_n_IsoTracks ; - std::vector<double> m_pT ; - std::vector<double> m_pT_Iso ; - std::vector<double> m_dR ; - std::vector<double> m_eta ; - std::vector<double> m_phi ; - std::vector<DETID> m_dets; - std::vector<int> m_nROBs; - std::vector<double> m_ROB_eta; - std::vector<double> m_ROB_phi; - - - double m_dR0 ; - double m_dR0_overlap ; - double m_pT_min ; - double m_pT_min_iso ; - double m_etaEdge ; - double m_etaLowEdge ; - double m_etaWidth ; - double m_phiWidth ; - std::string m_tracksName ; - bool m_doNotPass ; - bool m_lookForAnyTracks ; - - - std::string m_pebLabel; - - // Hardcoded extra ROBs that should be shipped in all cases - std::vector<uint32_t> m_extraROBs; - - std::vector<eformat::SubDetector> m_trigResults; - - // Timing: - ITrigTimerSvc* m_timerSvc; - std::vector<TrigTimer*> m_timers; -}; -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.cxx deleted file mode 100644 index 13d2ec17e14f65f47300f72fd45144030b6f6aed..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: TrigEtaHypo.cxx -// PACKAGE: Trigger/TrigAlgorithms/TrigDetCalib -// -// ******************************************************************** - -#include "TrigEtaHypo.h" - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" - -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include <cmath> - -//#include "CLHEP/Units/SystemOfUnits.h" - -class ISvcLocator; - - -TrigEtaHypo::TrigEtaHypo(const std::string& name, ISvcLocator* pSvcLocator): - HLT::HypoAlgo(name, pSvcLocator) -{ - declareProperty("EtaMinCut", m_etaMinCut = -1, "minimum eta value"); // Default: None - declareProperty("EtaMaxCut", m_etaMaxCut = -1, "maximum eta value"); // Default: None - declareProperty("RoILabel", m_roILabel = "initialRoI", "RoI feature label"); - declareProperty("doMonitoring", m_doMonitoring = false, "switch on/off monitoring" ); - declareProperty("AcceptAll", m_acceptAll = false); -} - - -TrigEtaHypo::~TrigEtaHypo() -{ } - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigEtaHypo::hltInitialize() -// ---------------------------------------------------------------------- -{ - msg() << MSG::INFO << "in initialize()" << endmsg; - - // Initialize timing service - //------------------------------ - if( service( "TrigTimerSvc", m_timerSvc).isFailure() ) { - msg() << MSG::WARNING << name() - << ": Unable to locate TrigTimer Service" << endmsg; - } - if (m_timerSvc) - m_timers.push_back(m_timerSvc->addItem("TrigEtaHypo.TrigEtaHypoTot")); - - m_acceptedEvts = 0; - m_rejectedEvts = 0; - m_errorEvts = 0; - - return HLT::OK; -} - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigEtaHypo::hltFinalize(){ -// ---------------------------------------------------------------------- - - msg() << MSG::INFO << "in finalize()" << endmsg; - msg() << MSG::INFO << "Events accepted/rejected/errors: "<< m_acceptedEvts <<" / "<< m_rejectedEvts << " / "<< m_errorEvts << endmsg; - return HLT::OK; -} - - -// ---------------------------------------------------------------------- -HLT::ErrorCode TrigEtaHypo::hltExecute(const HLT::TriggerElement* outputTE, bool& pass) { -// ---------------------------------------------------------------------- - - // Time total TrigL2JetHypo execution time. - if (m_timerSvc) m_timers[0]->start(); - - pass = false; - - // get the trigger element and extract the RoI information - - const TrigRoiDescriptor* roiDescriptor = 0; - if (getFeature(outputTE, roiDescriptor, m_roILabel) == HLT::OK && roiDescriptor) { - if (msgLvl() <= MSG::DEBUG) - msg() << MSG::DEBUG << "REGTEST: RoI id " << roiDescriptor->roiId() - << " located at phi = " << roiDescriptor->phi() << ", eta = " << roiDescriptor->eta() << endmsg; - else - msg() << MSG::DEBUG << "Failed to find RoiDescriptor " << endmsg; - - if ((m_etaMinCut < 0 || std::fabs(roiDescriptor->eta()) > m_etaMinCut) && - (m_etaMaxCut < 0 || std::fabs(roiDescriptor->eta()) < m_etaMaxCut)) { - pass = true; - m_acceptedEvts++; - } - else - m_rejectedEvts++; - } - else - m_errorEvts++; - - if (m_timerSvc) m_timers[0]->stop(); - return HLT::OK; -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.h deleted file mode 100644 index 68f9e60d6ee7e0bf6c07f58f6b1505f2b7cecafc..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigEtaHypo.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrigEtaHypo_H -#define TrigEtaHypo_H - -///////////////////////////////////////////////////////////////////////////////////////////////////// -/// Name : TrigEtaHypo.h -/// Package : Trigger/TrigAlgorithms/TrigDetCalib -/// Author : Nicolas Berger -/// Created : Sep. 2008 -/// -/// DESCRIPTION: simple hypo algorithms to limit eta range -/// -/////////////////////////////////////////////////////////////////////////////////////////////////////// -#include <vector> -#include <string> - -#include "TrigInterfaces/HypoAlgo.h" -#include "TrigTimeAlgs/TrigTimerSvc.h" - -class TrigEtaHypo : public HLT::HypoAlgo { - - public: - - TrigEtaHypo(const std::string& name, ISvcLocator* pSvcLocator); - ~TrigEtaHypo(); - - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - HLT::ErrorCode hltExecute(const HLT::TriggerElement* outputTE, bool& pass); - - - private: - - double m_etaMinCut, m_etaMaxCut; - std::string m_roILabel; - - int m_acceptedEvts; - int m_rejectedEvts; - int m_errorEvts; - - // Switch to accept all the events. - bool m_acceptAll; - - // Switch on Monitoring: - bool m_doMonitoring; - - // Timing: - ITrigTimerSvc* m_timerSvc; - std::vector<TrigTimer*> m_timers; -}; -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.cxx deleted file mode 100644 index ca8f6da194bc1bcf632d75a3ff074645cbe5426e..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigL1CaloOverflow.h" - -#include "TrigT1Result/RoIBResult.h" -#include "xAODEventInfo/EventInfo.h" - -#include <bitset> - -// BCIDs of the abort gap -const int ABORT_GAP_START = 3446; -const int ABORT_GAP_END = 3563; - -TrigL1CaloOverflow::TrigL1CaloOverflow(const std::string& name, ISvcLocator* pSvcLocator): - HLT::AllTEAlgo(name, pSvcLocator), - m_lvl1Tool("HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool",this) -{ - declareProperty("ignoreAbortGap", m_ignoreAbortGap = true, "Ignore overflows in abort gap"); - declareProperty("acceptCMXOverflows", m_acceptCMXOverflows = true, "Accept CMX overflows"); - declareProperty("acceptCaloRoIBOverflows", m_acceptCaloRoIBOverflows = true, "Accept Calo RoIB overflows"); - declareProperty("acceptLvl1ConsistencyProblems", m_acceptLvl1Consist = true, "Accept events with problems in the Lvl1 consistency checker"); -} - -HLT::ErrorCode TrigL1CaloOverflow::hltInitialize() -{ - if (m_lvl1Tool.retrieve().isFailure()) { - ATH_MSG_ERROR("Cannot retrieve " << m_lvl1Tool); - return HLT::BAD_JOB_SETUP; - } - return HLT::OK; -} - -HLT::ErrorCode TrigL1CaloOverflow::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& /*tes_in*/, unsigned int output) -{ - beforeExecMonitors().ignore(); - - // Do nothing for events in the abort gap (tile laser causes overflows) - if (m_ignoreAbortGap) { - const xAOD::EventInfo* evt(0); - if (evtStore()->retrieve(evt).isSuccess() && - evt->bcid() >= ABORT_GAP_START && evt->bcid() <= ABORT_GAP_END) { - return HLT::OK; - } - } - - const ROIB::RoIBResult* result; - if (evtStore()->retrieve(result).isFailure()) return HLT::OK; - - // Overflows in the TOB transmission to CMX - if (m_acceptCMXOverflows) { - std::bitset<3> overflow = m_lvl1Tool->lvl1EMTauJetOverflow(*result); - if (overflow.any()) { - addRoI(output)->setActiveState(true); - ATH_MSG_DEBUG("Event was force accepted by L1Calo due to TOB overflows in CMX transmission"); - } - } - - // Overflows on the RoI link to the RoIB - if (m_acceptCaloRoIBOverflows) { - if (result->CheckEMOverflow() || result->CheckJOverflow()) { - addRoI(output)->setActiveState(true); - ATH_MSG_DEBUG("Event has overflows in the EM or JET RoI transmission to the RoIB"); - } - } - - // Events with issues in the consistency checker (not strictly overflows, see ATR-14607) - if (m_acceptLvl1Consist) { - HLT::ErrorCode ec = config()->getLvlConverterStatus(); - if ( ec.reason()==HLT::Reason::MISSING_FEATURE && - ec.steeringInternalReason()==HLT::SteeringInternalReason::MISSING_CALO_ROI ) { // see Lvl1ConsistencyChecker.cxx - addRoI(output)->setActiveState(true); - ATH_MSG_DEBUG("Event has Lvl1 consistency checker problems"); - } - } - - afterExecMonitors().ignore(); - return HLT::OK; -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.h deleted file mode 100644 index 85c42e630d0e4a6054583e80c3165bb0a3dd287d..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigL1CaloOverflow.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGDETCALIB_TRIGL1CALOOVERFLOW_H -#define TRIGDETCALIB_TRIGL1CALOOVERFLOW_H - -#include <string> -#include "TrigInterfaces/AllTEAlgo.h" -#include "TrigSteering/Lvl1ResultAccessTool.h" - -namespace HLT { - class TriggerElement; -} - -/** - * Algorithm that accepts all events with L1Calo TOB overflows - **/ - -class TrigL1CaloOverflow : public HLT::AllTEAlgo { - -public: - TrigL1CaloOverflow(const std::string& name, ISvcLocator* pSvcLocator); - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize() {return HLT::OK;} - - HLT::ErrorCode hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& input, - unsigned int output); - -private: - ToolHandle<HLT::ILvl1ResultAccessTool> m_lvl1Tool; - bool m_ignoreAbortGap; - bool m_acceptCMXOverflows; - bool m_acceptCaloRoIBOverflows; - bool m_acceptLvl1Consist; -}; - - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.cxx deleted file mode 100755 index 883dbbb81d1c73e2d31fd6d4a33b147395c1416f..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.cxx +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/PartialEventBuildingInfo.h" -#include "IRegionSelector/IRegSelSvc.h" - -#include "TrigROBListWriter.h" - -TrigROBListWriter::TrigROBListWriter(const std::string& name, ISvcLocator* pSvcLocator) - : HLT::FexAlgo(name, pSvcLocator), - m_robSelector("TrigROBSelector", this ), - m_addCTPResult(0), m_addL2Result(0), m_addEFResult(0), - m_nRoIs(0) -{ - declareProperty("ROBSelector", m_robSelector, "The ROB Selector Tool"); - declareProperty("AddCTPResult", m_addCTPResult, "Add the CTP result to the list of ROBs"); - declareProperty("AddL2Result", m_addL2Result, "Add the L2 result to the list of ROBs"); - declareProperty("AddEFResult", m_addEFResult, "Add the EF result to the list of ROBs"); - declareProperty("etaEdge", m_etaEdge = 5.0, "Upper limit of |eta| range"); - declareProperty("etaWidth", m_etaWidth = 0.1, "Width of the RoI in eta"); - declareProperty("phiWidth", m_phiWidth = 0.1, "Width of the RoI in phi"); - declareProperty("PEBInfoLabel", m_pebLabel = "dunno", "The label under which the PartialEventBuildingInfo object is stored"); - declareProperty("RoIDescriptorLabels", m_roILabels, "The labels used to search for RoI features"); - declareProperty("MaxRoIsPerEvent", m_maxRoIsPerEvent = -1); - declareProperty("extraROBs", m_extraROBs); - declareProperty("rejectAll", m_rejectAll = false); - - declareMonitoredStdContainer("nROBs", m_nROBs); - declareMonitoredStdContainer("detectors", m_dets); - declareMonitoredVariable("roIEta", m_roIEta); - declareMonitoredVariable("roIPhi", m_roIPhi); -} - - -HLT::ErrorCode TrigROBListWriter::hltInitialize() -{ - if (m_addCTPResult) m_trigResults.push_back(eformat::TDAQ_CTP); - if (m_addL2Result) m_trigResults.push_back(eformat::TDAQ_LVL2); - if (m_addEFResult) m_trigResults.push_back(eformat::TDAQ_EVENT_FILTER); - - return HLT::OK; -} - - -HLT::ErrorCode TrigROBListWriter::hltStart() -{ - return m_robSelector->setupMonitoring(); -} - - -HLT::ErrorCode TrigROBListWriter::hltFinalize() -{ - return HLT::OK; -} - - -HLT::ErrorCode TrigROBListWriter::hltExecute(const HLT::TriggerElement* te_in, - HLT::TriggerElement* te_out) -{ - m_nRoIs++; - msg() << MSG::DEBUG << "Executing this TrigROBListWriter " << name() << " for types " - << te_in->getId() << " -> " << te_out->getId(); - if (m_maxRoIsPerEvent > -1) msg() << " RoI " << m_nRoIs << "/" << m_maxRoIsPerEvent; - msg() << endmsg; - - if (m_maxRoIsPerEvent > -1 && m_nRoIs > m_maxRoIsPerEvent) { - msg() << MSG::DEBUG << "RoI limit (" << m_maxRoIsPerEvent - << ") reached for this event : will not process this RoI" << endmsg; - return HLT::OK; - } - - // Get RoI descriptor - const TrigRoiDescriptor* roIDescriptor = 0; - HLT::ErrorCode status = HLT::BAD_ALGO_CONFIG; - - for (std::vector<std::string>::const_iterator label = m_roILabels.begin(); - label != m_roILabels.end(); label++) { - status = getFeature(te_out, roIDescriptor, *label); - if (status == HLT::OK && roIDescriptor) break; - } - - if (status != HLT::OK || !roIDescriptor) { - msg() << MSG::ERROR << "Could not find RoI descriptor - labels checked : "; - for (std::vector<std::string>::const_iterator label = m_roILabels.begin(); - label != m_roILabels.end(); label++) - msg() << *label << " "; - msg()<< endmsg; - return status; - } - - // from dummyAlgoForCalibration - // create new partial EB directive - PartialEventBuildingInfo* pebInfo = config()->getPEBI(); - if(!pebInfo){ - msg() << MSG::DEBUG << "*** Not Executing this TrigROBListWriter " << name() << ", not a calib chain" << endmsg; - return HLT::OK; - } - /*PartialEventBuildingInfo* pebInfo = 0; - if (store()->transientContains<PartialEventBuildingInfo>(m_pebLabel)) - store()->retrieve(pebInfo, m_pebLabel).ignore(); - else { - pebInfo = new PartialEventBuildingInfo(); - store()->record(pebInfo, m_pebLabel, true).ignore(); - }*/ - - // Some monitoring - - m_roIEta = roIDescriptor->eta(); - m_roIPhi = roIDescriptor->phi(); - - // bool createRoI = false; - // if ( roIDescriptor->eta()==roIDescriptor->etaMinus() && roIDescriptor->eta()==roIDescriptor->etaPlus() && - // roIDescriptor->phi()==roIDescriptor->phiMinus() && roIDescriptor->phi()==roIDescriptor->phiPlus() ) { - - double etaMin = std::max(-m_etaEdge,roIDescriptor->eta() - m_etaWidth); - double etaMax = std::min( m_etaEdge,roIDescriptor->eta() + m_etaWidth); - - double phiMin = roIDescriptor->phi() - m_phiWidth; - double phiMax = roIDescriptor->phi() + m_phiWidth; - while (phiMin < 0) phiMin += 2*M_PI; - while (phiMax > 2*M_PI) phiMax -= 2*M_PI; // AH HA!! This is wrong! Need in the range -pi .. pi - - TrigRoiDescriptor roi( roIDescriptor->eta(), etaMin, etaMax, roIDescriptor->phi(), phiMin, phiMax ); - - // now add ROBs - HLT::ErrorCode ec = m_robSelector->fillPEBInfo(*pebInfo, roi, &m_dets, &m_nROBs); - if (ec != HLT::OK) return ec; - - // Add extra ROBs - for (std::vector<uint32_t>::const_iterator rob = m_extraROBs.begin(); rob != m_extraROBs.end(); rob++) - pebInfo->add(*rob); - - // Add trig results as specified in properties - pebInfo->addSubDetector(m_trigResults); - - if(m_rejectAll) // Flag used for commissioning - te_out->setActiveState(false); - else - te_out->setActiveState(true); - return HLT::OK; -} - - -HLT::ErrorCode TrigROBListWriter::hltEndEvent() -{ - m_robSelector->reset(); - m_dets.clear(); - m_nROBs.clear(); - m_nRoIs = 0; - return HLT::OK; -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.h deleted file mode 100755 index 0041c3eae821221391911eb910edda7f70fab513..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBListWriter.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @Project: LAr Calibration - * @Package: TrigEgammaHypo - * @class : TrigROBListWriter - * - * @brief : Algorithm to write out a list of LAr ROBs for its input RoI - * - * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN - * - * File and Version Information: - * $Id: TrigROBListWriter.h 707504 2015-11-12 16:33:46Z fwinkl $ - **********************************************************************************/ - -#ifndef TrigEgammaHypo_TrigROBListWriter_H -#define TrigEgammaHypo_TrigROBListWriter_H - -#include "TrigInterfaces/FexAlgo.h" - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include <vector> -#include <string> - -#include "IRegionSelector/RegSelEnums.h" -#include "GaudiKernel/ITHistSvc.h" -#include "TrigDetCalib/ITrigROBSelector.h" - -#include "eformat/SourceIdentifier.h" - -class IRegSelSvc; -class MsgStream; -class PartialEventBuildingInfo; -class TH1I; - -namespace HLT { - class TriggerElement; -} - -/** - @class TrigROBListWriter - Algorithm to write out a list of LAr ROBs for its input RoI - @author Nicolas Berger <Nicolas.Berger@cern.ch> -*/ -class TrigROBListWriter : public HLT::FexAlgo -{ - public: - - TrigROBListWriter(const std::string& name, ISvcLocator* pSvcLocator); //!< std Gaudi algorthm constructor - - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - - /** @brief take one input TriggerElement and process it - It tries to retrieve any attached TrigRoIDescriptor features and prints them. - @param input TriggerElement to be processed - @param output TriggerElement coming out of the algorithm - */ - HLT::ErrorCode hltExecute(const HLT::TriggerElement* input, - HLT::TriggerElement* output); - - HLT::ErrorCode hltStart(); - - HLT::ErrorCode hltEndEvent(); - - - - private: - - ToolHandle<ITrigROBSelector> m_robSelector; - bool m_addCTPResult, m_addL2Result, m_addEFResult; - - double m_etaEdge, m_etaWidth, m_phiWidth; - - std::string m_pebLabel; - std::vector<std::string> m_roILabels; - - int m_maxRoIsPerEvent, m_nRoIs; - - // Hardcoded extra ROBs that should be shipped in all cases - std::vector<uint32_t> m_extraROBs; - - // Monitored variables - std::vector<DETID> m_dets; - std::vector<eformat::SubDetector> m_trigResults; - std::vector<int> m_nROBs; - double m_roIEta, m_roIPhi; - - bool m_rejectAll; -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.cxx deleted file mode 100644 index 558f271ee89289553d0959b88da2a66479683ffc..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "CxxUtils/phihelper.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/PartialEventBuildingInfo.h" -#include "IRegionSelector/IRegSelSvc.h" -#include "TrigInterfaces/IMonitoredAlgo.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "GaudiKernel/Algorithm.h" - -#include "TrigROBSelector.h" -#include "TH1.h" - -TrigROBSelector::TrigROBSelector(const std::string& type, const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_regionSelector("RegSelSvc/RegSelSvc", name), - m_tHistSvc("THistSvc/THistSvc", name) -{ - declareInterface<ITrigROBSelector>( this ); - - declareProperty("etaMinMon", m_etaMinMon = -4.8, "lower edge of eta range for monitoring"); - declareProperty("etaMaxMon", m_etaMaxMon = 4.8, "upper edge of eta range for monitoring"); - declareProperty("phiMinMon", m_phiMinMon = -M_PI, "lower edge of phi range for monitoring"); - declareProperty("phiMaxMon", m_phiMaxMon = M_PI, "upper edge of phi range for monitoring"); - declareProperty("Subdetectors", m_detSpec = "All", "Subdetectors to include in readout"); - declareProperty("MonitoringHistoPath", m_outputPath = "", "Path to monitoring histograms"); - - //std::string::size_type index; - //std::string newName = name; - //while ((index = newName.find(".")) != std::string::npos) newName.replace(index, 1, "_"); - - m_detNames[PIXEL] = "PIXEL"; - m_detNames[SCT] = "SCT"; - m_detNames[TRT] = "TRT"; - m_detNames[TTEM] = "TTEM"; - m_detNames[TTHEC] = "TTHEC"; - m_detNames[TILE] = "TILE"; - m_detNames[FCALEM] = "FCALEM"; - m_detNames[FCALHAD] = "FCALHAD"; - m_detNames[MDT] = "MDT"; - m_detNames[RPC] = "RPC"; - m_detNames[TGC] = "TGC"; - /* on April 19, 2018, these subdetectors were not included by default, so do not change this - m_detNames[LAR] = "LAR"; - m_detNames[FTK] = "FTK"; - */ - m_detNames[CSC] = "CSC"; // included since April 19, 2018, small size -} - - -StatusCode TrigROBSelector::initialize() -{ - const IMonitoredAlgo* parentMon = dynamic_cast<const IMonitoredAlgo*>(parent()); - if (!parentMon) { - ATH_MSG_WARNING("Attached to algorithm which is not of type IMonitoredAlgo"); - return StatusCode::FAILURE; - } - const Algorithm* parentAlg = dynamic_cast<const Algorithm*>(parent()); - if (!parentAlg) { - ATH_MSG_WARNING("Attached to algorithm which is not of type Algorithm"); - return StatusCode::FAILURE; - } - std::string parentName = parentAlg->name(); - - if (m_outputPath == "") m_outputPath = "/EXPERT/" + parentName + "/"; - - - // The RegionSelector is being retrieved here - StatusCode sc = StatusCode::SUCCESS; - - sc = m_regionSelector.retrieve(); - if (sc.isFailure()) { - ATH_MSG_FATAL("Unable to retrieve RegionSelector Service"); - return sc; - } - - sc = m_tHistSvc.retrieve(); - if (sc.isFailure()) { - ATH_MSG_ERROR("Unable to retrieve pointer to THistSvc"); - return sc; - } - - std::map<DETID, bool> isIncluded; - - // Look for some groups: - if (m_detSpec.find("ID") != std::string::npos) - isIncluded[PIXEL] = isIncluded[SCT] = isIncluded[TRT] = true; - - if (m_detSpec.find("LAr") != std::string::npos) { - isIncluded[TTEM] = isIncluded[TTHEC] = true; - isIncluded[FCALEM] = isIncluded[FCALHAD] = true; - } - - if (m_detSpec.find("Muons") != std::string::npos) - isIncluded[MDT] = isIncluded[RPC] = isIncluded[TGC] = isIncluded[CSC] = true; - - if (m_detSpec.find("EM") != std::string::npos) - isIncluded[TTEM] = isIncluded[FCALEM] = true; - - if (m_detSpec.find("Had") != std::string::npos) - isIncluded[TTHEC] = isIncluded[TILE] = isIncluded[FCALHAD] = true; - - if (m_detSpec.find("All") != std::string::npos) { - for (std::map<DETID,std::string>::const_iterator name = m_detNames.begin(); - name != m_detNames.end(); name++) - isIncluded[name->first] = true; - } - - m_detectors.clear(); - - // Look for the registered detector names and fill the detector mask. - for (std::map<DETID,std::string>::const_iterator name = m_detNames.begin(); - name != m_detNames.end(); name++) { - if (m_detSpec.find(name->second) != std::string::npos) - isIncluded[name->first] = true; - if (isIncluded[name->first]) m_detectors.push_back(name->first); - } - - msg() << MSG::DEBUG << "Selected subdetectors = "; - for (std::vector<DETID>::const_iterator det = m_detectors.begin(); - det != m_detectors.end(); det++) { - msg() << MSG::DEBUG << *det << " " << endmsg; - } - msg() << endmsg; - - return sc; -} - - -StatusCode TrigROBSelector::finalize() -{ - return StatusCode::SUCCESS; -} - - -HLT::ErrorCode TrigROBSelector::fillPEBInfo(PartialEventBuildingInfo& pebInfo, - const IRoiDescriptor& roi, - std::vector<DETID>* dets, std::vector<int>* nRobs) -{ - std::vector<uint32_t> allROBs; - - for (std::vector<DETID>::const_iterator detector = m_detectors.begin(); - detector != m_detectors.end(); detector++) - { - std::vector<uint32_t> detectorROBs; - m_regionSelector->DetROBIDListUint(*detector, roi, detectorROBs); - - allROBs.insert(allROBs.end(), detectorROBs.begin(), detectorROBs.end()); - msg() << MSG::DEBUG << "ROBs requested for detector " << *detector << " : "; - - for (unsigned int i = 0; i < detectorROBs.size(); i++) msg() << MSG::DEBUG << "0x" << std::hex << detectorROBs[i] << std::dec << " "; - msg() << endmsg; - - if (dets) (*dets).push_back(*detector); - if (nRobs) (*nRobs).push_back(detectorROBs.size()); - - TH1I*& robHist = m_robHists[*detector]; - if (!robHist) { - ATH_MSG_DEBUG("Monitoring of detector " << *detector << " not implemented yet."); - continue; - } - - for (unsigned int i=0; i<detectorROBs.size(); i++) - robHist->Fill(m_robIdMap[detectorROBs[i]]); - } - - for (std::vector<uint32_t>::const_iterator rob = allROBs.begin(); rob != allROBs.end(); rob++) - pebInfo.add(*rob); - - return HLT::OK; -} - - -bool TrigROBSelector::reset() -{ - return true; -} - - -HLT::ErrorCode TrigROBSelector::setupMonitoring() -{ - ATH_MSG_INFO("in setupMonitoring() "); - - for (std::vector<DETID>::const_iterator det = m_detectors.begin(); - det != m_detectors.end(); det++) { - std::vector<uint32_t> range; - - double eta = 0.5*(m_etaMinMon+m_etaMaxMon); - double phi = CxxUtils::phiBisect(m_phiMinMon, m_phiMaxMon); - TrigRoiDescriptor roi( eta, m_etaMinMon, m_etaMaxMon, phi, m_phiMinMon, m_phiMaxMon ); - m_regionSelector->DetROBIDListUint(*det, roi, range ); - ATH_MSG_DEBUG("Range for detId = " << *det << " = " << range.size()); - m_ranges[*det] = range; - - int bin = 0; - for (std::vector<uint32_t>::const_iterator robId = range.begin(); - robId != range.end(); ++robId, ++bin) - m_robIdMap[*robId] = bin; - } - - // Now setup all the histograms - HLT::ErrorCode ec = bookMonitoringHistograms(); - if (ec != HLT::OK) return ec; - - for (std::vector<DETID>::const_iterator det = m_detectors.begin(); - det != m_detectors.end(); det++) { - - std::stringstream ss; - std::string label; - const std::vector<uint32_t>& range = m_ranges[*det]; - TH1I*& hist = m_robHists[*det]; - if (!hist) continue; - - for (unsigned int j = 0; j < range.size(); j++) { - ss << std::hex << "0x" << range[j] << std::dec; - ss >> label; - hist->GetXaxis()->SetBinLabel(j+1, label.c_str()); - } - } - - ATH_MSG_INFO("done setupMonitoring() "); - return HLT::OK; -} - - -HLT::ErrorCode TrigROBSelector::bookMonitoringHistograms() -{ - ATH_MSG_DEBUG("Going to book and register monitoring histograms"); - - for (std::vector<DETID>::const_iterator det = m_detectors.begin(); - det != m_detectors.end(); det++) { - - // temporarily disable these histograms - // since the following errors occured - // TTHEC and TTEM can't be summed (nbins 0) - // in the other histograms all bins have the same axis labels - m_robHists[*det] = 0; continue; - - - if (*det == MDT || *det == RPC || *det == TGC || *det == CSC) { m_robHists[*det] = 0; continue; } // Not implemented yet - TH1I* h = bookAndRegisterTH1I("RobId" + m_detNames[*det], m_outputPath, m_ranges[*det].size(), 0, m_ranges[*det].size()); - - if (!h) return HLT::BAD_JOB_SETUP; - m_robHists[*det] = h; - } - - ATH_MSG_DEBUG("done : book and register monitoring histograms"); - - return HLT::OK; -} - - -TH1I* TrigROBSelector::bookAndRegisterTH1I(std::string name, std::string outpath, int nBins, int minX, int maxX) -{ - // Say hello - ATH_MSG_DEBUG("Now trying to register histogram: " << name << " (TH1I)"); - TH1I* h = new TH1I(name.c_str(), name.c_str(), nBins, minX, maxX); - if (m_tHistSvc->regHist(outpath + h->GetName(), h).isFailure()) { - ATH_MSG_WARNING("Can't book " << outpath + h->GetName()); - return 0; - } - ATH_MSG_DEBUG("done : register histograms"); - return h; -} - - -StatusCode TrigROBSelector::queryInterface( const InterfaceID& riid, - void** ppvIf ) -{ - if ( riid == ITrigROBSelector::interfaceID() ) { - *ppvIf = (ITrigROBSelector*)this; - addRef(); - return StatusCode::SUCCESS; - } - - return AthAlgTool::queryInterface( riid, ppvIf ); -} diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.h deleted file mode 100644 index a884a8bc72350c278555323a9d2b141c9637c928..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigROBSelector.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @Project: LAr Calibration - * @Package: TrigDetCalib - * @class : TrigROBSelector - * - * @brief : Tool to select a list of ROBs for a given (eta,phi) region and subdetector set - * - * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN - * - * File and Version Information: - * $Id: TrigROBSelector.h 707504 2015-11-12 16:33:46Z fwinkl $ - **********************************************************************************/ - -#ifndef TrigEgammaHypo_TrigROBSelector_H -#define TrigEgammaHypo_TrigROBSelector_H - -#include "TrigDetCalib/ITrigROBSelector.h" - -#include <vector> -#include <string> -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ITHistSvc.h" -#include "IRegionSelector/RegSelEnums.h" -#include "IRegionSelector/IRegSelSvc.h" - -class MsgStream; -class PartialEventBuildingInfo; -class TH1I; - -namespace HLT { - class TriggerElement; -} - -/** - @class TrigROBSelector - Tool to select a list of ROBs for a given (eta,phi) region and subdetector set - @author Nicolas Berger <Nicolas.Berger@cern.ch> - */ - - -class TrigROBSelector : public AthAlgTool, public virtual ITrigROBSelector -{ - public: - - TrigROBSelector(const std::string& type, const std::string& name, - const IInterface* parent = 0); - - StatusCode initialize(); - StatusCode finalize(); - - HLT::ErrorCode fillPEBInfo(PartialEventBuildingInfo& pebInfo, - const IRoiDescriptor& roi, - std::vector<DETID>* dets = 0, std::vector<int>* nRobs = 0); - - HLT::ErrorCode setupMonitoring(); - HLT::ErrorCode bookMonitoringHistograms(); - TH1I* bookAndRegisterTH1I(std::string name, std::string outpath, int nBins, int minX, int maxX); - - bool reset(); - - StatusCode queryInterface( const InterfaceID& riid, void** ppvIf ); //!< Gaudi interface method - static const InterfaceID& interfaceID() { return ITrigROBSelector::interfaceID(); } //!< Gaudi interface method - - private: - - ServiceHandle<IRegSelSvc> m_regionSelector; - ServiceHandle<ITHistSvc> m_tHistSvc; - - double m_etaMaxMon, m_etaMinMon, m_phiMinMon, m_phiMaxMon; - - std::string m_detSpec; - std::vector<DETID> m_detectors; - - // Monitoring - std::string m_outputPath; - std::map<uint32_t, int> m_robIdMap; - std::map < DETID, std::vector<uint32_t> > m_ranges; - std::map < DETID, std::string > m_detNames; - std::map < DETID, TH1I * > m_robHists; -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.cxx deleted file mode 100755 index 2fb7df717be99dda035599ef3e61e33ffdbc59c7..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.cxx +++ /dev/null @@ -1,707 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigSteeringEvent/TrigRoiDescriptor.h" -#include "TrigSteeringEvent/PartialEventBuildingInfo.h" -#include "IRegionSelector/IRegSelSvc.h" - -#include "TrigSubDetListWriter.h" -#include "GaudiKernel/IJobOptionsSvc.h" - - -//using namespace eformat; - -TrigSubDetListWriter::TrigSubDetListWriter(const std::string& name, ISvcLocator* pSvcLocator) - //: HLT::FexAlgo(name, pSvcLocator), - : HLT::AllTEAlgo(name, pSvcLocator), - m_regionSelector("RegSelSvc/RegSelSvc", "TrigSubDetListWriter"), - m_detectors(0), - m_sourceid(0), - m_addL1Calo(false), - m_useCachedResult(false), - m_nRoIs(0), - m_rejectAll(false) -{ - declareProperty("PEBInfoLabel", m_pebLabel = "dunno", "The label under which the PartialEventBuildingInfo object is stored"); - //declareProperty("Subdetectors", m_detSpec = "All"); - declareProperty("Subdetectors", m_detSpec); // <--- obsolote, use SubdetId instead - declareProperty("SubdetId", m_detId); - declareProperty("MaxRoIsPerEvent", m_maxRoIsPerEvent = -1); - declareProperty("MonitoringHistoPath", m_outputpath = "/EXPERT/"+name+"/"); -// the tile calibration needs an special ROB: - declareProperty("extraROBs", m_extrarobs); - declareProperty("addL1Calo", m_addL1Calo); - declareProperty("rejectAll", m_rejectAll); -} - - -HLT::ErrorCode TrigSubDetListWriter::hltInitialize() -{ - ServiceHandle<IJobOptionsSvc> p_jobOptionsSvc("JobOptionsSvc", name()); - if ((p_jobOptionsSvc.retrieve()).isFailure()) { - msg() << MSG::WARNING << "Could not find JobOptionsSvc to set DataFlow properties" << endmsg; - } else { - // get the list of enabled ROBs from OKS - const Property* pprob=Gaudi::Utils::getProperty( p_jobOptionsSvc->getProperties("DataFlowConfig"), "DF_Enabled_ROB_IDs"); - if (pprob != 0) { - if (m_enabledROBs.assign(*pprob)) { - //robOKSconfigFound = true; - msg() << MSG::DEBUG << " ---> Read from DataFlow configuration: " << m_enabledROBs.value().size() - << " enabled ROB IDs." << endmsg; - } else { - msg() << MSG::WARNING << "Could not set Property '" << pprob->name() << "' from DataFlow." << endmsg; - } - } - // get the list of enabled Sub Detectors from OKS - const Property* ppsd=Gaudi::Utils::getProperty( p_jobOptionsSvc->getProperties("DataFlowConfig"), "DF_Enabled_SubDet_IDs"); - if (ppsd != 0) { - if (m_enabledSubDetectors.assign(*ppsd)) { - //subDetOKSconfigFound = true; - msg() << MSG::DEBUG << " ---> Read from DataFlow configuration: " << m_enabledSubDetectors.value().size() - << " enabled Sub Detector IDs." << endmsg; - } else { - msg() << MSG::WARNING << "Could not set Property '" << ppsd->name() << "' from DataFlow." << endmsg; - } - } - } - - // The RegionSelector is being retrieved here - if( (m_regionSelector.retrieve()).isFailure() ) { - msg() << MSG::FATAL << "Unable to retrieve RegionSelector Service" << endmsg; - return HLT::TOOL_FAILURE; - } - - bool do_Pixel = false,do_SCT = false, do_TRT = false, - do_TTEM = false, do_TTHEC = false, do_Tile = false, - do_FCalEM = false,do_FCalHad = false, - do_MDT = false, do_RPC = false, do_TGC = false; - - for(std::vector<std::string>::iterator detit = m_detId.begin(); detit != m_detId.end(); ++detit){ - //if (m_detSpec.find("HLTResult") != std::string::npos) { - if (*detit=="RPC") { - m_sourceid.push_back(eformat::MUON_RPC_BARREL_A_SIDE); - m_sourceid.push_back(eformat::MUON_RPC_BARREL_C_SIDE); - } else if (*detit=="HLTResult") { - m_sourceid.push_back(eformat::TDAQ_HLT); - m_sourceid.push_back(eformat::TDAQ_CTP); - } else if (*detit=="TDAQ_HLT") { - m_sourceid.push_back(eformat::TDAQ_HLT); - } else if (*detit=="L2EFResult") { - m_sourceid.push_back(eformat::TDAQ_LVL2); - m_sourceid.push_back(eformat::TDAQ_EVENT_FILTER); - m_sourceid.push_back(eformat::TDAQ_CTP); - } else if (*detit=="TDAQ_LVL2") { - m_sourceid.push_back(eformat::TDAQ_LVL2); - } else if (*detit=="TDAQ_EVENT_FILTER") { - m_sourceid.push_back(eformat::TDAQ_EVENT_FILTER); - } else if (*detit=="TDAQ_CTP") { - m_sourceid.push_back(eformat::TDAQ_CTP); - } else if (*detit=="TDAQ_SFI") { - m_sourceid.push_back(eformat::TDAQ_SFI); - } else if (*detit=="TDAQ_SFO") { - m_sourceid.push_back(eformat::TDAQ_SFO); - } else if (*detit=="TDAQ_CALO" || *detit=="TDAQ_L1CALO") { - m_sourceid.push_back(eformat::TDAQ_CALO_PREPROC); - m_sourceid.push_back(eformat::TDAQ_CALO_CLUSTER_PROC_DAQ); - m_sourceid.push_back(eformat::TDAQ_CALO_CLUSTER_PROC_ROI); - m_sourceid.push_back(eformat::TDAQ_CALO_JET_PROC_DAQ); - m_sourceid.push_back(eformat::TDAQ_CALO_JET_PROC_ROI); - } else if (*detit=="TDAQ_MUON") { - m_sourceid.push_back(eformat::TDAQ_MUON_CTP_INTERFACE); - } else if (*detit=="TDAQ_BEAM_CRATE") { - m_sourceid.push_back(eformat::TDAQ_BEAM_CRATE); - } else if (*detit=="TDAQ_L2SV") { - m_sourceid.push_back(eformat::TDAQ_L2SV); - } else if (*detit=="InnerDetector") { - m_sourceid.push_back(eformat::PIXEL_IBL); - m_sourceid.push_back(eformat::PIXEL_BARREL); - m_sourceid.push_back(eformat::PIXEL_DISK); - m_sourceid.push_back(eformat::PIXEL_B_LAYER); - m_sourceid.push_back(eformat::SCT_BARREL_A_SIDE); - m_sourceid.push_back(eformat::SCT_BARREL_C_SIDE); - m_sourceid.push_back(eformat::SCT_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::SCT_ENDCAP_C_SIDE); - m_sourceid.push_back(eformat::TRT_ANCILLARY_CRATE); - m_sourceid.push_back(eformat::TRT_BARREL_A_SIDE); - m_sourceid.push_back(eformat::TRT_BARREL_C_SIDE); - m_sourceid.push_back(eformat::TRT_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::TRT_ENDCAP_C_SIDE); - } else if (*detit=="SiOnly") { - m_sourceid.push_back(eformat::PIXEL_IBL); - m_sourceid.push_back(eformat::PIXEL_BARREL); - m_sourceid.push_back(eformat::PIXEL_DISK); - m_sourceid.push_back(eformat::PIXEL_B_LAYER); - m_sourceid.push_back(eformat::SCT_BARREL_A_SIDE); - m_sourceid.push_back(eformat::SCT_BARREL_C_SIDE); - m_sourceid.push_back(eformat::SCT_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::SCT_ENDCAP_C_SIDE); - } else if (*detit=="DBM") { - m_sourceid.push_back(eformat::PIXEL_DBM); - } else if (*detit=="IBL") { - m_sourceid.push_back(eformat::PIXEL_IBL); - } else if (*detit=="Pixel") { - m_sourceid.push_back(eformat::PIXEL_IBL); - m_sourceid.push_back(eformat::PIXEL_BARREL); - m_sourceid.push_back(eformat::PIXEL_DISK); - m_sourceid.push_back(eformat::PIXEL_B_LAYER); - } else if (*detit=="Muons") { - m_sourceid.push_back(eformat::MUON_ANCILLARY_CRATE); - m_sourceid.push_back(eformat::MUON_MDT_BARREL_A_SIDE); - m_sourceid.push_back(eformat::MUON_MDT_BARREL_C_SIDE); - m_sourceid.push_back(eformat::MUON_MDT_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::MUON_MDT_ENDCAP_C_SIDE); - m_sourceid.push_back(eformat::MUON_RPC_BARREL_A_SIDE); - m_sourceid.push_back(eformat::MUON_RPC_BARREL_C_SIDE); - m_sourceid.push_back(eformat::MUON_TGC_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::MUON_TGC_ENDCAP_C_SIDE); - m_sourceid.push_back(eformat::MUON_CSC_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::MUON_CSC_ENDCAP_C_SIDE); - m_sourceid.push_back(eformat::TDAQ_MUON_CTP_INTERFACE); - } else if (*detit=="CSC") { - m_sourceid.push_back(eformat::MUON_CSC_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::MUON_CSC_ENDCAP_C_SIDE); - } else if (*detit=="Tile") { - m_sourceid.push_back(eformat::TILECAL_LASER_CRATE); - m_sourceid.push_back(eformat::TILECAL_BARREL_A_SIDE); - m_sourceid.push_back(eformat::TILECAL_BARREL_C_SIDE); - m_sourceid.push_back(eformat::TILECAL_EXT_A_SIDE); - m_sourceid.push_back(eformat::TILECAL_EXT_C_SIDE); - } else if (*detit=="LAr") { - m_sourceid.push_back(eformat::LAR_EM_BARREL_A_SIDE); - m_sourceid.push_back(eformat::LAR_EM_BARREL_C_SIDE); - m_sourceid.push_back(eformat::LAR_EM_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::LAR_EM_ENDCAP_C_SIDE); - m_sourceid.push_back(eformat::LAR_FCAL_A_SIDE); - m_sourceid.push_back(eformat::LAR_FCAL_C_SIDE); - m_sourceid.push_back(eformat::LAR_HAD_ENDCAP_A_SIDE); - m_sourceid.push_back(eformat::LAR_HAD_ENDCAP_C_SIDE); - } else if (*detit=="FCal") { - m_sourceid.push_back(eformat::LAR_FCAL_A_SIDE); - m_sourceid.push_back(eformat::LAR_FCAL_C_SIDE); - } else if (*detit=="FORWARD_BCM") { - m_sourceid.push_back(eformat::FORWARD_BCM); - } else if (*detit=="FORWARD_LUCID") { - m_sourceid.push_back(eformat::FORWARD_LUCID); - } else if (*detit=="FORWARD_ZDC") { - m_sourceid.push_back(eformat::FORWARD_ZDC); - } else if (*detit=="FORWARD_ALPHA") { - m_sourceid.push_back(eformat::FORWARD_ALPHA); - } else if (*detit=="FORWARD_AFP") { - m_sourceid.push_back(eformat::FORWARD_AFP); - } else { - ATH_MSG_ERROR("Unknown detector ID for partial event building:" << *detit << ". Please update TrigSubSetListWriter."); - } - - } - - if (m_detSpec.find("ID") != std::string::npos) { - do_Pixel = true; - do_SCT = true; - do_TRT = true; - } - - if (m_detSpec.find("SiOnly") != std::string::npos) { - do_Pixel = true; - do_SCT = true; - } - - if (m_detSpec.find("LAr") != std::string::npos) { - do_TTEM = true; - do_TTHEC = true; - do_FCalEM = true; - do_FCalHad = true; - } - - if (m_detSpec.find("Muons") != std::string::npos) { - do_MDT = true; - do_RPC = true; - do_TGC = true; - } - - if (m_detSpec.find("EM") != std::string::npos) { - do_TTEM = true; - do_FCalEM = true; - } - - if (m_detSpec.find("Had") != std::string::npos) { - do_TTHEC = true; - do_Tile = true; - do_FCalHad = true; - } - - if (m_detSpec.find("Tile") != std::string::npos) { - do_Tile = true; - } - - if (m_detSpec.find("All") != std::string::npos) { - do_Pixel = true; - do_SCT = true; - do_TRT = true; - do_TTEM = true; - do_TTHEC = true; - do_FCalEM = true; - do_FCalHad = true; - do_Tile = true; - do_MDT = true; - do_RPC = true; - do_TGC = true; - } - - m_detectors.clear(); - if (m_detSpec.find("Pixel") != std::string::npos) do_Pixel = true; - if (m_detSpec.find("SCT") != std::string::npos) do_SCT = true; - if (m_detSpec.find("TRT") != std::string::npos) do_TRT = true; - if (m_detSpec.find("TTEM") != std::string::npos) do_TTEM = true; - if (m_detSpec.find("TTHEC") != std::string::npos) do_TTHEC = true; - if (m_detSpec.find("Tile") != std::string::npos) do_Tile = true; - if (m_detSpec.find("FCalEM") != std::string::npos) do_FCalEM = true; - if (m_detSpec.find("FCalHad") != std::string::npos) do_FCalHad = true; - if (m_detSpec.find("MDT") != std::string::npos) do_MDT = true; - if (m_detSpec.find("RPC") != std::string::npos) do_RPC = true; - if (m_detSpec.find("TGC") != std::string::npos) do_TGC = true; - - if (do_Pixel) m_detectors.push_back(PIXEL); - if (do_SCT) m_detectors.push_back(SCT); - if (do_TRT) m_detectors.push_back(TRT); - if (do_TTEM) m_detectors.push_back(TTEM); - if (do_TTHEC) m_detectors.push_back(TTHEC); - if (do_Tile) m_detectors.push_back(TILE); - if (do_FCalEM) m_detectors.push_back(FCALEM); - if (do_FCalHad) m_detectors.push_back(FCALHAD); - if (do_MDT) m_detectors.push_back(MDT); - if (do_RPC) m_detectors.push_back(RPC); - if (do_TGC) m_detectors.push_back(TGC); - - msg() << MSG::INFO << "Selected "<< m_detectors.size() << " subdetectors = "; - for (std::vector<DETID>::const_iterator det = m_detectors.begin(); - det != m_detectors.end(); det++) msg() << *det << " "; - msg() << endmsg; - - if ( service("THistSvc", m_thistSvc).isFailure() ) { - msg() << MSG::ERROR << "Unable to retrieve pointer to THistSvc" << endmsg; - return HLT::BAD_JOB_SETUP; - } - - return HLT::OK; -} - -HLT::ErrorCode TrigSubDetListWriter::hltStart() -{ - TrigRoiDescriptor roi(true); /// create a fullscan RoI - - m_ttemrange.clear(); - m_tthecrange.clear(); - m_fcalrange.clear(); - m_fcalemrange.clear(); - m_tilerange.clear(); - m_pixrange.clear(); - m_sctrange.clear(); - m_trtrange.clear(); - m_regionSelector->DetROBIDListUint(TTEM, roi, m_ttemrange); - m_regionSelector->DetROBIDListUint(TTHEC, roi, m_tthecrange); - m_regionSelector->DetROBIDListUint(FCALHAD, roi, m_fcalrange); - m_regionSelector->DetROBIDListUint(FCALEM, roi, m_fcalemrange); - m_fcalrange.insert(m_fcalrange.end(),m_fcalemrange.begin(),m_fcalemrange.end()); - // Tile uses a different phi convention - m_regionSelector->DetROBIDListUint(TILE, roi, m_tilerange); - m_regionSelector->DetROBIDListUint(PIXEL, roi, m_pixrange); - m_regionSelector->DetROBIDListUint(SCT, roi, m_sctrange); - m_regionSelector->DetROBIDListUint(TRT, roi, m_trtrange); - - for(std::vector<uint32_t>::iterator it = m_fcalrange.begin(); - it != m_fcalrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_fcalrange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_ttemrange.begin(); - it != m_ttemrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_ttemrange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_tthecrange.begin(); - it != m_tthecrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_tthecrange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_tilerange.begin(); - it != m_tilerange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_tilerange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_sctrange.begin(); - it != m_sctrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_sctrange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_trtrange.begin(); - it != m_trtrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_trtrange.erase(it)-1; - } - - for(std::vector<uint32_t>::iterator it = m_pixrange.begin(); - it != m_pixrange.end(); it++) { - if (!isRobEnabled( *it ) ) it = m_pixrange.erase(it)-1; - } - -// Prepare for Histograms - int bin=0; - for(std::vector<uint32_t>::const_iterator it=m_ttemrange.begin();it!=m_ttemrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_tthecrange.begin();it!=m_tthecrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_fcalrange.begin();it!=m_fcalrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_tilerange.begin();it!=m_tilerange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_sctrange.begin();it!=m_sctrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_trtrange.begin();it!=m_trtrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - bin=0; - for(std::vector<uint32_t>::const_iterator it=m_pixrange.begin();it!=m_pixrange.end();++it){ - m_robidmap[*it] = bin; - bin++; - } - - /// Now setup all the histograms! - if ( this->bookMonitoringHistograms().isFailure() ) { - msg() << MSG::WARNING << "Histogram booking error. Issuing HLT::BAD_JOB_SETUP" << endmsg; - return HLT::BAD_JOB_SETUP; - } - -/* std::stringstream ss; - std::string label; - for(unsigned int j=0; j<m_ttemrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_ttemrange[j] << std::dec; - ss >> label; - m_httemrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_tthecrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_tthecrange[j] << std::dec; - ss >> label; - m_htthecrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_fcalrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_fcalrange[j] << std::dec; - ss >> label; - m_hfcalrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_tilerange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_tilerange[j] << std::dec; - ss >> label; - m_htilerob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_trtrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_trtrange[j] << std::dec; - ss >> label; - m_htrtrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_sctrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_sctrange[j] << std::dec; - ss >> label; - m_hsctrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_pixrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_pixrange[j] << std::dec; - ss >> label; - m_hpixrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - } - - for(unsigned int j=0; j<m_ttemrange.size(); j++){ - ss.clear(); - ss << std::hex << "0x" << m_ttemrange[j] << std::dec; - ss >> label; - m_httemrob->GetXaxis()->SetBinLabel(j+1,label.c_str()); - }*/ - - return HLT::OK; - -} - -StatusCode TrigSubDetListWriter::bookMonitoringHistograms() -{ - /// Say hello - if (msgLvl()<=MSG::DEBUG) msg() << MSG::DEBUG << "Now trying to register standard monitoring histograms" << endmsg; - /*m_httemrob = bookAndRegisterTH1I("RobIdTTEM", m_outputpath,m_ttemrange.size() ,0,m_ttemrange.size() ); - m_htthecrob = bookAndRegisterTH1I("RobIdTTHEC", m_outputpath,m_tthecrange.size() ,0,m_tthecrange.size() ); - m_hfcalrob = bookAndRegisterTH1I("RobIdFcal", m_outputpath,m_fcalrange.size() ,0,m_fcalrange.size() ); - m_htilerob = bookAndRegisterTH1I("RobIdTile", m_outputpath,m_tilerange.size() ,0,m_tilerange.size() ); - m_htrtrob = bookAndRegisterTH1I("RobIdTRT", m_outputpath,m_trtrange.size() ,0,m_trtrange.size() ); - m_hsctrob = bookAndRegisterTH1I("RobIdSCT", m_outputpath,m_sctrange.size() ,0,m_sctrange.size() ); - m_hpixrob = bookAndRegisterTH1I("RobIdPixel", m_outputpath,m_pixrange.size() ,0,m_pixrange.size() );*/ - - return StatusCode::SUCCESS; -} - - -HLT::ErrorCode TrigSubDetListWriter::hltFinalize() -{ - return HLT::OK; -} - - -HLT::ErrorCode TrigSubDetListWriter::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& /*te_in*/, - unsigned int te_out) -{ - - if (m_useCachedResult) { - if (msgLvl() <= MSG::DEBUG) { - msg() << MSG::DEBUG << "Executing this Partial event " << name() << " in cached mode" << endmsg; - } - } - - m_nRoIs++; - - -/* HLT::TEVec allTEs; - for (std::vector<HLT::TEVec>::const_iterator it = te_in.begin(); - it != te_in.end(); ++it) { - - for (HLT::TEVec::const_iterator inner_it = (*it).begin(); - inner_it != (*it).end(); ++inner_it) { - - allTEs.push_back(*inner_it); -// msg() << MSG::DEBUG << "Executing this TrigSubDetListWriter " << name() << " for types " -// << inner_it->getId(); - } - }*/ - - - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "Executing this TrigSubDetListWriter " << name() << endmsg; - if (m_maxRoIsPerEvent > -1) msg() << " RoI " << m_nRoIs << "/" << m_maxRoIsPerEvent; - msg() << endmsg; - } - - if (m_maxRoIsPerEvent > -1 && m_nRoIs > m_maxRoIsPerEvent) { - ATH_MSG_DEBUG("RoI limit (" << m_maxRoIsPerEvent - << ") reached for this event : will not process this RoI"); - return HLT::OK; - } - - -// Get RoI descriptor - TrigRoiDescriptor* roIDescriptor = 0; - - HLT::ErrorCode status = HLT::BAD_ALGO_CONFIG; - - // from dummyAlgoForCalibration - // create new partial EB directive - PartialEventBuildingInfo* pebInfo = config()->getPEBI(); - if(!pebInfo){ - msg() << MSG::DEBUG << "*** Not Executing this TrigSubDetListWriter " << name() << ", not a calib chain" << endmsg; - return HLT::OK; - } - /*PartialEventBuildingInfo* pebInfo = 0; - if (store()->transientContains<PartialEventBuildingInfo>(m_pebLabel)) - store()->retrieve(pebInfo, m_pebLabel).ignore(); - else { - pebInfo = new PartialEventBuildingInfo(); - store()->record(pebInfo, m_pebLabel, true).ignore(); - }*/ - - // now add ROBs - status = fillPEBInfo(*pebInfo); - if(status!=HLT::OK){ - msg() << MSG::DEBUG << "No ROB info for partial event building" << endmsg; - return status; - } - HLT::TriggerElement* te = addRoI(te_out,roIDescriptor); - if(m_rejectAll) // Flag used for commissioning - te->setActiveState(false); - else - te->setActiveState(true); - return status; - -} - - -HLT::ErrorCode TrigSubDetListWriter::fillPEBInfo(PartialEventBuildingInfo& pebInfo) -{ - - std::vector<uint32_t> detectorROBs; - //std::vector<uint32_t> allROBs, detectorROBs; - -// double etaMin = -5.; -// double etaMax = 5.; -// double phiMax = M_PI; -// double phiMin = -M_PI; - //double phiMin = -2*M_PI; - int size = 0; - - // reserve space of ROB vector, limits to be determined - //allROBs.reserve(120); - // ROB ID 0x520020, need special ROB for tile calibration - //allROBs.insert(allROBs.end(),m_extrarobs.begin(),m_extrarobs.end()); - - // including L1 Calo ROBs - if(m_addL1Calo) - this->fillL1CaloRobs(m_extrarobs); - - pebInfo.addROBs(m_extrarobs); - - size += m_extrarobs.size(); - size += m_sourceid.size(); - - if(m_sourceid.size()!=0) - pebInfo.addSubDetector(m_sourceid); - - for (std::vector<DETID>::const_iterator detector = m_detectors.begin(); - detector != m_detectors.end(); detector++) - { - detectorROBs.clear(); - // if((*detector)==TILE){ - // phiMax = 2*M_PI; - // phiMin = 0.; - // }else{ - // phiMax = M_PI; - // phiMin = -M_PI; - // } - //m_regionSelector->DetROBIDListUint(*detector, etaMin, etaMax, phiMin, phiMax, detectorROBs); - //m_regionSelector->DetROBIDListUint(*detector, detectorROBs); - //allROBs.insert(allROBs.end(), detectorROBs.begin(), detectorROBs.end()); - //msg() << MSG::DEBUG << "ROBs for detector " << *detector << " : "; - //for (unsigned int i = 0; i < detectorROBs.size(); i++) msg() << "0x" << std::hex << detectorROBs[i] << std::dec << " "; - //msg() << endmsg; - switch (*detector) { - case PIXEL: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_hpixrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_pixrange.size(); - pebInfo.addROBs(m_pixrange); - break; - case SCT: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_hsctrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_sctrange.size(); - pebInfo.addROBs(m_sctrange); - break; - case TRT: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_htrtrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_trtrange.size(); - pebInfo.addROBs(m_trtrange); - break; - case LAR: - case TTEM: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_httemrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_ttemrange.size(); - pebInfo.addROBs(m_ttemrange); - break; - case TTHEC: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_htthecrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_tthecrange.size(); - pebInfo.addROBs(m_tthecrange); - break; - case TILE: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_htilerob->Fill(m_robidmap[detectorROBs[i]]); - size += m_tilerange.size(); - pebInfo.addROBs(m_tilerange); - break; - case FCALEM: - case FCALHAD: - //for(unsigned int i=0; i<detectorROBs.size(); i++) m_hfcalrob->Fill(m_robidmap[detectorROBs[i]]); - size += m_fcalrange.size(); - pebInfo.addROBs(m_fcalrange); - break; - case MDT: - case RPC: - case TGC: - case CSC: - ATH_MSG_DEBUG("Muon detectors not yet implemented"); - break; - default: - msg() << MSG::WARNING << "unknown detector type requested " << endmsg; - } - - } - - //for (std::vector<uint32_t>::const_iterator rob = allROBs.begin(); rob != allROBs.end(); rob++) - // pebInfo.add(*rob); - -/* std::cout << "in partial eb after " << std::endl; - std::vector<uint32_t> rob2; - pebInfo.get(rob2); - for(int j=0;j<rob2.size();j++){ - std::cout << "passing this rob = " << (rob2)[j] << std::endl; - }*/ - - m_useCachedResult = true; - - if(size==0) return HLT::MISSING_FEATURE; - - return HLT::OK; -} - - -HLT::ErrorCode TrigSubDetListWriter::hltEndEvent() -{ - m_nRoIs = 0; - m_useCachedResult=false; - return HLT::OK; -} - -TH1I* TrigSubDetListWriter::bookAndRegisterTH1I(const char* name, std::string outpath, int nBins, int minX, int maxX) -{ - TH1I* h = new TH1I(name,name,nBins,minX,maxX); - if (m_thistSvc->regHist(outpath + h->GetName(), h).isFailure()) msg() << MSG::WARNING << "Can't book " << outpath + h->GetName() << endmsg; - - return h; -} - -void TrigSubDetListWriter::fillL1CaloRobs(std::vector<uint32_t>& roblist) -{ - - uint32_t l1caloarray [] = { - 0x710000, 0x710001, 0x710002, 0x710003, 0x710004, 0x710005, 0x710006, 0x710007, 0x710010, 0x710011, 0x710012, 0x710013, 0x710014, 0x710015, 0x710016, 0x710017, 0x710020, 0x710021, 0x710022, 0x710023, 0x710024, 0x710025, 0x710026, 0x710027, 0x710030, 0x710031, 0x710032, 0x710033, 0x710034, 0x710035, 0x710036, 0x710037, 0x720008, 0x720009, 0x72000a, 0x72000b, 0x720028, 0x720029, 0x72002a, 0x72002b, 0x730088, 0x730089, 0x73008a, 0x73008b, 0x74000c, 0x74000d, 0x74001c, 0x74001d, 0x74002c, 0x74002d, 0x74003c, 0x74003d, 0x75008c, 0x75008d }; - roblist.insert(roblist.end(),l1caloarray,l1caloarray+sizeof(l1caloarray)/sizeof(uint32_t)); -} - -//========================================================================= -// check that a ROB ID is enabled for readout in OKS ---> for "online" running -//========================================================================= -bool TrigSubDetListWriter::isRobEnabled(const uint32_t robid) { - bool b_enabled = true; - - // check if given ROB is actually enabled for readout - if (m_enabledROBs.value().size() != 0) { - std::vector<uint32_t>::const_iterator rob_enabled_it = - std::find(m_enabledROBs.value().begin(), m_enabledROBs.value().end(), robid); - if(rob_enabled_it == m_enabledROBs.value().end()) { - ATH_MSG_DEBUG("---> ROB Id : 0x" << MSG::hex << robid << MSG::dec - << " will not be retrieved, since it is not on the list of enabled ROBs."); - b_enabled = false; - } - } - - return b_enabled; -} - diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.h b/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.h deleted file mode 100755 index 84308850a98e1f224514d7e3b5f335e544c52583..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/TrigSubDetListWriter.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -/********************************************************************************** - * @Project: LAr Calibration - * @Package: TrigEgammaHypo - * @class : TrigSubDetListWriter - * - * @brief : Algorithm to write out a list of LAr ROBs for its input RoI - * - * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN - * - * Ignacio Aracena: - * July 22 2008: taken from TrigROBListWriter and modified to read out the whole detector - * - * File and Version Information: - * $Id: TrigSubDetListWriter.h 707504 2015-11-12 16:33:46Z fwinkl $ - **********************************************************************************/ - -#ifndef TrigEgammaHypo_TrigSubDetListWriter_H -#define TrigEgammaHypo_TrigSubDetListWriter_H - -#include "GaudiKernel/ServiceHandle.h" -#include <vector> -#include <string> - -#include "TrigInterfaces/AllTEAlgo.h" -#include "IRegionSelector/RegSelEnums.h" -#include "GaudiKernel/ITHistSvc.h" - -#include "eformat/SourceIdentifier.h" - -#include "TH1I.h" - -class IRegSelSvc; -class PartialEventBuildingInfo; -//class TH1I; - -namespace HLT { - class TriggerElement; -} - -/** - @class TrigSubDetListWriter - Algorithm to write out a list of LAr ROBs for its input RoI - @author Nicolas Berger <Nicolas.Berger@cern.ch> -*/ -class TrigSubDetListWriter : public HLT::AllTEAlgo -{ - public: - - TrigSubDetListWriter(const std::string& name, ISvcLocator* pSvcLocator); //!< std Gaudi algorthm constructor - - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - - /** @brief take one input TriggerElement and process it - It tries to retrieve any attached TrigRoIDescriptor features and prints them. - @param input TriggerElement to be processed - @param output TriggerElement coming out of the algorithm - */ - HLT::ErrorCode hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& te_in, - unsigned int output); - - HLT::ErrorCode fillPEBInfo(PartialEventBuildingInfo& pebInfo); - - HLT::ErrorCode hltStart(); - - TH1I* bookAndRegisterTH1I(const char* name, std::string outpath, int nBins, int minX, int maxX); - - StatusCode bookMonitoringHistograms(); - - HLT::ErrorCode hltEndEvent(); - - void fillL1CaloRobs(std::vector<uint32_t>& roblist); - - private: - - ServiceHandle<IRegSelSvc> m_regionSelector; - std::string m_pebLabel; - - std::string m_detSpec; - std::vector<std::string> m_detId; - std::vector<DETID> m_detectors; - std::vector<eformat::SubDetector> m_sourceid; - std::vector<uint32_t> m_extrarobs; - bool m_addL1Calo; - - bool m_useCachedResult; //!< internal caching: true when the hltExecute will run in cached mode - int m_maxRoIsPerEvent, m_nRoIs; - - std::map<uint32_t,int> m_robidmap; - - /* Histogram service */ - std::vector<uint32_t> m_pixrange; - std::vector<uint32_t> m_sctrange; - std::vector<uint32_t> m_trtrange; - std::vector<uint32_t> m_ttemrange; - std::vector<uint32_t> m_tthecrange; - std::vector<uint32_t> m_tilerange; - std::vector<uint32_t> m_mdtrange; - std::vector<uint32_t> m_rpcrange; - std::vector<uint32_t> m_tgcrange; - std::vector<uint32_t> m_cscrange; - std::vector<uint32_t> m_fcalrange; - std::vector<uint32_t> m_fcalemrange; - - /* Histogram service */ - ITHistSvc * m_thistSvc; - - std::string m_outputpath; - - bool m_rejectAll; - /** detector mask */ - typedef SimpleProperty< std::vector<uint32_t> > Uint32ArrayProperty; - /** @brief list of all enabled ROBs which can be retrieved */ - Uint32ArrayProperty m_enabledROBs; - - /** @brief list of all enabled Sub Detectors which can be retrieved */ - Uint32ArrayProperty m_enabledSubDetectors; - - /// check if a ROB is enabled for readout in OKS - bool isRobEnabled(const uint32_t robid); -// std::string m_outputpath; - -// std::string m_outputpath; - -}; - -#endif diff --git a/Trigger/TrigAlgorithms/TrigDetCalib/src/components/TrigDetCalib_entries.cxx b/Trigger/TrigAlgorithms/TrigDetCalib/src/components/TrigDetCalib_entries.cxx deleted file mode 100644 index 340d8d0e6d82fe9704d14760e9abcaa09dbfe350..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigDetCalib/src/components/TrigDetCalib_entries.cxx +++ /dev/null @@ -1,17 +0,0 @@ -#include "../TrigROBSelector.h" -#include "../TrigROBListWriter.h" -#include "../TrigSubDetListWriter.h" -#include "../TrigEtaHypo.h" -#include "../TrigCheckForTracks.h" -#include "../TrigCheckForMuons.h" -#include "../ScoutingStreamWriter.h" -#include "../TrigL1CaloOverflow.h" - -DECLARE_COMPONENT( TrigROBSelector ) -DECLARE_COMPONENT( TrigROBListWriter ) -DECLARE_COMPONENT( TrigSubDetListWriter ) -DECLARE_COMPONENT( TrigEtaHypo ) -DECLARE_COMPONENT( TrigCheckForTracks ) -DECLARE_COMPONENT( TrigCheckForMuons ) -DECLARE_COMPONENT( ScoutingStreamWriter ) -DECLARE_COMPONENT( TrigL1CaloOverflow ) diff --git a/Trigger/TrigAlgorithms/TrigEgammaRec/python/TrigEgammaRecConfig.py b/Trigger/TrigAlgorithms/TrigEgammaRec/python/TrigEgammaRecConfig.py index 1721caa5a02a8f94876f727f7900c43b6005f5d8..5bd243b7c2673817708e6f27743b220999d2ff86 100755 --- a/Trigger/TrigAlgorithms/TrigEgammaRec/python/TrigEgammaRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigEgammaRec/python/TrigEgammaRecConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # configurables for TrigEgammaRec fexes from AthenaCommon.Logging import logging @@ -12,13 +12,9 @@ from egammaRec.Factories import Factory, ToolFactory, FcnWrapper, getPropertyVal # The following tools use the offline configuration from egammaTools.egammaToolsFactories import EMConversionBuilder, EGammaAmbiguityTool,EMFourMomBuilder +# Import the xAOD isolation parameters. +from xAODPrimitives.xAODIso import xAODIso as isoPar -# Define the isolation types -import ROOT, cppyy -# Need to be sure base dict is loaded first. -cppyy.loadDictionary('xAODCoreRflxDict') -cppyy.loadDictionary('xAODPrimitivesDict') -isoPar = ROOT.xAOD.Iso ## Be carefull : store them in decreasing dR TrigEgammaIsoTypes = [ [ int(isoPar.ptcone40), int(isoPar.ptcone30), int(isoPar.ptcone20)], [ int(isoPar.etcone40), int(isoPar.etcone30), int(isoPar.etcone20)], diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py index 6c853fd11f90db103ba2f42511190c5b63ca0678..347af0cea78ae12ec2fb9d0c9c2474d4be23e4c7 100755 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py @@ -313,12 +313,19 @@ class TrigFastTrackFinderBase(TrigFastTrackFinder): self.doZFinder = InDetTrigSliceSettings[('doZFinder',remapped_type)] if (self.doZFinder): from IDScanZFinder.IDScanZFinderConf import TrigZFinder - theTrigZFinder = TrigZFinder() + theTrigZFinder = TrigZFinder( name="TrigZFinder_"+remapped_type ) theTrigZFinder.NumberOfPeaks = 3 theTrigZFinder.LayerNumberTool=numberingTool + if remapped_type == "beamSpot" : + theTrigZFinder.TripletMode = 1 + theTrigZFinder.TripletDZ = 1 + theTrigZFinder.PhiBinSize = 0.1 + theTrigZFinder.UseOnlyPixels = True + theTrigZFinder.MaxLayer = 3 + theTrigZFinder.FullScanMode = True #TODO: know this from the RoI anyway - should set for every event - ToolSvc += theTrigZFinder + self.trigZFinder = theTrigZFinder self.doFastZVertexSeeding = True self.zVertexResolution = 1 diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx index e07d30476da5b6a97adbad60f225c6aef0acb4dd..206ec3bd3a03dba04207dfb255be2cb1694f9af4 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx @@ -22,6 +22,7 @@ #include "TrigInDetEvent/TrigVertex.h" #include "TrigInDetEvent/TrigVertexCollection.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "TrkTrack/TrackCollection.h" #include "TrkTrack/Track.h" @@ -80,7 +81,7 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p m_trigL2ResidualCalculator("TrigL2ResidualCalculator"), m_trackMaker("InDet::SiTrackMaker_xk/InDetTrigSiTrackMaker"), m_trigInDetTrackFitter("TrigInDetTrackFitter"), - m_trigZFinder("TrigZFinder"), + m_trigZFinder("TrigZFinder/TrigZFinder", this ), m_trackSummaryTool("Trk::ITrackSummaryTool/ITrackSummaryTool"), m_doCloneRemoval(true), m_useBeamSpot(true), @@ -149,7 +150,7 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p declareProperty( "initialTrackMaker", m_trackMaker); declareProperty( "trigInDetTrackFitter", m_trigInDetTrackFitter ); declareProperty( "trigZFinder", m_trigZFinder ); - declareProperty( "TrigL2ResidualCalculator", m_trigZFinder ); + declareProperty( "TrigL2ResidualCalculator", m_trigL2ResidualCalculator ); declareProperty("TrackSummaryTool", m_trackSummaryTool); declareProperty( "doResMon", m_doResMonitoring = true); @@ -312,9 +313,9 @@ namespace InDet { class ExtendedSiTrackMakerEventData_xk : public InDet::SiTrackMakerEventData_xk { public: - ExtendedSiTrackMakerEventData_xk(const SG::ReadHandleKey<Trk::PRDtoTrackMap> &key) { + ExtendedSiTrackMakerEventData_xk(const SG::ReadHandleKey<Trk::PRDtoTrackMap> &key, const EventContext& ctx) { if (!key.key().empty()) { - m_prdToTrackMap = SG::ReadHandle<Trk::PRDtoTrackMap>(key); + m_prdToTrackMap = SG::ReadHandle<Trk::PRDtoTrackMap>(key, ctx); if (!m_prdToTrackMap.isValid()) { throw std::runtime_error(std::string("Failed to get PRD to track map:") + key.key()); } @@ -356,8 +357,9 @@ namespace InDet { } StatusCode TrigFastTrackFinder::execute() { + auto ctx = getContext(); //RoI preparation/update - SG::ReadHandle<TrigRoiDescriptorCollection> roiCollection(m_roiCollectionKey); + SG::ReadHandle<TrigRoiDescriptorCollection> roiCollection(m_roiCollectionKey, ctx); ATH_CHECK(roiCollection.isValid()); TrigRoiDescriptorCollection::const_iterator roi = roiCollection->begin(); TrigRoiDescriptorCollection::const_iterator roiE = roiCollection->end(); @@ -368,11 +370,11 @@ StatusCode TrigFastTrackFinder::execute() { internalRoI.manageConstituents(false);//Don't try to delete RoIs at the end m_countTotalRoI++; - SG::WriteHandle<TrackCollection> outputTracks(m_outputTracksKey); + SG::WriteHandle<TrackCollection> outputTracks(m_outputTracksKey, ctx); outputTracks = std::make_unique<TrackCollection>(); - InDet::ExtendedSiTrackMakerEventData_xk trackEventData(m_prdToTrackMap); - ATH_CHECK(findTracks(trackEventData, internalRoI, *outputTracks)); + InDet::ExtendedSiTrackMakerEventData_xk trackEventData(m_prdToTrackMap, ctx); + ATH_CHECK(findTracks(trackEventData, internalRoI, *outputTracks, ctx)); return StatusCode::SUCCESS; } @@ -388,7 +390,8 @@ HLT::ErrorCode TrigFastTrackFinder::hltExecute(const HLT::TriggerElement*, } TrackCollection* outputTracks = new TrackCollection(SG::OWN_ELEMENTS); InDet::FexSiTrackMakerEventData_xk trackEventData(*this, outputTE, m_prdToTrackMap.key()); - StatusCode sc = findTracks(trackEventData, *internalRoI, *outputTracks); + + StatusCode sc = findTracks(trackEventData, *internalRoI, *outputTracks, getContext()); HLT::ErrorCode code = HLT::OK; if (sc != StatusCode::SUCCESS) { delete outputTracks; @@ -407,7 +410,8 @@ HLT::ErrorCode TrigFastTrackFinder::hltExecute(const HLT::TriggerElement*, StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trackEventData, const TrigRoiDescriptor& roi, - TrackCollection& outputTracks) const { + TrackCollection& outputTracks, + const EventContext& ctx) const { // Run3 monitoring ----------> auto mnt_roi_nTracks = Monitored::Scalar<int>("roi_nTracks", 0); auto mnt_roi_nSPs = Monitored::Scalar<int>("roi_nSPs", 0); @@ -433,7 +437,7 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac std::vector<TrigSiSpacePointBase> convertedSpacePoints; convertedSpacePoints.reserve(5000); - ATH_CHECK(m_spacePointTool->getSpacePoints( roi, convertedSpacePoints, mnt_roi_nSPsPIX, mnt_roi_nSPsSCT)); + ATH_CHECK(m_spacePointTool->getSpacePoints(roi, convertedSpacePoints, mnt_roi_nSPsPIX, mnt_roi_nSPsSCT, ctx)); mnt_timer_SpacePointConversion.stop(); mnt_roi_nSPs = mnt_roi_nSPsPIX + mnt_roi_nSPsSCT; @@ -541,7 +545,7 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac bool PIX = true; bool SCT = true; - m_trackMaker->newTrigEvent(Gaudi::Hive::currentContext(), trackEventData, PIX, SCT); + m_trackMaker->newTrigEvent(ctx, trackEventData, PIX, SCT); for(unsigned int tripletIdx=0;tripletIdx!=triplets.size();tripletIdx++) { @@ -566,7 +570,7 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac ++mnt_roi_nSeeds; - std::list<Trk::Track*> tracks = m_trackMaker->getTracks(Gaudi::Hive::currentContext(), trackEventData, spVec); + std::list<Trk::Track*> tracks = m_trackMaker->getTracks(ctx, trackEventData, spVec); for(std::list<Trk::Track*>::const_iterator t=tracks.begin(); t!=tracks.end(); ++t) { if((*t)) { @@ -665,7 +669,7 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac m_countRoIwithTracks++; ///////////// fill vectors of quantities to be monitored - fillMon(outputTracks, *vertices, roi); + fillMon(outputTracks, *vertices, roi, ctx); mnt_roi_lastStageExecuted = 7; // Run3 monitoring @@ -794,8 +798,8 @@ bool TrigFastTrackFinder::usedByAnyTrack(const std::vector<Identifier>& vIds, st return !xSection.empty(); } -void TrigFastTrackFinder::getBeamSpot(float& shift_x, float& shift_y) const { - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; +void TrigFastTrackFinder::getBeamSpot(float& shift_x, float& shift_y, const EventContext& ctx) const { + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; Amg::Vector3D vertex = beamSpotHandle->beamPos(); ATH_MSG_VERBOSE("Beam spot position " << vertex); double xVTX = vertex.x(); @@ -830,11 +834,11 @@ HLT::ErrorCode TrigFastTrackFinder::getRoI(const HLT::TriggerElement* outputTE, } void TrigFastTrackFinder::fillMon(const TrackCollection& tracks, const TrigVertexCollection& vertices, - const TrigRoiDescriptor& roi) const { + const TrigRoiDescriptor& roi, const EventContext& ctx) const { float shift_x = 0; float shift_y = 0; if(m_useBeamSpot) { - getBeamSpot(shift_x, shift_y); + getBeamSpot(shift_x, shift_y, ctx); } auto mnt_roi_eta = Monitored::Scalar<float>("roi_eta", 0.0); auto mnt_roi_phi = Monitored::Scalar<float>("roi_phi", 0.0); diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h index 8fafe565a141159eef34e24e52bb5351361df61b..2011d9cc05dabc823c1a6736447f2119fd982369 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h @@ -78,14 +78,12 @@ class TrigFastTrackFinder : public HLT::FexAlgo { StatusCode findTracks(InDet::SiTrackMakerEventData_xk &event_data, const TrigRoiDescriptor& roi, - TrackCollection& outputTracks) const; + TrackCollection& outputTracks, + const EventContext& ctx) const; double trackQuality(const Trk::Track* Tr) const; void filterSharedTracks(std::vector<std::tuple<bool, double, Trk::Track*>>& QT) const; - virtual bool isClonable() const override { return true; } - virtual unsigned int cardinality() const override { return 0; }//Mark as re-entrant - protected: void updateClusterMap(long int, const Trk::Track*, std::map<Identifier, std::vector<long int> >&) const; @@ -146,11 +144,11 @@ protected: // Monitoring member functions - void fillMon(const TrackCollection& tracks, const TrigVertexCollection& vertices, const TrigRoiDescriptor& roi) const; + void fillMon(const TrackCollection& tracks, const TrigVertexCollection& vertices, const TrigRoiDescriptor& roi, const EventContext& ctx) const; void runResidualMonitoring(const Trk::Track& track) const; //Setup functions - void getBeamSpot(float&, float&) const; + void getBeamSpot(float&, float&, const EventContext&) const; HLT::ErrorCode getRoI(const HLT::TriggerElement* inputTE, const IRoiDescriptor*& roi); // Internal bookkeeping diff --git a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py index 3ddcfaf16cd9345f4f1fea982bb47e8ab7913931..41f793cac704ff2de0869a6a89bfa6898bdebb37 100644 --- a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py @@ -8,7 +8,6 @@ from AthenaCommon.SystemOfUnits import MeV from JetRec.JetRecConf import JetRecTool from JetRec.JetRecConf import (JetFromPseudojet, JetFinder) -from JetRec.JetRecConf import PseudoJetGetter #added from JetRec.JetRecFlags import jetFlags from JetRec.JetRecStandard import jtm from JetRec.JetRecCalibrationFinder import jrcf diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TriggerPseudoJetGetter.h b/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TriggerPseudoJetGetter.h index b9a685980e4ccef2f710bbfe49912ae1c04d2d13..38c82fa77b4e604ac769c07f68a5c8774ac627d8 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TriggerPseudoJetGetter.h +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TriggerPseudoJetGetter.h @@ -18,7 +18,7 @@ #define TRIGHLTJETREC_TRIGGERPSEUDOJETGETTER_H #include "TrigHLTJetRec/ITriggerPseudoJetGetter.h" -#include "JetRec/PseudoJetGetter.h" +#include "JetInterface/IPseudoJetGetter.h" #include "JetEDM/PseudoJetVector.h" #include "AsgTools/AsgTool.h" diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt index 5983ab686f8b6ef2fd315a9d6df9b277f002d155..442266569a9c409b27f18b58de4db2576342e081 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/CMakeLists.txt @@ -1,80 +1,31 @@ -################################################################################ -# Package: TrigL2MuonSA -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigL2MuonSA ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - DetectorDescription/RegionSelector - Event/ByteStreamCnvSvcBase - Event/xAOD/xAODTrigMuon - Event/xAOD/xAODTrigger - GaudiKernel - MuonSpectrometer/MuonCablings/MuonMDT_Cabling - MuonSpectrometer/MuonCablings/MuonRPC_Cabling - MuonSpectrometer/MuonCablings/MuonTGC_Cabling - MuonSpectrometer/MuonCablings/RPCcablingInterface - MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc - MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces - MuonSpectrometer/MuonRDO - MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1RPCRecRoiSvc - Trigger/TrigTools/TrigMuonBackExtrapolator - Trigger/TrigTools/TrigTimeAlgs - PRIVATE - Control/AthenaInterprocess - Control/CxxUtils - Control/StoreGate - DetectorDescription/GeoModel/GeoModelUtilities - Event/EventInfo - Event/xAOD/xAODEventInfo - MuonSpectrometer/MuonCablings/MuonCablingData - MuonSpectrometer/MuonCalib/MuonCalibEvent - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling - Tools/PathResolver ) - # External dependencies: find_package( CLHEP ) -find_package( Eigen ) find_package( GSL ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( tdaq-common COMPONENTS MuCalDecode circ_proc ) # Component(s) in the package: atlas_add_library( TrigL2MuonSALib - src/*.cxx - PUBLIC_HEADERS TrigL2MuonSA - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier RegionSelectorLib ByteStreamCnvSvcBaseLib xAODTrigMuon xAODTrigger GaudiKernel MuonMDT_CablingLib MuonTGC_CablingLib RPCcablingInterfaceLib MdtCalibSvcLib MuonRDO CscClusterizationLib MuonPrepRawData MuonRecToolInterfaces TrigMuonEvent TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib AthenaInterprocess StoreGateLib SGtests EventInfo xAODEventInfo MuonCablingData MuonCalibEvent MuonReadoutGeometry MuonIdHelpersLib PathResolver GeoModelUtilities RPC_CondCablingLib MuonCnvToolInterfacesLib MuonRPC_CablingLib TrigMuonBackExtrapolatorLib ) + src/*.cxx + PUBLIC_HEADERS TrigL2MuonSA + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringKernelLib ByteStreamCnvSvcBaseLib CscClusterizationLib GaudiKernel GeoPrimitives Identifier MdtCalibSvcLib MuonCablingData MuonCnvToolInterfacesLib MuonIdHelpersLib MuonPrepRawData MuonRDO MuonRecToolInterfaces MuonTGC_CablingLib RPC_CondCablingLib RegionSelectorLib StoreGateLib TrigInterfacesLib TrigMuonBackExtrapolatorLib TrigSteeringEvent TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigTimeAlgsLib xAODEventInfo xAODTrigMuon xAODTrigger + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GSL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaInterprocess CxxUtils EventInfo GeoModelUtilities MuonCalibEvent MuonReadoutGeometry PathResolver ) atlas_add_component( TrigL2MuonSA src/components/*.cxx LINK_LIBRARIES TrigL2MuonSALib ) # Install files from the package: -atlas_install_headers( TrigL2MuonSA ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_runtime( share/pt_barrel.lut share/pt_barrelSP.lut share/pt_barrelSP_new.lut share/pt_barrel.mc10.lut share/pt_endcap.lut share/pt_endcap.mc10.lut share/dZ_barrel.lut share/pt_endcap_small_large.lut share/pt_endcap_run2.lut share/pt_comb_sigma.lut share/pt_comb_mean.lut) atlas_add_test( MdtDataPreparator_test SCRIPT python -m TrigL2MuonSA.MdtDataPreparator_test PROPERTIES TIMEOUT 600 LOG_SELECT_PATTERN "dead tube" ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --enable-extension=ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h index bab989b72e1aef5580b82c0a4cfaa70dd3b31280..e753a5a91515802cdd3b9e270d3b3e2a6dc6b4e4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_CSCDATAPREPARATOR_H @@ -13,32 +13,15 @@ #include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "RegionSelector/IRegSelSvc.h" -#include "Identifier/IdentifierHash.h" - #include "TrigL2MuonSA/TgcData.h" #include "TrigL2MuonSA/CscData.h" #include "TrigL2MuonSA/RecMuonRoIUtils.h" #include "TrigL2MuonSA/MuonRoad.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" - #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "CscClusterization/ICscClusterBuilder.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class ICscClusterBuilder; - -namespace Muon { - class IMuonRdoToPrepDataTool; -} - -namespace MuonGM { - class MuonDetectorManager; - class CscReadoutElement; - class MuonStation; -} +#include "MuonIdHelpers/IMuonIdHelperSvc.h" // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -57,10 +40,9 @@ namespace TrigL2MuonSA { const std::string& name, const IInterface* parent); - ~CscDataPreparator(); + ~CscDataPreparator()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); public: @@ -81,9 +63,7 @@ namespace TrigL2MuonSA { private: - // Geometry Services - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Region Selector ServiceHandle<IRegSelSvc> m_regionSelector; @@ -93,14 +73,9 @@ namespace TrigL2MuonSA { // CSC PrepDataProvider ToolHandle<Muon::IMuonRdoToPrepDataTool> m_cscPrepDataProvider; - //ToolHandle<Muon::IMuonRdoToPrepDataTool> m_cscPrepDataProvider { - // this, "CscPrepDataProvider", "Muon::CscRdoToCscPrepDataTool/CscPrepDataProviderTool", ""}; ToolHandle<ICscClusterBuilder> m_cscClusterProvider; - //ToolHandle<ICscClusterBuilder> m_cscClusterProvider { - // this, "CscClusterProvider", "CscThresholdClusterBuilderTool", ""}; - SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrepContainerKey{ - this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"}; + SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrepContainerKey{ this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"}; // Flag to decide if we need to run the actual decoding (in MT setup, we can use offline code for this) Gaudi::Property<bool> m_doDecoding{ this, "DoDecoding", true, "Flag to decide if we need to do decoding of the CSCs" }; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h index cc2e392e4394a9e03974a6e9036b109311fa4b33..68f3fde556266fe0d3582ea5e67e2ae8dc8b04d0 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_MDTDATAPREPARATOR_H @@ -7,18 +7,17 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" -//#include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" //added +#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "RegionSelector/IRegSelSvc.h" #include "Identifier/IdentifierHash.h" #include "MuonRDO/MdtCsmContainer.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrigL2MuonSA/TgcData.h" #include "TrigL2MuonSA/MdtData.h" @@ -33,7 +32,6 @@ #include "MuonPrepRawData/MuonPrepDataContainer.h" -class StoreGateSvc; namespace MuonGM{ class MuonDetectorManager; class MdtReadoutElement; @@ -57,10 +55,9 @@ namespace TrigL2MuonSA { const std::string& name, const IInterface* parent); - ~MdtDataPreparator(); + ~MdtDataPreparator()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); public: @@ -126,15 +123,12 @@ namespace TrigL2MuonSA { // Tools for the Raw data conversion ToolHandle<Muon::IMuonRawDataProviderTool> m_mdtRawDataProvider; - //ToolHandle<Muon::IMuonRawDataProviderTool> m_mdtRawDataProvider { - // this, "MDT_RawDataProvider", "Muon::MDT_RawDataProviderTool", "MDTRawDataProviderTool"}; // Geometry Services const MuonGM::MuonDetectorManager* m_muonMgr; const MuonGM::MdtReadoutElement* m_mdtReadout; const MuonGM::MuonStation* m_muonStation; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; IdentifierHash m_hash_id; // Region Selector @@ -151,8 +145,6 @@ namespace TrigL2MuonSA { // handles to data access ToolHandle<Muon::IMuonRdoToPrepDataTool> m_mdtPrepDataProvider; - //ToolHandle<Muon::IMuonRdoToPrepDataTool> m_mdtPrepDataProvider { - // this, "MdtPrepDataProvider", "Muon::MdtRdoToPrepDataTool/MdtPrepDataProviderTool", "MdtPrepDataProviderTool"}; SG::ReadHandleKey<MdtCsmContainer> m_mdtCsmContainerKey{ this, "MDTCSMContainer", "MDTCSM", "Name of the MDTRDO to read in"}; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h index d8c8edcfbcf9590405e65cfc82f48f08ded723ea..8692341db11dfd81a14d0d427ed9d96e842be3e7 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h @@ -1,14 +1,14 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_MDTREGIONDEFINER_H #define TRIGL2MUONSA_MDTREGIONDEFINER_H -#include <string> - #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "TrigL2MuonSA/TgcFit.h" @@ -19,9 +19,7 @@ #include "TrigL2MuonSA/MuonRoad.h" #include "TrigL2MuonSA/MdtRegion.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class MdtIdHelper; +#include <string> namespace MuonGM { class MuonDetectorManager; @@ -44,13 +42,12 @@ namespace TrigL2MuonSA { const std::string& name, const IInterface* parent); - ~MdtRegionDefiner(void); + ~MdtRegionDefiner()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); // function using the new cabling/geometry - void setMdtGeometry(const Muon::MuonIdHelperTool* muonIdHelperTool, const MuonGM::MuonDetectorManager* muonMgr); + void setMdtGeometry(const MuonGM::MuonDetectorManager* muonMgr); void setRpcGeometry(bool use_rpc); public: @@ -88,7 +85,7 @@ namespace TrigL2MuonSA { TrigL2MuonSA::MuonRoad& muonRoad); private: - const Muon::MuonIdHelperTool* m_muonIdHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; const MuonGM::MuonDetectorManager* m_muonMgr; const MuonGM::MdtReadoutElement* m_mdtReadout; const MuonGM::MuonStation* m_muonStation; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h index 667303abd3cce5e9f2e7b6a9c55697ced36072ce..ee5c172c15293505ac6a2af7dc55cd97b5b08d65 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_MUFASTPATTERNFINDER_H @@ -7,16 +7,14 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" -#include "GeoPrimitives/GeoPrimitives.h" +#include "GaudiKernel/ToolHandle.h" +#include "GeoPrimitives/GeoPrimitives.h" #include "MdtCalibSvc/MdtCalibrationTool.h" - #include "TrigL2MuonSA/MuonRoad.h" #include "TrigL2MuonSA/MdtData.h" #include "TrigL2MuonSA/TrackData.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -48,10 +46,9 @@ class MuFastPatternFinder: public AthAlgTool const std::string& name, const IInterface* parent); - ~MuFastPatternFinder(); + ~MuFastPatternFinder()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); private: @@ -70,10 +67,7 @@ class MuFastPatternFinder: public AthAlgTool // MDT calibration service ToolHandle<MdtCalibrationTool> m_mdtCalibrationTool; - // Id helper - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h index 155a3558207e3ced5b897e006f2602f507710e6f..9b7a9cf9c02495942e4d11a13d5ec262a4b57032 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h @@ -5,17 +5,11 @@ #ifndef TRIGL2MUONSA_RPCROADDEFINER_H #define TRIGL2MUONSA_RPCROADDEFINER_H -#include <string> - #include "AthenaBaseComps/AthAlgTool.h" - #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include "TrigL2MuonSA/RpcData.h" #include "TrigL2MuonSA/RpcPatFinder.h" #include "TrigL2MuonSA/MuonRoad.h" @@ -23,10 +17,11 @@ #include "TrigL2MuonSA/RpcFitResult.h" #include "TrigL2MuonSA/BarrelRoadData.h" #include "TrigT1Interfaces/RecMuonRoI.h" - #include "RegionSelector/IRegSelSvc.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include <string> + namespace TrigL2MuonSA { // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h index fdbf52dfa262aa0a115b9d0bed250aa06ab24500..0ec663e82cdf77dedb935a39aaf075e94f0cfb91 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGL2MUONSA_TGCDATAPREPARATOR_H @@ -9,27 +9,19 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -//#include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "MuonRDO/TgcRdoContainer.h" - #include "TrigL2MuonSA/TgcDataPreparatorOptions.h" #include "TrigL2MuonSA/TgcData.h" #include "TrigL2MuonSA/RecMuonRoIUtils.h" #include "RegionSelector/IRegSelSvc.h" - #include "MuonTGC_Cabling/MuonTGC_CablingSvc.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" - #include "TrigSteeringEvent/TrigRoiDescriptor.h" - #include "MuonPrepRawData/MuonPrepDataContainer.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class StoreGateSvc; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace MuonGM { class MuonDetectorManager; @@ -62,10 +54,9 @@ class TgcDataPreparator: public AthAlgTool const std::string& name, const IInterface* parent); - ~TgcDataPreparator(); + ~TgcDataPreparator()=default; virtual StatusCode initialize(); - virtual StatusCode finalize (); StatusCode prepareData(const LVL1::RecMuonRoI* p_roi, TrigL2MuonSA::TgcHits& tgcHits); @@ -85,8 +76,7 @@ class TgcDataPreparator: public AthAlgTool const MuonGM::MuonDetectorManager* m_muonMgr; const MuonGM::TgcReadoutElement* m_tgcReadout; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //ActiveStoreSvc* m_activeStore; ServiceHandle<ActiveStoreSvc> m_activeStore; @@ -99,9 +89,6 @@ class TgcDataPreparator: public AthAlgTool // Tool for Rdo to Prep Data conversion ToolHandle<Muon::IMuonRdoToPrepDataTool> m_tgcPrepDataProvider; - //ToolHandle<Muon::IMuonRdoToPrepDataTool> m_tgcPrepDataProvider { - // this, "TgcPrepDataProvider", "Muon::TgcRdoToPrepDataTool/TgcPrepDataProviderTool", ""}; - // // Region Selector ServiceHandle<IRegSelSvc> m_regionSelector; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h index 8324bf2053abdd827b6f7041588a3fffb72ed4e0..e1e925aaa593d4c3c2a21becb9551c4e893cc3c1 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h @@ -5,27 +5,23 @@ #ifndef TRIGL2MUONSA_TGCROADDEFINER_H #define TRIGL2MUONSA_TGCROADDEFINER_H -#include <string> - #include "AthenaBaseComps/AthAlgTool.h" - #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h" #include "TrigL2MuonSA/PtEndcapLUTSvc.h" #include "TrigL2MuonSA/PtEndcapLUT.h" - #include "TrigL2MuonSA/TgcFit.h" #include "TrigL2MuonSA/TgcData.h" #include "TrigL2MuonSA/MuonRoad.h" #include "TrigL2MuonSA/MdtRegion.h" #include "TrigT1Interfaces/RecMuonRoI.h" - #include "RegionSelector/IRegSelSvc.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include <string> + namespace TrigL2MuonSA { // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig_newJO.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig_newJO.py index 30d0ade1678b73b7c862eb0063a682405da33edf..18133bb3bbcf63b9b76735d09c870aefc46adc6e 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig_newJO.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig_newJO.py @@ -16,18 +16,6 @@ def RpcDataPreparatorCfg( flags, roisKey ): acc = ComponentAccumulator() - # Get BS decoder - from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg - rpcAcc = RpcBytestreamDecodeCfg( flags, forTrigger=True ) - #rpcAcc.getEventAlgo("RpcRawDataProvider").RoIs = roisKey - acc.merge( rpcAcc ) - - # Get BS->RDO convertor - from MuonConfig.MuonRdoDecodeConfig import RpcRDODecodeCfg - rpcAcc = RpcRDODecodeCfg( flags, forTrigger=True ) - #rpcAcc.getEventAlgo("RpcRdoToRpcPrepData").RoIs = roisKey - acc.merge( rpcAcc ) - # Set Rpc data preparator for MuFast data preparator TrigL2MuonSA__RpcDataPreparator=CompFactory.getComp("TrigL2MuonSA::RpcDataPreparator") RpcDataPreparator = TrigL2MuonSA__RpcDataPreparator( RpcPrepDataProvider = None, @@ -43,18 +31,6 @@ def TgcDataPreparatorCfg( flags, roisKey ): acc = ComponentAccumulator() - # Get BS decoder - from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg - tgcAcc = TgcBytestreamDecodeCfg( flags, forTrigger=True ) - #TgcRawDataProvider.RoIs = roisKey - acc.merge( tgcAcc ) - - # Get BS->RDO convertor - from MuonConfig.MuonRdoDecodeConfig import TgcRDODecodeCfg - tgcAcc = TgcRDODecodeCfg( flags, forTrigger=True ) - #tgcAcc.getEventAlgo("TgcRdoToTgcPrepData").RoIs = roisKey - acc.merge( tgcAcc ) - # Set Tgc data preparator for MuFast data preparator TrigL2MuonSA__TgcDataPreparator=CompFactory.getComp("TrigL2MuonSA::TgcDataPreparator") TgcDataPreparator = TrigL2MuonSA__TgcDataPreparator( TgcPrepDataProvider = None, @@ -70,18 +46,6 @@ def MdtDataPreparatorCfg( flags, roisKey ): acc = ComponentAccumulator() - # Get BS decoder - from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg - mdtAcc = MdtBytestreamDecodeCfg( flags, forTrigger=True ) - #MdtRawDataProvider.RoIs = roisKey - acc.merge( mdtAcc ) - - # Get BS->RDO convertor - from MuonConfig.MuonRdoDecodeConfig import MdtRDODecodeCfg - mdtAcc = MdtRDODecodeCfg( flags, forTrigger=True ) - #mdtAcc.getEventAlgo("MdtRdoToMdtPrepData").RoIs = roisKey - acc.merge( mdtAcc ) - # Set Mdt data preparator for MuFast data preparator TrigL2MuonSA__MdtDataPreparator=CompFactory.getComp("TrigL2MuonSA::MdtDataPreparator") MdtDataPreparator = TrigL2MuonSA__MdtDataPreparator( MdtPrepDataProvider = None, @@ -96,23 +60,6 @@ def CscDataPreparatorCfg( flags, roisKey ): acc = ComponentAccumulator() - # Get BS decoder - from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg - cscAcc = CscBytestreamDecodeCfg( flags, forTrigger=True ) - #CscRawDataProvider.RoIs = roisKey - acc.merge( cscAcc ) - - # Get BS->RDO convertor - from MuonConfig.MuonRdoDecodeConfig import CscRDODecodeCfg - cscAcc = CscRDODecodeCfg( flags, forTrigger=True ) - #cscAcc.getEventAlgo("CscRdoToCscPrepData").RoIs = roisKey - acc.merge( cscAcc ) - - # Get cluster builder - from MuonConfig.MuonRdoDecodeConfig import CscClusterBuildCfg - cscAcc = CscClusterBuildCfg( flags, forTrigger=True ) - acc.merge( cscAcc ) - # Set Csc data preparator for MuFast data preparator TrigL2MuonSA__CscDataPreparator=CompFactory.getComp("TrigL2MuonSA::CscDataPreparator") CscDataPreparator = TrigL2MuonSA__CscDataPreparator( CscPrepDataProvider = None, @@ -308,20 +255,6 @@ def l2MuFastAlgCfg( flags, roisKey="" ): return acc, muFastFex -def l2MuFastRecoCfg( flags ): - - # Set EventViews for muFast step - from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco - reco = InViewReco("L2MuFastReco") - - # Get Reco alg of muFast Step in order to set into the view - algAcc, alg = l2MuFastAlgCfg( flags, roisKey=reco.name+"RoIs") - - reco.addRecoAlg( alg ) - reco.merge( algAcc ) - - return reco - def l2MuFastHypoCfg( flags, name="UNSPECIFIED", muFastInfo="UNSPECIFIED" ): diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAMonitoring.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAMonitoring.py index 98df3f5064097221591c4f0ce654cf85108a5928..5a2006be1d5a917970fa606d34b9e4ef061663b3 100755 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAMonitoring.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAMonitoring.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool @@ -34,7 +34,7 @@ class TrigL2MuonSAMonitoring(GenericMonitoringTool): from TrigMonitorBase.TrigGenericMonitoringToolConfig import defineHistogram, TrigGenericMonitoringToolConfig - + class TrigL2MuonSAValidationMonitoring(TrigGenericMonitoringToolConfig): def __init__ (self, name="TrigL2MuonSAValidationMonitoring"): super(TrigL2MuonSAValidationMonitoring, self).__init__(name) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx index 0533c8a97082a7ecaf43ccf688aeb35773650150..7a87e4d61a95b771b8c8cb0d1e2ce5bcfa6784df 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx @@ -1,20 +1,15 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/CscDataPreparator.h" #include "StoreGate/ActiveStoreSvc.h" - #include "CLHEP/Units/PhysicalConstants.h" - -#include "Identifier/IdentifierHash.h" #include "xAODTrigMuon/TrigMuonDefs.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" - #include "AthenaBaseComps/AthMsgStreamMacros.h" - using namespace Muon; // -------------------------------------------------------------------------------- @@ -47,13 +42,6 @@ TrigL2MuonSA::CscDataPreparator::CscDataPreparator(const std::string& type, // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -TrigL2MuonSA::CscDataPreparator::~CscDataPreparator() -{ -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - StatusCode TrigL2MuonSA::CscDataPreparator::initialize() { @@ -80,8 +68,8 @@ StatusCode TrigL2MuonSA::CscDataPreparator::initialize() ATH_CHECK( m_cscClusterProvider.retrieve(DisableTool{!m_doDecoding}) ); ATH_MSG_INFO("Retrieved " << m_cscClusterProvider); - // Tool for CSC ID helper - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); + // Locate RegionSelector ATH_CHECK( m_regionSelector.retrieve() ); ATH_MSG_DEBUG("Retrieved service " << m_regionSelector.name()); @@ -198,13 +186,13 @@ StatusCode TrigL2MuonSA::CscDataPreparator::prepareData(const TrigRoiDescriptor* // Create new digit TrigL2MuonSA::CscHitData cscHit; - cscHit.StationName = m_muonIdHelperTool->cscIdHelper().stationName( prepData.identify() ); - cscHit.StationEta = m_muonIdHelperTool->cscIdHelper().stationEta( prepData.identify() ); - cscHit.StationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi( prepData.identify() ); - cscHit.ChamberLayer = (true==isunspoiled) ? 1 : 0;//m_muonIdHelperTool->cscIdHelper().chamberLayer( prepData.identify() ); - cscHit.WireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer( prepData.identify() ); - cscHit.MeasuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi( prepData.identify() ); - cscHit.Strip = m_muonIdHelperTool->cscIdHelper().strip( prepData.identify() ); + cscHit.StationName = m_idHelperSvc->cscIdHelper().stationName( prepData.identify() ); + cscHit.StationEta = m_idHelperSvc->cscIdHelper().stationEta( prepData.identify() ); + cscHit.StationPhi = m_idHelperSvc->cscIdHelper().stationPhi( prepData.identify() ); + cscHit.ChamberLayer = (true==isunspoiled) ? 1 : 0; + cscHit.WireLayer = m_idHelperSvc->cscIdHelper().wireLayer( prepData.identify() ); + cscHit.MeasuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi( prepData.identify() ); + cscHit.Strip = m_idHelperSvc->cscIdHelper().strip( prepData.identify() ); cscHit.Chamber = chamber; cscHit.StripId = (cscHit.StationName << 18) | ((cscHit.StationEta + 2) << 16) | (cscHit.StationPhi << 12) @@ -280,18 +268,6 @@ double TrigL2MuonSA::CscDataPreparator::calc_residual_phi( double aw, double bw, } - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - -StatusCode TrigL2MuonSA::CscDataPreparator::finalize() -{ - ATH_MSG_DEBUG("Finalizing CscDataPreparator - package version " << PACKAGE_VERSION); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx index 93493eefe7ed44b3fc9c72b2b3747d9d37cec91a..acc48b43e3be16bd21cd48fe8a3bec8f0a2a07ea 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/MdtDataPreparator.h" @@ -73,13 +73,6 @@ TrigL2MuonSA::MdtDataPreparator::MdtDataPreparator(const std::string& type, // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -TrigL2MuonSA::MdtDataPreparator::~MdtDataPreparator() -{ -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - StatusCode TrigL2MuonSA::MdtDataPreparator::initialize() { // Get a message stream instance @@ -126,7 +119,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::initialize() // retrieve the mdtidhelper ATH_CHECK( detStore()->retrieve(m_muonMgr,"Muon") ); ATH_MSG_DEBUG("Retrieved GeoModel from DetectorStore."); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // Disable MDT PRD converter if we don't do the MDT data decoding ATH_CHECK( m_mdtPrepDataProvider.retrieve(DisableTool{!m_doDecoding}) ); @@ -136,10 +129,10 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::initialize() ATH_CHECK( m_activeStore.retrieve() ); ATH_MSG_DEBUG("Retrieved ActiveStoreSvc."); - m_BMGpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG") != -1; + m_BMGpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG") != -1; if(m_BMGpresent){ ATH_MSG_INFO("Processing configuration for layouts with BMG chambers."); - m_BMGid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG"); + m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG"); for(int phi=6; phi<8; phi++) { // phi sectors - BMGs are ony in (6 aka 12) and (7 aka 14) for(int eta=1; eta<4; eta++) { // eta sectors - BMGs are in eta 1 to 3 for(int side=-1; side<2; side+=2) { // side - both sides have BMGs @@ -204,7 +197,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::prepareData(const LVL1::RecMuonRoI* { StatusCode sc; - m_mdtRegionDefiner->setMdtGeometry(m_muonIdHelperTool.get(), m_muonMgr); + m_mdtRegionDefiner->setMdtGeometry(m_muonMgr); // define regions sc = m_mdtRegionDefiner->getMdtRegions(p_roi, rpcFitResult, muonRoad, mdtRegion); @@ -236,7 +229,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::prepareData(const LVL1::RecMuonRoI* { StatusCode sc; - m_mdtRegionDefiner->setMdtGeometry(m_muonIdHelperTool.get(), m_muonMgr); + m_mdtRegionDefiner->setMdtGeometry(m_muonMgr); // define regions sc = m_mdtRegionDefiner->getMdtRegions(p_roi, tgcFitResult, muonRoad, mdtRegion); @@ -448,7 +441,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtCsm(const MdtCsmContainer* pMd // Modificaiton provided by Jochen Meyer unsigned int i=0; int processingDetEl = 1; - bool BMEpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1; + bool BMEpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1; while( i < v_idHash.size() ) { redundant = false; @@ -466,20 +459,20 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtCsm(const MdtCsmContainer* pMd Identifier tmp_id; - IdContext tmp_context = m_muonIdHelperTool->mdtIdHelper().module_context(); - m_muonIdHelperTool->mdtIdHelper().get_id(v_idHash[i], tmp_id, &tmp_context); + IdContext tmp_context = m_idHelperSvc->mdtIdHelper().module_context(); + m_idHelperSvc->mdtIdHelper().get_id(v_idHash[i], tmp_id, &tmp_context); Identifier ml_id = tmp_id; if( BMEpresent ) { // if there are BMEs the RDOs are registered with the detectorElement hash // for BMEs the 2 CSMs are registered with the hashes of the 2 multilayers - ml_id = m_muonIdHelperTool->mdtIdHelper().multilayerID(tmp_id, processingDetEl); - m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(ml_id, v_idHash_corr); + ml_id = m_idHelperSvc->mdtIdHelper().multilayerID(tmp_id, processingDetEl); + m_idHelperSvc->mdtIdHelper().get_detectorElement_hash(ml_id, v_idHash_corr); } MdtCsmContainer::const_iterator pCsmIt = pMdtCsmContainer->indexFind(v_idHash_corr); if( pCsmIt==pMdtCsmContainer->end() ) { if(processingDetEl == 1){ - if ( m_muonIdHelperTool->mdtIdHelper().stationName(ml_id) == 53 ) processingDetEl = 2; //if this is BME, the 2nd layer should be checked next + if ( m_idHelperSvc->mdtIdHelper().stationName(ml_id) == 53 ) processingDetEl = 2; //if this is BME, the 2nd layer should be checked next else ++i; } else { processingDetEl = 1; //reset processingDetEl @@ -490,7 +483,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtCsm(const MdtCsmContainer* pMd if( BMEpresent ){ Identifier elementId = ((*pCsmIt)->identify()); // if there are BMEs it's also required to process there 2nd CSM - if( m_muonIdHelperTool->mdtIdHelper().stationName(elementId) == 53 ) { // is BME chamber + if( m_idHelperSvc->mdtIdHelper().stationName(elementId) == 53 ) { // is BME chamber // do the loop once again with the SAME iterator, but for the 2nd multilayer if( processingDetEl == 2 ) { // reset to CSM/multilayer 1 and go to next chamber @@ -634,12 +627,12 @@ bool TrigL2MuonSA::MdtDataPreparator::decodeMdtCsm(const MdtCsm* csm, double R = -99999., Z = -99999.; if(m_BMGpresent) { - Identifier tubeId = m_muonIdHelperTool->mdtIdHelper().channelID(StationName, StationEta, StationPhi, MultiLayer, Layer, Tube); - if(m_muonIdHelperTool->mdtIdHelper().stationName(tubeId) == m_BMGid ) { + Identifier tubeId = m_idHelperSvc->mdtIdHelper().channelID(StationName, StationEta, StationPhi, MultiLayer, Layer, Tube); + if(m_idHelperSvc->mdtIdHelper().stationName(tubeId) == m_BMGid ) { std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find( m_muonMgr->getMdtReadoutElement(tubeId)->identify() ); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), tubeId) != (myIt->second).end() ) { - ATH_MSG_DEBUG("Skipping tube with identifier " << m_muonIdHelperTool->mdtIdHelper().show_to_string(tubeId) ); + ATH_MSG_DEBUG("Skipping tube with identifier " << m_idHelperSvc->mdtIdHelper().show_to_string(tubeId) ); ++amt; continue; } @@ -968,7 +961,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std mdtCols.push_back(*MDTcoll); ATH_MSG_DEBUG("Selected Mdt Collection: " - << m_muonIdHelperTool->mdtIdHelper().show_to_string((*MDTcoll)->identify()) + << m_idHelperSvc->mdtIdHelper().show_to_string((*MDTcoll)->identify()) << " with size " << (*MDTcoll)->size() << "in Hash ID" << (int)*idit); } @@ -1006,10 +999,10 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std int drift = mdt->tdc(); int TubeLayers = m_mdtReadout->getNLayers(); - int TubeLayer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); + int TubeLayer = m_idHelperSvc->mdtIdHelper().tubeLayer(id); if(TubeLayer > TubeLayers) TubeLayer -= TubeLayers; int Layer = (MultiLayer-1)*TubeLayers + TubeLayer; - int Tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int Tube = m_idHelperSvc->mdtIdHelper().tube(id); double OrtoRadialPos = m_mdtReadout->getStationS(); std::string chamberType = m_mdtReadout->getStationType(); @@ -1033,11 +1026,11 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std } double R = -99999., Z = -99999.; - if(m_BMGpresent && m_muonIdHelperTool->mdtIdHelper().stationName(id) == m_BMGid ) { + if(m_BMGpresent && m_idHelperSvc->mdtIdHelper().stationName(id) == m_BMGid ) { std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find( m_muonMgr->getMdtReadoutElement(id)->identify() ); if( myIt != m_DeadChannels.end() ){ if( std::find( (myIt->second).begin(), (myIt->second).end(), id) != (myIt->second).end() ) { - ATH_MSG_DEBUG("Skipping tube with identifier " << m_muonIdHelperTool->mdtIdHelper().show_to_string(id) ); + ATH_MSG_DEBUG("Skipping tube with identifier " << m_idHelperSvc->mdtIdHelper().show_to_string(id) ); continue; } } @@ -1138,17 +1131,6 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -StatusCode TrigL2MuonSA::MdtDataPreparator::finalize() -{ - ATH_MSG_DEBUG("Finalizing MdtDataPreparator - package version " << PACKAGE_VERSION); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - void TrigL2MuonSA::MdtDataPreparator::initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl) { PVConstLink cv = mydetEl->getMaterialGeom(); // it is "Multilayer" int nGrandchildren = cv->getNChildVols(); @@ -1160,10 +1142,10 @@ void TrigL2MuonSA::MdtDataPreparator::initDeadChannels(const MuonGM::MdtReadoutE Identifier detElId = mydetEl->identify(); - int name = m_muonIdHelperTool->mdtIdHelper().stationName(detElId); - int eta = m_muonIdHelperTool->mdtIdHelper().stationEta(detElId); - int phi = m_muonIdHelperTool->mdtIdHelper().stationPhi(detElId); - int ml = m_muonIdHelperTool->mdtIdHelper().multilayer(detElId); + int name = m_idHelperSvc->mdtIdHelper().stationName(detElId); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId); + int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId); std::vector<Identifier> deadTubes; std::vector<int>::iterator it = tubes.begin(); @@ -1179,7 +1161,7 @@ void TrigL2MuonSA::MdtDataPreparator::initDeadChannels(const MuonGM::MdtReadoutE ++it; } else { - Identifier deadTubeId = m_muonIdHelperTool->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube ); + Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube ); deadTubes.push_back( deadTubeId ); ATH_MSG_VERBOSE("adding dead tube (" << tube << "), layer(" << layer << "), phi(" << phi << "), eta(" << eta << "), name(" << name diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx index 9f4a4da52918a8fa1bd2077aa2566ad1c369f192..2c43904d65b573bac763a6fbfe24c4961818f5df 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/MdtRegionDefiner.h" @@ -38,26 +38,10 @@ TrigL2MuonSA::MdtRegionDefiner::MdtRegionDefiner(const std::string& type, // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- - -TrigL2MuonSA::MdtRegionDefiner::~MdtRegionDefiner(void) -{ -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - StatusCode TrigL2MuonSA::MdtRegionDefiner::initialize() { ATH_MSG_DEBUG("Initializing MdtRegionDefiner - package version " << PACKAGE_VERSION) ; - - StatusCode sc; - sc = AthAlgTool::initialize(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR("Could not initialize the AthAlgTool base class."); - return sc; - } - - // + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -74,10 +58,8 @@ void TrigL2MuonSA::MdtRegionDefiner::setRpcGeometry(bool use_rpc) // -------------------------------------------------------------------------------- // set the pointers for the new cabling and geometry -void TrigL2MuonSA::MdtRegionDefiner::setMdtGeometry(const Muon::MuonIdHelperTool* muonIdHelperTool, - const MuonGM::MuonDetectorManager* muonMgr) +void TrigL2MuonSA::MdtRegionDefiner::setMdtGeometry(const MuonGM::MuonDetectorManager* muonMgr) { - m_muonIdHelperTool = muonIdHelperTool; m_muonMgr = muonMgr; } @@ -135,8 +117,8 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::getMdtRegions(const LVL1::RecMuonRoI* for(int sta_iter=0; sta_iter< (int)muonRoad.stationList.size(); sta_iter++){ Identifier id = muonRoad.stationList[sta_iter]; - int stationPhi = m_muonIdHelperTool->mdtIdHelper().stationPhi(id); - std::string name = m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id)); + int stationPhi = m_idHelperSvc->mdtIdHelper().stationPhi(id); + std::string name = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(id)); int chamber_this = 99; int sector_this = 99; bool isEndcap; @@ -144,9 +126,9 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::getMdtRegions(const LVL1::RecMuonRoI* if(chamber_this == chamber && sector_this == sector ){ if(ty1 == -1) - ty1 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(name)+1; + ty1 = m_idHelperSvc->mdtIdHelper().stationNameIndex(name)+1; else if(ty2 == -1) - ty2 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(name)+1; + ty2 = m_idHelperSvc->mdtIdHelper().stationNameIndex(name)+1; m_mdtReadout = m_muonMgr->getMdtReadoutElement(id); m_muonStation = m_mdtReadout->parentMuonStation(); @@ -293,8 +275,8 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::getMdtRegions(const LVL1::RecMuonRoI* for(int sta_iter=0; sta_iter<(int)muonRoad.stationList.size(); sta_iter++){ Identifier id = muonRoad.stationList[sta_iter]; - int stationPhi = m_muonIdHelperTool->mdtIdHelper().stationPhi(id); - std::string name = m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id)); + int stationPhi = m_idHelperSvc->mdtIdHelper().stationPhi(id); + std::string name = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(id)); int chamber_this = 99; int sector_this = 99; bool isEndcap; @@ -304,9 +286,9 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::getMdtRegions(const LVL1::RecMuonRoI* if(chamber_this == chamber && sector_this == sector){ if(ty1 == -1) - ty1 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(name)+1; + ty1 = m_idHelperSvc->mdtIdHelper().stationNameIndex(name)+1; else if(ty2 == -1) - ty2 = m_muonIdHelperTool->mdtIdHelper().stationNameIndex(name)+1; + ty2 = m_idHelperSvc->mdtIdHelper().stationNameIndex(name)+1; m_mdtReadout = m_muonMgr->getMdtReadoutElement(id); m_muonStation = m_mdtReadout->parentMuonStation(); float scale = 10.; @@ -767,18 +749,3 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::computePhi(const LVL1::RecMuonRoI* p_ } return StatusCode::SUCCESS; } - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - -StatusCode TrigL2MuonSA::MdtRegionDefiner::finalize() -{ - ATH_MSG_DEBUG("Finalizing MdtRegionDefiner - package version " << PACKAGE_VERSION); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx index 08c809f1ccd98a514058fe2420252583499159cb..0751ed235bb059ab4a8fa574f969d31dfc3f342f 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx @@ -1,18 +1,13 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/MuFastPatternFinder.h" #include "MuonCalibEvent/MdtCalibHit.h" - #include "CLHEP/Units/PhysicalConstants.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "Identifier/Identifier.h" - #include "xAODTrigMuon/TrigMuonDefs.h" - #include "AthenaBaseComps/AthMsgStreamMacros.h" // -------------------------------------------------------------------------------- @@ -38,24 +33,9 @@ TrigL2MuonSA::MuFastPatternFinder::MuFastPatternFinder(const std::string& type, // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- -TrigL2MuonSA::MuFastPatternFinder::~MuFastPatternFinder() -{ -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - StatusCode TrigL2MuonSA::MuFastPatternFinder::initialize() { - StatusCode sc; - sc = AthAlgTool::initialize(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR("Could not initialize the AthAlgTool base class."); - return sc; - } - - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -75,7 +55,7 @@ void TrigL2MuonSA::MuFastPatternFinder::doMdtCalibration(TrigL2MuonSA::MdtHitDat << StationName << "/" << StationEta << "/" << StationPhi << "/" << Multilayer << "/" << Layer << "/" << Tube); - Identifier id = ( mdtHit.Id.is_valid() ) ? mdtHit.Id : m_muonIdHelperTool->mdtIdHelper().channelID(StationName,StationEta, + Identifier id = ( mdtHit.Id.is_valid() ) ? mdtHit.Id : m_idHelperSvc->mdtIdHelper().channelID(StationName,StationEta, StationPhi,Multilayer,Layer,Tube); int tdcCounts = (int)mdtHit.DriftTime; @@ -325,17 +305,3 @@ double TrigL2MuonSA::MuFastPatternFinder::calc_residual(double aw,double bw,doub double dz = x - (y-bw)*ia; return dz/sqrt(1.+iaq); } - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - -StatusCode TrigL2MuonSA::MuFastPatternFinder::finalize() -{ - ATH_MSG_DEBUG("Finalizing MuFastPatternFinder - package version " << PACKAGE_VERSION); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx index 8fc45907950af5fc5e58e333748eddf3462f0f68..97403ea9ae044d9c057e9d881aafbd2555f716a5 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx @@ -1,24 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigL2MuonSA/TgcDataPreparator.h" #include "CLHEP/Units/PhysicalConstants.h" - -#include "Identifier/IdentifierHash.h" - #include "TrigL2MuonSA/TgcData.h" #include "TrigL2MuonSA/RecMuonRoIUtils.h" - -#include "StoreGate/ActiveStoreSvc.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" - #include "AthenaBaseComps/AthMsgStreamMacros.h" using namespace MuonGM; @@ -49,14 +41,6 @@ TrigL2MuonSA::TgcDataPreparator::TgcDataPreparator(const std::string& type, declareProperty("TgcPrepDataProvider", m_tgcPrepDataProvider); } - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - -TrigL2MuonSA::TgcDataPreparator::~TgcDataPreparator() -{ -} - // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -64,19 +48,12 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::initialize() { // Get a message stream instance ATH_MSG_DEBUG("Initializing TgcDataPreparator - package version " << PACKAGE_VERSION ); - - StatusCode sc; - sc = AthAlgTool::initialize(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR("Could not initialize the AthAlgTool base class."); - return sc; - } // Locate RegionSelector ATH_CHECK( m_regionSelector.retrieve() ); ATH_MSG_DEBUG("Retrieved service RegionSelector"); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK( m_activeStore.retrieve() ); ATH_MSG_DEBUG("Retrieved ActiveStoreSvc." ); @@ -101,7 +78,6 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::initialize() ATH_CHECK(m_tgcContainerKey.initialize()); - // return StatusCode::SUCCESS; } @@ -202,8 +178,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* for( ;cwi!=cwi_end;++cwi ){ // loop over data in the collection if( !*cwi ) continue; const Muon::TgcPrepData& prepDataWi = **cwi; - if (!m_muonIdHelperTool->tgcIdHelper().isStrip(prepDataWi.identify())) {//wire - int stationNumWi = m_muonIdHelperTool->tgcIdHelper().stationRegion(prepDataWi.identify())-1; + if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataWi.identify())) {//wire + int stationNumWi = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataWi.identify())-1; if (stationNumWi==-1) stationNumWi=3; if (stationNumWi<3 && fabs(prepDataWi.globalPosition().eta() - roi_eta) < mid_eta_test ) { float dphi = acos(cos(prepDataWi.globalPosition().phi()-roi_phi)); @@ -237,8 +213,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* for( ;chit!=chit_end;++chit ){ // loop over data in the collection if( !*chit ) continue; const Muon::TgcPrepData& prepDataHit = **chit; - if (!m_muonIdHelperTool->tgcIdHelper().isStrip(prepDataHit.identify())) {//strip - int stationNumHit = m_muonIdHelperTool->tgcIdHelper().stationRegion(prepDataHit.identify())-1; + if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataHit.identify())) {//strip + int stationNumHit = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataHit.identify())-1; if (stationNumHit==-1) stationNumHit=3; if (stationNumHit<3 && fabs(prepDataHit.globalPosition().eta() - roi_eta) < mid_eta_test ) { float dphi = acos(cos(prepDataHit.globalPosition().phi()-roi_phi)); @@ -269,9 +245,9 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* const Muon::TgcPrepData& prepData = **cit; bool isInRoad = false; - int stationNum = m_muonIdHelperTool->tgcIdHelper().stationRegion(prepData.identify())-1; + int stationNum = m_idHelperSvc->tgcIdHelper().stationRegion(prepData.identify())-1; if (stationNum==-1) stationNum=3; - if (m_muonIdHelperTool->tgcIdHelper().isStrip(prepData.identify())) { + if (m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())) { double dphi = fabs(prepData.globalPosition().phi() - roi_phi); if( dphi > CLHEP::pi*2 ) dphi = dphi - CLHEP::pi*2; if( dphi > CLHEP::pi ) dphi = CLHEP::pi*2 - dphi; @@ -291,8 +267,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* if( ! isInRoad ) continue; m_tgcReadout = prepData.detectorElement(); - gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(prepData.identify()); - channel = m_muonIdHelperTool->tgcIdHelper().channel(prepData.identify()); + gasGap = m_idHelperSvc->tgcIdHelper().gasGap(prepData.identify()); + channel = m_idHelperSvc->tgcIdHelper().channel(prepData.identify()); TrigL2MuonSA::TgcHitData lutDigit; @@ -301,8 +277,8 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* lutDigit.r = prepData.globalPosition().perp(); lutDigit.z = prepData.globalPosition().z(); lutDigit.sta = stationNum; - lutDigit.isStrip = m_muonIdHelperTool->tgcIdHelper().isStrip(prepData.identify()); - if(m_muonIdHelperTool->tgcIdHelper().isStrip(prepData.identify())){ + lutDigit.isStrip = m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify()); + if(m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())){ lutDigit.width = m_tgcReadout->stripWidth(gasGap, channel); } else{ @@ -319,17 +295,3 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* return StatusCode::SUCCESS; } - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- - -StatusCode TrigL2MuonSA::TgcDataPreparator::finalize() -{ - ATH_MSG_DEBUG("Finalizing TgcDataPreparator - package version " << PACKAGE_VERSION); - - StatusCode sc = AthAlgTool::finalize(); - return sc; -} - -// -------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigMinBias/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigMinBias/CMakeLists.txt index 5c3bc258bef5c7461fa8815a289beb3cc1329ee2..9d084ae94d29c74d0de61a345fbe229d622d9d88 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigMinBias/CMakeLists.txt @@ -20,7 +20,7 @@ atlas_depends_on_subdirs( PRIVATE Trigger/TrigTools/TrigTimeAlgs Event/xAOD/xAODTrigger Control/AthenaMonitoringKernel - ​Control/AthViews) + Control/AthViews) # Component(s) in the package: atlas_add_component( TrigMinBias diff --git a/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py b/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py index 9fd21ca09ea62d811ecd55a3be7fc4478ca94324..9972a81fb3f88e8e0ef46393dda1e8ba326b194c 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py +++ b/Trigger/TrigAlgorithms/TrigMinBias/python/TrackCountMonitoringMT.py @@ -6,5 +6,5 @@ def TrackCountMonitoring(): from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT alg=TrackCountHypoAlgMT() for i in range(len(alg.min_pt)): - monTool.defineHistogram('counts_minpTcut={}_maxZ0cut={}'.format(alg.min_pt[i],alg.max_z0[i]), path='EXPERT', type='TH1I', title='counts for min pT and max z0 cut',xbins=100, xmin=-0.5, xmax=4999.5) + monTool.defineHistogram('counts_minpTcutIndex_{}_maxZ0cutIndex_{}'.format(i,i), path='EXPERT', type='TH1I', title='counts for min pT and max z0 cut',xbins=100, xmin=-0.5, xmax=4999.5) return monTool diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py index cef1183ac6dec22711b96dda8db19f75eb734e27..2c45e522e8a2fb7fa71a5de697a0154014a076c9 100755 --- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py +++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py @@ -1,7 +1,5 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function - # TrigMuonEF configurables # from TrigMuonEF.TrigMuonEFConf import * @@ -14,6 +12,8 @@ from AthenaCommon import CfgMgr from AthenaCommon import CfgGetter from AthenaCommon.DetFlags import DetFlags from AthenaCommon.SystemOfUnits import GeV,mm +from AthenaCommon.Logging import logging +log = logging.getLogger('TrigMuonEFConfig') from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig @@ -659,8 +659,7 @@ def TMEF_TrackIsolationTool(name='TMEF_isolationTool',**kwargs): trkseltool.CutLevel='Loose' elif 'TightTSel' in name: trkseltool.CutLevel='TightPrimary' - print ('TMEF_TrackIsolationTool added trackselection tool:') - print (trkseltool) + log.debug('TMEF_TrackIsolationTool added trackselection tool:\n%s', trkseltool) kwargs.setdefault('TrackSelectionTool',trkseltool) return TrigMuonEFTrackIsolationTool(name, **kwargs) diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx index dc07c067007e7c0d3a8d50392f78aaa43fdfd7da..813fcaefbc77986ca099788d1a9d0acf6ca51c94 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx @@ -22,7 +22,6 @@ #include "TrkEventPrimitives/FitQuality.h" #include "MuonSegment/MuonSegment.h" -// #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "IRegionSelector/IRegSelSvc.h" #include "IRegionSelector/IRoiDescriptor.h" @@ -33,10 +32,6 @@ #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h" #include "CscClusterization/ICscClusterBuilder.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "MuidInterfaces/IMuidBackTracker.h" @@ -458,7 +453,7 @@ StatusCode TrigMuonEFStandaloneTrackTool::initialize() return StatusCode::FAILURE; } - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // register EndEvent incident IIncidentSvc* pIncsvc; @@ -1118,22 +1113,22 @@ if (m_useMdtData>0) { if( RPCcoll == rpcPrds->end() ) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext rpcContext = m_muonIdHelperTool->rpcIdHelper().module_context(); - int code = m_muonIdHelperTool->rpcIdHelper().get_id(*idit, idColl, &rpcContext); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); + int code = m_idHelperSvc->rpcIdHelper().get_id(*idit, idColl, &rpcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for rpc id hash = " << (int)*idit - << " not found in the cont. ext.id = " << m_muonIdHelperTool->rpcIdHelper().show_to_string(idColl)); + << " not found in the cont. ext.id = " << m_idHelperSvc->rpcIdHelper().show_to_string(idColl)); } continue; } if( (*RPCcoll)->size() == 0) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext rpcContext = m_muonIdHelperTool->rpcIdHelper().module_context(); - int code = m_muonIdHelperTool->rpcIdHelper().get_id(*idit, idColl, &rpcContext); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); + int code = m_idHelperSvc->rpcIdHelper().get_id(*idit, idColl, &rpcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for rpc id hash = " << (int)*idit - << " is empty ext.id = " << m_muonIdHelperTool->rpcIdHelper().show_to_string(idColl)); + << " is empty ext.id = " << m_idHelperSvc->rpcIdHelper().show_to_string(idColl)); } continue; } @@ -1144,12 +1139,12 @@ if (m_useMdtData>0) { rpcCols.push_back(*RPCcoll); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Selected Rpc Collection: " - << m_muonIdHelperTool->rpcIdHelper().show_to_string((*RPCcoll)->identify()) + << m_idHelperSvc->rpcIdHelper().show_to_string((*RPCcoll)->identify()) << " (hash = " << (int)*idit << ") with size " << (*RPCcoll)->size()); else if (testRoiDrivenMode) ATH_MSG_INFO("Selected Rpc Collection: " - << m_muonIdHelperTool->rpcIdHelper().show_to_string((*RPCcoll)->identify()) + << m_idHelperSvc->rpcIdHelper().show_to_string((*RPCcoll)->identify()) << " (hash = " << (int)*idit << "), with size " << (*RPCcoll)->size()); @@ -1181,22 +1176,22 @@ if (m_useMdtData>0) { if( MDTcoll == mdtPrds->end() ) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); - int code = m_muonIdHelperTool->mdtIdHelper().get_id(*idit, idColl, &mdtContext); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); + int code = m_idHelperSvc->mdtIdHelper().get_id(*idit, idColl, &mdtContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for mdt id hash = " << (int)*idit - << " not found in the cont. ext.id = " << m_muonIdHelperTool->mdtIdHelper().show_to_string(idColl)); + << " not found in the cont. ext.id = " << m_idHelperSvc->mdtIdHelper().show_to_string(idColl)); } continue; } if( (*MDTcoll)->size() == 0) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); - int code = m_muonIdHelperTool->mdtIdHelper().get_id(*idit, idColl, &mdtContext); + IdContext mdtContext = m_idHelperSvc->mdtIdHelper().module_context(); + int code = m_idHelperSvc->mdtIdHelper().get_id(*idit, idColl, &mdtContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for mdt id hash = " << (int)*idit - << " is empty ext.id = " << m_muonIdHelperTool->mdtIdHelper().show_to_string(idColl)); + << " is empty ext.id = " << m_idHelperSvc->mdtIdHelper().show_to_string(idColl)); } continue; } @@ -1213,9 +1208,9 @@ if (m_useMdtData>0) { const Muon::MdtPrepData* mdt = *cit; int TubeLayers = mdt->detectorElement()->getNLayers(); - int TubeLayer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(mdt->identify()); + int TubeLayer = m_idHelperSvc->mdtIdHelper().tubeLayer(mdt->identify()); if(TubeLayer > TubeLayers) TubeLayer -= TubeLayers; - const Amg::Vector3D mdtpos = mdt->detectorElement()->center(TubeLayer,m_muonIdHelperTool->mdtIdHelper().tube(mdt->identify())); + const Amg::Vector3D mdtpos = mdt->detectorElement()->center(TubeLayer,m_idHelperSvc->mdtIdHelper().tube(mdt->identify())); for(uint l2=0; l2<l2cont->size(); l2++){ l2muon = l2cont->at(l2); if(l2muon->nMdtHits()==0){ @@ -1246,11 +1241,11 @@ if (m_useMdtData>0) { mdt_hash_ids_cache.push_back(*idit); mdtCols.push_back(*MDTcoll); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Selected Mdt Collection: " - << m_muonIdHelperTool->mdtIdHelper().show_to_string((*MDTcoll)->identify()) + << m_idHelperSvc->mdtIdHelper().show_to_string((*MDTcoll)->identify()) << " with size " << (*MDTcoll)->size()); else if (testRoiDrivenMode) ATH_MSG_INFO("Selected Mdt Collection: " - << m_muonIdHelperTool->mdtIdHelper().show_to_string((*MDTcoll)->identify()) + << m_idHelperSvc->mdtIdHelper().show_to_string((*MDTcoll)->identify()) << " with size " << (*MDTcoll)->size()); } if (mdtCols.empty()) { @@ -1281,22 +1276,22 @@ if (m_useMdtData>0) { if( TGCcoll == tgcPrds->end() ) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " not found in the cont. ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " not found in the cont. ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } if( (*TGCcoll)->size() == 0) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " is empty ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " is empty ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } @@ -1305,11 +1300,11 @@ if (m_useMdtData>0) { nTgcHits+=(*TGCcoll)->size(); // count hits for TrigMuonEFInfo tgcCols.push_back(*TGCcoll); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Selected Tgc Collection: " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*TGCcoll)->identify()) + << m_idHelperSvc->tgcIdHelper().show_to_string((*TGCcoll)->identify()) << " with size " << (*TGCcoll)->size()); else if (testRoiDrivenMode) ATH_MSG_INFO("Selected Tgc Collection: " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*TGCcoll)->identify()) + << m_idHelperSvc->tgcIdHelper().show_to_string((*TGCcoll)->identify()) << " with size " << (*TGCcoll)->size()); } @@ -1322,29 +1317,29 @@ if (m_useMdtData>0) { if( TGCcoll == tgcPrdsPriorBC->end() ) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " not found in the cont. ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " not found in the cont. ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } if( (*TGCcoll)->size() == 0) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " is empty ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " is empty ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } nTgcHits+=(*TGCcoll)->size(); // count hits for TrigMuonEFInfo tgcCols.push_back(*TGCcoll); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Selected Tgc Collection: " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*TGCcoll)->identify()) + << m_idHelperSvc->tgcIdHelper().show_to_string((*TGCcoll)->identify()) << " with size " << (*TGCcoll)->size()); } const TgcPrepDataContainer* tgcPrdsNextBC = 0; @@ -1364,29 +1359,29 @@ if (m_useMdtData>0) { if( TGCcoll == tgcPrdsNextBC->end() ) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " not found in the cont. ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " not found in the cont. ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } if( (*TGCcoll)->size() == 0) { if (msgLvl(MSG::VERBOSE)) { Identifier idColl; - IdContext tgcContext = m_muonIdHelperTool->tgcIdHelper().module_context(); - int code = m_muonIdHelperTool->tgcIdHelper().get_id(*idit, idColl, &tgcContext); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); + int code = m_idHelperSvc->tgcIdHelper().get_id(*idit, idColl, &tgcContext); ATH_MSG_VERBOSE("get_id code = " << code << " collection for tgc id hash = " << (int)*idit - << " is empty ext.id = " << m_muonIdHelperTool->tgcIdHelper().show_to_string(idColl)); + << " is empty ext.id = " << m_idHelperSvc->tgcIdHelper().show_to_string(idColl)); } continue; } nTgcHits+=(*TGCcoll)->size(); // count hits for TrigMuonEFInfo tgcCols.push_back(*TGCcoll); ATH_MSG_DEBUG("Selected Tgc Collection: " - << m_muonIdHelperTool->tgcIdHelper().show_to_string((*TGCcoll)->identify()) + << m_idHelperSvc->tgcIdHelper().show_to_string((*TGCcoll)->identify()) << " with size " << (*TGCcoll)->size()); } } @@ -1427,11 +1422,11 @@ if (m_useMdtData>0) { nCscHits+=(*CSCcoll)->size(); // count hits for TrigMuonEFInfo cscCols.push_back(*CSCcoll); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Selected Csc Collection: " - << m_muonIdHelperTool->cscIdHelper().show_to_string((*CSCcoll)->identify()) + << m_idHelperSvc->cscIdHelper().show_to_string((*CSCcoll)->identify()) << " with size " << (*CSCcoll)->size()); else if (testRoiDrivenMode) ATH_MSG_INFO("Selected Csc Collection: " - << m_muonIdHelperTool->cscIdHelper().show_to_string((*CSCcoll)->identify()) + << m_idHelperSvc->cscIdHelper().show_to_string((*CSCcoll)->identify()) << " with size " << (*CSCcoll)->size()); } if (cscCols.empty()) { @@ -2553,7 +2548,7 @@ int TrigMuonEFStandaloneTrackTool::segmentMonitoring(const std::vector< const Mu Trk::RIO_OnTrack* rio = const_cast<Trk::RIO_OnTrack*> ((*segment)->rioOnTrack(irio)); if(!rio) continue; Identifier rioId = rio->identify(); - if(m_muonIdHelperTool->mdtIdHelper().is_mdt(rioId)) { + if(m_idHelperSvc->mdtIdHelper().is_mdt(rioId)) { nMdt++; const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(rio); if(mdt!=0){ @@ -2566,11 +2561,11 @@ int TrigMuonEFStandaloneTrackTool::segmentMonitoring(const std::vector< const Mu monVars.mdtADC.push_back(mdtPrd->adc()); } else ATH_MSG_ERROR("cannot cast to MdtDriftCircle "); - } else if (m_muonIdHelperTool->cscIdHelper().is_csc(rioId)) { + } else if (m_idHelperSvc->isCsc(rioId)) { nCsc++; - } else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(rioId)) { + } else if (m_idHelperSvc->isRpc(rioId)) { nRpc++; - } else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(rioId)){ + } else if (m_idHelperSvc->isTgc(rioId)){ nTgc++; } } // end loop on rio diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h index 3d51cf88e3b8daeaae41991a4298a766d5f0bc3a..622a2677c5a4a2d7715c43898f1d5bcc15ff9e6f 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.h @@ -1,24 +1,24 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGMUONEF_TRIGMUONEFSTANDALONETRACKTOOL_H #define TRIGMUONEF_TRIGMUONEFSTANDALONETRACKTOOL_H -#include <vector> #include "SegmentCache.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkTrack/TrackCollection.h" - #include "TrigMuonToolInterfaces/ITrigMuonStandaloneTrackTool.h" #include "TrigMuonToolInterfaces/TrigMuonEFMonVars.h" #include "MuonRecToolInterfaces/IMuonTrackFinder.h" #include "MuonRecToolInterfaces/IMuonCombiTrackMaker.h" #include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonPattern/MuonPatternCombinationCollection.h" #include "TrkSegment/SegmentCollection.h" #include "TrigInterfaces/IMonitoredAlgo.h" @@ -34,13 +34,14 @@ #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/TrackParticleAuxContainer.h" #include "MuonCombinedEvent/MuonCandidateCollection.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include <fstream> #include "MuonSegmentMakerToolInterfaces/IMuonSegmentOverlapRemovalTool.h" #include "CxxUtils/checker_macros.h" ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // legacy trigger code +#include <vector> + #define DEBUG_ROI_VS_FULL false /** @@ -265,9 +266,7 @@ class TrigMuonEFStandaloneTrackTool : public AthAlgTool, // Cache the ActiveStoreSvc ptr ActiveStoreSvc* p_ActiveStore; - // Muon Id Helpers - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //Cache Rob Lists std::vector<uint32_t> m_MdtRobList; diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigT2CaloCommon/CMakeLists.txt index 21ed2e52dac0c83c9a415c8fe649b271cd987950..38fcdcf5050143c9182c205a283cc750f337bcb1 100644 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/CMakeLists.txt @@ -1,50 +1,8 @@ -################################################################################ -# Package: TrigT2CaloCommon -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT2CaloCommon ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloEvent - Calorimeter/CaloGeoHelpers - Calorimeter/CaloIdentifier - Calorimeter/CaloInterface - Control/AthenaBaseComps - Control/AthenaKernel - Control/StoreGate - Control/CxxUtils - DetectorDescription/IRegionSelector - DetectorDescription/Identifier - Event/ByteStreamCnvSvcBase - Event/EventInfo - Event/xAOD/xAODTrigCalo - ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream - ForwardDetectors/ZDC/ZdcEvent - ForwardDetectors/ZDC/ZdcRec - GaudiKernel - LArCalorimeter/LArCnv/LArByteStream - LArCalorimeter/LArRawUtils - LArCalorimeter/LArRecEvent - LArCalorimeter/LArCabling - TileCalorimeter/TileEvent - TileCalorimeter/TileSvc/TileByteStream - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigTools/TrigTimeAlgs - PRIVATE - Calorimeter/CaloDetDescr - Calorimeter/CaloUtils - Database/AthenaPOOL/AthenaPoolUtilities - Event/ByteStreamData - LArCalorimeter/LArElecCalib - LArCalorimeter/LArBadChannelTool - LArCalorimeter/LArIdentifier - LArCalorimeter/LArRecConditions - LArCalorimeter/LArRecUtils - Trigger/TrigT1/TrigT1Interfaces ) - # External dependencies: find_package( tdaq-common ) @@ -53,21 +11,18 @@ atlas_add_library( TrigT2CaloCommonLib src/*.cxx PUBLIC_HEADERS TrigT2CaloCommon INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier AthenaBaseComps AthenaKernel IRegionSelector Identifier EventInfo xAODTrigCalo ZdcEvent GaudiKernel LArRecEvent TileEvent TrigSteeringEvent StoreGateLib SGtests ByteStreamCnvSvcBaseLib ZdcByteStreamLib ZdcRecLib LArByteStreamLib LArRawUtilsLib LArCablingLib TileByteStreamLib TrigInterfacesLib TrigTimeAlgsLib CaloDetDescrLib CaloUtilsLib ByteStreamData_test LArRecUtilsLib - PRIVATE_LINK_LIBRARIES AthenaPoolUtilities ByteStreamData LArIdentifier LArRecConditions TrigT1Interfaces CxxUtils ) + LINK_LIBRARIES AthenaBaseComps AthenaKernel CaloEvent CaloGeoHelpers CaloIdentifier CxxUtils GaudiKernel IRegionSelector Identifier LArByteStreamLib LArCablingLib LArRawUtilsLib LArRecEvent TileByteStreamLib TileEvent TrigInterfacesLib TrigSteeringEvent TrigTimeAlgsLib ZdcByteStreamLib ZdcEvent ZdcRecLib xAODEventInfo xAODTrigCalo + PRIVATE_LINK_LIBRARIES ${TBB_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaMonitoringKernelLib AthenaPoolUtilities ByteStreamCnvSvcBaseLib ByteStreamData CaloDetDescrLib CaloUtilsLib EventInfo LArBadChannelToolLib LArElecCalib LArIdentifier LArRecConditions LArRecUtilsLib LumiBlockCompsLib StoreGateLib TestTools TrigCaloEvent TrigT1Interfaces ) atlas_add_component( TrigT2CaloCommon src/components/*.cxx LINK_LIBRARIES TrigT2CaloCommonLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) # Tests: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) # Helper to define unit tests running in a separate directory function( _add_test name script ) diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/doc/packagedoc.h b/Trigger/TrigAlgorithms/TrigT2CaloCommon/doc/packagedoc.h deleted file mode 100644 index 0c0e2b4744bcf8bfbf5a7d287ec43641e9e65e0b..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/doc/packagedoc.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - -@page TrigT2CaloCommon_page -@author Denis Oliveira -@author Carlos Osuna - -@section TrigT2CaloCommon_TrigT2CaloCommonOverview Overview -This package provides data access classes and bytestream converters -objects for calorimeter reconstruction algorithms for L2 trigger. -In addition it contains classes for (EM) calibration and geometry helpers. - - - -*/ diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py index 5a5fc342e5b8850caaaf8c5ba2af38ab01f206f5..b7354c7de4b14025813422b225fb290ae15b88bd 100644 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py +++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py @@ -20,7 +20,7 @@ def setMinimalCaloSetup() : def _algoHLTCaloCell(name="HLTCaloCellMaker", inputEDM='', outputEDM='CellsClusters', RoIMode=True, OutputLevel=ERROR) : if not inputEDM: from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection - inputEDM = mapThresholdToL1RoICollection("FS") + inputEDM = mapThresholdToL1RoICollection("FSNOSEED") setMinimalCaloSetup() from AthenaCommon.AppMgr import ServiceMgr as svcMgr from TrigCaloRec.TrigCaloRecConfig import HLTCaloCellMaker diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/CBNT_RoICaloCell.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/CBNT_RoICaloCell.py deleted file mode 100755 index 5fbac2db6df204a2747a6fccc1f32704ea861342..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/CBNT_RoICaloCell.py +++ /dev/null @@ -1,53 +0,0 @@ - -svcMgr.THistSvc.Output = ["AANT DATAFILE='ntuple2.root' TYPE='ROOT' OPT='RECREATE'"] - -NtupleName="ntuple1.root" -from AnalysisTools.AthAnalysisToolsConf import AANTupleStream -aa=AANTupleStream() -aa.ExtraRefNames = [ "StreamESD","StreamRDO" ] -aa.OutputName = NtupleName -aa.ExistDataHeader = False -aa.WriteInputDataHeader = True -topSequence+=aa - -from CBNT_Athena.CBNT_AthenaAwareCfg import CBNT_AthenaAware -CBNT_Athena = CBNT_AthenaAware() -topSequence+=CBNT_Athena -include( "CBNT_Athena/CBNT_EventInfo_jobOptions.py" ) - -from CaloIdentifier import SUBCALO -from CaloRec.CaloRecConf import CBNTAA_CaloCell - -theApp.Dlls += [ "CaloRec" ] -#CBNT_Athena.Members += [ "CBNT_CaloCell/CBNT_RoILArCaloCell" ] -CBNT_RoILArCaloCell = CBNTAA_CaloCell( "CBNT_RoILArCaloCell" ) -CBNT_Athena+=CBNT_RoILArCaloCell -CBNT_RoILArCaloCell.CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL] -#CBNT_RoILArCaloCell.NtupleLocID="/FILE1/CALO/168"; -CBNT_RoILArCaloCell.CellsName="HLT_TrigT2CaloEgammaCells" -CBNT_RoILArCaloCell.MaxNCells=10000 -CBNT_RoILArCaloCell.Suffix="LRoI" -CBNT_RoILArCaloCell.SaveDetInfo=True -CBNT_RoILArCaloCell.SaveTimeInfo=True -CBNT_RoILArCaloCell.OutputLevel=DEBUG - -#CBNT_Athena.Members += [ "CBNT_CaloCell/CBNT_RoITileCaloCell" ] -CBNT_RoITileCaloCell = CBNTAA_CaloCell( "CBNT_RoITileCaloCell" ) -CBNT_Athena+=CBNT_RoITileCaloCell -CBNT_RoITileCaloCell.CaloNums=[SUBCALO.TILE] -#CBNT_RoITileCaloCell.NtupleLocID="/FILE1/CALO/169"; -CBNT_RoITileCaloCell.CellsName="HLT_TrigT2CaloEgammaCells" -CBNT_RoITileCaloCell.MaxNCells=2000 -CBNT_RoITileCaloCell.Suffix="TRoI" -CBNT_RoITileCaloCell.SaveDetInfo=True -CBNT_RoITileCaloCell.SaveTimeInfo=True -CBNT_RoITileCaloCell.OutputLevel=VERBOSE - -from TrigT2CaloEgamma.TrigT2CaloEgammaConfig import T2CaloEgamma_eGamma -T2CaloEgamma_eGamma().StoreCells=True -T2CaloEgamma_eGamma().OutputLevel=0 -svcMgr.StoreGateSvc.Dump=True -for item in T2CaloEgamma_eGamma().IAlgToolList: - item.SaveCellsInContainer=True - item.ThresholdKeepCells=0.0 - diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/TileQualCut.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/TileQualCut.py deleted file mode 100644 index 38e43081b9516fd3c0c3040eca40aeb7fd5bb1ee..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/TileQualCut.py +++ /dev/null @@ -1 +0,0 @@ -ToolSvc.TileCellBuilder.QualityCut=15 diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/jobOfragment_TrigT2CaloCommon.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/jobOfragment_TrigT2CaloCommon.py deleted file mode 100755 index 62edd2dc15605487f487d4cd9d07f435c76ee19d..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/jobOfragment_TrigT2CaloCommon.py +++ /dev/null @@ -1,12 +0,0 @@ -#---------------------------------------------------- -# T2CaloCommon options -#---------------------------------------------------- -# Not to include this file more than once -include.block ("TrigT2CaloCommon/jobOfragment_TrigT2CaloCommon.py") - -theApp.DLLs += [ "TrigT2CaloCommon" ] - -T2CaloMon_g1_L2 = Algorithm( "T2CaloMon_g1_L2" ) -T2CaloMon_g1_L2.TrigMonitorTools =["T2CaloMonTool/t2calomontool"] - - diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/robhit.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/robhit.py deleted file mode 100644 index bb5271e484d0a2e286e086ff6d4ee51e399145bd..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/share/robhit.py +++ /dev/null @@ -1,1591 +0,0 @@ -#!/usr/bin/env tdaq_python - -# This ROB hitlist was generated automatically by rosconf-from-data.py -# It is a python application you can customize. -# Consult the eformat wiki page. -# Current date and time is 2011-04-06 12:47:53.079848 - -# original filename list -filename = [] - -filename.append('data11_7TeV.00177682.physics_Egamma.daq.RAW._lb0550._SFO-4._0001.data') - -# uniq'fied robhit list -robhit = [] - -robhit.append(0x00111705) -robhit.append(0x00111706) -robhit.append(0x00111707) -robhit.append(0x00111708) -robhit.append(0x00111709) -robhit.append(0x00111710) -robhit.append(0x00111711) -robhit.append(0x00111712) -robhit.append(0x00111714) -robhit.append(0x00111715) -robhit.append(0x00111716) -robhit.append(0x00111717) -robhit.append(0x00111718) -robhit.append(0x00111719) -robhit.append(0x00111720) -robhit.append(0x00111721) -robhit.append(0x00111805) -robhit.append(0x00111806) -robhit.append(0x00111807) -robhit.append(0x00111808) -robhit.append(0x00111809) -robhit.append(0x00111810) -robhit.append(0x00111811) -robhit.append(0x00111812) -robhit.append(0x00111814) -robhit.append(0x00111815) -robhit.append(0x00111816) -robhit.append(0x00111817) -robhit.append(0x00111818) -robhit.append(0x00111819) -robhit.append(0x00111820) -robhit.append(0x00111821) -robhit.append(0x00112405) -robhit.append(0x00112406) -robhit.append(0x00112407) -robhit.append(0x00112408) -robhit.append(0x00112409) -robhit.append(0x00112410) -robhit.append(0x00112411) -robhit.append(0x00112412) -robhit.append(0x00112414) -robhit.append(0x00112415) -robhit.append(0x00112416) -robhit.append(0x00112417) -robhit.append(0x00112418) -robhit.append(0x00112419) -robhit.append(0x00112420) -robhit.append(0x00112421) -robhit.append(0x00112505) -robhit.append(0x00112506) -robhit.append(0x00112507) -robhit.append(0x00112508) -robhit.append(0x00112509) -robhit.append(0x00112510) -robhit.append(0x00112511) -robhit.append(0x00112512) -robhit.append(0x00112514) -robhit.append(0x00112515) -robhit.append(0x00112516) -robhit.append(0x00112517) -robhit.append(0x00112518) -robhit.append(0x00112519) -robhit.append(0x00112520) -robhit.append(0x00112521) -robhit.append(0x00120205) -robhit.append(0x00120206) -robhit.append(0x00120207) -robhit.append(0x00120208) -robhit.append(0x00120209) -robhit.append(0x00120210) -robhit.append(0x00120211) -robhit.append(0x00120212) -robhit.append(0x00120214) -robhit.append(0x00120215) -robhit.append(0x00120216) -robhit.append(0x00120217) -robhit.append(0x00120218) -robhit.append(0x00120219) -robhit.append(0x00120220) -robhit.append(0x00120221) -robhit.append(0x00121609) -robhit.append(0x00121610) -robhit.append(0x00121611) -robhit.append(0x00121612) -robhit.append(0x00121614) -robhit.append(0x00121615) -robhit.append(0x00121616) -robhit.append(0x00121617) -robhit.append(0x00130005) -robhit.append(0x00130006) -robhit.append(0x00130007) -robhit.append(0x00130008) -robhit.append(0x00130009) -robhit.append(0x00130010) -robhit.append(0x00130011) -robhit.append(0x00130012) -robhit.append(0x00130014) -robhit.append(0x00130015) -robhit.append(0x00130016) -robhit.append(0x00130017) -robhit.append(0x00130018) -robhit.append(0x00130019) -robhit.append(0x00130020) -robhit.append(0x00130021) -robhit.append(0x00130105) -robhit.append(0x00130106) -robhit.append(0x00130107) -robhit.append(0x00130108) -robhit.append(0x00130109) -robhit.append(0x00130110) -robhit.append(0x00130111) -robhit.append(0x00130112) -robhit.append(0x00130114) -robhit.append(0x00130115) -robhit.append(0x00130116) -robhit.append(0x00130117) -robhit.append(0x00130118) -robhit.append(0x00130119) -robhit.append(0x00130120) -robhit.append(0x00130121) -robhit.append(0x00130307) -robhit.append(0x00130308) -robhit.append(0x00130309) -robhit.append(0x00130310) -robhit.append(0x00130311) -robhit.append(0x00130312) -robhit.append(0x00130314) -robhit.append(0x00130315) -robhit.append(0x00130316) -robhit.append(0x00130317) -robhit.append(0x00130318) -robhit.append(0x00130319) -robhit.append(0x00210000) -robhit.append(0x00210001) -robhit.append(0x00210002) -robhit.append(0x00210003) -robhit.append(0x00210004) -robhit.append(0x00210005) -robhit.append(0x00210006) -robhit.append(0x00210007) -robhit.append(0x00210008) -robhit.append(0x00210009) -robhit.append(0x0021000a) -robhit.append(0x00210100) -robhit.append(0x00210101) -robhit.append(0x00210102) -robhit.append(0x00210103) -robhit.append(0x00210104) -robhit.append(0x00210105) -robhit.append(0x00210106) -robhit.append(0x00210107) -robhit.append(0x00210108) -robhit.append(0x00210109) -robhit.append(0x0021010a) -robhit.append(0x00220000) -robhit.append(0x00220001) -robhit.append(0x00220002) -robhit.append(0x00220003) -robhit.append(0x00220004) -robhit.append(0x00220005) -robhit.append(0x00220006) -robhit.append(0x00220007) -robhit.append(0x00220008) -robhit.append(0x00220009) -robhit.append(0x0022000a) -robhit.append(0x00220100) -robhit.append(0x00220101) -robhit.append(0x00220102) -robhit.append(0x00220103) -robhit.append(0x00220104) -robhit.append(0x00220105) -robhit.append(0x00220106) -robhit.append(0x00220107) -robhit.append(0x00220108) -robhit.append(0x00220109) -robhit.append(0x0022010a) -robhit.append(0x00230000) -robhit.append(0x00230001) -robhit.append(0x00230002) -robhit.append(0x00230003) -robhit.append(0x00230004) -robhit.append(0x00230005) -robhit.append(0x00230006) -robhit.append(0x00230007) -robhit.append(0x00230008) -robhit.append(0x00230009) -robhit.append(0x0023000a) -robhit.append(0x00230100) -robhit.append(0x00230101) -robhit.append(0x00230102) -robhit.append(0x00230103) -robhit.append(0x00230104) -robhit.append(0x00230105) -robhit.append(0x00230106) -robhit.append(0x00230107) -robhit.append(0x00230108) -robhit.append(0x00230109) -robhit.append(0x0023010a) -robhit.append(0x0023010b) -robhit.append(0x00240000) -robhit.append(0x00240001) -robhit.append(0x00240002) -robhit.append(0x00240003) -robhit.append(0x00240004) -robhit.append(0x00240005) -robhit.append(0x00240006) -robhit.append(0x00240007) -robhit.append(0x00240008) -robhit.append(0x00240009) -robhit.append(0x0024000a) -robhit.append(0x0024000b) -robhit.append(0x00240100) -robhit.append(0x00240101) -robhit.append(0x00240102) -robhit.append(0x00240103) -robhit.append(0x00240104) -robhit.append(0x00240105) -robhit.append(0x00240106) -robhit.append(0x00240107) -robhit.append(0x00240108) -robhit.append(0x00240109) -robhit.append(0x0024010a) -robhit.append(0x00310100) -robhit.append(0x00310200) -robhit.append(0x00310300) -robhit.append(0x00310400) -robhit.append(0x00310500) -robhit.append(0x00310600) -robhit.append(0x00310700) -robhit.append(0x00310800) -robhit.append(0x00310900) -robhit.append(0x00310a00) -robhit.append(0x00310b00) -robhit.append(0x00310c00) -robhit.append(0x00310d00) -robhit.append(0x00310e00) -robhit.append(0x00310f00) -robhit.append(0x00311000) -robhit.append(0x00311100) -robhit.append(0x00311200) -robhit.append(0x00311300) -robhit.append(0x00311400) -robhit.append(0x00311500) -robhit.append(0x00311600) -robhit.append(0x00311700) -robhit.append(0x00311800) -robhit.append(0x00311900) -robhit.append(0x00311a00) -robhit.append(0x00311b00) -robhit.append(0x00311c00) -robhit.append(0x00311d00) -robhit.append(0x00311e00) -robhit.append(0x00311f00) -robhit.append(0x00312000) -robhit.append(0x00320100) -robhit.append(0x00320200) -robhit.append(0x00320300) -robhit.append(0x00320400) -robhit.append(0x00320500) -robhit.append(0x00320600) -robhit.append(0x00320700) -robhit.append(0x00320800) -robhit.append(0x00320900) -robhit.append(0x00320a00) -robhit.append(0x00320b00) -robhit.append(0x00320c00) -robhit.append(0x00320d00) -robhit.append(0x00320e00) -robhit.append(0x00320f00) -robhit.append(0x00321000) -robhit.append(0x00321100) -robhit.append(0x00321200) -robhit.append(0x00321300) -robhit.append(0x00321400) -robhit.append(0x00321500) -robhit.append(0x00321600) -robhit.append(0x00321700) -robhit.append(0x00321800) -robhit.append(0x00321900) -robhit.append(0x00321a00) -robhit.append(0x00321b00) -robhit.append(0x00321c00) -robhit.append(0x00321d00) -robhit.append(0x00321e00) -robhit.append(0x00321f00) -robhit.append(0x00322000) -robhit.append(0x00330101) -robhit.append(0x00330102) -robhit.append(0x00330201) -robhit.append(0x00330202) -robhit.append(0x00330301) -robhit.append(0x00330302) -robhit.append(0x00330401) -robhit.append(0x00330402) -robhit.append(0x00330501) -robhit.append(0x00330502) -robhit.append(0x00330601) -robhit.append(0x00330602) -robhit.append(0x00330701) -robhit.append(0x00330702) -robhit.append(0x00330801) -robhit.append(0x00330802) -robhit.append(0x00330901) -robhit.append(0x00330902) -robhit.append(0x00330a01) -robhit.append(0x00330a02) -robhit.append(0x00330b01) -robhit.append(0x00330b02) -robhit.append(0x00330c01) -robhit.append(0x00330c02) -robhit.append(0x00330d01) -robhit.append(0x00330d02) -robhit.append(0x00330e01) -robhit.append(0x00330e02) -robhit.append(0x00330f01) -robhit.append(0x00330f02) -robhit.append(0x00331001) -robhit.append(0x00331002) -robhit.append(0x00331101) -robhit.append(0x00331102) -robhit.append(0x00331201) -robhit.append(0x00331202) -robhit.append(0x00331301) -robhit.append(0x00331302) -robhit.append(0x00331401) -robhit.append(0x00331402) -robhit.append(0x00331501) -robhit.append(0x00331502) -robhit.append(0x00331601) -robhit.append(0x00331602) -robhit.append(0x00331701) -robhit.append(0x00331702) -robhit.append(0x00331801) -robhit.append(0x00331802) -robhit.append(0x00331901) -robhit.append(0x00331902) -robhit.append(0x00331a01) -robhit.append(0x00331a02) -robhit.append(0x00331b01) -robhit.append(0x00331b02) -robhit.append(0x00331c01) -robhit.append(0x00331c02) -robhit.append(0x00331d01) -robhit.append(0x00331d02) -robhit.append(0x00331e01) -robhit.append(0x00331e02) -robhit.append(0x00331f01) -robhit.append(0x00331f02) -robhit.append(0x00332001) -robhit.append(0x00332002) -robhit.append(0x00340101) -robhit.append(0x00340102) -robhit.append(0x00340201) -robhit.append(0x00340202) -robhit.append(0x00340301) -robhit.append(0x00340302) -robhit.append(0x00340401) -robhit.append(0x00340402) -robhit.append(0x00340501) -robhit.append(0x00340502) -robhit.append(0x00340601) -robhit.append(0x00340602) -robhit.append(0x00340701) -robhit.append(0x00340702) -robhit.append(0x00340801) -robhit.append(0x00340802) -robhit.append(0x00340901) -robhit.append(0x00340902) -robhit.append(0x00340a01) -robhit.append(0x00340a02) -robhit.append(0x00340b01) -robhit.append(0x00340b02) -robhit.append(0x00340c01) -robhit.append(0x00340c02) -robhit.append(0x00340d01) -robhit.append(0x00340d02) -robhit.append(0x00340e01) -robhit.append(0x00340e02) -robhit.append(0x00340f01) -robhit.append(0x00340f02) -robhit.append(0x00341001) -robhit.append(0x00341002) -robhit.append(0x00341101) -robhit.append(0x00341102) -robhit.append(0x00341201) -robhit.append(0x00341202) -robhit.append(0x00341301) -robhit.append(0x00341302) -robhit.append(0x00341401) -robhit.append(0x00341402) -robhit.append(0x00341501) -robhit.append(0x00341502) -robhit.append(0x00341601) -robhit.append(0x00341602) -robhit.append(0x00341701) -robhit.append(0x00341702) -robhit.append(0x00341801) -robhit.append(0x00341802) -robhit.append(0x00341901) -robhit.append(0x00341902) -robhit.append(0x00341a01) -robhit.append(0x00341a02) -robhit.append(0x00341b01) -robhit.append(0x00341b02) -robhit.append(0x00341c01) -robhit.append(0x00341c02) -robhit.append(0x00341d01) -robhit.append(0x00341d02) -robhit.append(0x00341e01) -robhit.append(0x00341e02) -robhit.append(0x00341f01) -robhit.append(0x00341f02) -robhit.append(0x00342001) -robhit.append(0x00342002) -robhit.append(0x00410000) -robhit.append(0x00410001) -robhit.append(0x00410002) -robhit.append(0x00410003) -robhit.append(0x00410004) -robhit.append(0x00410005) -robhit.append(0x00410006) -robhit.append(0x00410007) -robhit.append(0x00410008) -robhit.append(0x00410009) -robhit.append(0x0041000a) -robhit.append(0x0041000b) -robhit.append(0x0041000c) -robhit.append(0x0041000d) -robhit.append(0x0041000e) -robhit.append(0x0041000f) -robhit.append(0x00410010) -robhit.append(0x00410011) -robhit.append(0x00410012) -robhit.append(0x00410013) -robhit.append(0x00410014) -robhit.append(0x00410015) -robhit.append(0x00410016) -robhit.append(0x00410017) -robhit.append(0x00410018) -robhit.append(0x00410019) -robhit.append(0x0041001a) -robhit.append(0x0041001b) -robhit.append(0x0041001c) -robhit.append(0x0041001d) -robhit.append(0x0041001e) -robhit.append(0x0041001f) -robhit.append(0x00410020) -robhit.append(0x00410021) -robhit.append(0x00410022) -robhit.append(0x00410023) -robhit.append(0x00410024) -robhit.append(0x00410025) -robhit.append(0x00410026) -robhit.append(0x00410027) -robhit.append(0x00410028) -robhit.append(0x00410029) -robhit.append(0x0041002a) -robhit.append(0x0041002b) -robhit.append(0x0041002c) -robhit.append(0x0041002d) -robhit.append(0x0041002e) -robhit.append(0x0041002f) -robhit.append(0x00410030) -robhit.append(0x00410031) -robhit.append(0x00410032) -robhit.append(0x00410033) -robhit.append(0x00410034) -robhit.append(0x00410035) -robhit.append(0x00410036) -robhit.append(0x00410037) -robhit.append(0x00410038) -robhit.append(0x00410039) -robhit.append(0x0041003a) -robhit.append(0x0041003b) -robhit.append(0x0041003c) -robhit.append(0x0041003d) -robhit.append(0x0041003e) -robhit.append(0x0041003f) -robhit.append(0x00410040) -robhit.append(0x00410041) -robhit.append(0x00410042) -robhit.append(0x00410043) -robhit.append(0x00410044) -robhit.append(0x00410045) -robhit.append(0x00410046) -robhit.append(0x00410047) -robhit.append(0x00410048) -robhit.append(0x00410049) -robhit.append(0x0041004a) -robhit.append(0x0041004b) -robhit.append(0x0041004c) -robhit.append(0x0041004d) -robhit.append(0x0041004e) -robhit.append(0x0041004f) -robhit.append(0x00410050) -robhit.append(0x00410051) -robhit.append(0x00410052) -robhit.append(0x00410053) -robhit.append(0x00410054) -robhit.append(0x00410055) -robhit.append(0x00410056) -robhit.append(0x00410057) -robhit.append(0x00410058) -robhit.append(0x00410059) -robhit.append(0x0041005a) -robhit.append(0x0041005b) -robhit.append(0x0041005c) -robhit.append(0x0041005d) -robhit.append(0x0041005e) -robhit.append(0x0041005f) -robhit.append(0x00410060) -robhit.append(0x00410061) -robhit.append(0x00410062) -robhit.append(0x00410063) -robhit.append(0x00410064) -robhit.append(0x00410065) -robhit.append(0x00410066) -robhit.append(0x00410067) -robhit.append(0x00410068) -robhit.append(0x00410069) -robhit.append(0x0041006a) -robhit.append(0x0041006b) -robhit.append(0x0041006c) -robhit.append(0x0041006d) -robhit.append(0x0041006e) -robhit.append(0x0041006f) -robhit.append(0x00410070) -robhit.append(0x00410071) -robhit.append(0x00410072) -robhit.append(0x00410073) -robhit.append(0x00410074) -robhit.append(0x00410075) -robhit.append(0x00410076) -robhit.append(0x00410077) -robhit.append(0x00410078) -robhit.append(0x00410079) -robhit.append(0x0041007a) -robhit.append(0x0041007b) -robhit.append(0x0041007c) -robhit.append(0x0041007d) -robhit.append(0x0041007e) -robhit.append(0x0041007f) -robhit.append(0x00410080) -robhit.append(0x00410081) -robhit.append(0x00410082) -robhit.append(0x00410083) -robhit.append(0x00410084) -robhit.append(0x00410085) -robhit.append(0x00410086) -robhit.append(0x00410087) -robhit.append(0x00410088) -robhit.append(0x00410089) -robhit.append(0x0041008a) -robhit.append(0x0041008b) -robhit.append(0x0041008c) -robhit.append(0x0041008d) -robhit.append(0x0041008e) -robhit.append(0x0041008f) -robhit.append(0x00410090) -robhit.append(0x00410091) -robhit.append(0x00410092) -robhit.append(0x00410093) -robhit.append(0x00410094) -robhit.append(0x00410095) -robhit.append(0x00410096) -robhit.append(0x00410097) -robhit.append(0x00410098) -robhit.append(0x00410099) -robhit.append(0x0041009a) -robhit.append(0x0041009b) -robhit.append(0x0041009c) -robhit.append(0x0041009d) -robhit.append(0x0041009e) -robhit.append(0x0041009f) -robhit.append(0x004100a0) -robhit.append(0x004100a1) -robhit.append(0x004100a2) -robhit.append(0x004100a3) -robhit.append(0x004100a4) -robhit.append(0x004100a5) -robhit.append(0x004100a6) -robhit.append(0x004100a7) -robhit.append(0x004100a8) -robhit.append(0x004100a9) -robhit.append(0x004100aa) -robhit.append(0x004100ab) -robhit.append(0x004100ac) -robhit.append(0x004100ad) -robhit.append(0x004100ae) -robhit.append(0x004100af) -robhit.append(0x004100b0) -robhit.append(0x004100b1) -robhit.append(0x004100b2) -robhit.append(0x004100b3) -robhit.append(0x004100b4) -robhit.append(0x004100b5) -robhit.append(0x004100b6) -robhit.append(0x004100b7) -robhit.append(0x004100b8) -robhit.append(0x004100b9) -robhit.append(0x004100ba) -robhit.append(0x004100bb) -robhit.append(0x004100bc) -robhit.append(0x004100bd) -robhit.append(0x004100be) -robhit.append(0x004100bf) -robhit.append(0x004100c0) -robhit.append(0x004100c1) -robhit.append(0x004100c2) -robhit.append(0x004100c3) -robhit.append(0x004100c4) -robhit.append(0x004100c5) -robhit.append(0x004100c6) -robhit.append(0x004100c7) -robhit.append(0x004100c8) -robhit.append(0x004100c9) -robhit.append(0x004100ca) -robhit.append(0x004100cb) -robhit.append(0x004100cc) -robhit.append(0x004100cd) -robhit.append(0x004100ce) -robhit.append(0x004100cf) -robhit.append(0x004100d0) -robhit.append(0x004100d1) -robhit.append(0x004100d2) -robhit.append(0x004100d3) -robhit.append(0x004100d4) -robhit.append(0x004100d5) -robhit.append(0x004100d6) -robhit.append(0x004100d7) -robhit.append(0x004100d8) -robhit.append(0x004100d9) -robhit.append(0x004100da) -robhit.append(0x004100db) -robhit.append(0x004100dc) -robhit.append(0x004100dd) -robhit.append(0x004100de) -robhit.append(0x004100df) -robhit.append(0x00420000) -robhit.append(0x00420001) -robhit.append(0x00420002) -robhit.append(0x00420003) -robhit.append(0x00420004) -robhit.append(0x00420005) -robhit.append(0x00420006) -robhit.append(0x00420007) -robhit.append(0x00420008) -robhit.append(0x00420009) -robhit.append(0x0042000a) -robhit.append(0x0042000b) -robhit.append(0x0042000c) -robhit.append(0x0042000d) -robhit.append(0x0042000e) -robhit.append(0x0042000f) -robhit.append(0x00420010) -robhit.append(0x00420011) -robhit.append(0x00420012) -robhit.append(0x00420013) -robhit.append(0x00420014) -robhit.append(0x00420015) -robhit.append(0x00420016) -robhit.append(0x00420017) -robhit.append(0x00420018) -robhit.append(0x00420019) -robhit.append(0x0042001a) -robhit.append(0x0042001b) -robhit.append(0x0042001c) -robhit.append(0x0042001d) -robhit.append(0x0042001e) -robhit.append(0x0042001f) -robhit.append(0x00420020) -robhit.append(0x00420021) -robhit.append(0x00420022) -robhit.append(0x00420023) -robhit.append(0x00420024) -robhit.append(0x00420025) -robhit.append(0x00420026) -robhit.append(0x00420027) -robhit.append(0x00420028) -robhit.append(0x00420029) -robhit.append(0x0042002a) -robhit.append(0x0042002b) -robhit.append(0x0042002c) -robhit.append(0x0042002d) -robhit.append(0x0042002e) -robhit.append(0x0042002f) -robhit.append(0x00420030) -robhit.append(0x00420031) -robhit.append(0x00420032) -robhit.append(0x00420033) -robhit.append(0x00420034) -robhit.append(0x00420035) -robhit.append(0x00420036) -robhit.append(0x00420037) -robhit.append(0x00420038) -robhit.append(0x00420039) -robhit.append(0x0042003a) -robhit.append(0x0042003b) -robhit.append(0x0042003c) -robhit.append(0x0042003d) -robhit.append(0x0042003e) -robhit.append(0x0042003f) -robhit.append(0x00420040) -robhit.append(0x00420041) -robhit.append(0x00420042) -robhit.append(0x00420043) -robhit.append(0x00420044) -robhit.append(0x00420045) -robhit.append(0x00420046) -robhit.append(0x00420047) -robhit.append(0x00420048) -robhit.append(0x00420049) -robhit.append(0x0042004a) -robhit.append(0x0042004b) -robhit.append(0x0042004c) -robhit.append(0x0042004d) -robhit.append(0x0042004e) -robhit.append(0x0042004f) -robhit.append(0x00420050) -robhit.append(0x00420051) -robhit.append(0x00420052) -robhit.append(0x00420053) -robhit.append(0x00420054) -robhit.append(0x00420055) -robhit.append(0x00420056) -robhit.append(0x00420057) -robhit.append(0x00420058) -robhit.append(0x00420059) -robhit.append(0x0042005a) -robhit.append(0x0042005b) -robhit.append(0x0042005c) -robhit.append(0x0042005d) -robhit.append(0x0042005e) -robhit.append(0x0042005f) -robhit.append(0x00420060) -robhit.append(0x00420061) -robhit.append(0x00420062) -robhit.append(0x00420063) -robhit.append(0x00420064) -robhit.append(0x00420065) -robhit.append(0x00420066) -robhit.append(0x00420067) -robhit.append(0x00420068) -robhit.append(0x00420069) -robhit.append(0x0042006a) -robhit.append(0x0042006b) -robhit.append(0x0042006c) -robhit.append(0x0042006d) -robhit.append(0x0042006e) -robhit.append(0x0042006f) -robhit.append(0x00420070) -robhit.append(0x00420071) -robhit.append(0x00420072) -robhit.append(0x00420073) -robhit.append(0x00420074) -robhit.append(0x00420075) -robhit.append(0x00420076) -robhit.append(0x00420077) -robhit.append(0x00420078) -robhit.append(0x00420079) -robhit.append(0x0042007a) -robhit.append(0x0042007b) -robhit.append(0x0042007c) -robhit.append(0x0042007d) -robhit.append(0x0042007e) -robhit.append(0x0042007f) -robhit.append(0x00420080) -robhit.append(0x00420081) -robhit.append(0x00420082) -robhit.append(0x00420083) -robhit.append(0x00420084) -robhit.append(0x00420085) -robhit.append(0x00420086) -robhit.append(0x00420087) -robhit.append(0x00420088) -robhit.append(0x00420089) -robhit.append(0x0042008a) -robhit.append(0x0042008b) -robhit.append(0x0042008c) -robhit.append(0x0042008d) -robhit.append(0x0042008e) -robhit.append(0x0042008f) -robhit.append(0x00420090) -robhit.append(0x00420091) -robhit.append(0x00420092) -robhit.append(0x00420093) -robhit.append(0x00420094) -robhit.append(0x00420095) -robhit.append(0x00420096) -robhit.append(0x00420097) -robhit.append(0x00420098) -robhit.append(0x00420099) -robhit.append(0x0042009a) -robhit.append(0x0042009b) -robhit.append(0x0042009c) -robhit.append(0x0042009d) -robhit.append(0x0042009e) -robhit.append(0x0042009f) -robhit.append(0x004200a0) -robhit.append(0x004200a1) -robhit.append(0x004200a2) -robhit.append(0x004200a3) -robhit.append(0x004200a4) -robhit.append(0x004200a5) -robhit.append(0x004200a6) -robhit.append(0x004200a7) -robhit.append(0x004200a8) -robhit.append(0x004200a9) -robhit.append(0x004200aa) -robhit.append(0x004200ab) -robhit.append(0x004200ac) -robhit.append(0x004200ad) -robhit.append(0x004200ae) -robhit.append(0x004200af) -robhit.append(0x004200b0) -robhit.append(0x004200b1) -robhit.append(0x004200b2) -robhit.append(0x004200b3) -robhit.append(0x004200b4) -robhit.append(0x004200b5) -robhit.append(0x004200b6) -robhit.append(0x004200b7) -robhit.append(0x004200b8) -robhit.append(0x004200b9) -robhit.append(0x004200ba) -robhit.append(0x004200bb) -robhit.append(0x004200bc) -robhit.append(0x004200bd) -robhit.append(0x004200be) -robhit.append(0x004200bf) -robhit.append(0x004200c0) -robhit.append(0x004200c1) -robhit.append(0x004200c2) -robhit.append(0x004200c3) -robhit.append(0x004200c4) -robhit.append(0x004200c5) -robhit.append(0x004200c6) -robhit.append(0x004200c7) -robhit.append(0x004200c8) -robhit.append(0x004200c9) -robhit.append(0x004200ca) -robhit.append(0x004200cb) -robhit.append(0x004200cc) -robhit.append(0x004200cd) -robhit.append(0x004200ce) -robhit.append(0x004200cf) -robhit.append(0x004200d0) -robhit.append(0x004200d1) -robhit.append(0x004200d2) -robhit.append(0x004200d3) -robhit.append(0x004200d4) -robhit.append(0x004200d5) -robhit.append(0x004200d6) -robhit.append(0x004200d7) -robhit.append(0x004200d8) -robhit.append(0x004200d9) -robhit.append(0x004200da) -robhit.append(0x004200db) -robhit.append(0x004200dc) -robhit.append(0x004200dd) -robhit.append(0x004200de) -robhit.append(0x004200df) -robhit.append(0x00430000) -robhit.append(0x00430001) -robhit.append(0x00430002) -robhit.append(0x00430003) -robhit.append(0x00430004) -robhit.append(0x00430005) -robhit.append(0x00430006) -robhit.append(0x00430007) -robhit.append(0x00430008) -robhit.append(0x00430009) -robhit.append(0x0043000a) -robhit.append(0x0043000b) -robhit.append(0x0043000c) -robhit.append(0x0043000d) -robhit.append(0x0043000e) -robhit.append(0x0043000f) -robhit.append(0x00430010) -robhit.append(0x00430011) -robhit.append(0x00430012) -robhit.append(0x00430013) -robhit.append(0x00430014) -robhit.append(0x00430015) -robhit.append(0x00430016) -robhit.append(0x00430017) -robhit.append(0x00430018) -robhit.append(0x00430019) -robhit.append(0x0043001a) -robhit.append(0x0043001b) -robhit.append(0x0043001c) -robhit.append(0x0043001d) -robhit.append(0x0043001e) -robhit.append(0x0043001f) -robhit.append(0x00430020) -robhit.append(0x00430021) -robhit.append(0x00430022) -robhit.append(0x00430023) -robhit.append(0x00430024) -robhit.append(0x00430025) -robhit.append(0x00430026) -robhit.append(0x00430027) -robhit.append(0x00430028) -robhit.append(0x00430029) -robhit.append(0x0043002a) -robhit.append(0x0043002b) -robhit.append(0x0043002c) -robhit.append(0x0043002d) -robhit.append(0x0043002e) -robhit.append(0x0043002f) -robhit.append(0x00430030) -robhit.append(0x00430031) -robhit.append(0x00430032) -robhit.append(0x00430033) -robhit.append(0x00430034) -robhit.append(0x00430035) -robhit.append(0x00430036) -robhit.append(0x00430037) -robhit.append(0x00430038) -robhit.append(0x00430039) -robhit.append(0x0043003a) -robhit.append(0x0043003b) -robhit.append(0x0043003c) -robhit.append(0x0043003d) -robhit.append(0x0043003e) -robhit.append(0x0043003f) -robhit.append(0x00430040) -robhit.append(0x00430041) -robhit.append(0x00430042) -robhit.append(0x00430043) -robhit.append(0x00430044) -robhit.append(0x00430045) -robhit.append(0x00430046) -robhit.append(0x00430047) -robhit.append(0x00430048) -robhit.append(0x00430049) -robhit.append(0x0043004a) -robhit.append(0x0043004b) -robhit.append(0x0043004c) -robhit.append(0x0043004d) -robhit.append(0x0043004e) -robhit.append(0x0043004f) -robhit.append(0x00430050) -robhit.append(0x00430051) -robhit.append(0x00430052) -robhit.append(0x00430053) -robhit.append(0x00430054) -robhit.append(0x00430055) -robhit.append(0x00430056) -robhit.append(0x00430057) -robhit.append(0x00430058) -robhit.append(0x00430059) -robhit.append(0x0043005a) -robhit.append(0x0043005b) -robhit.append(0x0043005c) -robhit.append(0x0043005d) -robhit.append(0x0043005e) -robhit.append(0x0043005f) -robhit.append(0x00430060) -robhit.append(0x00430061) -robhit.append(0x00430062) -robhit.append(0x00430063) -robhit.append(0x00430064) -robhit.append(0x00430065) -robhit.append(0x00430066) -robhit.append(0x00430067) -robhit.append(0x00430068) -robhit.append(0x00430069) -robhit.append(0x0043006a) -robhit.append(0x0043006b) -robhit.append(0x0043006c) -robhit.append(0x0043006d) -robhit.append(0x0043006e) -robhit.append(0x0043006f) -robhit.append(0x00430070) -robhit.append(0x00430071) -robhit.append(0x00430072) -robhit.append(0x00430073) -robhit.append(0x00430074) -robhit.append(0x00430075) -robhit.append(0x00430076) -robhit.append(0x00430077) -robhit.append(0x00430078) -robhit.append(0x00430079) -robhit.append(0x0043007a) -robhit.append(0x0043007b) -robhit.append(0x0043007c) -robhit.append(0x0043007d) -robhit.append(0x0043007e) -robhit.append(0x0043007f) -robhit.append(0x00430080) -robhit.append(0x00430081) -robhit.append(0x00430082) -robhit.append(0x00430083) -robhit.append(0x00430084) -robhit.append(0x00430085) -robhit.append(0x00430086) -robhit.append(0x00430087) -robhit.append(0x00430088) -robhit.append(0x00430089) -robhit.append(0x00440000) -robhit.append(0x00440001) -robhit.append(0x00440002) -robhit.append(0x00440003) -robhit.append(0x00440004) -robhit.append(0x00440005) -robhit.append(0x00440006) -robhit.append(0x00440007) -robhit.append(0x00440008) -robhit.append(0x00440009) -robhit.append(0x0044000a) -robhit.append(0x0044000b) -robhit.append(0x0044000c) -robhit.append(0x0044000d) -robhit.append(0x0044000e) -robhit.append(0x0044000f) -robhit.append(0x00440010) -robhit.append(0x00440011) -robhit.append(0x00440012) -robhit.append(0x00440013) -robhit.append(0x00440014) -robhit.append(0x00440015) -robhit.append(0x00440016) -robhit.append(0x00440017) -robhit.append(0x00440018) -robhit.append(0x00440019) -robhit.append(0x0044001a) -robhit.append(0x0044001b) -robhit.append(0x0044001c) -robhit.append(0x0044001d) -robhit.append(0x0044001e) -robhit.append(0x0044001f) -robhit.append(0x00440020) -robhit.append(0x00440021) -robhit.append(0x00440022) -robhit.append(0x00440023) -robhit.append(0x00440024) -robhit.append(0x00440025) -robhit.append(0x00440026) -robhit.append(0x00440027) -robhit.append(0x00440028) -robhit.append(0x00440029) -robhit.append(0x0044002a) -robhit.append(0x0044002b) -robhit.append(0x0044002c) -robhit.append(0x0044002d) -robhit.append(0x0044002e) -robhit.append(0x0044002f) -robhit.append(0x00440030) -robhit.append(0x00440031) -robhit.append(0x00440032) -robhit.append(0x00440033) -robhit.append(0x00440034) -robhit.append(0x00440035) -robhit.append(0x00440036) -robhit.append(0x00440037) -robhit.append(0x00440038) -robhit.append(0x00440039) -robhit.append(0x0044003a) -robhit.append(0x0044003b) -robhit.append(0x0044003c) -robhit.append(0x0044003d) -robhit.append(0x0044003e) -robhit.append(0x0044003f) -robhit.append(0x00440040) -robhit.append(0x00440041) -robhit.append(0x00440042) -robhit.append(0x00440043) -robhit.append(0x00440044) -robhit.append(0x00440045) -robhit.append(0x00440046) -robhit.append(0x00440047) -robhit.append(0x00440048) -robhit.append(0x00440049) -robhit.append(0x0044004a) -robhit.append(0x0044004b) -robhit.append(0x0044004c) -robhit.append(0x0044004d) -robhit.append(0x0044004e) -robhit.append(0x0044004f) -robhit.append(0x00440050) -robhit.append(0x00440051) -robhit.append(0x00440052) -robhit.append(0x00440053) -robhit.append(0x00440054) -robhit.append(0x00440055) -robhit.append(0x00440056) -robhit.append(0x00440057) -robhit.append(0x00440058) -robhit.append(0x00440059) -robhit.append(0x0044005a) -robhit.append(0x0044005b) -robhit.append(0x0044005c) -robhit.append(0x0044005d) -robhit.append(0x0044005e) -robhit.append(0x0044005f) -robhit.append(0x00440060) -robhit.append(0x00440061) -robhit.append(0x00440062) -robhit.append(0x00440063) -robhit.append(0x00440064) -robhit.append(0x00440065) -robhit.append(0x00440066) -robhit.append(0x00440067) -robhit.append(0x00440068) -robhit.append(0x00440069) -robhit.append(0x0044006a) -robhit.append(0x0044006b) -robhit.append(0x0044006c) -robhit.append(0x0044006d) -robhit.append(0x0044006e) -robhit.append(0x0044006f) -robhit.append(0x00440070) -robhit.append(0x00440071) -robhit.append(0x00440072) -robhit.append(0x00440073) -robhit.append(0x00440074) -robhit.append(0x00440075) -robhit.append(0x00440076) -robhit.append(0x00440077) -robhit.append(0x00440078) -robhit.append(0x00440079) -robhit.append(0x0044007a) -robhit.append(0x0044007b) -robhit.append(0x0044007c) -robhit.append(0x0044007d) -robhit.append(0x0044007e) -robhit.append(0x0044007f) -robhit.append(0x00440080) -robhit.append(0x00440081) -robhit.append(0x00440082) -robhit.append(0x00440083) -robhit.append(0x00440084) -robhit.append(0x00440085) -robhit.append(0x00440086) -robhit.append(0x00440087) -robhit.append(0x00440088) -robhit.append(0x00440089) -robhit.append(0x00450000) -robhit.append(0x00450001) -robhit.append(0x00450002) -robhit.append(0x00450003) -robhit.append(0x00450004) -robhit.append(0x00450005) -robhit.append(0x00450006) -robhit.append(0x00450007) -robhit.append(0x00450008) -robhit.append(0x00450009) -robhit.append(0x0045000a) -robhit.append(0x0045000b) -robhit.append(0x00460000) -robhit.append(0x00460001) -robhit.append(0x00460002) -robhit.append(0x00460003) -robhit.append(0x00460004) -robhit.append(0x00460005) -robhit.append(0x00460006) -robhit.append(0x00460007) -robhit.append(0x00460008) -robhit.append(0x00460009) -robhit.append(0x0046000a) -robhit.append(0x0046000b) -robhit.append(0x00470000) -robhit.append(0x00470001) -robhit.append(0x00470002) -robhit.append(0x00470003) -robhit.append(0x00470004) -robhit.append(0x00470005) -robhit.append(0x00470006) -robhit.append(0x00480000) -robhit.append(0x00480001) -robhit.append(0x00480002) -robhit.append(0x00480003) -robhit.append(0x00480004) -robhit.append(0x00480005) -robhit.append(0x00480006) -robhit.append(0x00510000) -robhit.append(0x00510001) -robhit.append(0x00510002) -robhit.append(0x00510003) -robhit.append(0x00510004) -robhit.append(0x00510005) -robhit.append(0x00510006) -robhit.append(0x00510007) -robhit.append(0x00510008) -robhit.append(0x00510009) -robhit.append(0x0051000a) -robhit.append(0x0051000b) -robhit.append(0x0051000c) -robhit.append(0x0051000d) -robhit.append(0x0051000e) -robhit.append(0x0051000f) -robhit.append(0x00520000) -robhit.append(0x00520001) -robhit.append(0x00520002) -robhit.append(0x00520003) -robhit.append(0x00520004) -robhit.append(0x00520005) -robhit.append(0x00520006) -robhit.append(0x00520007) -robhit.append(0x00520008) -robhit.append(0x00520009) -robhit.append(0x0052000a) -robhit.append(0x0052000b) -robhit.append(0x0052000c) -robhit.append(0x0052000d) -robhit.append(0x0052000e) -robhit.append(0x0052000f) -robhit.append(0x00530000) -robhit.append(0x00530001) -robhit.append(0x00530002) -robhit.append(0x00530003) -robhit.append(0x00530004) -robhit.append(0x00530005) -robhit.append(0x00530006) -robhit.append(0x00530007) -robhit.append(0x00530008) -robhit.append(0x00530009) -robhit.append(0x0053000a) -robhit.append(0x0053000b) -robhit.append(0x0053000c) -robhit.append(0x0053000d) -robhit.append(0x0053000e) -robhit.append(0x0053000f) -robhit.append(0x00540000) -robhit.append(0x00540001) -robhit.append(0x00540002) -robhit.append(0x00540003) -robhit.append(0x00540004) -robhit.append(0x00540005) -robhit.append(0x00540006) -robhit.append(0x00540007) -robhit.append(0x00540008) -robhit.append(0x00540009) -robhit.append(0x0054000a) -robhit.append(0x0054000b) -robhit.append(0x0054000c) -robhit.append(0x0054000d) -robhit.append(0x0054000e) -robhit.append(0x0054000f) -robhit.append(0x00610000) -robhit.append(0x00610001) -robhit.append(0x00610002) -robhit.append(0x00610003) -robhit.append(0x00610004) -robhit.append(0x00610005) -robhit.append(0x00610006) -robhit.append(0x00610007) -robhit.append(0x00610008) -robhit.append(0x00610009) -robhit.append(0x0061000a) -robhit.append(0x0061000b) -robhit.append(0x0061000c) -robhit.append(0x0061000d) -robhit.append(0x0061000e) -robhit.append(0x0061000f) -robhit.append(0x00610010) -robhit.append(0x00610011) -robhit.append(0x00610012) -robhit.append(0x00610013) -robhit.append(0x00610014) -robhit.append(0x00610015) -robhit.append(0x00610016) -robhit.append(0x00610017) -robhit.append(0x00610018) -robhit.append(0x00610019) -robhit.append(0x0061001a) -robhit.append(0x0061001b) -robhit.append(0x0061001c) -robhit.append(0x0061001d) -robhit.append(0x0061001e) -robhit.append(0x0061001f) -robhit.append(0x00610020) -robhit.append(0x00610021) -robhit.append(0x00610022) -robhit.append(0x00610023) -robhit.append(0x00610024) -robhit.append(0x00610025) -robhit.append(0x00610026) -robhit.append(0x00610027) -robhit.append(0x00610028) -robhit.append(0x00610029) -robhit.append(0x0061002a) -robhit.append(0x0061002b) -robhit.append(0x0061002c) -robhit.append(0x0061002d) -robhit.append(0x0061002e) -robhit.append(0x0061002f) -robhit.append(0x00610030) -robhit.append(0x00610031) -robhit.append(0x00620000) -robhit.append(0x00620001) -robhit.append(0x00620002) -robhit.append(0x00620003) -robhit.append(0x00620004) -robhit.append(0x00620005) -robhit.append(0x00620006) -robhit.append(0x00620007) -robhit.append(0x00620008) -robhit.append(0x00620009) -robhit.append(0x0062000a) -robhit.append(0x0062000b) -robhit.append(0x0062000c) -robhit.append(0x0062000d) -robhit.append(0x0062000e) -robhit.append(0x0062000f) -robhit.append(0x00620010) -robhit.append(0x00620011) -robhit.append(0x00620012) -robhit.append(0x00620013) -robhit.append(0x00620014) -robhit.append(0x00620015) -robhit.append(0x00620016) -robhit.append(0x00620017) -robhit.append(0x00620018) -robhit.append(0x00620019) -robhit.append(0x0062001a) -robhit.append(0x0062001b) -robhit.append(0x0062001c) -robhit.append(0x0062001d) -robhit.append(0x0062001e) -robhit.append(0x0062001f) -robhit.append(0x00620020) -robhit.append(0x00620021) -robhit.append(0x00620022) -robhit.append(0x00620023) -robhit.append(0x00620024) -robhit.append(0x00620025) -robhit.append(0x00620026) -robhit.append(0x00620027) -robhit.append(0x00620028) -robhit.append(0x00620029) -robhit.append(0x0062002a) -robhit.append(0x0062002b) -robhit.append(0x0062002c) -robhit.append(0x0062002d) -robhit.append(0x0062002e) -robhit.append(0x0062002f) -robhit.append(0x00620030) -robhit.append(0x00620031) -robhit.append(0x00630000) -robhit.append(0x00630001) -robhit.append(0x00630002) -robhit.append(0x00630003) -robhit.append(0x00630004) -robhit.append(0x00630005) -robhit.append(0x00630006) -robhit.append(0x00630007) -robhit.append(0x00630008) -robhit.append(0x00630009) -robhit.append(0x0063000a) -robhit.append(0x0063000b) -robhit.append(0x0063000c) -robhit.append(0x0063000d) -robhit.append(0x0063000e) -robhit.append(0x0063000f) -robhit.append(0x00630010) -robhit.append(0x00630011) -robhit.append(0x00630012) -robhit.append(0x00630013) -robhit.append(0x00630014) -robhit.append(0x00630015) -robhit.append(0x00630016) -robhit.append(0x00630017) -robhit.append(0x00630018) -robhit.append(0x00630019) -robhit.append(0x0063001a) -robhit.append(0x0063001b) -robhit.append(0x0063001c) -robhit.append(0x0063001d) -robhit.append(0x0063001e) -robhit.append(0x0063001f) -robhit.append(0x00630020) -robhit.append(0x00630021) -robhit.append(0x00630022) -robhit.append(0x00630023) -robhit.append(0x00630024) -robhit.append(0x00630025) -robhit.append(0x00630026) -robhit.append(0x00630027) -robhit.append(0x00630028) -robhit.append(0x00630029) -robhit.append(0x0063002a) -robhit.append(0x0063002b) -robhit.append(0x0063002c) -robhit.append(0x0063002d) -robhit.append(0x0063002e) -robhit.append(0x0063002f) -robhit.append(0x00630030) -robhit.append(0x00630031) -robhit.append(0x00630032) -robhit.append(0x00630033) -robhit.append(0x00640000) -robhit.append(0x00640001) -robhit.append(0x00640002) -robhit.append(0x00640003) -robhit.append(0x00640004) -robhit.append(0x00640005) -robhit.append(0x00640006) -robhit.append(0x00640007) -robhit.append(0x00640008) -robhit.append(0x00640009) -robhit.append(0x0064000a) -robhit.append(0x0064000b) -robhit.append(0x0064000c) -robhit.append(0x0064000d) -robhit.append(0x0064000e) -robhit.append(0x0064000f) -robhit.append(0x00640010) -robhit.append(0x00640011) -robhit.append(0x00640012) -robhit.append(0x00640013) -robhit.append(0x00640014) -robhit.append(0x00640015) -robhit.append(0x00640016) -robhit.append(0x00640017) -robhit.append(0x00640018) -robhit.append(0x00640019) -robhit.append(0x0064001a) -robhit.append(0x0064001b) -robhit.append(0x0064001c) -robhit.append(0x0064001d) -robhit.append(0x0064001e) -robhit.append(0x0064001f) -robhit.append(0x00640020) -robhit.append(0x00640021) -robhit.append(0x00640022) -robhit.append(0x00640023) -robhit.append(0x00640024) -robhit.append(0x00640025) -robhit.append(0x00640026) -robhit.append(0x00640027) -robhit.append(0x00640028) -robhit.append(0x00640029) -robhit.append(0x0064002a) -robhit.append(0x0064002b) -robhit.append(0x0064002c) -robhit.append(0x0064002d) -robhit.append(0x0064002e) -robhit.append(0x0064002f) -robhit.append(0x00640030) -robhit.append(0x00640031) -robhit.append(0x00640032) -robhit.append(0x00640033) -robhit.append(0x00650000) -robhit.append(0x00650001) -robhit.append(0x00650002) -robhit.append(0x00650003) -robhit.append(0x00650004) -robhit.append(0x00650005) -robhit.append(0x00650006) -robhit.append(0x00650007) -robhit.append(0x00650008) -robhit.append(0x00650009) -robhit.append(0x0065000a) -robhit.append(0x0065000b) -robhit.append(0x0065000c) -robhit.append(0x0065000d) -robhit.append(0x0065000e) -robhit.append(0x0065000f) -robhit.append(0x00660000) -robhit.append(0x00660001) -robhit.append(0x00660002) -robhit.append(0x00660003) -robhit.append(0x00660004) -robhit.append(0x00660005) -robhit.append(0x00660006) -robhit.append(0x00660007) -robhit.append(0x00660008) -robhit.append(0x00660009) -robhit.append(0x0066000a) -robhit.append(0x0066000b) -robhit.append(0x0066000c) -robhit.append(0x0066000d) -robhit.append(0x0066000e) -robhit.append(0x0066000f) -robhit.append(0x00670001) -robhit.append(0x00670002) -robhit.append(0x00670003) -robhit.append(0x00670004) -robhit.append(0x00670005) -robhit.append(0x00670006) -robhit.append(0x00670007) -robhit.append(0x00670008) -robhit.append(0x00670009) -robhit.append(0x0067000a) -robhit.append(0x0067000b) -robhit.append(0x0067000c) -robhit.append(0x00680001) -robhit.append(0x00680002) -robhit.append(0x00680003) -robhit.append(0x00680004) -robhit.append(0x00680005) -robhit.append(0x00680006) -robhit.append(0x00680007) -robhit.append(0x00680008) -robhit.append(0x00680009) -robhit.append(0x0068000a) -robhit.append(0x0068000b) -robhit.append(0x0068000c) -robhit.append(0x00690005) -robhit.append(0x00690007) -robhit.append(0x00690009) -robhit.append(0x00690011) -robhit.append(0x00690015) -robhit.append(0x00690017) -robhit.append(0x00690019) -robhit.append(0x00690021) -robhit.append(0x006a0005) -robhit.append(0x006a0007) -robhit.append(0x006a0009) -robhit.append(0x006a0011) -robhit.append(0x006a0015) -robhit.append(0x006a0017) -robhit.append(0x006a0019) -robhit.append(0x006a0021) -robhit.append(0x00710000) -robhit.append(0x00710001) -robhit.append(0x00710002) -robhit.append(0x00710003) -robhit.append(0x00710004) -robhit.append(0x00710005) -robhit.append(0x00710006) -robhit.append(0x00710007) -robhit.append(0x00710010) -robhit.append(0x00710011) -robhit.append(0x00710012) -robhit.append(0x00710013) -robhit.append(0x00710014) -robhit.append(0x00710015) -robhit.append(0x00710016) -robhit.append(0x00710017) -robhit.append(0x00710020) -robhit.append(0x00710021) -robhit.append(0x00710022) -robhit.append(0x00710023) -robhit.append(0x00710024) -robhit.append(0x00710025) -robhit.append(0x00710026) -robhit.append(0x00710027) -robhit.append(0x00710030) -robhit.append(0x00710031) -robhit.append(0x00710032) -robhit.append(0x00710033) -robhit.append(0x00710034) -robhit.append(0x00710035) -robhit.append(0x00710036) -robhit.append(0x00710037) -robhit.append(0x00720008) -robhit.append(0x00720009) -robhit.append(0x0072000a) -robhit.append(0x0072000b) -robhit.append(0x00720028) -robhit.append(0x00720029) -robhit.append(0x0072002a) -robhit.append(0x0072002b) -robhit.append(0x0074000c) -robhit.append(0x0074000d) -robhit.append(0x0074001c) -robhit.append(0x0074001d) -robhit.append(0x0074002c) -robhit.append(0x0074002d) -robhit.append(0x0074003c) -robhit.append(0x0074003d) -robhit.append(0x00760000) -robhit.append(0x00770000) -robhit.append(0x0081000a) -robhit.append(0x0081000c) -robhit.append(0x00820000) -robhit.append(0x00830000) -robhit.append(0x00830001) -robhit.append(0x00830002) -robhit.append(0x00830003) - -import logging -logging.info('ROB hit list (extracted from %d file/s) contains %d unique hits' % (len(filename), len(robhit))) diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/CMakeLists.txt index b2eb6197ad7ecf47f3b5264092110089da4cb460..d48260682b33191ea52906735515c89db4d6d9e7 100644 --- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/CMakeLists.txt @@ -1,43 +1,13 @@ -################################################################################ -# Package: TrigT2CaloEgamma -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT2CaloEgamma ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloEvent - Calorimeter/CaloGeoHelpers - Control/AthenaBaseComps - Control/CxxUtils - Event/xAOD/xAODTrigCalo - Event/xAOD/xAODTrigRinger - GaudiKernel - Reconstruction/egamma/egammaInterfaces - Trigger/TrigAlgorithms/TrigT2CaloCommon - Trigger/TrigEvent/TrigSteeringEvent - PRIVATE - Calorimeter/CaloDetDescr - Calorimeter/CaloIdentifier - Control/AthLinks - DetectorDescription/IRegionSelector - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigTools/TrigT2CaloCalibration - Trigger/TrigTools/TrigTimeAlgs - Reconstruction/egamma/egammaUtils - ) - # Component(s) in the package: atlas_add_component( TrigT2CaloEgamma src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloEvent CaloGeoHelpers xAODTrigCalo xAODTrigRinger GaudiKernel TrigT2CaloCommonLib TrigSteeringEvent CaloDetDescrLib CaloIdentifier AthLinks IRegionSelector TrigT1Interfaces TrigT2CaloCalibrationLib TrigTimeAlgsLib egammaUtils) + LINK_LIBRARIES AthLinks AthenaBaseComps AthenaMonitoringKernelLib CaloDetDescrLib CaloEvent CaloGeoHelpers CaloIdentifier CxxUtils GaudiKernel IRegionSelector StoreGateLib TrigCaloEvent TrigSteeringEvent TrigT1Interfaces TrigT2CaloCalibrationLib TrigT2CaloCommonLib TrigTimeAlgsLib egammaUtils xAODTrigCalo xAODTrigRinger ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - -# Python code checking: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIConfig.py b/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIConfig.py index 46bcc7b6e0a6fff43ed2b52d35582eebfce8562d..674fd6c07e5ca4e81fbfd3a1de7b4d53024c2fe3 100755 --- a/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIConfig.py +++ b/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIConfig.py @@ -30,3 +30,6 @@ class TrigmuRoIMTConfig (TrigmuRoIMT): super( TrigmuRoIMTConfig, self ).__init__( name ) self.MonTool = TrigmuRoIMTMonitoring() + + from TrigMuonRoITools.TrigMuonRoIToolsConfig import TrigMuonRoIToolCfg + self.RoITool = TrigMuonRoIToolCfg() diff --git a/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIMonitoring.py b/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIMonitoring.py index 1223c7b430a2da5e3e7f031b3318840d0d3e7bf6..2f0c15d0c47a67a2d2c268bca2dba5337513ddea 100755 --- a/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIMonitoring.py +++ b/Trigger/TrigAlgorithms/TrigmuRoI/python/TrigmuRoIMonitoring.py @@ -48,6 +48,6 @@ class TrigmuRoIMTMonitoring(GenericMonitoringTool): super(TrigmuRoIMTMonitoring, self).__init__( name ) self.HistPath = name - self.defineHistogram('RpcOutOfTime', type='TH1F', title="Distribution of the BCID difference for the Rpc RoI out of Time; (Muon RoI BCID - Event BCID)",xbins=21, xmin=-10.5, xmax=10.5) - self.defineHistogram('TgcOutOfTime', type='TH1F', title="Distribution of the BCID difference for the Tgc RoI out of Time; (Muon RoI BCID - Event BCID)",xbins=21, xmin=-10.5, xmax=10.5) - self.defineHistogram('EtaOutOfTime, PhiOutOfTime', type='TH2F', title="Eta vs Phi of the Mupon RoI out of time; Eta; Phi",bins=108, xmin=-2.7, xmax=2.7, ybins=96, ymin=-3.1416, ymax=3.1416 ) + self.defineHistogram('RpcOutOfTime', type='TH1F', path='EXPERT', title="Distribution of the BCID difference for the Rpc RoI out of Time; (Muon RoI BCID - Event BCID)",xbins=21, xmin=-10.5, xmax=10.5) + self.defineHistogram('TgcOutOfTime', type='TH1F', path='EXPERT', title="Distribution of the BCID difference for the Tgc RoI out of Time; (Muon RoI BCID - Event BCID)",xbins=21, xmin=-10.5, xmax=10.5) + self.defineHistogram('EtaOutOfTime, PhiOutOfTime', type='TH2F', path='EXPERT', title="Eta vs Phi of the Mupon RoI out of time; Eta; Phi", xbins=108, xmin=-2.7, xmax=2.7, ybins=96, ymin=-3.1416, ymax=3.1416 ) diff --git a/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt b/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt index 8de76ddcbdd1bc2e73b54daeb9601be5cdcb1ce5..4e05b729c533fd69c6bca8b0bb7ad1a845a4e2c6 100644 --- a/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt @@ -1,39 +1,8 @@ -# $Id: CMakeLists.txt 782843 2016-11-07 20:39:27Z krasznaa $ -################################################################################ -# Package: TrigBunchCrossingTool -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigBunchCrossingTool ) -# Declare the package's dependencies: -if( XAOD_STANDALONE ) - atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Trigger/TrigAnalysis/TrigAnalysisInterfaces - PRIVATE - Control/CxxUtils - Event/xAOD/xAODEventInfo - Event/xAOD/xAODTrigger - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data ) -else() - atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - GaudiKernel - Trigger/TrigAnalysis/TrigAnalysisInterfaces - PRIVATE - Control/CxxUtils - Control/AthenaKernel - Database/AthenaPOOL/AthenaPoolUtilities - Event/xAOD/xAODEventInfo - Event/xAOD/xAODTrigger - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data ) -endif() - # External dependencies: find_package( CORAL QUIET COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( ROOT COMPONENTS Net Core Tree MathCore Hist RIO pthread ) @@ -47,7 +16,7 @@ if( XAOD_STANDALONE ) LINK_LIBRARIES AsgTools TrigAnalysisInterfaces PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} xAODEventInfo - xAODTrigger TrigConfL1Data ) + xAODTrigger TrigConfL1Data TrigConfInterfaces ) else() atlas_add_component( TrigBunchCrossingTool TrigBunchCrossingTool/*.h src/*.cxx Root/*.h Root/*.cxx @@ -55,7 +24,7 @@ else() src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AsgTools - TrigAnalysisInterfaces GaudiKernel AthenaKernel + TrigAnalysisInterfaces TrigConfInterfaces GaudiKernel AthenaKernel AthenaPoolUtilities xAODEventInfo xAODTrigger TrigConfL1Data ) endif() @@ -69,7 +38,7 @@ atlas_add_test( ut_static_bunch_tool_test Root/count_bunch_neighbors.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo xAODTrigger - TrigConfL1Data ) + TrigConfL1Data TrigAnalysisInterfaces ) atlas_add_test( ut_web_bunch_tool_test SOURCES @@ -81,13 +50,8 @@ atlas_add_test( ut_web_bunch_tool_test Root/count_bunch_neighbors.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo xAODTrigger - TrigConfL1Data + TrigConfL1Data TrigAnalysisInterfaces PROPERTIES TIMEOUT 300 ) # Install files from the package: -atlas_install_headers( TrigBunchCrossingTool ) -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - -atlas_add_test( flake8_scripts - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/scripts - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigAnalysis/TrigBunchCrossingTool/scripts/StandaloneBunchgroupLookup.py b/Trigger/TrigAnalysis/TrigBunchCrossingTool/scripts/StandaloneBunchgroupLookup.py deleted file mode 100755 index 55684db2f5e0f9287af4528156eb82cf64316ede..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigBunchCrossingTool/scripts/StandaloneBunchgroupLookup.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/env python - -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from TrigBunchCrossingTool.StandaloneBunchgroupHandler import BunchgroupHandler - -run = 165954 -lb = 44 -bcid = 1 -bg = BunchgroupHandler() -bg.verbose = False - -# specify run, lb, bcid as input -# this function would be called per event -# on the first time round for a given run, all data are loaded from COOL -# and stored in memory, all other calls use the data in memory -before, after = bg.getNeighbourPattern(run,lb,bcid) - -# return values are (binary) lists of neighbouring BCIDs, +- 32 crossings; -# '1': filled crossing, '0': empty crossing -if bg.verbose: - print ("Before",before) - print ("After",after) - -# function to directly access lists of neighbouring filled BCIDs -l1, l2 = bg.getNeighbourBcids(run,lb,bcid) -print ("Run",run,"neighbouring filled BCIDs for BCID",bcid,":",sorted(l1), sorted(l2)) - -pos = bg.getTrainPosition(run,lb,bcid) -print ("BCID",bcid,"is at position",pos,"in the bunch train") - -# test cycle -for lumiBl in range(100): - for bunch in range(3564): - before, after = bg.getNeighbourBcids(run,lumiBl,bunch) diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx index 3ef882f7ebc07762292a6786338d89c6168bb26a..2e9f805e41f6218e27fe3cd8c98dc95a67056eed 100644 --- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx +++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaAnalysisBaseTool.cxx @@ -1025,12 +1025,12 @@ bool TrigEgammaAnalysisBaseTool::getCaloRings( const xAOD::Electron * el, std::v if(!el) return false; ringsE.clear(); - auto ringsELReader = xAOD::getCaloRingsReader(); + const auto& ringsELReader = xAOD::getCaloRingsReader(); // First, check if we can retrieve decoration: const xAOD::CaloRingsLinks *caloRingsLinks(nullptr); try { - ATH_MSG_DEBUG("getCaloRingsReader->operator()(*el)"); - caloRingsLinks = &(ringsELReader->operator()(*el)); + ATH_MSG_DEBUG("getCaloRingsReader()(*el)"); + caloRingsLinks = &(ringsELReader(*el)); } catch ( const std::exception &e) { ATH_MSG_WARNING("Couldn't retrieve CaloRingsELVec. Reason: " << e.what()); return false; diff --git a/Trigger/TrigAnalysis/TrigEgammaEmulationTool/Root/TrigEgammaSelectorBaseTool.cxx b/Trigger/TrigAnalysis/TrigEgammaEmulationTool/Root/TrigEgammaSelectorBaseTool.cxx index 6c7bd10482f34b543a4fecb3ed4e9f60b21089c5..f05b694ec0390e56c8e8e9c86156e558ad8d7567 100644 --- a/Trigger/TrigAnalysis/TrigEgammaEmulationTool/Root/TrigEgammaSelectorBaseTool.cxx +++ b/Trigger/TrigAnalysis/TrigEgammaEmulationTool/Root/TrigEgammaSelectorBaseTool.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration * */ @@ -83,43 +83,3 @@ const xAOD::TrigRingerRings* TrigEgammaSelectorBaseTool::getTrigCaloRings( const } return nullptr; } - -//!========================================================================== -/* -bool TrigEgammaSelectorBaseTool::getCaloRings( const xAOD::Electron *el, std::vector<float> &ringsE ){ - if(!el) return false; - ringsE.clear(); - auto m_ringsELReader = xAOD::getCaloRingsReader(); - - // First, check if we can retrieve decoration: - const xAOD::CaloRingsELVec *caloRingsELVec(nullptr); - try { - caloRingsELVec = &(m_ringsELReader->operator()(*el)); - } catch ( const std::exception &e) { - ATH_MSG_WARNING("Couldn't retrieve CaloRingsELVec. Reason: " << e.what()); - } - - if ( caloRingsELVec->empty() ){ - ATH_MSG_WARNING("Particle does not have CaloRings decoratorion."); - return false; - } - - // For now, we are using only the first cluster - const xAOD::CaloRings *clrings = *(caloRingsELVec->at(0)); - // For now, we are using only the first cluster - - if(clrings) clrings->exportRingsTo(ringsE); - else{ - ATH_MSG_WARNING("There is a problem when try to attack the rings vector using exportRigsTo() method."); - return false; - } - return true; -} -#else -bool TrigEgammaSelectorBaseTool::getCaloRings( const xAOD::Electron *el, std::vector<float> & ){ - if(!el) return false; - return true; -} -*/ - - diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h new file mode 100644 index 0000000000000000000000000000000000000000..53ae3c41e9fb1aa87c991efaa048ffee0425d115 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h @@ -0,0 +1,53 @@ +/* emacs: this is -*- c++ -*- */ +/** + ** @file AnalysisConfigMT_Ntuple.h + ** + ** Ehis is the MT analysis class - we really don;t want to + ** have to duplicate everything so we instead just inherit + ** from the normal class and just implement the new loop + ** method + ** + ** + ** @author mark sutton + ** @date Monday 18th May 2020 22:55:37 BST + ** + ** Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + **/ + + +#ifndef TrigInDetAnalysisExample_AnalysisConfigMT_Ntuple_H +#define TrigInDetAnalysisExample_AnalysisConfigMT_Ntuple_H + +#include "TrigInDetAnalysisExample/AnalysisConfig_Ntuple.h" + + +class AnalysisConfigMT_Ntuple : public AnalysisConfig_Ntuple { + +public: + + // Full constructor: test/reference/selection + // - analysisInstanceName: the name of the analysis chain being created + // - xxxChainName: the name of the chain to be used as test/reference/selection; must be "StoreGate" in case of direct access to SG containers + // - xxxType: the type of tracks to be retrieved from the test/reference/selection chain or container + // - xxxKey: the key for tracks to be retrieved from the test/reference/selection chain or container + // - roiInfo: in case the test chain is a real chain, this is used to specify RoI widths; in case the test chain is a fake chain, this is used + // for RoI position too + // - all standard operations are performed in loops over 0=test 1=reference 2=selection + + AnalysisConfigMT_Ntuple( TIDARoiDescriptor* roiInfo, + const std::vector<std::string>& chainNames, std::string outputFileName="TrkNtuple.root", + double tauEtCutOffline=0.0, int TruthPdgId = 0, bool keepAllEvents_=false ) : + AnalysisConfig_Ntuple( roiInfo, chainNames, outputFileName, tauEtCutOffline, TruthPdgId, keepAllEvents_ ) + { } + + virtual ~AnalysisConfigMT_Ntuple() { } + +protected: + + virtual void loop(); + +}; + + +#endif // TrigInDetAnalysisExample_AnalysisConfigMT_Ntuple_H + diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h index f38a8b025d7618db130d77772fc6ad1d7898bd1f..938129828f10bb17d7366bb0dce7604a94283a32 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h @@ -226,19 +226,12 @@ protected: virtual void loop() { - // bool dbg = true; - // std::cout << "AnalysisConfigMT_Tier0::loop() for " << T_AnalysisConfig<T>::m_analysisInstanceName << std::endl; - // std::cout << "\n\n\tAnalysisConfigMT_Tier0::loop() for " << T_AnalysisConfig<T>::m_analysisInstanceName << std::endl; - - if( m_provider->msg().level() <= MSG::VERBOSE) { m_provider->msg(MSG::VERBOSE) << "AnalysisConfigMT_Tier0::loop() for " << T_AnalysisConfig<T>::m_analysisInstanceName << endmsg; } - // std::cout << "\tAnalysisConfigMT_Tier0::loop() for " << T_AnalysisConfig<T>::m_analysisInstanceName << std::endl; - // get (offline) beam position double xbeam = 0; double ybeam = 0; @@ -253,12 +246,8 @@ protected: } } - // m_first = true; - if ( m_first ) { - // std::cout << "\tloop() first event setup" << std::endl; - m_first = false; m_provider->msg(MSG::VERBOSE) << " using beam position\tx=" << xbeam << "\ty=" << ybeam << endmsg; @@ -267,8 +256,6 @@ protected: std::vector<std::string> configuredChains = (*(m_tdt))->getListOfTriggers("L2_.*, EF_.*, HLT_.*"); - // std::cout << "\tloop() (first eveny printout) Configured chains " << configuredChains.size() << std::endl; - for ( unsigned i=0 ; i<configuredChains.size() ; i++ ) { // std::cout << "Configured chain " << configuredChains[i] << std::endl; m_provider->msg(MSG::VERBOSE) << "Chain " << configuredChains[i] << endmsg; @@ -629,17 +616,10 @@ protected: if ( m_chainNames[ichain].passed() ) decisiontype = _decisiontype; else decisiontype = TrigDefs::alsoDeactivateTEs; + /// useful debug information to be kept in for the time being // if ( decisiontype==TrigDefs::requireDecision ) std::cout << "\tSUTT TrigDefs::requireDecision " << decisiontype << std::endl; // if ( decisiontype==TrigDefs::Physics ) std::cout << "\tSUTT TrigDefs::Physics " << decisiontype << std::endl; - - /// and the index of the collection (if any) - /// disable this feature at the moment - put back in when we have the more important - /// stuff working - // const std::string& key_index_string = m_chainNames[ichain].extra(); - // unsigned key_index = 0; - // if ( key_index_string!="" ) key_index = std::atoi( key_index_string.c_str() ); - if ( chainname!="" && m_provider->msg().level() <= MSG::VERBOSE ) { m_provider->msg(MSG::VERBOSE) << "status for chain " << chainname @@ -651,6 +631,7 @@ protected: m_provider->msg(MSG::VERBOSE) << chainname << "\tpassed: " << (*m_tdt)->isPassed( chainname ) << endmsg; } + /// useful debug information to be kept in // std::cout << "\tstatus for chain " << chainname // << "\tpass " << (*m_tdt)->isPassed( chainname ) // << "\tpassdt " << (*m_tdt)->isPassed( chainname, decisiontype ) @@ -662,7 +643,6 @@ protected: if ( chainname!="" && !this->m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) ) continue; - // std::cout << "\tchain " << m_chainNames[ichain] << "\tchainname " << chainname << "\tvtx " << vtx_name << "\troi " << roi_name << std::endl; /// Get chain combinations and loop on them /// - loop made on chain selected as the one steering RoI creation @@ -691,7 +671,6 @@ protected: chain.addRoi( *roiInfo ); - if ( m_provider->evtStore()->template contains<xAOD::TrackParticleContainer>(key) ) { this->template selectTracks<xAOD::TrackParticleContainer>( m_selectorTest, key ); refbeamspot = this->template getBeamspot<xAOD::TrackParticleContainer>( key ); @@ -736,33 +715,21 @@ protected: if ( roi_key=="SuperRoi" && iroi>1 ) continue; - // std::cout << "\troi: get link ..." << std::endl; + // std::cout << "\troi: get link " << roi_key << " ..." << std::endl; const ElementLink<TrigRoiDescriptorCollection> roi_link = roi_info.link; - // std::cout << "\troi: read link ..." << std::endl; - const TrigRoiDescriptor* const* roiptr = roi_link.cptr(); - // std::cout << "\troi: link ..." << roiptr << std::endl; - - if ( roiptr == 0 ) { - // std::cerr << "\treadback link is null DAMMIT !!!" << std::endl; continue; } // std::cout << "\troi: link deref ..." << *roiptr << std::endl; - if (m_provider->msg().level() <= MSG::VERBOSE) { m_provider->msg(MSG::VERBOSE) << " RoI descriptor for seeded chain " << chainname << " " << **roiptr << endmsg; } - - - // TIDARoiDescriptor* roiInfo = 0; - - // if ( dbg ) std::cout << "\tlink looks ok ..." << std::endl; TIDARoiDescriptor* roiInfo = new TIDARoiDescriptor( TIDARoiDescriptorBuilder(**roiptr) ); @@ -776,7 +743,6 @@ protected: // beamspot stuff not needed for xAOD::TrackParticles - /// create analysis chain chain.addRoi( *roiInfo ); @@ -787,47 +753,36 @@ protected: chain.back().addTracks(testtracks); -#if 0 - if ( dbg ) { - std::cout << "\tTIDA analysis for chain: " << chainname << "\t key: " << key << "\t" << **roiptr << std::endl; - std::cout << "\tcollections: " << chain.back() << std::endl; - } -#endif - - if ( roiInfo ) delete roiInfo; - - } - - -#if 0 - if ( vtx_name!="" ) { - - m_provider->msg(MSG::VERBOSE) << "\tFetch xAOD::VertexContainer for chain " << chainConfig << " with key " << vtx_name << endmsg; - - std::vector< Trig::Feature<xAOD::VertexContainer> > xaodtrigvertices = c->get<xAOD::VertexContainer>(vtx_name); - - if ( xaodtrigvertices.empty() ) { - m_provider->msg(MSG::WARNING) << "\tNo xAOD::VertexContainer for chain " << chainConfig << " for key " << vtx_name << endmsg; - } + /// now get the vertices - else { + if ( vtx_name!="" ) { - m_provider->msg(MSG::VERBOSE) << "\txAOD::VertexContainer found with size " << xaodtrigvertices.size() << "\t" << vtx_name << endmsg; + m_provider->msg(MSG::VERBOSE) << "\tFetch xAOD::VertexContainer for chain " << chainConfig << " with key " << vtx_name << endmsg; + - for ( unsigned iv=0 ; iv<xaodtrigvertices.size() ; iv++ ) { - - const xAOD::VertexContainer* vert = xaodtrigvertices[iv].cptr(); - - m_provider->msg(MSG::VERBOSE) << "\t" << iv << " xAOD VxContainer for " << chainConfig << " " << vert << " key " << vtx_name << endmsg; - - xAOD::VertexContainer::const_iterator vtxitr = vert->begin(); + std::pair< xAOD::VertexContainer::const_iterator, + xAOD::VertexContainer::const_iterator > vtx_itrpair = this->template getCollection<xAOD::VertexContainer>( roi_link, vtx_name ); + + if ( vtx_itrpair.first == vtx_itrpair.second ) { + m_provider->msg(MSG::WARNING) << "\tNo xAOD::Vertex for chain " << chainName << " for key " << vtx_name << endmsg; + } + else { - for ( ; vtxitr != vert->end(); ++vtxitr) { + m_provider->msg(MSG::INFO) << "\txAOD::VertexContainer found with size " << (vtx_itrpair.second - vtx_itrpair.first) + << "\t" << vtx_name << endmsg; + + xAOD::VertexContainer::const_iterator vtxitr = vtx_itrpair.first; + + for ( ; vtxitr!=vtx_itrpair.second ; vtxitr++ ) { + /// leave this code commented so that we have a record of the change - as soon as we can /// fix the missing track multiplicity from the vertex this will need to go back // if ( ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) || vtx_name=="EFHistoPrmVtx" ) { - if ( (*vtxitr)->vertexType()!=0 || vtx_name=="EFHistoPrmVtx" ) { + if ( (*vtxitr)->vertexType()!=0 || vtx_name=="EFHistoPrmVtx" ) { + + m_provider->msg(MSG::VERBOSE) << "\tvertex " << chainConfig << " " << (*vtxitr) << "\t name" << vtx_name << endmsg; + chain.back().addVertex( TIDA::Vertex( (*vtxitr)->x(), (*vtxitr)->y(), (*vtxitr)->z(), @@ -844,12 +799,20 @@ protected: } } - } + } /// retrieve online vertices - } /// retrieve online vertices - +#if 0 + if ( dbg ) { + std::cout << "\tTIDA analysis for chain: " << chainname << "\t key: " << key << "\t" << **roiptr << std::endl; + std::cout << "\tcollections: " << chain.back() << std::endl; + } #endif - + + if ( roiInfo ) delete roiInfo; + + } + + } /// "offline" of "roi" type chains @@ -911,6 +874,11 @@ protected: this->template selectTracks<TruthParticleContainer>( &selectorTruth, "SpclMC"); foundTruth = true; } + else if ( m_provider->evtStore()->template contains<xAOD::TruthParticleContainer>("TruthParticles") ) { + /// xAOD::TruthParticles + this->template selectTracks<xAOD::TruthParticleContainer>( &selectorTruth, "TruthParticles"); + foundTruth = true; + } else if ( m_provider->evtStore()->template contains<TruthParticleContainer>("") ) { /// anything else? this->template selectTracks<TruthParticleContainer>( &selectorTruth, ""); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ee7150200eba1e8eb1b99e69a441b4e8473ac6f0 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx @@ -0,0 +1,1212 @@ +/** + ** @file AnalysisConfigMT_Ntuple.cxx + ** + ** @author mark sutton + ** + ** Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + **/ + +#include "TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "xAODTruth/TruthVertexContainer.h" + +#include "TrigInDetAnalysis/Filter_AcceptAll.h" +#include "TrigInDetAnalysisUtils/Filter_etaPT.h" +#include "TrigInDetAnalysisUtils/Filter_RoiSelector.h" +#include "TrigInDetAnalysisUtils/Filters.h" + +#include "TrigInDetAnalysis/TIDDirectory.h" +#include "TrigInDetAnalysisUtils/TIDARoiDescriptorBuilder.h" + +std::string date(); + + +//function to find true taus +const HepMC::GenParticle* fromParent( int pdg_id, const HepMC::GenParticle* p, bool printout=false ); + + + +template<class T> +void remove_duplicates(std::vector<T>& vec) { + std::sort(vec.begin(), vec.end()); + vec.erase(std::unique(vec.begin(), vec.end()), vec.end()); +} + + + + +void AnalysisConfigMT_Ntuple::loop() { + + m_provider->msg(MSG::INFO) << "[91;1m" << "AnalysisConfig_Ntuple::loop() for " << m_analysisInstanceName + << " compiled " << __DATE__ << " " << __TIME__ << "\t: " << date() << "[m" << endmsg; + + // get (offline) beam position + double xbeam = 0; + double ybeam = 0; + double zbeam = 0; + std::vector<double> beamline; + + bool foundOffline = false; + + if ( m_iBeamCondSvc ) { + + const Amg::Vector3D& vertex = m_iBeamCondSvc->beamPos(); + xbeam = vertex[0]; + ybeam = vertex[1]; + zbeam = vertex[2]; + + // m_provider->msg(MSG::INFO) << " using beam position\tx=" << xbeam << "\ty=" << ybeam << "\tz=" << zbeam <<endmsg; + beamline.push_back(xbeam); + beamline.push_back(ybeam); + beamline.push_back(zbeam); + // m_provider->msg(MSG::INFO) << " beamline values : " << beamline[0] << "\t" << beamline[1] << "\t" << beamline[2] << endmsg; + } + + // get (online) beam position + double xbeam_online = 0; + double ybeam_online = 0; + double zbeam_online = 0; + + std::vector<double> beamline_online; + + if ( m_iOnlineBeamCondSvc ) { + + const Amg::Vector3D& vertex = m_iOnlineBeamCondSvc->beamPos(); + xbeam_online = vertex[0]; + ybeam_online = vertex[1]; + zbeam_online = vertex[2]; + + beamline_online.push_back( xbeam_online ); + beamline_online.push_back( ybeam_online ); + beamline_online.push_back( zbeam_online ); + + // m_provider->msg(MSG::INFO) << " using online beam position" + // << "\tx=" << xbeam_online + // << "\ty=" << ybeam_online + // << "\tz=" << zbeam_online << endmsg; + } + + // m_provider->msg(MSG::INFO) << " offline beam position\tx=" << xbeam << "\ty=" << ybeam << "\tz=" << zbeam << endmsg; + // m_provider->msg(MSG::INFO) << " online beam position\tx=" << xbeam_online << "\ty=" << ybeam_online << "\tz=" << zbeam_online << endmsg; + + /// list the configured chains + + static std::set<std::string> configuredHLTChains; + + std::vector<ChainString> chainNames; + + static bool tida_first = true; + + if ( tida_first ) { + + std::vector<std::string> configuredChains = (*m_tdt)->getListOfTriggers("L2_.*, EF_.*, HLT_.*"); + + // m_provider->msg(MSG::INFO) << "[91;1m" << configuredChains.size() << " Configured Chains" << "[m" << endmsg; + for ( unsigned i=0 ; i<configuredChains.size() ; i++ ) { + // m_provider->msg(MSG::INFO) << "[91;1m" << "Chain " << configuredChains[i] << " (ACN)[m" << endmsg; + configuredHLTChains.insert( configuredChains[i] ); + + } + + tida_first = false; + + std::vector<ChainString>::iterator chainitr = m_chainNames.begin(); + + /// handle wildcard chain selection - but only the first time + while ( chainitr!=m_chainNames.end() ) { + + /// get chain + ChainString& chainName = (*chainitr); + + /// get matching chains + + std::vector<std::string> selectChains; + selectChains.clear(); + if ( chainitr->head()=="" ) selectChains.push_back(""); + else selectChains = (*m_tdt)->getListOfTriggers( chainName.head() ); + + for ( unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) { + + if ( chainName.tail()!="" ) selectChains[iselected] += ":key="+chainName.tail(); + if ( chainName.extra()!="" ) selectChains[iselected] += ":index="+chainName.extra(); + + if ( chainName.element()!="" ) selectChains[iselected] += ":te="+chainName.element(); + if ( chainName.roi()!="" ) selectChains[iselected] += ":roi="+chainName.roi(); + if ( chainName.vtx()!="" ) selectChains[iselected] += ":vtx="+chainName.vtx(); + + if ( !chainName.passed() ) selectChains[iselected] += ";DTE"; + + /// replace wildcard with actual matching chains ... + chainNames.push_back( ChainString(selectChains[iselected]) ); + + m_provider->msg(MSG::INFO) << "[91;1m" << "Matching chain " << selectChains[iselected] << "[m" << endmsg; + + } + + chainitr++; + } + + m_chainNames = chainNames; + } + + + Filter_AcceptAll filter; + /// FIXME: should really have hardcoded limits encoded as + /// const variables + Filter_etaPT filterRef(5,500); + Filter_etaPT filter_etaPT(3.0,1000); + Filter_pdgIdpTeta filter_pdgIdpTeta(m_TruthPdgId,3.0,1000); // |eta|<3, pt>1GeV + + TrackFilter* truthFilter = &filter_etaPT; + + //tau filtering done separately to include mothers + if ( m_TruthPdgId!=0 && m_TruthPdgId!=15 ) truthFilter = &filter_pdgIdpTeta; + + TrigTrackSelector selectorTruth( truthFilter ); + + TrigTrackSelector selectorRef( &filter_etaPT ); + TrigTrackSelector selectorTest( &filter ); + + + selectorTruth.setBeamline( xbeam, ybeam, zbeam ); + selectorRef.setBeamline( xbeam, ybeam, zbeam ); + selectorTest.setBeamline( xbeam_online, ybeam_online, zbeam_online ); + + + selectorTruth.correctTracks( true ); + selectorRef.correctTracks( true ); + selectorTest.correctTracks( true ); + + + // clear the ntuple TIDA::Event class + m_event->clear(); + + const xAOD::EventInfo* pEventInfo = 0; + + unsigned run_number = 0; + unsigned long long event_number = 0; + unsigned lumi_block = 0; + unsigned bunch_crossing_id = 0; + unsigned time_stamp = 0; + double mu_val = 0; + + if ( m_provider->evtStore()->retrieve(pEventInfo).isFailure() ) { + m_provider->msg(MSG::DEBUG) << "Failed to get EventInfo " << endmsg; + } + else { + run_number = pEventInfo->runNumber(); + event_number = pEventInfo->eventNumber(); + lumi_block = pEventInfo->lumiBlock(); + time_stamp = pEventInfo->timeStamp(); + bunch_crossing_id = pEventInfo->bcid(); + mu_val = pEventInfo->averageInteractionsPerCrossing(); + } + + m_provider->msg(MSG::INFO) << "run " << run_number + << "\tevent " << event_number + << "\tlb " << lumi_block << endmsg; + + m_event->run_number(run_number); + m_event->event_number(event_number); + m_event->lumi_block(lumi_block); + m_event->time_stamp(time_stamp); + m_event->bunch_crossing_id(bunch_crossing_id); + m_event->mu(mu_val); + + // build a chain group on the fly and use the reference + const Trig::ChainGroup* L2chain=(*m_tdt)->getChainGroup("L2_.*"); + const Trig::ChainGroup* EFchain=(*m_tdt)->getChainGroup("EF_.*"); + const Trig::ChainGroup* HLTchain=(*m_tdt)->getChainGroup("HLT_.*"); + + m_provider->msg(MSG::DEBUG) << "[91;1m" + << "L2 pass " << L2chain->isPassed() << "\t" + << "EF pass " << EFchain->isPassed() << "\t" + << "HLT pass " << HLTchain->isPassed() << "[m" + << endmsg; + + /// check whether the chains have actually run, otherwise there's no point + /// doing anything + + bool analyse = false; + + unsigned decisiontype_ = TrigDefs::Physics; + + if ( requireDecision() ) decisiontype_ = TrigDefs::requireDecision; + + + /// bomb out if no chains passed and not told to keep all events + + int passed_chains = 0; + + m_provider->msg(MSG::INFO) << "Checking " << m_chainNames.size() << " chains" << endmsg; + + if ( m_chainNames.empty() ) { + m_provider->msg(MSG::WARNING) << "No chains to check" << endmsg; + return; + } + + for ( unsigned ichain=0 ; ichain<m_chainNames.size() ; ichain++ ) { + + const std::string& chainName = m_chainNames[ichain].head(); + + // Only for trigger chains + + if (chainName.find("L2") == std::string::npos && + chainName.find("EF") == std::string::npos && + chainName.find("HLT") == std::string::npos ) continue; + + if ( configuredHLTChains.find(chainName)==configuredHLTChains.end() ) { + m_provider->msg(MSG::WARNING) << "[91;1m" << "Chain " << chainName + << " is not configured for this event" << "[m" + << endmsg; + continue; + } + + + std::string roistring = ""; + if ( m_chainNames[ichain].roi()!="" ) roistring += "\troi " + m_chainNames[ichain].roi(); + + bool passPhysics = (*m_tdt)->isPassed(chainName); + + m_provider->msg(MSG::INFO) << "Chain " << chainName << "\troi " << roistring + << "\tpres " << (*m_tdt)->getPrescale(chainName) + << ( passPhysics ? "[91;1m" : "" ) << "\tpass physics " << passPhysics << ( passPhysics ? "[m" : "" ) + << "\t: ( pass " << (*m_tdt)->isPassed(chainName, decisiontype_ ) << "\tdec type " << decisiontype_ << " ) " << endmsg; + + if ( (*m_tdt)->isPassed(chainName, decisiontype_ ) ) { + analyse = true; + passed_chains++; + } + + } /// finished loop over chains + + + + /// bomb out if no chains passed and not told to keep all events and found no + /// offline objects + if ( !analyse && !m_keepAllEvents && !foundOffline ) { + m_provider->msg(MSG::INFO) << "No chains passed unprescaled - not processing this event: " << run_number << " " << event_number << " " << lumi_block << endmsg; + return; + } + + + m_provider->msg(MSG::INFO) << "Chains passed " << passed_chains << endmsg; + + + /// for Monte Carlo get the truth particles if requested to do so + + // const TruthParticleContainer* mcpartTES = 0; + + selectorTruth.clear(); + + m_provider->msg(MSG::INFO) << "MC Truth flag " << m_mcTruth << endmsg; + const TrigInDetTrackTruthMap* truthMap = 0; + bool foundTruth = false; + if ( m_mcTruth && m_TruthPdgId!=15) { + m_provider->msg(MSG::INFO) << "getting Truth" << endmsg; + if ( m_provider->evtStore()->retrieve(truthMap, "TrigInDetTrackTruthMap").isFailure()) { + // m_provider->msg(MSG::WARNING) << "TrigInDetTrackTruthMap not found" << endmsg; + m_hasTruthMap = false; + } + else { + m_provider->msg(MSG::INFO) << "TrigInDetTrackTruthMap found" << endmsg; + m_hasTruthMap = true; + } + if (m_provider->evtStore()->contains<TruthParticleContainer>("INav4MomTruthEvent")) { + //ESD + selectTracks<TruthParticleContainer>( &selectorTruth, "INav4MomTruthEvent" ); + foundTruth = true; + } + else if (m_provider->evtStore()->contains<TruthParticleContainer>("SpclMC")) { + /// AOD + selectTracks<TruthParticleContainer>( &selectorTruth, "SpclMC"); + foundTruth = true; + } + else if (m_provider->evtStore()->contains<TruthParticleContainer>("")) { + /// anything else? + selectTracks<TruthParticleContainer>( &selectorTruth, ""); + foundTruth = true; + } + else if (m_provider->evtStore()->contains<xAOD::TruthParticleContainer>("TruthParticles")) { + /// anything else? + selectTracks<xAOD::TruthParticleContainer>( &selectorTruth, "TruthParticles" ); + foundTruth = true; + } + else { + m_provider->msg(MSG::WARNING) << "Truth not found - none whatsoever!" << endmsg; + } + } + + + /// No lovely truth particle collections, so will need to + /// navigate through the egregious McTruthCollection, looking + /// at the GenParticles on each GenVertex in the collection + /// lovely... + + if ( m_mcTruth && !foundTruth ) { + + m_provider->msg(MSG::INFO) << "getting Truth" << endmsg; + + /// selectTracks<TruthParticleContainer>( &selectorTruth, "INav4MomTruthEvent" ); + + const DataHandle<McEventCollection> mcevent; + + /// now as a check go through the GenEvent collection + + std::string collectionNames[4] = { "GEN_AOD", "TruthEvent", "", "G4Truth" }; + + std::string collectionName = ""; + + bool foundcollection = false; + + for ( int ik=0 ; ik<4 ; ik++ ) { + + m_provider->msg(MSG::INFO) << "Try McEventCollection: " << collectionNames[ik] << endmsg; + + if (!m_provider->evtStore()->contains<McEventCollection>(collectionNames[ik]) ) { + m_provider->msg(MSG::INFO) << "No McEventCollection: " << collectionNames[ik] << endmsg; + continue; + } + + m_provider->msg(MSG::INFO) << "evtStore()->retrieve( mcevent, " << collectionNames[ik] << " )" << endmsg; + + if ( m_provider->evtStore()->retrieve( mcevent, collectionNames[ik] ).isFailure() ) { + m_provider->msg(MSG::INFO) << "Failed to get McEventCollection: " << collectionNames[ik] << endmsg; + } + else { + // found this collectionName + collectionName = collectionNames[ik]; + m_provider->msg(MSG::INFO) << "Found McEventCollection: " << collectionName << endmsg; + foundcollection = true; + break; + } + } + + // not found any collection + if ( !foundcollection ) { + + m_provider->msg(MSG::WARNING) << "No MC Truth Collections of any sort, whatsoever!!!" << endmsg; + + // m_tree->Fill(); + + // return StatusCode::FAILURE; + + return; + } + + ////////////////////////////////////////////////////////////////////////////////// + /// This is a nasty hack to find the truth collections + /// why, why, why, why, why oh why, is it sooooo + /// difficult to navigate through this nonsense + /// it's not at all tidy, and should be rewritten, + /// but probably never will be + + m_provider->msg(MSG::INFO) << "Found McEventCollection: " << collectionName << "\tNevents " << mcevent->size() << endmsg; + + /// count the number of interactions of each sort + /// this is actually *very stupid*, there are a *lot* + /// of "processes" with *no* particles in them for some + /// reason, whoever programed this f**cked up structure + /// that needs this sort of fannying around to navigate + + McEventCollection::const_iterator evitr(mcevent->begin()); + McEventCollection::const_iterator evend(mcevent->end()); + + unsigned ie = 0; /// count of "events" - or interactions + unsigned ip = 0; /// count of particles + + unsigned ie_ip = 0; /// count of "events with some particles" + + while ( evitr!=evend ) { + + int _ip = 0; /// count of particles in this interaction + + int pid = (*evitr)->signal_process_id(); + + // if ( (*evitr)->particles_size()>0 ) std::cout << "process " << "\tpid " << pid << std::endl; + + if ( pid!=0 && (*evitr)->particles_size()>0 ) { /// hooray! actually found a sensible event + + /// go through the particles + HepMC::GenEvent::particle_const_iterator pitr((*evitr)->particles_begin()); + HepMC::GenEvent::particle_const_iterator pend((*evitr)->particles_end()); + + while ( pitr!=pend ) { + + // int pdg_id = (*pitr)->pdg_id(); + // std::cout << ip++ << "\tparticle " << pdg_id << "\t" << "(*pitr)->pT()" << std::endl; + + //if tau job, only select if have a tau somewhere along chain, otherwise just add + if ( (m_TruthPdgId==15 && fromParent(m_TruthPdgId, *pitr)!=0) || m_TruthPdgId!=15 ) { + + /// select the ones of interest + selectorTruth.selectTrack( *pitr ); + } + + + ++_ip; + + ++pitr; + + } + + + } + + ++ie; + ++evitr; + + if ( _ip>0 ) { + /// if there were some particles in this interaction ... + // m_provider->msg(MSG::INFO) << "Found " << ie << "\tpid " << pid << "\t with " << ip << " TruthParticles (GenParticles)" << endmsg; + ++ie_ip; + ip += _ip; + } + } + + m_provider->msg(MSG::INFO) << "Found " << ip << " TruthParticles (GenParticles) in " << ie_ip << " GenEvents out of " << ie << endmsg; + + m_provider->msg(MSG::INFO) << "selected " << selectorTruth.size() << " TruthParticles (GenParticles)" << endmsg; + + //////////////////////////////////////////////////////////////////////////////////////// + + if ( !(ip>0) ) { + m_provider->msg(MSG::WARNING) << "NO TRUTH PARTICLES - returning" << endmsg; + return; /// need to be careful here, if not requiring truth *only* should not return + } + + } + + + + // clear the ntuple TIDA::Event class + m_event->clear(); + + /// get (offline) reference tracks + + /// get offline tracks + + m_provider->msg(MSG::INFO) << " Offline tracks " << endmsg; + + selectorRef.clear(); + + if (m_provider->evtStore()->contains<xAOD::TrackParticleContainer>("InDetTrackParticles")) { + selectTracks<xAOD::TrackParticleContainer>( &selectorRef, "InDetTrackParticles" ); + } + else if (m_provider->evtStore()->contains<Rec::TrackParticleContainer>("TrackParticleCandidate")) { + selectTracks<Rec::TrackParticleContainer>( &selectorRef, "TrackParticleCandidate" ); + } + else { + m_provider->msg(MSG::WARNING) << " Offline tracks not found " << endmsg; + } + + + /// get the offline vertices into our structure + + std::vector<TIDA::Vertex> vertices; + + // std::vector<TIDA::Vertex> vertices; + + m_provider->msg(MSG::VERBOSE) << "fetching AOD Primary vertex container" << endmsg; + + const xAOD::VertexContainer* xaodVtxCollection = 0; + + if ( m_provider->evtStore()->retrieve( xaodVtxCollection, "PrimaryVertices" ).isFailure()) { + m_provider->msg(MSG::WARNING) << "xAOD Primary vertex container not found with key " << "PrimaryVertices" << endmsg; + } + + if ( xaodVtxCollection!=0 ) { + + m_provider->msg(MSG::INFO) << "xAOD Primary vertex container " << xaodVtxCollection->size() << " entries" << endmsg; + + xAOD::VertexContainer::const_iterator vtxitr = xaodVtxCollection->begin(); + for ( ; vtxitr != xaodVtxCollection->end(); vtxitr++ ) { + + /// useful debug information - leave in + // std::cout << "SUTT xAOD::Vertex::type() " << (*vtxitr)->type() << "\tvtxtype " << (*vtxitr)->vertexType() << "\tntrax " << (*vtxitr)->nTrackParticles() << std::endl; + + if ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) { + vertices.push_back( TIDA::Vertex( (*vtxitr)->x(), + (*vtxitr)->y(), + (*vtxitr)->z(), + /// variances + (*vtxitr)->covariancePosition()(Trk::x,Trk::x), + (*vtxitr)->covariancePosition()(Trk::y,Trk::y), + (*vtxitr)->covariancePosition()(Trk::z,Trk::z), + (*vtxitr)->nTrackParticles(), + /// quality + (*vtxitr)->chiSquared(), + (*vtxitr)->numberDoF() ) ); + } + + } + } + + + /// add offline Vertices to the Offline chain + + + /// add the truth particles if needed + + if ( m_mcTruth ) { + m_event->addChain( "Truth" ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorTruth.tracks()); + } + + + /// now add the vertices + + /// useful debug information - leave in + // std::cout << "SUTT Nvertices " << vertices.size() << "\ttype 101 " << vertices_full.size() << std::endl; + + for ( unsigned i=0 ; i<vertices.size() ; i++ ) { + m_provider->msg(MSG::DEBUG) << "vertex " << i << " " << vertices[i] << endmsg; + m_event->addVertex(vertices[i]); + } + + + /// offline object counters + + int Noff = 0; + int Nmu = 0; + int Nel = 0; + int Ntau = 0; + + + /// now add the offline vertices + + if ( m_doOffline || m_doVertices ) { + m_event->addChain( "Vertex" ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addVertices( vertices ); + } + + + /// now add the offline tracks + + if ( m_doOffline ) { + + m_event->addChain( "Offline" ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorRef.tracks()); + + if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorRef.getBeamX() ); + beamline_.push_back( selectorRef.getBeamY() ); + beamline_.push_back( selectorRef.getBeamZ() ); + m_event->back().back().addUserData(beamline_); + } + else { + m_event->back().back().addUserData(beamline); + } + + + + Noff = selectorRef.tracks().size(); + + m_provider->msg(MSG::DEBUG) << "ref tracks.size() " << selectorRef.tracks().size() << endmsg; + for ( int ii=selectorRef.tracks().size() ; ii-- ; ) m_provider->msg(MSG::DEBUG) << " ref track " << ii << " " << *selectorRef.tracks()[ii] << endmsg; + + } + + /// navigate through the requested storegate TEST chains + + for ( unsigned ichain=0 ; ichain<m_chainNames.size() ; ichain++ ) { + + m_provider->msg(MSG::INFO)<< "chain:\t" << m_chainNames[ichain] << endmsg; + + /// get the chain, collection and TE names and track index + + const std::string& chainname = m_chainNames[ichain].head(); + const std::string& collectionname = m_chainNames[ichain].tail(); + + if ( chainname!="" ) continue; + if ( collectionname=="" ) continue; + + /// useful debug information - leave this here + + // const std::string& index = m_chainNames[ichain].extra(); + // const std::string& element = m_chainNames[ichain].element(); + + // std::cout << "\tchain: " << chainname << "\tcollection: " << collectionname << "\tindex: " << index << "\tte: " << element << std::endl; + + /// here we *only* want collections with no specified chain + /// name, then we look in storegate for the collections directly + + selectorTest.clear(); + + bool found = false; + + std::string collection_test = collectionname; + size_t pos = collectionname.find("/"); + if ( pos!=std::string::npos ) collection_test = collectionname.substr( pos+1, collectionname.size()-pos ); + + if (m_provider->evtStore()->contains<Rec::TrackParticleContainer>(collection_test)) { + found = selectTracks<Rec::TrackParticleContainer>( &selectorTest, collectionname ); + } + else if (m_provider->evtStore()->contains<xAOD::TrackParticleContainer>(collection_test)) { + found = selectTracks<xAOD::TrackParticleContainer>( &selectorTest, collectionname ); + } + else if (m_provider->evtStore()->contains<TrigInDetTrackCollection>(collection_test)) { + found = selectTracks<TrigInDetTrackCollection>( &selectorTest, collectionname ); + } + else if (m_provider->evtStore()->contains<TrackCollection>(collection_test)) { + found = selectTracks<TrackCollection>( &selectorTest, collectionname ); + } + else { + m_provider->msg(MSG::WARNING) << "\tcollection " << collectionname << " not found" << endmsg; + } + + if ( found ) { + + m_event->addChain( collectionname ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorTest.tracks()); + + if ( selectorTest.getBeamX()!=0 || selectorTest.getBeamY()!=0 || selectorTest.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorTest.getBeamX() ); + beamline_.push_back( selectorTest.getBeamY() ); + beamline_.push_back( selectorTest.getBeamZ() ); + m_event->back().back().addUserData(beamline_); + } + else { + m_event->back().back().addUserData(beamline); + } + + int Ntest = selectorTest.tracks().size(); + + m_provider->msg(MSG::INFO) << "collection " << collectionname << "\ttest tracks.size() " << Ntest << endmsg; + for ( int ii=Ntest ; ii-- ; ) m_provider->msg(MSG::DEBUG) << " test track " << ii << " " << *selectorTest.tracks()[ii] << endmsg; + } + } + + + std::string ElectronRef[7] = { + "", + "TightCB", "MediumCB", "LooseCB", + "TightLH", "MediumLH", "LooseLH" }; + + + /// new electron selection + + for ( size_t ielec=0 ; ielec<m_electronType.size() ; ielec++ ) { + /// hmm, if we stored the types as a map it would be more + /// straightforward than having to stick all this in a loop + + int itype = -1; + for ( int it=0 ; it<7 ; it++ ) if ( m_electronType[ielec]==ElectronRef[it] ) itype = it; + if ( itype<0 ) continue; + + std::vector<TrackTrigObject> elevec; + + /// useful debug information ... + // std::cout << "\tElectrons selection " << ielec << " " << m_electronType[ielec] + // << "\t" << itype << " " << ElectronRef[itype] << "\t" << m_rawElectrons[ielec] << std::endl; + + int Nel_ = processElectrons( selectorRef, &elevec, itype, ( m_rawElectrons[ielec]=="raw" ? true : false ) ); + + + if ( Nel_ < 1 ) continue; + + Nel += Nel_; + + std::string echain = std::string("Electrons"); + if ( m_electronType[ielec]!="" ) echain += "_" + m_electronType[ielec]; + if ( m_rawElectrons[ielec]=="raw" ) echain += "_raw"; + + m_event->addChain( echain ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorRef.tracks()); + m_event->back().back().addObjects( elevec ); + + // leave this in util fully validated ... + // std::cout << m_event->back() << std::endl; + + if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorRef.getBeamX() ); + beamline_.push_back( selectorRef.getBeamY() ); + beamline_.push_back( selectorRef.getBeamZ() ); + m_event->back().back().addUserData(beamline_); + } + else { + m_event->back().back().addUserData(beamline); + } + } + + + + std::string MuonRef[5] = { "", "Tight", "Medium", "Loose", "VeryLoose" }; + + /// get muons + for ( size_t imuon=0 ; imuon<m_muonType.size() ; imuon++ ) { + + m_provider->msg(MSG::INFO) << "fetching offline muons " << endmsg; + + int muonType = -1; + for ( int it=0 ; it<5 ; it++ ) if ( m_muonType[imuon] == MuonRef[it] ) muonType=it; + if ( muonType<0 ) continue; + + int Nmu_ = processMuons( selectorRef, muonType ); + + if ( Nmu_ < 1 ) continue; + + Nmu += Nmu_; + + m_provider->msg(MSG::INFO) << "found " << Nmu << " offline muons " << endmsg; + + std::string mchain = "Muons"; + if ( m_muonType[imuon]!="" ) mchain += "_" + m_muonType[imuon]; + + m_event->addChain(mchain); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorRef.tracks()); + if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorRef.getBeamX() ); + beamline_.push_back( selectorRef.getBeamY() ); + beamline_.push_back( selectorRef.getBeamZ() ); + m_event->back().back().addUserData(beamline_); + } + else { + m_event->back().back().addUserData(beamline); + } + + m_provider->msg(MSG::DEBUG) << "ref muon tracks.size() " << selectorRef.tracks().size() << endmsg; + for ( int ii=selectorRef.tracks().size() ; ii-- ; ) m_provider->msg(MSG::INFO) << " ref muon track " << ii << " " << *selectorRef.tracks()[ii] << endmsg; + } + + + + + /// get muons + if ( m_doMuonsSP ) { + + m_provider->msg(MSG::INFO) << "fetching offline muons " << endmsg; + + int muonType = 0; + + Nmu += processMuons( selectorRef, muonType ); + + m_provider->msg(MSG::INFO) << "found " << Nmu << " offline muons " << endmsg; + + m_event->addChain("MuonsSP"); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorRef.tracks()); + + m_provider->msg(MSG::DEBUG) << "ref muon tracks.size() " << selectorRef.tracks().size() << endmsg; + for ( int ii=selectorRef.tracks().size() ; ii-- ; ) m_provider->msg(MSG::INFO) << " ref muon track " << ii << " " << *selectorRef.tracks()[ii] << endmsg; + } + + + + /// new tau selection + std::string TauRef[4] = { "", "Tight", "Medium", "Loose" }; + + + for ( size_t itau=0 ; itau<m_tauType.size() ; itau++ ) { + /// hmm, if we stored the types as a map it would be more + /// straightforward than having to stick all this in a loop + + int itype = -1; + for ( int it=0 ; it<4 ; it++ ) if ( m_tauType[itau]==TauRef[it] ) itype = it; + if ( itype<0 ) continue; + + /// use same threshold for 1 and 3 prong ?? + int requireNtracks = 0; + if ( m_tauProngs[itau]=="3Prong" ) requireNtracks = 3; + if ( m_tauProngs[itau]=="1Prong" ) requireNtracks = 1; + + std::vector<TrackTrigObject> tauvec; + + int Ntau_ = processTaus( selectorRef, &tauvec, itype, requireNtracks, 20000 ); + + Ntau += Ntau_; + + if ( Ntau_ > 0 ) { + /// only add a tau collection if there are actually the + /// relevant taus + std::string tchain = std::string("Taus"); + if ( m_tauType[itau] != "" ) tchain += "_" + m_tauType[itau]; + if ( m_tauProngs[itau] != "" ) tchain += "_" + m_tauProngs[itau]; + + m_event->addChain( tchain ); + m_event->back().addRoi(TIDARoiDescriptor(true)); + m_event->back().back().addTracks(selectorRef.tracks()); + m_event->back().back().addObjects( tauvec ) ; + + // leave this in util fully validated ... + // std::cout << m_event->back() << std::endl; + + if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorRef.getBeamX() ); + beamline_.push_back( selectorRef.getBeamY() ); + beamline_.push_back( selectorRef.getBeamZ() ); + m_event->back().back().addUserData(beamline_); + } + else { + m_event->back().back().addUserData(beamline); + } + } + } + + /// useful debug information 0 leave here + // std::cout << "SUTT Ntaus: " << Ntau << std::endl; + + if ( Nmu==0 && Noff==0 && Nel==0 && Ntau==0 ) m_provider->msg(MSG::INFO) << "No offline objects found " << endmsg; + else foundOffline = true; + + + // now loop over all relevant chains to get the trigger tracks... + for ( unsigned ichain=0 ; ichain<m_chainNames.size() ; ichain++ ) { + + // create chains for ntpl + + /// get the chain name + const std::string& chainName = m_chainNames[ichain].head(); + + /// and the name of the collection (if any) + const std::string& collectionName = m_chainNames[ichain].tail(); + + + if( chainName.find("L2_")==std::string::npos && + chainName.find("EF_")==std::string::npos && + chainName.find("HLT_")==std::string::npos ) continue; + + + m_provider->msg(MSG::INFO) << "chain " << chainName + << "\tprescale " << (*m_tdt)->getPrescale(chainName) + << "\tpass " << (*m_tdt)->isPassed(chainName) << " physics " + << " (req dec " << (*m_tdt)->isPassed(chainName, decisiontype_ ) << " dec type " << decisiontype_ << ")" + << endmsg; + + /// now decide whether we want all the TEs for this chain, or just those + /// that are still active + unsigned decisiontype; + if ( m_chainNames[ichain].passed() ) decisiontype = decisiontype_; + else decisiontype = TrigDefs::alsoDeactivateTEs; + + + /// if the chain did not pass, skip this chain completely + if ( !(*m_tdt)->isPassed( chainName, decisiontype_ ) ) continue; + + + /// new MT TDT feature access + + + std::string roi_key = m_chainNames[ichain].roi(); + std::string vtx_name = m_chainNames[ichain].vtx(); + + +#if 0 + /// this code needs to be here to be eventually replaced when + /// the TDT combination feature retrieval has been implemented + /// at that point it can be replaced by the appropriate + /// code using the new TDT feature access + + if ( roi_name!="" ) { + + std::string roi_name_tmp = roi_name; + std::string roi_tename = ""; + + if ( roi_name.find("/")!=std::string::npos ) { + roi_name_tmp = roi_name.substr( roi_name.find("/")+1, roi_name.size()-roi_name.find("/") ); + roi_tename = roi_name.substr( 0, roi_name.find("/") ); + } + + roist = comb->get<TrigRoiDescriptor>( roi_name_tmp, decisiontype_, roi_tename ); + + if ( roist.size()>0 ) { + for ( unsigned ir=0 ; ir<roist.size() ; ir++ ) m_provider->msg(MSG::INFO) << "\t\tRetrieved roi " << roi_name << "\t" << *roist[ir].cptr() << endmsg; + } + else { + m_provider->msg(MSG::WARNING) << "\t\tRequested roi " << roi_name << " not found" << endmsg; + } + + } + else { + roist = comb->get<TrigRoiDescriptor>("forID1"); + if ( roist.empty() ) roist = comb->get<TrigRoiDescriptor>("forID"); + if ( roist.empty() ) roist = comb->get<TrigRoiDescriptor>(""); + if ( roist.empty() ) roist = comb->get<TrigRoiDescriptor>("initialRoI"); + } +#endif + + + std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois = + (*m_tdt)->template features<TrigRoiDescriptorCollection>( chainName, + decisiontype, + roi_key, + TrigDefs::lastFeatureOfType, + "roi" ); + + /// leave this here for the moment until we know everything is working ... + // const unsigned int featureCollectionMode = const std::string& navElementLinkKey = "roi") const; + + int iroi = 0; /// count of how many rois processed so far + + /// if no rois for this chain then move along + + if ( rois.size()==0 ) continue; + + /// create the analysis chain + + m_event->addChain( m_chainNames[ichain] ); + + TIDA::Chain& chain = m_event->back(); + + + for ( const TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> roi_info : rois ) { + + iroi++; + + /// don't extract any additional rois if a superRoi is requested: + /// In this case, the superRoi would be shared between the different + /// chains + + if ( roi_key=="SuperRoi" && iroi>1 ) continue; + + const ElementLink<TrigRoiDescriptorCollection> roi_link = roi_info.link; + + const TrigRoiDescriptor* const* roiptr = roi_link.cptr(); + + if ( roiptr == 0 ) { + // std::cerr << "\treadback link is null DAMMIT !!!" << std::endl; + continue; + } + + if (m_provider->msg().level() <= MSG::VERBOSE) { + m_provider->msg(MSG::VERBOSE) << " RoI descriptor for seeded chain " << chainName << " " << **roiptr << endmsg; + } + + TIDARoiDescriptor* roi_tmp = new TIDARoiDescriptor( TIDARoiDescriptorBuilder(**roiptr) ); + + /// get the tracks + + ////////////////////////////////// + + /// useful cocumentation line ... + /// std::string keys[5] = { "TrigJetRec", "TrigSplitJet", "TrigSuperRoi", "forID", "" }; + + // m_provider->msg(MSG::INFO) << "using chain roi " << *roid << endmsg; + m_provider->msg(MSG::INFO) << "TIDARoi " << *roi_tmp << "\tcollectionName: " << collectionName << endmsg; + + /// this should *never* be the case, and we should only run this + /// bit of code once the first time round the loop anyhow + + selectorTest.clear(); + + + if ( chainName.find("HLT_")!=std::string::npos ) { + if ( selectTracks<xAOD::TrackParticleContainer>( &selectorTest, roi_link, collectionName ) ); + else m_provider->msg(MSG::WARNING) << "\tNo track collection " << collectionName << " found" << endmsg; + } + + /// fetch vertices if available ... + + std::vector<TIDA::Vertex> tidavertices; + + if ( vtx_name!="" ) { + + m_provider->msg(MSG::INFO) << "\tFetch xAOD::VertexContainer for chain " << chainName << " with key " << vtx_name << endmsg; + + /// MT Vertex access + + std::pair< xAOD::VertexContainer::const_iterator, + xAOD::VertexContainer::const_iterator > vtx_itrpair = getCollection<xAOD::VertexContainer>( roi_link, vtx_name ); + + if ( vtx_itrpair.first == vtx_itrpair.second ) { + m_provider->msg(MSG::WARNING) << "\tNo xAOD::Vertex for chain " << chainName << " for key " << vtx_name << endmsg; + } + else { + + m_provider->msg(MSG::INFO) << "\txAOD::VertexContainer found with size " << (vtx_itrpair.second - vtx_itrpair.first) + << "\t" << vtx_name << endmsg; + + xAOD::VertexContainer::const_iterator vtxitr = vtx_itrpair.first; + + for ( ; vtxitr!=vtx_itrpair.second ; vtxitr++ ) { + + /// leave this code commented so that we have a record of the change - as soon as we can + /// fix the missing track multiplicity from the vertex this will need to go back + // if ( ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) || vtx_name=="EFHistoPrmVtx" ) { + if ( (*vtxitr)->vertexType()!=0 || vtx_name=="EFHistoPrmVtx" ) { + tidavertices.push_back( TIDA::Vertex( (*vtxitr)->x(), + (*vtxitr)->y(), + (*vtxitr)->z(), + /// variances + (*vtxitr)->covariancePosition()(Trk::x,Trk::x), + (*vtxitr)->covariancePosition()(Trk::y,Trk::y), + (*vtxitr)->covariancePosition()(Trk::z,Trk::z), + (*vtxitr)->nTrackParticles(), + /// quality + (*vtxitr)->chiSquared(), + (*vtxitr)->numberDoF() ) ); + } + } + + } + + } + +#if 0 + //// not yet ready to get the jet yet - this can come once everything else is working + // now get the jets if they are present + std::vector<TrackTrigObject> jets; + if ( chainName.find("HLT_j")!=std::string::npos ) { + if ( get_jets( comb, jets ) == 0 ) m_provider->msg(MSG::WARNING) << "\tjets could not be retrieved " << endmsg; + } +#endif + + const std::vector<TIDA::Track*>& testTracks = selectorTest.tracks(); + m_provider->msg(MSG::DEBUG) << "\ttest tracks.size() " << testTracks.size() << endmsg; + for (unsigned int ii=0; ii < testTracks.size(); ii++) { + m_provider->msg(MSG::DEBUG) << " test track " << ii << "for chain " << chainName + ":" + collectionName << " " << *testTracks[ii] << endmsg; + } + + + // only add chain if there are any rois - also add beamline position for postprocessing + + + if ( roi_tmp == 0 ) { + if ( testTracks.size()>0 ) m_provider->msg(MSG::WARNING) << "\ttest tracks.size() " << testTracks.size() << "found but no roi!!!" << endmsg; + roi_tmp = new TIDARoiDescriptor(true); + } + + + + chain.addRoi( *roi_tmp ); + chain.back().addTracks(testTracks); + chain.back().addVertices(tidavertices); + chain.back().addUserData(beamline_online); + +#if 0 + /// jets can't be added yet + if ( chainName.find("HLT_j")!=std::string::npos ) chain.back().addObjects( jets ); +#endif + + if ( selectorTest.getBeamX()!=0 || selectorTest.getBeamY()!=0 || selectorTest.getBeamZ()!=0 ) { + std::vector<double> beamline_; + beamline_.push_back( selectorTest.getBeamX() ); + beamline_.push_back( selectorTest.getBeamY() ); + beamline_.push_back( selectorTest.getBeamZ() ); + chain.back().addUserData(beamline_); + } + else { + if ( beamline_online.size()>3 ) chain.back().addUserData(beamline_online); + } + + + // m_provider->msg(MSG::INFO) << " done" << endmsg; + + if ( roi_tmp ) delete roi_tmp; + roi_tmp = 0; + } + + + } + +#if 0 + /// don;t include this code at the moment ... + + { + /// strip out the offline tracks not in any Roi ... + + if ( filterOnRoi() || m_ptmin>0 ) { + + TIDA::Chain* offline = 0; + + std::vector<std::string> chainnames = m_event->chainnames(); + + /// get the offline chain + + for ( size_t ic=chainnames.size() ; ic-- ; ) { + if ( chainnames[ic] == "Offline" ) { + offline = &(m_event->chains()[ic]); + break; + } + } + + if ( offline ) { + + std::vector<TIDA::Chain>& chains = m_event->chains(); + std::vector<TIDA::Chain>::iterator citr = chains.begin(); + + std::vector<std::pair<double,double> > philims; + + for ( ; citr!=chains.end() ; citr++ ) { + if ( citr->name().find("HLT_")!=std::string::npos ) { + for ( size_t ir=0 ; ir<citr->size() ; ir++ ) { + TIDARoiDescriptor& roi = citr->rois()[ir].roi(); + if ( roi.composite() ) { + for ( size_t isub=0 ; isub<roi.size() ; isub++ ) { + philims.push_back( std::pair<double,double>( roi[isub]->phiMinus(), roi[isub]->phiPlus() ) ); + } + } + else philims.push_back( std::pair<double,double>( roi.phiMinus(), roi.phiPlus() ) ); + } + } + } + + remove_duplicates( philims ); + + for ( size_t iroi=0 ; iroi<offline->size() ; iroi++ ) { + + std::vector<TIDA::Track>& tracks = offline->rois()[iroi].tracks(); + + /// may well put the reporting back in, so leaving this + /// this in place + // size_t Noffline = tracks.size(); + + for ( std::vector<TIDA::Track>::iterator it=tracks.begin() ; it<tracks.end() ; ) { + bool inc = true; + if ( m_ptmin>0 ) { + if ( std::fabs(it->pT())<m_ptmin ) { inc=false; tracks.erase( it ); } + } + if ( inc && filterOnRoi() ) { + bool remove_track = true; + for ( size_t isub=0 ; isub<philims.size() ; isub++ ) { + + if ( philims[isub].first < philims[isub].second ) { + if ( it->phi()>=philims[isub].first && it->phi()<=philims[isub].second ) { + remove_track = false; + break; + } + } + else { + if ( it->phi()>=philims[isub].first || it->phi()<=philims[isub].second ) { + remove_track = false; + break; + } + } + } + if ( remove_track ) { inc=false; tracks.erase( it ); } + } + if ( inc ) it++; + } + + /// may well put the reporting back in, so leaving this + /// this in place + // m_provider->msg(MSG::DEBUG) << "TIDA::Roi offline track reduction: " << Noffline << " -> " << tracks.size() << endmsg; + + } + + } + + } + } + +#endif + + // if ( m_printInfo ) m_provider->msg(MSG::INFO) << "FILL TREE\n" << (*m_event) << endmsg; + if ( mTree ) mTree->Fill(); + +} + + + diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx index 78e4c0989100e83197bfd1530cea343fc2778be7..5166445fc35ecc6662550df6a4dda6cc928bf6c6 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx @@ -1764,8 +1764,6 @@ void AnalysisConfig_Ntuple::book() { m_provider->msg(MSG::INFO) << "[91;1m" << " booking ntuple" << "[m" << endmsg; m_provider->msg(MSG::INFO) << "[91;1m" << " trying to create new ntple file" << "[m" << endmsg; - gDirectory->pwd(); - /// save the current directory so we can return there after TDirectory* dir = gDirectory; @@ -1784,8 +1782,6 @@ void AnalysisConfig_Ntuple::book() { m_provider->msg(MSG::INFO) << "book() Writing to file " << outputFileName << endmsg; - gDirectory->pwd(); - if ( first_open || genericFlag() ) { /// create a brand new ntple mFile = new TFile( outputFileName.c_str(), "recreate"); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx index feae91074beeb7673b147284bc47707ac68681c5..562d9a1c142505681fc695be6e754b8446f41506 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx @@ -17,6 +17,7 @@ #include "TrigInDetAnalysisExample/TrigTestMonToolAC.h" #include "TrigInDetAnalysisExample/AnalysisConfig_Tier0.h" #include "TrigInDetAnalysisExample/AnalysisConfig_Ntuple.h" +#include "TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h" #include "TrigInDetAnalysisExample/ChainString.h" #include "AthenaMonitoring/AthenaMonManager.h" @@ -123,19 +124,25 @@ StatusCode TrigTestMonToolAC::init() { msg(MSG::DEBUG) << " ----- enter init() ----- " << endmsg; - msg(MSG::INFO) << "TrigTestMonToolAC::init() " << gDirectory->GetName() << endmsg; + msg(MSG::INFO) << "TrigTestMonToolAC::init() " << gDirectory->GetName() << " " << __DATE__ << endmsg; - // std::cout << "TrigTestMonToolAC::init() SUTT buildNtuple " << m_buildNtuple << std::endl; - // roi width information // m_roiInfo.etaHalfWidth(m_etaWidth); // m_roiInfo.phiHalfWidth(m_phiWidth); // m_roiInfo.zedHalfWidth(m_zedWidth); if ( m_buildNtuple ) { - m_sequences.push_back( new AnalysisConfig_Ntuple( &m_roiInfo, m_ntupleChainNames, - m_outputFileName, m_tauEtCutOffline, m_selectTruthPdgId, - m_keepAllEvents ) ); + if ( m_tdt->getNavigationFormat() == "TriggerElement" ) { + m_sequences.push_back( new AnalysisConfig_Ntuple( &m_roiInfo, m_ntupleChainNames, + m_outputFileName, m_tauEtCutOffline, m_selectTruthPdgId, + m_keepAllEvents ) ); + } + else { + m_sequences.push_back( new AnalysisConfigMT_Ntuple( &m_roiInfo, m_ntupleChainNames, + m_outputFileName, m_tauEtCutOffline, m_selectTruthPdgId, + m_keepAllEvents ) ); + } + m_sequences.back()->releaseData(m_releaseMetaData); if ( m_requireDecision ) m_sequences.back()->setRequireDecision(true); if ( m_mcTruth ) m_sequences.back()->setMCTruth(m_mcTruth); @@ -169,7 +176,7 @@ StatusCode TrigTestMonToolAC::book(bool newEventsBlock, bool newLumiBlock, bool bool newRun = newRunFlag(); #endif - msg(MSG::DEBUG) << "TrigTestMonToolAC::book() SUTT buildNtuple " << m_buildNtuple + msg(MSG::DEBUG) << "TrigTestMonToolAC::book() buildNtuple " << m_buildNtuple << "\tNewEventBlock " << newEventsBlock << "\tNewLumiBlock " << newLumiBlock << "\tNewRun " << newRun << std::endl; @@ -273,9 +280,6 @@ StatusCode TrigTestMonToolAC::book(bool newEventsBlock, bool newLumiBlock, bool msg(MSG::INFO) << "[91;1m" << "booking a Tier0 chain " << m_chainNames[i] << " [m" << endmsg; - // std::cout << "[91;1m" << "booking a Tier0 chain " << m_chainNames[i] << " [m" << std::endl; - - // if ( m_legacy && m_tdt->getNavigationFormat() == "TriggerElement" ) { if ( m_tdt->getNavigationFormat() == "TriggerElement" ) { m_sequences.push_back( new AnalysisConfig_Tier0(m_chainNames[i], diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt index b5f57a5be873794698bfdeb6d7754d35e4356f34..8137f81113fc726eb3151ca01ef5c56a63f55980 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODMuon Event/xAOD/xAODEgamma Event/xAOD/xAODTau + Event/xAOD/xAODTruth Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h index 230263358685f9c5eb73ec61fa3c9a1ab024a3ef..6b20b7cd5da9f79846c6e5c485247d5b6024000b 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h @@ -301,6 +301,37 @@ protected: /// new MT feature access + template<class Collection> + std::pair< typename Collection::const_iterator, typename Collection::const_iterator > + getCollection( const ElementLink<TrigRoiDescriptorCollection>& roi_link, + const std::string& key="" ) { + + /// will need this printout for debugging the feature access, so leave this commented + /// until it has been properly debugged, then it can be removed + // std::cout << "try " << key << "\t" << m_provider->evtStore()->template transientContains<Collection>(key) << std::endl; + + /// will not use the te name here, but keep it on just the + /// same for the time being, for subsequent development + std::string key_collection = key; + std::string key_tename = ""; + size_t pos = key_collection.find("/"); + if ( pos!=std::string::npos ) { + key_collection = key.substr( pos+1, key.size()-pos ); + key_tename = key.substr( 0, pos ); + } + + std::pair< typename Collection::const_iterator, + typename Collection::const_iterator > itrpair; + + SG::ReadHandle<Collection> handle(key); + + itrpair = (*m_tdt)->associateToEventView( handle, roi_link ); + + return itrpair; + } + + + template<class Collection> bool selectTracks( TrigTrackSelector* selector, // const TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> roi_link, diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h index 8da01df22003656ce4b03c1475442086cd4894a7..09a6a6f20557963f5d378a0e1746aadf5a11addf 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h @@ -32,6 +32,7 @@ #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenVertex.h" #include "AtlasHepMC/GenParticle.h" +#include "xAODTruth/TruthParticleContainer.h" ///// FrameWork includes @@ -63,8 +64,10 @@ class TrigTrackSelector : public TrackSelector { public: - // TrigTrackSelector( bool (*selector)(const TIDA::Track*)=NULL ) : TrackSelector(selector) { } - TrigTrackSelector( TrackFilter* selector ); + /// use a radius of 47 mm corresponding to the Run 1 pixel inner radius + /// For the IBL it should be 32 mm, but this was kept as 47 mm for consistency + /// of the definition. this should be changed to 32 mm for Run 3 + TrigTrackSelector( TrackFilter* selector, double radius=47 ); ~TrigTrackSelector() { clear(); } @@ -97,6 +100,9 @@ public: // extract all the tracks from a TrackParticle collection and add them void selectTracks( const TruthParticleContainer* truthtracks ); + // extract all the tracks from a TrackParticle collection and add them + void selectTracks( const xAOD::TruthParticleContainer* truthtracks ); + bool selectTrack( const HepMC::GenParticle* track ); @@ -107,6 +113,8 @@ public: // add a TruthParticle bool selectTrack( const TruthParticle* track ); + bool selectTrack( const xAOD::TruthParticle* track ); + // make a TIDA::Track from a GenParticle TIDA::Track* makeTrack( const HepMC::GenParticle* track ); @@ -123,8 +131,6 @@ public: void selectTracks( const TrackCollection* trigtracks ); -#ifdef XAODTRACKING_TRACKPARTICLE_H - /// legacy run 2 selector access bool selectTrack( const xAOD::TrackParticle* track, void* =0); @@ -136,8 +142,6 @@ public: void selectTracks( xAOD::TrackParticleContainer::const_iterator trackitr, xAOD::TrackParticleContainer::const_iterator trackend, void* =0); -#endif - void correctToBeamline( double& z0, double& dz0, @@ -154,7 +158,9 @@ private: double m_yBeam; double m_zBeam; - bool m_correctTrkTracks; + bool m_correctTrkTracks; + + double m_radius; }; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx index 6ddae1704249c1dc71559dbd921f2845c92d8b2d..e514a67bccb84fdbf58b2be13556f4b9e36bff51 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx @@ -10,11 +10,13 @@ #include "TrigInDetAnalysisUtils/TrigTrackSelector.h" - // TrigTrackSelector( bool (*selector)(const TIDA::Track*)=NULL ) : TrackSelector(selector) { } -TrigTrackSelector::TrigTrackSelector( TrackFilter* selector ) : +#include "xAODTruth/TruthVertexContainer.h" + + +TrigTrackSelector::TrigTrackSelector( TrackFilter* selector, double radius ) : TrackSelector(selector), m_id(0), m_xBeam(0), m_yBeam(0), m_zBeam(0), - //m_first(true), - m_correctTrkTracks(false) { } + m_correctTrkTracks(false), + m_radius(radius) { } bool TrigTrackSelector::selectTrack( const TrigInDetTrack* track, const TrigInDetTrackTruthMap* truthMap ) { @@ -260,7 +262,7 @@ void TrigTrackSelector::selectTracks( const Rec::TrackParticleContainer* trigtra -// extract all the tracks from a TrackParticle collection and add them +// extract all the tracks from a TruthParticle collection and add them void TrigTrackSelector::selectTracks( const TruthParticleContainer* truthtracks ) { // std::cout << "\t\t\tSUTT \tTrackParticleContainer->size() = " << trigtracks->size() << std::endl; @@ -278,6 +280,24 @@ void TrigTrackSelector::selectTracks( const TruthParticleContainer* truthtracks } +// extract all the tracks from a xAOD::TruthParticle collection and add them +void TrigTrackSelector::selectTracks( const xAOD::TruthParticleContainer* truthtracks ) { + + xAOD::TruthParticleContainer::const_iterator trackitr = truthtracks->begin(); + xAOD::TruthParticleContainer::const_iterator trackend = truthtracks->end(); + + while ( trackitr!=trackend ) { + + selectTrack( *trackitr ); + + trackitr++; + + } // loop over tracks + +} + + +// add a TruthParticle from a GenParticle - easy, bet it doesn't work bool TrigTrackSelector::selectTrack( const HepMC::GenParticle* track ) { /// not a "final state" particle @@ -314,6 +334,144 @@ bool TrigTrackSelector::selectTrack( const TruthParticle* track ) { } + + +// add an xAOD::TruthParticle +bool TrigTrackSelector::selectTrack( const xAOD::TruthParticle* track ) { + + if ( track ) { + + /// lazy just to avoid a find-replace of measPer to track + const xAOD::TruthParticle* measPer = track; + + double pT = measPer->pt(); + double eta = measPer->eta(); + double phi = measPer->phi(); + + // AAARCH!!!!! the TrackParticle pT is NOT SIGNED!!!! ( I ask you! ) + if ( measPer->charge()<0 && pT>0 ) pT *= -1; + + /// need to calculate the origin, and the beamline, and the d0 and z0 + /// with respect to the beamline + /// leave this in until we have checked whether everything is implemented correctly + // double xbeam = getBeamX(); // track->vx(); + // double ybeam = getBeamY(); // track->vy(); + // double zbeam = getBeamZ(); // track->vz(); + + if ( !track->hasProdVtx() ) return false; + + /// need to calculate d0 and z0 correctly. + + double xp[3] = { measPer->prodVtx()->x(), measPer->prodVtx()->y(), measPer->prodVtx()->z() }; + + double theta = 2*std::atan( std::exp( -eta ) ); + double z0 = xp[2] - (xp[0]*std::cos(phi) + xp[1]*std::sin(phi))/std::tan(theta); + double d0 = xp[1]*std::cos(phi) - xp[0]*std::sin(phi); + + double xd[3] = { 0, 0, 0 }; + + if ( track->hasDecayVtx() ) { + xd[0] = track->decayVtx()->x(); + xd[1] = track->decayVtx()->y(); + xd[2] = track->decayVtx()->z(); + } + + double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] ); + double rd = std::sqrt( xd[0]*xd[0] + xd[1]*xd[1] ); + + + bool final_state = false; + + /// the is our new "final state" requirement + /// the inner and outer radii are in some sense + /// arbitrary - these correspond to an envelope + /// around the pixel detector, so the track must + /// pass through the entire pixel detector + /// NB: In order to ensure you don't miss any + /// tracks they really need to be the same + /// ie if a track brems in your "volume" + /// then you will miss that track, and + /// also the resulting track, even if it is + /// a high et track + const double inner_radius = m_radius; /// was hardcoded as 47 - now this can be set from the constructor + const double outer_radius = m_radius; + if ( ( track->hasProdVtx() && rp<=inner_radius ) && + ( !track->hasDecayVtx() || rd>outer_radius ) ) final_state = true; + + /// leave this in for the moment - we may need to uncomment this afterall + // if ( track->status() == 3 ) final_state = false; /// check its not a documentation particle + + if ( !final_state ) return 0; + + double deta = 0; + double dphi = 0; + double dz0 = 0; + double dd0 = 0; + + double dpT = 0; + + int nBlayerHits = 0; + int nPixelHits = 0; + int nSctHits = 0; + int nStrawHits = 0; + int nTrtHits = 0; + + double chi2 = 0; + double dof = 0; + + bool expectBL = false; + + nSctHits += 0; + nPixelHits += 0; + + /// get the total number of holes as well + int nSiHits = 0; + + unsigned long id = (unsigned long)track; + + unsigned bitmap = 0; + + int trackAuthor = 0; + +#if 0 + std::cout << "\t\t\tSUTT TP track" + << "\teta=" << eta + << "\tphi=" << phi + << "\tz0=" << z0 + << "\tpT=" << pT + << "\td0=" << d0 + << "\tfitter=" << fitter + << "\tauthor=" << trackAuthor + << "\tVTX x " << xp[0]<< "\ty " << xp[1] << "\tz " << xp[2] + << std::endl; +#endif + + // Create and save Track + + TIDA::Track* t = new TIDA::Track( eta, phi, z0, d0, pT, chi2, dof, + deta, dphi, dz0, dd0, dpT, + nBlayerHits, nPixelHits, nSctHits, nSiHits, + nStrawHits, nTrtHits, bitmap, 0, + trackAuthor, false, -1, -1, + expectBL, id) ; + + /// useful debug info - leave in + // std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl; + + if ( !addTrack( t ) ){ + delete t; + return false; + } + return true; + + } + return false; + +} + + + + // make a TIDA::Track from a GenParticle TIDA::Track* TrigTrackSelector::makeTrack( const HepMC::GenParticle* track ) { unsigned long id = (unsigned long)track; @@ -838,11 +996,11 @@ bool TrigTrackSelector::selectTrack( const xAOD::TrackParticle* track, void* ) { if ( patternrec[ipr] ) { icount++; trackAuthor |= (ipr >> 16); - static bool first = true; - if ( first && icount>1 ) { - std::cerr << "more than one pattern rec strategy " << ipr << "\t(suppressing further output)" << std::endl; - first = false; - } + // static bool first = true; + // if ( first && icount>1 ) { + // std::cerr << "more than one pattern rec strategy " << ipr << "\t(suppressing further output)" << std::endl; + // first = false; + // } } } diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h index 54a87a37143728709a293c58dc26d6971e1cba62..d41f9fea43f43fb9916195806171259eae6b31c5 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGGER_TGCCOINHIERARCHYCLASSIFYTOOL_H #define TRIGGER_TGCCOINHIERARCHYCLASSIFYTOOL_H +#include "TrigMuonCoinHierarchy/ITgcCoinHierarchyClassifyTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" -#include "TrigMuonCoinHierarchy/ITgcCoinHierarchyClassifyTool.h" #include "TrigMuonCoinHierarchy/TgcCoinHierarchy.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -class Identifier; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Trigger { @@ -20,8 +19,7 @@ class TgcCoinHierarchyClassifyTool : virtual public ITgcCoinHierarchyClassifyToo /** Constructor */ TgcCoinHierarchyClassifyTool(const std::string& t, const std::string& n, const IInterface* p); - /** Destructor */ - virtual ~TgcCoinHierarchyClassifyTool(void) {}; + virtual ~TgcCoinHierarchyClassifyTool()=default; /** Query Interface */ StatusCode queryInterface(const InterfaceID& riid, void** ppvIf); @@ -31,8 +29,6 @@ class TgcCoinHierarchyClassifyTool : virtual public ITgcCoinHierarchyClassifyToo /** Initialize */ virtual StatusCode initialize(); - /** Finalize */ - virtual StatusCode finalize(); /** Make TgcCoinHierarchyTriggerSector's from TgcCoinDataContainer and TgcPrepDataContainer */ virtual StatusCode classify(std::vector<TgcCoinHierarchyTriggerSector*>* pTrigSectorCombs); @@ -40,15 +36,13 @@ class TgcCoinHierarchyClassifyTool : virtual public ITgcCoinHierarchyClassifyToo /** Get TgcCoinHierarchy::STATION enum from an Indentifier */ virtual TgcCoinHierarchy::STATION getSTATION(const Identifier identify) const; /** Get trigger sector from an Identifier */ - virtual bool getTriggerSector(const Identifier identify, unsigned int& isAside, unsigned int& isForward, - unsigned int& phi) const; + virtual bool getTriggerSector(const Identifier identify, unsigned int& isAside, unsigned int& isForward, unsigned int& phi) const; /** Get isStrip from an Identifier */ virtual bool isStrip(const Identifier identify) const; private: - /** Tool for TgcIdHelper */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + /** Map from trigger sector to TgcCoinHierarchyTriggerSector number */ int m_idVector[TgcCoinHierarchy::NSIDES][TgcCoinHierarchy::NREGIONS][TgcCoinHierarchy::NPHIS][TgcCoinHierarchy::NTIMING]; /** TgcCoinHierarchy instance used for conversions of enum's etc. */ @@ -56,10 +50,8 @@ class TgcCoinHierarchyClassifyTool : virtual public ITgcCoinHierarchyClassifyToo /** TgcCoinDataContainer name */ std::string m_tgcCoinDataContainerName[3]; - //std::string m_tgcCoinDataContainerName; /** TgcPrepDataContainer name */ std::string m_tgcPrepDataContainerName[3]; - //std::string m_tgcPrepDataContainerName; }; diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyFindTool.h b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyFindTool.h index bf1cadff1f55e9a552a139667d23638e451b1ddb..61479cc34e3d04426af745f28ccdc0a954af63f9 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyFindTool.h +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyFindTool.h @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGGER_TGCCOINHIERARCHYFINDTOOL_H #define TRIGGER_TGCCOINHIERARCHYFINDTOOL_H -#include "AthenaBaseComps/AthAlgTool.h" - #include "TrigMuonCoinHierarchy/ITgcCoinHierarchyFindTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" -#include "MuonRDO/TgcRdo.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonRDO/TgcRdo.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <fstream> @@ -25,7 +24,7 @@ class TgcCoinHierarchyFindTool : virtual public ITgcCoinHierarchyFindTool, virtu TgcCoinHierarchyFindTool(const std::string& t, const std::string& n, const IInterface* p); /** Destructor */ - virtual ~TgcCoinHierarchyFindTool(void) {}; + virtual ~TgcCoinHierarchyFindTool()=default; /** Query inteface */ StatusCode queryInterface(const InterfaceID& riid, void** ppvIf); @@ -35,8 +34,6 @@ class TgcCoinHierarchyFindTool : virtual public ITgcCoinHierarchyFindTool, virtu /** Initialize */ virtual StatusCode initialize(); - /** Finalize */ - virtual StatusCode finalize(); /** Find TgcCoinHierarchy's from a TgcCoinHierarchyTriggerSector */ virtual StatusCode find(TgcCoinHierarchyTriggerSector* pTrigSectorComb, @@ -198,9 +195,8 @@ class TgcCoinHierarchyFindTool : virtual public ITgcCoinHierarchyFindTool, virtu StatusCode findDummyTGC1HitFromHiPt(); StatusCode findDummyTGC23HitFromTracklet(); - /** Tool for TgcIdHelper */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + /** TgcCoinHierarchy instance used for conversions of enum's etc. */ TgcCoinHierarchy m_TCH; /* TGC Cabling service */ diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyValidation.h b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyValidation.h index 391870d5c132ff4e779a5b4b8ea76bd9daf85e31..456fdcea73c14144c4d633327f8f92770d4d285e 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyValidation.h +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/TrigMuonCoinHierarchy/TgcCoinHierarchyValidation.h @@ -1,19 +1,17 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGGER_TGCCOINHIERARCHYVALIDATION_H #define TRIGGER_TGCCOINHIERARCHYVALIDATION_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + #include "TrigMuonCoinHierarchy/TgcCoinHierarchy.h" #include "TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h" #include "MuonRDO/TgcRdo.h" - -//#include "TGCcablingInterface/ITGCcablingServerSvc.h" -//#include "MuonReadoutGeometry/MuonDetectorManager.h" -//#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <iostream> #include <fstream> @@ -58,9 +56,8 @@ namespace Trigger { /** ITgcCoinHierarchySvc */ ITgcCoinHierarchySvc* m_tgcCoinSvc; - /** MuonIdHelperTool and TgcCablingSvc */ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + const ITGCcablingSvc *m_tgcCabling; // TIMING diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyClassifyTool.cxx b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyClassifyTool.cxx index 6f29d8a94a51c4769f332bbb05ca9f8ad8675504..7a705a096f46cd39d9ce402492d3d7bebde91ad8 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyClassifyTool.cxx +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyClassifyTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h" @@ -44,13 +44,7 @@ namespace Trigger { StatusCode TgcCoinHierarchyClassifyTool::initialize() { ATH_MSG_DEBUG("initialize()"); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); - return StatusCode::SUCCESS; - } - - StatusCode TgcCoinHierarchyClassifyTool::finalize() { - ATH_MSG_DEBUG("finalize()"); - + ATH_CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -203,7 +197,7 @@ namespace Trigger { } // Add this hit to the corresponding TgcCoinHierarchyTriggerSector - TgcCoinHierarchy::TYPE p_type = m_TCH.isStripToTYPE(m_muonIdHelperTool->tgcIdHelper().isStrip(p_identify)); + TgcCoinHierarchy::TYPE p_type = m_TCH.isStripToTYPE(m_idHelperSvc->tgcIdHelper().isStrip(p_identify)); p_TrigSectorComb->setTiming(bc); p_TrigSectorComb->addHit(*ihh, p_type, p_station); sizeTgcPrepData++; @@ -219,9 +213,9 @@ namespace Trigger { } TgcCoinHierarchy::STATION TgcCoinHierarchyClassifyTool::getSTATION(Identifier identify) const { - if(!m_muonIdHelperTool->tgcIdHelper().is_tgc(identify)) return TgcCoinHierarchy::NOTSTATION; + if(!m_idHelperSvc->isTgc(identify)) return TgcCoinHierarchy::NOTSTATION; - int stationName = m_muonIdHelperTool->tgcIdHelper().stationName(identify); + int stationName = m_idHelperSvc->tgcIdHelper().stationName(identify); return m_TCH.stationNameToSTATION(stationName); } @@ -230,24 +224,24 @@ namespace Trigger { unsigned int& isForward, unsigned int& phi) const { // Check that Identifier is one of TGC - if(!m_muonIdHelperTool->tgcIdHelper().is_tgc(identify)) return false; + if(!m_idHelperSvc->isTgc(identify)) return false; // Check that Identifier is in TGC Big Wheel TgcCoinHierarchy::STATION station = getSTATION(identify); if(station==TgcCoinHierarchy::NOTSTATION) return false; - int stationName = m_muonIdHelperTool->tgcIdHelper().stationName(identify); + int stationName = m_idHelperSvc->tgcIdHelper().stationName(identify); isForward = static_cast<unsigned int>(m_TCH.stationNameToIsForward(stationName)); - isAside = static_cast<unsigned int>(m_muonIdHelperTool->tgcIdHelper().stationEta(identify)>0); + isAside = static_cast<unsigned int>(m_idHelperSvc->tgcIdHelper().stationEta(identify)>0); - phi = static_cast<unsigned int>(m_muonIdHelperTool->tgcIdHelper().stationPhi(identify)); + phi = static_cast<unsigned int>(m_idHelperSvc->tgcIdHelper().stationPhi(identify)); if(phi==0 || phi>=TgcCoinHierarchy::NPHIS) return false; return true; } bool TgcCoinHierarchyClassifyTool::isStrip(Identifier identify) const { - return m_muonIdHelperTool->tgcIdHelper().isStrip(identify); + return m_idHelperSvc->tgcIdHelper().isStrip(identify); } } // end of namespace Trigger diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyFindTool.cxx b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyFindTool.cxx index 132512d142c5158e864d59913aedbc51040d6ebc..fe3ae247618bff46e017d81287bbb37b736e9495 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyFindTool.cxx +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyFindTool.cxx @@ -1,16 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigMuonCoinHierarchy/TgcCoinHierarchyFindTool.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/TgcIdHelper.h" - #include "TGCcablingInterface/ITGCcablingServerSvc.h" - #include "TrigMuonCoinHierarchy/DummyHitChannelToOnlineID.h" - #include "PathResolver/PathResolver.h" using Muon::TgcCoinData; @@ -42,8 +38,7 @@ namespace Trigger { StatusCode TgcCoinHierarchyFindTool::initialize() { ATH_MSG_DEBUG("initialize()"); - // Retrieve MuonIdHelperTool - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve()); // Try to configure the cabling service StatusCode sc = getCabling(); @@ -59,12 +54,6 @@ namespace Trigger { return StatusCode::SUCCESS; } - StatusCode TgcCoinHierarchyFindTool::finalize() { - ATH_MSG_DEBUG("finalize()"); - - return StatusCode::SUCCESS; - } - StatusCode TgcCoinHierarchyFindTool::find(TgcCoinHierarchyTriggerSector* pTrigSectorComb, std::vector<TgcCoinHierarchy*>* pHierarchies) { ATH_MSG_DEBUG("find()"); @@ -436,7 +425,7 @@ namespace Trigger { if(hasTracklet) { const TgcCoinData* tracklet = pHierarchy->getCoincidence(TgcCoinData::TYPE_TRACKLET, isStrip); const Identifier trackletChannelId = tracklet->channelIdOut(); - trackletChannel = m_muonIdHelperTool->tgcIdHelper().channel(trackletChannelId); + trackletChannel = m_idHelperSvc->tgcIdHelper().channel(trackletChannelId); int trackletSubDetectorID = -1; int trackletRodID = -1; int trackletSswID = -1; @@ -462,8 +451,8 @@ namespace Trigger { } const Identifier hiptChannelIdOut = hiPt->channelIdOut(); - int hiptChannel = m_muonIdHelperTool->tgcIdHelper().channel(hiptChannelIdOut); - int hiptStationPhi = m_muonIdHelperTool->tgcIdHelper().stationPhi(hiptChannelIdOut); + int hiptChannel = m_idHelperSvc->tgcIdHelper().channel(hiptChannelIdOut); + int hiptStationPhi = m_idHelperSvc->tgcIdHelper().stationPhi(hiptChannelIdOut); int hiptSubDetectorID = -1; int hiptRodID = -1; int hiptSswID_out = -1; @@ -509,9 +498,7 @@ namespace Trigger { hiptSbLoc_in_strip, bitpos_in, hiptSlbChannel); } - const int hiPtStationEtaOut = m_muonIdHelperTool->tgcIdHelper().stationEta(hiptChannelIdOut); - // If abs(hiPtStationEtaOut) is 4 or 5, abs(m_muonIdHelperTool->tgcIdHelper().stationEta(hiPt->channelIdIn())) is 4. - // In other cases, abs(m_muonIdHelperTool->tgcIdHelper().stationEta(hiPt->channelIdIn())) is 2. + const int hiPtStationEtaOut = m_idHelperSvc->tgcIdHelper().stationEta(hiptChannelIdOut); TgcCoinHierarchy::TYPE type = (isStrip ? TgcCoinHierarchy::STRIP : TgcCoinHierarchy::WIRE); @@ -524,7 +511,7 @@ namespace Trigger { return StatusCode::FAILURE; } - const int hitStationEta = m_muonIdHelperTool->tgcIdHelper().stationEta(hit->identify()); + const int hitStationEta = m_idHelperSvc->tgcIdHelper().stationEta(hit->identify()); // HiPt Endcap Strip looses the information to distinguish A,B-inputs and C,D-inputs. // The minimum combinations of TGC3 (HiPt) and TGC1 (Hit) are checked. diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyValidation.cxx b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyValidation.cxx index a591fb4809fc4c8a96b3c2f6987639131f57aa7f..299527cf84f5633cce6b35d64be0e1d1e11c1007 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyValidation.cxx +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/src/TgcCoinHierarchyValidation.cxx @@ -1,23 +1,18 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigMuonCoinHierarchy/TgcCoinHierarchyValidation.h" #include "TrigMuonCoinHierarchy/ITgcCoinHierarchySvc.h" #include "TrigMuonCoinHierarchy/TgcCoinHierarchyClassifyTool.h" - #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonTrigCoinData/TgcCoinDataContainer.h" #include "muonEvent/MuonContainer.h" #include "TrkTrack/TrackCollection.h" - #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/TgcIdHelper.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" -#include "GaudiKernel/ITHistSvc.h" - #include <iomanip> #include <string> #include <climits> @@ -46,15 +41,6 @@ namespace Trigger { declareProperty("doCoin",m_doCoin=true); declareProperty("doHit" ,m_doHit=true); declareProperty("logName",m_logName); -/* - TgcCoinHierarchy *tmpTool = new TgcCoinHierarchy(); - if (m_timingName.compare("PRIOR")==0)m_bc = 0; - else if(m_timingName.compare("CURR" )==0)m_bc = 1; - else if(m_timingName.compare("NEXT" )==0)m_bc = 2; - else m_bc = UINT_MAX; - std::cout << __FILE__ << " set timing:" << m_timingName << ":" << m_bc << std::endl; - delete tmpTool; -*/ } StatusCode TgcCoinHierarchyValidation::initialize() { @@ -80,7 +66,7 @@ namespace Trigger { } // Prepare hit analysis // - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // Prepare log maker // if(!m_logName.empty()){ @@ -331,27 +317,27 @@ namespace Trigger { } int TgcCoinHierarchyValidation::getSTATION(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().stationName(id); + return m_idHelperSvc->tgcIdHelper().stationName(id); } int TgcCoinHierarchyValidation::getStEta(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().stationEta(id); + return m_idHelperSvc->tgcIdHelper().stationEta(id); } int TgcCoinHierarchyValidation::getStPhi(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().stationPhi(id); + return m_idHelperSvc->tgcIdHelper().stationPhi(id); } int TgcCoinHierarchyValidation::getGasgap(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().gasGap(id); + return m_idHelperSvc->tgcIdHelper().gasGap(id); } int TgcCoinHierarchyValidation::getChannel(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().channel(id); + return m_idHelperSvc->tgcIdHelper().channel(id); } int TgcCoinHierarchyValidation::getIsStrip(const Identifier id){ - return m_muonIdHelperTool->tgcIdHelper().isStrip(id); + return m_idHelperSvc->tgcIdHelper().isStrip(id); } diff --git a/Trigger/TrigConfiguration/TrigConfIO/python/HLTTriggerConfigAccess.py b/Trigger/TrigConfiguration/TrigConfIO/python/HLTTriggerConfigAccess.py index deadcde5bdbb38ce2cc11bfa42bc7638e3b90188..8aff51fee8b64ba8351c1ff7eb60bb63d6d67ed2 100644 --- a/Trigger/TrigConfiguration/TrigConfIO/python/HLTTriggerConfigAccess.py +++ b/Trigger/TrigConfiguration/TrigConfIO/python/HLTTriggerConfigAccess.py @@ -83,7 +83,7 @@ class HLTJobOptionsAccess(TriggerConfigAccess): super(HLTJobOptionsAccess,self).__init__( ConfigType.HLTJO, mainkey = "properties", filename = filename, dbalias = dbalias, dbkey = smkey ) self.loader.setQuery([ - "SELECT JO.HST_DATA FROM {schema}.SUPER_MASTER_TABLE SMT, {schema}.HLT_SETUP JO WHERE JO.HST_ID=SMT.SMT_HLT_JOBOPTIONS_ID AND SMT.SMT_ID={dbkey}", # for new db schema + "SELECT JO.HJO_DATA FROM {schema}.SUPER_MASTER_TABLE SMT, {schema}.HLT_JOBOPTIONS JO WHERE JO.HJO_ID=SMT.SMT_HLT_JOBOPTIONS_ID AND SMT.SMT_ID={dbkey}", # for new db schema "SELECT JO.JO_CONTENT FROM {schema}.SUPER_MASTER_TABLE SMT, {schema}.JO_MASTER_TABLE JO WHERE JO.JO_ID=SMT.SMT_JO_MASTER_TABLE_ID AND SMT.SMT_ID={dbkey}" # for current db schema ]) self.load() diff --git a/Trigger/TrigConfiguration/TrigConfIO/src/TrigDBJobOptionsLoader.cxx b/Trigger/TrigConfiguration/TrigConfIO/src/TrigDBJobOptionsLoader.cxx index adaa8b62e29d54a447d9ea5150a45e70f2b4fc18..38cef2c7cbd4332dd35fcb38842a1051a475eae1 100644 --- a/Trigger/TrigConfiguration/TrigConfIO/src/TrigDBJobOptionsLoader.cxx +++ b/Trigger/TrigConfiguration/TrigConfIO/src/TrigDBJobOptionsLoader.cxx @@ -42,18 +42,18 @@ namespace { auto & q = queries.back(); // tables q.addToTableList ( "SUPER_MASTER_TABLE", "SMT" ); - q.addToTableList ( "HLT_SETUP", "JO" ); + q.addToTableList ( "HLT_JOBOPTIONS", "JO" ); // bind vars q.extendBinding<int>("smk"); // conditions q.extendCondition("SMT.SMT_ID = :smk"); - q.extendCondition("AND JO.HST_ID=SMT.SMT_HLT_JOBOPTIONS_ID"); + q.extendCondition("AND JO.HJO_ID=SMT.SMT_HLT_JOBOPTIONS_ID"); // attributes q.extendOutput<std::string>( "SMT.SMT_NAME" ); q.extendOutput<int> ( "SMT.SMT_HLT_JOBOPTIONS_ID" ); - q.extendOutput<coral::Blob>( "JO.HST_DATA" ); + q.extendOutput<coral::Blob>( "JO.HJO_DATA" ); // the field with the data - q.setDataName("JO.HST_DATA"); + q.setDataName("JO.HJO_DATA"); } return queries; } diff --git a/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py b/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py index 0f68baca5dc39b2534bdf913dddc57280674e627..1ab28fb21efe52b855b3e77019c951357b34cf28 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py +++ b/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py @@ -23,8 +23,8 @@ from AthenaCommon.CFElements import seqAND decoder = HLTResultMTByteStreamDecoderAlg() costDataDeserialiser = TriggerEDMDeserialiserAlg("CostDataTrigDeserialiser") -from TriggerMenuMT.HLTMenuConfig.Menu import EventBuildingInfo -costDataDeserialiser.ModuleID = EventBuildingInfo.DataScoutingIdentifiers["CostMonDS"] +from TrigEDMConfig import DataScoutingInfo +costDataDeserialiser.ModuleID = DataScoutingInfo.DataScoutingIdentifiers["CostMonDS"] decodingSeq = seqAND("Decoding") decodingSeq += decoder diff --git a/Trigger/TrigEvent/TrigNavTools/TrigNavTools/TrigNavigationSlimmingHdlr.h b/Trigger/TrigEvent/TrigNavTools/TrigNavTools/TrigNavigationSlimmingHdlr.h deleted file mode 100644 index 708a04e894fad1aec7cc839774491ad1dc93bc5b..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/TrigNavTools/TrigNavigationSlimmingHdlr.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIG_NAVIGATION_SLIMMING_HLDR -#define TRIG_NAVIGATION_SLIMMING_HLDR - -#include "AthenaKernel/ISlimmingHdlr.h" - -#include <string> -#include <vector> - -#include <stdint.h> - - - -namespace HLT { - - class TrigNavigationSlimmingTool; - class HLTResult; - - class TrigNavigationSlimmingHdlr : public ::Athena::ISlimmingHdlr - { - - public: - - TrigNavigationSlimmingHdlr( const TrigNavigationSlimmingHdlr& rhs ); - - TrigNavigationSlimmingHdlr( HLT::HLTResult *result, - const INamedInterface *requestor, - HLT::TrigNavigationSlimmingTool *slimmer); - - ~TrigNavigationSlimmingHdlr(); - - void commit(); - - void rollback(); - - void *object(); - - std::type_info& type_id(); - - const ::INamedInterface* requester(); - - - void setName(const std::string &name) { m_name = name; }; - std::string name() { return m_name; }; - - private: - - HLT::HLTResult *m_result; - - const INamedInterface *m_requester; - - // nav and cuts data so that you can undo a slim - std::vector<uint32_t> m_unslimmedNavData; - std::vector<unsigned int> m_unslimmedCuts; - - HLT::TrigNavigationSlimmingTool *m_slimmer; - - std::string m_name; - - }; - -} - -#endif diff --git a/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h b/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h index 3ac68b93ba0f1c8e9ac7c2bfb1a590350bf36e50..037ffc7ab18810ee8b1b23eb1251476c68ad3144 100644 --- a/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h +++ b/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -8,12 +8,4 @@ @section TrigNavTools_TrigNavToolsIntro Introduction - This package contains tools and algorithms for performing slimming of the - trigger Navigation structure: - - HLT::TrigNavigationSlimming is an algorithm for performing slimming - - HLT::TrigNavigationSlimmingTool is a tool for performing slimming - - To use the TrigNavigationSlimming algorith, please use the topOptions in the - share directory - */ diff --git a/Trigger/TrigEvent/TrigNavTools/python/TrigNavToolsConfig.py b/Trigger/TrigEvent/TrigNavTools/python/TrigNavToolsConfig.py index 52ddbbd30200ec0ddd1724615cce18c6950f1abf..b859cbdb2a06d1412984972890b4427a3d636fbb 100644 --- a/Trigger/TrigEvent/TrigNavTools/python/TrigNavToolsConfig.py +++ b/Trigger/TrigEvent/TrigNavTools/python/TrigNavToolsConfig.py @@ -1,10 +1,10 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AppMgr import ToolSvc -from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool, TrigNavigationThinningTool def slimmingTool( config ): + from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool global ToolSvc assert 'name' in config, 'name of the configuration is missing' assert 'mode' in config, 'mode of slimming has to be configured' @@ -30,30 +30,12 @@ def slimmingTool( config ): ToolSvc += SlimTool return SlimTool -def navigationSlimming( config ): - global ToolSvc - - SlimTool = slimmingTool(config) - assert 'ThinningSvc' in config, 'Instance of thinning svc to talk to is indispensable' - assert config['ThinningSvc'], 'No ThinningSvc given' - - ThinTool = TrigNavigationThinningTool(config['name']+'Thin') - ThinTool.ThinningSvc = config['ThinningSvc'] - # ThinTool.ActInPlace=False - - if 'xAOD' in config: - ThinTool.ResultKey='' - ThinTool.xAODNavigationKey=config['result'] - ThinTool.ExtraInputs = [('xAOD::TrigNavigation','StoreGateSvc+TrigNavigation')] - - if 'result' in config: - ThinTool.ResultKey=config['result'] - else: - ThinTool.ResultKey='HLTResult_HLT' - ThinTool.SlimmingTool = SlimTool - ToolSvc += ThinTool - - return ThinTool - - +def navigationThinningSvc (config): + from TrigNavTools.TrigNavToolsConf import TrigNavigationThinningSvc + slimTool = slimmingTool (config) + svc = TrigNavigationThinningSvc (config['name'] + 'ThinSvc', + SlimmingTool = slimTool) + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr += svc + return svc diff --git a/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py b/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py index 92dc27f2691d2a78d38b7b8f8702b950f12abeef..e6d1d6443e6d9512ea6e985f4e17818cf16d23ac 100644 --- a/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py +++ b/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py @@ -12,19 +12,15 @@ def __addInput( stream, skip=[] ): elStream = MSMgr.NewPoolStream( 'elXAODStream', 'elXAOD.pool.root' ) -svcMgr += createThinningSvc(svcName='elThinningSvc', outStreams=[elStream.Stream]) __addInput(elStream) phStream = MSMgr.NewPoolRootStream( 'phXAODStream', 'phXAOD.pool.root' ) -svcMgr += createThinningSvc(svcName='phThinningSvc', outStreams=[phStream.Stream]) tauStream = MSMgr.NewPoolRootStream( 'tauXAODStream', 'tauXAOD.pool.root' ) -svcMgr += createThinningSvc(svcName='tauThinningSvc', outStreams=[tauStream.Stream]) -from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool, TrigNavigationThinningTool, HLT__StreamTrigNavSlimming -from TrigNavTools.TrigNavToolsConfig import navigationSlimming +from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel dk = DerivationFramework__DerivationKernel() @@ -39,11 +35,22 @@ tokeep = {'electron': ['HLT_TrigElectronContainer_L2ElectronFex', 'HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Tau_FTF'] } -dk.ThinningTools += [navigationSlimming({'name':'el', 'features':tokeep['electron'], 'chains':'HLT_e1.*', 'mode':'normal', 'ThinningSvc':svcMgr.elThinningSvc})] +def _addThinning (stream, svc): + for t in stream.GetEventStream().HelperTools: + if t.getType() == 'Athena::ThinningCacheTool': + t.TrigNavigationThinningSvc = svc + break + return -dk.ThinningTools += [navigationSlimming({'name':'ph', 'features':tokeep['photon'], 'chains':'HLT_g.*|HLT_.g.*', 'mode':'normal', 'ThinningSvc':svcMgr.phThinningSvc})] -dk.ThinningTools += [navigationSlimming({'name':'tau', 'features':tokeep['tau'], 'chains':'HLT_tau.*|HLT_.tau.*', 'mode':'normal', 'ThinningSvc':svcMgr.tauThinningSvc})] +_addThinning (elStream, + navigationThinningSvc ({'name':'el', 'features':tokeep['electron'], 'chains':'HLT_e1.*', 'mode':'normal'})) + +_addThinning (phStream, + navigationThinningSvc ({'name':'ph', 'features':tokeep['photon'], 'chains':'HLT_g.*|HLT_.g.*', 'mode':'normal'})) + +_addThinning (tauStream, + navigationThinningSvc ({'name':'tau', 'features':tokeep['tau'], 'chains':'HLT_tau.*|HLT_.tau.*', 'mode':'normal'})) from AthenaCommon.AlgSequence import AlgSequence diff --git a/Trigger/TrigEvent/TrigNavTools/src/SlimmingHandler.h b/Trigger/TrigEvent/TrigNavTools/src/SlimmingHandler.h index 29783e80d11987be6de70809b64682beecf3f015..5531ca417b0c8c26572d1c7ab3d2ddd5c71c17c2 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/SlimmingHandler.h +++ b/Trigger/TrigEvent/TrigNavTools/src/SlimmingHandler.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef SlimmingHandler_h @@ -95,7 +95,6 @@ SlimmingHandler<ResultType>::SlimmingHandler(ResultType* result, template<class ResultType> void SlimmingHandler<ResultType>::commit() { - // log << MSG::DEBUG << "TrigNavigationSlimmingHdlr::commit() wiht slimming tool " << m_slimmer << endmsg; // do slimming and serialized to the m_result std::vector<uint32_t> temp; @@ -117,8 +116,6 @@ void SlimmingHandler<ResultType>::rollback() { // Athena::MsgStreamMember mlog(Athena::Options::Eager, m_name); // MsgStream log = mlog.get(); - // log << MSG::DEBUG << "TrigNavigationSlimmingHdlr::rollback()"; - // replace_data(m_result, m_unslimmedNavData); // // write the saved navigation data back into the hltresult diff --git a/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.cxx b/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.cxx deleted file mode 100644 index b5ba63bf074db1495e20d34d9a2de433a0c8b741..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "TrigNavigationThinningTool.h" -#include "StreamTrigNavSlimming.h" - -HLT::StreamTrigNavSlimming::StreamTrigNavSlimming(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_tool("HLT::TrigNavigationThinningTool/TrigNavigationThinningTool") { - declareProperty("ThinningTool", m_tool, "Tool instance which forwards the slimming request"); -} - -HLT::StreamTrigNavSlimming::~StreamTrigNavSlimming() { -} - -StatusCode HLT::StreamTrigNavSlimming::initialize() { - ATH_MSG_DEBUG( "StreamTrigNavSlimming::initialize()" ); - CHECK( m_tool.retrieve() ); - /* check is the tool is configured ok, but sgetProperty of AlgTool does not work - if ( bool(m_tool->getProperty("ActInPlace")) == true ) { - ATH_MSG_DEBUG( "StreamTrigNavSlimming::initialize() the thinning tool configured to act in place" ); - StatusCode::FAILURE; - } - */ - return StatusCode::SUCCESS; -} - -StatusCode HLT::StreamTrigNavSlimming::finalize() { - return StatusCode::SUCCESS; -} - -StatusCode HLT::StreamTrigNavSlimming::execute() { - ATH_MSG_DEBUG( "StreamTrigNavSlimming::execute()" ); - CHECK(m_tool->doThinning()); - return StatusCode::SUCCESS; -} - diff --git a/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.h b/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.h deleted file mode 100644 index ea01069234b72e6c7f9fb385304d4cbca17105ff..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/StreamTrigNavSlimming.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGNAVTOOLS_STREAMTRIGNAVIGATIONSLIMMING_H -#define TRIGNAVTOOLS_STREAMTRIGNAVIGATIONSLIMMING_H - -#include "DerivationFrameworkInterfaces/IThinningTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgorithm.h" - -namespace HLT { - - class HLTResult; - - class StreamTrigNavSlimming : public AthAlgorithm { - public: - StreamTrigNavSlimming(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~StreamTrigNavSlimming(); - - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - private: - ToolHandle<DerivationFramework::IThinningTool> m_tool; - - - }; // end StreamTrigNavSlimming class - -} // end HLT namespace - -#endif // #if HLT_SLIM_NAVIGATION_H diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.cxx b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.cxx deleted file mode 100644 index 98829efa516b8d713d538d7ee9902c0f4d23b452..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "TrigNavigationSlimming.h" - -using namespace HLT; - -HLT::TrigNavigationSlimming::TrigNavigationSlimming(const std::string& name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_tool("HLT::TrigNavigationThinningTool/TrigNavigationThinningTool") { - declareProperty("ThinningTool", m_tool, "Tool instance which forwards the slimming request"); -} - -StatusCode HLT::TrigNavigationSlimming::initialize() { - CHECK( m_tool.retrieve() ); - // here we shoudl check if the tool is well configured - return StatusCode::SUCCESS; -} - - -StatusCode HLT::TrigNavigationSlimming::execute() { - CHECK( m_tool->doThinning() ); - return StatusCode::SUCCESS; -} - -StatusCode HLT::TrigNavigationSlimming::finalize() { - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.h b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.h deleted file mode 100644 index 06e5e53d2e215ae1f49ad5782eb23d7e7a95d98c..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimming.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGNAVTOOLS_TRIGNAVIGATIONSLIMMING_H -#define TRIGNAVTOOLS_TRIGNAVIGATIONSLIMMING_H - - -#include "DerivationFrameworkInterfaces/IThinningTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgorithm.h" - - -namespace HLT { - - class TrigNavigationSlimming : public AthAlgorithm { - - public: - - TrigNavigationSlimming(const std::string& name, ISvcLocator *pSvcLocator); - ~TrigNavigationSlimming() { ; }; - - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - protected: - ToolHandle<DerivationFramework::IThinningTool> m_tool; - - }; // end of class TrigNavigationSlimming - -} // end of namespace HLT - -#endif diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimmingHdlr.cxx b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimmingHdlr.cxx deleted file mode 100644 index e8db22ca17c442da049d3e8bb7a6044045b2e996..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationSlimmingHdlr.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AthenaKernel/MsgStreamMember.h" - -#include "TrigSteeringEvent/HLTResult.h" -#include "StreamTrigNavSlimming.h" -#include "TrigNavTools/TrigNavigationSlimmingTool.h" -#include "TrigNavTools/TrigNavigationSlimmingHdlr.h" - -#include <iostream> - -HLT::TrigNavigationSlimmingHdlr::TrigNavigationSlimmingHdlr(HLT::HLTResult *result, - const INamedInterface* requester, - HLT::TrigNavigationSlimmingTool *slimmer) - : Athena::ISlimmingHdlr(), - m_result(result), - m_requester(requester), - m_slimmer(slimmer) { - - // copy the nav data and cuts data so you can undo a slim - m_unslimmedNavData = m_result->getNavigationResult(); - m_unslimmedCuts = m_result->getNavigationResultCuts(); - m_name = requester->name() + "Hdlr"; - -} - -HLT::TrigNavigationSlimmingHdlr::~TrigNavigationSlimmingHdlr() { -} - -void HLT::TrigNavigationSlimmingHdlr::commit() { - - // log << MSG::DEBUG << "TrigNavigationSlimmingHdlr::commit() wiht slimming tool " << m_slimmer << endmsg; - // do slimming and serialized to the m_result - if( m_slimmer->doSlimming( m_result->getNavigationResult() ).isFailure() ) { - Athena::MsgStreamMember mlog(Athena::Options::Eager, m_name); - MsgStream log = mlog.get(); - log << MSG::WARNING << "StreamTrigNavSlimming failed execute(). Unable to proceed... bailing out" << endmsg; - return; - } - - //log << MSG::DEBUG << "Performed actual slimming" << endmsg; -} - -void HLT::TrigNavigationSlimmingHdlr::rollback() { - - // Athena::MsgStreamMember mlog(Athena::Options::Eager, m_name); - // MsgStream log = mlog.get(); - - // log << MSG::DEBUG << "TrigNavigationSlimmingHdlr::rollback()"; - - // write the saved navigation data back into the hltresult - std::vector<uint32_t>& navData = m_result->getNavigationResult(); - std::vector<unsigned int>& cuts = m_result->getNavigationResultCuts(); - - navData.clear(); - navData.insert(navData.begin(), m_unslimmedNavData.begin(), m_unslimmedNavData.end()); - cuts.clear(); - cuts.insert(cuts.begin(), m_unslimmedCuts.begin(), m_unslimmedCuts.end()); - // log << MSG::DEBUG << "Rolled back the slimming" << endmsg; -} - -void *HLT::TrigNavigationSlimmingHdlr::object() { - - return m_result; - -} - -const ::INamedInterface* HLT::TrigNavigationSlimmingHdlr::requester() { - - return m_requester; - -} - -std::type_info& HLT::TrigNavigationSlimmingHdlr::type_id() { - - const std::type_info& i(typeid(HLT::HLTResult)); - return const_cast<std::type_info&>(i); - -} diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx index e70c919d02261824878be3015ced998f3d5ad91d..193bf23d525b70da67acf54f06e778a9672710ca 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx +++ b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx @@ -9,7 +9,7 @@ TrigNavigationThinningSvc::TrigNavigationThinningSvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), m_workerThinning("ThinningSvc", name), - m_slimmingTool("TrigNavigationThinningTool/TrigNavigationThinningTool/") + m_slimmingTool("TrigNavigationSlimmingTool/TrigNavigationSlimmingTool") { declareProperty("WorkerThinningSvc", m_workerThinning, "Service which deals wiht all requests except the navigation"); declareProperty("SlimmingTool", m_slimmingTool, "Tool responsible for the actual thinning"); diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.cxx b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.cxx deleted file mode 100644 index 855b673ba0a4d10d62cfa2ad0c27e744417d90d6..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigSteeringEvent/HLTResult.h" -#include "xAODTrigger/TrigNavigation.h" -#include "xAODTrigger/TrigNavigationAuxInfo.h" -#include "TrigNavigationThinningTool.h" -#include "SlimmingHandler.h" - -TrigNavigationThinningTool::TrigNavigationThinningTool(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), - m_thinningSvc("IThinningSvc/ThinningSvc", name), - m_slimmingTool("", this) - // m_slimmingTool("HLT::TrigNavigationSlimmingTool/TrigNavigationSlimmingTool", this) // a private instansce -{ - declareInterface<DerivationFramework::IThinningTool>(this); - declareProperty("ThinningSvc", m_thinningSvc, "Synchronize feature indexes with this instance of ThinningSvc"); - declareProperty("SlimmingTool", m_slimmingTool, "Tool instance which does the actual slimming"); - declareProperty("ResultKey", m_HLTResultKey = "HLTResult_HLT"); - declareProperty("xAODNavigationKey", m_xAODNavigationKey = "TrigNavigation"); - declareProperty("ActInPlace", m_actInPlace = false, "Run slimming on the spot (creates messes when multiple output streams are produced by the job!)"); -} - -TrigNavigationThinningTool::~TrigNavigationThinningTool(){ -} - -StatusCode TrigNavigationThinningTool::initialize() { - ATH_MSG_DEBUG( "TrigNavigationThinningTool::initialize()" ); - CHECK( m_thinningSvc.retrieve() ); - CHECK( m_slimmingTool.retrieve() ); - CHECK( m_slimmingTool->initialize() ); - return StatusCode::SUCCESS; -} -StatusCode TrigNavigationThinningTool::finalize() { - return StatusCode::SUCCESS; -} - - -template<> -xAOD::TrigNavigation* TrigNavigationThinningTool::createAndRecordResult(const std::string& key) const { - auto nav = new xAOD::TrigNavigation(); - auto store = new xAOD::TrigNavigationAuxInfo(); - nav->setStore(store); - - if ( evtStore()->record(nav, key).isFailure() ) { - ATH_MSG_ERROR( "Can not record the result xAODTrigNaviagtion in store, this is badly functioning and configuration needs fixing"); - return nullptr; - } - - if ( evtStore()->record(store, key+"Aux.").isFailure() ) { - ATH_MSG_ERROR( "Can not record the result (Aux) in store, this is badly functioning and configuration needs fixing"); - return nullptr; - } - - return nav; -} - - -StatusCode TrigNavigationThinningTool::doThinning() const { - ATH_MSG_DEBUG( "TrigNavigationThinningTool::doThinning()" ); - - // Check if there is a (const) HLTResult - HLT::HLTResult *hltresult = nullptr; - if ( not m_HLTResultKey.empty() and evtStore()->contains<HLT::HLTResult>(m_HLTResultKey) ) { - const HLT::HLTResult* cres = nullptr; - if ( evtStore()->retrieve( cres, m_HLTResultKey).isFailure() or cres==nullptr ) { - ATH_MSG_WARNING( "Unable to load HLT::HLTResult using key " << m_HLTResultKey ); - } - else { - hltresult = const_cast<HLT::HLTResult*>(cres); - } - } - - // Check if there is a xAOD::TrigNavigation, or create it - xAOD::TrigNavigation *xaodresult = nullptr; - if ( not m_xAODNavigationKey.empty() ) { - if ( not evtStore()->contains<xAOD::TrigNavigation>(m_xAODNavigationKey) ) { - ATH_MSG_DEBUG( "Absent xAOD::TrigNavigation of key " << m_xAODNavigationKey << ". Creating new one and registering it"); - xaodresult = createAndRecordResult<xAOD::TrigNavigation>(m_xAODNavigationKey); - } - if ( evtStore()->retrieve( xaodresult, m_xAODNavigationKey).isFailure() or xaodresult==nullptr ) { - ATH_MSG_WARNING( "Unable to load xAOD::TrigNavigation using key " << m_xAODNavigationKey ); - } - } - - if ( hltresult == nullptr and xaodresult == nullptr ) { - ATH_MSG_DEBUG( "Neither xAOD, not HLT navigations are present or required, doing nothing"); - return StatusCode::SUCCESS; - } - - - if ( m_actInPlace ) { - ATH_MSG_DEBUG( "Running navigation slimming in place" ); - std::vector<uint32_t> slimmedPayload; - CHECK( m_slimmingTool->doSlimming( slimmedPayload) ); - if ( hltresult ) { - hltresult->getNavigationResultCuts().clear(); - hltresult->getNavigationResult() = slimmedPayload; - } - if ( xaodresult ) { - xaodresult->setSerialized(slimmedPayload); - } - } else { - ATH_MSG_DEBUG( "Scheduling trigger navigation slimming while writing output file" ); - if ( hltresult ) { - SlimmingHandler<HLT::HLTResult> *hdlr - = new SlimmingHandler<HLT::HLTResult>(hltresult, this, m_slimmingTool.operator->()); - CHECK(m_thinningSvc->register_slimmer(hdlr)); - } - if (xaodresult ) { - SlimmingHandler<xAOD::TrigNavigation> *hdlr - = new SlimmingHandler<xAOD::TrigNavigation>(xaodresult, this, m_slimmingTool.operator->()); - CHECK(m_thinningSvc->register_slimmer(hdlr)); - - } - - - } - return StatusCode::SUCCESS; -} - - diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.h b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.h deleted file mode 100644 index 2c07894052651e468d60fb3de60109abfcf8001d..0000000000000000000000000000000000000000 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningTool.h +++ /dev/null @@ -1,37 +0,0 @@ -// -*- c++ -*- - -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGNAVTOOLS_TRIGNAVIGATIONTHINNINGTOOL_H -#define TRIGNAVTOOLS_TRIGNAVIGATIONTHINNINGTOOL_H - -#include "DerivationFrameworkInterfaces/IThinningTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IThinningSvc.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigNavTools/TrigNavigationSlimmingTool.h" - -class TrigNavigationThinningTool : public AthAlgTool, public DerivationFramework::IThinningTool { -public: - TrigNavigationThinningTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~TrigNavigationThinningTool(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode doThinning() const; - -private: - template<class ResultType> - ResultType* createAndRecordResult(const std::string& key) const; - - ServiceHandle<IThinningSvc> m_thinningSvc; - ToolHandle<HLT::TrigNavigationSlimmingTool> m_slimmingTool; - std::string m_HLTResultKey; - std::string m_xAODNavigationKey; - bool m_actInPlace; -}; - -#endif diff --git a/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx b/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx index 9b446e7ec13516d4e554e43d97a919959426433c..9da5ee43a220778a67393dc4ce4b10a3f8720e9a 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx +++ b/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx @@ -1,14 +1,8 @@ -#include "../StreamTrigNavSlimming.h" #include "TrigNavTools/TrigNavigationSlimmingTool.h" -#include "../TrigNavigationSlimming.h" -#include "../TrigNavigationThinningTool.h" #include "../TrigNavigationThinningSvc.h" DECLARE_COMPONENT( HLT::TrigNavigationSlimmingTool ) -DECLARE_COMPONENT( HLT::TrigNavigationSlimming ) -DECLARE_COMPONENT( HLT::StreamTrigNavSlimming ) -DECLARE_COMPONENT( TrigNavigationThinningTool ) DECLARE_COMPONENT( TrigNavigationThinningSvc ) diff --git a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResultMT.h b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResultMT.h index 9dc794738c899952b7ad736c54acc3f3968642cb..6036865344ce81ba338602d771a5986a89ce6536 100644 --- a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResultMT.h +++ b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResultMT.h @@ -162,6 +162,9 @@ namespace HLT { /// Add module ID to the list of truncated results void addTruncatedModuleId(const uint16_t moduleId); + // ------------------------- Extra helper methods -------------------------- + /// If there is at least one stream tag set, it means the event is accepted + bool isAccepted() const {return !m_streamTags.empty();} private: // ------------------------- Private data members -------------------------- diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoConfig.py b/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoConfig.py similarity index 62% rename from Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoConfig.py rename to Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoConfig.py index e70018acaf516d204db396346a7a20e59af61851..a0b39b9139ea37f3a6833b102e919b824dd477fd 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoConfig.py @@ -1,29 +1,48 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from TrigBphysHypo.TrigBphysHypoConf import TrigMultiTrkHypo, TrigMultiTrkHypoTool -from TrigBphysHypo.TrigMultiTrkHypoMonitoringConfig import TrigMultiTrkHypoMonitoring, TrigMultiTrkHypoToolMonitoring +from TrigBphysHypo.TrigBphysHypoConf import TrigMultiTrkComboHypo, TrigMultiTrkComboHypoTool +from TrigBphysHypo.TrigMultiTrkComboHypoMonitoringConfig import TrigMultiTrkComboHypoMonitoring, TrigMultiTrkComboHypoToolMonitoring from AthenaCommon.Logging import logging -log = logging.getLogger('TrigMultiTrkHypoConfig') - - -def TrigMultiTrkHypoToolFromDict(chainDict): - config = TrigMultiTrkHypoConfig() - tool = config.ConfigurationHypoTool(chainDict) +log = logging.getLogger('TrigMultiTrkComboHypoConfig') + +def DimuL2ComboHypoCfg(name): + log.debug('DimuL2ComboHypoCfg.name = %s ', name) + + config = TrigMultiTrkComboHypoConfig() + hypo = config.ConfigurationComboHypo( + trigSequenceName = 'Dimu', + trigLevel = 'L2', + trackCollection='HLT_IDTrack_Muon_FTF') + return hypo + +def DimuEFComboHypoCfg(name): + from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muonNames + log.debug('DimuEFComboHypoCfg.name = %s ', name) + + config = TrigMultiTrkComboHypoConfig() + hypo = config.ConfigurationComboHypo( + trigSequenceName = 'Dimu', + trigLevel = 'EF', + muonCollection = muonNames().getNames('RoI').EFCBName) + return hypo + +def TrigMultiTrkComboHypoToolFromDict(chainDict): + config = TrigMultiTrkComboHypoConfig() + tool = config.ConfigurationComboHypoTool(chainDict) return tool +class TrigMultiTrkComboHypoConfig(object): -class TrigMultiTrkHypoConfig(object): - - def ConfigurationHypo(self, trigSequenceName='Dimu', trigLevel='L2', trackCollection='', muonCollection=''): + def ConfigurationComboHypo(self, trigSequenceName='Dimu', trigLevel='L2', trackCollection='', muonCollection=''): trigLevelDict = {'L2':0, 'EF':1} try: value = trigLevelDict[trigLevel] - log.debug('TrigMultiTrkHypo.trigLevel = %s ', value) + log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value) except KeyError: - log.error('TrigMultiTrkHypo.trigLevel should be L2 or EF, but %s provided.', trigLevel) + log.error('TrigMultiTrkComboHypo.trigLevel should be L2 or EF, but %s provided.', trigLevel) from TrkExTools.AtlasExtrapolator import AtlasExtrapolator from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter @@ -41,26 +60,29 @@ class TrigMultiTrkHypoConfig(object): MaxPhi = [ 10000., 10000., 10000.], MaxChi2OfVtxEstimation = 2000.) - tool = TrigMultiTrkHypo( - name = trigSequenceName+'HypoAlg'+trigLevel, + tool = TrigMultiTrkComboHypo( + name = trigSequenceName+trigLevel+'ComboHypo', trigLevel = trigLevel, nTracks = 2, massRanges = [ (100., 20000.) ], TrackCollectionKey = trackCollection, MuonCollectionKey = muonCollection, - TrigBphysCollectionKey = ('TrigBphys' if trigLevel == 'L2' else 'TrigBphysEF') + trigSequenceName, VertexFitter = VertexFitter, VertexPointEstimator = VertexPointEstimator, - MonTool = TrigMultiTrkHypoMonitoring('TrigMultiTrkHypoMonitoring_'+trigSequenceName+trigLevel)) + CheckMultiplicityMap = False, + MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+trigSequenceName+trigLevel)) + + if trigLevel == 'EF': + tool.TrigBphysCollectionKey = 'HLT_'+trigSequenceName+trigLevel return tool - def ConfigurationHypoTool(self, chainDict): + def ConfigurationComboHypoTool(self, chainDict): topoAlgs = chainDict['chainName'] log.debug("Set for algorithm %s", topoAlgs) - tool = TrigMultiTrkHypoTool(topoAlgs) + tool = TrigMultiTrkComboHypoTool(topoAlgs) if 'nocut' in topoAlgs: tool.AcceptAll = True @@ -71,7 +93,6 @@ class TrigMultiTrkHypoConfig(object): tool.ApplyUpperMassCut = True tool.ApplyChi2Cut = True tool.Chi2VtxCut = 20 - tool.nBphysObjects = 1 tool.trkPtThresholds = getBphysThresholds(chainDict) if 'bJpsimumu' in topoAlgs: @@ -91,7 +112,7 @@ class TrigMultiTrkHypoConfig(object): tool.LowerMassCut = 100 #MeV tool.UpperMassCut = 14000 #MeV - tool.MonTool = TrigMultiTrkHypoToolMonitoring('MonTool') + tool.MonTool = TrigMultiTrkComboHypoToolMonitoring('MonTool') return tool diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoMonitoringConfig.py b/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoMonitoringConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..c571b0e8ae186337641029b70691e83a2ade87af --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkComboHypoMonitoringConfig.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram + +class TrigMultiTrkComboHypoMonitoring(GenericMonitoringTool): + def __init__ (self, name): + super(TrigMultiTrkComboHypoMonitoring, self).__init__(name) + if 'L2' in name: + self.Histograms = [ + defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100), + defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100), + defineHistogram('acceptance', type='TH1F',path='EXPERT', title="filter acceptance", xbins=2, xmin=0, xmax=2), + defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=1000), + ] + elif 'EF' in name: + self.Histograms = [ + defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100), + defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100), + defineHistogram('nCombination', type='TH1F',path='EXPERT', title="number of track combinations before mass preselection", xbins=100, xmin=0, xmax=100), + defineHistogram('nCombinationBeforeFit', type='TH1F', path='EXPERT', title="number of inputs to the vertex fitter", xbins=100, xmin=0, xmax=100), + defineHistogram('nBPhysObject', type='TH1F', path='EXPERT', title="number of fitted BPhysObjects", xbins=100, xmin=0, xmax=100), + defineHistogram('trkMassBeforeFit', type='TH1F', path='EXPERT', title="mass of track combinations BEFORE fit [GeV]", xbins=200, xmin=0, xmax=100), + defineHistogram('bphysChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), + defineHistogram('bphysFitMass', type='TH1F', path='EXPERT', title="fit mass of N tracks; fit mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), + defineHistogram('bphysMass', type='TH1F', path='EXPERT', title="mass of N tracks; mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), + defineHistogram('bphysCharge', type='TH1F', path='EXPERT', title="total charge of N tracks", xbins=20, xmin=-10, xmax=10), + defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=1000), + ] + +class TrigMultiTrkComboHypoToolMonitoring(GenericMonitoringTool): + def __init__ (self, name): + super(TrigMultiTrkComboHypoToolMonitoring, self).__init__(name) + self.Histograms = [ + defineHistogram('totCharge', type='TH1F', path='EXPERT', title="Total Charge of tracks", xbins=21, xmin=-10, xmax=10), + defineHistogram('CutCounter', type='TH1F', path='EXPERT', title="mass of track pairs; m_{#mu#mu} [GeV]", xbins=5, xmin=-0.5, xmax=4.5), + defineHistogram('FitChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), + defineHistogram('VertexMass', type='TH1F', path='EXPERT', title="Number of tracks selected; N selected tracks", xbins=100, xmin=0, xmax=20), + defineHistogram('trackPts', type='TH1F', path='EXPERT', title="pair mass of N tracks; pair mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20) + ] diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoMonitoringConfig.py b/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoMonitoringConfig.py deleted file mode 100644 index a0950d52c04667460e0530c385786eccde3ed67c..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBphysHypo/python/TrigMultiTrkHypoMonitoringConfig.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram - -class TrigMultiTrkHypoMonitoring(GenericMonitoringTool): - def __init__ (self, name): - super(TrigMultiTrkHypoMonitoring, self).__init__(name) - self.Histograms = [ - defineHistogram('nTrk', type='TH1F', path='EXPERT', title="number of tracks in input views", xbins=100, xmin=0, xmax=100), - defineHistogram('nAcceptedTrk', type='TH1F', path='EXPERT', title="number of selected input tracks", xbins=100, xmin=0, xmax=100), - defineHistogram('nCombination', type='TH1F',path='EXPERT', title="number of track combinations before mass preselection", xbins=100, xmin=0, xmax=100), - defineHistogram('nCombinationBeforeFit', type='TH1F', path='EXPERT', title="number of inputs to the vertex fitter", xbins=100, xmin=0, xmax=100), - defineHistogram('nBPhysObject', type='TH1F', path='EXPERT', title="number of fitted BPhysObjects", xbins=100, xmin=0, xmax=100), - defineHistogram('trkMassBeforeFit', type='TH1F', path='EXPERT', title="mass of track combinations BEFORE fit [GeV]", xbins=200, xmin=0, xmax=100), - defineHistogram('bphysChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), - defineHistogram('bphysFitMass', type='TH1F', path='EXPERT', title="fit mass of N tracks; fit mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), - defineHistogram('bphysMass', type='TH1F', path='EXPERT', title="mass of N tracks; mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20), - defineHistogram('bphysCharge', type='TH1F', path='EXPERT', title="total charge of N tracks", xbins=20, xmin=-10, xmax=10), - defineHistogram('TIME_all', type='TH1F', path='EXPERT', title='execution time; [microseconds]', xbins=100, xmin=0, xmax=100), - ] - -class TrigMultiTrkHypoToolMonitoring(GenericMonitoringTool): - def __init__ (self, name): - super(TrigMultiTrkHypoToolMonitoring, self).__init__(name) - self.Histograms = [ - defineHistogram('totCharge', type='TH1F', path='EXPERT', title="Total Charge of tracks", xbins=21, xmin=-10, xmax=10), - defineHistogram('CutCounter', type='TH1F', path='EXPERT', title="mass of track pairs; m_{#mu#mu} [GeV]", xbins=5, xmin=-0.5, xmax=4.5), - defineHistogram('FitChi2', type='TH1F', path='EXPERT', title="chi2 fit of N tracks; fit chi2 of N selected tracks", xbins=100, xmin=0, xmax=100), - defineHistogram('VertexMass', type='TH1F', path='EXPERT', title="Number of tracks selected; N selected tracks", xbins=100, xmin=0, xmax=20), - defineHistogram('trackPts', type='TH1F', path='EXPERT', title="pair mass of N tracks; pair mass of N selected tracks [GeV]", xbins=100, xmin=0, xmax=20) - ] diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.cxx similarity index 52% rename from Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.cxx rename to Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.cxx index 8b698c4b4d117c2ab7f5e75685c900d18eb57cc1..271aedb7a98cc0838fd4793631f4a3d229ef9547 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.cxx @@ -4,7 +4,7 @@ /************************************************************************** ** - ** File: Trigger/TrigHypothesis/TrigBPhysHypo/TrigMultiTrkHypo.cxx + ** File: Trigger/TrigHypothesis/TrigBPhysHypo/TrigMultiTrkComboHypo.cxx ** ** Description: multi-track hypothesis algorithm ** @@ -12,7 +12,10 @@ ** **************************************************************************/ -#include "TrigMultiTrkHypo.h" +#include <algorithm> +#include <numeric> + +#include "TrigMultiTrkComboHypo.h" #include "xAODMuon/Muon.h" #include "xAODTracking/TrackParticle.h" @@ -22,6 +25,7 @@ #include "xAODTrigBphys/TrigBphysAuxContainer.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" +#include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigConfHLTData/HLTUtils.h" #include "AthViews/View.h" @@ -31,17 +35,19 @@ using TrigCompositeUtils::Decision; using TrigCompositeUtils::DecisionContainer; +using TrigCompositeUtils::DecisionID; using TrigCompositeUtils::DecisionIDContainer; - -TrigMultiTrkHypo::TrigMultiTrkHypo(const std::string& name, ISvcLocator* pSvcLocator) - : ::HypoBase(name, pSvcLocator) {} +TrigMultiTrkComboHypo::TrigMultiTrkComboHypo(const std::string& name, ISvcLocator* pSvcLocator) + : ::ComboHypo(name, pSvcLocator) {} -StatusCode TrigMultiTrkHypo::initialize() { +StatusCode TrigMultiTrkComboHypo::initialize() { ATH_MSG_DEBUG( "TrigMultiTrkHypo::initialize()" ); + ATH_CHECK( ::ComboHypo::initialize() ); + // check consistency of the properties if (m_trkMass.size() != m_nTrk) { ATH_MSG_ERROR( "Requested " << m_nTrk << " tracks per vertex, but only provided " << m_trkMass.size() << " track masses"); @@ -77,24 +83,67 @@ StatusCode TrigMultiTrkHypo::initialize() { ATH_CHECK( m_muonContainerKey.initialize(false) ); ATH_CHECK( m_trackParticleContainerKey.initialize() ); renounce(m_trackParticleContainerKey); + ATH_CHECK( m_trigBphysContainerKey.initialize(false) ); } else if (m_trigLevelString == "EF") { m_trigLevel = xAOD::TrigBphys::EF; ATH_CHECK( m_trackParticleContainerKey.initialize(false) ); ATH_CHECK( m_muonContainerKey.initialize() ); renounce(m_muonContainerKey); + ATH_CHECK( m_trigBphysContainerKey.initialize() ); } else { m_trigLevel = xAOD::TrigBphys::UNKOWNLEVEL; ATH_MSG_ERROR( "trigLevel should be L2 or EF, but " << m_trigLevelString << " provided" ); return StatusCode::FAILURE; } - ATH_CHECK( m_trigBphysContainerKey.initialize() ); ATH_CHECK( m_vertexFitter.retrieve() ); ATH_CHECK( m_vertexPointEstimator.retrieve() ); - ATH_CHECK( m_hypoTools.retrieve() ); + // allowed IDs to filter out incoming decisions at L2 level + for (const auto& item : triggerMultiplicityMap()) { + const HLT::Identifier id = HLT::Identifier::fromToolName(item.first); + m_allowedIDs.insert(id.numeric()); + if (item.second.size() > 1) { + for (size_t i = 0; i < item.second.size(); i++) { + m_allowedIDs.insert(TrigCompositeUtils::createLegName(id, i).numeric()); + } + } + } + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG( "Allowed decisions:" ); + for (const DecisionID& id : m_allowedIDs) { + ATH_MSG_DEBUG( " +++ " << HLT::Identifier(id) ); + } + } + + // add IDs to ComboHypoTools to check that each trigger leg fulfill TrigCompositeUtils::passed() requirement + for (auto& tool : hypoTools()) { + const HLT::Identifier id = tool->decisionId(); + const auto itr = triggerMultiplicityMap().find(id.name()); + if (itr == triggerMultiplicityMap().end()) { + ATH_MSG_ERROR( "No entry found for " << tool->name() << " in triggerMultiplicityMap" ); + } + const std::vector<int>& multiplicity = itr->second; + std::vector<HLT::Identifier> legDecisionIds; + if (multiplicity.size() == 1) { + std::fill_n(std::back_inserter(legDecisionIds), multiplicity[0], id); + } + else { + size_t n = static_cast<size_t>(std::accumulate(multiplicity.begin(), multiplicity.end(), 0)); + for (size_t i = 0; i < n; i++) { + legDecisionIds.push_back(TrigCompositeUtils::createLegName(id, i)); + } + } + tool->setLegDecisionIds(legDecisionIds); + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG( "Leg decisions for tool " << tool->name() ); + for (const auto& id : legDecisionIds) { + ATH_MSG_DEBUG( " +++ " << id ); + } + } + } if (!m_monTool.empty()) { ATH_CHECK( m_monTool.retrieve() ); @@ -108,23 +157,155 @@ StatusCode TrigMultiTrkHypo::initialize() { } -StatusCode TrigMultiTrkHypo::finalize() { +StatusCode TrigMultiTrkComboHypo::finalize() { TrigConf::HLTUtils::hashes2file(); return StatusCode::SUCCESS; } -StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { +StatusCode TrigMultiTrkComboHypo::execute(const EventContext& context) const { ATH_MSG_DEBUG( "TrigMultiTrkHypo::execute() starts" ); - ATH_MSG_DEBUG( "decision input key: " << decisionInput().key() ); - auto previousDecisionsHandle = SG::makeHandle(decisionInput(), context); + if (m_trigLevel == xAOD::TrigBphys::L2) { + ATH_CHECK( executeL2(context) ); + } + else if (m_trigLevel == xAOD::TrigBphys::EF) { + ATH_CHECK( executeEF(context) ); + } + + ATH_MSG_DEBUG( "TrigMultiTrkHypo::execute() terminates with StatusCode::SUCCESS" ); + return StatusCode::SUCCESS; +} + + +StatusCode TrigMultiTrkComboHypo::executeL2(const EventContext& context) const { + + ATH_MSG_DEBUG( "decision input key: " << decisionsInput().at(0).key() ); + auto previousDecisionsHandle = SG::makeHandle(decisionsInput().at(0), context); + CHECK( previousDecisionsHandle.isValid() ); + ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() << " previous decisions" ); + + // create the mutable output DecisionContainer and register it to StoreGate + SG::WriteHandle<DecisionContainer> outputHandle = TrigCompositeUtils::createAndStore(decisionsOutput().at(0), context); + DecisionContainer* decisions = outputHandle.ptr(); + + // monitored variables + auto mon_nTrk = Monitored::Scalar<int>("nTrk", 0); + auto mon_nAcceptedTrk = Monitored::Scalar<int>("nAcceptedTrk", 0); + auto mon_isEventAccepted = Monitored::Scalar<int>("acceptance", 0); + auto mon_timer = Monitored::Timer( "TIME_all" ); + + auto group = Monitored::Group(m_monTool, + mon_nTrk, mon_nAcceptedTrk, mon_isEventAccepted, + mon_timer); + + // combine all tracks from the event views, make overlap removal + std::vector<ElementLink<xAOD::TrackParticleContainer>> tracks; + size_t viewCounter = 0; + for (const Decision* previousDecision : *previousDecisionsHandle) { + auto viewLinkInfo = TrigCompositeUtils::findLink<ViewContainer>(previousDecision, TrigCompositeUtils::viewString(), true); + ATH_CHECK( viewLinkInfo.isValid() ); + auto viewEL = viewLinkInfo.link; + + std::vector<ElementLink<xAOD::TrackParticleContainer>> tracksFromView; + auto tracksHandle = ViewHelper::makeHandle(*viewEL, m_trackParticleContainerKey, context); + CHECK( tracksHandle.isValid() ); + ATH_MSG_DEBUG( "tracks handle " << m_trackParticleContainerKey << " size: " << tracksHandle->size() ); + + for (size_t idx = 0; idx < tracksHandle->size(); ++idx) { + tracksFromView.emplace_back(ViewHelper::makeLink<xAOD::TrackParticleContainer>(*viewEL, tracksHandle, idx)); + } + mon_nTrk += tracksFromView.size(); + + for (const auto& trackEL : tracksFromView) { + const xAOD::TrackParticle* track = *trackEL; + if (track->definingParametersCovMatrixVec().empty() || track->pt() < m_trkPt.value().back()) continue; + + if (viewCounter == 0 || + std::find_if(tracks.begin(), tracks.end(), + [this,track = track](const auto& x){ return isIdenticalTracks(track, *x); }) == tracks.end()) { + tracks.emplace_back(trackEL); + } + } + + viewCounter++; + } + std::sort(tracks.begin(), tracks.end(), [](const auto& lhs, const auto& rhs){ return ((*lhs)->pt() > (*rhs)->pt()); }); + + mon_nAcceptedTrk = tracks.size(); + ATH_MSG_DEBUG( "Select " << mon_nAcceptedTrk << " tracks and send them to vertex fitter" ); + + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG( "Dump found tracks before vertex fit: " ); + for (const auto& x : tracks) { + const xAOD::TrackParticle* track = *x; + ATH_MSG_DEBUG( " -- track pt/eta/phi/q: " << track->pt() << " / " << track->eta() << " / " << track->phi() << " / " << track->charge() ); + } + } + + mon_isEventAccepted = 0; + for (size_t itrk1 = 0; itrk1 < tracks.size(); ++itrk1) { + if (mon_isEventAccepted) break; + const xAOD::TrackParticle* trk1 = *tracks[itrk1]; + auto p1 = trk1->genvecP4(); + p1.SetM( m_trkMass[0] ); + if (p1.Pt() < m_trkPt[0]) continue; + + for (size_t itrk2 = itrk1 + 1; itrk2 < tracks.size(); ++itrk2) { + const xAOD::TrackParticle* trk2 = *tracks[itrk2]; + auto p2 = trk2->genvecP4(); + p2.SetM( m_trkMass[1] ); + if (p2.Pt() < m_trkPt[1]) continue; + + double mass = (p1 + p2).M(); + ATH_MSG_DEBUG( "track 1: " << p1.Pt()<< " / " << p1.Eta() << " / " << p1.Phi() << " / " << trk1->charge() ); + ATH_MSG_DEBUG( "track 2: " << p2.Pt()<< " / " << p2.Eta() << " / " << p2.Phi() << " / " << trk2->charge() ); + ATH_MSG_DEBUG( "track pair mass: " << mass ); + + if (!isInMassRange(mass)) continue; + + xAOD::TrigBphys* trigBphys = fit(std::vector<ElementLink<xAOD::TrackParticleContainer>>{tracks[itrk1], tracks[itrk2]}); + if (!trigBphys) continue; + + ATH_MSG_DEBUG( "Found good dimuon pair at L2 level: stop looking for dimuon pairs" ); + mon_isEventAccepted = 1; + delete trigBphys; + break; + } + } + + if (mon_isEventAccepted) { + ATH_MSG_DEBUG( "Copying decisions from " << decisionsInput().at(0).key() << " to " << decisionsOutput().at(0).key() ); + for (const Decision* previousDecision : *previousDecisionsHandle) { + DecisionIDContainer previousDecisionIDs; + TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs); + DecisionIDContainer decisionIDs; + std::set_intersection(previousDecisionIDs.begin(), previousDecisionIDs.end(), m_allowedIDs.begin(), m_allowedIDs.end(), + std::inserter(decisionIDs, decisionIDs.end())); + + Decision* decision = TrigCompositeUtils::newDecisionIn(decisions); + TrigCompositeUtils::linkToPrevious(decision, previousDecision, context); + TrigCompositeUtils::insertDecisionIDs(decisionIDs, decision); + } + } + else { + ATH_MSG_DEBUG( "No dimuon pairs found: no desicions will be copied to " << decisionsOutput().at(0).key() ); + } + + return StatusCode::SUCCESS; +} + + +StatusCode TrigMultiTrkComboHypo::executeEF(const EventContext& context) const { + + ATH_MSG_DEBUG( "decision input key: " << decisionsInput().at(0).key() ); + auto previousDecisionsHandle = SG::makeHandle(decisionsInput().at(0), context); CHECK( previousDecisionsHandle.isValid() ); ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() << " previous decisions" ); // create the mutable output DecisionContainer and register it to StoreGate - SG::WriteHandle<DecisionContainer> outputHandle = TrigCompositeUtils::createAndStore(decisionOutput(), context); + SG::WriteHandle<DecisionContainer> outputHandle = TrigCompositeUtils::createAndStore(decisionsOutput().at(0), context); DecisionContainer* decisions = outputHandle.ptr(); auto trigBphysHandle = SG::makeHandle(m_trigBphysContainerKey, context); @@ -154,34 +335,26 @@ StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { mon_trkMassBeforeFit, mon_bphysChi2, mon_bphysFitMass, mon_bphysMass, mon_bphysCharge, mon_timer); - // combine all tracks/muons from the event views, make overlap removal - std::vector<std::pair<ElementLink<xAOD::TrackParticleContainer>, const Decision*>> tracks; + // combine all muons from the event views, make overlap removal + std::vector<std::pair<ElementLink<xAOD::TrackParticleContainer>, ElementLinkVector<TrigCompositeUtils::DecisionContainer>>> tracks; size_t viewCounter = 0; for (const Decision* previousDecision : *previousDecisionsHandle) { - const auto viewEL = previousDecision->objectLink<ViewContainer>(TrigCompositeUtils::viewString()); - CHECK( viewEL.isValid() ); + auto previousDecisionEL = TrigCompositeUtils::decisionToElementLink(previousDecision, context); - std::vector<ElementLink<xAOD::TrackParticleContainer>> tracksFromView; - if (m_trigLevel == xAOD::TrigBphys::L2) { - auto tracksHandle = ViewHelper::makeHandle(*viewEL, m_trackParticleContainerKey, context); - CHECK( tracksHandle.isValid() ); - ATH_MSG_DEBUG( "tracks handle " << m_trackParticleContainerKey << " size: " << tracksHandle->size() ); + auto viewLinkInfo = TrigCompositeUtils::findLink<ViewContainer>(previousDecision, TrigCompositeUtils::viewString(), true); + ATH_CHECK( viewLinkInfo.isValid() ); + auto viewEL = viewLinkInfo.link; - for (size_t idx = 0; idx < tracksHandle->size(); ++idx) { - tracksFromView.emplace_back(ViewHelper::makeLink<xAOD::TrackParticleContainer>(*viewEL, tracksHandle, idx)); - } - } - else { - auto muonsHandle = ViewHelper::makeHandle(*viewEL, m_muonContainerKey, context); - CHECK( muonsHandle.isValid() ); - ATH_MSG_DEBUG( "muons handle " << m_muonContainerKey << " size: " << muonsHandle->size() ); - - for (const xAOD::Muon* muon : *muonsHandle) { - if (!muon->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)) continue; - const ElementLink<xAOD::TrackParticleContainer> trackEL = muon->inDetTrackParticleLink(); - CHECK( trackEL.isValid() ); - tracksFromView.emplace_back(trackEL); - } + std::vector<ElementLink<xAOD::TrackParticleContainer>> tracksFromView; + auto muonsHandle = ViewHelper::makeHandle(*viewEL, m_muonContainerKey, context); + CHECK( muonsHandle.isValid() ); + ATH_MSG_DEBUG( "muons handle " << m_muonContainerKey << " size: " << muonsHandle->size() ); + + for (const xAOD::Muon* muon : *muonsHandle) { + if (!muon->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)) continue; + const ElementLink<xAOD::TrackParticleContainer> trackEL = muon->inDetTrackParticleLink(); + CHECK( trackEL.isValid() ); + tracksFromView.emplace_back(trackEL); } mon_nTrk += tracksFromView.size(); @@ -189,13 +362,16 @@ StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { const xAOD::TrackParticle* track = *trackEL; if (track->definingParametersCovMatrixVec().empty() || track->pt() < m_trkPt.value().back()) continue; - if (viewCounter == 0 || - std::find_if(tracks.begin(), tracks.end(), - [this,track = track](const auto& x){ return isIdenticalTracks(track, *x.first); }) == tracks.end()) { - tracks.emplace_back(std::make_pair(trackEL, previousDecision)); + auto itr = (viewCounter ? std::find_if(tracks.begin(), tracks.end(), + [this,track = track](const auto& x){ return isIdenticalTracks(track, *x.first); }) + : tracks.end()); + if (itr == tracks.end()) { + tracks.emplace_back(std::make_pair(trackEL, ElementLinkVector<TrigCompositeUtils::DecisionContainer>(1, previousDecisionEL))); + } + else { + (*itr).second.push_back(previousDecisionEL); } } - viewCounter++; } std::sort(tracks.begin(), tracks.end(), [](const auto& lhs, const auto& rhs){ return ((*lhs.first)->pt() > (*rhs.first)->pt()); }); @@ -211,7 +387,7 @@ StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { } } - std::vector<std::vector<const Decision*>> trigBphysPreviousDecisions; + std::vector<std::vector<size_t>> trigBphysTrackIdx; for (size_t itrk1 = 0; itrk1 < tracks.size(); ++itrk1) { const xAOD::TrackParticle* trk1 = *tracks[itrk1].first; auto p1 = trk1->genvecP4(); @@ -242,7 +418,7 @@ StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { if (!trigBphys) continue; trigBphysHandle->push_back(trigBphys); - trigBphysPreviousDecisions.emplace_back(std::vector<const Decision*>{tracks[itrk1].second, tracks[itrk2].second}); + trigBphysTrackIdx.emplace_back(std::vector<size_t>{itrk1, itrk2}); mon_nBPhysObject++; bphysMass.push_back(mass * 0.001); @@ -250,56 +426,51 @@ StatusCode TrigMultiTrkHypo::execute(const EventContext& context) const { } } - std::vector<TrigMultiTrkHypoTool::TrigMultiTrkInfo> hypoToolInput; + std::map<ElementLinkVector<TrigCompositeUtils::DecisionContainer>, DecisionIDContainer> legDecisionIDsMap; + for (const auto& leg : tracks) { + auto itr = legDecisionIDsMap.find( leg.second ); + if (itr == legDecisionIDsMap.end()) { + DecisionIDContainer legDecisionIDs; + for (const ElementLink<DecisionContainer>& decisionEL : leg.second) { + TrigCompositeUtils::decisionIDs(*decisionEL, legDecisionIDs); + } + legDecisionIDsMap[leg.second] = legDecisionIDs; + } + } size_t idx = 0; for (const xAOD::TrigBphys* trigBphys : *trigBphysHandle) { - ATH_MSG_DEBUG( "Found xAOD::TrigBphys: mass = " << trigBphys->mass() ); // create a new output Decision object, backed by the 'decisions' container. Decision* decision = TrigCompositeUtils::newDecisionIn(decisions); + std::vector<DecisionIDContainer*> previousDecisionIDs; + for (size_t itrk : trigBphysTrackIdx[idx]) { + // attach all previous decisions: if the same previous decision is called twice, that's fine - internally takes care of that + for (const ElementLink<DecisionContainer>& previousDecisionEL : tracks[itrk].second) { + TrigCompositeUtils::linkToPrevious(decision, *previousDecisionEL, context); + } + auto& legDecisionIDs = legDecisionIDsMap[tracks[itrk].second]; + previousDecisionIDs.push_back(&legDecisionIDs); + } + // set mandatory feature ElementLink to xAOD::TrigBphys object decision->setObjectLink<xAOD::TrigBphysContainer>(TrigCompositeUtils::featureString(), ElementLink<xAOD::TrigBphysContainer>(*trigBphysHandle, trigBphys->index())); - DecisionIDContainer previousDecisionIDs_trk1; - DecisionIDContainer previousDecisionIDs_trk2; - for (size_t itrk = 0; itrk < 2; ++itrk) { - const Decision* previousDecision = trigBphysPreviousDecisions[idx][itrk]; - - // if the same previous decision is called twice, that's fine - internally takes care of that - TrigCompositeUtils::linkToPrevious(decision, previousDecision, context); - if (itrk == 0) { - TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs_trk1); - } - else { - TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs_trk2); - } - + for (const auto& tool : hypoTools()) { + ATH_MSG_DEBUG( "Go to " << tool ); + ATH_CHECK( tool->decideOnSingleObject(decision, previousDecisionIDs) ); } - // collect all the required information for the tool together in a handy struct - hypoToolInput.emplace_back(TrigMultiTrkHypoTool::TrigMultiTrkInfo{ - decision, trigBphys, previousDecisionIDs_trk1, previousDecisionIDs_trk2}); - ++idx; } - ATH_MSG_DEBUG( "Found "<< hypoToolInput.size() << " inputs to HypoTools" ); - for (auto& tool: m_hypoTools) { - ATH_MSG_DEBUG( "Go to " << tool ); - ATH_CHECK( tool->decide(hypoToolInput) ); - } - - ATH_CHECK( hypoBaseOutputProcessing(outputHandle) ); - - ATH_MSG_DEBUG( "TrigMultiTrkHypo::execute() terminates with StatusCode::SUCCESS" ); return StatusCode::SUCCESS; } -xAOD::TrigBphys* TrigMultiTrkHypo::fit(const std::vector<ElementLink<xAOD::TrackParticleContainer>>& trackParticleLinks) const { +xAOD::TrigBphys* TrigMultiTrkComboHypo::fit(const std::vector<ElementLink<xAOD::TrackParticleContainer>>& trackParticleLinks) const { xAOD::TrigBphys* result = nullptr; ATH_MSG_DEBUG( "Perform vertex fit" ); @@ -373,14 +544,14 @@ xAOD::TrigBphys* TrigMultiTrkHypo::fit(const std::vector<ElementLink<xAOD::Track } -bool TrigMultiTrkHypo::isIdenticalTracks(const xAOD::TrackParticle* lhs, const xAOD::TrackParticle* rhs) const { +bool TrigMultiTrkComboHypo::isIdenticalTracks(const xAOD::TrackParticle* lhs, const xAOD::TrackParticle* rhs) const { if (lhs->charge() * rhs->charge() < 0.) return false; return (ROOT::Math::VectorUtil::DeltaR(lhs->genvecP4(), rhs->genvecP4()) < m_deltaR); } -bool TrigMultiTrkHypo::isInMassRange(double mass) const { +bool TrigMultiTrkComboHypo::isInMassRange(double mass) const { bool result = false; for (const auto& range : m_massRange) { diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h similarity index 83% rename from Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.h rename to Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h index dbb368538d25bc870e03c309472bcb88f7946384..69a65e5abce830f17d54abd0cdf0917aa90ff2d9 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h @@ -4,7 +4,7 @@ /************************************************************************** ** - ** File: Trigger/TrigHypothesis/TrigBphysHypo/TrigMultiTrkHypo.h + ** File: Trigger/TrigHypothesis/TrigBphysHypo/TrigMultiTrkComboHypo.h ** ** Description: multi-track hypothesis algorithm ** @@ -12,8 +12,8 @@ ** **************************************************************************/ -#ifndef TRIG_TrigMultiTrkHypo_H -#define TRIG_TrigMultiTrkHypo_H +#ifndef TRIG_TrigMultiTrkComboHypo_H +#define TRIG_TrigMultiTrkComboHypo_H #include <string> #include <vector> @@ -22,13 +22,14 @@ #include "GaudiKernel/Property.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODMuon/MuonContainer.h" +#include "xAODTrigger/TrigComposite.h" #include "xAODTrigBphys/TrigBphysContainer.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "DecisionHandling/HypoBase.h" +#include "DecisionHandling/ComboHypo.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" #include "InDetConversionFinderTools/VertexPointEstimator.h" @@ -36,13 +37,13 @@ #include "AthenaMonitoringKernel/Monitored.h" #include "AthenaMonitoringKernel/GenericMonitoringTool.h" -#include "TrigMultiTrkHypoTool.h" +#include "TrigMultiTrkComboHypoTool.h" -class TrigMultiTrkHypo: public ::HypoBase { +class TrigMultiTrkComboHypo: public ::ComboHypo { public: - TrigMultiTrkHypo(const std::string& name, ISvcLocator* pSvcLocator); - TrigMultiTrkHypo() = delete; + TrigMultiTrkComboHypo(const std::string& name, ISvcLocator* pSvcLocator); + TrigMultiTrkComboHypo() = delete; virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& context) const override; @@ -53,7 +54,8 @@ class TrigMultiTrkHypo: public ::HypoBase { bool isReEntrant() const override { return false; } private: - + StatusCode executeL2(const EventContext& context) const; + StatusCode executeEF(const EventContext& context) const; xAOD::TrigBphys* fit(const std::vector<ElementLink<xAOD::TrackParticleContainer>>& tracklist) const; bool isIdenticalTracks(const xAOD::TrackParticle* lhs, const xAOD::TrackParticle* rhs) const; bool isInMassRange(double mass) const; @@ -61,7 +63,6 @@ class TrigMultiTrkHypo: public ::HypoBase { SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey {this, "TrackCollectionKey", "Tracks", "input TrackParticle container name"}; - SG::ReadHandleKey<xAOD::MuonContainer> m_muonContainerKey {this, "MuonCollectionKey", "CBCombinedMuon", "input EF Muon container name"}; @@ -80,9 +81,10 @@ class TrigMultiTrkHypo: public ::HypoBase { ToolHandle<InDet::VertexPointEstimator> m_vertexPointEstimator {this, "VertexPointEstimator", "", "tool to find starting point for the vertex fitter"}; ToolHandle<Trk::TrkVKalVrtFitter> m_vertexFitter {this, "VertexFitter", "", "VKalVrtFitter tool to fit tracks into the common vertex"}; - ToolHandleArray<TrigMultiTrkHypoTool> m_hypoTools {this, "HypoTools", {}, "tools to perform selection"}; ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", "monitoring tool"}; + TrigCompositeUtils::DecisionIDContainer m_allowedIDs; + }; -#endif // TRIG_TrigMultiTrkHypo_H +#endif // TRIG_TrigMultiTrkComboHypo_H diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.cxx similarity index 67% rename from Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.cxx rename to Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.cxx index b3361019cdaed455943f619a2cb9602a8285f6e8..90f2295d9b17ba4440fe8f9de68927e407650a5c 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.cxx @@ -6,40 +6,22 @@ ** ** File: Trigger/TrigHypothesis/TrigBPhysHypo/TrigMultiTrkHypoTool.cxx ** - ** Description: Multi-track hypothesis tool for bphys triggers + ** Description: multi-track hypothesis tool for bphys triggers ** - ** Author: H. Russell + ** Author: Heather Russell ** **************************************************************************/ -#include "TrigMultiTrkHypoTool.h" +#include "TrigMultiTrkComboHypoTool.h" -#include <math.h> +#include <cmath> -// additions of xAOD objects -#include "xAODTracking/TrackParticle.h" -#include "xAODTrigBphys/TrigBphys.h" -#include "xAODTrigBphys/TrigBphysContainer.h" +TrigMultiTrkComboHypoTool::TrigMultiTrkComboHypoTool(const std::string& type, const std::string& name, const IInterface* parent) + : ComboHypoToolBase(type, name, parent) {} -#include "AthenaMonitoringKernel/Monitored.h" -#include "TrigCompositeUtils/TrigCompositeUtils.h" - -class ISvcLocator; - - -TrigMultiTrkHypoTool::TrigMultiTrkHypoTool(const std::string & type, - const std::string & name, - const IInterface* parent ) - : AthAlgTool( type, name, parent ), - m_decisionId( HLT::Identifier::fromToolName( name ) ) -{} - -TrigMultiTrkHypoTool::~TrigMultiTrkHypoTool() -{ } - -StatusCode TrigMultiTrkHypoTool::initialize() +StatusCode TrigMultiTrkComboHypoTool::initialize() { ATH_MSG_DEBUG("AcceptAll = " << (m_acceptAll==true ? "True" : "False") ); if(m_TotChargeCut >=0)ATH_MSG_DEBUG("Total Charge Cut = " << m_TotChargeCut); @@ -70,8 +52,7 @@ StatusCode TrigMultiTrkHypoTool::initialize() } -//------------------------------------------------------------------------------------- -bool TrigMultiTrkHypoTool::decideOnSingleObject( const xAOD::TrigBphys* trigBphys, size_t ) const{ +bool TrigMultiTrkComboHypoTool::passed(const xAOD::TrigBphys* trigBphys) const { using namespace Monitored; @@ -125,7 +106,7 @@ bool TrigMultiTrkHypoTool::decideOnSingleObject( const xAOD::TrigBphys* trigBphy trackPts.push_back(tp->pt()); } mon_totCharge = totq; - thisPassedChargeCut = m_TotChargeCut <= -1 || (std::abs(totq) != m_TotChargeCut); + thisPassedChargeCut = m_TotChargeCut <= -1 || (std::abs(totq) == m_TotChargeCut); if(thisPassedChargeCut){ ATH_MSG_DEBUG("Passed charge cut with " << totq); } @@ -172,40 +153,25 @@ bool TrigMultiTrkHypoTool::decideOnSingleObject( const xAOD::TrigBphys* trigBphy return result; } -StatusCode TrigMultiTrkHypoTool::inclusiveSelection(std::vector<TrigMultiTrkHypoTool::TrigMultiTrkInfo>& toolInput) const{ - - for ( auto& i: toolInput ) { - //should this be configured to do something slightly differently? maybe we don't want the previous decision to pass this way?? - ATH_MSG_DEBUG("what is this? " << m_decisionId.numeric()); //hashing of the chain name - - //Make sure that BOTH tracks come from a previous muon that passed (for this chain) - //How could this not happen? no idea! - if ( TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs0 ) && - TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs1 ) ) { - if ( decideOnSingleObject( i.trigBphys, 0 )==true ) { - ATH_MSG_DEBUG("Passed through selection, decisionID:" << m_decisionId ); - TrigCompositeUtils::addDecisionID(m_decisionId, i.decision); - } else { - ATH_MSG_DEBUG("Didn't pass through selection, decisionID:" << m_decisionId ); - } - } else { - ATH_MSG_DEBUG("Didn't pass previous decision, decisionID:" << m_decisionId ); - } - } - return StatusCode::SUCCESS; -} -StatusCode TrigMultiTrkHypoTool::decide( std::vector<TrigMultiTrkHypoTool::TrigMultiTrkInfo> &input) const { +StatusCode TrigMultiTrkComboHypoTool::decideOnSingleObject(Decision* decision, const std::vector<DecisionIDContainer*>& previousDecisionIDs) const { + + ATH_CHECK( decision->hasObjectLink(TrigCompositeUtils::featureString()) ); - if ( m_nBphysObjects == 1 ) { - return inclusiveSelection( input ); - } else { - ATH_MSG_WARNING("TrigMultiTrkHypoTool is not configured to do multiple dimuon objects selection."); - ATH_MSG_WARNING("Clever overlap removal needed to ensure that dimuon objectss do not contain identical RoIs!"); - ATH_MSG_WARNING("I'm returning the inclusive selection result!"); - return inclusiveSelection( input ); + auto trigBphysEL = decision->objectLink<xAOD::TrigBphysContainer>(TrigCompositeUtils::featureString()); + ATH_CHECK( trigBphysEL.isValid() ); + ATH_CHECK( previousDecisionIDs.size() == legDecisionIds().size() ); + for (size_t i = 0; i < previousDecisionIDs.size(); ++i) { + if (!TrigCompositeUtils::passed(legDecisionId(i).numeric(), *previousDecisionIDs[i])) { + ATH_MSG_DEBUG( "Didn't pass previous decision: " << legDecisionId(i) ); + return StatusCode::SUCCESS; + } } -} + if (passed(*trigBphysEL)) { + TrigCompositeUtils::addDecisionID(decisionId(), decision); + } + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d53ad64b2fc2144d8dcca4b3a46f36e7c2fb4b31 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypoTool.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/************************************************************************** + ** + ** File: Trigger/TrigHypothesis/TrigBphysHypo/TrigMultiTrkComboHypoTool.h + ** + ** Description: multi-track hypothesis tool + ** + ** Author: Heather Russell + ** + **************************************************************************/ + +#ifndef TRIG_TrigMultiTrkComboHypoTool_H +#define TRIG_TrigMultiTrkComboHypoTool_H + +#include <string> +#include <vector> + +#include "DecisionHandling/ComboHypoToolBase.h" + +#include "xAODTrigBphys/TrigBphys.h" +#include "xAODTrigBphys/TrigBphysContainer.h" + +#include "TrigCompositeUtils/HLTIdentifier.h" +#include "TrigCompositeUtils/TrigCompositeUtils.h" + +#include "AthenaMonitoringKernel/Monitored.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" + +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionIDContainer; + + +class TrigMultiTrkComboHypoTool: public ComboHypoToolBase { + public: + TrigMultiTrkComboHypoTool(const std::string& type, const std::string& name, const IInterface* parent); + virtual StatusCode initialize() override; + virtual StatusCode decideOnSingleObject(Decision*, const std::vector<DecisionIDContainer*>&) const override; + + private: + bool passed(const xAOD::TrigBphys*) const; + virtual bool executeAlg(std::vector<LegDecision>&) const override { return true; } + + + // Mass window cuts + Gaudi::Property<int> m_nTrk { this, "nTrk",2,"Number of tracks in the vertex"}; + Gaudi::Property< int > m_TotChargeCut{this, "TotChargeCut", 0, "The Magnitude of the total charge to accept, negative is none" }; + Gaudi::Property< float > m_lowerMassCut{this, "LowerMassCut", -99. , "Lower mass cut for vertex " }; + Gaudi::Property< float > m_upperMassCut{this, "UpperMassCut", -99. , "Upper mass cut for vertex" }; + Gaudi::Property< bool >m_applyUpperMassCut{this, "ApplyUpperMassCut", false, "Apply the upper mass cut" }; + Gaudi::Property< bool > m_applyChi2Cut{this, "ApplyChi2Cut", false, "Apply a chi2 cut to vertex" }; + Gaudi::Property< float > m_chi2VtxCut{this, "Chi2VtxCut", -99. , "Chi2 cut for vertex (0 < chi2 < cut)" }; + Gaudi::Property<std::vector<float>> m_ptTrkMin { this, "trkPtThresholds", {3650, 3650} ,"minimum track pTs (one per track, sorted descending!)"}; + + // to set Accept-All mode: should be done with force-accept when possible + Gaudi::Property< bool > m_acceptAll {this, "AcceptAll", false, "Ignore selection" }; + + ToolHandle<GenericMonitoringTool> m_monTool { this, "MonTool", "", "Monitoring tool" }; + +}; + +#endif // TRIG_TrigMultiTrkComboHypoTool_H diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.h deleted file mode 100644 index 96b480c48d4e21a9014fdc89c8169708e5c40cd4..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkHypoTool.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/************************************************************************** - ** - ** File: Trigger/TrigHypothesis/TrigBphysHypo/TrigMultiTrkHypoTool.h - ** - ** Description: multi track hypothesis tool - ** - ** Author: H. Russell - ** - **************************************************************************/ - -#ifndef TRIG_TrigMultiTrkHypoTool_H -#define TRIG_TrigMultiTrkHypoTool_H - -// standard stuff -#include <string> -// general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" - -#include "Constants.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigCompositeUtils/HLTIdentifier.h" -#include "CLHEP/Units/SystemOfUnits.h" - -#include "xAODTrigBphys/TrigBphys.h" -#include "xAODTrigBphys/TrigBphysContainer.h" - -#include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "AthenaMonitoringKernel/GenericMonitoringTool.h" - -#include "TrigCompositeUtils/Combinators.h" - - -class TrigMultiTrkHypoTool: public ::AthAlgTool { - enum { MaxNumberTools = 20 }; - public: - TrigMultiTrkHypoTool(const std::string& type, - const std::string & name, - const IInterface* parent ); - - virtual ~TrigMultiTrkHypoTool(); - - struct TrigMultiTrkInfo { - TrigMultiTrkInfo( TrigCompositeUtils::Decision* d, const xAOD::TrigBphys* c, - const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs0, - const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs1 ) - : decision( d ), - trigBphys( c ), - previousDecisionIDs0 ( previousDecisionIDs0 ), - previousDecisionIDs1( previousDecisionIDs1 ) - - {} - - TrigCompositeUtils::Decision* decision; - const xAOD::TrigBphys* trigBphys; - const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs0; - const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs1; - - }; - - virtual StatusCode initialize() override; - virtual StatusCode decide(std::vector<TrigMultiTrkHypoTool::TrigMultiTrkInfo>& toolInput) const; - bool decideOnSingleObject(const xAOD::TrigBphys* trigBphys, size_t cutIndex) const; - StatusCode inclusiveSelection(std::vector<TrigMultiTrkHypoTool::TrigMultiTrkInfo>& toolInput) const; - - private: - - HLT::Identifier m_decisionId; - - - // Mass window cuts - Gaudi::Property<int> m_nTrk { this, "nTrk",2,"Number of tracks in the vertex"}; - Gaudi::Property< int > m_TotChargeCut{this, "TotChargeCut", 0, "The Magnitude of the total charge to accept, negative is none" }; - Gaudi::Property< float > m_lowerMassCut{this, "LowerMassCut", -99. , "Lower mass cut for vertex " }; - Gaudi::Property< float > m_upperMassCut{this, "UpperMassCut", -99. , "Upper mass cut for vertex" }; - Gaudi::Property< bool >m_applyUpperMassCut{this, "ApplyUpperMassCut", false, "Apply the upper mass cut" }; - Gaudi::Property< bool > m_applyChi2Cut{this, "ApplyChi2Cut", false, "Apply a chi2 cut to vertex" }; - Gaudi::Property< float > m_chi2VtxCut{this, "Chi2VtxCut", -99. , "Chi2 cut for vertex (0 < chi2 < cut)" }; - Gaudi::Property< int > m_nBphysObjects {this, "nBphysObjects", 1, "Number of good b-phys objects required per event" }; - Gaudi::Property<std::vector<float>> m_ptTrkMin { this, "trkPtThresholds", {3650, 3650} ,"minimum track pTs (one per track, sorted descending!)"}; - - // to set Accept-All mode: should be done with force-accept when possible - Gaudi::Property< bool > m_acceptAll {this, "AcceptAll", false, "Ignore selection" }; - - ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" }; - -}; - -#endif // TRIG_TrigMultiTrkHypoTool_H diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/components/TrigBphysHypo_entries.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/components/TrigBphysHypo_entries.cxx index 46c8d1f3b602286d480a66d6f5b3a5b3bbb4f0f5..7f303c13b493eee4cee2c1d8e596f2e969ac0dbc 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/components/TrigBphysHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/components/TrigBphysHypo_entries.cxx @@ -31,8 +31,8 @@ #include "../TrigEFMultiMuFex.h" #include "../TrigEFTrkMassFex.h" -#include "src/TrigMultiTrkHypo.h" -#include "src/TrigMultiTrkHypoTool.h" +#include "src/TrigMultiTrkComboHypo.h" +#include "src/TrigMultiTrkComboHypoTool.h" //#include "../TrigBphysL1DiMuComboFex.h" @@ -69,6 +69,6 @@ DECLARE_COMPONENT( TrigBphysMuonCounter ) DECLARE_COMPONENT( TrigBphysTrackRoiMaker ) DECLARE_COMPONENT( TrigBphysElectronCounter ) //DECLARE_COMPONENT( TrigBphysL1DiMuComboFex ) -DECLARE_COMPONENT( TrigMultiTrkHypo ) -DECLARE_COMPONENT( TrigMultiTrkHypoTool ) +DECLARE_COMPONENT( TrigMultiTrkComboHypo ) +DECLARE_COMPONENT( TrigMultiTrkComboHypoTool ) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/CMakeLists.txt b/Trigger/TrigHypothesis/TrigHLTJetHypo/CMakeLists.txt index 86849e30076fd5a29c8607d0b6faf689de904f4b..4cfbd3d6ba741417c7ecc4b36cb780ba7e41d7a0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/CMakeLists.txt +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/CMakeLists.txt @@ -1,22 +1,8 @@ -############################################################################### -# Package: TrigHLTJetHypo -############################################################################### +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# # Declare the package name: atlas_subdir( TrigHLTJetHypo ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Event/xAOD/xAODJet - GaudiKernel - Trigger/TrigEvent/TrigParticle - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigTools/TrigTimeAlgs - Trigger/TrigSteer/DecisionHandling - Trigger/TrigSteer/TrigCompositeUtils ) - # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -26,24 +12,20 @@ atlas_add_library( TrigHLTJetHypoLib src/TrigHLTJetHypoUtils/*.cxx PUBLIC_HEADERS TrigHLTJetHypo PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES xAODJet GaudiKernel TrigParticle TrigSteeringEvent TrigInterfacesLib TrigTimeAlgsLib DecisionHandlingLib TrigCompositeUtilsLib - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) + LINK_LIBRARIES AsgTools AthenaBaseComps DecisionHandlingLib GaudiKernel TrigCompositeUtilsLib TrigInterfacesLib TrigParticle TrigTimeAlgsLib xAODJet + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringKernelLib CaloGeoHelpers TrigMissingEtEvent xAODEventInfo xAODTrigger ) atlas_add_component( TrigHLTJetHypo src/components/*.cxx LINK_LIBRARIES TrigHLTJetHypoLib ) -atlas_add_test( TrigHLTJetHypoTool SCRIPT python -m TrigHLTJetHypo.TrigJetHypoToolConfig - POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --extend-ignore=E701 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - - # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +# Tests: atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/share + SCRIPT ${ATLAS_FLAKE8} ${CMAKE_CURRENT_SOURCE_DIR}/share POST_EXEC_SCRIPT nopost.sh ) + +atlas_add_test( TrigHLTJetHypoTool SCRIPT python -m TrigHLTJetHypo.TrigJetHypoToolConfig + POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/PartitionsGen.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/PartitionsGen.h index 88fb9b0b9a29e7bb1db34bba2a49149651c5281f..8ade07e7934b9100ef0015ab13bfebc9b38d3827 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/PartitionsGen.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/PartitionsGen.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -104,7 +104,7 @@ class PartitionsGen { bool m_valid{true}; std::vector<int> m_current; - std::size_t m_nc; + std::size_t m_nc = 0; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py index 068a05703b5bd824ed5828c5e51e53269f5fca0b..5e96bc834f989d5848e00e75a529e818e3e7eb40 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py @@ -5,23 +5,8 @@ from a hypo tree.""" from __future__ import print_function -from TrigHLTJetHypo.TrigHLTJetHypoConf import ( - TrigJetConditionConfig_abs_eta, - TrigJetConditionConfig_signed_eta, - TrigJetConditionConfig_et, - TrigJetConditionConfig_dijet_mass, - TrigJetConditionConfig_dijet_deta, - TrigJetConditionConfig_dijet_dphi, - TrigJetConditionConfig_qjet_mass, - TrigJetConditionConfig_moment, - TrigJetConditionConfig_smc, - TrigJetConditionConfig_jvt, - TrigJetConditionConfig_compound, - TrigJetConditionConfig_acceptAll, - TrigJetHypoToolConfig_fastreduction, - TrigJetHypoToolHelperMT, - ) +from AthenaConfiguration.ComponentFactory import CompFactory from TrigHLTJetHypo.node import Node @@ -29,6 +14,8 @@ from collections import defaultdict import copy +from AthenaCommon.Logging import logging +log = logging.getLogger( 'ConditionsToolSetterFastReduction' ) def is_leaf(node): return node.scenario in ('simple', 'etaet', 'dijet', 'qjet') @@ -48,21 +35,21 @@ class ConditionsToolSetterFastReduction(object): # for simple, use TrigJetConditionConfig_etaet. Needs to be # completed because simple can conain any single jet condition self.tool_factories = { - 'eta': [TrigJetConditionConfig_abs_eta, 0], - 'peta': [TrigJetConditionConfig_signed_eta, 0], - 'neta': [TrigJetConditionConfig_signed_eta, 0], - 'et': [TrigJetConditionConfig_et, 0], - 'djmass': [TrigJetConditionConfig_dijet_mass, 0], - 'djdphi': [TrigJetConditionConfig_dijet_dphi, 0], - 'djdeta': [TrigJetConditionConfig_dijet_deta, 0], - 'qjmass': [TrigJetConditionConfig_qjet_mass, 0], - 'momwidth': [TrigJetConditionConfig_moment, 0], - 'smc': [TrigJetConditionConfig_smc, 0], - 'jvt': [TrigJetConditionConfig_jvt, 0], - 'all': [TrigJetConditionConfig_acceptAll, 0], - 'compound': [TrigJetConditionConfig_compound, 0], - 'fastreduction': [TrigJetHypoToolConfig_fastreduction, 0], - 'helper': [TrigJetHypoToolHelperMT, 0], + 'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0], + 'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'et': [CompFactory.TrigJetConditionConfig_et, 0], + 'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0], + 'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0], + 'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0], + 'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0], + 'momwidth': [CompFactory.TrigJetConditionConfig_moment, 0], + 'smc': [CompFactory.TrigJetConditionConfig_smc, 0], + 'jvt': [CompFactory.TrigJetConditionConfig_jvt, 0], + 'all': [CompFactory.TrigJetConditionConfig_acceptAll, 0], + 'compound': [CompFactory.TrigJetConditionConfig_compound, 0], + 'fastreduction': [CompFactory.TrigJetHypoToolConfig_fastreduction, 0], + 'helper': [CompFactory.TrigJetHypoToolHelperMT, 0], } # map conaining parent child ids for the node @@ -376,7 +363,7 @@ class ConditionsToolSetterFastReduction(object): tree_map = {} self._fill_tree_map(root, tree_map) for k, v in tree_map.items(): - print ("Tree map debug %s %s", str(k), str(v)) + log.debug("Tree map debug %s %s", str(k), str(v)) self.treeVec = self._map_2_vec(tree_map) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFlowNetwork.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFlowNetwork.py index b6ca5c57f68e09d7fbbd86770293ff06c00d0003..7ba098fd38caad496359e60c43a6aad2abc5c819 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFlowNetwork.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFlowNetwork.py @@ -5,23 +5,7 @@ from a hypo tree.""" from __future__ import print_function -from TrigHLTJetHypo.TrigHLTJetHypoConf import ( - TrigJetConditionConfig_abs_eta, - TrigJetConditionConfig_signed_eta, - TrigJetConditionConfig_et, - TrigJetConditionConfig_dijet_mass, - TrigJetConditionConfig_dijet_deta, - TrigJetConditionConfig_dijet_dphi, - TrigJetConditionConfig_qjet_mass, - TrigJetConditionConfig_moment, - TrigJetConditionConfig_smc, - TrigJetConditionConfig_compound, - TrigJetConditionConfig_acceptAll, - TrigJetHypoToolConfig_flownetwork, - TrigJetHypoToolHelperMT, - ) - - +from AthenaConfiguration.ComponentFactory import CompFactory from TrigHLTJetHypo.node import Node from collections import defaultdict @@ -47,20 +31,20 @@ class ConditionsToolSetterFlowNetwork(object): # for simple, use TrigJetConditionConfig_etaet. Needs to be # completed because simple can conain any single jet condition self.tool_factories = { - 'eta': [TrigJetConditionConfig_abs_eta, 0], - 'peta': [TrigJetConditionConfig_signed_eta, 0], - 'neta': [TrigJetConditionConfig_signed_eta, 0], - 'et': [TrigJetConditionConfig_et, 0], - 'djmass': [TrigJetConditionConfig_dijet_mass, 0], - 'djdphi': [TrigJetConditionConfig_dijet_dphi, 0], - 'djdeta': [TrigJetConditionConfig_dijet_deta, 0], - 'qjmass': [TrigJetConditionConfig_qjet_mass, 0], - 'momwidth': [TrigJetConditionConfig_moment, 0], - 'smc': [TrigJetConditionConfig_smc, 0], - 'all': [TrigJetConditionConfig_acceptAll, 0], - 'compound': [TrigJetConditionConfig_compound, 0], - 'flownetwork': [TrigJetHypoToolConfig_flownetwork, 0], - 'helper': [TrigJetHypoToolHelperMT, 0], + 'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0], + 'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'et': [CompFactory.TrigJetConditionConfig_et, 0], + 'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0], + 'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0], + 'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0], + 'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0], + 'momwidth': [CompFactory.TrigJetConditionConfig_moment, 0], + 'smc': [CompFactory.TrigJetConditionConfig_smc, 0], + 'all': [CompFactory.TrigJetConditionConfig_acceptAll, 0], + 'compound': [CompFactory.TrigJetConditionConfig_compound, 0], + 'flownetwork': [CompFactory.TrigJetHypoToolConfig_flownetwork, 0], + 'helper': [CompFactory.TrigJetHypoToolHelperMT, 0], } # map conaining parent child ids for the node diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterHT.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterHT.py new file mode 100644 index 0000000000000000000000000000000000000000..c2a8236c6df68863d486377e849eea253deb10fc --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterHT.py @@ -0,0 +1,88 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +"""Instantiates TrigJetHypoToolConfig_fastreduction AlgTool +from a hypo tree.""" + +from __future__ import print_function + +from TrigHLTJetHypo.TrigHLTJetHypoConf import ( + TrigJetConditionConfig_ht, + TrigJetHypoToolConfig_ht, + TrigJetHypoToolHelperMT, +) + + +class ConditionsToolSetterHT(object): + + """Visitor to set instantiated AlgTools to a jet hypo tree""" + + def __init__(self, name): + + self.name = name + # for simple, use TrigJetConditionConfig_etaet. Needs to be + # completed because simple can conain any single jet condition + self.tool_factories = { + 'htcondition': [TrigJetConditionConfig_ht, 0], + 'htconfig': [TrigJetHypoToolConfig_ht, 0], + 'helper': [TrigJetHypoToolHelperMT, 0], + } + + + def _get_tool_instance(self, key, extra=''): + + klass = self.tool_factories[key][0] + sn = self.tool_factories[key][1] + + name = '%s_%d_fn' % (key, sn) + if extra: name += '_' + extra + tool = klass(name=name) + self.tool_factories[key][1] += 1 + return tool + + def report(self): + wid = max(len(k) for k in self.tool_factories.keys()) + rep = '\n%s: ' % self.__class__.__name__ + + rep += '\n'.join( + ['%s: %d' % (k.ljust(wid), v[1]) + for k, v in self.tool_factories.items()]) + + return rep + + def mod(self, node): + """Entry point for this module. HT specific. + Set up + TrigJetConditionConfig_ht, + TrigJetHypoToolConfig_h + TrigJetHypoToolHelperMT + """ + + # navigate the tree filling in node-parent and node- Condtion factory + # relations + + + # root = Node(scenario='root') + # root.children = [node] + + # self._check_scenarios(root) + + # root is an alias for node - as in ConditionTooSetterFastReduction + assert node.scenario == 'ht' + + print (node) + conditionMaker = self._get_tool_instance('htcondition') + config_tool = self._get_tool_instance('htconfig') + cut_windows = {} + [cut_windows.update(d) for d in node.conf_attrs] + print (cut_windows) + conditionMaker.htmin = cut_windows['ht']['min'] + conditionMaker.etmin = cut_windows['et']['min'] + conditionMaker.etamin = cut_windows['eta']['min'] + conditionMaker.etamax = cut_windows['eta']['max'] + print (conditionMaker) + + config_tool.conditionMakers = [conditionMaker] + helper_tool = self._get_tool_instance('helper') + helper_tool.HypoConfigurer = config_tool + + self.tool = helper_tool diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterTree.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterTree.py index 79ca521e8b9f2373dc5b770ddad75817d8a0c08c..1259283f5a47e3804cf52f6eee48e50f0eb8feb8 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterTree.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterTree.py @@ -4,31 +4,8 @@ from a hypo tree.""" from __future__ import print_function -from TrigHLTJetHypo.TrigHLTJetHypoConf import ( - TrigJetConditionConfig_abs_eta, - TrigJetConditionConfig_signed_eta, - TrigJetConditionConfig_et, - TrigJetConditionConfig_dijet_mass, - TrigJetConditionConfig_dijet_deta, - TrigJetConditionConfig_dijet_dphi, - TrigJetConditionConfig_qjet_mass, - TrigJetConditionConfig_moment, - TrigJetConditionConfig_smc, - TrigJetConditionConfig_jvt, - TrigJetHypoToolHelperMT, - TrigJetConditionConfig_compound, - TrigJetHypoToolConfig_leaf, - NotHelperTool, - AndHelperTool, - OrHelperTool, - CombinationsHelperTool, - TrigJetHypoToolConfig_combgen, - TrigJetHypoToolConfig_partgen, - ) - -from TrigHLTJetHypoUnitTests.TrigHLTJetHypoUnitTestsConf import ( - AgreeHelperTool, -) + +from AthenaConfiguration.ComponentFactory import CompFactory from collections import defaultdict @@ -37,31 +14,31 @@ class ConditionsToolSetterTree(object): def __init__(self, name): - self.name = name + self.name = name # for simple, use TrigJetConditionConfig_etaet. Needs to be # completed because simple can conain any single jet condition self.tool_factories = { - 'eta': [TrigJetConditionConfig_abs_eta, 0], - 'peta': [TrigJetConditionConfig_signed_eta, 0], - 'neta': [TrigJetConditionConfig_signed_eta, 0], - 'et': [TrigJetConditionConfig_et, 0], - 'djmass': [TrigJetConditionConfig_dijet_mass, 0], - 'djdphi': [TrigJetConditionConfig_dijet_dphi, 0], - 'djdeta': [TrigJetConditionConfig_dijet_deta, 0], - 'qjmass': [TrigJetConditionConfig_qjet_mass, 0], - 'momwidth': [TrigJetConditionConfig_moment, 0], - 'smc': [TrigJetConditionConfig_smc, 0], - 'jvt': [TrigJetConditionConfig_jvt, 0], - 'compound': [TrigJetConditionConfig_compound, 0], - 'leaf': [TrigJetHypoToolConfig_leaf, 0], - 'helper': [TrigJetHypoToolHelperMT, 0], - 'combgen_helper': [CombinationsHelperTool, 0], - 'not': [NotHelperTool, 0], - 'and': [AndHelperTool, 0], - 'agree': [AgreeHelperTool, 0], - 'or': [OrHelperTool, 0], - 'combgen': [TrigJetHypoToolConfig_combgen, 0], - 'partgen': [TrigJetHypoToolConfig_partgen, 0], + 'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0], + 'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0], + 'et': [CompFactory.TrigJetConditionConfig_et, 0], + 'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0], + 'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0], + 'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0], + 'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0], + 'momwidth': [CompFactory.TrigJetConditionConfig_moment, 0], + 'smc': [CompFactory.TrigJetConditionConfig_smc, 0], + 'jvt': [CompFactory.TrigJetConditionConfig_jvt, 0], + 'compound': [CompFactory.TrigJetConditionConfig_compound, 0], + 'leaf': [CompFactory.TrigJetHypoToolConfig_leaf, 0], + 'helper': [CompFactory.TrigJetHypoToolHelperMT, 0], + 'combgen_helper': [CompFactory.CombinationsHelperTool, 0], + 'not': [CompFactory.NotHelperTool, 0], + 'and': [CompFactory.AndHelperTool, 0], + 'agree': [CompFactory.AgreeHelperTool, 0], + 'or': [CompFactory.OrHelperTool, 0], + 'combgen': [CompFactory.TrigJetHypoToolConfig_combgen, 0], + 'partgen': [CompFactory.TrigJetHypoToolConfig_partgen, 0], } self.mod_router = { diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py index 749a7d141876183a439196f83d2e2988c4eeedee..0a88e3db38c05e26360c91bf3b1c8e8dff12a312 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py @@ -1,13 +1,15 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function -from TrigHLTJetHypo.TrigHLTJetHypoConf import TrigJetHypoToolMT +from AthenaConfiguration.ComponentFactory import CompFactory -from TrigHLTJetHypo.treeVisitors import TreeParameterExpander -from TrigHLTJetHypo.ConditionsToolSetterTree import ConditionsToolSetterTree -from TrigHLTJetHypo.ConditionsToolSetterFastReduction import ( +from TrigHLTJetHypo.treeVisitors import TreeParameterExpander +from TrigHLTJetHypo.ConditionsToolSetterTree import ConditionsToolSetterTree +from TrigHLTJetHypo.ConditionsToolSetterFastReduction import ( ConditionsToolSetterFastReduction, - ) +) + +from TrigHLTJetHypo.ConditionsToolSetterHT import ConditionsToolSetterHT from TrigHLTJetHypo.chainDict2jetLabel import chainDict2jetLabel @@ -26,11 +28,11 @@ def trigJetHypoToolHelperFromDict_(chain_label, tree = parser.parse() - + #expand strings of cuts to a cut dictionary visitor = TreeParameterExpander() tree.accept(visitor) - log.info(visitor.report()) + log.debug(visitor.report()) # tell the child nodes who their parent is. tree.set_ids(node_id=0, parent_id=0) @@ -39,10 +41,10 @@ def trigJetHypoToolHelperFromDict_(chain_label, # chain name in run 2 dicts were missing the 'HLT_' prefix # but it seems it is necessary to run the hypos in AthenaMT ?...? - + if not chain_name.startswith('HLT_'): chain_name = 'HLT_' + chain_name - + log.info('trigJetHypoToolFromDict chain_name %s', chain_name) # debug flag to be relayed to C++ objects @@ -55,7 +57,8 @@ def trigJetHypoToolHelperFromDict_(chain_label, else: if toolSetter.__class__.__name__ in ( - 'ConditionsToolSetterFastReduction',): + 'ConditionsToolSetterFastReduction', + 'ConditionsToolSetterHT'): toolSetter.mod(tree) tool = toolSetter.tool @@ -67,7 +70,7 @@ def trigJetHypoToolHelperFromDict_(chain_label, toolSetter = ConditionsToolSetterTree(chain_name) tool = tree.tool - log.info(visitor.report()) + log.debug(visitor.report()) return tool @@ -89,18 +92,23 @@ def trigJetHypoToolHelperFromDict(chain_dict): chain_dict['chainName'],) m += ' jet hypo scenario: %s' % ( chain_dict['chainParts'][0]['hypoScenario'],) - + log.error(m) - + raise e - + chain_name = chain_dict['chainName'] - toolSetter=ConditionsToolSetterFastReduction(chain_name) + toolSetter = None + if 'HT' in chain_name: + toolSetter=ConditionsToolSetterHT(chain_name) + else: + toolSetter=ConditionsToolSetterFastReduction(chain_name) + return trigJetHypoToolHelperFromDict_(chain_label, chain_name, toolSetter) - + def trigJetHypoToolFromDict(chain_dict): """Produce a jet trigger hypo tool from a chainDict""" @@ -108,7 +116,7 @@ def trigJetHypoToolFromDict(chain_dict): log.info('trigJetHypoToolFromDict chainDict %s', str(chain_dict)) chain_name = chain_dict['chainName'] - tool = TrigJetHypoToolMT(name=chain_name) + tool = CompFactory.TrigJetHypoToolMT(name=chain_name) # obtain a Helper Tool (possibly a tree of tools) to # make the hypo decision. @@ -117,8 +125,8 @@ def trigJetHypoToolFromDict(chain_dict): # controls whether debug visitor is sent to helper tool debug = False # SET TO False WHEN COMMITTING tool.visit_debug = debug - - log.info('%s', tool) + log.debug('%s', tool) + return tool @@ -132,7 +140,7 @@ class TestStringMethods(unittest.TestCase): for chain_name in chain_names: chain_dict = dictFromChainName(chain_name) tool = trigJetHypoToolFromDict(chain_dict) - self.assertIsNotNone(tool) + self.assertIsNotNone(tool) log.info('%s %s', chain_name.rjust(wid), tool) @@ -144,16 +152,16 @@ class TestDebugFlagIsFalse(unittest.TestCase): chain_name = 'HLT_j85_L1J20' chain_dict = dictFromChainName(chain_name) tool = trigJetHypoToolFromDict(chain_dict) - self.assertIsNotNone(tool) - self.assertFalse(tool.visit_debug) + self.assertIsNotNone(tool) + self.assertFalse(tool.visit_debug) + - def _tests(): from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName chainNameDecoder = DictFromChainName.DictFromChainName() - + chain_names = ( 'j80_0eta240_2j60_320eta490_L1J20', 'j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20', @@ -162,10 +170,10 @@ def _tests(): chain_dict = chainNameDecoder.getChainDict(cn) trigJetHypoToolFromDict(chain_dict) - + if __name__ == '__main__': unittest.main() - + # run _tests outide untit tests so as to see stdout # _tests() diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/cdTest.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/cdTest.py new file mode 100644 index 0000000000000000000000000000000000000000..aab6fdfce2e98b9e59b5afed3f0c2a5c1d8cfc93 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/cdTest.py @@ -0,0 +1,10 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from testChainDictMaker import testChainDictMaker + + +from chainDict2jetLabel import chainDict2jetLabel + +cds = testChainDictMaker() +for cd in cds: + print(cd[0]) + print(chainDict2jetLabel(cd[1])) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py index 3fb405fe03b0d9628126aeeadcfccd2dc0670df7..41a1145170119605deec76de2e41ff957fb0ce7e 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py @@ -276,6 +276,76 @@ def _make_dijet_label(chain_parts): )""" % argvals +def _make_ht_label(chain_parts): + """ht label. ht cuts, and cuts on particpating jets + Currently supported cuts: + - all jets: ht + - all jets: et + - all jets: eta + + - default values are used for unspecified cuts. + The cut set can be extended according to the pattern + """ + + assert len(chain_parts) == 1, '_make_ht_label, no. of chain parts != 1' + scenario = chain_parts[0]['hypoScenario'] + + assert scenario.startswith('HT'), '_make_ht_label(): scenario does not start with HT' + + arg_res = [ + re.compile(r'^(?P<lo>\d*)(?P<key>ht)(?P<hi>\d*)$'), + re.compile(r'^(?P<lo>\d*)(?P<key>et)(?P<hi>\d*)$'), + re.compile(r'^(?P<lo>\d*)(?P<key>eta)(?P<hi>\d*)$'), + ] + + defaults = { + 'ht': ('0', 'inf'), + 'et': ('0', 'inf'), + 'eta': ('0', 'inf'), + } + + + args = _args_from_scenario(scenario) + argvals = {} + nargs = len(args) + assert len(args) <= len(arg_res), 'bad num of args %d, expected < %d' % (len(args), + len(arg_res)) + + # obtain argument values frrom scenario + while args: + arg = args.pop() + for r in arg_res: + m = r.match(arg) + if m is not None: + arg_res.remove(r) + gd = m.groupdict() + key = gd['key'] + + try: + lo = float(gd['lo']) + except ValueError: + lo = float(defaults[key][0]) + argvals[key+'lo'] = lo + try: + hi = float(gd['hi']) + except ValueError: + hi = float(defaults[key][1]) + argvals[key+'hi'] = hi + + print (argvals) + assert len(argvals) == 2*nargs, 'no of args: %d, expected %d' % (len(argvals), 2*nargs) + + print ('sent 100') + result = """ + ht([(%(htlo).0fht) + (%(etlo).0fet) + (%(etalo).0feta%(etahi).0f) + ])""" % argvals + print (result) + return result + + + def _make_combinationsTest_label(chain_parts): """make test label for combinations helper with two simple children.""" @@ -329,6 +399,7 @@ def chainDict2jetLabel(chain_dict): # suported scenarios router = { 'simple': _make_simple_label, + 'HT': _make_ht_label, 'vbenf': _make_vbenf_label, 'dijet': _make_dijet_label, 'combinationsTest': _make_combinationsTest_label, @@ -365,83 +436,4 @@ and([] # more than 2 labels is not expected assert False -def _tests(): - - print('\n--------- _tests() starts _______') - - from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName - from TrigHLTJetHypo.ChainLabelParser import ChainLabelParser - - chain_names = ( - 'HLT_j85_L1J20', - # 'HLT_j80_0eta240_2j60_320eta490_L1J20', - # ``'HLT_j85_j70_L1J20', - 'HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20', - 'HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20', - - ) - - - for cn in chain_names: - chain_dict = DictFromChainName.dictFromChainName(cn) - - label = chainDict2jetLabel(chain_dict) - print('\n') - print(cn) - print(' ', label) - print('\n') - - parser = ChainLabelParser(label, debug=False) - parser.parse() - - print('\n--------- _tests() ends _______') - - -def _tests1(): - - print('\n--------- _tests1() starts _______') - - from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName - from TrigHLTJetHypo.ChainLabelParser import ChainLabelParser - - chain_name = 'HLT_j85_L1J20' - - chain_dict = DictFromChainName.dictFromChainName(chain_name) - label = _make_simple_partition_label(chain_dict) - - print('\n') - print(chain_name) - print(' ', label) - print('\n') - - parser = ChainLabelParser(label, debug=False) - parser.parse() - - print('\n--------- _tests1() ends _______') - -def _tests2(): - print('\n--------- _tests2() starts _______') - - from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName - from TrigHLTJetHypo.ChainLabelParser import ChainLabelParser - - chain_name = 'HLT_j85_L1J20' - - chain_dict = DictFromChainName.dictFromChainName(chain_name) - label = _make_simple_comb_label(chain_dict) - - print('\n') - print(chain_name) - print(' ', label) - print('\n') - - parser = ChainLabelParser(label, debug=False) - parser.parse() - - print('\n--------- _tests2() ends _______') - - -if __name__ == '__main__': - _tests() - _tests1() - _tests2() +# module tests now in testChainDictMaker.py diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py new file mode 100644 index 0000000000000000000000000000000000000000..b60f1b83b9fea7c282242895b9822829884758ff --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py @@ -0,0 +1,47 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +"""Make chain dicts for testing jet hypo config modules""" + +from __future__ import print_function + +from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import ( + SingleJetGroup, + MultiJetGroup) + +from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp +from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName + + +def testChainDictMaker(): + + chain_props = [ + ChainProp(name='HLT_j260_320eta490_L1J75_31ETA49', + groups=SingleJetGroup), + + ChainProp(name='HLT_j80_j60_L1J15', + l1SeedThresholds=['FSNOSEED']*2, groups=MultiJetGroup), + + ChainProp(name='HLT_j0_HTSEP1000htSEP100etSEP0eta320_L1J15', + l1SeedThresholds=['FSNOSEED'], groups=MultiJetGroup), + + + ChainProp(name='HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20', + l1SeedThresholds=['FSNOSEED']*3, + groups=MultiJetGroup), + + ChainProp(name='HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20', + l1SeedThresholds=['FSNOSEED'], + groups=MultiJetGroup), + ] + + result = [] + for cp in chain_props: + chain_dict = dictFromChainName(cp) + result.append((cp.name, chain_dict)) + + return result + +if __name__ == '__main__': + dicts = testChainDictMaker() + for d in dicts: + print('') + print (d) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py index a368fff65cf1bda61fb856e8242033f0d3509f2f..233b6e0686b9d1c3d6a9ab98f496b30dee754920 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py @@ -52,6 +52,7 @@ def scaleFactors(parameter): 'neta': -0.01, 'peta': 0.01, 'et': 1000., + 'ht': 1000., 'smc': 1000., 'djdeta': 0.1, 'djmass': 1000., @@ -403,6 +404,7 @@ class TreeParameterExpander(object): 'z': TreeParameterExpander_null, 'simple': TreeParameterExpander_simple, 'simplepartition': TreeParameterExpander_simple, + 'ht': TreeParameterExpander_simple, 'dijet': TreeParameterExpander_dijet, 'qjet': TreeParameterExpander_simple, 'not': TreeParameterExpander_null, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot.py index 1fd888efb77d8ebdcb587dfb74e041d93b808a83..0a76ce53202c92af853cda7caf3af4805cb5f227 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot.py @@ -1,3 +1,4 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function import os diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot_tree.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot_tree.py index 1654e27e35d7927ff7dba3f9b9d93a59d08bf797..ad60e59377123187cc62d8be2fcd7c2a1ce85a72 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot_tree.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/share/hypo_dot_tree.py @@ -1,3 +1,4 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function import os diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx index 473b3ae3f4c9a675b41d85e49589fa9f3e35c89c..bcc456d1a53ab543dc6ac23cbfa82a6b709489d0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx @@ -24,18 +24,27 @@ HTConditionMT::HTConditionMT(double ht_min, } -bool HTConditionMT::isSatisfied(const HypoJetVector& ips, - const std::unique_ptr<ITrigJetHypoInfoCollector>&) const { +bool +HTConditionMT::isSatisfied(const HypoJetVector& ips, + const std::unique_ptr<ITrigJetHypoInfoCollector>& infoCollector) const { if (m_filter) { HypoJetVector ips_c(ips.begin(), ips.end()); auto iter = std::partition(ips_c.begin(), ips_c.end(), *m_filter); + if (infoCollector) { + infoCollector -> collect("", "No of jets after filtering " + + std::to_string(iter - ips_c.begin())); + } + return std::accumulate(ips_c.begin(), iter, 0.0, [](double sum, const HypoJet::IJet* jp){ return sum + jp->et();}) > m_htMin; } else { + if(infoCollector) { + infoCollector -> collect("", "Nofiltering"); + } return std::accumulate(ips.begin(), ips.end(), diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFRazorAllTEHypo.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFRazorAllTEHypo.cxx index 552911a8e0ba677ec3acae93d7e5ad3051b7321f..5a8164d5b9b5e7dc9fd8791e41655150fb8f8367 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFRazorAllTEHypo.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFRazorAllTEHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -24,13 +24,6 @@ #include "TrigHLTJetHypo/TrigEFRazorAllTE.h" -//PS #include "JetEvent/JetCollection.h" -//PS #include "JetEvent/Jet.h" -//PS #include "FourMomUtils/P4DescendingSorters.h" -#include "CLHEP/Units/SystemOfUnits.h" - -//PS #include "TrigSteeringEvent/TrigPassBits.h" - #include "TrigMissingEtEvent/TrigMissingET.h" #include "xAODJet/JetContainer.h" diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6c7de10a5c40de22198bf695adb263355e5d2ba1 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/* + Instantiator for Ht Conditions + */ +#include "TrigJetConditionConfig_ht.h" +#include "GaudiKernel/StatusCode.h" +#include "./HTConditionMT.h" +#include "./ArgStrToDouble.h" + +TrigJetConditionConfig_ht::TrigJetConditionConfig_ht(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent){ + +} + + +StatusCode TrigJetConditionConfig_ht::initialize() { + CHECK(checkVals()); + + return StatusCode::SUCCESS; +} + + +ConditionMT TrigJetConditionConfig_ht::getCondition() const { + auto a2d = ArgStrToDouble(); + return std::make_unique<HTConditionMT>(a2d(m_htmin), + a2d(m_etmin), + a2d(m_etamin), + a2d(m_etamax)); +} + + +StatusCode TrigJetConditionConfig_ht::checkVals() const { + auto a2d = ArgStrToDouble(); + if (a2d(m_htmin) < 0.){ + ATH_MSG_ERROR("ht min < 0."); + return StatusCode::FAILURE; + } + + if (a2d(m_etmin) < 0.){ + ATH_MSG_ERROR("etmin < 0"); + return StatusCode::FAILURE; + } + + if (a2d(m_etamin) < 0.){ + ATH_MSG_ERROR("abseta min < 0"); + return StatusCode::FAILURE; + } + + + if (a2d(m_etamin) > a2d(m_etamax)){ + ATH_MSG_ERROR("abseta min > abseta max"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +bool TrigJetConditionConfig_ht::addToCapacity(std::size_t) { + return false; +} + +std::size_t TrigJetConditionConfig_ht::capacity() const { + return getCondition()->capacity(); +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.h new file mode 100644 index 0000000000000000000000000000000000000000..222b809d3eb41f5df2b710ec027ed72dea1f8144 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_ht.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGJETCONDITIONCONFIG_HT_H +#define TRIGJETCONDITIONCONFIG_HT_H + +#include "ITrigJetConditionConfig.h" +#include "./ConditionsDefsMT.h" +#include "AthenaBaseComps/AthAlgTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +class TrigJetConditionConfig_ht: +public extends<AthAlgTool, ITrigJetConditionConfig> { + + public: + + TrigJetConditionConfig_ht(const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode initialize() override; + virtual ConditionMT getCondition() const override; + + virtual bool addToCapacity(std::size_t) override; + virtual std::size_t capacity() const override; + + private: + + // cut on sum + Gaudi::Property<std::string> + m_htmin{this, "htmin", {"0"}, "min ht (et sum for selected jets)"}; + + // cuts on input vectors + + Gaudi::Property<std::string> + m_etmin{this, "etmin", {"0"}, "min et for each jet"}; + + Gaudi::Property<std::string> + m_etamin{this, "etamin", {"0"}, "min eta for each jet"}; + + Gaudi::Property<std::string> + m_etamax{this, "etamax", {"inf"}, "max eta for each jet"}; + + StatusCode checkVals() const; +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx index b6de4a16af9e556c0d9eb11be2f3f48ce3377b29..a7bddb80d573e2048e57189ead7ae51b4465e49a 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoAlgMT.cxx @@ -2,6 +2,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ +#include <algorithm> #include "GaudiKernel/Property.h" #include "TrigJetHypoAlgMT.h" #include "TrigCompositeUtils/HLTIdentifier.h" @@ -33,6 +34,7 @@ StatusCode TrigJetHypoAlgMT::execute( const EventContext& context ) const { // The container should have only one such Decision (for L1) as deding // on jets is a one step process. + ATH_MSG_DEBUG("Retrieving L1 decision \"" << decisionInput().key() << "\""); auto h_prevDecisions = SG::makeHandle(decisionInput(), context ); if( not h_prevDecisions.isValid() || h_prevDecisions->size() ==0) {//implicit @@ -107,9 +109,30 @@ TrigJetHypoAlgMT::decide(const xAOD::JetContainer* jets, TrigCompositeUtils::decisionIDs(previousDecision).begin(), TrigCompositeUtils::decisionIDs(previousDecision).end() }; + + if (msgLvl(MSG::DEBUG)) { + msg() << "IDs of active legs:" << endmsg; + for(auto decisionID: previousDecisionIDs) { + msg() << " " << decisionID << endmsg; + } + } + // Some of these may be leg IDs, convert those to the chain ID + TrigCompositeUtils::DecisionIDContainer leglessPreviousDecisionIDs; + std::transform(previousDecisionIDs.begin(), previousDecisionIDs.end(), + std::inserter(leglessPreviousDecisionIDs,leglessPreviousDecisionIDs.begin()), + [] (TrigCompositeUtils::DecisionID id) -> TrigCompositeUtils::DecisionID + {return TrigCompositeUtils::getIDFromLeg(HLT::Identifier(id)).numeric();} + ); + if (msgLvl(MSG::DEBUG)) { + msg() << "IDs of active chains:" << endmsg; + for(auto decisionID: leglessPreviousDecisionIDs) { + msg() << " " << decisionID << endmsg; + } + } for (const auto& tool: m_hypoTools) { - CHECK(tool->decide(jets, previousDecisionIDs, jetHypoInputs)); + ATH_MSG_DEBUG("Now computing decision for " << tool->name()); + CHECK(tool->decide(jets, leglessPreviousDecisionIDs, jetHypoInputs)); } return StatusCode::SUCCESS; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.cxx index 02f4f39d2bd37f1d57f705900db50223cd76c644..d5a94d93493ac4c808137c5d890d8b6af0b723ea 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.cxx @@ -8,7 +8,7 @@ #include "./conditionsFactoryMT.h" -#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJetFactory.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerFactory.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TrigHLTJetHypoHelper2.h" @@ -68,7 +68,7 @@ TrigJetHypoToolConfig_ht::requiresNJets() const { std::unique_ptr<IJetGrouper> TrigJetHypoToolConfig_ht::getJetGrouper() const { - return std::make_unique<SingleJetGrouper>(); + return std::make_unique<AllJetsGrouper>(); } std::unique_ptr<IGroupsMatcherMT> diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.h index 9b008b048c2dba9b86f179ae7b670e8088bbf4af..58a7b9e91be21faec740dfd396edf0a3d3ee86d7 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_ht.h @@ -50,13 +50,7 @@ public extends<AthAlgTool, ITrigJetHypoToolConfig> { ToolHandleArray<ITrigJetConditionConfig> m_conditionMakers{ this, "conditionMakers", {}, "hypo tree node to conditiionMaker map"}; - Gaudi::Property<std::vector<std::size_t>> m_treeVec{ - this, "treeVector", {}, "integer sequence representation of jet hypo tree"}; - - Gaudi::Property<std::vector<int>> m_sharedNodesVec{ - this, "sharedVector", {}, "nodeID groups for nodes that see input jets"}; - - std::vector<std::vector<int>> m_sharedNodes{}; + }; #endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperMT.h index 7e39e5ea4a0eeb5d04617739398f0a440eafa4b7..085a05005b713006673aeaf4a3b2f183b80cc6be 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperMT.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperMT.h @@ -74,10 +74,10 @@ public extends<AthAlgTool, ITrigJetHypoToolHelperMT> { this, "HypoConfigurer", {}, "Configurer to set up TrigHLTJetHypoHelper2"}; Gaudi::Property<int> - m_parentNodeID {this, "parent_id", {}, "hypo tool tree parent node id"}; + m_parentNodeID {this, "parent_id", {0}, "hypo tool tree parent node id"}; Gaudi::Property<int> - m_nodeID {this, "node_id", {}, "hypo tool tree node id"}; + m_nodeID {this, "node_id", {0}, "hypo tool tree node id"}; Gaudi::Property<bool> m_debug {this, "debug", false, "instantantiate helpers with this debug flag"}; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx index 67646021c72d0b26ec1892c8a548e860474fc8bf..63ab69cb60f45da312add040cdf573c1c7123e39 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx @@ -66,7 +66,8 @@ TrigJetHypoToolMT::decide(const xAOD::JetContainer* jets, if (not TrigCompositeUtils::passed(getId().numeric(), previousDecisionIDs)) { // This HypoTool's chain is not active - // we must not check this tool's logic. - + ATH_MSG_DEBUG("Previous decisionID not found for " << getId().numeric() << " - exiting."); + return StatusCode::SUCCESS; } @@ -126,7 +127,7 @@ TrigJetHypoToolMT::decide(const xAOD::JetContainer* jets, participating_jets.end(), pair.first); if (it != participating_jets.end()) { - + ATH_MSG_VERBOSE("Passing jet: pt " << (*it)->pt() << ", eta " << (*it)->eta() ); // This jet particpated in passing the event. // Add this HypoTool's ID to this Decision object. diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx index 497bc96b5eafdd50be831c17f1aa16b87411855f..7bac3f6c859eb47d55528c833f1d7b67833b3eb9 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx @@ -25,6 +25,7 @@ #include "../TrigJetConditionConfig_abs_eta.h" #include "../TrigJetConditionConfig_signed_eta.h" #include "../TrigJetConditionConfig_et.h" +#include "../TrigJetConditionConfig_ht.h" #include "../TrigJetConditionConfig_dijet_mass.h" #include "../TrigJetConditionConfig_dijet_dphi.h" #include "../TrigJetConditionConfig_dijet_deta.h" @@ -77,6 +78,7 @@ DECLARE_COMPONENT(TrigHLTJetHypo_EtaEt) DECLARE_COMPONENT(TrigJetConditionConfig_signed_eta) DECLARE_COMPONENT(TrigJetConditionConfig_abs_eta) DECLARE_COMPONENT(TrigJetConditionConfig_et) +DECLARE_COMPONENT(TrigJetConditionConfig_ht) DECLARE_COMPONENT(TrigJetConditionConfig_dijet_mass) DECLARE_COMPONENT(TrigJetConditionConfig_dijet_deta) DECLARE_COMPONENT(TrigJetConditionConfig_dijet_dphi) diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py b/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py index 29aaed95227eb9db8d3cbc0457566c1e43777fee..3cb153251df08b7d6bc9170bf4b0c44d7625ac3a 100755 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py @@ -403,7 +403,12 @@ def TrigmuCombHypoToolFromDict( chainDict ): config = TrigmuCombHypoConfig() tight = False # can be probably decoded from some of the proprties of the chain, expert work - tool=config.ConfigurationHypoTool( chainDict['chainName'], thresholds, tight ) + + acceptAll = False + if chainDict['chainParts'][0]['signature'] == 'Bphysics': + acceptAll = True + + tool=config.ConfigurationHypoTool( chainDict['chainName'], thresholds, tight, acceptAll ) addMonitoring( tool, TrigmuCombHypoMonitoring, "TrigmuCombHypoTool", chainDict['chainName'] ) @@ -413,9 +418,10 @@ class TrigmuCombHypoConfig(object): log = logging.getLogger('TrigmuCombHypoConfig') - def ConfigurationHypoTool( self, thresholdHLT, thresholds, tight ): + def ConfigurationHypoTool( self, thresholdHLT, thresholds, tight, acceptAll ): tool = CompFactory.TrigmuCombHypoTool( thresholdHLT ) + tool.AcceptAll = acceptAll nt = len(thresholds) log.debug('Set %d thresholds', nt) diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h index 67192b7396a0787442adca937e1df5f485d7732b..95e23681c80e5f5cc2b574ee325f60482ea4a6a2 100755 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h @@ -71,6 +71,7 @@ class HLTBjetMonTool : public IHLTMonTool { SG::ReadHandleKey<xAOD::VertexContainer> m_offlineVertexContainerKey {this,"OfflineVertexContainerName","PrimaryVertices","Key of offline primary vertexes"}; SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_EFHistoPrmVtx","Key of online bjet primary vertexes"}; + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_onlineTrackContainerKey {this,"OnlineTrackContainerName","HLT_IDTrack_Bjet_IDTrig","Key of online tracks of bjets"}; ToolHandle<Trig::TrigDecisionTool> m_trigDec; //! diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/python/TrigBjetMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigBjetMonitoring/python/TrigBjetMonitorAlgorithm.py index 1d560d0624b1c91fc0f44393d57731ea05c15c19..9d047e13bd17f03e87b952f33a44c5e8e0af6d11 100644 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/python/TrigBjetMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/python/TrigBjetMonitorAlgorithm.py @@ -5,7 +5,7 @@ '''@file TrigBjetMonitorAlgorithm.py @author E. Nagy @author T. Bold -@date 2019-04-16 +@date 2020-05-27 @brief Example trigger python configuration for the Run III AthenaMonitoring package, based on the example by C Burton and P Onyisi ''' @@ -113,6 +113,7 @@ def TrigBjetMonConfig(inputFlags): # Histograms which depend on the trigger chain + # mu-jet histograms doRun2 = False AllChains = [] @@ -125,17 +126,22 @@ def TrigBjetMonConfig(inputFlags): HistName = 'jetPt_' + chain[2:] if chain[0:1] == "E" : BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events', - path='Expert/'+chain[2:],xbins=100,xmin=-0.0,xmax=750.0) + path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0) # print " ==> histogram ",HistName," is defined for Expert folder" if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events', - path='Shifter/'+chain[2:],xbins=100,xmin=-0.0,xmax=750.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" + path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0) continue else : # b-jets # print " b-jet histogram is defined for ", chain[2:] + # b-jet histograms + + # Primary vertex histograms + + # PV associated to jets + HistName = 'PVz_jet_' + chain[2:] if chain[0:1] == "E" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events', @@ -144,7 +150,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV from jets;zPV from jets;Events', path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'PVx_jet_' + chain[2:] if chain[0:1] == "E" : @@ -154,7 +159,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV from jets;xPV from jets;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'PVy_jet_' + chain[2:] if chain[0:1] == "E" : @@ -164,7 +168,8 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV from jets;yPV from jets;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5) - # print " ==> histogram ",HistName," is defined for Shifter folder" + + # PV directly from SG HistName = 'nPV_tr_' + chain[2:] if chain[0:1] == "E" : @@ -174,7 +179,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Number of online PV per event;nPV;Events', path='Shifter/'+chain[2:],xbins=101,xmin=-1.0,xmax=100.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'PVz_tr_' + chain[2:] if chain[0:1] == "E" : @@ -184,7 +188,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events', path='Shifter/'+chain[2:],xbins=500,xmin=-250.0,xmax=250.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'PVx_tr_' + chain[2:] if chain[0:1] == "E" : @@ -194,7 +197,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online xPV;xPV from jets;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'PVy_tr_' + chain[2:] if chain[0:1] == "E" : @@ -204,7 +206,35 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of online yPV;yPV from jets;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-1.5,xmax=+1.5) - # print " ==> histogram ",HistName," is defined for Shifter folder" + + # track histograms + + HistName = 'nTrack_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events', + path='Expert/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName, title='Number of tracks;nTrack;Events', + path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0) + + HistName = 'trkPt_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events', + path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName, title='Pt of tracks;Pt;Events', + path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=50.0) + + HistName = 'trkEta_' + chain[2:] + ',trkPhi_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi', + path='Expert/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of tracks;Eta;Phi', + path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416) HistName = 'd0_' + chain[2:] if chain[0:1] == "E" : @@ -214,7 +244,35 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-2.0,xmax=2.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" + + HistName = 'ed0_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(d0);sig(d0);Events', + path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=1.0) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(d0);sig(d0);Events', + path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=1.0) + + HistName = 'z0_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events', + path='Expert/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of z0;z0;Events', + path='Shifter/'+chain[2:],xbins=200,xmin=-250.0,xmax=250.0) + + HistName = 'ez0_' + chain[2:] + if chain[0:1] == "E" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(z0);sig(z0);Events', + path='Expert/'+chain[2:],xbins=200,xmin=0.,xmax=5.0) + # print " ==> histogram ",HistName," is defined for Expert folder" + if chain[0:1] == "S" : + BjetMonGroup.defineHistogram(HistName, title='Distribution of sig(z0);sig(z0);Events', + path='Shifter/'+chain[2:],xbins=200,xmin=0.,xmax=5.0) + + # jet histograms HistName = 'nJet_' + chain[2:] if chain[0:1] == "E" : @@ -224,17 +282,15 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Number of jets;nJet;Events', path='Shifter/'+chain[2:],xbins=40,xmin=0.0,xmax=40.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" HistName = 'jetPt_' + chain[2:] if chain[0:1] == "E" : BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events', - path='Expert/'+chain[2:],xbins=100,xmin=-0.0,xmax=750.0) + path='Expert/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0) # print " ==> histogram ",HistName," is defined for Expert folder" if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events', - path='Shifter/'+chain[2:],xbins=100,xmin=-0.0,xmax=750.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" + path='Shifter/'+chain[2:],xbins=100,xmin=0.0,xmax=750.0) HistName = 'jetEta_' + chain[2:] + ',jetPhi_' + chain[2:] if chain[0:1] == "E" : @@ -244,7 +300,9 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName,type='TH2F',title='Phi vs Eta of jets;Eta_jet;Phi_jet', path='Shifter/'+chain[2:],xbins=20,xmin=-5.0,xmax=+5.0,ybins=20,ymin=-3.1416,ymax=+3.1416) - # print " ==> histogram ",HistName," is defined for Shifter folder" + + # b-tagging quantities + HistName = 'wMV2c20_' + chain[2:] if chain[0:1] == "E" : @@ -254,7 +312,6 @@ def TrigBjetMonConfig(inputFlags): if chain[0:1] == "S" : BjetMonGroup.defineHistogram(HistName, title='Distribution of MV2c20 discriminant;MV2c20;Events', path='Shifter/'+chain[2:],xbins=200,xmin=-1.0,xmax=1.0) - # print " ==> histogram ",HistName," is defined for Shifter folder" continue @@ -309,7 +366,7 @@ if __name__=='__main__': # file to be run w/ doRun2 = False # file = '/afs/cern.ch/user/e/ebergeas/work/public/triggermonitoring/nightly_2019-10-20T2130/AOD.pool.root' # file = '/afs/cern.ch/work/e/enagy/public/GenerateAOD/Gen_MT_240919/AOD.pool.root' - file = '/afs/cern.ch/work/e/enagy/public/ARTfiles/MCtest290120.AOD.pool.root' + file = '/afs/cern.ch/work/e/enagy/public/ARTfiles/MCtest200520.AOD.pool.root' # file to be run w/ doRun2 = True # file = '/afs/cern.ch/work/e/enagy/public/GenerateAOD/Gen_ST_240919/AOD.pool.root' # file = '/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2019-09-16T2129/TrigAnalysisTest/test_trigAna_q221_RDOtoAOD_mt1_build/AOD.pool.root' diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx index ac0a5ce1b371a250a4e372e2b8cbf3c9dba03ad3..69349b9b66d6cf0efe8c7fcc94a8f50cec7b3f88 100755 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx @@ -127,6 +127,7 @@ StatusCode HLTBjetMonTool::init() { ATH_CHECK( m_offlineVertexContainerKey.initialize() ); ATH_CHECK( m_onlineVertexContainerKey.initialize() ); + ATH_CHECK( m_onlineTrackContainerKey.initialize() ); return StatusCode::SUCCESS; } @@ -953,7 +954,7 @@ StatusCode HLTBjetMonTool::book(){ ATH_MSG_DEBUG(" pT: " << (trk->pt())*1.e-3 << " Eta: " << trk->eta() << " Phi: " << trk->phi() << " d0: " << trk->d0() ); if (HistTrack) hist("d0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(trk->d0()); if (HistTrack) hist("z0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(trk->z0()); - if (HistTrack) hist("ed0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(Amg::error(trk->definingParametersCovMatrix(), 0)); + if (HistTrack) hist("ed0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(Amg::error(trk->definingParametersCovMatrix(), 0) ); if (HistTrack) hist("ez0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(Amg::error(trk->definingParametersCovMatrix(), 1)); if (HistTrack) hist("trkPt"+HistExt,"HLT/BjetMon/"+HistDir)->Fill( (trk->pt())*1.e-3 ); if (HistTrack) hist2("trkEtaPhi"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(trk->eta(),trk->phi()); @@ -1043,10 +1044,18 @@ StatusCode HLTBjetMonTool::book(){ } // Run2 access else { // Run3 access + ATH_MSG_DEBUG(" ===> Run 3 access for Trigger Item: " << trigItem); - // online PV from SG + // online track container + SG::ReadHandle<xAOD::TrackParticleContainer> theTracks(m_onlineTrackContainerKey); + // verify the content + for ( const xAOD::TrackParticle* track : *theTracks ) { + ATH_MSG_DEBUG( " Pt of track in TrackParticleContainer: " << track->pt() ); + } + + // online PV from SG int iPV = 0; SG::ReadHandle<xAOD::VertexContainer> vtxContainer(m_onlineVertexContainerKey); for (const xAOD::Vertex* vtx : *vtxContainer) { @@ -1056,15 +1065,16 @@ StatusCode HLTBjetMonTool::book(){ if(HistPV) hist("PVy_tr"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(vtx->y()); if(HistPV) hist("PVz_tr"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(vtx->z()); iPV++; + if ( Eofflinepv && HistPV && (iPV == 1) ) hist("diffzPV0offPVon"+HistExt,"HLT/BjetMon/"+HistDir)->Fill( vtx->z()-offlinepvz ); } // if vtx type } // loop on vtxContainer ATH_MSG_DEBUG(" Number of vertices from SG: " << iPV ); if(HistPV) hist("nPV_tr"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(iPV); - // Jets and PV through jet link - // std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigItem, TrigDefs::Physics, jetKey); + // Jets and PV and tracks through jet link std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigItem, TrigDefs::Physics, m_onlineBjetContainerKey); // TM 240320 int ijet = 0; + int itrack = 0; for(const auto jetLinkInfo : onlinejets) { // jetPt const xAOD::Jet* jet = *(jetLinkInfo.link); @@ -1080,13 +1090,41 @@ StatusCode HLTBjetMonTool::book(){ // if(HistPV) hist("PVz_tr"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(vtx->z()); } ijet++; - } // onlinejets - ATH_MSG_DEBUG(" - nJet: " << ijet); + + // Tracks associated to triggered jets ( featurs = onlinejets ) courtesy of Tim Martin on 12/05/2020 + const auto track_it_pair = m_trigDec->associateToEventView(theTracks, jetLinkInfo.source, "roi"); + const xAOD::TrackParticleContainer::const_iterator start_it = track_it_pair.first; + const xAOD::TrackParticleContainer::const_iterator end_it = track_it_pair.second; + int count = 0; + for ( xAOD::TrackParticleContainer::const_iterator it = start_it; it != end_it; ++it) { + count++; + ATH_MSG_DEBUG( " Track " << count << " with pT " << (*it)->pt() <<" from BJet with pT " << (*jetLinkInfo.link)->pt() ); + ATH_MSG_DEBUG( " Track " << count << " with pT/eta/phi " << (*it)->pt() << "/" << (*it)->eta() << "/" << (*it)->phi() ); + ATH_MSG_DEBUG( " Track " << count << " with d0/sigd0 " << (*it)->d0() << "/" << Amg::error((*it)->definingParametersCovMatrix(), 0) ); + ATH_MSG_DEBUG( " Track " << count << " with z0/sigz0 " << (*it)->z0() << "/" << Amg::error((*it)->definingParametersCovMatrix(), 1) ); + if (HistTrack) hist("d0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill((*it)->d0()); + if (HistTrack) hist("z0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill((*it)->z0()); + if (HistTrack) hist("ed0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(Amg::error((*it)->definingParametersCovMatrix(), 0) ); + if (HistTrack) hist("ez0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(Amg::error((*it)->definingParametersCovMatrix(), 1) ); + if (HistTrack) hist("trkPt"+HistExt,"HLT/BjetMon/"+HistDir)->Fill( ((*it)->pt())*1.e-3 ); + if (HistTrack) hist2("trkEtaPhi"+HistExt,"HLT/BjetMon/"+HistDir)->Fill((*it)->eta(),(*it)->phi()); + float errz0 = Amg::error((*it)->definingParametersCovMatrix(), 1); + if (Eofflinepv && HistTrack) hist("diffz0PV0"+HistExt,"HLT/BjetMon/"+HistDir)->Fill((*it)->z0()+(*it)->vz()-offlinepvz); + if ( errz0 >0. && Eofflinepv && HistTrack) hist("sigz0PV"+HistExt,"HLT/BjetMon/"+HistDir)->Fill( ((*it)->z0()+(*it)->vz()-offlinepvz)/errz0 ); + } // it on tracks + ATH_MSG_DEBUG( " Number of tracks: " << count ); + itrack += count; + + } // jetLinkInfo + + ATH_MSG_DEBUG(" Total number of triggered b-jets: " << ijet); if(HistJet) hist("nJet"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(ijet); + ATH_MSG_DEBUG(" Total number of triggered tracks associated to the b-jets: " << itrack); + if (HistTrack) hist("nTrack"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(itrack); } // else Run3 access - } // ichain + } // trigItem } // FiredChainNames.empty() diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx index 12551317b3183cd8f6ba9e06745e24f955018002..df2cc7e08ed45b02f99e7e9aaa5f002b33a21095 100644 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx @@ -10,10 +10,21 @@ #include "xAODBTagging/BTaggingContainer.h" #include "xAODBTagging/BTagging.h" +#include "Particle/TrackParticleContainer.h" +#include "GeoPrimitives/GeoPrimitives.h" + +#include "TrigParticle/TrigEFBjet.h" +#include "TrigParticle/TrigEFBjetContainer.h" + #include "JetEvent/JetCollection.h" #include "muonEvent/Muon.h" #include "muonEvent/MuonContainer.h" +// Calculates the track errors +#include "EventPrimitives/EventPrimitivesHelpers.h" + + + TrigBjetMonitorAlgorithm::TrigBjetMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) : AthMonitorAlgorithm(name,pSvcLocator) ,m_doRandom(true) @@ -36,6 +47,7 @@ StatusCode TrigBjetMonitorAlgorithm::initialize() { ATH_CHECK( m_offlineVertexContainerKey.initialize() ); ATH_CHECK( m_onlineVertexContainerKey.initialize() ); + ATH_CHECK( m_onlineTrackContainerKey.initialize() ); return AthMonitorAlgorithm::initialize(); } @@ -278,7 +290,15 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c }// trigger combinations } else { // Run 3 trigger - ATH_MSG_DEBUG(" ===> Run 3 access to Trigger feature: " ); + + ATH_MSG_DEBUG(" ===> Run 3 access to Trigger Item: " << trigName); + + // online track container + SG::ReadHandle<xAOD::TrackParticleContainer> theTracks(m_onlineTrackContainerKey, ctx); + // verify the content + for ( const xAOD::TrackParticle* track : *theTracks ) { + ATH_MSG_DEBUG( " Pt of track in TrackParticleContainer: " << track->pt() ); + } // bjet chains if (bjetChain) { @@ -318,11 +338,12 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c //bjet or mujet chains if (bjetChain || mujetChain) { - // Jets and PV through jet link - // std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigName, TrigDefs::Physics, jetKey); + // Jets and PV and tracks through jet link + std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigName, TrigDefs::Physics, m_onlineBjetContainerKey); - // std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigName); + int ijet = 0; + int itrack = 0; std::string nJetH = "nJet_"+trigName; auto nJet = Monitored::Scalar<int>(nJetH,0.0); nJet = onlinejets.size(); @@ -371,9 +392,74 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c fill("TrigBjetMonitor",PVy_jet); } ijet++; - } // onlinejets - ATH_MSG_DEBUG(" ijet : " << ijet << " nJet : " << nJet); + + // Tracks associated to triggered jets ( featurs = onlinejets ) courtesy of Tim Martin on 12/05/2020 + const auto track_it_pair = m_trigDec->associateToEventView(theTracks, jetLinkInfo.source, "roi"); + const xAOD::TrackParticleContainer::const_iterator start_it = track_it_pair.first; + const xAOD::TrackParticleContainer::const_iterator end_it = track_it_pair.second; + + int count = 0; + for ( xAOD::TrackParticleContainer::const_iterator it = start_it; it != end_it; ++it) { + count++; + ATH_MSG_DEBUG( " Track " << count << " with pT " << (*it)->pt() <<" from BJet with pT " << (*jetLinkInfo.link)->pt() ); + ATH_MSG_DEBUG( " Track " << count << " with pT/eta/phi " << (*it)->pt() << "/" << (*it)->eta() << "/" << (*it)->phi() ); + ATH_MSG_DEBUG( " Track " << count << " with d0/sigd0 " << (*it)->d0() << "/" << Amg::error((*it)->definingParametersCovMatrix(), 0) ); + ATH_MSG_DEBUG( " Track " << count << " with z0/sigz0 " << (*it)->z0() << "/" << Amg::error((*it)->definingParametersCovMatrix(), 1) ); + std::string NameH = "trkPt_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto trkPt = Monitored::Scalar<float>(NameH,0.0); + trkPt = ((*it)->pt())*1.e-3; + ATH_MSG_DEBUG(" trkPt: " << trkPt); + fill("TrigBjetMonitor",trkPt); + NameH = "trkEta_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto trkEta = Monitored::Scalar<float>(NameH,0.0); + trkEta = (*it)->eta(); + NameH = "trkPhi_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto trkPhi = Monitored::Scalar<float>(NameH,0.0); + trkPhi = (*it)->phi(); + ATH_MSG_DEBUG(" trkEta: " << trkEta << " trkPhi : " << trkPhi); + fill("TrigBjetMonitor",trkEta,trkPhi); + NameH = "d0_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto d0 = Monitored::Scalar<float>(NameH,0.0); + d0 = (*it)->d0(); + ATH_MSG_DEBUG(" d0: " << d0); + fill("TrigBjetMonitor",d0); + NameH = "z0_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto z0 = Monitored::Scalar<float>(NameH,0.0); + z0 = (*it)->z0(); + ATH_MSG_DEBUG(" z0: " << z0); + fill("TrigBjetMonitor",z0); + NameH = "ed0_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto ed0 = Monitored::Scalar<float>(NameH,0.0); + ed0 = Amg::error((*it)->definingParametersCovMatrix(), 0); + ATH_MSG_DEBUG(" ed0: " << ed0); + fill("TrigBjetMonitor",ed0); + NameH = "ez0_"+trigName; + ATH_MSG_DEBUG( " NameH: " << NameH ); + auto ez0 = Monitored::Scalar<float>(NameH,0.0); + ez0 = Amg::error((*it)->definingParametersCovMatrix(), 1); + ATH_MSG_DEBUG(" ez0: " << ez0); + fill("TrigBjetMonitor",ez0); + } // it on tracks + ATH_MSG_DEBUG( " Number of tracks: " << count ); + itrack += count; + + } // jetLinkInfo from onlinejets + + ATH_MSG_DEBUG(" Total number of triggered b-jets: " << ijet << " nJet : " << nJet); + ATH_MSG_DEBUG(" Total number of triggered tracks associated to the b-jets: " << itrack); + std::string nTrackH = "nTrack_"+trigName; + auto nTrack = Monitored::Scalar<int>(nTrackH,0.0); + nTrack = itrack; + fill("TrigBjetMonitor",nTrack); + } //bjet or mujet + } // else Run3 } else { diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h index 62266c71560e2048ec27cfa7da18e4214ff04d6a..07dfd01f729b88c38f5434c1c70defca9b867a49 100644 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h @@ -32,7 +32,10 @@ class TrigBjetMonitorAlgorithm : public AthMonitorAlgorithm { SG::ReadHandleKey<xAOD::MuonContainer> m_muonContainerKey; SG::ReadHandleKey<xAOD::VertexContainer> m_offlineVertexContainerKey {this,"OfflineVertexContainerName","PrimaryVertices","Key of offline primary vertexes"}; SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_EFHistoPrmVtx","Key of online bjet primary vertexes"}; + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_onlineTrackContainerKey {this,"OnlineTrackContainerName","HLT_IDTrack_Bjet_IDTrig","Key of online tracks of bjets"}; + ToolHandle<Trig::TrigDecisionTool> m_trigDec; //! + bool m_doRun2; }; #endif diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/CMakeLists.txt b/Trigger/TrigMonitoring/TrigBphysMonitoring/CMakeLists.txt index cfa63402e08f4720fcc1ae2b23f6a552d36fef65..68cb6db1028d8fcb889785c8e7c743d2d4e4efc3 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/CMakeLists.txt @@ -24,7 +24,8 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkVertexFitter/TrkVertexAnalysisUtils Trigger/TrigEvent/TrigMuonEvent Trigger/TrigEvent/TrigParticle - Trigger/TrigSteer/DecisionHandling ) + Trigger/TrigSteer/DecisionHandling + InnerDetector/InDetConditions/BeamSpotConditionsData ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -37,7 +38,8 @@ atlas_add_component( TrigBphysMonitoring INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} xAODTracking TrigDecisionToolLib TrigHLTMonitoringLib AthenaMonitoringLib TrkVertexAnalysisUtilsLib AthenaBaseComps xAODEventInfo - xAODMuon xAODTrigBphys xAODTrigMuon GaudiKernel TrkParameters TrkParametersBase VxVertex TrigMuonEvent TrigParticle DecisionHandlingLib ) + xAODMuon xAODTrigBphys xAODTrigMuon GaudiKernel TrkParameters TrkParametersBase VxVertex TrigMuonEvent + TrigParticle DecisionHandlingLib BeamSpotConditionsData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/python/TrigBphysMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigBphysMonitoring/python/TrigBphysMonitorAlgorithm.py index 072cd0e8f0a00954ff021b27bf2a2dddd2a4a933..b0b5b30958f1e27f3ed3f281eeae35037998cb1a 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/python/TrigBphysMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/python/TrigBphysMonitorAlgorithm.py @@ -56,7 +56,7 @@ def TrigBphysMonConfig(inputFlags): #trigBphysMonAlg.TriggerChain = 'HLT_mu26_ivarmedium' #trigBphysMonAlg.TriggerChain = 'HLT_e24_lhtight_nod0' monitored_chains = ['HLT_2mu10_bJpsimumu_L12MU10', 'HLT_2mu10_bUpsimumu_L12MU10'] - monitored_containers = ['TrigBphysDimu', 'TrigBphysEFDimu'] + monitored_containers = ['HLT_DimuEF'] trigBphysMonAlg.MonitoredChains = monitored_chains trigBphysMonAlg.MonitoredContainers = monitored_containers diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.cxx b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.cxx index 0b0758f51f542c89f0d837fd97f7a865f63e9fe9..3d0b7c212fd8a70330a48a3c1b44c75bc7163373 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.cxx +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.cxx @@ -18,7 +18,6 @@ #include "GaudiKernel/Property.h" #include "AthenaBaseComps/AthCheckMacros.h" -#include "xAODTracking/VertexContainer.h" #include "xAODTracking/Vertex.h" @@ -31,17 +30,7 @@ BphysTrigDecoratorAlg::BphysTrigDecoratorAlg( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthAlgorithm( name, pSvcLocator ) -,m_decorators(this) -{ - // - // Property declaration - declareProperty( "JpsiContainerName", m_JpsiCandidatesKey = "JpsiCandiates" ); - declareProperty( "PVContainerName", m_pvCandidatesKey = "PrimaryVertices" ); - - declareProperty( "Decorators", m_decorators ); - - -} +{} // Destructor /////////////// @@ -52,11 +41,10 @@ BphysTrigDecoratorAlg::~BphysTrigDecoratorAlg() //////////////////////////// StatusCode BphysTrigDecoratorAlg::initialize() { - ATH_MSG_INFO ("Initializing " << name() << "..."); + ATH_MSG_DEBUG ("Initializing " << name() << "..."); - for (auto tool : m_decorators) { - ATH_CHECK(tool.retrieve()); - } + ATH_CHECK( m_decorators.retrieve() ); + ATH_CHECK( m_JpsiCandidatesKey.initialize() ); return StatusCode::SUCCESS; @@ -64,7 +52,7 @@ StatusCode BphysTrigDecoratorAlg::initialize() StatusCode BphysTrigDecoratorAlg::finalize() { - ATH_MSG_INFO ("Finalizing " << name() << "..."); + ATH_MSG_DEBUG ("Finalizing " << name() << "..."); return StatusCode::SUCCESS; } @@ -74,19 +62,19 @@ StatusCode BphysTrigDecoratorAlg::execute() ATH_MSG_DEBUG ("Executing " << name() << "..."); // get the dimuon candidates - const xAOD::VertexContainer* mumuContainer(0); - if(evtStore()->retrieve(mumuContainer ,m_JpsiCandidatesKey).isFailure()){ + SG::ReadHandle<xAOD::VertexContainer> mumuContainer{m_JpsiCandidatesKey}; + if(!mumuContainer.isValid()){ ATH_MSG_INFO("No vertex container " << m_JpsiCandidatesKey << " skipping decoration"); return StatusCode::SUCCESS; } else { ATH_MSG_DEBUG("Found Container " << m_JpsiCandidatesKey << " with " << - (mumuContainer? mumuContainer->size() : -1) << " candidates" ); + mumuContainer->size() << " candidates" ); } // call each decorator tool on each vertex: for (auto vtx: *mumuContainer) { - ATH_MSG_VERBOSE("Vetex: " << vtx); - ATH_MSG_VERBOSE("Vetex: " << vtx->x() << " " << vtx->y() << " " << vtx->z()); + ATH_MSG_VERBOSE("Vertex: " << vtx); + ATH_MSG_VERBOSE("Vertex: " << vtx->x() << " " << vtx->y() << " " << vtx->z()); for (auto tool : m_decorators) { if (tool->decorateVertex(vtx,nullptr).isFailure()) { diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.h b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.h index 9be3e91115d2a1ac2419cb134a2964e39f16e761..357cc7cbb75c531cf28990a36be849921bc26904 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.h +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDecoratorAlg.h @@ -17,6 +17,7 @@ // FrameWork includes #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" +#include "xAODTracking/VertexContainer.h" #include "TrigBphysMonitoring/IBphysTrigDiMuDecoratorTool.h" @@ -61,10 +62,10 @@ class BphysTrigDecoratorAlg /// Default constructor: BphysTrigDecoratorAlg(); - ToolHandleArray<IBphysTrigDiMuDecoratorTool> m_decorators; + ToolHandleArray<IBphysTrigDiMuDecoratorTool> m_decorators{this, "Decorators", {}}; /// Containers - std::string m_pvCandidatesKey,m_JpsiCandidatesKey; + SG::ReadHandleKey<xAOD::VertexContainer> m_JpsiCandidatesKey{this, "JpsiContainerName", "JpsiCandidates"}; }; diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.cxx b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.cxx index 14efb13e5800821b76971ba6ec31e8e87be59720..b9e80ea56036fdb9cb2198d11941aa098cbfaf35 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.cxx +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.cxx @@ -33,20 +33,7 @@ BphysTrigDiMuDecoratorTool::BphysTrigDiMuDecoratorTool( const std::string& type, const std::string& name, const IInterface* parent ) : ::AthAlgTool ( type, name, parent ) -,m_V0Tools("Trk::V0Tools") -,m_trackMass(105.6583715) { - //declareInterface< BphysTrigDiMuDecoratorTool >(this); - // - // Property declaration - // - //declareProperty( "Property", m_nProperty ); - declareProperty("V0Tools",m_V0Tools); - - declareProperty( "TrackMass", m_trackMass ); - declareProperty( "PVContainerName", m_pvCandidatesKey = "PrimaryVertices" ); - - declareInterface<IBphysTrigDiMuDecoratorTool>(this); } @@ -59,21 +46,24 @@ BphysTrigDiMuDecoratorTool::~BphysTrigDiMuDecoratorTool() //////////////////////////// StatusCode BphysTrigDiMuDecoratorTool::initialize() { - ATH_MSG_INFO ("Initializing " << name() << "..."); + ATH_MSG_DEBUG ("Initializing " << name() << "..."); if ( m_V0Tools.retrieve().isFailure() ) { ATH_MSG_FATAL("Failed to retrieve tool " << m_V0Tools); return StatusCode::FAILURE; } else { - ATH_MSG_INFO("Retrieved tool " << m_V0Tools); + ATH_MSG_DEBUG("Retrieved tool " << m_V0Tools); } + + ATH_CHECK( m_pvCandidatesKey.initialize() ); + ATH_CHECK( m_beamSpotKey.initialize() ); return StatusCode::SUCCESS; } StatusCode BphysTrigDiMuDecoratorTool::finalize() { - ATH_MSG_INFO ("Finalizing " << name() << "..."); + ATH_MSG_DEBUG ("Finalizing " << name() << "..."); return StatusCode::SUCCESS; } @@ -96,41 +86,44 @@ StatusCode BphysTrigDiMuDecoratorTool::decorateVertex(const xAOD::Vertex* vtx, //ATH_CHECK( evtStore()->retrieve(jpsiContainer ,m_JpsiCandidatesKey)); - const xAOD::VertexContainer* pvContainer(0); + SG::ReadHandle<xAOD::VertexContainer> pvContainer{m_pvCandidatesKey}; // check if PV container - ie. if cosmics // https://its.cern.ch/jira/browse/ATR-10633 - if (evtStore()->retrieve(pvContainer ,m_pvCandidatesKey ).isFailure() || !pvContainer) { + if (!pvContainer.isValid()) { ATH_MSG_DEBUG("No PrimaryVertex container of name: " << m_pvCandidatesKey); } // no PV - - //vtx->auxdecor<unsigned int>("TestVar") = 10; - + const xAOD::Vertex * vtxbs(nullptr), *vtxpv(nullptr); - if (pvContainer) { - for (auto primvtx: *pvContainer) { - if ( primvtx->vertexType() == xAOD::VxType::PriVtx) + if (pvContainer.isValid()) { + for (const auto& primvtx: *pvContainer) { + if ( primvtx->vertexType() == xAOD::VxType::PriVtx) { vtxpv = primvtx; + break; + } } // vtx } // if pv container is found - const xAOD::EventInfo *evtInfo(nullptr); - if ( evtStore()->retrieve(evtInfo).isFailure() || !evtInfo) { + SG::ReadCondHandle<InDet::BeamSpotData> beamspot{m_beamSpotKey}; + if ( ! beamspot.isValid() ) { ATH_MSG_DEBUG("No EventInfo found; dummy BS position used"); } else { - ATH_MSG_VERBOSE("Beamspot: " << evtInfo->beamPosX() << " " - << evtInfo->beamPosY() << " " << evtInfo->beamPosZ() << " / " - << evtInfo->beamPosSigmaX() << " " << evtInfo->beamPosSigmaY() << " " - << evtInfo->beamPosSigmaZ() ); + ATH_MSG_VERBOSE("Beamspot: " + << beamspot->beamPos()[0] << " " + << beamspot->beamPos()[1] << " " + << beamspot->beamPos()[2] << " / " + << beamspot->beamSigma(0) << " " + << beamspot->beamSigma(1) << " " + << beamspot->beamSigma(2) << " " ); } std::unique_ptr<xAOD::Vertex> bsVertex = std::make_unique<xAOD::Vertex>(); bsVertex->makePrivateStore(); AmgSymMatrix(3) cov; - if (evtInfo) { - bsVertex->setX(evtInfo->beamPosX()); - bsVertex->setY(evtInfo->beamPosY()); - bsVertex->setZ(evtInfo->beamPosZ()); - cov(0,0) = evtInfo->beamPosSigmaX() * evtInfo->beamPosSigmaX(); - cov(1,1) = evtInfo->beamPosSigmaY() * evtInfo->beamPosSigmaY(); - cov(2,2) = evtInfo->beamPosSigmaZ() * evtInfo->beamPosSigmaZ(); + if (beamspot.isValid()) { + bsVertex->setX(beamspot->beamPos()[0]); + bsVertex->setY(beamspot->beamPos()[1]); + bsVertex->setZ(beamspot->beamPos()[2]); + for (short axis = 0; axis < 3; ++axis ) { + cov(axis,axis) = beamspot->beamSigma( axis ) * beamspot->beamSigma( axis ); + } } else { bsVertex->setX(0.); bsVertex->setY(0.); diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.h b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.h index e4e70943142eaab74529332561bad0e1127ddd33..fd051cf5e3de23cd75e0d8c1ef7499e7bd7c63ee 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.h +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/BphysTrigDiMuDecoratorTool.h @@ -26,6 +26,7 @@ #include "xAODTracking/Vertex.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/TrackParticle.h" +#include "BeamSpotConditionsData/BeamSpotData.h" #include "xAODTrigBphys/TrigBphysContainer.h" @@ -83,12 +84,13 @@ class BphysTrigDiMuDecoratorTool : /// Default constructor: BphysTrigDiMuDecoratorTool(); - ToolHandle < Trk::V0Tools > m_V0Tools; /// For lxy etc + ToolHandle < Trk::V0Tools > m_V0Tools{this, "V0Tools", "Trk::V0Tools"}; /// For lxy etc // Containers - std::string m_pvCandidatesKey; //m_JpsiCandidatesKey + SG::ReadHandleKey<xAOD::VertexContainer> m_pvCandidatesKey{this, "PVContainerName", "PrimaryVertices"}; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{this, "BeamSpotKey", "BeamSpotData"}; - double m_trackMass; + Gaudi::Property<double> m_trackMass{this, "TrackMass", 105.6583715}; }; // I/O operators diff --git a/Trigger/TrigMonitoring/TrigCaloMonitoring/CMakeLists.txt b/Trigger/TrigMonitoring/TrigCaloMonitoring/CMakeLists.txt index 9f1cbe2f30f2e6876fb0b62e4e019818de4319a2..389e23424de0df25f939c6178792f962a63cd7d1 100644 --- a/Trigger/TrigMonitoring/TrigCaloMonitoring/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigCaloMonitoring/CMakeLists.txt @@ -20,7 +20,7 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODTrigCalo LArCalorimeter/LArIdentifier LArCalorimeter/LArCabling - Luminosity/LumiBlockData + LumiBlock/LumiBlockData Reconstruction/egamma/egammaEvent Trigger/TrigAlgorithms/TrigCaloRec Trigger/TrigAlgorithms/TrigT2CaloCommon diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py index 2d84219e60d20faacc6ba619c0c3e5e3707844e2..f86c85768005b60f9c606bc7cd951b341498cc92 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py @@ -1,22 +1,6 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -################################ -###### Run-3 develpments ####### -################################ -# Should be removed for future -monitoring_electron_Run3 = ['HLT_e3_etcut_L1EM3','HLT_e5_etcut_L1EM3','HLT_e7_etcut_L1EM3','HLT_e300_etcut_L1EM24VHI'] -monitoring_photon_Run3 = ['HLT_g5_etcut_L1EM3','HLT_g5_loose_L1EM3','HLT_g5_medium_L1EM3','HLT_g5_tight_L1EM3','HLT_g140_loose_L1EM24VH'] -monitoring_tags_Run3 = ['HLT_e26_lhtight_L1EM24VHI'] -monitoringTP_electron_Run3 = ['HLT_e26_lhtight_L1EM24VHI','HLT_e60_lhmedium_L1EM24VHI','HLT_e140_lhloose_L1EM24VHI'] -monitoringTP_Jpsiee_Run3 = [] - - - - -################################################ -# Official triggers -################################################ #Categories currently used by offline Egamma TO monitoring tool diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py index c6aab7946e905ed0dc6cd5aa0ec26bf869e90069..0964efc7e06d3851e9aee52c4150b13495f5591e 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py @@ -25,41 +25,11 @@ def TrigEgammaMonConfig(inputFlags): # configure alg and ana tools from TrigEgammaMonitoring.TrigEgammaMonitoringMTConfig import TrigEgammaMonAlgBuilder monAlgCfg = TrigEgammaMonAlgBuilder( helper, '2018', detailedHistogram=True ) # Using 2018 e/g tunings - - # Force monitor builder - monAlgCfg.activate_zee=False - monAlgCfg.activate_jpsiee=False - monAlgCfg.activate_electron=True - monAlgCfg.activate_photon=False # build monitor and book histograms monAlgCfg.configure() - - # Test matching tool - # The following class will make a sequence, configure algorithms, and link - #from AthenaMonitoring import AthMonitorCfgHelper - #helper = AthMonitorCfgHelper(inputFlags,'TrigEgammaAthMonitorCfg') - #from TrigEgammaMatchingTool.TrigEgammaMatchingToolConf import TrigEgammaMatchingToolMTTest, Trig__TrigEgammaMatchingToolMT - #mon = helper.addAlgorithm( TrigEgammaMatchingToolMTTest, "TrigEgammaMatchingToolMTTest" ) - #triggers = [ - # "HLT_e26_etcut_L1EM22VHI", - # "HLT_e26_lhtight_L1EM24VHI", - # "HLT_e300_etcut_L1EM24VHI", - # "HLT_e3_etcut_L1EM3", - # "HLT_e5_etcut_L1EM3", - # "HLT_e7_etcut_L1EM3", - # ] - #tool = Trig__TrigEgammaMatchingToolMT("MatchingTool") - #mon.TrigEgammaMatchingToolMT = tool - #mon.TriggerList = triggers - #helper.resobj.addPublicTool(tool) - - - - - # Finalize. The return value should be a tuple of the ComponentAccumulator # and the sequence containing the created algorithms. If we haven't called # any configuration other than the AthMonitorCfgHelper here, then we can diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py index a6a211ecef2b6f99ff42472d1a1a9e4d6e1c3bf5..5287ee988a7f50b101cf46204f6249680aab171c 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py @@ -6,7 +6,7 @@ @brief Run 3 configuration builder. Histograms definitions taken from TrigEgammaPlotTool ''' -from TrigEgammaMonitoring.TrigEgammaMonitCategory import monitoring_tags_Run3, monitoring_electron_Run3, monitoring_photon_Run3, monitoringTP_electron_Run3, monitoringTP_Jpsiee_Run3 + #from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoring_electron, monitoring_photon, monitoringTP_electronJpsiee, monitoringTP_electron from TrigEgammaHypo.TrigEgammaPidTools import ElectronPidTools from TrigEgammaHypo.TrigEgammaPidTools import PhotonPidTools @@ -38,7 +38,7 @@ class TrigEgammaMonAlgBuilder: activate_zee = False activate_jpsiee = False tagItems = [] - JpsitagItems = [] + jpsitagItems = [] electronList = [] photonList = [] tpList = [] @@ -106,7 +106,7 @@ class TrigEgammaMonAlgBuilder: self.activate_electron=True self.activate_photon=True - + def configure(self): self.setProperties() self.configureMonitor() @@ -115,9 +115,10 @@ class TrigEgammaMonAlgBuilder: - # Implementation of https://its.cern.ch/jira/browse/ATR-13200 + def get_monitoring_mode(self): + # Implementation of https://its.cern.ch/jira/browse/ATR-13200 self.__logger.info("TrigEgammaMonToolBuilder.get_monitoring_mode()") self.data_type = dqflags.monManDataType() if self.data_type == 'monteCarlo': @@ -141,9 +142,7 @@ class TrigEgammaMonAlgBuilder: self.__logger.info("TrigEgammaMonToolBuilder.setProperties()") self.basePath = 'HLT/EgammaMon' - self.tagItems = monitoring_tags_Run3 - self.JpsitagItems = [] - + if self.pp_mode is True: self.setDefaultProperties() elif self.cosmic_mode is True: @@ -168,10 +167,23 @@ class TrigEgammaMonAlgBuilder: def setDefaultProperties(self): - self.electronList = monitoring_electron_Run3 - self.photonList = monitoring_photon_Run3 - self.tpList = monitoringTP_electron_Run3 - self.jpsiList = monitoringTP_Jpsiee_Run3 + + # This will be removed for future. + monitoring_electron = ['HLT_e3_etcut_L1EM3','HLT_e5_etcut_L1EM3','HLT_e7_etcut_L1EM3','HLT_e300_etcut_L1EM24VHI'] + monitoring_photon = ['HLT_g5_etcut_L1EM3','HLT_g5_loose_L1EM3','HLT_g5_medium_L1EM3','HLT_g5_tight_L1EM3','HLT_g140_loose_L1EM24VH'] + monitoringTP_electron = ['HLT_e26_lhtight_L1EM24VHI','HLT_e60_lhmedium_L1EM24VHI','HLT_e140_lhloose_L1EM24VHI'] + + + + self.electronList = monitoring_electron + self.photonList = monitoring_photon + self.tpList = monitoringTP_electron + self.jpsiList = [] + self.tagItems = [] #monitoring_tags + self.jpsitagItems = [] #monitoring_jpsitags + + + # @@ -253,7 +265,7 @@ class TrigEgammaMonAlgBuilder: self.zeeMonAlg.RemoveCrack=False self.zeeMonAlg.TagTriggerList=self.tagItems self.zeeMonAlg.TriggerList=self.tpList - self.zeeMonAlg.DetailedHistograms=self.detailHistograms + self.zeeMonAlg.DetailedHistograms=self.detailedHistograms if self.activate_jpsiee: @@ -276,8 +288,8 @@ class TrigEgammaMonAlgBuilder: self.jpsieeMonAlg.OfflineProbeSelector='LHLoose' self.jpsieeMonAlg.OppositeCharge=True self.jpsieeMonAlg.RemoveCrack=False - self.jpsieeMonAlg.TagTriggerList=self.tagItems - self.jpsieeMonAlg.TriggerList=self.tpList + self.jpsieeMonAlg.TagTriggerList=self.jpsitagItems + self.jpsieeMonAlg.TriggerList=self.jpsiList self.jpsieeMonAlg.DetailedHistograms=self.detailedHistograms @@ -307,7 +319,7 @@ class TrigEgammaMonAlgBuilder: self.phMonAlg.LHResultNames=self.lhnames self.phMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector] self.phMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector] - self.phMonAlg.TriggerList=self.tpList + self.phMonAlg.TriggerList=self.photonList self.phMonAlg.DetailedHistograms=self.detailedHistograms diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h index c5863b2835b408ac5a30e46317be921b1f0bd9ea..39aa807c484d4545e87a07c090ab4c398a721c7b 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.h @@ -36,7 +36,6 @@ class TrigEgammaMonitorElectronAlgorithm: public TrigEgammaMonitorAnalysisAlgori /*! List of triggers to study */ std::vector<std::string> m_trigList; - /*! List of triggers from menu */ Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}}; /*! Directory name for each algorithm */ @@ -53,8 +52,6 @@ class TrigEgammaMonitorElectronAlgorithm: public TrigEgammaMonitorAnalysisAlgori Gaudi::Property<bool> m_forceVetoVeryLoose{ this, "ForceVetoVeryLoose", false}; /*! Remove crack region for Probe default True */ Gaudi::Property<bool> m_rmCrack{ this, "RemoveCrack", true}; - - // Containers /*! Event Wise offline ElectronContainer Access and end iterator */ SG::ReadHandleKey<xAOD::ElectronContainer> m_offElectronKey{ this, "ElectronKey", "Electrons", ""}; diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx index 4092832d1fcefc159470799bc945c13a4849952f..cee8d2319df122c632b21dd772bf11ca4dfb916c 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx @@ -22,6 +22,19 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::initialize() ATH_CHECK(TrigEgammaMonitorAnalysisAlgorithm::initialize()); ATH_CHECK(m_offPhotonKey.initialize()); + + + for(const auto trigName:m_trigInputList) + { + if(getTrigInfoMap().count(trigName) != 0){ + ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); + }else { + m_trigList.push_back(trigName); + setTrigInfo(trigName); + } + } + + return StatusCode::SUCCESS; } @@ -29,7 +42,6 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::initialize() StatusCode TrigEgammaMonitorPhotonAlgorithm::fillHistograms( const EventContext& ctx ) const { - ATH_MSG_DEBUG("Executing TrigEgammaMonitorPhotonAlgorithm"); if(tdt()->ExperimentalAndExpertMethods()->isHLTTruncated()){ @@ -55,6 +67,10 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::fillHistograms( const EventContext& } + fillDistributions( pairObjs, info ); + fillEfficiencies( pairObjs, info ); + + ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger); } // End loop over trigger list diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx index d53c41229f3e668a85d4a76e6af089e5d3705884..165c25862711f6f28ce435e3d11ddf4f4912b5d7 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx @@ -52,19 +52,16 @@ StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::initialize() { ATH_MSG_INFO("Now configuring chains for analysis: " << name() ); std::vector<std::string> chains = tdt()->getListOfTriggers("HLT_e.*, L1_EM.*, HLT_g.*"); - for(const auto trigName:m_trigInputList) { - if (std::find(chains.begin(), chains.end(), trigName) != chains.end()){ - if(getTrigInfoMap().count(trigName) != 0){ - ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); - }else { - m_trigList.push_back(trigName); - setTrigInfo(trigName); - } + if(getTrigInfoMap().count(trigName) != 0){ + ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); + }else { + m_trigList.push_back(trigName); + setTrigInfo(trigName); } } - + return StatusCode::SUCCESS; } @@ -115,6 +112,10 @@ StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::fillHistograms( const EventCon // Include fill here + fillDistributions( pairObjs, info ); + fillEfficiencies( pairObjs, info ); + + } // End loop over trigger list @@ -131,7 +132,8 @@ StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::fillHistograms( const EventCon bool TrigEgammaMonitorTagAndProbeAlgorithm::executeTandP( const EventContext& ctx, std::vector<const xAOD::Electron*> &probeElectrons) const { - + + auto monGroup = getGroup( "Event" ); fillLabel(monGroup, m_anatype+"_CutCounter", "Events"); @@ -281,10 +283,12 @@ bool TrigEgammaMonitorTagAndProbeAlgorithm::minimalTriggerRequirement() const { ATH_MSG_DEBUG("Apply Minimal trigger requirements"); for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { - std::string tag = m_tagTrigList.at(ilist); + std::string tag = m_tagTrigList[ilist]; if ( tdt()->isPassed(tag) ) return true; } + + return false; } @@ -390,7 +394,7 @@ bool TrigEgammaMonitorTagAndProbeAlgorithm::isTagElectron( ToolHandle<GenericMon // The statement below is more general bool tagPassed=false; for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { - std::string tag = m_tagTrigList.at(ilist); + std::string tag = m_tagTrigList[ilist]; if(tdt()->isPassed(tag)){ if(m_tp){ std::string p1trigger; @@ -418,7 +422,7 @@ bool TrigEgammaMonitorTagAndProbeAlgorithm::isTagElectron( ToolHandle<GenericMon ATH_MSG_DEBUG("Matching Tag Electron FC"); bool tagMatched=false; for(unsigned int ilist = 0; ilist != m_tagTrigList.size(); ilist++) { - std::string tag = m_tagTrigList.at(ilist); + std::string tag = m_tagTrigList[ilist]; if( match()->match(el,tag) ) tagMatched=true; } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h index 955ddfa08cf6cd8f21678c91fa7096f43e57fd54..db940d8a82422acf445e892789b1b34d94a6ea7d 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.h @@ -34,10 +34,7 @@ class TrigEgammaMonitorTagAndProbeAlgorithm: public TrigEgammaMonitorAnalysisAlg - /*! Trigger for tag and event wise selection */ - std::vector<std::string> m_tagTrigList; - /*! List of triggers from menu */ - std::vector<std::string> m_trigInputList; + /*! List of triggers from menu after filter*/ std::vector<std::string> m_trigList; @@ -61,8 +58,10 @@ class TrigEgammaMonitorTagAndProbeAlgorithm: public TrigEgammaMonitorAnalysisAlg /** Properties **/ - - + /*! List of triggers from menu */ + Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}}; + /*! Tag trigger list */ + Gaudi::Property<std::vector<std::string>> m_tagTrigList{ this, "TagTriggerList", {}}; /*! Zee lower mass cut */ Gaudi::Property<float> m_ZeeMassMin{ this, "ZeeLowerMass", 80}; /*! Zee upper mass cut */ @@ -89,8 +88,6 @@ class TrigEgammaMonitorTagAndProbeAlgorithm: public TrigEgammaMonitorAnalysisAlg Gaudi::Property<bool> m_doJpsiee{this,"DoJpsiee", false}; /*! analysis name */ Gaudi::Property<std::string> m_anatype{ this, "Analysis","Zee"}; - - // Containers /*! Event Wise offline ElectronContainer Access and end iterator */ SG::ReadHandleKey<xAOD::ElectronContainer> m_offElectronKey{ this, "ElectronKey", "Electrons", ""}; /*! Jet container for probe selection */ diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py index 01785aa74436b4323c119488dc9007c96c2178a5..48ebb4505f53451c9e6c1566dc954ed22271c012 100644 --- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py @@ -23,28 +23,36 @@ def TrigIDtrkMonitoringTool( legacy_monitoring=False ): # Cosmic instances ############################################################## - if not mt_chains: + # Cosmic Expert instance + tidacos = TrigTestBase(name = "IDCosmicTool", + histoPathBase = "/Trigger/HLT") + tidacos.AnalysisConfig = "Tier0" + tidacos.SliceTag = "HLT/TRIDT/Cosmic/Expert" + # tidacos.OutputLevel = DEBUG + tidacos.pixHitsOffline=-1 + tidacos.sctHitsOffline=-1 + tidacos.siHitsOffline=-1 - # Cosmic Expert instance - - tidacos = TrigTestBase(name = "IDCosmicTool", - histoPathBase = "/Trigger/HLT") - tidacos.AnalysisConfig = "Tier0" - tidacos.SliceTag = "HLT/TRIDT/Cosmic/Expert" - # tidacos.OutputLevel = DEBUG - tidacos.pixHitsOffline=-1 - tidacos.sctHitsOffline=-1 - tidacos.siHitsOffline=-1 + if mt_chains: + tidacos.ntupleChainNames += [ + "Offline", + "HLT_.*_cosmic.*:HLT_IDTrack_FTF", + "HLT_.*_cosmic.*:HLT_IDTrack_EFID" + ] + else: tidacos.ntupleChainNames += [ "Offline", "HLT_id_cosmic.*:InDetTrigTrackingxAODCnv_CosmicsN_EFID", "HLT_id_cosmic.*:InDetTrigTrackingxAODCnvIOTRT_CosmicsN_EFID" ] - list += [ tidacos ] - + list += [ tidacos ] + + + if not mt_chains: + # Cosmic Shifter instance tidacosshift = TrigTestBase(name = "IDCosmicShifterTool", diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py index e9473a55692e5ea79e3c87a8fd871e8b881fe06a..466b095c7fb1d789f9fb5de1b8120135ea67f531 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py @@ -86,7 +86,7 @@ def TrigJetMonConfig(inputFlags): l1jetconf.toAlg(helper) # Loop over L1 jet chains - for chain,jetcoll in Chain2L1JetCollDict.iteritems(): + for chain,jetcoll in Chain2L1JetCollDict.items(): l1chainconf = l1JetMonitoringConfig(ConfigFlags,jetcoll,chain) l1chainconf.toAlg(helper) @@ -103,7 +103,7 @@ def TrigJetMonConfig(inputFlags): monitorConf.toAlg(helper) # Loop over HLT jet chains - for chain,jetcoll in Chain2JetCollDict[InputType].iteritems(): + for chain,jetcoll in Chain2JetCollDict[InputType].items(): chainMonitorConf = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT) chainMonitorConf.toAlg(helper) @@ -371,7 +371,7 @@ if __name__=='__main__': l1jetconf.toAlg(helper) # Loop over L1 jet chains - for chain,jetcoll in Chain2L1JetCollDict.iteritems(): + for chain,jetcoll in Chain2L1JetCollDict.items(): l1chainconf = l1JetMonitoringConfig(ConfigFlags,jetcoll,chain) l1chainconf.toAlg(helper) @@ -388,7 +388,7 @@ if __name__=='__main__': monitorConf.toAlg(helper) # Loop over HLT jet chains - for chain,jetcoll in Chain2JetCollDict[InputType].iteritems(): + for chain,jetcoll in Chain2JetCollDict[InputType].items(): chainMonitorConf = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT) chainMonitorConf.toAlg(helper) diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx index 629ea3bd93e9a124e0de70cc2b2680c28aa0d266..ec01b8425dcb66475e7c077551a4a955be4c3a3a 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx @@ -56,7 +56,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co // access met containers SG::ReadHandle<xAOD::MissingETContainer> offline_met_cont(m_offline_met_key, ctx); - if (offline_met_cont->size()==0 || ! offline_met_cont.isValid() ) { + if (! offline_met_cont.isValid() || offline_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_offline_met_key << " does not exist or is empty"); } @@ -66,32 +66,32 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_cell_met_cont(m_hlt_cell_met_key, ctx); - if (hlt_cell_met_cont->size()==0 || ! hlt_cell_met_cont.isValid() ) { + if (! hlt_cell_met_cont.isValid() || hlt_cell_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_cell_met_key << " does not exist or is empty"); } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_mht_met_cont(m_hlt_mht_met_key, ctx); - if (hlt_mht_met_cont->size()==0 || ! hlt_mht_met_cont.isValid() ) { + if (! hlt_mht_met_cont.isValid() || hlt_mht_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_mht_met_key << " does not exist or is empty"); } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_tc_met_cont(m_hlt_tc_met_key, ctx); - if (hlt_tc_met_cont->size()==0 || ! hlt_tc_met_cont.isValid() ) { + if (! hlt_tc_met_cont.isValid() || hlt_tc_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_tc_met_key << " does not exist or is empty"); } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_tcpufit_met_cont(m_hlt_tcpufit_met_key, ctx); - if (hlt_tcpufit_met_cont->size()==0 || ! hlt_tcpufit_met_cont.isValid() ) { + if (! hlt_tcpufit_met_cont.isValid() || hlt_tcpufit_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_tcpufit_met_key << " does not exist or is empty"); } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_trkmht_met_cont(m_hlt_trkmht_met_key, ctx); - if (hlt_trkmht_met_cont->size()==0 || ! hlt_trkmht_met_cont.isValid() ) { + if (! hlt_trkmht_met_cont.isValid() || hlt_trkmht_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_trkmht_met_key << " does not exist or is empty"); } SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_pfsum_met_cont(m_hlt_pfsum_met_key, ctx); - if (hlt_pfsum_met_cont->size()==0 || ! hlt_pfsum_met_cont.isValid() ) { + if (! hlt_pfsum_met_cont.isValid() || hlt_pfsum_met_cont->size()==0 ) { ATH_MSG_DEBUG("Container "<< m_hlt_pfsum_met_key << " does not exist or is empty"); } @@ -138,7 +138,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co auto pass_HLT2 = Monitored::Scalar<float>("pass_HLT2",0.0); // access offline MET values - if ( offline_met_cont->size() > 0 && offline_met_cont.isValid() ) { + if ( offline_met_cont.isValid() && offline_met_cont->size() > 0 ) { offline_met = offline_met_cont->at(0); offline_Ex = - (offline_met->mpx())/1000.; offline_Ey = - (offline_met->mpy())/1000.; @@ -156,7 +156,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT cell MET values - if ( hlt_cell_met_cont->size() > 0 && hlt_cell_met_cont.isValid() ) { + if ( hlt_cell_met_cont.isValid() && hlt_cell_met_cont->size() > 0 ) { hlt_met = hlt_cell_met_cont->at(0); cell_Ex = (hlt_met->ex())/1000.; cell_Ey = (hlt_met->ey())/1000.; @@ -164,7 +164,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT mht MET values - if ( hlt_mht_met_cont->size() > 0 && hlt_mht_met_cont.isValid() ) { + if ( hlt_mht_met_cont.isValid() && hlt_mht_met_cont->size() > 0 ) { hlt_met = hlt_mht_met_cont->at(0); mht_Ex = (hlt_met->ex())/1000.; mht_Ey = (hlt_met->ey())/1000.; @@ -172,7 +172,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT tclcw MET values - if ( hlt_tc_met_cont->size() > 0 && hlt_tc_met_cont.isValid() ) { + if ( hlt_tc_met_cont.isValid() && hlt_tc_met_cont->size() > 0 ) { hlt_met = hlt_tc_met_cont->at(0); tc_Ex = (hlt_met->ex())/1000.; tc_Ey = (hlt_met->ey())/1000.; @@ -180,7 +180,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT trkmht MET values - if ( hlt_trkmht_met_cont->size() > 0 && hlt_trkmht_met_cont.isValid() ) { + if ( hlt_trkmht_met_cont.isValid() && hlt_trkmht_met_cont->size() > 0 ) { hlt_met = hlt_trkmht_met_cont->at(0); trkmht_Ex = (hlt_met->ex())/1000.; trkmht_Ey = (hlt_met->ey())/1000.; @@ -188,7 +188,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT tcpufit MET values - if ( hlt_tcpufit_met_cont->size() > 0 && hlt_tcpufit_met_cont.isValid() ) { + if ( hlt_tcpufit_met_cont.isValid() && hlt_tcpufit_met_cont->size() > 0 ) { hlt_met = hlt_tcpufit_met_cont->at(0); tcpufit_Ex = (hlt_met->ex())/1000.; tcpufit_Ey = (hlt_met->ey())/1000.; @@ -203,7 +203,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT pfsum MET values - if ( hlt_pfsum_met_cont->size() > 0 && hlt_pfsum_met_cont.isValid() ) { + if ( hlt_pfsum_met_cont.isValid() && hlt_pfsum_met_cont->size() > 0 ) { hlt_met = hlt_pfsum_met_cont->at(0); pfsum_Ex = (hlt_met->ex())/1000.; pfsum_Ey = (hlt_met->ey())/1000.; diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/python/TrigMinBiasMonitoringMT.py b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/python/TrigMinBiasMonitoringMT.py index 975b360cfdecbe60833ea6b25b056ff737a8ebcd..dc9d35488e7bec433cf2bade530f8543f803da40 100644 --- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/python/TrigMinBiasMonitoringMT.py +++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/python/TrigMinBiasMonitoringMT.py @@ -7,28 +7,24 @@ ''' def TrigMinBias(configFlags): - + from AthenaMonitoring import AthMonitorCfgHelper monConfig = AthMonitorCfgHelper(configFlags,'HLTMinBiasMonAlgMTAcc') - - from AthenaConfiguration.ComponentFactory import CompFactory + + from AthenaConfiguration.ComponentFactory import CompFactory alg = monConfig.addAlgorithm(CompFactory.HLTMinBiasMonAlgMT,'HLTMinBiasMonAlgMT') mbEffAllGroup = monConfig.addGroup( alg, 'EffAll', 'HLT/MinBiasMon/' ) - alg.triggerList = [ "HLT_mb_sptrk_L1RD0_FILLED"] length = len(alg.triggerList) - mbEffAllGroup.defineHistogram( "PurityAll,whichTrigger",type = 'TEfficiency',title="PurityAll;whichTrigger" ,xbins=length, xmin=0, xmax=length) mbEffAllGroup.defineHistogram( "PurityPassed,whichTrigger",type = 'TEfficiency',title="PurityPassed;whichTrigger",xbins=length, xmin=0, xmax=length, xlabels = list(alg.triggerList)) - mbEffAllGroup.defineHistogram( "EfficiencyAll,whichTrigger",type = 'TEfficiency', title="EfficiencyAll;whichTrigger",xbins=length, xmin=0, xmax=length) - mbEffAllGroup.defineHistogram( "EfficiencyPassed,whichTrigger",type = 'TEfficiency', title="EfficiencyPassed;whichTrigger", xbins=length, xmin=0, xmax=length) - mbEffAllGroup.defineHistogram( "EfficiencyPassed,trigNo",type = 'TEfficiency', title="EfficiencyPassed;trig No.", xbins=length, xmin=0, xmax=length, xlabels = list(alg.triggerList)) - mbEffAllGroup.defineHistogram( "whichTrigger",title="count of triggers", xbins=length, xmin=0, xmax=length) - mbEffAllGroup.defineHistogram( "EfficiencyPassed,trigCount",type = 'TProfile',title="EfficiencyPassed;Trigger;EfficiencyPassed", xbins=length, xmin=0, xmax=length) + mbEffAllGroup.defineHistogram( "whichTrigger",title="count of triggers;HLT", xbins=length, xmin=0, xmax=length, xlabels = list(alg.triggerList)) + mbEffAllGroup.defineHistogram( "whichTrigger;No. of events", type='TH1I',title='Event per Trigger;HLT',xbins=length, xmin=0, xmax=length, xlabels = list(alg.triggerList)) + mbEffAllGroup.defineHistogram( "decision,whichTrigger", type='TEfficiency',title='Efficiency of selecting Events with One Good Trk;TriggerName',xbins=length, xmin=0, xmax=length, xlabels = list(alg.triggerList)) + - for chain in alg.triggerList: mbGroup = monConfig.addGroup( alg, @@ -38,8 +34,7 @@ def TrigMinBias(configFlags): alg, chain+'_Eff', 'HLT/MinBiasMon/Purities&Efficiencies/'+chain+'/') - - + # correct the titles of following histograms mbGroup.defineHistogram( "PixelSPLow", title="Number of SP in whole Pixels detector for all events in low range", xbins=100, xmin=0, xmax=100) mbGroup.defineHistogram( "PixelSPHigh", title="Number of SP in whole Pixels detector for all events in high range", xbins=100, xmin=0, xmax=30000) @@ -56,10 +51,13 @@ def TrigMinBias(configFlags): mbGroup.defineHistogram( "SctECA_SP,SctECC_SP",type = 'TH2F', title="SctECA_SP;SctECC_SP", xbins=100, xmin=0, xmax=30000, ybins=100, ymin=0, ymax=30000) mbGroup.defineHistogram( "PixECA_SP,PixECC_SP",type = 'TH2F', title="PixECA_SP;PixECC_SP", xbins=100, xmin=0, xmax=30000, ybins=100, ymin=0, ymax=30000) mbGroup.defineHistogram( "SctBarr_SP,PixBarr_SP",type = 'TH2F', title="SctBarr_SP;PixBarr_SP", xbins=100, xmin=0, xmax=120000, ybins=100, ymin=0, ymax=30000) - mbEffGroup.defineHistogram( "decision,nTrk",type = 'TEfficiency', title="EfficiencyTracks;nTrk", xbins=100, xmin=0, xmax=30000) mbEffGroup.defineHistogram( "NumGoodOnlineTracks", title="NumGoodOnlineTracks", xbins=100, xmin=0, xmax=2000) mbEffGroup.defineHistogram( "NumGoodOfflineTracks", title="NumGoodOfflineTracks", xbins=100, xmin=0, xmax=2000) mbEffGroup.defineHistogram( "NumGoodOnlineTracks,NumGoodOfflineTracks",type = 'TH2F', title="NumGoodOnlineTracks;NumGoodOfflineTracks", xbins=100, xmin=0, xmax=2000, ybins=100, ymin=0, ymax=2000) + mbEffGroup.defineHistogram( "decision,NumGoodOfflineTracks", type='TEfficiency',title='Efficiency;Offline Good nTrk',xbins=1000,xmin=0,xmax=1000) + mbEffGroup.defineHistogram( "decision,nTrk",type = 'TEfficiency', title="Efficiency;nTrk", xbins=1000,xmin=0,xmax=1000) + + return monConfig.result() if __name__=='__main__': # Setup the Run III behavior @@ -70,25 +68,29 @@ if __name__=='__main__': from AthenaCommon.Constants import DEBUG # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import ConfigFlags - # ConfigFlags.Input.Files = ['/afs/cern.ch/user/s/somadutt/public/testUPC2.AOD.pool.root'] #our file runs fine - ConfigFlags.Input.Files = ['/afs/cern.ch/user/s/somadutt/public/AOD.pool.root'] #from https://atlas-art-data.web.cern.ch/atlas-art-data/grid-output/master/Athena/x86_64-centos7-gcc8-opt/2020-02-10T2132//TrigAnalysisTest/test_trigAna_RDOtoT0Mon_mt1_grid/ - ConfigFlags.Input.isMC = True + # ConfigFlags.Input.Files = ['/afs/cern.ch/user/s/somadutt/public/testUPC2.AOD.pool.root'] #Local HI-UPC file + + # data AOD file + ConfigFlags.Input.Files = ['/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2020-06-01T2139/TrigP1Test/test_trigP1_v1PhysP1_T0Mon_build/AOD.pool.root'] + + # ConfigFlags.Input.Files = ['/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2020-05-22T2142/TrigAnalysisTest/test_trigAna_RDOtoT0Mon_mt1_build/AOD.pool.root'] + # ConfigFlags.Input.isMC = True #un-Comment this line for MC AOD files, comment for data-AOD files ConfigFlags.Output.HISTFileName = 'TestMonitorOutput.root' - + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg = MainServicesCfg(ConfigFlags) - + cfg.merge(PoolReadCfg(ConfigFlags)) cfg.merge(TrigMinBias(ConfigFlags)) - + # If you want to turn on more detailed messages ... # cfg.getEventAlgo('HLTMinBiasMonAlgMT').OutputLevel = 2 # DEBUG #either this line or the next works!! cfg.getEventAlgo('HLTMinBiasMonAlgMT').OutputLevel = DEBUG # DEBUG cfg.printConfig(withDetails=True) # set True for exhaustive info cfg.run() #use cfg.run(20) to only run on first 20 events # to run: - # python -m TrigMinBiasMonitoring.TrigMinBiasMonitoringMT + # python -m TrigMinBiasMonitoring.TrigMinBiasMonitoringMT diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.cxx index f50eabb780537a83f15bce80f813bb4b303fbbde..5dea737ad3dee25e95587b44e0e8aad2a72a0e36 100644 --- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.cxx +++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.cxx @@ -5,8 +5,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #include "HLTMinBiasMonAlgMT.h" HLTMinBiasMonAlgMT::HLTMinBiasMonAlgMT(const std::string& name, ISvcLocator* pSvcLocator) : -AthMonitorAlgorithm(name, pSvcLocator), -m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") +AthMonitorAlgorithm(name, pSvcLocator) { } @@ -21,6 +20,7 @@ StatusCode HLTMinBiasMonAlgMT::initialize() ATH_CHECK( m_trkCountsKey.initialize() ); ATH_CHECK( m_HLTxaodTrkKey.initialize() ); ATH_CHECK( m_inDetTrackParticlesKey.initialize()); + return StatusCode::SUCCESS; } @@ -37,7 +37,6 @@ StatusCode HLTMinBiasMonAlgMT::fillHistograms(const EventContext& context) const ATH_CHECK( monitorPurities( context ) ); ATH_CHECK( monitorSPCounts( context ) ); ATH_CHECK( monitorTrkCounts( context ) ); - ATH_CHECK( m_trigDecTool.retrieve() ); return StatusCode::SUCCESS; } @@ -49,91 +48,117 @@ StatusCode HLTMinBiasMonAlgMT::monitorPurities(const EventContext& /*context*/) StatusCode HLTMinBiasMonAlgMT::monitorSPCounts(const EventContext& context) const { auto spCountsHandle = SG::makeHandle( m_spCountsKey, context); - - + ATH_MSG_DEBUG("Inside SP Loop"); + ATH_MSG_DEBUG(spCountsHandle->size()); + ATH_MSG_DEBUG(spCountsHandle.isValid()); if (!spCountsHandle.isValid()) { - ATH_MSG_DEBUG("Could not retrieve spCountsHandle"); - return StatusCode::SUCCESS; } + ATH_MSG_DEBUG("Could not retrieve spCountsHandle"); + return StatusCode::SUCCESS; } - ATH_CHECK( spCountsHandle.isValid() ); - if ( spCountsHandle->size() == 0 ) { // trigger did not run, no monitoring - return StatusCode::SUCCESS; - } - ATH_CHECK( spCountsHandle->size() == 1 ); // if object is present then it should have size == 1 - - using namespace Monitored; - for (long unsigned int i =0; i<m_triggerList.size(); i++){ + ATH_CHECK( spCountsHandle.isValid() ); + if ( spCountsHandle->size() == 0 ) { // trigger did not run, no monitoring + return StatusCode::SUCCESS; + } + ATH_CHECK( spCountsHandle->size() == 1 ); // if object is present then it should have size == 1 - if (m_trigDecTool->getPrescale(m_triggerList[i])) { - auto pixelSPLow = Scalar( "PixelSPLow", spCountsHandle->at(0)->getDetail<int>("totNumPixSP") ); - auto pixelSPHigh = Scalar( "PixelSPHigh", spCountsHandle->at(0)->getDetail<int>("totNumPixSP") ); - auto PixBarr_SP = Scalar( "PixBarr_SP", spCountsHandle->at(0)->getDetail<int>("pixClBarrel") ); - auto PixECA_SP = Scalar( "PixECA_SP", spCountsHandle->at(0)->getDetail<int>("pixClEndcapA") ); - auto PixECC_SP = Scalar( "PixECC_SP", spCountsHandle->at(0)->getDetail<int>("pixClEndcapC") ); + using namespace Monitored; + const auto& trigDecTool = getTrigDecisionTool(); + auto chaingroup = trigDecTool->getChainGroup("HLT_mb.*");//checking if this works ; - auto SctTot = Scalar( "SctTot", spCountsHandle->at(0)->getDetail<int>("totNumSctSP") ); - auto SctBarr_SP = Scalar( "SctBarr_SP", spCountsHandle->at(0)->getDetail<int>("SctSpBarrel") ); - auto SctECA_SP = Scalar( "SctECA_SP", spCountsHandle->at(0)->getDetail<int>("SctSpEndcapA") ); - auto SctECC_SP = Scalar( "SctECC_SP", spCountsHandle->at(0)->getDetail<int>("SctSpEndcapC") ); + for(auto &trig : chaingroup->getListOfTriggers()) { + auto cg = trigDecTool->getChainGroup(trig); + std::string thisTrig = trig; - fill(m_triggerList[i], pixelSPLow, pixelSPHigh, PixBarr_SP,PixECA_SP, PixECC_SP, SctTot, SctBarr_SP, SctECA_SP, SctECC_SP); - } - } + ATH_MSG_DEBUG (thisTrig << " chain prescale = " << cg->getPrescale()); - return StatusCode::SUCCESS; -} + if(trigDecTool->isPassed(trig)) {ATH_MSG_DEBUG("Chain "<<trig <<" is passed: YES");} + else ATH_MSG_DEBUG("Chain "<<trig <<" is passed: NO"); -StatusCode HLTMinBiasMonAlgMT::monitorTrkCounts(const EventContext& context) const { - auto HLTxaodTrkHandle = SG::makeHandle( m_HLTxaodTrkKey, context); - auto inDetTrackParticlesHandle = SG::makeHandle( m_inDetTrackParticlesKey, context); - auto trkCountsHandle = SG::makeHandle( m_trkCountsKey, context); + if (cg->getPrescale()) { + auto pixelSPLow = Scalar( "PixelSPLow", spCountsHandle->at(0)->getDetail<int>("totNumPixSP") ); + auto pixelSPHigh = Scalar( "PixelSPHigh", spCountsHandle->at(0)->getDetail<int>("totNumPixSP") ); + auto PixBarr_SP = Scalar( "PixBarr_SP", spCountsHandle->at(0)->getDetail<int>("pixClBarrel") ); + auto PixECA_SP = Scalar( "PixECA_SP", spCountsHandle->at(0)->getDetail<int>("pixClEndcapA") ); + auto PixECC_SP = Scalar( "PixECC_SP", spCountsHandle->at(0)->getDetail<int>("pixClEndcapC") ); - using namespace Monitored; + auto SctTot = Scalar( "SctTot", spCountsHandle->at(0)->getDetail<int>("totNumSctSP") ); + auto SctBarr_SP = Scalar( "SctBarr_SP", spCountsHandle->at(0)->getDetail<int>("SctSpBarrel") ); + auto SctECA_SP = Scalar( "SctECA_SP", spCountsHandle->at(0)->getDetail<int>("SctSpEndcapA") ); + auto SctECC_SP = Scalar( "SctECC_SP", spCountsHandle->at(0)->getDetail<int>("SctSpEndcapC") ); - if (!trkCountsHandle.isValid()) { - ATH_MSG_DEBUG("Could not retrieve trkCountsHandle"); - return StatusCode::SUCCESS; } - - ATH_CHECK( trkCountsHandle.isValid() ); - if ( trkCountsHandle->size() == 0 ) { // trigger did not run, no monitoring - return StatusCode::SUCCESS; - } + fill(thisTrig, pixelSPLow, pixelSPHigh, PixBarr_SP,PixECA_SP, PixECC_SP, SctTot, SctBarr_SP, SctECA_SP, SctECC_SP); + } + } - ATH_CHECK( HLTxaodTrkHandle.isValid() ); - if ( HLTxaodTrkHandle->size() == 0 ) { // trigger did not run, no monitoring return StatusCode::SUCCESS; } - ATH_CHECK( inDetTrackParticlesHandle.isValid() ); - if ( inDetTrackParticlesHandle->size() == 0 ) { // trigger did not run, no monitoring - return StatusCode::SUCCESS; - } - ATH_CHECK( trkCountsHandle->size() == 1 ); // if object is present then it should have size == 1 - - using namespace Monitored; - for (long unsigned int i =0; i<m_triggerList.size(); i++){ - const unsigned int passBits = m_trigDecTool->isPassedBits(m_triggerList[i]); - ATH_MSG_DEBUG(passBits); - ATH_MSG_DEBUG(TrigDefs::EF_prescaled); - ATH_MSG_DEBUG(m_trigDecTool->isPassed("L1_RD0_FILLED")); - ATH_MSG_DEBUG(m_trigDecTool->isPassed(m_triggerList[i])); - if ((!(passBits & TrigDefs::EF_prescaled)) && (passBits & TrigDefs::L1_isPassedAfterVeto)) { - auto xaodntrk = Scalar( "xaodnTrk", HLTxaodTrkHandle->size() ); - auto decision = Scalar<int>("decision", m_trigDecTool->isPassed(m_triggerList[i]) ? 1 : 0); - auto NumGoodOfflineTracks = Scalar("NumGoodOfflineTracks", inDetTrackParticlesHandle->size()); - auto ntrk = Scalar( "nTrk", trkCountsHandle->at(0)->getDetail<int>("ntrks") ); - auto NumGoodOnlineTracks = Scalar("NumGoodOnlineTracks", trkCountsHandle->at(0)->getDetail<int>("ntrks")); - auto whichTrigger = Scalar("whichTrigger",m_triggerList[i]); - - fill(m_triggerList[i]+"_Eff", ntrk,NumGoodOnlineTracks,xaodntrk,decision,NumGoodOfflineTracks,whichTrigger); - fill("EffAll",decision,whichTrigger); - - } - if ( m_trigDecTool->isPassed(m_triggerList[i]) ) { - auto whichTrigger = Scalar("whichTrigger",m_triggerList[i]); - auto PurityPassed = Scalar<int>("PurityPassed", m_trigDecTool->isPassed(m_triggerList[i]) ? 1 : 0); - fill("EffAll",PurityPassed,whichTrigger); + StatusCode HLTMinBiasMonAlgMT::monitorTrkCounts(const EventContext& context) const { + auto HLTxaodTrkHandle = SG::makeHandle( m_HLTxaodTrkKey, context); + auto inDetTrackParticlesHandle = SG::makeHandle( m_inDetTrackParticlesKey, context); + auto trkCountsHandle = SG::makeHandle( m_trkCountsKey, context); + ATH_MSG_DEBUG("Inside Trk Loop"); + ATH_MSG_DEBUG(trkCountsHandle->size()); + ATH_MSG_DEBUG(trkCountsHandle.isValid()); + + if (!trkCountsHandle.isValid()) { + ATH_MSG_DEBUG("Could not retrieve trkCountsHandle"); + return StatusCode::SUCCESS; } + + ATH_CHECK( trkCountsHandle.isValid() ); + if ( trkCountsHandle->size() == 0 ) { // trigger did not run, no monitoring + return StatusCode::SUCCESS; + } + ATH_CHECK( HLTxaodTrkHandle.isValid() ); + if ( HLTxaodTrkHandle->size() == 0 ) { // trigger did not run, no monitoring + return StatusCode::SUCCESS; + } + ATH_CHECK( inDetTrackParticlesHandle.isValid() ); + if ( inDetTrackParticlesHandle->size() == 0 ) { // trigger did not run, no monitoring + return StatusCode::SUCCESS; + } + ATH_CHECK( trkCountsHandle->size() == 1 ); // if object is present then it should have size == 1 + + using namespace Monitored; + const auto& trigDecTool = getTrigDecisionTool(); + auto chaingroup = trigDecTool->getChainGroup("HLT_mb_sptrk_L1.*");//checking if this works ; + long unsigned int counter = 0; + for(auto &trig : chaingroup->getListOfTriggers()) { + std::string thisTrig = trig; + if(thisTrig!=m_triggerList[counter]) { + ATH_MSG_DEBUG("Trigger Names or Ordering Don't match"); + ATH_MSG_DEBUG ("trig in Alg = "<<thisTrig << " trig in List = " << m_triggerList[counter]); + return StatusCode::SUCCESS; + } + + if(trigDecTool->isPassed(trig)) { + ATH_MSG_DEBUG("Chain "<<trig <<" is passed: YES"); + } + else ATH_MSG_DEBUG("Chain "<<trig <<" is passed: NO"); + + const unsigned int passBits = trigDecTool->isPassedBits(trig); + ATH_MSG_DEBUG(passBits); + ATH_MSG_DEBUG(TrigDefs::EF_prescaled); + ATH_MSG_DEBUG(trigDecTool->isPassed("L1_RD0_FILLED")); + ATH_MSG_DEBUG(trigDecTool->isPassed(trig)); + if ((!(passBits & TrigDefs::EF_prescaled)) && (passBits & TrigDefs::L1_isPassedAfterVeto)) { + auto xaodntrk = Scalar( "xaodnTrk", HLTxaodTrkHandle->size() ); + auto decision = Scalar<int>("decision", trigDecTool->isPassed(trig) ? 1 : 0); + auto NumGoodOfflineTracks = Scalar("NumGoodOfflineTracks", inDetTrackParticlesHandle->size()); + auto ntrk = Scalar( "nTrk", trkCountsHandle->at(0)->getDetail<int>("ntrks") ); + auto NumGoodOnlineTracks = Scalar("NumGoodOnlineTracks", trkCountsHandle->at(0)->getDetail<int>("ntrks")); + auto whichtrigger = Scalar("whichTrigger",trig); + + fill(thisTrig+"_Eff",ntrk,NumGoodOnlineTracks,xaodntrk,decision,NumGoodOfflineTracks,whichtrigger); + fill("EffAll",decision,whichtrigger); + } + + if ( trigDecTool->isPassed(trig) ) { + auto whichtrigger = Scalar("whichTrigger",trig); + auto PurityPassed = Scalar<int>("PurityPassed", trigDecTool->isPassed(trig) ? 1 : 0); + fill("EffAll",PurityPassed,whichtrigger); + } + if(counter<m_triggerList.size())counter++; + } + return StatusCode::SUCCESS; } - } - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.h b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.h index 2f524384dc1052ec5347aea3ff29d1292626ac0a..8758ca0c35a0604dcffc5462f4c3ee0a945f5121 100644 --- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.h +++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasMonAlgMT.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGMINBIASMONITORING_HLTMINBIASMONALGMT_H #define TRIGMINBIASMONITORING_HLTMINBIASMONALGMT_H @@ -18,9 +18,9 @@ #include <string> /** - * @class HLTMinBiasMonAlgMT - * @brief - **/ +* @class HLTMinBiasMonAlgMT +* @brief +**/ class HLTMinBiasMonAlgMT : public AthMonitorAlgorithm { public: HLTMinBiasMonAlgMT(const std::string& name, ISvcLocator* pSvcLocator); @@ -32,11 +32,10 @@ public: private: SG::ReadHandleKey<xAOD::TrigCompositeContainer> m_spCountsKey { this, "SPCountsKey", "HLT_SpacePointCounts", "Name of Space Points info object produced by the HLT SP counting FEX algorithm" }; - SG::ReadHandleKey<xAOD::TrigCompositeContainer> m_trkCountsKey { this, "TrackCountsKey", "HLT_TrackCounts", "Name of Online track counts info object produced by the HLT track counting FEX algorithm" }; + SG::ReadHandleKey<xAOD::TrigCompositeContainer> m_trkCountsKey { this, "TrackCountsKey", "HLT_TrackCount", "Name of Online track counts info object produced by the HLT track counting FEX algorithm" }; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_HLTxaodTrkKey { this, "HLTxaodTrkKey", "HLT_IDTrack_FS_FTF", "Name of track counts info object produced by the HLT track counting FEX algorithm" }; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_inDetTrackParticlesKey { this, "inDetTrackParticlesKey", "InDetTrackParticles", "Name of Offline track counts info object produced by the HLT track counting FEX algorithm" }; - ToolHandle<Trig::TrigDecisionTool> m_trigDecTool; - + Gaudi::Property<std::vector<std::string>> m_triggerList{this, "triggerList",{"HLT_mb_sptrk_L1RD0_FILLED"}, "Add triggers to this to be monitored"}; StatusCode monitorPurities(const EventContext& context) const; StatusCode monitorSPCounts(const EventContext& context) const; diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/TrigMuonMonitoring/HLTMuonMonTool.h b/Trigger/TrigMonitoring/TrigMuonMonitoring/TrigMuonMonitoring/HLTMuonMonTool.h index 03aa482222d07177b6220677fa2fde69807aafdb..47f19f23a52408daa83279fb6abe8486efbabc22 100755 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/TrigMuonMonitoring/HLTMuonMonTool.h +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/TrigMuonMonitoring/HLTMuonMonTool.h @@ -25,6 +25,9 @@ #include <TRandom3.h> #include "TMath.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODTruth/TruthParticleContainer.h" + /* namespace Rec { class IMuonCombinedSelectorTool; @@ -78,6 +81,7 @@ class HLTMuonMonTool : public IHLTMonTool StatusCode initMuonEFDQA(); StatusCode initMuGirlDQA(); StatusCode initMuZTPDQA(); + StatusCode initMuonTruthHists(); //book() for each HLT Algorithm std::string m_histdir; @@ -94,6 +98,7 @@ class HLTMuonMonTool : public IHLTMonTool std::string m_histdirrateratio; std::string m_histdircoverage; std::string m_histdirdist2d; + std::string m_histdirtruthmuon; StatusCode bookCommonDQA(); StatusCode bookChainDQA(); @@ -107,6 +112,7 @@ class HLTMuonMonTool : public IHLTMonTool StatusCode bookMuonEFDQA(); StatusCode bookMuGirlDQA(); StatusCode bookMuZTPDQA(); + StatusCode bookMuonTruthHists(); //fill() for each HLT Algorithm StatusCode fillCommonDQA(); @@ -122,6 +128,7 @@ class HLTMuonMonTool : public IHLTMonTool StatusCode fillMuGirlDQA(); StatusCode fillMuZTPDQA(); StatusCode fillMuZTPDQA_wrapper(); + StatusCode fillMuonTruthHists(); //proc() for each HLT Algorithm StatusCode procChainDQA(); @@ -136,11 +143,13 @@ class HLTMuonMonTool : public IHLTMonTool StatusCode procMuonEFDQA(); StatusCode procMuGirlDQA(); StatusCode procMuZTPDQA(); + StatusCode procMuonTruthHists(); //sub functions in each HLT algorithm StatusCode fillEFSingleChainHistos(const std::vector<std::string> & triggerlist); StatusCode fillL2SASingleChainHistos(const std::vector<std::string> & triggerlist); - + double getTruthToEFdRmin(const std::string trig, double eta_true, double phi_true); + // private functions float getPtThresTrigMuonEFSA(const int thres, const float eta); float getPtThresTrigMuonEFCB(const int thres, const float eta); @@ -177,6 +186,9 @@ class HLTMuonMonTool : public IHLTMonTool int m_lumiblock; int m_event; + // Steam: Main, express, StreamRDO... + std::string m_triggerStreamOfFile; + //flags for trigger decision std::vector<std::string> m_chainsRate; @@ -368,6 +380,10 @@ class HLTMuonMonTool : public IHLTMonTool //private parameters/functions for MuGirl + //private parameters/functions for MuonTruthMon + SG::ReadHandleKey<xAOD::TruthParticleContainer> m_muonTruthParticlesKey{this, "MuonTruthParticlesKey", "MuonTruthParticles"}; + int m_isData; + //histogram vectors std::vector<TH1F *> m_HistoVectorMuonL2MuonSA; std::vector<TH1F *> m_HistoVectorMuonmuComb; diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/python/TrigMuonMonitoringConfig.py b/Trigger/TrigMonitoring/TrigMuonMonitoring/python/TrigMuonMonitoringConfig.py index 466a340b741a4434bc94e6c483624850af3408dc..9bb36266a5781279716c9f0abb64d4237dceaf71 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/python/TrigMuonMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/python/TrigMuonMonitoringConfig.py @@ -8,6 +8,7 @@ def TrigMuonMonitoringTool(): from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # access to central tool HLTMuonMon = HLTMuonMonTool(name = 'HLTMuonMon', histoPathBase = "/Trigger/HLT", + TriggerStreamOfFile = getTriggerStreamOfFile(), ZTPPtCone30RelCut = 0.5) HLTMuonMon.monitoring_muonNonIso = hltmonList.monitoring_muonNonIso HLTMuonMon.monitoring_muonIso = hltmonList.monitoring_muonIso @@ -26,10 +27,21 @@ def TrigMuonMonitoringTool(): HLTMuonMon.BCTool = BunchCrossingTool() from AthenaCommon.AppMgr import ToolSvc #ToolSvc += HLTMuonMon; + from AthenaCommon.GlobalFlags import globalflags + inputDataType = str(globalflags.DataSource.StoredValue) + if inputDataType == 'data': + HLTMuonMon.truthmon_isData = 1 + else: + HLTMuonMon.truthmon_isData = 0 list = [ HLTMuonMon ]; return list +def getTriggerStreamOfFile(): + from PyUtils.MetaReaderPeeker import metadata + stag = metadata['triggerStreamOfFile'] + return stag + def setL2HypoTENames( HLTMuonMon, hltmonList): @@ -85,11 +97,4 @@ def setL2HypoTENames( HLTMuonMon, hltmonList): HLTMuonMon.monitoring_muonLowpt_L2CBHypo = muon.monitoring_muonLowpt_HI_L2CBHypo HLTMuonMon.monitoring_muon_Support_L2CBHypo = muon.monitoring_muon_Support_HI_L2CBHypo - - - - - - - diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/CommonMon.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/CommonMon.cxx index 61eb4eefcaa1e0440cf5ebd27537f31787744183..a36468add57c6f9fbd9a4d37468154db3ba77422 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/CommonMon.cxx +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/CommonMon.cxx @@ -16,7 +16,6 @@ #include "EventInfo/EventID.h" #include "EventInfo/EventType.h" #include "EventInfo/TriggerInfo.h" -#include "EventInfo/TagInfo.h" #include "TrigSteeringEvent/TrigOperationalInfo.h" #include "TrigSteeringEvent/TrigOperationalInfoCollection.h" @@ -1461,6 +1460,7 @@ StatusCode HLTMuonMonTool::fillCommonDQA() for (int i = 0; i <= m_maxESbr; i++) { m_passedES[i] = false; } + m_passedESNONISO = false; if (m_requestESchains) { std::vector<std::string>::iterator itrES; @@ -2321,7 +2321,6 @@ StatusCode HLTMuonMonTool::fillChainDQA_standard(const std::string& chainName, c StatusCode sc; StoreGateSvc* p_detStore; - std::string tag; //Set pointer on DetectorStore sc = service("DetectorStore", p_detStore); @@ -2331,14 +2330,6 @@ StatusCode HLTMuonMonTool::fillChainDQA_standard(const std::string& chainName, c } ATH_MSG_DEBUG( "Found DetectorStore ") ; - const TagInfo* tagInfo = 0; - sc = p_detStore->retrieve( tagInfo ); - if (sc.isFailure()) { - ATH_MSG_WARNING("Could not get TagInfo"); - return StatusCode::RECOVERABLE; - } else { - tagInfo->findTag("triggerStreamOfFile",tag); - } if(chainName.find("noL1")!= string::npos){ if(m_RecMuonCB_pt.size()<=1) return StatusCode::SUCCESS; @@ -2368,7 +2359,7 @@ StatusCode HLTMuonMonTool::fillChainDQA_standard(const std::string& chainName, c std::string EF_pre_trigger= m_FS_pre_trigger; std::string EF_pre_trigger_second= m_FS_pre_trigger_second; - if( tag == "express" && !m_passedES[ESSTD]) return StatusCode::SUCCESS; + if( m_triggerStreamOfFile == "express" && !m_passedES[ESSTD]) return StatusCode::SUCCESS; if(getTDT()->isPassed(EF_pre_trigger.c_str())!=1 && getTDT()->isPassed(EF_pre_trigger_second.c_str())!=1) return StatusCode::SUCCESS; std::string name = histcName + "_Turn_On_Curve_wrt_subleading_MuidCB" + "_Denominator"; hist(name, m_histdireffnumdenom)->Fill(m_RecMuonCB_pt[mu2_index]); diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx index 1ba2d513686280b4407703dd08e59c9101ed5063..b3854e6d4599340106482b8502b7148713009c0f 100755 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx @@ -70,6 +70,7 @@ HLTMuonMonTool::HLTMuonMonTool(const std::string & type, //construction of common parameters //declareProperty("foobar", m_foobar=false); // declareProperty("MuonSelectorTool",m_muonSelectorTool); // YY added -> removed + declareProperty("TriggerStreamOfFile", m_triggerStreamOfFile=""); declareProperty("monitoring_muonNonIso", m_chainsGeneric); declareProperty("monitoring_muonIso", m_chainsEFiso); declareProperty("monitoring_MSonly", m_chainsMSonly); @@ -127,6 +128,8 @@ HLTMuonMonTool::HLTMuonMonTool(const std::string & type, m_iMSH = 0; m_ztp_newrun = 0; + //construction of truth-based efficiency parameters + declareProperty("truthmon_isData",m_isData); } /*---------------------------------------------------------*/ @@ -623,7 +626,21 @@ StatusCode HLTMuonMonTool::init() ATH_MSG_VERBOSE("initMuZTPDQA failed"); } - StatusCode sc = scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + // Declare the status code to return + StatusCode sc; + + //Truth hists + if (m_isData == 1) { + sc = scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + } + else { + StatusCode scMuonTruthHists = initMuonTruthHists(); + if( scMuonTruthHists.isFailure() ){ + ATH_MSG_VERBOSE("initMuonTruthHists failed"); + } + sc = scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP & scMuonTruthHists; + } + return sc; // if(sc==1){ @@ -740,7 +757,23 @@ StatusCode HLTMuonMonTool::book() ATH_MSG_VERBOSE("bookMuZTPDQA failed"); } - StatusCode sc = scCommon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + // Declare the status code to return here + StatusCode sc; + + //Truth + if (m_isData == 1) { + sc = scCommon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + } + else { + m_histdirtruthmuon="HLT/MuonMon/TruthMuon"; + addMonGroup( new MonGroup(this, m_histdirtruthmuon, run, ATTRIB_UNMANAGED) ); + StatusCode scMuonTruthHists=bookMuonTruthHists(); + if( scMuonTruthHists.isFailure() ){ + ATH_MSG_VERBOSE("bookMuonTruthHists failed"); + } + sc = scCommon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP & scMuonTruthHists; + } + return sc; // if(sc==1){ // return StatusCode::SUCCESS; @@ -903,8 +936,28 @@ StatusCode HLTMuonMonTool::fill() scMuZTP=StatusCode::RECOVERABLE; } - StatusCode sc = scCommon & scRecMuon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + // Declare the status code to return here + StatusCode sc, scMuonTruthHists; + // Truth histograms + if (m_isData == 1) { + sc = scCommon & scRecMuon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + scMuonTruthHists = StatusCode::FAILURE; // initializing to FAILURE for the purpose of ATH_MSG_DEBUG below + } + else { + try { + scMuonTruthHists=fillMuonTruthHists(); + if( scMuonTruthHists.isFailure() ){ + ATH_MSG_VERBOSE("fillMuonTruthHists failed"); + } + } + catch(...) { + ATH_MSG_ERROR("Exception thrown by fillMuonTruthHists"); + scMuonTruthHists=StatusCode::RECOVERABLE; + } + + sc = scCommon & scRecMuon & scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP & scMuonTruthHists; + } ATH_MSG_DEBUG( " scCommon " << scCommon << " scRecMuon " << scRecMuon << " scChain " << scChain @@ -915,6 +968,7 @@ StatusCode HLTMuonMonTool::fill() << " scMuonEF " << scMuonEF << " scMuGirl " << scMuGirl << " scMuZTP " << scMuZTP + << " scMuonTruthHists " << scMuonTruthHists << " sc " << sc); return sc; @@ -1039,9 +1093,28 @@ StatusCode HLTMuonMonTool::proc() scMuZTP=StatusCode::RECOVERABLE; } - // + // Declare the return status code here + StatusCode sc; + + // Truth histograms + if (m_isData == 1) { + sc = scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; + } + else { + StatusCode scMuonTruthHists; + try { + scMuonTruthHists=procMuonTruthHists(); + if( scMuonTruthHists.isFailure() ){ + ATH_MSG_VERBOSE("procMuonTruthHists failed"); + } + } + catch(...) { + ATH_MSG_ERROR("Exception thrown by procMuonTruthHists"); + scMuonTruthHists=StatusCode::RECOVERABLE; + } + sc = scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP & scMuonTruthHists; + } - StatusCode sc = scChain & scL2MuonSA & scMuComb & scMuIso & scTileMu & scMuonEF & scMuGirl & scMuZTP; return sc; // if(sc==1){ // return StatusCode::SUCCESS; diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuZTPMon.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuZTPMon.cxx index d332a6ee8ea64dbdbd07084cf2ece9545a420436..28cb8f17d61168ad1a0da6cd998490ab1fd3fbcd 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuZTPMon.cxx +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuZTPMon.cxx @@ -11,7 +11,6 @@ #include "AthenaMonitoring/AthenaMonManager.h" #include "AthenaMonitoring/ManagedMonitorToolTest.h" #include "EventInfo/EventInfo.h" -#include "EventInfo/TagInfo.h" #include "EventInfo/EventID.h" // To be modified when L2MuonSA / muComb move to xAOD storage @@ -256,25 +255,13 @@ StatusCode HLTMuonMonTool::fillMuZTPDQA_wrapper() } ATH_MSG_DEBUG( "Found DetectorStore ") ; - const TagInfo* tagInfo = 0; - sc = p_detStore->retrieve( tagInfo ); - if (sc.isFailure()) { - ATH_MSG_WARNING("Could not get TagInfo"); - return StatusCode::RECOVERABLE; + if (m_triggerStreamOfFile == "express") { + ATH_MSG_DEBUG("ZTP: express stream"); + // check if the event was indeed taken by a single muon menu item + if( m_passedES[ESSTD] ) sc = fillMuZTPDQA(); } else { - string tag; - tagInfo->findTag("triggerStreamOfFile",tag); - ATH_MSG_DEBUG("triggerStreamOfFile tag: " << tag); - - // if expresss, check ES bit - if (tag == "express") { // passing standard chains: mu18it and mu24i - ATH_MSG_DEBUG("ZTP: express stream"); - // check if the event was indeed taken by a single muon menu item - if( m_passedES[ESSTD] ) sc = fillMuZTPDQA(); - } else { - // if non_express stream, run on all events - sc = fillMuZTPDQA(); - } + // if non_express stream, run on all events + sc = fillMuZTPDQA(); } return sc; diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonTruthMon.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonTruthMon.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e5c9a7b02fa085cb0df86a77462d1f694cf26968 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonTruthMon.cxx @@ -0,0 +1,168 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** @Afile MuonTruthMon.cxx + * + * authors: Laurynas Mince (laurynas.mince@cern.ch) + * date: 25.02.2020 + */ + +#include "TROOT.h" +#include "TH1F.h" +#include "TMath.h" + +#include "TrigMuonMonitoring/HLTMuonMonTool.h" + +StatusCode HLTMuonMonTool::initMuonTruthHists() +{ + ATH_CHECK(m_muonTruthParticlesKey.initialize()); + return StatusCode::SUCCESS; +}//initMuonTruthHists + +StatusCode HLTMuonMonTool::bookMuonTruthHists() +{ + // Truth muon histograms, i.e. the denominator in efficiency + addHistogram( new TH1F("EFMuon_effi_toTruth_pt_denom", "Truth muon p_{T}; p_{T}[GeV/c]; Entries", 30, 0.0, 200.0), m_histdirtruthmuon ); + + //single chain monitoring + std::vector<std::string> triggerlist; + triggerlist.insert(triggerlist.end(), m_chainsGeneric.begin(), m_chainsGeneric.end()); + triggerlist.insert(triggerlist.end(), m_chainsEFiso.begin(), m_chainsEFiso.end()); + triggerlist.insert(triggerlist.end(), m_chainsMSonly.begin(), m_chainsMSonly.end()); + triggerlist.insert(triggerlist.end(), m_chainsLowpt.begin(), m_chainsLowpt.end()); + for (std::string trig : triggerlist){ + // Truth muon eta and phi histograms with pT cuts per trigger chain + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_eta_denom_%s",trig.c_str()), Form("Truth muon %s #eta; #eta; Entries",trig.c_str()), 50, -2.7, 2.7), m_histdirtruthmuon ); + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_phi_denom_%s",trig.c_str()), Form("Truth muon %s #phi; #phi; Entries",trig.c_str()), 50, -3.14, 3.14), m_histdirtruthmuon ); + + // truth-matched trigger muon histograms, i.e. the numerator in efficiency + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_pt_numer_%s", trig.c_str()), Form("Truth-matched EF Muon %s p_{T}; p_{T}[GeV/c]; Entries", trig.c_str()), 30, 0.0, 200.0), m_histdirtruthmuon ); + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_eta_numer_%s",trig.c_str()), Form("Truth-matched EF Muon %s #eta; #eta; Entries", trig.c_str()), 50, -2.7, 2.7), m_histdirtruthmuon ); + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_phi_numer_%s",trig.c_str()), Form("Truth-matched EF Muon %s #phi; #phi [rad]; Entries", trig.c_str()), 50, -3.14,3.14), m_histdirtruthmuon ); + + // Truth-based efficiency histograms + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_pt_%s", trig.c_str()), Form("Truth-based EF Muon %s Efficiency pt (GeV/c); p_{T}[GeV/c]; Efficiency", trig.c_str()), 30, 0.0, 200.0 ), m_histdirtruthmuon ); + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_eta_%s", trig.c_str()), Form("Truth-based EF Muon %s Efficiency #eta; #eta; Efficiency", trig.c_str()), 50, -2.7, 2.7 ), m_histdirtruthmuon ); + addHistogram( new TH1F(Form("EFMuon_effi_toTruth_phi_%s", trig.c_str()), Form("Truth-based EF Muon %s Efficiency #phi (rad); #phi[rad]; Efficiency", trig.c_str()), 50, -3.14, 3.14 ), m_histdirtruthmuon ); + } + + return StatusCode::SUCCESS; +}//bookMuonTruthHists + +StatusCode HLTMuonMonTool::fillMuonTruthHists() +{ + const double DR_MATCHED = 0.1; + + //single chain monitoring + std::vector<std::string> triggerlist; + triggerlist.insert(triggerlist.end(), m_chainsGeneric.begin(), m_chainsGeneric.end()); + triggerlist.insert(triggerlist.end(), m_chainsEFiso.begin(), m_chainsEFiso.end()); + triggerlist.insert(triggerlist.end(), m_chainsMSonly.begin(), m_chainsMSonly.end()); + triggerlist.insert(triggerlist.end(), m_chainsLowpt.begin(), m_chainsLowpt.end()); + + SG::ReadHandle<xAOD::TruthParticleContainer> truthMuons(m_muonTruthParticlesKey); + if (truthMuons.isValid()) { + for (const auto truthMu : *truthMuons) { + double pt_true = truthMu->pt()/1000.0; + double eta_true = truthMu->eta(); + double phi_true = truthMu->phi(); + // Fill the truth histograms + hist("EFMuon_effi_toTruth_pt_denom", m_histdirtruthmuon)->Fill(pt_true); + // Match a trigger muon with the truth muon for each trigger chain + for (std::string trig : triggerlist){ + ATH_MSG_DEBUG("Retrieving feature container for " << trig); + // Names of muon trigger chains indicate the pT cuts like so "_mu50" for a 50 GeV cut + // Find the index of "_mu" in the string of a muon trigger chain name and move the index by + // 3 places to the right to reach a pT value + std::size_t index_i = trig.find("_mu")+3; + std::size_t index_f = trig.find("_", index_i+1); + double pT_cut = 0.0; + if (index_f < trig.length()) { + pT_cut = std::stod(trig.substr(index_i, index_f - index_i)); + } + else { + pT_cut = std::stod(trig.substr(index_i, trig.length()-1)); + } + // pT cut for eta/ phi distributions 1 GeV above the trigger pT cut + if (pT_cut + 1.0 > pt_true) + continue; + + // Fill the truth muon eta and phi histograms + hist(Form( "EFMuon_effi_toTruth_eta_denom_%s",trig.c_str()), m_histdirtruthmuon)->Fill(eta_true); + hist(Form( "EFMuon_effi_toTruth_phi_denom_%s",trig.c_str()), m_histdirtruthmuon)->Fill(phi_true); + + double dR = getTruthToEFdRmin(trig, eta_true, phi_true); + if ( dR <= DR_MATCHED) { + hist(Form( "EFMuon_effi_toTruth_pt_numer_%s",trig.c_str()), m_histdirtruthmuon)->Fill( pt_true ); + hist(Form( "EFMuon_effi_toTruth_eta_numer_%s",trig.c_str()), m_histdirtruthmuon)->Fill( eta_true ); + hist(Form( "EFMuon_effi_toTruth_phi_numer_%s",trig.c_str()), m_histdirtruthmuon)->Fill( phi_true ); + } + } + } + } + return StatusCode::SUCCESS; +}//fillMuonTruthHists + +double HLTMuonMonTool::getTruthToEFdRmin(const std::string trig, double eta_true, double phi_true) +{ + double dR_min = 1000.0; + if (getTDT()->getNavigationFormat() == "TriggerElement") { // run 2 access + ATH_MSG_DEBUG("Run 2 access to EF " << trig.c_str()); + const Trig::FeatureContainer fc = getTDT()->features( trig, TrigDefs::alsoDeactivateTEs); + const std::vector< Trig::Feature<xAOD::MuonContainer> > fEFs = fc.get<xAOD::MuonContainer>(); + for(const Trig::Feature<xAOD::MuonContainer> &fEF : fEFs){ + const xAOD::MuonContainer *cont = fEF.cptr(); + for( const xAOD::Muon* ef : *cont ){ + const HLT::TriggerElement *efTE = fEF.te(); + if(efTE->getActiveState()){//pass + double dR = calc_dR(ef->eta(), ef->phi(), eta_true, phi_true); + if (dR < dR_min) + dR_min = dR; + } + } + } + }//run 2 access + else { // run 3 access + ATH_MSG_DEBUG("Run 3 access to EF " << trig.c_str() << " = " << getTDT()->isPassed(trig)); + const std::vector< TrigCompositeUtils::LinkInfo<xAOD::MuonContainer> > fc = getTDT()->features<xAOD::MuonContainer>(trig); + ATH_MSG_DEBUG("N(EF muon LinkInfo) for chain " << trig << " = " << fc.size() << " passed = " << getTDT()->isPassed(trig)); + for(auto muonLinkInfo : fc) { + ATH_CHECK( muonLinkInfo.isValid(), -1 ); + ElementLink<xAOD::MuonContainer> muonLink = muonLinkInfo.link; + ATH_CHECK( muonLink.isValid(), 1 ); + double dR = calc_dR((*muonLink)->eta(), (*muonLink)->phi(), eta_true, phi_true); + if (dR < dR_min) + dR_min = dR; + } + }// run 3 access + + return dR_min; +}//getTruthToTruthToEFdRmin + +StatusCode HLTMuonMonTool::procMuonTruthHists() +{ + if( endOfRunFlag() ){ + ATH_MSG_DEBUG("procMuonTruthHists"); + + //single chain monitoring + std::vector<std::string> triggerlist; + triggerlist.insert(triggerlist.end(), m_chainsGeneric.begin(), m_chainsGeneric.end()); + triggerlist.insert(triggerlist.end(), m_chainsEFiso.begin(), m_chainsEFiso.end()); + triggerlist.insert(triggerlist.end(), m_chainsMSonly.begin(), m_chainsMSonly.end()); + triggerlist.insert(triggerlist.end(), m_chainsLowpt.begin(), m_chainsLowpt.end()); + + // Fill the truth-based efficiency histograms + for(std::string trig : triggerlist){ + hist(Form("EFMuon_effi_toTruth_pt_%s", trig.c_str()), m_histdirtruthmuon)->Sumw2(); + hist(Form("EFMuon_effi_toTruth_pt_%s", trig.c_str()), m_histdirtruthmuon)->Divide(hist(Form("EFMuon_effi_toTruth_pt_numer_%s", trig.c_str()), m_histdirtruthmuon), hist("EFMuon_effi_toTruth_pt_denom", m_histdirtruthmuon), 1, 1, "B"); + + hist(Form("EFMuon_effi_toTruth_eta_%s", trig.c_str()), m_histdirtruthmuon)->Sumw2(); + hist(Form("EFMuon_effi_toTruth_eta_%s", trig.c_str()), m_histdirtruthmuon)->Divide(hist(Form("EFMuon_effi_toTruth_eta_numer_%s", trig.c_str()), m_histdirtruthmuon), hist(Form("EFMuon_effi_toTruth_eta_denom_%s",trig.c_str()), m_histdirtruthmuon), 1, 1, "B"); + + hist(Form("EFMuon_effi_toTruth_phi_%s", trig.c_str()), m_histdirtruthmuon)->Sumw2(); + hist(Form("EFMuon_effi_toTruth_phi_%s", trig.c_str()), m_histdirtruthmuon)->Divide(hist(Form("EFMuon_effi_toTruth_phi_numer_%s", trig.c_str()), m_histdirtruthmuon), hist(Form("EFMuon_effi_toTruth_phi_denom_%s",trig.c_str()), m_histdirtruthmuon), 1, 1, "B"); + } + } + return StatusCode::SUCCESS; +}//procMuonTruthHists \ No newline at end of file diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_Ztautau.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_Ztautau.cxx index 43f68839230700d9608e0183ea0097f02587c537..cc1fbe84bbcf611c6030bf58bfe8eb7365a42d01 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_Ztautau.cxx +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_Ztautau.cxx @@ -221,17 +221,11 @@ StatusCode HLTTauMonTool::RealZTauTauEfficiency(const std::string & goodTauRefTy //ltau_dR > 2.9 && ltau_vismass > 45000. && ltau_vismass < 85000.) { - for(unsigned int i=0;i<m_trigItemsZtt.size();++i) - { - std::string l1_chain(LowerChain("HLT_"+m_trigItemsZtt[i])); - std::string hlt_chain = "HLT_"+m_trigItemsZtt[i]; - std::string trigItemShort; - if(m_trigItemsZtt[i].find("tau25")!=string::npos && m_trigItemsZtt[i].find("L1TAU")!=string::npos){ - size_t posit=m_trigItemsZtt[i].rfind("_"); - if(posit<31)trigItemShort=m_trigItemsZtt[i].substr(0,posit); - } + for ( const auto& item: m_trigItemsZtt ) { + std::string l1_chain(LowerChain("HLT_"+item)); + std::string hlt_chain = "HLT_"+item; - setCurrentMonGroup("HLT/TauMon/Expert/RealZtautauEff/"+trigItemShort); + setCurrentMonGroup("HLT/TauMon/Expert/RealZtautauEff/"+item); //hist("hRealZttPtDenom")->Fill(Tau_TLV.Pt()/GeV); //L1 diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_bookHistograms.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_bookHistograms.cxx index 044a4226892b0c70f42d92cfaaab899921e7d40e..8af3ab872d90fd6f31d4c65dff4e1785bba63d30 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_bookHistograms.cxx +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool_bookHistograms.cxx @@ -611,16 +611,10 @@ void HLTTauMonTool::bookHistogramsAllItem(){ { const int nbin_pt = 11; double bins_pt[nbin_pt] = {20.,25.,30.,35.,40.,45.,50.,60.,70.,100.,150.}; - - for(unsigned int i=0;i<m_trigItemsZtt.size();++i) + for ( const auto& item: m_trigItemsZtt ) { - std::string trigItemShort; - if(m_trigItemsZtt[i].find("tau25")!=string::npos){ - size_t posit=m_trigItemsZtt[i].rfind("_"); - if(posit<31)trigItemShort=m_trigItemsZtt[i].substr(0,posit); - } - addMonGroup( new MonGroup(this, "HLT/TauMon/Expert/RealZtautauEff/"+trigItemShort,run) ); - setCurrentMonGroup("HLT/TauMon/Expert/RealZtautauEff/"+trigItemShort); + addMonGroup( new MonGroup(this, "HLT/TauMon/Expert/RealZtautauEff/"+item,run) ); + setCurrentMonGroup("HLT/TauMon/Expert/RealZtautauEff/"+item); //addHistogram(new TH1F("hRealZttPtDenom","Offline Real Tau;Offline Tau p_{T} [GeV];",nbin_pt-1,bins_pt)); //addHistogram(new TH1F("hRealZttL1PtNum","L1 vs Offline Real Tau; Offline Tau p_{T} [GeV];",nbin_pt-1,bins_pt)); //addHistogram(new TH1F("hRealZttHLTPtNum","HLT vs Offline Real Tau; Offline Tau p_{T} [GeV];",nbin_pt-1,bins_pt)); diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypo.h similarity index 82% rename from Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h rename to Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypo.h index 60833c41053ada63abf99974944c73adc57f3905..ef7151cc847694c70ebffcfd65392689ca82b7c5 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypo.h @@ -11,7 +11,7 @@ // STL includes #include <string> #include <utility> -#include "ComboHypoToolBase.h" +#include "DecisionHandling/ComboHypoToolBase.h" /** * @class ComboHypo for combined hypotheses required only counting (multiplicity requirements) @@ -26,7 +26,7 @@ class ComboHypo : public ::AthReentrantAlgorithm { -public: + public: ComboHypo(const std::string& name, ISvcLocator* pSvcLocator); virtual ~ComboHypo() override; @@ -34,7 +34,15 @@ public: virtual StatusCode execute(const EventContext& context) const override; virtual StatusCode finalize() override; -private: + protected: + const SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer>& decisionsInput() const { return m_inputs; } + const SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer>& decisionsOutput() const { return m_outputs; } + typedef std::map<std::string, std::vector<int>> MultiplicityReqMap; + const MultiplicityReqMap& triggerMultiplicityMap() const { return m_multiplicitiesReqMap.value(); } + ToolHandleArray<ComboHypoToolBase>& hypoTools() { return m_hypoTools; } + const ToolHandleArray<ComboHypoToolBase>& hypoTools() const { return m_hypoTools; } + + private: SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputs { this, "HypoInputDecisions", {}, "Input Decisions" }; SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_outputs { this, "HypoOutputDecisions", {}, "Ouput Decisions" }; @@ -42,10 +50,12 @@ private: Gaudi::Property<bool> m_requireUniqueROI {this, "RequireUniqueROI", false, "Require each Feature in each leg of the combination to come from a unique L1 seeding ROI."}; - typedef std::map<std::string, std::vector<int>> MultiplicityReqMap; Gaudi::Property< MultiplicityReqMap > m_multiplicitiesReqMap{this, "MultiplicitiesMap", {}, "Map from the chain name to multiplicities required at each input"}; + Gaudi::Property<bool> m_checkMultiplicityMap { this, "CheckMultiplicityMap", true, + "Perform a consistency check of the MultiplicitiesMap"}; + /** * @brief iterates over the inputs and for every object (no filtering) crates output object linked to input moving * the decisions that are mentioned in the passing set diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h similarity index 85% rename from Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.h rename to Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h index e19ea90d4c86c3157bc0828cb1865282730070e5..a9937ad8ba42b1320f61126aa6ce0baca603338d 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ComboHypoToolBase.h @@ -5,7 +5,7 @@ #define DECISIONHANDLING_COMBOHYPOTOOLBASE_H // Package includes -#include "IComboHypoTool.h" +#include "DecisionHandling/IComboHypoTool.h" // Framework includes #include "AthenaBaseComps/AthAlgTool.h" @@ -14,6 +14,7 @@ // STL includes #include <string> +#include <vector> /** * @class ComboHypoToolBase @@ -34,12 +35,16 @@ public: **/ virtual StatusCode decide(LegDecisionsMap & passingLegs, const EventContext& /* ctx */ ) const override; + virtual StatusCode decideOnSingleObject(TrigCompositeUtils::Decision*, const std::vector<TrigCompositeUtils::DecisionIDContainer*>&) const { return StatusCode::SUCCESS; } /** * @brief retrieves this decision Id **/ - virtual HLT::Identifier decisionId() const { return m_decisionId; } + virtual HLT::Identifier decisionId() const { return m_decisionId; } + void setLegDecisionIds(const std::vector<HLT::Identifier>& legDecisionIds) { m_legDecisionIds = legDecisionIds; } + HLT::Identifier legDecisionId(size_t i) const { return m_legDecisionIds.at(i); } + const std::vector<HLT::Identifier>& legDecisionIds() const { return m_legDecisionIds; } protected: @@ -105,8 +110,8 @@ public: private: - HLT::Identifier m_decisionId; - + HLT::Identifier m_decisionId; + std::vector<HLT::Identifier> m_legDecisionIds; }; diff --git a/Trigger/TrigSteer/DecisionHandling/src/IComboHypoTool.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/IComboHypoTool.h similarity index 100% rename from Trigger/TrigSteer/DecisionHandling/src/IComboHypoTool.h rename to Trigger/TrigSteer/DecisionHandling/DecisionHandling/IComboHypoTool.h diff --git a/Trigger/TrigSteer/DecisionHandling/python/DecisionHandlingConfig.py b/Trigger/TrigSteer/DecisionHandling/python/DecisionHandlingConfig.py index f1890347b73e97bd5649176ea619f6e10c330c77..8fa029189db31349f76bb2bf19064ee65fd8d70e 100644 --- a/Trigger/TrigSteer/DecisionHandling/python/DecisionHandlingConfig.py +++ b/Trigger/TrigSteer/DecisionHandling/python/DecisionHandlingConfig.py @@ -26,3 +26,8 @@ def TriggerSummaryAlg( name ): xbins=100, xmin=0, xmax=3.5e3 ) alg.MonTool = monTool return alg + +def ComboHypoCfg( name ): + from DecisionHandling.DecisionHandlingConf import ComboHypo + alg = ComboHypo( name ) + return alg diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx index 68afffcdf052abc46d81162a907fa1cddca20533..88ec47e71facfeb236f9278ac8b955c42c79e54d 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "ComboHypo.h" +#include "DecisionHandling/ComboHypo.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" @@ -57,12 +57,14 @@ StatusCode ComboHypo::initialize() { ATH_CHECK( m_multiplicitiesReqMap.size() != 0 ); bool errorOccured = false; - for ( const auto& m : m_multiplicitiesReqMap ) { - if ( m.second.size() != maxMult ) { - errorOccured = true; - ATH_MSG_ERROR( "Chain " << m.first - << " configured with input multiplicity " << m.second.size() << " like this: " << m.second - << " which is lower than for this chain " << maxMultEl->first << " " << maxMult); + if (m_checkMultiplicityMap) { + for ( const auto& m : m_multiplicitiesReqMap ) { + if ( m.second.size() != maxMult ) { + errorOccured = true; + ATH_MSG_ERROR( "Chain " << m.first + << " configured with input multiplicity " << m.second.size() << " like this: " << m.second + << " which is lower than for this chain " << maxMultEl->first << " " << maxMult); + } } } diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx index 09dbb94a1a9d84330829146056d74536d8f11c23..613e380f5cf0b5dacbf88a8f5cb7e27c606cf05f 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoToolBase.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "ComboHypoToolBase.h" +#include "DecisionHandling/ComboHypoToolBase.h" using namespace TrigCompositeUtils; diff --git a/Trigger/TrigSteer/DecisionHandling/src/DeltaRRoIComboHypoTool.h b/Trigger/TrigSteer/DecisionHandling/src/DeltaRRoIComboHypoTool.h index 2e55844205a3483b5dab6edb0214357b7d9c947f..d548f6c4b02d7b2aa38f676369b3aa1ff6ce4653 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/DeltaRRoIComboHypoTool.h +++ b/Trigger/TrigSteer/DecisionHandling/src/DeltaRRoIComboHypoTool.h @@ -9,7 +9,7 @@ #include "TrigCompositeUtils/HLTIdentifier.h" #include "AthenaBaseComps/AthAlgTool.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "ComboHypoToolBase.h" +#include "DecisionHandling/ComboHypoToolBase.h" class DeltaRRoIComboHypoTool: public ComboHypoToolBase { diff --git a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx index e55e57d985d6d54d53b9d19b229ec93a69b2abc0..e891afb5dad91b7a401bcb32542fd35d9eced1ec 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx @@ -1,10 +1,10 @@ #include "../DumpDecisions.h" #include "../RoRSeqFilter.h" #include "../TriggerSummaryAlg.h" -#include "../ComboHypo.h" +#include "DecisionHandling/ComboHypo.h" #include "../InputMakerForRoI.h" #include "../DeltaRRoIComboHypoTool.h" -#include "../ComboHypoToolBase.h" +#include "DecisionHandling/ComboHypoToolBase.h" DECLARE_COMPONENT( DumpDecisions ) DECLARE_COMPONENT( RoRSeqFilter ) diff --git a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h index 868ca21e79de11682c33d48144500f7a1f8cf082..2a5ad8bcc702ba363c47b95453ba4e89b46b759a 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h +++ b/Trigger/TrigSteer/TrigOutputHandling/TrigOutputHandling/HLTResultMTMaker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGOUTPUTHANDLING_HLTRESULTMTMAKER_H @@ -48,10 +48,15 @@ private: this, "HLTResultWHKey", "HLTResultMT", "Key of the output HLTResultMT object" }; + /// Tool creating stream tags (defines if event is accepted) + ToolHandle<HLTResultMTMakerTool> m_streamTagMaker { + this, "StreamTagMaker", "", + "Tool creating stream tags (defines if event is accepted)" + }; /// Tools filling the HLTResultMT object ToolHandleArray<HLTResultMTMakerTool> m_makerTools { this, "MakerTools", {}, - "Set of tools that fill content of the HLTResultMT" + "Set of additional tools that fill content of the HLTResultMT" }; /// Monitoring tool ToolHandle<GenericMonitoringTool> m_monTool { diff --git a/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py b/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py index 257bb698a9000244f5ba3cb1352e59cb9f04c8cf..a2e6ea02f15d530b842a090b657e3487676f03c6 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py +++ b/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py @@ -1,9 +1,10 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + from AthenaConfiguration.ComponentFactory import CompFactory from builtins import str def HLTResultMTMakerCfg(name="HLTResultMTMaker"): - from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool m = CompFactory.HLTResultMTMaker(name) @@ -35,16 +36,9 @@ def HLTResultMTMakerCfg(name="HLTResultMTMaker"): # Configure HLT result monitoring histograms m.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) - m.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPERT', type='TH1F', title='Time of result making;Time [us];Events', - xbins=100, xmin=0, xmax=1000 ), - defineHistogram( 'nstreams', path='EXPERT', type='TH1F', title='Number of streams;Number of streams;Events', - xbins=60, xmin=0, xmax=60 ), - defineHistogram( 'nfrags', path='EXPERT', type='TH1F', title='Number of HLT results (module IDs);Number of results;Events', - xbins=10, xmin=0, xmax=10 ), - defineHistogram( 'sizeMain', path='EXPERT', type='TH1F', title='Main (physics) HLT result size;Size [kB];Events', - xbins=101, xmin=-10, xmax=1000 ) ] - - + m.MonTool.defineHistogram('TIME_makeResult', path='EXPERT', type='TH1F', title='makeResult() call time;Time [ms];Events', + xbins=200, xmin=0, xmax=50 ) + return m def TriggerEDMSerialiserToolCfg(name="TriggerEDMSerialiserTool"): diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx index c1a593fa9fe088dbd73cde88390104459a271069..09d6ba5a136e04283a84013c96f2795d4768a80d 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultMTMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigOutputHandling/HLTResultMTMaker.h" @@ -64,6 +64,7 @@ HLTResultMTMaker::~HLTResultMTMaker() {} // ============================================================================= StatusCode HLTResultMTMaker::initialize() { ATH_CHECK(m_hltResultWHKey.initialize()); + ATH_CHECK(m_streamTagMaker.retrieve()); ATH_CHECK(m_makerTools.retrieve()); ATH_CHECK(m_monTool.retrieve()); ATH_CHECK(m_jobOptionsSvc.retrieve()); @@ -126,40 +127,39 @@ StatusCode HLTResultMTMaker::finalize() { // The main method of the tool // ============================================================================= StatusCode HLTResultMTMaker::makeResult(const EventContext& eventContext) const { + auto monTime = Monitored::Timer<std::chrono::duration<float, std::milli>>("TIME_makeResult"); // Create and record the HLTResultMT object auto hltResult = SG::makeHandle(m_hltResultWHKey,eventContext); ATH_CHECK( hltResult.record(std::make_unique<HLT::HLTResultMT>()) ); ATH_MSG_DEBUG("Recorded HLTResultMT with key " << m_hltResultWHKey.key()); - // Fill the object using the result maker tools - auto time = Monitored::Timer("TIME_build" ); + // Fill the stream tags StatusCode finalStatus = StatusCode::SUCCESS; - for (auto& maker: m_makerTools) { - if (StatusCode sc = maker->fill(*hltResult, eventContext); sc.isFailure()) { - ATH_MSG_ERROR(maker->name() << " failed"); - finalStatus = sc; - } + if (StatusCode sc = m_streamTagMaker->fill(*hltResult, eventContext); sc.isFailure()) { + ATH_MSG_ERROR(m_streamTagMaker->name() << " failed"); + finalStatus = sc; } - time.stop(); - - if (!m_skipValidatePEBInfo) validatePEBInfo(*hltResult); - ATH_MSG_DEBUG(*hltResult); + // Fill the result using all other tools if the event was accepted + if (hltResult->isAccepted()) { + for (auto& maker: m_makerTools) { + ATH_MSG_DEBUG("Calling " << maker->name() << " for accepted event"); + if (StatusCode sc = maker->fill(*hltResult, eventContext); sc.isFailure()) { + ATH_MSG_ERROR(maker->name() << " failed"); + finalStatus = sc; + } + } - // Fill monitoring histograms - auto nstreams = Monitored::Scalar("nstreams", hltResult->getStreamTags().size()); - auto bitWords = Monitored::Scalar("bitWords", hltResult->getHltPassRawBits().size() - + hltResult->getHltPrescaledBits().size() - + hltResult->getHltRerunBits().size() ); - auto nfrags = Monitored::Scalar("nfrags", hltResult->getSerialisedData().size()); - auto sizeMain = Monitored::Scalar("sizeMain", -1.); - auto iter = hltResult->getSerialisedData().find(0); // this is the main fragment of the HLT result - if (iter != hltResult->getSerialisedData().end()) - sizeMain = double(iter->second.size()*sizeof(uint32_t))/1024; + if (!m_skipValidatePEBInfo) validatePEBInfo(*hltResult); + } + else { + ATH_MSG_DEBUG("Rejected event, further result filling skipped after stream tag maker"); + } - Monitored::Group(m_monTool, time, nstreams, nfrags, sizeMain, bitWords); + ATH_MSG_DEBUG(*hltResult); + Monitored::Group(m_monTool, monTime); return finalStatus; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx index 2de1f5aa688831890079f31e30a9033727821576..3c5211163a921f8a0d5ab118c2a63b66e2fe8f8a 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/StreamTagMakerTool.cxx @@ -111,6 +111,11 @@ StatusCode StreamTagMakerTool::fill( HLT::HLTResultMT& resultToFill, const Event DecisionIDContainer rerunIDs; decisionIDs(rerunChains, rerunIDs); + if (passRawIDs.empty()) { + ATH_MSG_DEBUG("No chains passed, event rejected"); + return StatusCode::SUCCESS; + } + std::unordered_map<unsigned int, PEBInfoWriterToolBase::PEBInfo> chainToPEBInfo; ATH_CHECK(fillPEBInfoMap(chainToPEBInfo, ctx)); diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl1.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl1.cxx index f860bf1651b96fd51165bba15a173efb55d1fcd2..4fe5a5b27ff3f3deb5be947a056f2919559fea93 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl1.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl1.cxx @@ -150,9 +150,9 @@ TCS::DeltaEtaIncl1::processBitCorrect( const std::vector<TCS::TOBArray const *> output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptDEta1[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histAcceptDEta1[i]->GetName(),(float)deltaEta*0.10); } else if(fillReject) { - m_histRejectDEta1[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histRejectDEta1[i]->GetName(),(float)deltaEta*0.10); } msgss << (accept?"pass":"fail") << "|"; TRG_MSG_DEBUG(msgss.str()); @@ -204,9 +204,9 @@ TCS::DeltaEtaIncl1::process( const std::vector<TCS::TOBArray const *> & input, output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptDEta1[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histAcceptDEta1[i]->GetName(),(float)deltaEta*0.10); } else if(fillReject) { - m_histRejectDEta1[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histRejectDEta1[i]->GetName(),(float)deltaEta*0.10); } msgss << (accept?"pass":"fail") << "|"; TRG_MSG_DEBUG(msgss.str()); diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl2.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl2.cxx index b73fe3bcefaa4bfe1e5e49a15364c8d1f10ec83e..a081723593dce663fd0510abc6748611e4070f90 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl2.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaEtaIncl2.cxx @@ -140,9 +140,9 @@ TCS::DeltaEtaIncl2::processBitCorrect( const std::vector<TCS::TOBArray const *> output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptDEta2[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histAcceptDEta2[i]->GetName(),(float)deltaEta*0.10); } else if(fillReject) { - m_histRejectDEta2[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histRejectDEta2[i]->GetName(),(float)deltaEta*0.10); } TRG_MSG_DEBUG("DeltaEta = " << deltaEta << " -> accept bit " << i << " -> " << (accept?"pass":"fail")); @@ -183,9 +183,9 @@ TCS::DeltaEtaIncl2::process( const std::vector<TCS::TOBArray const *> & input, output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptDEta2[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histAcceptDEta2[i]->GetName(),(float)deltaEta*0.10); } else if(fillReject) { - m_histRejectDEta2[i]->Fill((float)deltaEta*0.10); + fillHist1D(m_histRejectDEta2[i]->GetName(),(float)deltaEta*0.10); } TRG_MSG_DEBUG("DeltaEta = " << deltaEta << " -> accept bit " << i << " -> " << (accept?"pass":"fail")); diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaPhiIncl2.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaPhiIncl2.cxx index ce02468851ca7eda77a790b016c4529f002b77b6..f1b26f2ad21b869e1ff86d7e76b436fcc2312df6 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaPhiIncl2.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/DeltaPhiIncl2.cxx @@ -121,13 +121,13 @@ TCS::DeltaPhiIncl2::processBitCorrect( const std::vector<TCS::TOBArray const *> //if (i == 0) { if (!iaccept[i]) { iaccept[i]=1; - m_histAcceptDPhi2[i]->Fill(deltaPhi); + fillHist1D(m_histAcceptDPhi2[i]->GetName(),deltaPhi); } //} } else { //if (i==0) - m_histRejectDPhi2[i]->Fill(deltaPhi); + fillHist1D(m_histRejectDPhi2[i]->GetName(),deltaPhi); } TRG_MSG_DEBUG("DeltaPhi = " << deltaPhi << " -> " << (accept?"pass":"fail")); @@ -168,13 +168,13 @@ TCS::DeltaPhiIncl2::process( const std::vector<TCS::TOBArray const *> & input, //if (i == 0) { if (!iaccept[i]) { iaccept[i]=1; - m_histAcceptDPhi2[i]->Fill(deltaPhi); + fillHist1D(m_histAcceptDPhi2[i]->GetName(),deltaPhi); } //} } else { //if (i==0) - m_histRejectDPhi2[i]->Fill(deltaPhi); + fillHist1D(m_histRejectDPhi2[i]->GetName(),deltaPhi); } TRG_MSG_DEBUG("DeltaPhi = " << deltaPhi << " -> " << (accept?"pass":"fail")); diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/ExclusiveJets.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/ExclusiveJets.cxx index 17a059ab1c59fae11eea1180280458f1a6312ff9..3623816bb2c89c50b95d879e18aac809a33e847c 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/ExclusiveJets.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/ExclusiveJets.cxx @@ -142,11 +142,11 @@ TCS::ExclusiveJets::processBitCorrect( const vector<TCS::TOBArray const *> & inp output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptExclusiveJets[i]->Fill(xi_1); + fillHist1D(m_histAcceptExclusiveJets[i]->GetName(),xi_1); } else if(fillReject) { - m_histRejectExclusiveJets[i]->Fill(xi_1); + fillHist1D(m_histRejectExclusiveJets[i]->GetName(),xi_1); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1); } } @@ -196,11 +196,11 @@ TCS::ExclusiveJets::process( const vector<TCS::TOBArray const *> & input, output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptExclusiveJets[i]->Fill(xi_1); + fillHist1D(m_histAcceptExclusiveJets[i]->GetName(),xi_1); } else if(fillReject) { - m_histRejectExclusiveJets[i]->Fill(xi_1); + fillHist1D(m_histRejectExclusiveJets[i]->GetName(),xi_1); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1); } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassDeltaPhiInclusive.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassDeltaPhiInclusive.cxx index 747ad00da2b1f29b299207a0c3ddbf710376f7e2..5117a3f2bfa486df62d56ae084c716ef226b1bdb 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassDeltaPhiInclusive.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassDeltaPhiInclusive.cxx @@ -194,13 +194,13 @@ TCS::InvariantMassDeltaPhiInclusive::processBitCorrect( const std::vector<TCS::T output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDPhi[i]->Fill(sqrt((float)deltaPhi)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDPhi[i]->GetName(),sqrt((float)deltaPhi)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDPhi[i]->Fill(sqrt((float)deltaPhi)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDPhi[i]->GetName(),sqrt((float)deltaPhi)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } @@ -253,13 +253,13 @@ TCS::InvariantMassDeltaPhiInclusive::process( const std::vector<TCS::TOBArray co output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDPhi[i]->Fill(sqrt((float)deltaPhi)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDPhi[i]->GetName(),sqrt((float)deltaPhi)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDPhi[i]->Fill(sqrt((float)deltaPhi)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDPhi[i]->GetName(),sqrt((float)deltaPhi)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept ?"pass":"fail") << " invmass2 = " << invmass2); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1.cxx index 5d0ac1249ef0c077aa818bdd3bdf426ed596b10c..697e5640075589ce80794623486ca4e92e66025d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1.cxx @@ -162,11 +162,11 @@ TCS::InvariantMassInclusive1::processBitCorrect( const std::vector<TCS::TOBArray output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptINV1[i]->Fill(sqrt((float)invmass2)); + fillHist1D(m_histAcceptINV1[i]->GetName(),sqrt((float)invmass2)); } else if(fillReject) { - m_histRejectINV1[i]->Fill(sqrt((float)invmass2)); + fillHist1D(m_histRejectINV1[i]->GetName(),sqrt((float)invmass2)); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } } } @@ -221,11 +221,11 @@ TCS::InvariantMassInclusive1::process( const std::vector<TCS::TOBArray const *> output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptINV1[i]->Fill(sqrt((float)invmass2)); + fillHist1D(m_histAcceptINV1[i]->GetName(),sqrt((float)invmass2)); } else if(fillReject) { - m_histRejectINV1[i]->Fill(sqrt((float)invmass2)); + fillHist1D(m_histRejectINV1[i]->GetName(),sqrt((float)invmass2)); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1DeltaRSqrIncl1.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1DeltaRSqrIncl1.cxx index 51428fbf5e9c876322e7c7a1d079b1b0feccaa7b..833840828224fc29474d545b104fc3697c06f18d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1DeltaRSqrIncl1.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive1DeltaRSqrIncl1.cxx @@ -184,11 +184,11 @@ TCS::InvariantMassInclusive1DeltaRSqrIncl1::processBitCorrect( const std::vector output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDR[i]->Fill(sqrt((float)deltaR2)); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDR[i]->GetName(),sqrt((float)deltaR2)); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDR[i]->Fill(sqrt((float)deltaR2)); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDR[i]->GetName(),sqrt((float)deltaR2)); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2 << " deltaR2 = " << deltaR2 ); } @@ -246,11 +246,11 @@ TCS::InvariantMassInclusive1DeltaRSqrIncl1::process( const std::vector<TCS::TOBA output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDR[i]->Fill(sqrt((float)deltaR2)); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDR[i]->GetName(),sqrt((float)deltaR2)); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDR[i]->Fill(sqrt((float)deltaR2)); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDR[i]->GetName(),sqrt((float)deltaR2)); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2 << " deltaR2 = " << deltaR2 ); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2.cxx index 325ab75bc928c443cb6d5708174e3eaa6ae9b1bd..6daa338dbba8f35a720fdc3ff406f6214cf7b70d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2.cxx @@ -172,11 +172,11 @@ TCS::InvariantMassInclusive2::processBitCorrect( const std::vector<TCS::TOBArray output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } @@ -227,11 +227,11 @@ TCS::InvariantMassInclusive2::process( const std::vector<TCS::TOBArray const *> output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept ?"pass":"fail") << " invmass2 = " << invmass2); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2DeltaRSqrIncl2.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2DeltaRSqrIncl2.cxx index 4f834ddd3aeef317e9b230813ce7c269f64e3065..e1662362497dec47a92239de01d58c8492348ec9 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2DeltaRSqrIncl2.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassInclusive2DeltaRSqrIncl2.cxx @@ -198,13 +198,13 @@ TCS::InvariantMassInclusive2DeltaRSqrIncl2::processBitCorrect( const std::vector output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDR[i]->Fill(sqrt((float)deltaR2)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDR[i]->GetName(),sqrt((float)deltaR2)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDR[i]->Fill(sqrt((float)deltaR2)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDR[i]->GetName(),sqrt((float)deltaR2)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2 << " deltaR2 = " << deltaR2 ); } @@ -258,13 +258,13 @@ TCS::InvariantMassInclusive2DeltaRSqrIncl2::process( const std::vector<TCS::TOBA output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) ); } if(fillAccept and not alreadyFilled) { - m_histAcceptM[i]->Fill(sqrt((float)invmass2)); - m_histAcceptDR[i]->Fill(sqrt((float)deltaR2)); - m_histAcceptEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histAcceptM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histAcceptDR[i]->GetName(),sqrt((float)deltaR2)); + fillHist2D(m_histAcceptEta1Eta2[i]->GetName(),eta1, eta2); } else if(fillReject) { - m_histRejectM[i]->Fill(sqrt((float)invmass2)); - m_histRejectDR[i]->Fill(sqrt((float)deltaR2)); - m_histRejectEta1Eta2[i]->Fill(eta1, eta2); + fillHist1D(m_histRejectM[i]->GetName(),sqrt((float)invmass2)); + fillHist1D(m_histRejectDR[i]->GetName(),sqrt((float)deltaR2)); + fillHist2D(m_histRejectEta1Eta2[i]->GetName(),eta1, eta2); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2 << " deltaR2 = " << deltaR2 ); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassThreeTOBsIncl.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassThreeTOBsIncl.cxx index 54f1600ad8149b6e55b06768c26e9d8846751620..8950ab01bda28ce4647ed29604651aa60b7380de 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassThreeTOBsIncl.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/InvariantMassThreeTOBsIncl.cxx @@ -167,11 +167,11 @@ TCS::InvariantMassThreeTOBsIncl::processBitCorrect( const vector<TCS::TOBArray c TOBvector.clear(); } if(fillAccept and not alreadyFilled) { - m_histAcceptINVThree[i]->Fill(sqrt(invmass2)); + fillHist1D(m_histAcceptINVThree[i]->GetName(),sqrt(invmass2)); } else if(fillReject) { - m_histRejectINVThree[i]->Fill(sqrt(invmass2)); + fillHist1D(m_histRejectINVThree[i]->GetName(),sqrt(invmass2)); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } } @@ -239,11 +239,11 @@ TCS::InvariantMassThreeTOBsIncl::process( const vector<TCS::TOBArray const *> & TOBvector.clear(); } if(fillAccept and not alreadyFilled) { - m_histAcceptINVThree[i]->Fill(sqrt(invmass2)); + fillHist1D(m_histAcceptINVThree[i]->GetName(),sqrt(invmass2)); } else if(fillReject) { - m_histRejectINVThree[i]->Fill(sqrt(invmass2)); + fillHist1D(m_histRejectINVThree[i]->GetName(),sqrt(invmass2)); } - TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); + TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " invmass2 = " << invmass2); } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/JetHT.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/JetHT.cxx index ed69da95ea859f3e5b4fcac9ccfe0349b08903ba..c017583ee11e4ffa5610864f53bbac99bafeb3a4 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/JetHT.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/JetHT.cxx @@ -141,9 +141,9 @@ TCS::JetHT::process( const std::vector<TCS::TOBArray const *> & input, output[i]->push_back( CompositeTOB( GenericTOB::createOnHeap( GenericTOB(sumET,0,0) ) )); } if(fillAccept and not alreadyFilled) { - m_histAcceptHT[i]->Fill(sumET); + fillHist1D(m_histAcceptHT[i]->GetName(),sumET); } else if(fillReject) { - m_histRejectHT[i]->Fill(sumET); + fillHist1D(m_histRejectHT[i]->GetName(),sumET); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " HT = " << sumET); diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/MinDeltaPhiIncl2.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/MinDeltaPhiIncl2.cxx index 7d46a71fd87dea5e412efcba378b7986b9c40d2b..435efb2196b04b3a754b227021ea5297c12542ac 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/MinDeltaPhiIncl2.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/MinDeltaPhiIncl2.cxx @@ -151,9 +151,9 @@ TCS::MinDeltaPhiIncl2::processBitCorrect( const std::vector<TCS::TOBArray const output[i]->push_back(TCS::CompositeTOB(*tobmin1, *tobmin2)); } if(fillAccept and not alreadyFilled){ - m_histAcceptMinDPhi2[i]->Fill((float)mindphi*0.10); + fillHist1D(m_histAcceptMinDPhi2[i]->GetName(),(float)mindphi*0.10); } else if(fillReject){ - m_histRejectMinDPhi2[i]->Fill((float)mindphi*0.10); + fillHist1D(m_histRejectMinDPhi2[i]->GetName(),(float)mindphi*0.10); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail")); } // for(i) @@ -223,9 +223,9 @@ TCS::MinDeltaPhiIncl2::process( const std::vector<TCS::TOBArray const *> & input output[i]->push_back(TCS::CompositeTOB(*tobmin1, *tobmin2)); } if(fillAccept and not alreadyFilled){ - m_histAcceptMinDPhi2[i]->Fill((float)mindphi*0.10); + fillHist1D(m_histAcceptMinDPhi2[i]->GetName(),(float)mindphi*0.10); } else if(fillReject) { - m_histRejectMinDPhi2[i]->Fill((float)mindphi*0.10); + fillHist1D(m_histRejectMinDPhi2[i]->GetName(),(float)mindphi*0.10); } TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail")); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/SimpleCone.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/SimpleCone.cxx index d41df902f9b256e74faf89f2a8bc4e50fff7d728..923961e4fabdd17a9eb8b0e86a631d4918ca9338 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/SimpleCone.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/SimpleCone.cxx @@ -163,9 +163,9 @@ TCS::SimpleCone::process( const std::vector<TCS::TOBArray const *> & input, output[i]->push_back( CompositeTOB( GenericTOB::createOnHeap( GenericTOB(leadingET,0,0) ) )); } if(fillAccept) - m_histAcceptSimpleCone[i]->Fill(leadingET); + fillHist1D(m_histAcceptSimpleCone[i]->GetName(),leadingET); else if(fillReject) - m_histRejectSimpleCone[i]->Fill(leadingET); + fillHist1D(m_histRejectSimpleCone[i]->GetName(),leadingET); TRG_MSG_DEBUG("Decision " << i << ": " << (accept?"pass":"fail") << " SimpleCone = " << leadingET); diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt index 87c2a1940909ac18ec15952e9d8eb458860c5267..5d7c49c7fda80a5e95b371ac15a2ba4c5c509f07 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt @@ -7,6 +7,7 @@ atlas_subdir( L1TopoCoreSim ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + GaudiKernel Trigger/TrigT1/L1Topo/L1TopoCommon Trigger/TrigT1/L1Topo/L1TopoConfig Trigger/TrigT1/L1Topo/L1TopoEvent @@ -27,13 +28,13 @@ atlas_add_library( L1TopoCoreSim PUBLIC_HEADERS L1TopoCoreSim INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces ${ROOT_LIBRARIES} + LINK_LIBRARIES GaudiKernel L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces ${ROOT_LIBRARIES} PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoAlgorithms L1TopoHardware ) atlas_add_executable( TrigConfTopoStandAlone src/test/TopoStandAlone.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase L1TopoAlgorithms L1TopoHardware L1TopoCoreSim ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} GaudiKernel L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase L1TopoAlgorithms L1TopoHardware L1TopoCoreSim ) atlas_add_executable( TrigConfTopoTestSteeringConfig src/test/TopoTestSteeringConfig.cxx diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/StandaloneL1TopoHistSvc.h b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/StandaloneL1TopoHistSvc.h index c72241341179a0af83f6080100639365dc2e8bb9..c6234198a734f149ba6a4a7d727d919a846d4c33 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/StandaloneL1TopoHistSvc.h +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/L1TopoCoreSim/StandaloneL1TopoHistSvc.h @@ -16,8 +16,14 @@ public: virtual void registerHist(TH1 * h) override; + virtual void registerHist(TH2 * h) override; + virtual TH1 * findHist(const std::string & histName) override; + virtual void fillHist1D(const std::string & histName, double x) override; + + virtual void fillHist2D(const std::string & histName, double x, double y) override; + virtual void setBaseDir(const std::string & baseDir) override; virtual void save() override; diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/StandaloneL1TopoHistSvc.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/StandaloneL1TopoHistSvc.cxx index 211b0bedec8eef752989985c1d521c1448e24e71..54f762f5632507fea6f3a1425aa9fb8e9d21c414 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/StandaloneL1TopoHistSvc.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/StandaloneL1TopoHistSvc.cxx @@ -4,6 +4,7 @@ #include "L1TopoCoreSim/StandaloneL1TopoHistSvc.h" #include "TFile.h" #include "TH1.h" +#include "TH2.h" #include <iostream> #include <map> @@ -21,19 +22,37 @@ public: {} ~StandaloneL1TopoHistSvcImpl() { - for( auto h : m_hists ) { + for( auto h : m_hists1D ) { + delete h.second; + } + for( auto h : m_hists2D ) { delete h.second; } } void registerHist(TH1 * h) { if(h != nullptr) { - //cout << "JOERG registering histogram " << h->GetName() << " at " << h << endl; + //cout << "JOERG registering histogram " << h->GetName() << " at " << h << endl; h->SetDirectory(0); TRG_MSG_DEBUG("Registering histogram " << h->GetName()); const string key = h->GetName(); - if( m_hists.find(key) == end(m_hists) ) { - m_hists[key] = h; + if( m_hists1D.find(key) == end(m_hists1D) ) { + m_hists1D[key] = h; + } else { + TRG_MSG_WARNING("StandaloneL1TopoHistSvc::registerHist: a histogram " << key << " exists already. Will keep the first one and delete the newly requested."); + delete h; + } + } + } + + void registerHist(TH2 * h) { + if(h != nullptr) { + //cout << "JOERG registering histogram " << h->GetName() << " at " << h << endl; + h->SetDirectory(0); + TRG_MSG_DEBUG("Registering histogram " << h->GetName()); + const string key = h->GetName(); + if( m_hists2D.find(key) == end(m_hists2D) ) { + m_hists2D[key] = h; } else { TRG_MSG_WARNING("StandaloneL1TopoHistSvc::registerHist: a histogram " << key << " exists already. Will keep the first one and delete the newly requested."); delete h; @@ -42,14 +61,36 @@ public: } TH1 * findHist(const string & histName) { - auto h = m_hists.find(histName); - if( h == end(m_hists) ) { + auto colPos = histName.find_first_of('/'); + string realhistName = histName.substr(colPos+1); + auto h = m_hists1D.find(realhistName); + if( h == end(m_hists1D) ) { return nullptr; } else { return h->second; } } + void fillHist1D(const std::string & histName,double x) { + auto colPos = histName.find_first_of('/'); + string realhistName = histName.substr(colPos+1); + auto h = m_hists1D.find(realhistName); + if( h == end(m_hists1D) ) { + TRG_MSG_WARNING("No histogram founded for " << histName); + } else + h->second->Fill(x); + } + + void fillHist2D(const std::string & histName,double x,double y) { + auto colPos = histName.find_first_of('/'); + string realhistName = histName.substr(colPos+1); + auto h = m_hists2D.find(realhistName); + if( h == end(m_hists2D) ) { + TRG_MSG_WARNING("No histogram founded for " << histName); + } else + h->second->Fill(x,y); + } + void setBaseDir(const string & baseDir) { m_baseDir = baseDir; } @@ -69,7 +110,28 @@ public: TFile * f = TFile::Open(filename.c_str(),"RECREATE"); - for( auto h : m_hists ) { + for( auto h : m_hists1D ) { + + string fullName(h.second->GetName()); + string path(basepath); + + auto slashPos = fullName.find_last_of('/'); + if(slashPos != string::npos) { + if(path!="") + path += "/"; + path += fullName.substr(0,slashPos); + // set the name + h.second->SetName( fullName.substr(slashPos+1).c_str() ); + } + + const char* dir = path.c_str(); + if( ! f->GetDirectory(dir)) { + f->mkdir(dir); + } + f->cd(dir); + h.second->Write(); + } + for( auto h : m_hists2D ) { string fullName(h.second->GetName()); string path(basepath); @@ -92,12 +154,13 @@ public: } f->Write(); f->Close(); - TRG_MSG_INFO("Wrote " << m_hists.size() << " l1topo algorithm histograms to file " << filename); + TRG_MSG_INFO("Wrote " << m_hists1D.size()+m_hists2D.size() << " l1topo algorithm histograms to file " << filename); } private: - map<string,TH1*> m_hists; + map<string,TH1*> m_hists1D; + map<string,TH2*> m_hists2D; string m_baseDir {""}; }; @@ -122,12 +185,26 @@ StandaloneL1TopoHistSvc::registerHist(TH1 * h) { m_impl->registerHist(h); } +void +StandaloneL1TopoHistSvc::registerHist(TH2 * h) { + //cout << "Called StandaloneL1TopoHistSvc::registerHist(" << h->GetName() << ")" << endl; + m_impl->registerHist(h); +} + TH1 * StandaloneL1TopoHistSvc::findHist(const std::string & histName) { //cout << "Called StandaloneL1TopoHistSvc::findHist(" << histName << ")" << endl; return m_impl->findHist(histName); } +void StandaloneL1TopoHistSvc::fillHist1D(const std::string & histName, double x) { + m_impl->fillHist1D(histName,x); +} + +void StandaloneL1TopoHistSvc::fillHist2D(const std::string & histName, double x, double y) { + m_impl->fillHist2D(histName,x,y); +} + void StandaloneL1TopoHistSvc::setBaseDir(const std::string & baseDir) { m_impl->setBaseDir(baseDir); diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/ConfigurableAlg.h b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/ConfigurableAlg.h index 83f840c8bf8ab0b16422f2c2f94da18309254b6a..72ccd4f60bdcb16964efac3294cca6f52dfdad76 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/ConfigurableAlg.h +++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/ConfigurableAlg.h @@ -15,11 +15,13 @@ #include "L1TopoInterfaces/AlgFactory.h" #include "L1TopoCommon/StatusCode.h" + #include <vector> #include <string> #include <memory> class TH1; +class TH2; class IL1TopoHistSvc; namespace TCS { @@ -84,6 +86,12 @@ namespace TCS { virtual StatusCode doReset() = 0; void registerHist(TH1 *); + + void registerHist(TH2 *); + + void fillHist1D(const std::string & histName, double x); + + void fillHist2D(const std::string & histName, double x, double y); private: diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/IL1TopoHistSvc.h b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/IL1TopoHistSvc.h index 41a70676b0fce20d7df8cd7a36d4dcbe7b4a84c6..761e6f36921e14c32c340af37039ed0b16a1ca6d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/IL1TopoHistSvc.h +++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/L1TopoInterfaces/IL1TopoHistSvc.h @@ -7,14 +7,21 @@ #include <iostream> class TH1; +class TH2; class IL1TopoHistSvc { public: virtual void registerHist(TH1 * h) = 0; + virtual void registerHist(TH2 * h) = 0; + virtual TH1 * findHist(const std::string & histName) = 0; + virtual void fillHist1D(const std::string & histName, double x) = 0; + + virtual void fillHist2D(const std::string & histName, double x, double y) = 0; + virtual void setBaseDir(const std::string & baseDir) = 0; virtual void save() = 0; diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx index e6335a4a21bc17fe7a49401d72796342c38fb0d9..2e0f04b31a0c80cf86f933bc6ae6f1af909ad335 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/Root/ConfigurableAlg.cxx @@ -10,6 +10,7 @@ #include "L1TopoInterfaces/IL1TopoHistSvc.h" #include "TH1.h" +#include "TH2.h" #include <iostream> using namespace std; @@ -46,6 +47,30 @@ public: m_localHistStore.push_back(h); } } + + void registerHist(TH2 * h) { + // histograms in the L1Topo framework are put in a algorith specific folder + string newHistName = m_name + "/" + h->GetName(); + h->SetName(newHistName.c_str()); + + if( m_histSvc ) { + m_histSvc->registerHist(h); + } else { + m_localHistStore.push_back(h); + } + } + + void fillHist1D(const std::string & histName, double x) { + string newHistName = m_name + "/" + histName; + m_histSvc->fillHist1D(newHistName,x); + } + + + void fillHist2D(const std::string & histName, double x, double y) { + string newHistName = m_name + "/" + histName; + m_histSvc->fillHist2D(newHistName,x,y); + } + private: @@ -143,6 +168,18 @@ void ConfigurableAlg::registerHist(TH1 * h) { m_impl->registerHist(h); } +void ConfigurableAlg::registerHist(TH2 * h) { + m_impl->registerHist(h); +} + +void ConfigurableAlg::fillHist1D(const std::string & histName, double x) { + m_impl->fillHist1D(histName,x); +} + +void ConfigurableAlg::fillHist2D(const std::string & histName, double x, double y) { + m_impl->fillHist2D(histName,x,y); +} + namespace TCS { diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt index 8282e563ea87eb867bd7c1ca6f35b8f4ae1e92fc..aeaaecd1333f94c856d18d8cc7b8f7756c9b7d18 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt @@ -33,7 +33,7 @@ atlas_disable_as_needed() # Component(s) in the package: atlas_add_library( L1TopoSimulationLib - L1TopoSimulation/*.h + L1TopoSimulation/*.h Root/*.cxx INTERFACE PUBLIC_HEADERS L1TopoSimulation LINK_LIBRARIES GaudiKernel ) @@ -43,10 +43,15 @@ atlas_add_component( L1TopoSimulation INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib TrigInterfacesLib TrigT1CaloEventLib TrigT1CaloUtilsLib - AthenaBaseComps GaudiKernel TrigConfBase TrigConfL1Data L1TopoConfig + AthenaBaseComps GaudiKernel TrigConfBase TrigConfL1Data L1TopoConfig L1TopoSimulationLib L1TopoCoreSim L1TopoEvent L1TopoInterfaces L1TopoAlgorithms TrigT1Interfaces TrigT1Result TrigConfInterfaces ) +atlas_add_component( L1TopoSimulationTest + src/test/*.h src/test/*.cxx src/test/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel L1TopoCoreSim L1TopoEvent L1TopoInterfaces L1TopoAlgorithms L1TopoSimulationLib) + # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/AthenaL1TopoHistSvc.h similarity index 75% rename from Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.h rename to Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/AthenaL1TopoHistSvc.h index fcae989360d090d8da8fc443314d440f9afc31a6..8c096f9899dc8724a376462dc146275649683af5 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/AthenaL1TopoHistSvc.h @@ -9,6 +9,8 @@ #include "L1TopoInterfaces/IL1TopoHistSvc.h" #include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/LockedHandle.h" + #include <memory> class AthenaL1TopoHistSvc : public IL1TopoHistSvc { @@ -18,8 +20,14 @@ public: virtual void registerHist(TH1 * h) override; + virtual void registerHist(TH2 * h) override; + virtual TH1 * findHist(const std::string & histName) override; + virtual void fillHist1D(const std::string & histName, double x) override; + + virtual void fillHist2D(const std::string & histName, double x, double y) override; + virtual void setBaseDir(const std::string & baseDir) override; virtual void save() override; diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/Root/AthenaL1TopoHistSvc.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/Root/AthenaL1TopoHistSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07c10a12ddd05d3733ccf7b9a1cd5f18e2808423 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/Root/AthenaL1TopoHistSvc.cxx @@ -0,0 +1,150 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "L1TopoSimulation/AthenaL1TopoHistSvc.h" +#include "TH1.h" +#include "TH2.h" + +#include "TrigConfBase/TrigConfMessaging.h" + +#include <iostream> +using namespace std; + + +class AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl : public TrigConf::TrigConfMessaging +{ +public: + + AthenaL1TopoHistSvcImpl(ServiceHandle<ITHistSvc> histSvc) : + TrigConfMessaging("AthenaL1TopoHistSvc"), + m_histSvc(histSvc) + { + TRG_MSG_INFO("Activating"); + } + + ~AthenaL1TopoHistSvcImpl() + {} + + + void registerHist(TH1 * h) { + TRG_MSG_DEBUG("Registration of " << h->GetName() ); + if(m_histSvc) { + string fullName( m_baseDir + h->GetName() ); + auto colPos = fullName.find_last_of('/'); + string histName = fullName.substr(colPos+1); + h->SetName(histName.c_str()); + std::unique_ptr<TH1> uhist(h); + LockedHandle<TH1> lh; + if( ! m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) { + TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() ); + } + } else { + TRG_MSG_WARNING("No THistSvc available, can't register histogram"); + } + } + + void registerHist(TH2 * h) { + TRG_MSG_DEBUG("Registration of " << h->GetName() ); + if(m_histSvc) { + string fullName( m_baseDir + h->GetName() ); + auto colPos = fullName.find_last_of('/'); + string histName = fullName.substr(colPos+1); + h->SetName(histName.c_str()); + std::unique_ptr<TH2> uhist(h); + LockedHandle<TH2> lh; + if( ! m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) { + TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() ); + } + } else { + TRG_MSG_WARNING("No THistSvc available, can't register histogram"); + } + } + + TH1 * findHist(const std::string & histName) { + TH1 * h; + string fullName( m_baseDir + histName ); + if ( ! m_histSvc->getHist(fullName, h).isSuccess() ) + { TRG_MSG_WARNING("Could not find histogram with name : " << fullName ); } + else + { TRG_MSG_DEBUG("findHist(" << histName << ") found: " << (void*)h); } + return h; + } + + void fillHist1D(const std::string & histName,double x) { + LockedHandle<TH1> lh; + string fullName( m_baseDir + histName ); + if( ! m_histSvc->getShared(fullName, lh).isSuccess()) + { TRG_MSG_WARNING("No histogram found for " << fullName); } + else + { lh->Fill(x); } + } + + void fillHist2D(const std::string & histName,double x,double y) { + LockedHandle<TH2> lh; + string fullName( m_baseDir + histName ); + if( ! m_histSvc->getShared(fullName, lh).isSuccess()) + { TRG_MSG_WARNING("No histogram found for " << fullName); } + else + { lh->Fill(x,y); } + } + + void setBaseDir(const std::string & baseDir) { + auto colPos = baseDir.find_last_of(':'); + if( colPos != string::npos ) { + m_baseDir = baseDir.substr(colPos+1); + } else { + m_baseDir = baseDir; + } + if( '/' != m_baseDir[m_baseDir.size()-1] ) { + // add a '/' at the end + m_baseDir += "/"; + } + } + +private: + ServiceHandle<ITHistSvc> m_histSvc; + string m_baseDir {""}; + +}; + + +AthenaL1TopoHistSvc::AthenaL1TopoHistSvc(ServiceHandle<ITHistSvc> histSvc) : + m_impl(new AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl(histSvc)) +{} + +AthenaL1TopoHistSvc::~AthenaL1TopoHistSvc() +{} + +void +AthenaL1TopoHistSvc::registerHist(TH1 * h) { + m_impl->registerHist(h); +} + +void +AthenaL1TopoHistSvc::registerHist(TH2 * h) { + m_impl->registerHist(h); +} + +TH1 * +AthenaL1TopoHistSvc::findHist(const std::string & histName) { + return m_impl->findHist( histName ); +} + +void AthenaL1TopoHistSvc::fillHist1D(const std::string & histName, double x) { + m_impl->fillHist1D(histName,x); +} + +void AthenaL1TopoHistSvc::fillHist2D(const std::string & histName, double x, double y) { + m_impl->fillHist2D(histName,x,y); +} + +void +AthenaL1TopoHistSvc::setBaseDir(const std::string & baseDir) { + m_impl->setBaseDir( baseDir ); +} + +void +AthenaL1TopoHistSvc::save() { + // not implemented +} diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationTestConfig.py b/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationTestConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..5743cbe64ed25cb7e9e5d614013833054ca947e5 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/python/L1TopoSimulationTestConfig.py @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from L1TopoSimulation.L1TopoSimulationTestConf import LVL1__L1TopoSimulationTest + +class L1TopoSimulationTest ( LVL1__L1TopoSimulationTest ): + + def __init__( self, name = "L1TopoSimulationTest" ): + super( L1TopoSimulationTest, self ).__init__( name ) diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py new file mode 100644 index 0000000000000000000000000000000000000000..89b71198f9de71bfc80826a848c22c3086e4dcbf --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1TopoSimulationTest.py @@ -0,0 +1,92 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +import os,psutil + +from AthenaCommon.Logging import logging +log = logging.getLogger('L1TopoSimStandAlone.py') + +from AthenaCommon.AppMgr import ServiceMgr as svcMgr, theApp + +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") + +#---------------------------------------------------------------------------------# +# MT-specific code +# Get number of processes and threads +from AthenaCommon.ConcurrencyFlags import jobproperties as jp +nThreads = jp.ConcurrencyFlags.NumThreads() +nProc = jp.ConcurrencyFlags.NumProcs() + +if nThreads >=1 : + from AthenaCommon.AlgScheduler import AlgScheduler + AlgScheduler.OutputLevel( INFO ) + AlgScheduler.ShowControlFlow( True ) + AlgScheduler.ShowDataDependencies( True ) + AlgScheduler.setDataLoaderAlg( 'SGInputLoader' ) + + # Support for the MT-MP hybrid mode + if (nProc > 0) : + + from AthenaCommon.Logging import log as msg + if (theApp.EvtMax == -1) : + msg.fatal('EvtMax must be >0 for hybrid configuration') + sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR) + + if ( theApp.EvtMax % nProc != 0 ) : + msg.warning('EvtMax[%s] is not divisible by nProcs[%s]: MP Workers will not process all requested events',theApp.EvtMax,nProc) + + chunkSize = int (theApp.EvtMax / nProc) + + from AthenaMP.AthenaMPFlags import jobproperties as jps + jps.AthenaMPFlags.ChunkSize= chunkSize + + msg.info('AthenaMP workers will process %s events each',chunkSize) + + ## force loading of data. make sure this alg is at the front of the + ## AlgSequence + # + from SGComps.SGCompsConf import SGInputLoader + topSequence+=SGInputLoader(OutputLevel=DEBUG, ShowEventDump=False) + + + # ThreadPoolService thread local initialization + from GaudiHive.GaudiHiveConf import ThreadPoolSvc + svcMgr += ThreadPoolSvc("ThreadPoolSvc") + svcMgr.ThreadPoolSvc.ThreadInitTools = ["ThreadInitTool"] + +# MT-specific code +#---------------------------------------------------------------------------------# + +from L1TopoSimulation.L1TopoSimulationTestConfig import L1TopoSimulationTest + +topSequence += L1TopoSimulationTest() +topSequence.L1TopoSimulationTest.InputASCIIFile = 'eventdump_new.txt' +topSequence.L1TopoSimulationTest.InputXMLFile = 'L1Topoconfig_MC_pp_v8_recent.xml' + + +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() +svcMgr.THistSvc.Output += ["EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'"] + +#---------------------------------------------------------------------------------# +# MT-specific code + +# set algCardinality = 1 to disable cloning for all Algs +algCardinality = nThreads + +# Cloning can be disable for any alg + +if (algCardinality > 1): + for alg in topSequence: + name = alg.name() + if name in ["SGInputLoader"] : + # suppress INFO message about Alg unclonability + # set alg.Cardinality = 1 to disable cloning for specific Alg + alg.Cardinality = nThreads + else: + alg.Cardinality = algCardinality + +# MT-specific code +#---------------------------------------------------------------------------------# diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx deleted file mode 100644 index 3225413492be6a6424e3f57491e56b9b1288073b..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/AthenaL1TopoHistSvc.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "AthenaL1TopoHistSvc.h" -#include "TH1.h" - -#include "TrigConfBase/TrigConfMessaging.h" - -#include <iostream> -using namespace std; - - -class AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl : public TrigConf::TrigConfMessaging -{ -public: - - AthenaL1TopoHistSvcImpl(ServiceHandle<ITHistSvc> histSvc) : - TrigConfMessaging("AthenaL1TopoHistSvc"), - m_histSvc(histSvc) - { - TRG_MSG_INFO("Activating"); - } - - ~AthenaL1TopoHistSvcImpl() - {} - - void registerHist(TH1 * h) { - TRG_MSG_DEBUG("Registration of " << h->GetName() ); - if(m_histSvc) { - string fullName( m_baseDir + h->GetName() ); - auto colPos = fullName.find_last_of('/'); - string histName = fullName.substr(colPos+1); - h->SetName(histName.c_str()); - if( ! m_histSvc->regHist(fullName, h).isSuccess() ) { - TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() ); - } - } else { - TRG_MSG_WARNING("No THistSvc available, can't register histogram"); - } - } - - TH1 * findHist(const std::string & histName) { - TH1 * h; - string fullName( m_baseDir + histName ); - m_histSvc->getHist(fullName, h).ignore(); - TRG_MSG_DEBUG("findHist(" << histName << ") found: " << (void*)h); - return h; - } - - void setBaseDir(const std::string & baseDir) { - auto colPos = baseDir.find_last_of(':'); - if( colPos != string::npos ) { - m_baseDir = baseDir.substr(colPos+1); - } else { - m_baseDir = baseDir; - } - if( '/' != m_baseDir[m_baseDir.size()-1] ) { - // add a '/' at the end - m_baseDir += "/"; - } - } - -private: - ServiceHandle<ITHistSvc> m_histSvc; - string m_baseDir {""}; - -}; - - -AthenaL1TopoHistSvc::AthenaL1TopoHistSvc(ServiceHandle<ITHistSvc> histSvc) : - m_impl(new AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl(histSvc)) -{} - -AthenaL1TopoHistSvc::~AthenaL1TopoHistSvc() -{} - -void -AthenaL1TopoHistSvc::registerHist(TH1 * h) { - m_impl->registerHist(h); -} - - -TH1 * -AthenaL1TopoHistSvc::findHist(const std::string & histName) { - return m_impl->findHist( histName ); -} - - -void -AthenaL1TopoHistSvc::setBaseDir(const std::string & baseDir) { - m_impl->setBaseDir( baseDir ); -} - -void -AthenaL1TopoHistSvc::save() { - // not implemented -} diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx index f41904b66e48df74ff8989eac352c181ef0825ee..a688375890cfee7534f47665334316aaba3b864b 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx @@ -3,7 +3,7 @@ */ #include "./L1TopoSimulation.h" -#include "./AthenaL1TopoHistSvc.h" +#include "L1TopoSimulation/AthenaL1TopoHistSvc.h" //#include "./getAthenaTopoHistSvc.h" #include "TH1F.h" diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx index 64948f45ab94962c67dbc164e81dc49a9475850b..9c274c86e7701c9fcfb4c216338855302198d3dc 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx @@ -13,4 +13,3 @@ DECLARE_COMPONENT( LVL1::EMTauInputProvider ) DECLARE_COMPONENT( LVL1::JetInputProvider ) DECLARE_COMPONENT( LVL1::EnergyInputProvider ) DECLARE_COMPONENT( LVL1::MuonInputProvider ) - diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e3490e761e9cd96114d8f4ce2579a7cbcc3f9776 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.cxx @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "./L1TopoSimulationTest.h" +#include "L1TopoSimulation/AthenaL1TopoHistSvc.h" + +#include "L1TopoCoreSim/TopoSteering.h" +#include "L1TopoConfig/L1TopoMenu.h" +#include "L1TopoEvent/TopoInputEvent.h" +#include "L1TopoConfig/L1TopoXMLParser.h" +#include "L1TopoInterfaces/IL1TopoHistSvc.h" + +#include "GaudiKernel/ITHistSvc.h" + + +using namespace std; + + +LVL1::L1TopoSimulationTest::L1TopoSimulationTest(const std::string &name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator), + m_OffhistSvc( "THistSvc/THistSvc", name), + m_OfftopoSteering( unique_ptr<TCS::TopoSteering>(new TCS::TopoSteering()) ) +{ + declareProperty( "InputXMLFile", m_OffinputXMLFile, "File name for menu XML"); + declareProperty( "InputASCIIFile", m_OffinputASCIIFile, "File name for ASCII TOB vector"); + declareProperty( "HistSvc", m_OffhistSvc, "Histogramming service for L1Topo algorithms"); + declareProperty( "MonHistBaseDir", m_OffhistBaseDir = "L1TopoAlgorithms", "Base directory for monitoring histograms will be /EXPERT/<MonHistBaseDir>" ); + declareProperty( "TopoOutputLevel", m_OfftopoOutputLevel, "OutputLevel for L1Topo algorithms" ); + declareProperty( "TopoSteeringOutputLevel", m_OfftopoSteeringOutputLevel, "OutputLevel for L1Topo steering" ); +} + + +LVL1::L1TopoSimulationTest::~L1TopoSimulationTest() +{} + + +StatusCode +LVL1::L1TopoSimulationTest::initialize() { + ATH_MSG_INFO("initialize"); + + m_OfftopoSteering->setMsgLevel( TrigConf::MSGTC::Level(m_OfftopoSteeringOutputLevel) ); + + if (m_OffinputXMLFile.empty()){ + ATH_MSG_FATAL("No L1 Topo menu from XML " << m_OffinputXMLFile); + return StatusCode::FAILURE; + } + TXC::L1TopoXMLParser XMLParser; + XMLParser.msg().setLevel( TrigConf::MSGTC::Level(m_OfftopoOutputLevel) ); + XMLParser.readConfiguration(m_OffinputXMLFile); + XMLParser.parseConfiguration(); + + m_OfftopoSteering->setupFromConfiguration(XMLParser.takeMenu()); + m_OfftopoSteering->setAlgMsgLevel( TrigConf::MSGTC::Level(m_OfftopoOutputLevel) ); + + + std::shared_ptr<IL1TopoHistSvc> topoHistSvc = std::shared_ptr<IL1TopoHistSvc>( new AthenaL1TopoHistSvc(m_OffhistSvc) ); + topoHistSvc->setBaseDir("/EXPERT/" + m_OffhistBaseDir.value()); + + + m_OfftopoSteering->setHistSvc(topoHistSvc); + + try { + m_OfftopoSteering->initializeAlgorithms(); + } + catch(exception & e) { + ATH_MSG_FATAL("Caught exception when initializing topo algorithms" << e.what() ); + return StatusCode::FAILURE; + } + + m_Offreader.setVerbosity(0); // disable print to screen + + // load ascii event file + m_Offreader.loadInput(m_OffinputASCIIFile); + m_Offreader.validateInput(); + + // instantiate input event + TCS::TopoInputEvent & inputEvent = m_OfftopoSteering->inputEvent(); + m_Offreader.setInputEvent(&inputEvent); + + return StatusCode::SUCCESS; +} + +StatusCode +LVL1::L1TopoSimulationTest::execute() { + + // reset input and internal state + m_OfftopoSteering->reset(); + + // Obtain next events in the dump txt + m_Offreader.getNextEvent(); + + // execute the toposteering + m_OfftopoSteering->executeEvent(); + + return StatusCode::SUCCESS; +} + +StatusCode +LVL1::L1TopoSimulationTest::finalize() { + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h new file mode 100644 index 0000000000000000000000000000000000000000..495332a47bafdab6de1ef64a3e964a309ac8cd90 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/L1TopoSimulationTest.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef L1Topo_LVL1_L1TopoSimulationTest_h +#define L1Topo_LVL1_L1TopoSimulationTest_h + +#include "TrigConfBase/MsgStream.h" + + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + +#include "L1TopoCoreSim/TopoASCIIReader.h" + +#include <memory> + +class ITHistSvc; + +namespace TCS { + class TopoSteering; +} + +namespace TrigConf { + class IL1TopoConfigSvc; +} + +namespace LVL1 { + + class L1TopoSimulationTest : public AthAlgorithm { + public: + L1TopoSimulationTest(const std::string &name, ISvcLocator* pSvcLocator); + ~L1TopoSimulationTest(); + + virtual StatusCode initialize() override; + + virtual StatusCode execute() override; + + virtual StatusCode finalize() override; + + + private: + + TCS::TopoASCIIReader m_Offreader; + + ServiceHandle<ITHistSvc> m_OffhistSvc; + + int m_OfftopoOutputLevel{TrigConf::MSGTC::WARNING}; // property to set the outputlevel of the topo algorithms + int m_OfftopoSteeringOutputLevel{TrigConf::MSGTC::WARNING}; // property to set the outputlevel of the topo steering + + StringProperty m_OffhistBaseDir; //! sets base dir for monitoring histograms + StringProperty m_OffinputASCIIFile { "" }; // input dump file + StringProperty m_OffinputXMLFile { "" }; // XML file can be register in case of enabling the ASCII file read for validation purposes + + std::unique_ptr<TCS::TopoSteering> m_OfftopoSteering; //!< the topo steering + + + }; + +} +#endif diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/components/L1TopoSimulationTest_entries.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/components/L1TopoSimulationTest_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..68104298d9aa1b3b589a2186ab5f41e8fc0c414a --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/test/components/L1TopoSimulationTest_entries.cxx @@ -0,0 +1,4 @@ + +#include "../L1TopoSimulationTest.h" + +DECLARE_COMPONENT( LVL1::L1TopoSimulationTest ) diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h index 7a9045dd0356e675fe83e404e56d86b90d7d5b1d..a5d34a11aeaead04ac109ca97f36bb76c2ec6444 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h @@ -1,20 +1,17 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MMLOADVARIABLES_H #define MMLOADVARIABLES_H +#include "MMT_struct.h" //for digitWrapper, hitData_key, hitData_entry, evInf_entry +#include "AthenaBaseComps/AthMsgStreamMacros.h" -//C++ language libraries #include <map> #include <vector> #include <string> -#include "MMT_struct.h" //for digitWrapper, hitData_key, hitData_entry, evInf_entry -#include "AthenaBaseComps/AthMsgStreamMacros.h" - -//forward declarations class MsgStream; class MmIdHelper; class MmDigit; @@ -27,13 +24,12 @@ namespace MuonGM { class MuonDetectorManager; } - class MMLoadVariables { public: MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetectorManager* detManager, const MmIdHelper* idhelper, MMT_Parameters *par); - ~MMLoadVariables(); + ~MMLoadVariables()=default; void getMMDigitsInfo(std::vector<digitWrapper>& entries, std::map<hitData_key,hitData_entry>& Hits_Data_Set_Time, std::map<int,evInf_entry>& Event_Info); //Import_Athena..._.m stuff @@ -162,9 +158,9 @@ namespace MuonGM { // - const MuonGM::MuonDetectorManager* m_detManager{}; //!< MuonDetectorManager - const MmIdHelper* m_MmIdHelper{}; //!< MM offline Id helper - StoreGateSvc* m_evtStore{}; + const MuonGM::MuonDetectorManager* m_detManager; //!< MuonDetectorManager + const MmIdHelper* m_MmIdHelper; //!< MM offline Id helper + StoreGateSvc* m_evtStore; MMT_Parameters* m_par{}; bool m_striphack{}; std::string getWedgeType(const MmDigitContainer *nsw_MmDigitContainer); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx index a0613dfcb3cbf9cd37ee3f3a4e21193a11a72a9e..9f8c6b7b50c6c48334c9bcfaa91ee0ebeea4bc6e 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx @@ -1,35 +1,30 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// local includes #include "TrigT1NSWSimTools/MMLoadVariables.h" + #include "TrigT1NSWSimTools/MMT_Finder.h" #include "TrigT1NSWSimTools/MMT_Fitter.h" - #include "MuonDigitContainer/MmDigitContainer.h" #include "MuonSimEvent/MicromegasHitIdHelper.h" #include "MuonSimEvent/MM_SimIdToOfflineId.h" - #include "AtlasHepMC/GenEvent.h" #include "GeneratorObjects/McEventCollection.h" #include "TrackRecord/TrackRecordCollection.h" #include "MuonSimData/MuonSimDataCollection.h" - -// //Event info includes #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" -// #include "StoreGate/StoreGateSvc.h" +#include "MuonIdHelpers/MmIdHelper.h" + #include "TVector3.h" #include <cmath> - using std::map; using std::vector; using std::string; - MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetectorManager* detManager, const MmIdHelper* idhelper, MMT_Parameters *par): m_msg("MMLoadVariables"){ m_par = par; @@ -38,9 +33,6 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec m_MmIdHelper = idhelper; } -MMLoadVariables::~MMLoadVariables() { -} - void MMLoadVariables::getMMDigitsInfo(vector<digitWrapper>& entries, map<hitData_key,hitData_entry>& Hits_Data_Set_Time, map<int,evInf_entry>& Event_Info){ //*******Following MuonPRD code to access all the variables********** @@ -237,7 +229,7 @@ MMLoadVariables::~MMLoadVariables() { MicromegasHitIdHelper* hitHelper = MicromegasHitIdHelper::GetHelper(); - MM_SimIdToOfflineId simToOffline(*m_MmIdHelper); + MM_SimIdToOfflineId simToOffline(m_MmIdHelper); for( auto it2 : *nswContainer ) { //get hit variables const MMSimHit hit = it2; fillVars.NSWMM_globalTime.push_back(hit.globalTime()); diff --git a/Trigger/TrigT1/TrigT1ResultByteStream/src/L1TriggerResultByteStreamCnv.cxx b/Trigger/TrigT1/TrigT1ResultByteStream/src/L1TriggerResultByteStreamCnv.cxx index 67f6170e9e412c7cab752a3e193a9ad377bcb647..feec29732696c6770d14627487f01541f3c1857b 100644 --- a/Trigger/TrigT1/TrigT1ResultByteStream/src/L1TriggerResultByteStreamCnv.cxx +++ b/Trigger/TrigT1/TrigT1ResultByteStream/src/L1TriggerResultByteStreamCnv.cxx @@ -30,7 +30,7 @@ L1TriggerResultByteStreamCnv::L1TriggerResultByteStreamCnv(ISvcLocator* svcLoc) Converter(storageType(), classID(), svcLoc), AthMessaging(msgSvc(), "L1TriggerResultByteStreamCnv"), m_ByteStreamEventAccess("ByteStreamCnvSvc", "L1TriggerResultByteStreamCnv"), - m_muonEncoderTool("ExampleL1TriggerByteStreamTool/ToolSvc.L1MuonBSEncoderTool") {} + m_muonEncoderTool("ExampleL1TriggerByteStreamTool/L1MuonBSEncoderTool") {} // ============================================================================= // Standard destructor diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/LVL1TGCTrigger.h b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/LVL1TGCTrigger.h index 608b07d288f7d69e771f7478818d9e023d6c69d8..65428de780f567d7f3e31d52d32848c745401e4b 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/LVL1TGCTrigger.h +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/LVL1TGCTrigger.h @@ -39,10 +39,14 @@ #include "TileEvent/TileMuContainer.h" #include "TileEvent/TileMuonReceiverObj.h" +//NSW Trigger Output +#include "MuonRDO/NSW_TrigRawDataContainer.h" + class TgcRdo; class TgcRawData; class ITGCcablingSvc; + namespace LVL1TGCTrigger { /** @@ -93,6 +97,10 @@ namespace LVL1TGCTrigger { // Fill TMDB event data StatusCode fillTMDB(); + + // Fill NSW event data + StatusCode fillNSW(); + // record bare-RDO for LowPT coincidences (on m_OutputTgcRDO=True): void recordRdoSLB(TGCSector *); @@ -132,7 +140,7 @@ namespace LVL1TGCTrigger { StringProperty m_keyMuCTPIInput_TGC{this,"MuCTPIInput_TGC","L1MuctpiStoreTGC"}; // Version of Coincidence Window - StringProperty m_VerCW{this,"VersionCW","00_07_0022"}; + StringProperty m_VerCW{this,"VersionCW","00_07_0022"};// TILE_EIFI_BW StringProperty m_MaskFileName12{this,"MaskFileName12",""}; //!< property, see @link LVL1TGCTrigger::LVL1TGCTrigger @endlink ShortProperty m_CurrentBunchTag{this,"CurrentBunchTag",TgcDigit::BC_CURRENT}; //!< property, see @link LVL1TGCTrigger::LVL1TGCTrigger @endlink @@ -146,6 +154,7 @@ namespace LVL1TGCTrigger { BooleanProperty m_INNERVETO{this,"INNERVETO",true}; // flag for using VETO by Inner Station for SL BooleanProperty m_FULLCW{this,"FULLCW",false}; // flag for using differne CW for each octant BooleanProperty m_TILEMU{this,"TILEMU",false}; // flag for using TileMu + BooleanProperty m_USENSW{this,"USENSW",false}; // flag for using NSW BooleanProperty m_useRun3Config{this,"useRun3Config",false}; // flag for using switch between Run3 and Run2 algorithms @@ -171,6 +180,7 @@ namespace LVL1TGCTrigger { SG::ReadHandleKey<TgcDigitContainer> m_keyTgcDigit{this,"InputData_perEvent","TGC_DIGITS","Location of TgcDigitContainer"}; SG::ReadHandleKey<TileMuonReceiverContainer> m_keyTileMu{this,"TileMuRcv_Input","TileMuRcvCnt","Location of TileMuonReceiverContainer"}; + SG::ReadHandleKey<Muon::NSW_TrigRawDataContainer> m_keyNSWTrigOut{this,"NSWTrigger_Input","NSWTRGRDO","Location of NSW_TrigRawDataContainer"}; SG::ReadCondHandleKey<TGCTriggerData> m_readCondKey{this,"ReadCondKey","TGCTriggerData"}; SG::WriteHandleKey<LVL1MUONIF::Lvl1MuCTPIInput> m_muctpiKey{this, "MuctpiLocationTGC", "L1MuctpiStoreTGC", "Location of muctpi for Tgc"}; SG::WriteHandleKey<LVL1MUONIF::Lvl1MuCTPIInputPhase1> m_muctpiPhase1Key{this, "MuctpiPhase1LocationTGC", "L1MuctpiStoreTGC", "Location of muctpiPhase1 for Tgc"}; diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/NSWTrigOut.h b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/NSWTrigOut.h new file mode 100644 index 0000000000000000000000000000000000000000..dd34ccfee9215256596737c3c2a59ea853ea0f38 --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/NSWTrigOut.h @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ==================================================================== +/* + NSWTrigOut.h +*/ +// ==================================================================== +#ifndef NSW_TRIGOUT_H +#define NSW_TRIGOUT_H + +#include "AthenaKernel/MsgStreamMember.h" + +#include <vector> + +namespace LVL1TGCTrigger { + + class TGCArguments; + +// ==================================================================== +// +// class definition +// +// ==================================================================== + +class NSWTrigOut { +protected: + int m_sideID; // 0:A-side 1:C-side + std::vector<int> m_NSWTriggerProcessor; // 0 ~ 15 + std::vector<int> m_NSWeta_8bit; // 0.005 + std::vector<int> m_NSWphi_6bit; // 10mrad + std::vector<int> m_NSWDtheta_5bit; // 1mrad + +public: + NSWTrigOut(); + NSWTrigOut(int side, std::vector<int> NSWTrigger, std::vector<int> NSWeta, std::vector<int> NSWphi, std::vector<int> NSWDtheta,TGCArguments* tgcargs=0); + NSWTrigOut(int side, std::vector<int> NSWTrigger,TGCArguments* tgcargs=0); + + virtual ~NSWTrigOut() { } + + NSWTrigOut(const NSWTrigOut& right); + + const NSWTrigOut& operator=(const NSWTrigOut& right); + NSWTrigOut& operator+(const NSWTrigOut& right); + NSWTrigOut& operator+=(const NSWTrigOut& right); + bool operator==(const NSWTrigOut& right) const + { + return (this==&right); + } + + bool operator!=(const NSWTrigOut& right) const + { + return (this!=&right); + } + + + + // set functons + void setSide(int side){ m_sideID = side; } + void setNSWTriggerProcessor(int NSWTP){ m_NSWTriggerProcessor.push_back(NSWTP); } + void setEta(int NSWeta){ m_NSWeta_8bit.push_back(NSWeta); } + void setPhi(int NSWphi){ m_NSWphi_6bit.push_back(NSWphi); } + void setDtheta(int NSWDtheta){ m_NSWDtheta_5bit.push_back(NSWDtheta); } + void clear() { m_sideID=-1;m_NSWTriggerProcessor.clear(); m_NSWeta_8bit.clear(); m_NSWphi_6bit.clear(); m_NSWDtheta_5bit.clear();} + + // get functions + int getSide() const { return m_sideID; } + const std::vector<int>& getNSWTriggerProcessor() const {return m_NSWTriggerProcessor; } + const std::vector<int>& getNSWeta() const {return m_NSWeta_8bit; } + const std::vector<int>& getNSWphi() const {return m_NSWphi_6bit; } + const std::vector<int>& getNSWDtheta() const {return m_NSWDtheta_5bit; } + + // print methods + const MSG::Level defaultMSGLvl = MSG::INFO; + bool msgLvl(const MSG::Level lvl) const; + MsgStream& msg(const MSG::Level lvl) const; + void print() const; + + + private: + TGCArguments* m_tgcArgs; + mutable Athena::MsgStreamMember m_msg; + + +}; + +inline bool NSWTrigOut::msgLvl(const MSG::Level lvl) const +{ + return (m_msg.get().level() <= lvl) ? true : false; +} +inline MsgStream& NSWTrigOut::msg(const MSG::Level lvl) const{ return m_msg << lvl; } + +} //end of namespace bracket + +#endif diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCArguments.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCArguments.hh index 38f785bbafce5365e6088e8b84423ce8e4ace490..f88cbd4cfd97eb7525ae1f3ea6d4301a3d634493 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCArguments.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCArguments.hh @@ -21,6 +21,7 @@ class TGCArguments void set_TILE_MU(bool v); void set_USE_CONDDB(bool v); void set_useRun3Config(bool v); + void set_USE_NSW(bool v); MSG::Level MSGLEVEL() const; bool SHPT_ORED() const; @@ -29,6 +30,8 @@ class TGCArguments bool TILE_MU() const; bool USE_CONDDB() const; bool useRun3Config() const; + bool USE_NSW() const; + private: MSG::Level m_MSGLEVEL; @@ -38,6 +41,10 @@ class TGCArguments bool m_TILE_MU; bool m_USE_CONDDB; bool m_useRun3Config; + bool m_USE_NSW; + + + }; } // namespace LVL1TGCTrigger diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCDatabaseManager.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCDatabaseManager.hh index 034d3073ff9545283b2b7db382324dd893f1113c..99421858d1074f815ad4ad91228d7402a9eacc73 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCDatabaseManager.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCDatabaseManager.hh @@ -29,6 +29,7 @@ class TGCConnectionPPToSL; class TGCRPhiCoincidenceMap; class TGCEIFICoincidenceMap; class TGCTileMuCoincidenceMap; +class TGCNSWCoincidenceMap; class TGCDatabaseManager { @@ -50,6 +51,7 @@ class TGCDatabaseManager TGCRPhiCoincidenceMap* getRPhiCoincidenceMap(int sideId, int octantId) const; TGCEIFICoincidenceMap* getEIFICoincidenceMap(int sideId) const; TGCTileMuCoincidenceMap* getTileMuCoincidenceMap() const; + std::shared_ptr<TGCNSWCoincidenceMap> getNSWCoincidenceMap(int sideId, int octantId, int moduleId) const; TGCConnectionInPP* getConnectionInPP(TGCPatchPanel* patchPanel) const; void addConnectionInPP(const TGCPatchPanel* patchPanel, const TGCConnectionInPP* connectionInPP); @@ -71,9 +73,12 @@ class TGCDatabaseManager void setMessageLevel(const MSG::Level lvl) const; private: + enum {NumberOfModuleInBW=9}; + TGCRPhiCoincidenceMap* m_mapRphi[NumberOfSide][NumberOfOctant]; TGCEIFICoincidenceMap* m_mapEIFI[NumberOfSide]; TGCTileMuCoincidenceMap* m_mapTileMu; + std::array<std::array<std::array<std::shared_ptr<TGCNSWCoincidenceMap>, NumberOfModuleInBW>, NumberOfOctant>, NumberOfSide> m_mapNSW; TGCConnectionPPToSL* m_PPToSL[NumberOfRegionType]; TGCConnectionASDToPP* m_ASDToPP[NumberOfRegionType][NumberOfPatchPanelType][TotalNumForwardBackwardType]; @@ -108,6 +113,12 @@ TGCTileMuCoincidenceMap* TGCDatabaseManager::getTileMuCoincidenceMap() const return m_mapTileMu; } +inline +std::shared_ptr<TGCNSWCoincidenceMap> TGCDatabaseManager::getNSWCoincidenceMap(int sideId, int octantId, int moduleId) const +{ + return m_mapNSW[sideId][octantId][moduleId]; +} + inline TGCConnectionPPToSL* TGCDatabaseManager::getConnectionPPToSL(TGCRegionType type) const { diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCElectronicsSystem.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCElectronicsSystem.hh index 93fc3c66ba9662eb397026766bd99785315e9812..8c2a44c9baf9799bfacf55c4aab262914ddb34b7 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCElectronicsSystem.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCElectronicsSystem.hh @@ -22,6 +22,7 @@ class TGCEvent; class TGCDatabaseManager; class TGCSector; class TGCTMDB; +class TGCNSW; class TGCElectronicsSystem { public: @@ -40,6 +41,7 @@ public: return m_sector[side][oct][mod]; }; TGCTMDB* getTMDB() const {return m_tmdb;} + std::shared_ptr<TGCNSW> getNSW() const {return m_nsw;} TGCElectronicsSystem(TGCArguments*, TGCDatabaseManager* database, bool isAtlas=true); ~TGCElectronicsSystem(); @@ -56,6 +58,8 @@ private: TGCDatabaseManager* m_DB; TGCSector* m_sector[NumberOfSide][NumberOfOctant][NumberOfModule]; TGCTMDB* m_tmdb; + std::shared_ptr<TGCNSW> m_nsw; + TGCArguments* m_tgcArgs; }; diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSW.h b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSW.h new file mode 100644 index 0000000000000000000000000000000000000000..c8d4f6c311230d41150ea2c8049ad199bc727ca9 --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSW.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ==================================================================== +/* + TGCNSW.h +*/ +// ==================================================================== +#ifndef TGC_NSW_H +#define TGC_NSW_H + +#include <vector> +#include <memory> + +#include "TrigT1TGC/TGCNumbering.hh" + +namespace LVL1TGCTrigger { + +class NSWTrigOut; + +// ==================================================================== +// +// class definition +// +// ==================================================================== + +class TGCNSW{ +public: + TGCNSW(); + virtual ~TGCNSW(); + + TGCNSW(const TGCNSW& right); + const TGCNSW& operator=(const TGCNSW& right); + bool operator==(const TGCNSW& right) const + { return (this==&right); } + bool operator!=(const TGCNSW& right) const + { return (this!=&right); } + + enum { NumberOfNSWTriggerProcesser = 16 }; + + std::shared_ptr<const NSWTrigOut> getOutput(TGCRegionType region ,int side, int TGC_TriggerSector) const; + void setOutput(int side, int NSWTriggerProcesser,int NSWeta_8bit,int NSWphi_6bit,int NSWDtheta_5bit); //eta:0.005 phi:10mrad Dtheta:1mrad + void eraseOutput(); + int getNumberOfNSWTriggerProcesser() const { return NumberOfNSWTriggerProcesser; }; + + void print() const; + enum { Aside=0 , Cside=1 }; + protected: + std::shared_ptr<NSWTrigOut> m_buffer[2][NumberOfNSWTriggerProcesser];//buffer[Aside or Cside][NSW Trigger Processor] + +}; + + +} //end of namespace bracket + +#endif diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSWCoincidenceMap.h b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSWCoincidenceMap.h new file mode 100644 index 0000000000000000000000000000000000000000..252ee0d8b3f884071b23cae774edb5e0b9e12955 --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCNSWCoincidenceMap.h @@ -0,0 +1,87 @@ +#ifndef TGCNSWCoincidenceMap_h +#define TGCNSWCoincidenceMap_h + +#include <vector> +#include <map> +#include <string> + +#include "GaudiKernel/ToolHandle.h" +#include "TrigT1TGC/TGCNumbering.hh" + +#include "AthenaKernel/MsgStreamMember.h" +#include "GaudiKernel/MsgStream.h" + +class ITGCTriggerDbTool; + +namespace LVL1TGCTrigger { + +class NSWTrigOut; +class TGCArguments; + +class TGCNSWCoincidenceMap { + +private: + TGCNSWCoincidenceMap();// hide default constructor + enum {N_dEta=64,N_dPhi=16,N_Dtheta=32,N_PT_THRESH=15};//6bit eta,4bit phi,5bit Dtheta, 4bit pT + enum ReadCW_Type{EtaPhi_CW=0,EtaDtheta_CW}; + std::map<TGCRegionType,int> m_NumberOfEtaRaw={{ENDCAP,37},{FORWARD,16}}; + std::map<TGCRegionType,int> m_NumberOfRoI={{ENDCAP,148},{FORWARD,64}}; + +public: + + + TGCNSWCoincidenceMap(TGCArguments* tgcargs,const std::string& version,int side,int oct,int mod); + ~TGCNSWCoincidenceMap(); + + bool isForward( int module ); + + int TGCNSW_pTcalcu_EtaPhi(const NSWTrigOut *nswOut, int RoI) const; + int TGCNSW_pTcalcu_EtaDtheta(const NSWTrigOut *nswOut, int RoI) const; + + const std::string& getVersion() const; + int getSideId() const; + int getOctantId() const; + + + // copy and assignment operator + TGCNSWCoincidenceMap(const TGCNSWCoincidenceMap& right); + bool readMap(std::string moduleName, ReadCW_Type cw_type); + bool readShift(); + TGCArguments* tgcArgs() const { return m_tgcArgs;} + +private: + std::vector<short int> m_EtaPhi_CW[N_dEta][N_dPhi]; + std::vector<short int> m_EtaDtheta_CW[N_dEta][N_Dtheta]; + std::vector<short int> m_Offset_Eta; + std::vector<short int> m_Offset_Phi; + + + std::string m_verName; + int m_side; + int m_octant; + int m_module; + int m_sector; + TGCRegionType m_region; + bool m_fullCW; + + + + ToolHandle<ITGCTriggerDbTool> m_condDbTool; + TGCArguments* m_tgcArgs; + + //Declaring private message stream member. + Athena::MsgStreamMember m_msg; + + + +}; + + + + + +} //end of namespace bracket + +#endif // TGCNSWCoincidenceMap_hh + + diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCRPhiCoincidenceOut.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCRPhiCoincidenceOut.hh index 54f679226435da4e6ea0de55d38acaa351ac208a..437f58edc8d4ada6a4e4c0274f4b8c0ebfd377db 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCRPhiCoincidenceOut.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCRPhiCoincidenceOut.hh @@ -32,6 +32,7 @@ public: void setHit(int ptIn){ m_hit[ptIn]=true;}; void clearHit(int ptIn) { m_hit[ptIn] = false;}; int getPtLevel() const; // for Run2 Algo + int getRoI() const{ return m_RoI; } void setIdSSC(int idSSCIn){ m_idSSC = idSSCIn;}; void setpT(int pTIn){ m_pT=pTIn;}; diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSector.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSector.hh index 24585fd19e41b140c4b12b429f46c862ea67699c..233b38f3186c99c847d92c16a1c13f23dc15365d 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSector.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSector.hh @@ -30,7 +30,7 @@ #include "TrigT1TGC/TGCSectorLogic.hh" #include "TrigT1TGC/TGCTMDB.h" - +#include "TrigT1TGC/TGCNSW.h" namespace LVL1TGCTrigger { @@ -44,7 +44,9 @@ public: TGCRegionType type, TGCForwardBackwardType forwardBackward, const TGCDatabaseManager* db, - const TGCTMDB* tmdb); + const TGCTMDB* tmdb, + std::shared_ptr<const TGCNSW> nsw + ); TGCSector(TGCArguments*); @@ -81,6 +83,7 @@ public: private: const TGCTMDB* getTMDB() const { return m_TMDB; } + std::shared_ptr<const TGCNSW> getNSW() const{ return m_NSW; } int getPatchPanelType(TGCSignalType signal, int layer) const; @@ -89,6 +92,7 @@ private: void setRPhiMap(const TGCRPhiCoincidenceMap* map, const TGCEIFICoincidenceMap* mapI=0); void setTileMuMap(const TGCTileMuCoincidenceMap* map); + void setNSWMap(std::shared_ptr<const TGCNSWCoincidenceMap> mapNSW); void connectPPToSB(const TGCConnectionPPToSB* connection); void connectSBToHPB(const TGCConnectionSBToHPB* connection); void connectHPBToSL(const TGCConnectionHPBToSL* connection); @@ -122,6 +126,7 @@ private: TGCSectorLogic* m_SL; const TGCTMDB* m_TMDB; + std::shared_ptr<const TGCNSW> m_NSW; TGCArguments* m_tgcArgs; diff --git a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSectorLogic.hh b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSectorLogic.hh index 8798dc5eb22b4cfe8c4976abc1acd1e20aa0d0c4..8de4d435ca4dc6570545e3d9690337eb64668e1b 100644 --- a/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSectorLogic.hh +++ b/Trigger/TrigT1/TrigT1TGC/TrigT1TGC/TGCSectorLogic.hh @@ -36,6 +36,8 @@ const int MaxNumberOfWireHighPtBoard = 2; class TGCHighPtBoard; class TGCHighPtChipOut; class TGCTMDB; +class TGCNSW; +class TGCNSWCoincidenceMap; //for Run3 class TGCTrackSelectorOut; @@ -74,6 +76,8 @@ public: void setEIFIMap(const TGCEIFICoincidenceMap* mapI); void setTileMuMap(const TGCTMDB* tmdb, const TGCTileMuCoincidenceMap* mapTM); + void setNSWMap(std::shared_ptr<const TGCNSW> nsw, + std::shared_ptr<const TGCNSWCoincidenceMap> mapNSW); void showResult(TGCSLSelectorOut* out); TGCSectorLogic(TGCArguments*, TGCRegionType regionIn, int id); @@ -97,6 +101,10 @@ protected: void doInnerCoincidence(const SG::ReadCondHandleKey<TGCTriggerData> readCondKey, int SSCId, TGCRPhiCoincidenceOut* coincidenceOut); + void doInnerCoincidenceRun3(int SSCId, TGCRPhiCoincidenceOut* coincidenceOut); + + void doTGCNSWCoincidence(TGCRPhiCoincidenceOut* coincidenceOut); + private: TGCSectorLogic& operator=(const TGCSectorLogic& right); @@ -115,6 +123,8 @@ private: const TGCEIFICoincidenceMap* m_mapEIFI; const TGCTileMuCoincidenceMap* m_mapTileMu; const TGCTMDB* m_pTMDB; + std::shared_ptr<const TGCNSW> m_nsw; + std::shared_ptr<const TGCNSWCoincidenceMap> m_mapNSW; // for Run2 TGCSLPreSelector m_preSelector; diff --git a/Trigger/TrigT1/TrigT1TGC/src/LVL1TGCTrigger.cxx b/Trigger/TrigT1/TrigT1TGC/src/LVL1TGCTrigger.cxx index 79fbe80d78253de62e7174d78f373115619a25f3..8f9325a9968d8d3f041376e87c09e16edc6a5bf3 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/LVL1TGCTrigger.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/LVL1TGCTrigger.cxx @@ -22,6 +22,7 @@ #include "TrigT1TGC/TrigT1TGC_ClassDEF.h" #include "TrigT1TGC/TGCNumbering.hh" #include "TrigT1TGC/TGCTMDBOut.h" +#include "TrigT1TGC/TGCNSW.h" // Athena/Gaudi #include "StoreGate/StoreGate.h" @@ -42,6 +43,10 @@ #include "MuonDigitContainer/TgcDigit.h" #include "MuonRDO/TgcRdoContainer.h" + +#include "MuonRDO/NSW_TrigRawData.h" +#include "MuonRDO/NSW_TrigRawDataContainer.h" + #include "TGCcablingInterface/ITGCcablingSvc.h" #include "TGCcablingInterface/ITGCcablingServerSvc.h" #include "PathResolver/PathResolver.h" @@ -94,6 +99,8 @@ namespace LVL1TGCTrigger { m_tgcArgs.set_USE_INNER( m_USEINNER.value() ); m_tgcArgs.set_INNER_VETO( m_INNERVETO.value() && m_tgcArgs.USE_INNER() ); m_tgcArgs.set_TILE_MU( m_TILEMU.value() && m_tgcArgs.USE_INNER() ); + m_tgcArgs.set_USE_NSW( m_USENSW.value() && m_tgcArgs.USE_INNER() ); + m_tgcArgs.set_USE_CONDDB( m_USE_CONDDB.value() ); m_tgcArgs.set_useRun3Config( m_useRun3Config.value() ); @@ -109,6 +116,7 @@ namespace LVL1TGCTrigger { // read and write handle key ATH_CHECK(m_keyTgcDigit.initialize()); ATH_CHECK(m_keyTileMu.initialize()); + ATH_CHECK(m_keyNSWTrigOut.initialize()); ATH_CHECK(m_muctpiPhase1Key.initialize(tgcArgs()->useRun3Config())); ATH_CHECK(m_muctpiKey.initialize(!tgcArgs()->useRun3Config())); @@ -162,6 +170,11 @@ namespace LVL1TGCTrigger { const TGCTriggerData* readCdo{*readHandle}; doTileMu = readCdo->isActive(TGCTriggerData::CW_TILE); } + + + // NSW data + bool doNSW = m_tgcArgs.USE_NSW(); + // TgcRdo m_tgcrdo.clear(); @@ -212,7 +225,13 @@ namespace LVL1TGCTrigger { return sc; } } - + + // Use NSW trigger output + if(doNSW && bc==m_CurrentBunchTag){ + ATH_CHECK(fillNSW()); + } + + if (m_ProcessAllBunches || bc==m_CurrentBunchTag){ m_bctagInProcess =bc; sc=processOneBunch(tgc_container, muctpiinput, muctpiinputPhase1); @@ -1363,5 +1382,43 @@ namespace LVL1TGCTrigger { } + + //----------------------------------- + //NSW input + //---------------------------------- + StatusCode LVL1TGCTrigger::fillNSW(){ + ATH_MSG_DEBUG("fillNSW"); + StatusCode sc = StatusCode::SUCCESS; + std::shared_ptr<TGCNSW> nsw = m_system->getNSW(); + nsw->eraseOutput(); + + //The following part will be available when NSW Trigger Output is available. + + /* + SG::ReadHandle<Muon::NSW_TrigRawDataContainer> readNSW_TrigRawDataContainer(m_keyNSWTrigOut); + if(!readNSW_TrigRawDataContainer.isValid()){ + ATH_MSG_ERROR("Cannot retrieve NSW TrigRawData Container."); + return StatusCode::FAILURE; + } + const Muon::NSW_TrigRawDataContainer* nsw_TrigRawDataContainer = readNSW_TrigRawDataContainer.cptr(); + for(const Muon::NSW_TrigRawData* nsw_sector : *nsw_TrigRawDataContainer){ + for(const Muon::NSW_TrigRawDataSegment* nsw_trk : *nsw_sector){ + nsw->setOutput(nsw_sector->sideId(), // side + //nsw_sector->sectorId(), // Sector number in NSW + //nsw_trk->rIndex(), // R-index + //nsw_trk->phiIndex(), // Phi-index + //nsw_trk->deltaTheta() // Delta theta index + ); + } + } + */ + + + if(sc.isFailure()){ + ATH_MSG_WARNING("Couldn't retrieve NSW trigger output"); + } + return sc; + } + } //end of namespace bracket diff --git a/Trigger/TrigT1/TrigT1TGC/src/NSWTrigOut.cxx b/Trigger/TrigT1/TrigT1TGC/src/NSWTrigOut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..601b23d636a0ac83555b34297d8acbb2cbfda6a8 --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/src/NSWTrigOut.cxx @@ -0,0 +1,124 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ==================================================================== +/* + NSWTrigOut.cc +*/ +// ==================================================================== + +#include "TrigT1TGC/NSWTrigOut.h" + +#include "TrigT1TGC/TGCArguments.hh" +#include "AthenaBaseComps/AthMsgStreamMacros.h" + +namespace LVL1TGCTrigger { + +// ==================================================================== +// +// class description +// +// ==================================================================== + +////////////////////// +NSWTrigOut::NSWTrigOut() + : m_sideID(-1), m_NSWTriggerProcessor(0), m_NSWeta_8bit(0), m_NSWphi_6bit(0), m_NSWDtheta_5bit(0), m_tgcArgs(0) +////////////////////// +{ +} + +/////////////////////////////////////////////////////////////// + NSWTrigOut::NSWTrigOut(int side, std::vector<int> NSWTP, std::vector<int> NSWeta,std::vector<int> NSWphi, std::vector<int> NSWDtheta,TGCArguments* tgcargs) + : m_sideID(side), m_NSWTriggerProcessor(NSWTP), m_NSWeta_8bit(NSWeta), m_NSWphi_6bit(NSWphi), m_NSWDtheta_5bit(NSWDtheta),m_tgcArgs(tgcargs) +/////////////////////////////////////////////////////////////// +{ + m_msg = Athena::MsgStreamMember("LVL1TGC::NSWTrigOut"); + if(m_tgcArgs){ + m_msg.get().setLevel(m_tgcArgs->MSGLEVEL()); + } + else{ + m_msg.get().setLevel(defaultMSGLvl); + } +} + NSWTrigOut::NSWTrigOut(int side, std::vector<int> NSWTP,TGCArguments* tgcargs) + : m_sideID(side), m_NSWTriggerProcessor(NSWTP), m_NSWeta_8bit(0), m_NSWphi_6bit(0), m_NSWDtheta_5bit(0),m_tgcArgs(tgcargs) +/////////////////////////////////////////////////////////////// +{ + m_msg = Athena::MsgStreamMember("LVL1TGC::NSWTrigOut"); + if(m_tgcArgs){ + m_msg.get().setLevel(m_tgcArgs->MSGLEVEL()); + } + else{ + m_msg.get().setLevel(defaultMSGLvl); + } +} + +/////////////////////////////////////////////////////////////// +NSWTrigOut::NSWTrigOut(const NSWTrigOut& right) +///////////////////////////////////////////////////////////// + :m_sideID(right.m_sideID), + m_NSWTriggerProcessor(right.m_NSWTriggerProcessor), + m_NSWeta_8bit(right.m_NSWeta_8bit), + m_NSWphi_6bit(right.m_NSWphi_6bit), + m_NSWDtheta_5bit(right.m_NSWDtheta_5bit), + m_tgcArgs(right.m_tgcArgs) +{ + m_msg = Athena::MsgStreamMember("LVL1TGC::NSWTrigOut"); + if(m_tgcArgs){ + m_msg.get().setLevel(m_tgcArgs->MSGLEVEL()); + } + else{ + m_msg.get().setLevel(defaultMSGLvl); + } +} + + +///////////////////////////////////////////////////////////// +const NSWTrigOut& NSWTrigOut::operator=(const NSWTrigOut& right) +///////////////////////////////////////////////////////////// +{ + if (this != &right) { + m_sideID = right.m_sideID; + m_NSWTriggerProcessor = right.m_NSWTriggerProcessor; + m_NSWeta_8bit = right.m_NSWeta_8bit; + m_NSWphi_6bit = right.m_NSWphi_6bit; + m_NSWDtheta_5bit = right.m_NSWDtheta_5bit; + m_tgcArgs = right.m_tgcArgs; + } + return *this; +} + +/////////////////////////////////////////////////////////// +NSWTrigOut& NSWTrigOut::operator+=(const NSWTrigOut& right) +/////////////////////////////////////////////////////////// +{ + if (this != &right && (m_sideID==right.m_sideID || m_sideID==-1)) { + m_NSWTriggerProcessor.insert(m_NSWTriggerProcessor.end(), right.m_NSWTriggerProcessor.begin(), right.m_NSWTriggerProcessor.end()); + m_NSWeta_8bit.insert(m_NSWeta_8bit.end(), right.m_NSWeta_8bit.begin(), right.m_NSWeta_8bit.end()); + m_NSWphi_6bit.insert(m_NSWphi_6bit.end(), right.m_NSWphi_6bit.begin(), right.m_NSWphi_6bit.end()); + m_NSWDtheta_5bit.insert(m_NSWDtheta_5bit.end(), right.m_NSWDtheta_5bit.begin(), right.m_NSWDtheta_5bit.end()); + } + + return *this; + +} + +///////////////////////////// +void NSWTrigOut::print() const +///////////////////////////// +{ + for(unsigned int i=0;i!=m_NSWTriggerProcessor.size();i++){ + ATH_MSG_DEBUG("i="<<i<<"\n" + <<"Size=="<<m_NSWTriggerProcessor.size()<<"\n" + << "Side=" << m_sideID <<"\n" + << " :: ModuleID=" << m_NSWTriggerProcessor[i]<<"\n" + << " :: eta_8bit=" << m_NSWeta_8bit[i]<<"\n" + << " :: phi_6bit=" << m_NSWphi_6bit[i]<<"\n" + << " :: Dtheta_5bit=" << m_NSWDtheta_5bit[i]<<"\n"); + } + +} + + +} //end of namespace bracket diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCArguments.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCArguments.cxx index e0b770bced59fa4ebb1f60c975dd2e111763d8a4..3c7f65000fa99065af9b21dcd4cfcbd8f0a66c47 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCArguments.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCArguments.cxx @@ -13,7 +13,8 @@ TGCArguments::TGCArguments() m_INNER_VETO(false), m_TILE_MU(false), m_USE_CONDDB(false), - m_useRun3Config(false) + m_useRun3Config(false), + m_USE_NSW(false) { } @@ -28,6 +29,8 @@ TGCArguments::~TGCArguments() void TGCArguments::set_TILE_MU(bool v){ m_TILE_MU = v;} void TGCArguments::set_USE_CONDDB(bool v){ m_USE_CONDDB = v;} void TGCArguments::set_useRun3Config(bool v){ m_useRun3Config = v;} + void TGCArguments::set_USE_NSW(bool v){ m_USE_NSW = v;} + MSG::Level TGCArguments::MSGLEVEL() const {return m_MSGLEVEL;} bool TGCArguments::SHPT_ORED() const {return m_SHPT_ORED;} @@ -36,5 +39,7 @@ TGCArguments::~TGCArguments() bool TGCArguments::TILE_MU() const {return m_TILE_MU;} bool TGCArguments::USE_CONDDB() const {return m_USE_CONDDB;} bool TGCArguments::useRun3Config() const {return m_useRun3Config;} + bool TGCArguments::USE_NSW() const {return m_USE_NSW;} + } diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCDatabaseManager.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCDatabaseManager.cxx index e0f7d59c4c4b76e91fb10bf8257d96f7bb9c0c33..c19cec9976342dc2f34113609933fff484c0f8bb 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCDatabaseManager.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCDatabaseManager.cxx @@ -7,6 +7,7 @@ #include "TrigT1TGC/TGCRPhiCoincidenceMap.hh" #include "TrigT1TGC/TGCEIFICoincidenceMap.h" #include "TrigT1TGC/TGCTileMuCoincidenceMap.hh" +#include "TrigT1TGC/TGCNSWCoincidenceMap.h" #include "TrigT1TGC/TGCConnectionASDToPP.hh" #include "TrigT1TGC/TGCConnectionInPP.hh" #include "TrigT1TGC/TGCPatchPanel.hh" @@ -127,13 +128,20 @@ TGCDatabaseManager::TGCDatabaseManager(TGCArguments* tgcargs, std::string ver_BW = ver; std::string ver_EIFI = ver; std::string ver_TILE = ver; + std::string ver_NSW = ver; std::vector<std::string> vers = TGCDatabaseManager::splitCW(ver, '_'); - if (vers.size() == 3) { + if (vers.size() == 3) { // for Run2 ver_BW = "v" + vers[2]; ver_EIFI = "v" + vers[1]; ver_TILE = "v" + vers[0]; } + else if(vers.size() == 4 && tgcArgs()->useRun3Config()) { // for Run3 + ver_BW = "v" + vers[3]; + ver_EIFI = "v" + vers[2]; + ver_TILE = "v" + vers[1]; + ver_NSW = "v" + vers[0]; + } // RPhi Coincidence Map for (int side=0; side<NumberOfSide; side +=1) { @@ -151,6 +159,17 @@ TGCDatabaseManager::TGCDatabaseManager(TGCArguments* tgcargs, // Tile-Mu coincidence Map m_mapTileMu = new TGCTileMuCoincidenceMap(tgcArgs(), readCondKey, ver_TILE); + if(tgcArgs()->useRun3Config() && tgcArgs()->USE_NSW()){ + for (int side=0; side<NumberOfSide; side +=1) { + for (int oct=0; oct<NumberOfOctant; oct++) { + for(int mod=0; mod<NumberOfModuleInBW; mod++){ + // NSW Coincidence Map + m_mapNSW[side][oct][mod].reset(new TGCNSWCoincidenceMap(tgcArgs(),ver_NSW,side,oct,mod)); + } + } + } + + } } void TGCDatabaseManager::deleteConnectionPPToSL() diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCElectronicsSystem.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCElectronicsSystem.cxx index cfc418147dc63c778a757198523b377d1370ed66..186e43bb10c735a1ceadb78915b08f6a058a7126 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCElectronicsSystem.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCElectronicsSystem.cxx @@ -36,6 +36,7 @@ void TGCElectronicsSystem::distributeSignal(LVL1TGCTrigger::TGCEvent* event) TGCElectronicsSystem::TGCElectronicsSystem(TGCArguments* tgcargs) :m_DB(0), m_tmdb(0), + m_nsw(0), m_tgcArgs(tgcargs) { for(int side=0; side < NumberOfSide; side++){ @@ -54,11 +55,17 @@ TGCElectronicsSystem::TGCElectronicsSystem(TGCArguments* tgcargs) bool ): m_DB(database), m_tmdb(0), + m_nsw(0), m_tgcArgs(tgcargs) { // TileMu m_tmdb = new TGCTMDB(); + // NSW + if(tgcargs->USE_NSW() && tgcargs->useRun3Config()){ + m_nsw.reset(new TGCNSW()); + } + int SectorId; LVL1TGCTrigger::TGCRegionType RegionType; LVL1TGCTrigger::TGCForwardBackwardType forwardBackward; @@ -71,7 +78,9 @@ TGCElectronicsSystem::TGCElectronicsSystem(TGCArguments* tgcargs) m_sector[side][oct][mod] = new TGCSector(tgcArgs(),SectorId, RegionType, forwardBackward, m_DB, - m_tmdb); + m_tmdb, + m_nsw + ); } // loop module } // loop octant } //loop side @@ -187,7 +196,7 @@ TGCElectronicsSystem::~TGCElectronicsSystem() } // loop octant } // loop side - if (m_tmdb) delete m_tmdb; + if (m_tmdb){ delete m_tmdb;} } // hiddedn copy constructor diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCNSW.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCNSW.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e7dcfc14d5cfcc00a03f3656c705f4cf20207c3d --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCNSW.cxx @@ -0,0 +1,138 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ==================================================================== +/* + TGCNSW.cc +*/ +// ==================================================================== + +#include <iostream> +#include <iomanip> + +#include "TrigT1TGC/TGCNSW.h" +#include "TrigT1TGC/NSWTrigOut.h" + +namespace LVL1TGCTrigger { + +// ==================================================================== +// +// class description +// +// ==================================================================== + +TGCNSW::TGCNSW(){ + for (int side=0; side < 2; side++) { + for (int TP=0; TP < NumberOfNSWTriggerProcesser; TP++) { + std::vector<int> vecTP; + vecTP.push_back(TP); + m_buffer[side][TP].reset(new NSWTrigOut(side, vecTP)); + } + } +} + + +TGCNSW::~TGCNSW(){ +} + +TGCNSW::TGCNSW(const TGCNSW& right){ + for(int idx1=0; idx1<2; idx1++){ + for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){ + m_buffer[idx1][idx2] = 0; + } + } + *this= right; +} + + +const TGCNSW& TGCNSW::operator=(const TGCNSW& right){ + if (this != &right) { + for(int idx1=0; idx1<2; idx1++){ + for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){ + m_buffer[idx1][idx2].reset(new NSWTrigOut(*(right.m_buffer[idx1][idx2]))); + } + } + } + return *this; +} + +std::shared_ptr<const NSWTrigOut> TGCNSW::getOutput(TGCRegionType region ,int side,int TGC_TriggerSector) const{ + + std::shared_ptr<NSWTrigOut> tirgNSW_output; + tirgNSW_output.reset(new NSWTrigOut()); + tirgNSW_output->clear(); + if ( (side<0)||(side>1) ) return 0; + if(region==ENDCAP){ + if ( TGC_TriggerSector<0 || TGC_TriggerSector>47 ) return 0; + ////NSW Large Secor Info + int NSW_TriggerSecot=(TGC_TriggerSector+1)/6*2; + if(NSW_TriggerSecot==16){NSW_TriggerSecot=0;} + if(NSW_TriggerSecot>=0 && NSW_TriggerSecot<=15){ + *tirgNSW_output+=*m_buffer[side][NSW_TriggerSecot]; + } + + ////NSW Small Sector Info + if(TGC_TriggerSector%6==1 || TGC_TriggerSector%6==2){ + return tirgNSW_output; + } + NSW_TriggerSecot=(TGC_TriggerSector+1+(TGC_TriggerSector-1)/6*2)/4; + if(NSW_TriggerSecot==0){NSW_TriggerSecot=15;} + if(NSW_TriggerSecot>=0 && NSW_TriggerSecot<=15){ + *tirgNSW_output+=*m_buffer[side][NSW_TriggerSecot]; + } + + return tirgNSW_output; + } + + if(region==FORWARD){ + if ( TGC_TriggerSector<0 || TGC_TriggerSector>23 ) return 0; + ////NSW Large Secor Info + int NSW_TriggerSecot=(TGC_TriggerSector+1)/3*2; + if(NSW_TriggerSecot==16){NSW_TriggerSecot=0;} + if(NSW_TriggerSecot>=0 && NSW_TriggerSecot<=15){ + *tirgNSW_output+=*m_buffer[side][NSW_TriggerSecot]; + } + + ///NSW Small Sector Info + NSW_TriggerSecot=2*(TGC_TriggerSector+2)/3-1; + if(NSW_TriggerSecot==-1){NSW_TriggerSecot=15;} + if(NSW_TriggerSecot>=0 && NSW_TriggerSecot<=15){ + *tirgNSW_output+=*m_buffer[side][NSW_TriggerSecot]; + } + return tirgNSW_output; + } + + + return 0; +} + + +void TGCNSW::setOutput(int side, int NSWTriggerProcesser, int NSWeta_8bit, int NSWphi_6bit, int NSWDtheta_5bit){ + if ( (side<0)||(side>1) ) return;//side 0::Aside 1::Cside + if ( (NSWTriggerProcesser<0) || (NSWTriggerProcesser>=NumberOfNSWTriggerProcesser) ) return; + m_buffer[side][NSWTriggerProcesser]->setSide(side); + m_buffer[side][NSWTriggerProcesser]->setNSWTriggerProcessor(NSWTriggerProcesser); + m_buffer[side][NSWTriggerProcesser]->setEta(NSWeta_8bit); + m_buffer[side][NSWTriggerProcesser]->setPhi(NSWphi_6bit); + m_buffer[side][NSWTriggerProcesser]->setDtheta(NSWDtheta_5bit); +} + +void TGCNSW::eraseOutput(){ + for(int idx1=0; idx1<2; idx1++){ + for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){ + m_buffer[idx1][idx2]->clear(); + } + } +} + +void TGCNSW::print() const{ + for(int idx1=0; idx1<2; idx1++){ + for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){ + m_buffer[idx1][idx2]->print(); + } + } +} + + +} //end of namespace bracket diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCNSWCoincidenceMap.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCNSWCoincidenceMap.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f5d144eb4db4fa77db7b73f39c28e18f72ae2357 --- /dev/null +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCNSWCoincidenceMap.cxx @@ -0,0 +1,273 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +#include <iomanip> + +#include "TrigT1TGC/TGCNSWCoincidenceMap.h" +#include "TrigT1TGC/NSWTrigOut.h" +#include "TrigT1TGC/TGCDatabaseManager.hh" +#include "PathResolver/PathResolver.h" + +#include "MuonCondInterface/ITGCTriggerDbTool.h" + +#include "GaudiKernel/ISvcLocator.h" +#include "GaudiKernel/Bootstrap.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/IMessageSvc.h" + +#include "TrigT1TGC/TGCArguments.hh" + +namespace LVL1TGCTrigger { + + + TGCNSWCoincidenceMap::TGCNSWCoincidenceMap(TGCArguments* tgcargs,const std::string& version,int side,int oct,int mod) + :m_verName(version), + m_side(side), + m_octant(oct), + m_module(mod), + m_condDbTool("TGCTriggerDbTool"), + m_tgcArgs(tgcargs) + { + + m_msg = Athena::MsgStreamMember("LVL1TGCTrigger::TGCNSWCoincidenceMap::TGCNSWCoincidenceMap"); + m_msg.get().setLevel(tgcArgs()->MSGLEVEL()); + + if(!tgcArgs()->USE_NSW()){return;} + + std::string moduleName = std::to_string(mod); + if( isForward(mod)){ + m_region=TGCRegionType::FORWARD; + m_sector = m_module/3; + m_sector += 3*m_octant; + } + else{ + m_region=TGCRegionType::ENDCAP; + m_sector = m_module%3 + 2*(m_module/3); + m_sector += 6*m_octant; + } + + + m_Offset_Eta.resize(m_NumberOfRoI[m_region]); + m_Offset_Phi.resize(m_NumberOfRoI[m_region]); + + for(int dr=0;dr!=N_dEta;dr++){ + for(int dphi=0;dphi!=N_dPhi;dphi++){ + m_EtaPhi_CW[dr][dphi].resize(m_NumberOfRoI[m_region]); + std::fill(m_EtaPhi_CW[dr][dphi].begin(), m_EtaPhi_CW[dr][dphi].end(),0); + } + for(int dTheta=0;dTheta!=N_Dtheta;dTheta++){ + m_EtaDtheta_CW[dr][dTheta].resize(m_NumberOfRoI[m_region]); + std::fill(m_EtaDtheta_CW[dr][dTheta].begin(), m_EtaDtheta_CW[dr][dTheta].end(),0); + } + } + + if( ( oct%2==0 && mod==5 ) || (oct%2==1 && (mod==2 || mod==8)) ){moduleName+="b";} + else{moduleName+="a";} + + + //---------Read out CW data--------- + if(!this->readMap( moduleName, ReadCW_Type::EtaPhi_CW) || + !this->readMap( moduleName, ReadCW_Type::EtaDtheta_CW) + ){ + // NSW trigger flag is set to false when the map reading failed. + tgcArgs()->set_USE_NSW(false); + } + + //---------Fill Shift data--------- + if(!this->readShift()){ + // NSW trigger flag is set to false when the map reading failed. + tgcArgs()->set_USE_NSW(false); + } + + } + + TGCNSWCoincidenceMap::TGCNSWCoincidenceMap(){ } + + + TGCNSWCoincidenceMap::~TGCNSWCoincidenceMap() + { + } + + + + bool TGCNSWCoincidenceMap::isForward( int mod ){ + return ( mod==2 || mod==5 || mod==8 ); + } + + //TGC-NSW Eta-Phi Coincidence + int TGCNSWCoincidenceMap::TGCNSW_pTcalcu_EtaPhi(const NSWTrigOut *nswOut,int roi) const + { + std::vector<int> nswEta_vec=nswOut->getNSWeta(); + std::vector<int> nswPhi_vec=nswOut->getNSWphi(); + int highest_pT=0; + + for(unsigned int nswTrk_id=0;nswTrk_id!=nswEta_vec.size();nswTrk_id++){ + int eta_decode=m_Offset_Eta[roi]-nswEta_vec[nswTrk_id]; + int phi_decode=m_Offset_Phi[roi]-nswPhi_vec[nswTrk_id]; + if(eta_decode<0 || eta_decode>=N_dEta){continue;} + if(phi_decode<0 || phi_decode>=N_dPhi){continue;} + + if(highest_pT<m_EtaPhi_CW[eta_decode][phi_decode][roi]){ + highest_pT=m_EtaPhi_CW[eta_decode][phi_decode][roi]; + } + } + + return highest_pT; + } + + + //TGC-NSW Eta-DeltaTheta Coincidence + int TGCNSWCoincidenceMap::TGCNSW_pTcalcu_EtaDtheta(const NSWTrigOut *nswOut,int roi) const + { + std::vector<int> nswEta_vec=nswOut->getNSWeta(); + std::vector<int> nswDtheta_vec=nswOut->getNSWDtheta(); + int highest_pT=0; + + for(unsigned int nswTrk_id=0;nswTrk_id!=nswEta_vec.size();nswTrk_id++){ + int eta_decode=m_Offset_Eta[roi]-nswEta_vec[nswTrk_id]; + int dTheta_decode=nswDtheta_vec[nswTrk_id]; + if(eta_decode<0 || eta_decode>=N_dEta){continue;} + if(highest_pT<m_EtaDtheta_CW[eta_decode][dTheta_decode][roi]){ + highest_pT=m_EtaDtheta_CW[eta_decode][dTheta_decode][roi]; + } + } + + return highest_pT; + } + + + bool TGCNSWCoincidenceMap::readMap(std::string moduleName, ReadCW_Type cw_type) + { + std::string kSide[2] = {"a", "c"}; + std::string kCWtype[2] = {"EtaPhi","EtaDtheta"}; + + std::string dbname=""; + //Files below are put in calib dirctory when the files are fixed. + //dbname = "/NSW/cm_" + kSide[m_side] + moduleName +kCWtype[cw_type]+"_"+m_verName+".db"; + //std::string fullName = PathResolver::FindCalibDirectory("TrigT1TGC_CW")+fn; + + // Coincidence Map files haven't fixed. + // The files are temporary and just for test. + // These files are in lxplus.cern.ch:/afs/cern.ch/user/h/hhibi/public/TrigT1TGC/ + + std::string fullName = "./cm_" + kSide[m_side] + moduleName+kCWtype[cw_type]+"_0030.db"; + + std::ifstream data(fullName); + if(!data.is_open()){return false;} + char delimiter = '\n'; + std::string field; + std::string tag; + + while (std::getline(data, field, delimiter)) { + int roi=-1; + unsigned int n_Etabit=0; + unsigned int n_Phibit=0; + std::istringstream header(field); + header >> tag; + if(tag=="#"){ // read header part. + header >> roi >> n_Etabit >> n_Phibit; + } + // get trigger word + std::string word; + unsigned int pT=0; + + ////////////// Read CW //////////////// + for(size_t posR=0; posR<N_dEta ; posR++){ + std::getline(data, field, delimiter); + std::istringstream cont(field); + //----Read EtaPhi CW--------- + if(cw_type==ReadCW_Type::EtaPhi_CW){ + for(size_t posPHI=0; posPHI<N_dPhi; posPHI++){ + cont >> word; + std::istringstream(word) >> std::hex >> pT; + m_EtaPhi_CW[posR][posPHI][roi]=pT; + } + } + //-----Read EtaDtheta CW----- + if(cw_type==ReadCW_Type::EtaDtheta_CW){ + for(size_t posDTHETA=0; posDTHETA<N_Dtheta; posDTHETA++){ + cont >> word; + std::istringstream(word) >> std::hex >> pT; + m_EtaDtheta_CW[posR][posDTHETA][roi]=pT; + } + } + } + + } + data.close(); + + + return true; + } + + + bool TGCNSWCoincidenceMap::readShift(){ + + char delimiter = '\n'; + std::string field; + std::string tag; + int side; + int triggerSector; + + //------- Read Endcap Shift + std::string dbname=""; + + // Files for decording haven't fixed. + // The files are temporary and just for test. + // These files are in lxplus.cern.ch:/afs/cern.ch/user/h/hhibi/public/TrigT1TGC/ + if(m_region==ENDCAP){dbname = "./RoIpos_Endcap.db";} + if(m_region==FORWARD){dbname = "./RoIpos_Forward.db";} + + //Files below are put in calib dirctory when the files are fixed. + //if(m_region==ENDCAP){dbname = "/NSW/decorder_Endcap_"+m_verName+".db";} + //if(m_region==FORWARD){dbname = "/NSW/decorder_Forward_"+m_verName+".db";} + //fullName = PathResolver::FindCalibDirectory("TrigT1TGC_CW")+fn; + + std::ifstream data(dbname); + if(!data.is_open()){return false;} + + while (std::getline(data, field, delimiter)) { + std::istringstream header(field); + header >> tag; + if(tag=="#"){ // read header part. + header >> side >> triggerSector ; + } + + // get trigger word + std::getline(data, field, delimiter); + std::istringstream cont(field); + std::string word; + int shift=0; + int phi_shift[4]; + int eta_shift[37]; + + if(side!=m_side || triggerSector!=m_sector){ continue; } + for(int phiN=0; phiN!=4; phiN++){ + cont >> word; + std::istringstream(word) >> shift; + phi_shift[phiN]=shift; + } + for(int etaN=0; etaN!=m_NumberOfEtaRaw[m_region]; etaN++){ + cont >> word; + std::istringstream(word) >> shift; + eta_shift[etaN]=shift; + } + for(int roi=0;roi!=m_NumberOfRoI[m_region];roi++){ + m_Offset_Eta[roi]=eta_shift[roi/4]+N_dEta/2; + m_Offset_Phi[roi]=phi_shift[roi%4]+N_dPhi/2; + } + + break; + } + data.close(); + + return true; + } + +} //end of namespace bracket diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCSector.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCSector.cxx index b316a053169cd133221675c6f1db4d9a2edbb1db..25c4fd3c0dc25da23a25000ce7b51c03e143b15e 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCSector.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCSector.cxx @@ -79,7 +79,7 @@ TGCSector::TGCSector( TGCArguments* tgcargs) : m_id(0), m_regionType(FORWARD), m_numberOfHit(0), m_sideId(0), m_octantId(0), m_moduleId(0), m_forwardBackward(ForwardSector), - m_SL(0), m_TMDB(0), + m_SL(0), m_TMDB(0), m_NSW(0), m_tgcArgs(tgcargs) { for(unsigned int iPatchPanelType=0; iPatchPanelType<NumberOfPatchPanelType; iPatchPanelType++) { @@ -101,9 +101,11 @@ TGCSector::TGCSector( TGCArguments* tgcargs) int idIn, TGCRegionType type, TGCForwardBackwardType forwardBackward, const TGCDatabaseManager* db, - const TGCTMDB* tm) + const TGCTMDB* tm, + std::shared_ptr<const TGCNSW> nsw + ) : m_id(idIn),m_regionType(type),m_numberOfHit(0), - m_TMDB(tm), + m_TMDB(tm),m_NSW(nsw), m_tgcArgs(tgcargs) { m_sideId = (idIn/NumberOfModule)/NumberOfOctant; @@ -137,8 +139,14 @@ TGCSector::TGCSector( TGCArguments* tgcargs) // set RPhi and EIFI CoincidenceMap in SectorLogic. setRPhiMap(map, mapI); + // set Tile CoincidenceMap & give Tile buffer to SL const TGCTileMuCoincidenceMap* mapTM = db->getTileMuCoincidenceMap(); setTileMuMap(mapTM); + + // set NSW CoincidenceMap & give NSW buffer to SL + std::shared_ptr<const TGCNSWCoincidenceMap> mapNSW = db->getNSWCoincidenceMap(m_sideId, m_octantId,m_moduleId); + setNSWMap(mapNSW); + } // set connection between boards; @@ -156,7 +164,7 @@ TGCSector::TGCSector( const TGCSector& ) : m_id(0), m_regionType(FORWARD), m_numberOfHit(0), m_sideId(0), m_octantId(0), m_moduleId(0), m_forwardBackward(ForwardSector), - m_SL(0), m_TMDB(0) + m_SL(0), m_TMDB(0), m_NSW(0) { for(unsigned int iPatchPanelType=0; iPatchPanelType<NumberOfPatchPanelType; iPatchPanelType++) { m_ASDToPP[iPatchPanelType] = 0; @@ -293,6 +301,14 @@ void TGCSector::setTileMuMap(const TGCTileMuCoincidenceMap* mapTM) } +void TGCSector::setNSWMap(std::shared_ptr<const TGCNSWCoincidenceMap> mapNSW) +{ + if (m_SL) m_SL->setNSWMap(m_NSW, mapNSW); +} + + + + void TGCSector::connectPPToSB(const TGCConnectionPPToSB* connection) { int iPP,iSB,iPort,i; diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCSectorLogic.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCSectorLogic.cxx index 6ecf3b88a1aa580737dd45e0f214caa5ab48fe11..4fd6096a71e08fc8e851871c5c36d84799d24746 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCSectorLogic.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCSectorLogic.cxx @@ -10,6 +10,10 @@ #include "TrigT1TGC/TGCTMDB.h" #include "TrigT1TGC/TGCTMDBOut.h" +#include "TrigT1TGC/TGCNSW.h" +#include "TrigT1TGC/NSWTrigOut.h" +#include "TrigT1TGC/TGCNSWCoincidenceMap.h" + #include "StoreGate/ReadCondHandle.h" #include "MuonCondSvc/TGCTriggerData.h" @@ -100,6 +104,14 @@ void TGCSectorLogic::setTileMuMap(const TGCTMDB* tmdb, if (m_mapTileMu ==0 || m_pTMDB==0) m_useTileMu = false; } + void TGCSectorLogic::setNSWMap(std::shared_ptr<const TGCNSW> nsw, + std::shared_ptr<const TGCNSWCoincidenceMap> mapNSW){ + m_nsw = nsw; + m_mapNSW = mapNSW; + if( m_nsw == 0 || m_mapNSW == 0){tgcArgs()->set_USE_NSW(false);} +} + + void TGCSectorLogic::setWireHighPtBoard(int port, TGCHighPtBoard* highPtBoard) { m_wireHighPtBoard[port] = highPtBoard; @@ -187,10 +199,16 @@ void TGCSectorLogic::clockIn(const SG::ReadCondHandleKey<TGCTriggerData> readCon } //////////////////////////////////////////// // do coincidence with Inner Tracklet of EIFI and/or TileMu - if (m_useEIFI){ - if(!tgcArgs()->useRun3Config()){doInnerCoincidence(readCondKey, SSCid, coincidenceOut);} - else{/*InnerCoincidence Algorithm for Run3 will be implemented;*/} + + if(!tgcArgs()->useRun3Config()){ + if (m_useEIFI){ + doInnerCoincidence(readCondKey, SSCid, coincidenceOut); + } } + else{ + doInnerCoincidenceRun3(SSCid, coincidenceOut);/*InnerCoincidence Algorithm for Run3 will be implemented;*/ + } + if(coincidenceOut){ if(tgcArgs()->useRun3Config()){m_trackSelector.input(coincidenceOut);}// TrackSelector for Run3 @@ -534,4 +552,86 @@ void TGCSectorLogic::doInnerCoincidence(const SG::ReadCondHandleKey<TGCTriggerDa } + + + //////////////////////////////////////// + // Inner Coincidnece Algorithms on Run3 + //////////////////////////////////////// + void TGCSectorLogic::doInnerCoincidenceRun3(int SSCId, TGCRPhiCoincidenceOut* coincidenceOut){ + if (coincidenceOut ==0) return; + + int pt = coincidenceOut->getpT(); + if (pt==0) return; + + if(SSCId<=4 && m_region==ENDCAP){//3 detectors are used to inner coincidnece in SSC#0~4 in Endcap; + + // WHICH INNER COINCIDENCE + // select a inner station detector which is used in inner coincidence algorithm. + //Defenation of innerDetectorNumber :: enum{EI=0,TILE,BIS78}; + + /*int innerDetectorNumber = which_InnerCoincidence();*/ //this function will be implemented. + + // doTGCEICoincidnece(); + // doTILECoincidence(); + // doTGCBISCoincidence(); + + } + else{// NSW or FI are used to inner coincidnece in SSC#5~18 in Endcap and Forward region + if(tgcArgs()->USE_NSW() /*&& isNSWside(m_sideId)*/){ //this function will be implemented.There is a NSW on A-side only in early Run3; + doTGCNSWCoincidence(coincidenceOut); + } + else if(/*!isNSWside(m_sideId)*/false){ + //doTGCFICoincidence(); + } + + } + + + + } + + + void TGCSectorLogic::doTGCNSWCoincidence(TGCRPhiCoincidenceOut* coincidenceOut){ + + int pt_EtaPhi=0,pt_EtaDtheta=0; + + //////// calculate pT ////// + + std::shared_ptr<const NSWTrigOut> pNSWOut = m_nsw->getOutput(m_region,m_sideId,m_sectorId); + pt_EtaPhi = m_mapNSW->TGCNSW_pTcalcu_EtaPhi( + pNSWOut.get(), + coincidenceOut->getRoI() + ); + + pt_EtaDtheta = m_mapNSW->TGCNSW_pTcalcu_EtaDtheta( + pNSWOut.get(), + coincidenceOut->getRoI() + ); + /////// set flag //////// + if(pt_EtaPhi==0 && pt_EtaDtheta==0){ + coincidenceOut->setInnerCoincidenceFlag(false); + return; + } + else{ + coincidenceOut->setInnerCoincidenceFlag(true); + } + + + ////// select lowest pT ///// + if(pt_EtaPhi>coincidenceOut->getpT() && pt_EtaDtheta>coincidenceOut->getpT()){ + return; + } + else if(pt_EtaPhi<pt_EtaDtheta){ + coincidenceOut->setpT(pt_EtaPhi); + return; + } + else{ + coincidenceOut->setpT(pt_EtaDtheta); + return; + } + + } + + + } //end of namespace bracket diff --git a/Trigger/TrigTools/TrigByteStreamTools/CMakeLists.txt b/Trigger/TrigTools/TrigByteStreamTools/CMakeLists.txt index e00b728670519a9b5db248914b96ab451cf63f14..b8d19c81a18b243b08ac430f2c8c82d5b504af4c 100644 --- a/Trigger/TrigTools/TrigByteStreamTools/CMakeLists.txt +++ b/Trigger/TrigTools/TrigByteStreamTools/CMakeLists.txt @@ -28,5 +28,5 @@ atlas_add_test( dumpHLTContentInBS_run3 /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data20_test/data_test.00374861.physics_Main.daq.RAW._lb0004._SFO-1._0001.data LOG_IGNORE_PATTERN "^----" ) atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR} + SCRIPT ${ATLAS_FLAKE8} -- ${CMAKE_CURRENT_SOURCE_DIR} POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigTools/TrigByteStreamTools/bin/trigbs_findevent.py b/Trigger/TrigTools/TrigByteStreamTools/bin/trigbs_findevent.py index 932402afe41602e0e005a0611b0936114126fcf1..9fa98b2405638bcbc15bb334bddc1806b471b8b4 100755 --- a/Trigger/TrigTools/TrigByteStreamTools/bin/trigbs_findevent.py +++ b/Trigger/TrigTools/TrigByteStreamTools/bin/trigbs_findevent.py @@ -1,10 +1,8 @@ #!/usr/bin/env python -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """Find event in FILE(s). -FILE can be a local file or a castor path. On castor, wildcards are supported but -need to be put into single-quotes to avoid shell expansion. If no event identifier(s) are specified on the command line all events are printed. In addition one can save the selected events into a new file. """ @@ -12,10 +10,8 @@ In addition one can save the selected events into a new file. __author__ = "Frank Winklmeier" import sys -import os import argparse import eformat -from PyUtils.castor import nsls def fmtEvent(e,showTime=False): if showTime: @@ -33,7 +29,7 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-f', '--file', metavar='FILE', nargs='*', default=[], - help='local file or castor path') + help='file name') parser.add_argument('-g', '--globalid', type=int, action='store', nargs='*', help='Global event ID') @@ -44,48 +40,19 @@ def main(): parser.add_argument('-t', '--time', action=StoreTime, nargs='*', help='Nanosecond time stamp (seconds:nanoseconds)') - parser.add_argument('-d', '--debug', type=int, action='store', metavar='RUN', - help='Find event in debug streams of RUN') - parser.add_argument('-s', '--save', metavar='OUTFILE', nargs='?', action='store', const='trigbs_findevent', help='Save selected events in OUTFILE') - parser.add_argument('--debugPath', action='store', - default='/castor/cern.ch/grid/atlas/DAQ/2012', - help='Path to debug stream events %(default)s') - parser.add_argument('-v', '--verbose', action='store_true', help='Be verbose') args = parser.parse_args() - files = [] - for f in args.file: - if f.find('castor')!=-1: - files += nsls(f) - else: - files += [f] - - if args.debug is not None: - # Set/reset castor environment for debug stream access - stage_host = os.environ.get('STAGE_HOST',None) - stage_svcclass = os.environ.get('STAGE_SVCCLASS',None) - os.environ['STAGE_HOST'] = 'castoratlas' - os.environ['STAGE_SVCCLASS'] = 'atlcal' - debug_dirs = nsls(os.path.join(args.debugPath,'%08d' % args.debug,'debug_*')) - for d in debug_dirs: - files += nsls(os.path.join(d,'*.data')) - - if stage_host: - os.environ['STAGE_HOST'] = stage_host - if stage_svcclass: - os.environ['STAGE_SVCCLASS'] = stage_svcclass - ofs = None if args.save is not None: ofs = eformat.ostream(core_name=args.save) - for f in files: + for f in args.file: ifs = eformat.istream(f) if args.verbose: print('==%s' % f) diff --git a/Trigger/TrigTools/TrigInDetConf/python/TrigInDetPostTools.py b/Trigger/TrigTools/TrigInDetConf/python/TrigInDetPostTools.py index 340936078e7b379fec9cf2b9c1f5475a4ce179a9..b120cfe3565f96d9e371256af283fde787b2f3d4 100644 --- a/Trigger/TrigTools/TrigInDetConf/python/TrigInDetPostTools.py +++ b/Trigger/TrigTools/TrigInDetConf/python/TrigInDetPostTools.py @@ -65,8 +65,7 @@ InDetTrigParticleCreatorToolWithSummary = \ Extrapolator = InDetTrigExtrapolator, TrackSummaryTool = InDetTrigTrackSummaryToolSharedHits, KeepParameters = True, - ComputeAdditionalInfo = True, - UpdateTrack = False + ComputeAdditionalInfo = True ) ToolSvc += InDetTrigParticleCreatorToolWithSummary @@ -78,8 +77,7 @@ InDetTrigParticleCreatorToolWithSummaryTRTPid = \ Extrapolator = InDetTrigExtrapolator, TrackSummaryTool = InDetTrigTrackSummaryToolSharedHitsWithTRTPid, KeepParameters = True, - ComputeAdditionalInfo = True, - UpdateTrack = False + ComputeAdditionalInfo = True ) ToolSvc += InDetTrigParticleCreatorToolWithSummaryTRTPid @@ -91,8 +89,7 @@ InDetTrigParticleCreatorToolParams = \ Trk__TrackParticleCreatorTool( name = "InDetTrigParticleCreatorToolParams", Extrapolator = InDetTrigExtrapolator, TrackSummaryTool = InDetTrigTrackSummaryToolSharedHits, - KeepParameters = True, - UpdateTrack = False + KeepParameters = True ) ToolSvc += InDetTrigParticleCreatorToolParams @@ -104,8 +101,7 @@ InDetTrigParticleCreatorToolFTF = \ Extrapolator = InDetTrigExtrapolator, TrackSummaryTool = InDetTrigFastTrackSummaryTool, KeepParameters = True, - ComputeAdditionalInfo = True, - UpdateTrack = False + ComputeAdditionalInfo = True ) ToolSvc += InDetTrigParticleCreatorToolFTF diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py index e13073ebc5dc3dc488950bea1b3448804d31a057..58f15c70652cd61db93087a951256da97a20a09b 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py @@ -77,15 +77,6 @@ def makeInDetPrecisionTracking( whichSignature, outPTTrackParticles = "%sTrack_%s_%s" %(outputTrackPrefixName, remapSuffix( whichSignature ), 'IDTrig') -# # disable the TRT extension at the moment for bjets and muons - if "electron" in whichSignature : - doTRTextension = True - elif "tau" in whichSignature : - doTRTextension = True - else : - doTRTextension = False - - #Atm there are mainly two output track collections one from ambiguity solver stage and one from trt, #we want to have the output name of the track collection the same whether TRT was run or not, #e.g InDetTrigPT_Tracks_electron @@ -105,10 +96,6 @@ def makeInDetPrecisionTracking( whichSignature, if verifier: verifier.DataObjects += [( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+' + TrigPixelKeys.PixelClusterAmbiguitiesMap ), ( 'TrackCollection' , 'StoreGateSvc+' + inputFTFtracks )] - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+' + TrigPixelKeys.PixelClusterAmbiguitiesMap )] - from AthenaCommon.AppMgr import ToolSvc #----------------------------------------------------------------------------- @@ -117,16 +104,17 @@ def makeInDetPrecisionTracking( whichSignature, from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryHelperToolSharedHits,InDetTrigTRT_ElectronPidTool - InDetTrigTrackSummaryToolSharedHitsWithTRTPid = Trk__TrackSummaryTool(name = "%sTrackSummaryToolSharedHitsWithTRT%s"%(algNamePrefix, signature), - InDetSummaryHelperTool = InDetTrigTrackSummaryHelperToolSharedHits, - doSharedHits = InDetTrigFlags.doSharedHits(), - doHolesInDet = True, - TRT_ElectronPidTool = InDetTrigTRT_ElectronPidTool) - + trigTrackSummaryTool = Trk__TrackSummaryTool(name = "%sTrackSummaryToolSharedHitsWithTRT%s"%(algNamePrefix, signature), + InDetSummaryHelperTool = InDetTrigTrackSummaryHelperToolSharedHits, + doSharedHits = InDetTrigFlags.doSharedHits(), + doHolesInDet = True ) + + if doTRTextension: + if "electron" in whichSignature or "tau" in whichSignature : + trigTrackSummaryTool.TRT_ElectronPidTool = InDetTrigTRT_ElectronPidTool - if whichSignature == "electron" or "tau" in whichSignature : Parameter_config = True - SummaryTool_config = InDetTrigTrackSummaryToolSharedHitsWithTRTPid + SummaryTool_config = trigTrackSummaryTool else: SummaryTool_config = InDetTrigTrackSummaryTool Parameter_config = False @@ -374,7 +362,7 @@ def makeInDetPrecisionTracking( whichSignature, TrackSummaryTool = SummaryTool_config) ToolSvc += InDetTrigMTxAODParticleCreatorTool - log.info(InDetTrigMTxAODParticleCreatorTool) + log.debug(InDetTrigMTxAODParticleCreatorTool) from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackCollectionCnvTool @@ -384,7 +372,7 @@ def makeInDetPrecisionTracking( whichSignature, ToolSvc += InDetTrigMTxAODTrackCollectionCnvTool - log.info(InDetTrigMTxAODTrackCollectionCnvTool) + log.debug(InDetTrigMTxAODTrackCollectionCnvTool) #This one shouldn't be necessary #TODO: obsolete turn off @@ -414,7 +402,7 @@ def makeInDetPrecisionTracking( whichSignature, #allViewAlgorithms += InDetTrigMTxAODTrackParticleCnvAlg - log.info(InDetTrigMTxAODTrackParticleCnvAlg) + log.debug(InDetTrigMTxAODTrackParticleCnvAlg) ptAlgs.append( InDetTrigMTxAODTrackParticleCnvAlg) #ToolSvc.InDetTrigHoleSearchTool.SctSummaryTool.InDetTrigInDetSCT_FlaggedConditionTool.SCT_FlaggedCondData = "SCT_FlaggedCondData_TRIG" diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py index 89326454283eae507664d1a1a51b5d5e6b1b4929..bfd74d034dd0df9cf68a29c826510a352174ea11 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py @@ -30,10 +30,13 @@ def makeInDetAlgsNoView( whichSignature='', separateTrackParticleCreator='', roi def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'EMViewRoIs', doFTF = True, viewVerifier='IDViewDataVerifier' ): #If signature specified add suffix to the algorithms - signature = "_" + whichSignature if whichSignature else '' + signature = whichSignature if whichSignature else '' if signature != "" and separateTrackParticleCreator == "": separateTrackParticleCreator = signature + if signature == "" : + raise ValueError('makeInDetAlgs() No signature specified') + #Global keys/names for Trigger collections from .InDetTrigCollectionKeys import TrigPixelKeys, TrigSCTKeys from InDetRecExample.InDetKeys import InDetKeys @@ -56,12 +59,9 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] viewAlgs.append( ViewDataVerifier ) - # Make sure required objects are still available at whole-event level + # Load RDOs if we aren't loading bytestream from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] - - # Load RDOs if we aren't loading bytestream if not globalflags.InputFormat.is_bytestream(): ViewDataVerifier.DataObjects += [( 'PixelRDO_Container' , InDetKeys.PixelRDOs() ), ( 'SCT_RDO_Container' , InDetKeys.SCT_RDOs() ), @@ -84,11 +84,15 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E #Pixel from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder - InDetPixelRodDecoder = PixelRodDecoder(name = "InDetPixelRodDecoder" + signature) + InDetPixelRodDecoder = PixelRodDecoder(name = "InDetPixelRodDecoder_" + signature) + # Disable duplcated pixel check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetPixelRodDecoder.CheckDuplicatedPixel=False ToolSvc += InDetPixelRodDecoder from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool - InDetPixelRawDataProviderTool = PixelRawDataProviderTool(name = "InDetPixelRawDataProviderTool" + signature, + InDetPixelRawDataProviderTool = PixelRawDataProviderTool(name = "InDetPixelRawDataProviderTool_" + signature, Decoder = InDetPixelRodDecoder, checkLVL1ID = False) ToolSvc += InDetPixelRawDataProviderTool @@ -98,7 +102,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # load the PixelRawDataProvider from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProvider - InDetPixelRawDataProvider = PixelRawDataProvider(name = "InDetPixelRawDataProvider"+ signature, + InDetPixelRawDataProvider = PixelRawDataProvider(name = "InDetPixelRawDataProvider_"+ signature, RDOKey = InDetKeys.PixelRDOs(), ProviderTool = InDetPixelRawDataProviderTool,) InDetPixelRawDataProvider.isRoI_Seeded = True @@ -114,11 +118,11 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E #SCT from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder - InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder" + signature) + InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder_" + signature) ToolSvc += InDetSCTRodDecoder from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProviderTool - InDetSCTRawDataProviderTool = SCTRawDataProviderTool(name = "InDetSCTRawDataProviderTool" + signature, + InDetSCTRawDataProviderTool = SCTRawDataProviderTool(name = "InDetSCTRawDataProviderTool_" + signature, Decoder = InDetSCTRodDecoder) ToolSvc += InDetSCTRawDataProviderTool if (InDetTrigFlags.doPrintConfigurables()): @@ -127,7 +131,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # load the SCTRawDataProvider from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProvider - InDetSCTRawDataProvider = SCTRawDataProvider(name = "InDetSCTRawDataProvider" + signature, + InDetSCTRawDataProvider = SCTRawDataProvider(name = "InDetSCTRawDataProvider_" + signature, RDOKey = InDetKeys.SCT_RDOs(), ProviderTool = InDetSCTRawDataProviderTool) InDetSCTRawDataProvider.isRoI_Seeded = True @@ -139,7 +143,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # load the SCTEventFlagWriter from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTEventFlagWriter - InDetSCTEventFlagWriter = SCTEventFlagWriter(name = "InDetSCTEventFlagWriter"+ signature) + InDetSCTEventFlagWriter = SCTEventFlagWriter(name = "InDetSCTEventFlagWriter_"+ signature) viewAlgs.append(InDetSCTEventFlagWriter) @@ -152,7 +156,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E PixelConfigCondAlg.UseCalibConditions = False from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool - InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool" + signature, + InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool_" + signature, SCTLorentzAngleTool = TrigSCTLorentzAngleTool, PixelLorentzAngleTool = TrigPixelLorentzAngleTool) @@ -160,21 +164,25 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool - InDetMergedPixelsTool = InDet__MergedPixelsTool(name = "InDetMergedPixelsTool" + signature, + InDetMergedPixelsTool = InDet__MergedPixelsTool(name = "InDetMergedPixelsTool_" + signature, globalPosAlg = InDetClusterMakerTool, MinimalSplitSize = 0, MaximalSplitSize = 49, MinimalSplitProbability = 0, DoIBLSplitting = True, ) + # Enable duplcated RDO check for data15 because duplication mechanism was used. + from RecExConfig.RecFlags import rec + if len(rec.projectName())>=6 and rec.projectName()[:6]=="data15": + InDetMergedPixelsTool.CheckDuplicatedRDO = True ToolSvc += InDetMergedPixelsTool from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder - InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder(name = "InDetPixelGangedAmbiguitiesFinder" + signature) + InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder(name = "InDetPixelGangedAmbiguitiesFinder_" + signature) ToolSvc += InDetPixelGangedAmbiguitiesFinder from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__PixelClusterization - InDetPixelClusterization = InDet__PixelClusterization(name = "InDetPixelClusterization" + signature, + InDetPixelClusterization = InDet__PixelClusterization(name = "InDetPixelClusterization_" + signature, clusteringTool = InDetMergedPixelsTool, gangedAmbiguitiesFinder = InDetPixelGangedAmbiguitiesFinder, DataObjectName = InDetKeys.PixelRDOs(), @@ -189,29 +197,29 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # Create SCT_ConditionsSummaryTool from SCT_ConditionsTools.SCT_ConditionsSummaryToolSetup import SCT_ConditionsSummaryToolSetup - sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup("InDetSCT_ConditionsSummaryTool" + signature) + sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup("InDetSCT_ConditionsSummaryTool_" + signature) sct_ConditionsSummaryToolSetup.setup() InDetSCT_ConditionsSummaryTool = sct_ConditionsSummaryToolSetup.getTool() # noqa: F841 - sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup("InDetSCT_ConditionsSummaryToolWithoutFlagged" + signature) + sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup("InDetSCT_ConditionsSummaryToolWithoutFlagged_" + signature) sct_ConditionsSummaryToolSetupWithoutFlagged.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool() # Add conditions tools to SCT_ConditionsSummaryTool from SCT_ConditionsTools.SCT_ConfigurationConditionsToolSetup import SCT_ConfigurationConditionsToolSetup sct_ConfigurationConditionsToolSetup = SCT_ConfigurationConditionsToolSetup() - sct_ConfigurationConditionsToolSetup.setToolName("InDetSCT_ConfigurationConditionsTool" + signature) + sct_ConfigurationConditionsToolSetup.setToolName("InDetSCT_ConfigurationConditionsTool_" + signature) sct_ConfigurationConditionsToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(sct_ConfigurationConditionsToolSetup.getTool().getFullName()) from SCT_ConditionsTools.SCT_ReadCalibDataToolSetup import SCT_ReadCalibDataToolSetup sct_ReadCalibDataToolSetup = SCT_ReadCalibDataToolSetup() - sct_ReadCalibDataToolSetup.setToolName("InDetSCT_ReadCalibDataTool" + signature) + sct_ReadCalibDataToolSetup.setToolName("InDetSCT_ReadCalibDataTool_" + signature) sct_ReadCalibDataToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(sct_ReadCalibDataToolSetup.getTool().getFullName()) from SCT_ConditionsTools.SCT_ByteStreamErrorsToolSetup import SCT_ByteStreamErrorsToolSetup sct_ByteStreamErrorsToolSetup = SCT_ByteStreamErrorsToolSetup() - sct_ByteStreamErrorsToolSetup.setToolName("InDetSCT_BSErrorTool" + signature) + sct_ByteStreamErrorsToolSetup.setToolName("InDetSCT_BSErrorTool_" + signature) sct_ByteStreamErrorsToolSetup.setConfigTool(sct_ConfigurationConditionsToolSetup.getTool()) sct_ByteStreamErrorsToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(sct_ByteStreamErrorsToolSetup.getTool().getFullName()) @@ -223,7 +231,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # --- SCT_ClusteringTool # from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool - InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool(name = "InDetSCT_ClusteringTool" + signature, + InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool(name = "InDetSCT_ClusteringTool_" + signature, globalPosAlg = InDetClusterMakerTool, conditionsTool = InDetSCT_ConditionsSummaryToolWithoutFlagged) if InDetTrigFlags.doSCTIntimeHits(): @@ -237,7 +245,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E # from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__SCT_Clusterization - InDetSCT_Clusterization = InDet__SCT_Clusterization(name = "InDetSCT_Clusterization" + signature, + InDetSCT_Clusterization = InDet__SCT_Clusterization(name = "InDetSCT_Clusterization_" + signature, clusteringTool = InDetSCT_ClusteringTool, # ChannelStatus = InDetSCT_ChannelStatusAlg, DataObjectName = InDetKeys.SCT_RDOs(), @@ -256,12 +264,12 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E #Space points and FTF from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool - InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool" + signature) + InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool_" + signature) from AthenaCommon.DetFlags import DetFlags from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder from SiSpacePointFormation.InDetOnlineMonitor import InDetMonitoringTool - InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder" + signature, + InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder_" + signature, SiSpacePointMakerTool = InDetSiSpacePointMakerTool, PixelsClustersName = TrigPixelKeys.Clusters, SpacePointsPixelName = TrigPixelKeys.SpacePoints, @@ -292,7 +300,7 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinderBase theFTF = TrigFastTrackFinderBase("TrigFastTrackFinder_" + whichSignature, whichSignature) theFTF.RoIs = rois - theFTF.TracksName = "TrigFastTrackFinder_Tracks" + separateTrackParticleCreator + theFTF.TracksName = "TrigFastTrackFinder_Tracks_" + separateTrackParticleCreator #the following doCloneRemoval modification should be set up in the InDetTrigSliceSettings once legacy trigger not needed if whichSignature=="Electron": @@ -305,15 +313,17 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E from TrigEDMConfig.TriggerEDMRun3 import recordable from InDetTrigParticleCreation.InDetTrigParticleCreationConf import InDet__TrigTrackingxAODCnvMT - trackCollection = "HLT_IDTrack" + separateTrackParticleCreator + "_FTF" + trackCollection = "HLT_IDTrack_" + separateTrackParticleCreator + "_FTF" + theTrackParticleCreatorAlg = InDet__TrigTrackingxAODCnvMT(name = "InDetTrigTrackParticleCreatorAlg" + whichSignature, - doIBLresidual = False, - TrackName = "TrigFastTrackFinder_Tracks" + separateTrackParticleCreator, - TrackParticlesName = recordable( trackCollection ), + TrackName = "TrigFastTrackFinder_Tracks_" + separateTrackParticleCreator, ParticleCreatorTool = InDetTrigParticleCreatorToolFTF) - - theTrackParticleCreatorAlg.roiCollectionName = rois + + if separateTrackParticleCreator == "BeamSpot" : + theTrackParticleCreatorAlg.TrackParticlesName = trackCollection + else: + theTrackParticleCreatorAlg.TrackParticlesName = recordable( trackCollection ) viewAlgs.append(theTrackParticleCreatorAlg) diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py index 1debafb05a47e672800716ff1b82be9b856f8a60..21b0c07f878f2cd884fff2546317de7b8ca36bfb 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py @@ -193,6 +193,9 @@ def TrigInDetConfig( flags, roisKey="EMRoIs", signatureName='' ): PixelRodDecoder=CompFactory.PixelRodDecoder InDetPixelRodDecoder = PixelRodDecoder(name = "InDetPixelRodDecoder"+ signature) + # Disable duplcated pixel check for data15 because duplication mechanism was used. + if len(flags.Input.ProjectName)>=6 and flags.Input.ProjectName[:6]=="data15": + InDetPixelRodDecoder.CheckDuplicatedPixel=False acc.addPublicTool(InDetPixelRodDecoder) PixelRawDataProviderTool=CompFactory.PixelRawDataProviderTool @@ -284,6 +287,9 @@ def TrigInDetConfig( flags, roisKey="EMRoIs", signatureName='' ): MinimalSplitProbability = 0, DoIBLSplitting = True, ) + # Enable duplcated RDO check for data15 because duplication mechanism was used. + if len(flags.Input.ProjectName)>=6 and flags.Input.ProjectName[:6]=="data15": + InDetMergedPixelsTool.CheckDuplicatedRDO = True acc.addPublicTool(InDetMergedPixelsTool) InDet__PixelGangedAmbiguitiesFinder=CompFactory.InDet.PixelGangedAmbiguitiesFinder diff --git a/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigSpacePointConversionTool.h b/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigSpacePointConversionTool.h index e951a1965db41d6b98171e0aafa986be2865b349..6ec35c22919e6a199ce53d777d618e32aadbe67d 100644 --- a/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigSpacePointConversionTool.h +++ b/Trigger/TrigTools/TrigInDetToolInterfaces/TrigInDetToolInterfaces/ITrigSpacePointConversionTool.h @@ -26,7 +26,7 @@ class ITrigSpacePointConversionTool : virtual public IAlgTool { return IID_ITrigSpacePointConversionTool; } - virtual StatusCode getSpacePoints(const IRoiDescriptor&, std::vector<TrigSiSpacePointBase>&, int&, int&) const = 0; + virtual StatusCode getSpacePoints(const IRoiDescriptor&, std::vector<TrigSiSpacePointBase>&, int&, int&, const EventContext& ctx) const = 0; }; diff --git a/Trigger/TrigTools/TrigMuonRoITools/CMakeLists.txt b/Trigger/TrigTools/TrigMuonRoITools/CMakeLists.txt index 65e2c5abb38c3e74569f69f5fd7c2d6efe9c3bba..edfb950b78a17c49939f26cab5b244e49aea69b0 100644 --- a/Trigger/TrigTools/TrigMuonRoITools/CMakeLists.txt +++ b/Trigger/TrigTools/TrigMuonRoITools/CMakeLists.txt @@ -25,3 +25,6 @@ atlas_add_component( TrigMuonRoITools src/*.cxx src/components/*.cxx LINK_LIBRARIES AthenaBaseComps ByteStreamCnvSvcBaseLib GaudiKernel TrigT1Result TrigMuonRoIToolsLib ) + +# Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigTools/TrigMuonRoITools/python/TrigMuonRoIToolsConfig.py b/Trigger/TrigTools/TrigMuonRoITools/python/TrigMuonRoIToolsConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..aa05049b86f16cb7f065c7a82b567c3013f83263 --- /dev/null +++ b/Trigger/TrigTools/TrigMuonRoITools/python/TrigMuonRoIToolsConfig.py @@ -0,0 +1,32 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentFactory import CompFactory + +def TrigMuonRoIToolCfg(): + tool = CompFactory.TrigMuonRoITool('TrigMuonRoITool') + tool.DaqMuCTPiROBid = 0x760000 + tool.DecodeMuCTPiFromROB = False + tool.MUCTPILocation = 'MUCTPI_RDO' + + # TODO: Relying on a Converter to provide MUCTPI_RDO may be not thread safe. + # Run-3 MUCTPI should provide a decoder algorithm which should be scheduled before any alg using this tool. + # For now, still using the Run-2 Converter-based solution: + if tool.MUCTPILocation and not tool.DecodeMuCTPiFromROB: + rdoType = 'MuCTPI_RDO' + + # Tell SGInputLoader to load MUCTPI_RDO from the input + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + if not hasattr(topSequence,'SGInputLoader'): + raise RuntimeError('Cannot configure TrigMuonRoITool because SGInputLoader is missing from topSequence') + topSequence.SGInputLoader.Load += [( rdoType, 'StoreGateSvc+'+tool.MUCTPILocation )] + + # Enable using the Converter to load MUCTPI_RDO from ByteStream + from AthenaCommon.GlobalFlags import globalflags + if globalflags.InputFormat.is_bytestream(): + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + if not hasattr(svcMgr, 'ByteStreamAddressProviderSvc'): + raise RuntimeError('Cannot configure TrigMuonRoITool because ByteStreamAddressProviderSvc is missing from svcMgr') + svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ rdoType+'/'+tool.MUCTPILocation ] + + return tool diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx index 1a8eac85e731ed78093ffd12c43ef137f20db556..6217d130fd8ed4b755625cbc721b366053e3a0b4 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx @@ -103,14 +103,14 @@ StatusCode TrigSpacePointConversionTool::finalize() { StatusCode TrigSpacePointConversionTool::getSpacePoints(const IRoiDescriptor& internalRoI, - std::vector<TrigSiSpacePointBase>& output, int& nPix, int& nSct) const { + std::vector<TrigSiSpacePointBase>& output, int& nPix, int& nSct, const EventContext& ctx) const { output.clear(); - SG::ReadHandle<SpacePointContainer> pixelSpacePointsContainer(m_pixelSpacePointsContainerKey); + SG::ReadHandle<SpacePointContainer> pixelSpacePointsContainer(m_pixelSpacePointsContainerKey, ctx); ATH_CHECK(pixelSpacePointsContainer.isValid()); - SG::ReadHandle<SpacePointContainer> sctSpacePointsContainer(m_sctSpacePointsContainerKey); + SG::ReadHandle<SpacePointContainer> sctSpacePointsContainer(m_sctSpacePointsContainerKey, ctx); ATH_CHECK(sctSpacePointsContainer.isValid()); std::vector<IdentifierHash> listOfPixIds; @@ -147,16 +147,16 @@ StatusCode TrigSpacePointConversionTool::getSpacePoints(const IRoiDescriptor& in nPix=selector.select(*pixelSpacePointsContainer,listOfPixIds); nSct=selector.select(*sctSpacePointsContainer,listOfSctIds); } - if(!m_useBeamTilt) shiftSpacePoints(output); - else transformSpacePoints(output); + if(!m_useBeamTilt) shiftSpacePoints(output, ctx); + else transformSpacePoints(output, ctx); return StatusCode::SUCCESS; } -void TrigSpacePointConversionTool::shiftSpacePoints(std::vector<TrigSiSpacePointBase>& output) const { +void TrigSpacePointConversionTool::shiftSpacePoints(std::vector<TrigSiSpacePointBase>& output, const EventContext& ctx) const { - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; const Amg::Vector3D &vertex = beamSpotHandle->beamPos(); double shift_x = vertex.x() - beamSpotHandle->beamTilt(0)*vertex.z(); double shift_y = vertex.y() - beamSpotHandle->beamTilt(1)*vertex.z(); @@ -166,9 +166,9 @@ void TrigSpacePointConversionTool::shiftSpacePoints(std::vector<TrigSiSpacePoint } -void TrigSpacePointConversionTool::transformSpacePoints(std::vector<TrigSiSpacePointBase>& output) const { +void TrigSpacePointConversionTool::transformSpacePoints(std::vector<TrigSiSpacePointBase>& output, const EventContext& ctx) const { - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; const Amg::Vector3D &origin = beamSpotHandle->beamPos(); double tx = tan(beamSpotHandle->beamTilt(0)); double ty = tan(beamSpotHandle->beamTilt(1)); diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h index 77347fe46fad53ae85613cbe2ab6ae5e8d1901f5..26b3e6e7da0bf99cdde58469217d85a6b1b8f6b9 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h @@ -39,7 +39,7 @@ class TrigSpacePointConversionTool : virtual public ITrigSpacePointConversionToo //concrete implementations - virtual StatusCode getSpacePoints(const IRoiDescriptor&, std::vector<TrigSiSpacePointBase>&, int&, int&) const override final; + virtual StatusCode getSpacePoints(const IRoiDescriptor&, std::vector<TrigSiSpacePointBase>&, int&, int&, const EventContext& ctx) const override final; protected: @@ -62,8 +62,8 @@ class TrigSpacePointConversionTool : virtual public ITrigSpacePointConversionToo bool m_useBeamTilt; bool m_useNewScheme; - void shiftSpacePoints(std::vector<TrigSiSpacePointBase>&) const; - void transformSpacePoints(std::vector<TrigSiSpacePointBase>&) const; + void shiftSpacePoints(std::vector<TrigSiSpacePointBase>&, const EventContext&) const; + void transformSpacePoints(std::vector<TrigSiSpacePointBase>&, const EventContext&) const; /// new region selector tools ToolHandle<IRegSelTool> m_regsel_pix; diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index 85b974530e6dffec3eaf5078bb05dce181c16975..ef9cd5989cb6344ffcf295485d75af3f0b583740 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -22,12 +22,30 @@ TrigSignatureMoniMT INFO -- #3965466087 Features TrigSignatureMoniMT INFO HLT_2j330_a10t_lcw_jes_35smcINF_L1J100 #1295975955 TrigSignatureMoniMT INFO -- #1295975955 Events 3 3 0 - - - - - 0 TrigSignatureMoniMT INFO -- #1295975955 Features 0 - - - - - +TrigSignatureMoniMT INFO HLT_2j60_L1J15 #927735533 +TrigSignatureMoniMT INFO -- #927735533 Events 20 20 10 - - - - - 10 +TrigSignatureMoniMT INFO -- #927735533 Features 28 - - - - - +TrigSignatureMoniMT INFO HLT_2mu10_bJpsimumu_L12MU10 #3498558358 +TrigSignatureMoniMT INFO -- #3498558358 Events 3 3 3 3 3 2 - - 0 +TrigSignatureMoniMT INFO -- #3498558358 Features 12 12 16 4 - - +TrigSignatureMoniMT INFO HLT_2mu10_bUpsimumu_L12MU10 #234102568 +TrigSignatureMoniMT INFO -- #234102568 Events 3 3 3 3 3 2 - - 0 +TrigSignatureMoniMT INFO -- #234102568 Features 12 12 16 4 - - TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 #2619091790 TrigSignatureMoniMT INFO -- #2619091790 Events 3 3 3 1 1 1 - - 1 TrigSignatureMoniMT INFO -- #2619091790 Features 12 4 4 4 - - TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 #557204938 TrigSignatureMoniMT INFO -- #557204938 Events 3 3 3 1 1 1 - - 1 TrigSignatureMoniMT INFO -- #557204938 Features 12 4 4 4 - - +TrigSignatureMoniMT INFO HLT_2mu4_bDimu_L12MU4 #1730084172 +TrigSignatureMoniMT INFO -- #1730084172 Events 4 4 4 4 4 4 - - 1 +TrigSignatureMoniMT INFO -- #1730084172 Features 16 16 24 11 - - +TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 #4276347155 +TrigSignatureMoniMT INFO -- #4276347155 Events 4 4 4 4 4 4 - - 1 +TrigSignatureMoniMT INFO -- #4276347155 Features 16 16 24 11 - - +TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 #4008168535 +TrigSignatureMoniMT INFO -- #4008168535 Events 4 4 4 4 4 4 - - 0 +TrigSignatureMoniMT INFO -- #4008168535 Features 16 16 24 10 - - TrigSignatureMoniMT INFO HLT_2mu4_muonqual_L12MU4 #1584776935 TrigSignatureMoniMT INFO -- #1584776935 Events 4 4 4 4 4 4 - - 4 TrigSignatureMoniMT INFO -- #1584776935 Features 16 16 24 20 - - @@ -206,8 +224,8 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 #86840 TrigSignatureMoniMT INFO -- #868405538 Events 20 20 19 - - - - - 19 TrigSignatureMoniMT INFO -- #868405538 Features 50 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_csskpf_nojcalib_L1J20 #3533281867 -TrigSignatureMoniMT INFO -- #3533281867 Events 19 19 19 - - - - - 19 -TrigSignatureMoniMT INFO -- #3533281867 Features 64 - - - - - +TrigSignatureMoniMT INFO -- #3533281867 Events 19 19 15 - - - - - 15 +TrigSignatureMoniMT INFO -- #3533281867 Features 25 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 #1335156103 TrigSignatureMoniMT INFO -- #1335156103 Events 19 19 16 - - - - - 16 TrigSignatureMoniMT INFO -- #1335156103 Features 31 - - - - - @@ -268,9 +286,12 @@ TrigSignatureMoniMT INFO -- #436385969 Features TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20 #3634067472 TrigSignatureMoniMT INFO -- #3634067472 Events 19 19 0 - - - - - 0 TrigSignatureMoniMT INFO -- #3634067472 Features 0 - - - - - +TrigSignatureMoniMT INFO HLT_j80_L1J15 #2440872308 +TrigSignatureMoniMT INFO -- #2440872308 Events 20 20 13 - - - - - 13 +TrigSignatureMoniMT INFO -- #2440872308 Features 23 - - - - - TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 #582699527 -TrigSignatureMoniMT INFO -- #582699527 Events 20 20 0 - - - - - 0 -TrigSignatureMoniMT INFO -- #582699527 Features 0 - - - - - +TrigSignatureMoniMT INFO -- #582699527 Events 20 20 8 - - - - - 8 +TrigSignatureMoniMT INFO -- #582699527 Features 23 - - - - - TrigSignatureMoniMT INFO HLT_j85_L1J20 #510475538 TrigSignatureMoniMT INFO -- #510475538 Events 19 19 13 - - - - - 13 TrigSignatureMoniMT INFO -- #510475538 Features 21 - - - - - @@ -289,6 +310,12 @@ TrigSignatureMoniMT INFO -- #782182242 Features TrigSignatureMoniMT INFO HLT_mu10_lateMu_L1MU10 #48780310 TrigSignatureMoniMT INFO -- #48780310 Events 10 10 0 0 - - - - 0 TrigSignatureMoniMT INFO -- #48780310 Features 0 0 - - - - +TrigSignatureMoniMT INFO HLT_mu11_mu6_bJpsimumu_L1MU11_2MU6 #2504965945 +TrigSignatureMoniMT INFO -- #2504965945 Events 4 4 4 0 3 0 - - 0 +TrigSignatureMoniMT INFO -- #2504965945 Features 8 0 6 0 - - +TrigSignatureMoniMT INFO HLT_mu11_mu6_bUpsimumu_L1MU11_2MU6 #1171632195 +TrigSignatureMoniMT INFO -- #1171632195 Events 4 4 4 0 3 0 - - 0 +TrigSignatureMoniMT INFO -- #1171632195 Features 8 0 6 0 - - TrigSignatureMoniMT INFO HLT_mu14_L1MU10 #1696906927 TrigSignatureMoniMT INFO -- #1696906927 Events 10 10 10 7 7 7 - - 7 TrigSignatureMoniMT INFO -- #1696906927 Features 13 8 8 8 - - @@ -467,17 +494,3 @@ TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #362 TrigSignatureMoniMT INFO -- #3626903018 Events 19 19 19 - - - - - 19 TrigSignatureMoniMT INFO -- #3626903018 Features 19 - - - - - TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #998713382 -TrigSignatureMoniMT INFO -- #998713382 Events 19 19 14 - - - - - 14 -TrigSignatureMoniMT INFO -- #998713382 Features 14 - - - - - -TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 -TrigSignatureMoniMT INFO -- #1583719916 Events 19 19 15 - - - - - 15 -TrigSignatureMoniMT INFO -- #1583719916 Features 15 - - - - - -TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 -TrigSignatureMoniMT INFO -- #2468872349 Events 19 19 17 - - - - - 17 -TrigSignatureMoniMT INFO -- #2468872349 Features 17 - - - - - -TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 #531141817 -TrigSignatureMoniMT INFO -- #531141817 Events 10 10 7 - - - - - 7 -TrigSignatureMoniMT INFO -- #531141817 Features 7 - - - - - -TrigSignatureMoniMT INFO HLT_xe65_cell_xe110_tcpufit_L1XE50 #115518400 -TrigSignatureMoniMT INFO -- #115518400 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #115518400 Features 3 - - - - - diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/testAthenaTrigRDOtoBS.py b/Trigger/TrigValidation/TrigAnalysisTest/share/testAthenaTrigRDOtoBS.py index b6cf602d3b8690c9ff3399b1214d2866dc3d3edc..fd7d9187b834baa885b09ea9631f9493ee872c5c 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/testAthenaTrigRDOtoBS.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/testAthenaTrigRDOtoBS.py @@ -69,6 +69,9 @@ TriggerFlags.doHLT=True include("RecExCommon/RecExCommon_topOptions.py") #----------------------------------------------------------- +from LumiBlockComps.LumiBlockMuWriterDefault import LumiBlockMuWriterDefault +LumiBlockMuWriterDefault() + #-----------------Monitoring and leak check----------------- jobproperties.PerfMonFlags.doMonitoring = True jobproperties.PerfMonFlags.OutputFile = "ntuple.root" diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py new file mode 100755 index 0000000000000000000000000000000000000000..b8f09eb57cc5804b4c166d632b6686c77a4b1036 --- /dev/null +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +# art-description: Test of transform RDO->RDO_TRIG->ESD->AOD->NTUP_PHYSVAL with serial athena (legacy trigger) and produce webdisplay +# art-type: grid +# art-include: master/Athena +# art-output: *.txt +# art-output: *.log +# art-output: log.* +# art-output: *.out +# art-output: *.err +# art-output: *.log.tar.gz +# art-output: *.new +# art-output: *.json +# art-output: *.root +# art-output: *.pmon.gz +# art-output: *perfmon* +# art-output: prmon* +# art-output: *.check* +# art-output: HLTconfig*.xml +# art-output: L1Topoconfig*.xml +# art-output: LVL1config*.xml +# art-output: PHYSVAL_WEB +# art-html: PHYSVAL_WEB + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps +import os + +# To run single-process transform on MCORE sites +if 'ATHENA_NPROC_NUM' in os.environ: + del os.environ['ATHENA_NPROC_NUM'] + +rdo2aod = ExecStep.ExecStep('RDOtoAOD') +rdo2aod.type = 'Reco_tf' +rdo2aod.input = 'ttbar' +rdo2aod.max_events = 500 +rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" --valid=True' +rdo2aod.args += ' --preExec="all:from TriggerJobOpts.TriggerFlags import TriggerFlags; TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\");"' + +physval = ExecStep.ExecStep('PhysVal') +physval.type = 'Reco_tf' +physval.input = '' +physval.explicit_input = True +physval.args = '--inputAODFile=AOD.pool.root --outputNTUP_PHYSVALFile=NTUP_PHYSVAL.pool.root --valid=True' + +validationFlags = 'doTrigEgamma,doTrigBphys,doTrigMET,doTrigJet,doTrigMuon,doTrigHLTResult,doTrigCalo,doTrigMinBias,doTrigTau,doTrigIDtrk,doTrigBjet' +physval.args += ' --validationFlags="{:s}"'.format(validationFlags) + +test = Test.Test() +test.art_type = 'grid' +test.exec_steps = [rdo2aod,physval] +test.check_steps = CheckSteps.default_check_steps(test) + + +download=CheckSteps.DownloadRefStep() +download.artpackage = 'TrigAnalysisTest' +download.artjobname = 'test_trigAna_PhysValWeb_grid.py' +download.required=True +test.check_steps.append(download) + + +if not os.path.exists('PHYSVAL_WEB'): + os.mkdir('PHYSVAL_WEB') + + +pv=[] +pv.append(['Tau','TauMon']) +pv.append(['Muon','MuonMon']) +pv.append(['ID','IDMon']) +pv.append(['Bphys','BphysMon']) +pv.append(['HLTCalo','HLTCaloESD']) +pv.append(['Result','Result']) +pv.append(['Bjet','BjetMon']) +pv.append(['MET','METMon']) +pv.append(['MinBias','MinBiasMon']) +pv.append(['Egamma','Egamma']) + +for slice in pv: + name='PhysValWeb'+slice[0] + sliceweb=CheckSteps.PhysValWebStep(name) + sliceweb.sig=slice[1] + sliceweb.required=True + test.check_steps.append(sliceweb) + +import sys +sys.exit(test.run()) + diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_decodeBS_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_decodeBS_build.py index 7a9755d9461797b72da112baecfda0338517f3dc..4489ac5f200d902814ee32f89e10680c43b3adf8 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_decodeBS_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Dev_decodeBS_build.py @@ -62,5 +62,16 @@ test.exec_steps = [writeBS, filterMain, decodeMain, filterCost, decodeCost] test.check_steps = CheckSteps.default_check_steps(test) test.get_step('CheckFile').input_file = 'ESD.pool.root,ESD.Module1.pool.root' +# Overwrite default MessageCount settings +# We are trying to lower the limits step by step +# Ultimately there should be no per-event messages +msgcount = test.get_step("MessageCount") +msgcount.thresholds = { + 'WARNING': 600, + 'INFO': 600, + 'other': 100 +} +msgcount.required = True # make the test exit code depend on this step + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/MinBias.py b/Trigger/TrigValidation/TrigUpgradeTest/share/MinBias.py deleted file mode 100644 index 4eff818e1afe886b363e37b548893ff7269f5ae8..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/MinBias.py +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# -createHLTMenuExternally=True -doWriteRDOTrigger = False -doWriteBS = False -include("TriggerJobOpts/runHLT_standalone.py") - -from TrigUpgradeTest.TestUtils import makeChain -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep -from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm - -chainName = "HLT_mb_sptrk_L1RD0_FILLED" - - -from TrigInDetConfig.InDetSetup import makeInDetAlgs -from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection, mapThresholdToL1DecisionCollection - -idAlgs = makeInDetAlgs(whichSignature='MinBias', separateTrackParticleCreator='MinBias', rois=mapThresholdToL1RoICollection('FSNOSEED')) - -from TrigT2MinBias.TrigT2MinBiasConf import TrigCountSpacePointsMT, SPCountHypoAlgMT, SPCountHypoTool -SpCount=TrigCountSpacePointsMT() -SpCount.OutputLevel= DEBUG -SpCount.SpacePointsKey="HLT_SpacePointCounts" - -SpCountHypo = SPCountHypoAlgMT() -SpCountHypo.OutputLevel= DEBUG - - -def generateSPCountHypo(chainDict): - hypo = SPCountHypoTool(chainDict["chainName"]) - # will set here thresholds - return hypo - - -SpCountHypo.HypoOutputDecisions="SPDecisions" -SpCountHypo.SpacePointsKey="HLT_SpacePointCounts" - -from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT, TrackCountHypoTool -TrackCountHypo=TrackCountHypoAlgMT() -TrackCountHypo.OutputLevel= DEBUG - - -TrackCountHypo.HypoInputDecisions="SPDecisions" -TrackCountHypo.HypoOutputDecisions="TrackCountDecisions" -TrackCountHypo.tracksKey="HLT_IDTrack_MinBias" -TrackCountHypo.trackCountKey="HLT_TrackCount" - - -from TrigMinBias.TrackCountMonitoringMT import TrackCountMonitoring -TrackCountHypo.MonTool = TrackCountMonitoring() - -def generateTrackCountHypo(chainDict): - hypo = TrackCountHypoTool(chainDict["chainName"]) - # will set here cuts - return hypo - -############### build menu -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence -from AthenaCommon.CFElements import parOR -from DecisionHandling.DecisionHandlingConf import InputMakerForRoI - -# TODO - split ID into two parts, one for SP counting another for the tracking, the tracking will go to the second step (Tracking) sequence -inputMakerSPCount = InputMakerForRoI(name="IMMinBiasSPCount", RoIs="HLT_MBSP") -Step1_SPCount = ChainStep( "Step1_SPCount", [MenuSequence( Maker=inputMakerSPCount, - Sequence=parOR("SPCountReco", [inputMakerSPCount]+idAlgs + [ SpCount ] ), - Hypo=SpCountHypo, HypoToolGen=generateSPCountHypo )] ) - - -inputMakerTrkCount = InputMakerForRoI(name="IMMinBiasTrkCount", RoIs="HLT_MBTRK") -Step2_TrkCount = ChainStep( "Step2_TrkCount", - [ MenuSequence( Maker=inputMakerTrkCount , - Sequence=parOR("TrkCountReco", [inputMakerTrkCount]), - Hypo=TrackCountHypo, - HypoToolGen=generateTrackCountHypo )] ) - -makeChain(chainName, ["FSNOSEED"], ChainSteps=[Step1_SPCount, Step2_TrkCount]) - -from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree -from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT -makeHLTTree( triggerConfigHLT=TriggerConfigHLT ) - - -from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON -generateJSON() diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py index 0f9c036c5f8b89f13e2ecf700def7d30b5c09c68..1096b4ac8db83606f5c0ac899a107f4051add242 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py @@ -181,13 +181,12 @@ if opt.doBjetSlice == True: jetSequence = jetMenuSequenceFromString("a4_tc_em_subjesgscIS_ftf") step1 = ChainStep("Step1_bjet", [jetSequence] ) - step2 = ChainStep("Step2_bjet", [getBJetSequence('j')]) - step3 = ChainStep("Step3_bjet", [getBJetSequence('btag')]) + step2 = ChainStep("Step2_bjet", [getBJetSequence()]) bjetChains = [ - makeChain(name='HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ), - makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ), - makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2,step3] ) + makeChain(name='HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2] ), + makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step1,step2] ), + makeChain(name='HLT_j45_ftf_subjesgscIS_bmv2c1070_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2] ) ] testChains += bjetChains @@ -247,31 +246,24 @@ if opt.doMETSlice == True: # B-physics and light states chains ################################################################## if opt.doBphysicsSlice == True: - from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muFastSequence, muEFSASequence, muEFCBSequence - from TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsSequenceSetup import dimuL2Sequence, dimuEFSequence - - BphysChains = [] - - step1mufast=ChainStep("Step1_muFast", [muFastSequence()]) - step2L2Dimu=ChainStep("Step2_L2Dimu", [dimuL2Sequence()]) - - #still to come - step3muEFSA=ChainStep("Step3_muEFSA", [ muEFSASequence() ]) - step4muEFCB=ChainStep("Step4_muEFCB", [ muEFCBSequence() ]) - step5EFDimu=ChainStep("Step5_EFDimu", [ dimuEFSequence() ]) - - BphysChains += [ makeChain(name='HLT_2mu4_bDimu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu, step3muEFSA, step4muEFCB, step5EFDimu])] - BphysChains += [ makeChain(name='HLT_2mu6_bJpsimumu_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2L2Dimu])] - BphysChains += [ makeChain(name='HLT_2mu4_bBmumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])] - BphysChains += [ makeChain(name='HLT_2mu4_bUpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])] - BphysChains += [ makeChain(name='HLT_2mu4_bJpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])] - - #BphysChains += [Chain(name='HLT_mu6_mu4_bJpsimumu_L1MU6_2MU4', ChainSteps=[ step1mufast, step2L2Dimu])] - #to come: step3muEFSA, step4muEFCB, step5EFJpsi])] - testChains += BphysChains - - + from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muFastSequence, muCombSequence, muEFSASequence, muEFCBSequence + from TrigBphysHypo.TrigMultiTrkComboHypoConfig import DimuL2ComboHypoCfg, DimuEFComboHypoCfg + + step1_dimufast=ChainStep("Step1_dimuFast", [muFastSequence()], multiplicity=[2]) + step2_dimuComb=ChainStep("Step2_dimuComb", [muCombSequence()], multiplicity=[2], comboHypoCfg=DimuL2ComboHypoCfg) + step3_dimuEFSA=ChainStep("Step3_dimuEFSA", [muEFSASequence()], multiplicity=[2]) + step4_dimuEFCB=ChainStep("Step4_dimuEFCB", [muEFCBSequence()], multiplicity=[2], comboHypoCfg=DimuEFComboHypoCfg) + steps = [step1_dimufast, step2_dimuComb, step3_dimuEFSA, step4_dimuEFCB] + + BphysChains = [ + makeChain(name='HLT_2mu4_bBmumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=steps), + makeChain(name='HLT_2mu4_bDimu_L12MU4', L1Thresholds=["MU4"], ChainSteps=steps), + makeChain(name='HLT_2mu4_bJpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=steps), + makeChain(name='HLT_2mu6_bJpsimumu_L12MU6', L1Thresholds=["MU6"], ChainSteps=steps), + makeChain(name='HLT_2mu4_bUpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=steps) + ] + testChains += BphysChains ################################################################## # combined chains diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref index 29f6ccc22ae727d76d0ee2102389fd8d5715da85..35ee4104663db648abf8c3be871daeb03494d958 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref @@ -53,14 +53,14 @@ TrigSignatureMoniMT INFO HLT_j45_L1J20 #12473361 TrigSignatureMoniMT INFO -- #1247336154 Events 0 0 - - - - - 0 TrigSignatureMoniMT INFO -- #1247336154 Features - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_L1J20 #4088855158 -TrigSignatureMoniMT INFO -- #4088855158 Events 0 0 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #4088855158 Features 0 0 0 - - +TrigSignatureMoniMT INFO -- #4088855158 Events 0 0 0 0 - - - 0 +TrigSignatureMoniMT INFO -- #4088855158 Features 0 0 - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 #991419339 -TrigSignatureMoniMT INFO -- #991419339 Events 0 0 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #991419339 Features 0 0 0 - - +TrigSignatureMoniMT INFO -- #991419339 Events 0 0 0 0 - - - 0 +TrigSignatureMoniMT INFO -- #991419339 Features 0 0 - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 #1961149049 -TrigSignatureMoniMT INFO -- #1961149049 Events 0 0 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #1961149049 Features 0 0 0 - - +TrigSignatureMoniMT INFO -- #1961149049 Events 0 0 0 0 - - - 0 +TrigSignatureMoniMT INFO -- #1961149049 Features 0 0 - - - TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 #215408633 TrigSignatureMoniMT INFO -- #215408633 Events 0 0 - - - - - 0 TrigSignatureMoniMT INFO -- #215408633 Features - - - - - diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py index 62aef38d630955eba06016ff2805b186b54b1b3b..29835f3dd108a30d3b575b0d047e19ae98cd966e 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py @@ -12,16 +12,16 @@ from AthenaCommon.AppMgr import theApp from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 -#Temporarily turning off ID geometery until the configuration is fully migrated +#Temporarily turning off ID geometery until the configuration is fully migrated flags.Detector.GeometryPixel = False -flags.Detector.GeometrySCT = False -flags.Detector.GeometryTRT = False +flags.Detector.GeometrySCT = False +flags.Detector.GeometryTRT = False flags.Detector.GeometryLAr = True -flags.Detector.GeometryTile = True -flags.Detector.GeometryMDT = True +flags.Detector.GeometryTile = True +flags.Detector.GeometryMDT = True flags.Detector.GeometryTGC = True -flags.Detector.GeometryCSC = True -flags.Detector.GeometryRPC = True +flags.Detector.GeometryCSC = True +flags.Detector.GeometryRPC = True # Output configuration - currently testing offline workflow flags.Trigger.writeBS = False @@ -38,9 +38,9 @@ assert setupMenuModule != None, "Could not import module {}".format(setupMenuPat assert setupMenuModule.setupMenu != None, "Could not import setupMenu from {}".format(setupMenuPath) flags.needFlagsCategory('Trigger') setupMenuModule.setupMenu(flags) - +flags.Exec.MaxEvents=50 flags.Input.isMC = False -flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] +flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] flags.Trigger.L1Decoder.forceEnableAllChains = True flags.Concurrency.NumThreads=1 @@ -94,4 +94,4 @@ print( "Storing config in the file {}".format( fname ) ) with open(fname, "wb") as p: acc.store( p ) p.close() -#acc.run(maxEvents=20) +acc.run() diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_minbias_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_minbias_build.sh deleted file mode 100755 index b40db9faa1f552612f73bd4ae3a0b99917ddc601..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_minbias_build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# art-description: athenaMT trigger test for min bias reconstruction algorithms. -# art-type: build -# art-include: master/Athena -# Skipping art-output which has no effect for build tests. -# If you create a grid version, check art-output in existing grid tests. - -export EVENTS=20 -export THREADS=1 -export SLOTS=1 -export JOBOPTION="TrigUpgradeTest/MinBias.py" - -# Skip dumping chain counts because this test doesn't produce the histogram including them -export SKIP_CHAIN_DUMP=1 - -source exec_TrigUpgradeTest_art_athenaMT.sh -source exec_TrigUpgradeTest_art_post.sh diff --git a/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h b/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h index 19bbd6e302f176ca071cf279da6c1b9775f71bea..f97bea0bd7cab35b60f5ce98150037f02e277d05 100644 --- a/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h +++ b/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGVALTOOLS_TROOTCOMPARE_H @@ -10,7 +10,6 @@ * @brief TRootCompare class * @author Frank Winklmeier * - * $Id: TRootCompare.h 702373 2015-10-22 13:55:56Z fwinkl $ */ #include "TFileLooper.h" @@ -52,7 +51,7 @@ class TRootCompare : public TFileLooper { Int_t missingHist() const { return m_histMissing; } private: - Bool_t compareHist(TH1& h, TH1& href); + Bool_t compareHist(const TH1& h, const TH1& href); void createDirectory(TFile* f, const char* dirpath); void printCanvas(const char* filename); diff --git a/Trigger/TrigValidation/TrigValTools/bin/messageCounter.py b/Trigger/TrigValidation/TrigValTools/bin/messageCounter.py index 8ec6e66ab29dd35021c1b04cab1cde5ba41ab9fc..44148ce9c9ce665e281d299c014c2df1892bc808 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/messageCounter.py +++ b/Trigger/TrigValidation/TrigValTools/bin/messageCounter.py @@ -49,6 +49,9 @@ def get_parser(): parser.add_argument('-p', '--printMessages', action='store_true', help='Print the messages found in analysed files') + parser.add_argument('--saveAll', + action='store_true', + help='Store all the messages into the output JSON file') parser.add_argument('-v', '--verbose', action='store_true', help='Increase output verbosity') @@ -113,12 +116,18 @@ def print_result(summary, full_result, print_messages=False): print(line, end='') # noqa: ATL901 -def save_to_json(result, filename): +def save_summary_to_json(result, filename): logging.info('Saving results to %s', filename) with open(filename, 'w') as f: json.dump(result, f, indent=4) +def save_all_to_json(full_result, filename): + logging.info('Saving results to %s', filename) + with open(filename, 'w') as f: + json.dump(full_result, f, indent=4) + + def main(): args = get_parser().parse_args() logging.basicConfig(stream=sys.stdout, @@ -141,7 +150,10 @@ def main(): summary = make_summary(messages) print_result(summary, messages, args.printMessages) out_file_name = 'MessageCount.{:s}.json'.format(fname) - save_to_json(summary, out_file_name) + save_summary_to_json(summary, out_file_name) + if args.saveAll: + all_out_file_name = 'Messages.{:s}.json'.format(fname) + save_all_to_json(messages, all_out_file_name) if '__main__' in __name__: diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py index a95790e796f3f0db078e2521e1b70499f93fd626..e88fbf285ef8366b0557537dbb40aaf5db2517e8 100644 --- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py +++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py @@ -17,7 +17,6 @@ import glob from TrigValTools.TrigValSteering.Step import Step from TrigValTools.TrigValSteering.Common import art_input_eos, art_input_cvmfs - class RefComparisonStep(Step): '''Base class for steps comparing a file to a reference''' @@ -413,6 +412,24 @@ class TailStep(Step): self.args += ' >'+self.output_name super(TailStep, self).configure(test) +class DownloadRefStep(Step): + '''Execute art.py download to downlaod results from previous day ''' + + def __init__(self, name='DownloadRefWeb'): + super(DownloadRefStep, self).__init__(name) + self.executable = 'art.py' + self.artpackage = ' ' + self.artjobname = ' ' + self.args = 'download ' + self.timeout = 20*60 + self.required = True + self.auto_report_result = True + + def configure(self, test): + self.args += ' '+self.artpackage+' '+self.artjobname + super(DownloadRefStep, self).configure(test) + + class HistCountStep(InputDependentStep): '''Execute histSizes.py to count histograms in a ROOT file''' @@ -428,6 +445,50 @@ class HistCountStep(InputDependentStep): super(HistCountStep, self).configure(test) +class PhysValWebStep(InputDependentStep): + '''Execute physval_make_web_display.py to make PhysVal web display from NTUP_PHYSVAL.root''' + + def __init__(self, name='PhysValWeb'): + super(PhysValWebStep, self).__init__(name) + self.input_file = 'NTUP_PHYSVAL.pool.root' + self.executable = 'physval_make_web_display.py' + self.refdir = ' ' + self.sig=' ' + self.args = '--ratio --drawopt HISTPE --refdrawopt HIST --title Test ' + self.auto_report_result = True + self.timeout = 30*60 + self.required = True + + def configure(self, test): + for fname in os.listdir('.'): + if fname.startswith('ref-'): + self.refdir = fname + refargs = ' --reffile Ref:'+self.refdir+'/NTUP_PHYSVAL.pool.root ' + outargs = ' --outdir PHYSVAL_WEB/'+self.sig + dirargs = ' --startpath run_1/HLT/'+self.sig + self.args += ' '+refargs+' '+outargs+' '+dirargs + self.args += ' '+self.input_file + super(PhysValWebStep, self).configure(test) + + def run(self, dry_run=False): + retcode, cmd = super(PhysValWebStep, self).run(dry_run) + fname='PHYSVAL_WEB/'+self.sig+'/index.html' + if os.path.exists(fname): + f=open(fname,"r") + nred=0 + for line in f: + if (line.find('Red') != -1): + nred+=1 + if nred > 0: + self.log.debug("red histograms in display for slice %s %d",self.sig,nred) + retcode+=nred + else: + retcode+=1000 + self.log.debug("missing index.html file for slice: %s ",self.sig) + self.report_result(retcode,"CheckWeb"+self.sig) + return retcode, cmd + + class ChainDumpStep(InputDependentStep): ''' Execute chainDump.py to print trigger counts from histograms to text files @@ -564,34 +625,36 @@ class MessageCountStep(Step): super(MessageCountStep, self).__init__(name) self.executable = 'messageCounter.py' self.log_regex = r'(athena\..*log$|athenaHLT:.*\.out$|^log\..*to.*)' + self.skip_logs = [] self.start_pattern = r'(HltEventLoopMgr|AthenaHiveEventLoopMgr).*INFO Starting loop on events' self.end_pattern = r'(HltEventLoopMgr.*INFO All events processed|AthenaHiveEventLoopMgr.*INFO.*Loop Finished)' - self.warning_threshold = None - self.info_threshold = None - self.debug_threshold = None - self.verbose_threshold = None - self.other_threshold = None + self.print_on_fail = None + self.thresholds = {} self.auto_report_result = True def configure(self, test): self.args += ' -s "{:s}"'.format(self.start_pattern) self.args += ' -e "{:s}"'.format(self.end_pattern) - if self.warning_threshold is None: - self.warning_threshold = 0 - if self.info_threshold is None: - self.info_threshold = test.exec_steps[0].max_events - if self.debug_threshold is None: - self.debug_threshold = 0 - if self.verbose_threshold is None: - self.verbose_threshold = 0 - if self.other_threshold is None: - self.other_threshold = test.exec_steps[0].max_events + if self.print_on_fail is None: + self.print_on_fail = self.required + if self.print_on_fail: + self.args += ' --saveAll' + if 'WARNING' not in self.thresholds: + self.thresholds['WARNING'] = 0 + if 'INFO' not in self.thresholds: + self.thresholds['INFO'] = test.exec_steps[0].max_events + if 'DEBUG' not in self.thresholds: + self.thresholds['DEBUG'] = 0 + if 'VERBOSE' not in self.thresholds: + self.thresholds['VERBOSE'] = 0 + if 'other' not in self.thresholds: + self.thresholds['other'] = test.exec_steps[0].max_events super(MessageCountStep, self).configure(test) def run(self, dry_run=False): files = os.listdir('.') r = re.compile(self.log_regex) - log_files = filter(r.match, files) + log_files = [f for f in filter(r.match, files) if f not in self.skip_logs] self.args += ' ' + ' '.join(log_files) auto_report = self.auto_report_result self.auto_report_result = False @@ -603,43 +666,28 @@ class MessageCountStep(Step): if self.auto_report_result: self.report_result() return self.result, cmd - (num_warning, num_info, num_debug, num_verbose, num_other) = (0, 0, 0, 0, 0) + for log_file in log_files: json_file = 'MessageCount.{:s}.json'.format(log_file) + if self.print_on_fail: + all_json_file = 'Messages.{:s}.json'.format(log_file) if not os.path.isfile(json_file): self.log.warning('%s cannot open file %s', self.name, json_file) with open(json_file) as f: summary = json.load(f) - num_warning += summary['WARNING'] - num_info += summary['INFO'] - num_debug += summary['DEBUG'] - num_verbose += summary['VERBOSE'] - num_other += summary['other'] - if num_warning > self.warning_threshold: - self.log.info( - '%s Number of WARNING messages %s is higher than threshold %s', - self.name, num_warning, self.warning_threshold) - self.result += 1 - if num_info > self.info_threshold: - self.log.info( - '%s Number of INFO messages %s is higher than threshold %s', - self.name, num_info, self.info_threshold) - self.result += 1 - if num_debug > self.debug_threshold: - self.log.info( - '%s Number of DEBUG messages %s is higher than threshold %s', - self.name, num_debug, self.debug_threshold) - self.result += 1 - if num_verbose > self.verbose_threshold: - self.log.info( - '%s Number of VERBOSE messages %s is higher than threshold %s', - self.name, num_verbose, self.verbose_threshold) - self.result += 1 - if num_other > self.other_threshold: - self.log.info( - '%s Number of "other" messages %s is higher than threshold %s', - self.name, num_other, self.other_threshold) - self.result += 1 + for level, threshold in six.iteritems(self.thresholds): + if summary[level] > threshold: + self.result += 1 + self.log.info( + '%s Number of %s messages %s is higher than threshold %s', + self.name, level, summary[level], threshold) + if self.print_on_fail: + self.log.info('%s Printing all %s messages', self.name, level) + with open(all_json_file) as af: + all_msg = json.load(af) + for msg in all_msg[level]: + print(msg.strip()) # noqa: ATL901 + if self.auto_report_result: self.report_result() return self.result, cmd @@ -734,6 +782,8 @@ def default_check_steps(test): # MessageCount msgcount = MessageCountStep('MessageCount') + for logmerge in [step for step in check_steps if isinstance(step, LogMergeStep)]: + msgcount.skip_logs.append(logmerge.merged_name) check_steps.append(msgcount) # Tail (probably not so useful these days) diff --git a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json index aaf83450d6815fb32b9f2009c7c0891fad27661d..8ce27fea098f1d93c6ad32f102b3f7328bc05070 100644 --- a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json +++ b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json @@ -85,6 +85,13 @@ "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigAnalysisTest/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091_tid10504490_00/HITS.10504490._000001.pool.root.1" ] }, + "munsw": { + "source": "mc", + "format": "RDO", + "paths": [ + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/group.det-muon.21185285.EXT1._000026.RDO.pool.root" + ] + }, "pileup_low": { "source": "mc", "format": "HITS", diff --git a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx index c5f2bf897e58ccf83718ff9b511d7e13ef3e07b2..e717ee8c09d46ca0a66ab90d0d20361b441521cc 100644 --- a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx +++ b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -7,7 +7,6 @@ * @brief TRootCompare implementation * @author Frank Winklmeier * - * $Id: TRootCompare.cxx,v 1.3 2008-11-06 12:05:07 fwinkl Exp $ */ #include "TrigValTools/TRootCompare.h" @@ -15,6 +14,7 @@ #include "TClass.h" #include "TKey.h" #include "TH1.h" +#include "TEfficiency.h" #include "TCanvas.h" #include "TVirtualPad.h" #include "TPaveStats.h" @@ -27,6 +27,7 @@ #include <iostream> #include <iomanip> #include <algorithm> +#include <memory> #include <math.h> using namespace std; @@ -123,182 +124,188 @@ void TRootCompare::processKey(TDirectory& dir, TKey& key) return; } - TObject* obj = key.ReadObj(); - if (obj->IsA()->InheritsFrom("TH1")) { - - // Extract directory name - TString dirName(dir.GetPath()); - dirName.Replace(0,dirName.First(":")+2,0); - if (rootDir()!="") dirName.ReplaceAll(rootDir(),m_refRootDir); - else dirName = m_refRootDir+"/"+dirName; - TString keyPath(dirName+"/"+key.GetName()); - - if (m_refFile->cd(dirName)) { - - if (TObject* refObj = m_refFile->Get(keyPath)) { - // Check if class types agree - if (obj->Class()!=refObj->Class()) { - cout << key.GetName() - << " is of different type in file and reference file." << endl; - return; - } + std::unique_ptr<TObject> obj(key.ReadObj()); - TH1& h = *((TH1*)obj); - TH1& href = *((TH1*)refObj); - Bool_t match = compareHist(h,href); - m_histTotal++; - if (match) { - m_histMatch++; - } - else { // histograms do not match - m_noMatch.push_back(keyPath.Data()); - - m_can->Clear(); - m_can->Divide(2,1); - m_can->cd(1)->SetPad(0,1,1,0.90); - m_can->cd(2)->SetPad(0,0.90,1,0); - TVirtualPad* pad = m_can->cd(2); + // Extract directory name + TString dirName(dir.GetPath()); + dirName.Replace(0,dirName.First(":")+2,0); + if (rootDir()!="") dirName.ReplaceAll(rootDir(),m_refRootDir); + else dirName = m_refRootDir+"/"+dirName; + TString keyPath(dirName+"/"+key.GetName()); + + if (!m_refFile->cd(dirName)) { // could not cd() into directory of histogram + m_histMissing++; + return; + } + + TObject* refObj = m_refFile->Get(keyPath); + if (!refObj) { // histogram not found + cout << "Cannot find " << keyPath << " in reference file" << endl; + m_histMissing++; + return; + } + + if (obj->Class()!=refObj->Class()) { // class types do not agree + cout << key.GetName() << " is of different type in file and reference file." << endl; + return; + } + + if (obj->IsA()->InheritsFrom("TH1")) { + TH1& h = *((TH1*)obj.get()); + TH1& href = *((TH1*)refObj); + Bool_t match = compareHist(h,href); + m_histTotal++; + if (match) { + m_histMatch++; + } + else { // histograms do not match + m_noMatch.push_back(keyPath.Data()); + + m_can->Clear(); + m_can->Divide(2,1); + m_can->cd(1)->SetPad(0,1,1,0.90); + m_can->cd(2)->SetPad(0,0.90,1,0); + TVirtualPad* pad = m_can->cd(2); - if (m_drawDiff) pad->Divide(2,1); - m_can->SetName(h.GetName()); - m_can->SetTitle(h.GetTitle()); - // Overlayed - pad->cd(1); - if (m_drawNormalized) { - if (href.Integral()) href.Scale(1/href.Integral()); - if (h.Integral()) h.Scale(1/h.Integral()); - } + if (m_drawDiff) pad->Divide(2,1); + m_can->SetName(h.GetName()); + m_can->SetTitle(h.GetTitle()); + // Overlayed + pad->cd(1); + if (m_drawNormalized) { + if (href.Integral()) href.Scale(1/href.Integral()); + if (h.Integral()) h.Scale(1/h.Integral()); + } - Double_t ymax = 1.05*max(h.GetMaximum(),href.GetMaximum()); - h.SetMaximum(ymax); - h.SetLineColor(kBlue); - h.Draw(); - m_can->Update(); - TPaveStats* st1 = (TPaveStats*)gPad->GetPrimitive("stats"); - if (st1) { - st1->SetName("stats1"); - st1->SetLineColor(kBlue); - } + Double_t ymax = 1.05*max(h.GetMaximum(),href.GetMaximum()); + h.SetMaximum(ymax); + h.SetLineColor(kBlue); + h.Draw(); + m_can->Update(); + TPaveStats* st1 = (TPaveStats*)gPad->GetPrimitive("stats"); + if (st1) { + st1->SetName("stats1"); + st1->SetLineColor(kBlue); + } - href.SetLineColor(kRed); - href.Draw("sames"); - m_can->Update(); - TPaveStats* st2 = (TPaveStats*)gPad->GetPrimitive("stats"); - if (st1 && st2) { - // Move stat box - Double_t x1 = st1->GetX1NDC()-0.01; - st2->SetName("stats2"); - Double_t w = st2->GetX2NDC()-st2->GetX1NDC(); - st2->SetX1NDC(x1-w); - st2->SetX2NDC(x1); - st2->SetLineColor(kRed); - m_can->Modified(); - } + href.SetLineColor(kRed); + href.Draw("sames"); + m_can->Update(); + TPaveStats* st2 = (TPaveStats*)gPad->GetPrimitive("stats"); + if (st1 && st2) { + // Move stat box + Double_t x1 = st1->GetX1NDC()-0.01; + st2->SetName("stats2"); + Double_t w = st2->GetX2NDC()-st2->GetX1NDC(); + st2->SetX1NDC(x1-w); + st2->SetX2NDC(x1); + st2->SetLineColor(kRed); + m_can->Modified(); + } - TH1* hdiff = 0; - if (m_drawDiff) { - hdiff = (TH1*)h.Clone(); - // Too many problems with difference of 2D histograms - if (hdiff->GetDimension()==1 && - hdiff->GetNbinsX()==href.GetNbinsX()) { - // Difference - pad->cd(2); - hdiff->SetName(TString(href.GetName())+" (diff)"); - hdiff->SetTitle(TString(href.GetTitle())+" (diff)"); - hdiff->SetLineColor(kBlack); - hdiff->Add(&href,-1); - hdiff->Draw(); - TPaveStats* st = (TPaveStats*)gPad->GetPrimitive("stats1"); - if (st) st->SetLineColor(kBlack); - } - if(hdiff->GetDimension()==2 && - hdiff->GetNbinsX()==href.GetNbinsX() && - hdiff->GetNbinsY()==href.GetNbinsY()) { - pad->cd(2); - hdiff->SetName(TString(href.GetName())+" (diff)"); - hdiff->SetTitle(TString(href.GetTitle())+" (diff)"); - hdiff->SetLineColor(kBlack); - hdiff->Add(&href,-1); - if(hdiff->GetXaxis()->GetLabels()!=0 && hdiff->GetNbinsX()>100) { - TH1 * hdiffred = (TH1*)hdiff->Clone(); - hdiffred->GetXaxis()->GetLabels()->Delete(); - hdiffred->Reset(); - hdiffred->SetName(TString(href.GetName())+" (diff reduced)"); - hdiffred->SetTitle(TString(href.GetTitle())+" (diff reduced)"); - int targetbin=1; - for(int x=1; x<=hdiff->GetNbinsX(); ++x) { - bool isEmpty(true); - for(int y=1;y<=hdiff->GetNbinsY();++y) { - if(hdiff->GetBinContent(x,y)!=0) { isEmpty=false; break; } - } - if(!isEmpty) { - for(int y=1;y<=hdiff->GetNbinsY();++y) { - if(hdiff->GetBinContent(x,y)!=0) - hdiffred->SetBinContent(targetbin,y,hdiff->GetBinContent(x,y)); - } - hdiffred->GetXaxis()->SetBinLabel(targetbin,hdiff->GetXaxis()->GetBinLabel(x)); - targetbin++; - } - } - hdiffred->LabelsDeflate(); - hdiffred->Draw("text"); - } else { - hdiff->Draw("text"); + TH1* hdiff = 0; + if (m_drawDiff) { + hdiff = (TH1*)h.Clone(); + // Too many problems with difference of 2D histograms + if (hdiff->GetDimension()==1 && + hdiff->GetNbinsX()==href.GetNbinsX()) { + // Difference + pad->cd(2); + hdiff->SetName(TString(href.GetName())+" (diff)"); + hdiff->SetTitle(TString(href.GetTitle())+" (diff)"); + hdiff->SetLineColor(kBlack); + hdiff->Add(&href,-1); + hdiff->Draw(); + TPaveStats* st = (TPaveStats*)gPad->GetPrimitive("stats1"); + if (st) st->SetLineColor(kBlack); + } + if(hdiff->GetDimension()==2 && + hdiff->GetNbinsX()==href.GetNbinsX() && + hdiff->GetNbinsY()==href.GetNbinsY()) { + pad->cd(2); + hdiff->SetName(TString(href.GetName())+" (diff)"); + hdiff->SetTitle(TString(href.GetTitle())+" (diff)"); + hdiff->SetLineColor(kBlack); + hdiff->Add(&href,-1); + if(hdiff->GetXaxis()->GetLabels()!=0 && hdiff->GetNbinsX()>100) { + TH1 * hdiffred = (TH1*)hdiff->Clone(); + hdiffred->GetXaxis()->GetLabels()->Delete(); + hdiffred->Reset(); + hdiffred->SetName(TString(href.GetName())+" (diff reduced)"); + hdiffred->SetTitle(TString(href.GetTitle())+" (diff reduced)"); + int targetbin=1; + for(int x=1; x<=hdiff->GetNbinsX(); ++x) { + bool isEmpty(true); + for(int y=1;y<=hdiff->GetNbinsY();++y) { + if(hdiff->GetBinContent(x,y)!=0) { isEmpty=false; break; } + } + if(!isEmpty) { + for(int y=1;y<=hdiff->GetNbinsY();++y) { + if(hdiff->GetBinContent(x,y)!=0) + hdiffred->SetBinContent(targetbin,y,hdiff->GetBinContent(x,y)); + } + hdiffred->GetXaxis()->SetBinLabel(targetbin,hdiff->GetXaxis()->GetBinLabel(x)); + targetbin++; } - TPaveStats* st = (TPaveStats*)gPad->GetPrimitive("stats1"); - if (st) st->SetLineColor(kBlack); } + hdiffred->LabelsDeflate(); + hdiffred->Draw("text"); + } else { + hdiff->Draw("text"); } + TPaveStats* st = (TPaveStats*)gPad->GetPrimitive("stats1"); + if (st) st->SetLineColor(kBlack); + } + } - // Some more cosmetics before saving to ps file - m_can->cd(0); - TText text; - text.SetTextSize(0.03); - text.SetTextAlign(22); - TString page("page "); - page += m_noMatch.size(); - text.DrawTextNDC(0.5,0.03,page); - - TString title(dir.GetName()); - title+="/"; - title+=href.GetName(); - text.DrawTextNDC(0.5,0.99,title); - - const int maxchars = 120; // max #chars for title - if (m_file) { - text.SetTextColor(kBlue); - string s(m_file->GetName()); - text.DrawTextNDC(0.5,0.93,s.substr(max(0,int(s.size()-maxchars))).c_str()); - } - if (m_refFile) { - text.SetTextColor(kRed); - string s(m_refFile->GetName()); - text.DrawTextNDC(0.5,0.96,s.substr(max(0,int(s.size()-maxchars))).c_str()); - } + // Some more cosmetics before saving to ps file + m_can->cd(0); + TText text; + text.SetTextSize(0.03); + text.SetTextAlign(22); + TString page("page "); + page += m_noMatch.size(); + text.DrawTextNDC(0.5,0.03,page); + + TString title(dir.GetName()); + title+="/"; + title+=href.GetName(); + text.DrawTextNDC(0.5,0.99,title); + + const int maxchars = 120; // max #chars for title + if (m_file) { + text.SetTextColor(kBlue); + string s(m_file->GetName()); + text.DrawTextNDC(0.5,0.93,s.substr(max(0,int(s.size()-maxchars))).c_str()); + } + if (m_refFile) { + text.SetTextColor(kRed); + string s(m_refFile->GetName()); + text.DrawTextNDC(0.5,0.96,s.substr(max(0,int(s.size()-maxchars))).c_str()); + } - if (m_psFile!="") printCanvas(m_psFile); + if (m_psFile!="") printCanvas(m_psFile); - // Save canvas to root file - if (m_outFile) { - createDirectory(m_outFile,dirName); // now we are in dirName - m_can->Write(); - } - - if (hdiff) delete hdiff; - } - } - else { // histogram not found - cout << "Cannot find " << keyPath << " in reference file" << endl; - m_histMissing++; + // Save canvas to root file + if (m_outFile) { + createDirectory(m_outFile,dirName); // now we are in dirName + m_can->Write(); } - } - else { // could not cd() into directory of histogram - m_histMissing++; - // TFile::cd() is already printing a similar message - //cout << "Cannot find directory " << dirName << " in reference file" << endl; + + if (hdiff) delete hdiff; } } - delete obj; + else if (obj->IsA()->InheritsFrom("TEfficiency")) { + auto h = (TEfficiency*)obj.get(); + auto href = (TEfficiency*)refObj; + Bool_t match = compareHist(*h->GetTotalHistogram(),*href->GetTotalHistogram()) && + compareHist(*h->GetPassedHistogram(),*href->GetPassedHistogram()); + m_histTotal++; + + // We only count (mis)matches but do not draw the difference for TEfficiency (yet) + if (match) m_histMatch++; + else m_noMatch.push_back(keyPath.Data()); + } } @@ -366,7 +373,7 @@ void TRootCompare::printCanvas(const char* filename) } -Bool_t TRootCompare::compareHist(TH1& h, TH1& href) +Bool_t TRootCompare::compareHist(const TH1& h, const TH1& href) { Bool_t result = kTRUE; @@ -399,9 +406,9 @@ Bool_t TRootCompare::compareHist(TH1& h, TH1& href) } else if (m_alg==TRootCompare::AXIS) { if (verbose()) cout << "AXIS: "; - TAxis *xa(h.GetXaxis()), *xaref(href.GetXaxis()); - TAxis *ya(h.GetXaxis()), *yaref(href.GetXaxis()); - TAxis *za(h.GetXaxis()), *zaref(href.GetXaxis()); + const TAxis *xa(h.GetXaxis()), *xaref(href.GetXaxis()); + const TAxis *ya(h.GetXaxis()), *yaref(href.GetXaxis()); + const TAxis *za(h.GetXaxis()), *zaref(href.GetXaxis()); if( xa->GetNbins() != xaref->GetNbins() ) result = kFALSE; if( result && (ya->GetNbins() != yaref->GetNbins()) ) result = kFALSE; if( result && (za->GetNbins() != zaref->GetNbins()) ) result = kFALSE; diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index cedc2fd9ca3d894bf5acfa08b20785cd94901094..d4fb1e7343a16e1cc55c52d60a88498d1bebd85e 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -22,12 +22,30 @@ TrigSignatureMoniMT INFO -- #3965466087 Features TrigSignatureMoniMT INFO HLT_2j330_a10t_lcw_jes_35smcINF_L1J100 #1295975955 TrigSignatureMoniMT INFO -- #1295975955 Events 20 20 0 - - - - - 0 TrigSignatureMoniMT INFO -- #1295975955 Features 0 - - - - - +TrigSignatureMoniMT INFO HLT_2j60_L1J15 #927735533 +TrigSignatureMoniMT INFO -- #927735533 Events 20 20 0 - - - - - 0 +TrigSignatureMoniMT INFO -- #927735533 Features 0 - - - - - +TrigSignatureMoniMT INFO HLT_2mu10_bJpsimumu_L12MU10 #3498558358 +TrigSignatureMoniMT INFO -- #3498558358 Events 20 20 0 0 0 0 - - 0 +TrigSignatureMoniMT INFO -- #3498558358 Features 0 0 0 0 - - +TrigSignatureMoniMT INFO HLT_2mu10_bUpsimumu_L12MU10 #234102568 +TrigSignatureMoniMT INFO -- #234102568 Events 20 20 0 0 0 0 - - 0 +TrigSignatureMoniMT INFO -- #234102568 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 #2619091790 TrigSignatureMoniMT INFO -- #2619091790 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #2619091790 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 #557204938 TrigSignatureMoniMT INFO -- #557204938 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #557204938 Features 0 0 0 0 - - +TrigSignatureMoniMT INFO HLT_2mu4_bDimu_L12MU4 #1730084172 +TrigSignatureMoniMT INFO -- #1730084172 Events 20 20 1 1 0 0 - - 0 +TrigSignatureMoniMT INFO -- #1730084172 Features 4 2 0 0 - - +TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 #4276347155 +TrigSignatureMoniMT INFO -- #4276347155 Events 20 20 1 1 0 0 - - 0 +TrigSignatureMoniMT INFO -- #4276347155 Features 4 2 0 0 - - +TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 #4008168535 +TrigSignatureMoniMT INFO -- #4008168535 Events 20 20 1 1 0 0 - - 0 +TrigSignatureMoniMT INFO -- #4008168535 Features 4 2 0 0 - - TrigSignatureMoniMT INFO HLT_2mu4_muonqual_L12MU4 #1584776935 TrigSignatureMoniMT INFO -- #1584776935 Events 20 20 1 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #1584776935 Features 4 0 0 0 - - @@ -70,6 +88,9 @@ TrigSignatureMoniMT INFO -- #1175391812 Features TrigSignatureMoniMT INFO HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15 #3989372080 TrigSignatureMoniMT INFO -- #3989372080 Events 20 20 20 20 - - - - 20 TrigSignatureMoniMT INFO -- #3989372080 Features 20 20 - - - - +TrigSignatureMoniMT INFO HLT_beamspot_trkFS_trkfast_BeamSpotPEB_L1J15 #628534730 +TrigSignatureMoniMT INFO -- #628534730 Events 20 20 20 20 - - - - 20 +TrigSignatureMoniMT INFO -- #628534730 Features 20 20 - - - - TrigSignatureMoniMT INFO HLT_costmonitor_CostMonDS_L1All #843341480 TrigSignatureMoniMT INFO -- #843341480 Events 20 20 20 - - - - - 20 TrigSignatureMoniMT INFO -- #843341480 Features 20 - - - - - @@ -274,6 +295,9 @@ TrigSignatureMoniMT INFO -- #436385969 Features TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20 #3634067472 TrigSignatureMoniMT INFO -- #3634067472 Events 20 20 0 - - - - - 0 TrigSignatureMoniMT INFO -- #3634067472 Features 0 - - - - - +TrigSignatureMoniMT INFO HLT_j80_L1J15 #2440872308 +TrigSignatureMoniMT INFO -- #2440872308 Events 20 20 3 - - - - - 3 +TrigSignatureMoniMT INFO -- #2440872308 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 #582699527 TrigSignatureMoniMT INFO -- #582699527 Events 20 20 0 - - - - - 0 TrigSignatureMoniMT INFO -- #582699527 Features 0 - - - - - @@ -298,6 +322,12 @@ TrigSignatureMoniMT INFO -- #782182242 Features TrigSignatureMoniMT INFO HLT_mu10_lateMu_L1MU10 #48780310 TrigSignatureMoniMT INFO -- #48780310 Events 20 20 0 0 - - - - 0 TrigSignatureMoniMT INFO -- #48780310 Features 0 0 - - - - +TrigSignatureMoniMT INFO HLT_mu11_mu6_bJpsimumu_L1MU11_2MU6 #2504965945 +TrigSignatureMoniMT INFO -- #2504965945 Events 20 20 0 0 0 0 - - 0 +TrigSignatureMoniMT INFO -- #2504965945 Features 0 0 0 0 - - +TrigSignatureMoniMT INFO HLT_mu11_mu6_bUpsimumu_L1MU11_2MU6 #1171632195 +TrigSignatureMoniMT INFO -- #1171632195 Events 20 20 0 0 0 0 - - 0 +TrigSignatureMoniMT INFO -- #1171632195 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_mu14_L1MU10 #1696906927 TrigSignatureMoniMT INFO -- #1696906927 Events 20 20 1 1 0 0 - - 0 TrigSignatureMoniMT INFO -- #1696906927 Features 1 1 0 0 - - @@ -514,6 +544,15 @@ TrigSignatureMoniMT INFO -- #48519027 Features TrigSignatureMoniMT INFO HLT_noalg_cosmiccalo_L1RD1_EMPTY #3925252528 TrigSignatureMoniMT INFO -- #3925252528 Events 20 20 - - - - - - 20 TrigSignatureMoniMT INFO -- #3925252528 Features - - - - - - +TrigSignatureMoniMT INFO HLT_noalg_idmon_L1RD0_EMPTY #56818284 +TrigSignatureMoniMT INFO -- #56818284 Events 20 20 - - - - - - 20 +TrigSignatureMoniMT INFO -- #56818284 Features - - - - - - +TrigSignatureMoniMT INFO HLT_noalg_idmon_L1RD0_FILLED #1198298874 +TrigSignatureMoniMT INFO -- #1198298874 Events 20 20 - - - - - - 20 +TrigSignatureMoniMT INFO -- #1198298874 Features - - - - - - +TrigSignatureMoniMT INFO HLT_noalg_idmon_L1RD0_UNPAIRED_ISO #2536676873 +TrigSignatureMoniMT INFO -- #2536676873 Events 20 20 - - - - - - 20 +TrigSignatureMoniMT INFO -- #2536676873 Features - - - - - - TrigSignatureMoniMT INFO HLT_sct_noise_SCTPEB_L1RD0_EMPTY #3024203296 TrigSignatureMoniMT INFO -- #3024203296 Events 20 20 20 - - - - - 20 TrigSignatureMoniMT INFO -- #3024203296 Features 20 - - - - - diff --git a/Trigger/TrigValidation/TriggerTest/share/testLVL1CTPAthenaTrigRDO.py b/Trigger/TrigValidation/TriggerTest/share/testLVL1CTPAthenaTrigRDO.py index fa219cefafd1ca2e91f772d75c007acfb5454004..75190797d1a6db70251484e2dda79e097a5e484b 100644 --- a/Trigger/TrigValidation/TriggerTest/share/testLVL1CTPAthenaTrigRDO.py +++ b/Trigger/TrigValidation/TriggerTest/share/testLVL1CTPAthenaTrigRDO.py @@ -65,6 +65,9 @@ GenerateMenu.overwriteSignaturesWith(L1Only) include("RecExCommon/RecExCommon_topOptions.py") #----------------------------------------------------------- +from LumiBlockComps.LumiBlockMuWriterDefault import LumiBlockMuWriterDefault +LumiBlockMuWriterDefault() + #------------------------------------------------------------ include("TriggerTest/TriggerTestCommon.py") #------------------------------------------------------------ diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py index 944198e03f0a78ef14436f3d66fa83f87b68de00..294ddd653436181de53b553d95a3cca80e18d3ea 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_build.py @@ -19,6 +19,7 @@ precommand = ''.join([ "doWriteRDOTrigger=True;", "forceEnableAllChains=True;", "fpeAuditor=True;", + "failIfNoProxy=True;" ]) ex.args = '-c "{:s}"'.format(precommand) @@ -31,9 +32,11 @@ test.check_steps = CheckSteps.default_check_steps(test) # We are trying to lower the limits step by step # Ultimately there should be no per-event messages msgcount = test.get_step("MessageCount") -msgcount.warning_threshold = 500 -msgcount.info_threshold = 1200 -msgcount.other_threshold = 80 +msgcount.thresholds = { + 'WARNING': 500, + 'INFO': 1200, + 'other': 80 +} msgcount.required = True # make the test exit code depend on this step # Add a step comparing counts in the log against reference diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py index 3985766c50c9aabaa822451989333685a22b7151..6615674ef96580bba7a484061c097906797f28f5 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_emptyMenu_build.py @@ -36,9 +36,11 @@ test.check_steps.remove(test.get_step("ZeroCounts")) # Overwrite default MessageCount settings msgcount = test.get_step("MessageCount") -msgcount.warning_threshold = 40 -msgcount.info_threshold = 600 -msgcount.other_threshold = 40 +msgcount.thresholds = { + 'WARNING': 40, + 'INFO': 600, + 'other': 40 +} msgcount.required = True # make the test exit code depend on this step import sys diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py index 162f8bb514118dceb06985d31c39a5c61f49784e..92d4f2b0bec1f18b53240c033f24a9066194d249 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py @@ -13,8 +13,13 @@ ex.type = 'athena' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'ttbar' ex.threads = 1 -# LS2_v1 soon to be renamed to Dev_pp_run3_v1 -ex.args = '-c "setMenu=\'LS2_v1\';doWriteBS=False;doWriteRDOTrigger=True;"' +precommand = ''.join([ + "setMenu='LS2_v1';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "doWriteBS=False;", + "doWriteRDOTrigger=True;", + "fpeAuditor=True;" +]) +ex.args = '-c "{:s}"'.format(precommand) test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py similarity index 63% rename from Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py rename to Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py index 14336b4b97fe47847f28fcec75321e1f8f7b78ca..2075544fbae5e465f6dd3560f9b9341d10224916 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_deps_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py @@ -11,13 +11,12 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps ex = ExecStep.ExecStep() ex.type = 'athena' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' -ex.input = 'data' +ex.input = 'ttbar' ex.threads = 1 precommand = ''.join([ "setMenu='LS2_v1';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 "doWriteBS=False;", "doWriteRDOTrigger=True;", - "forceEnableAllChains=True;", "fpeAuditor=True;", "failIfNoProxy=True;" ]) @@ -27,13 +26,5 @@ test = Test.Test() test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) - -# Add a step comparing counts in the log against reference from test_trig_data_v1Dev_build -refcomp = CheckSteps.RegTestStep("CountRefComp") -refcomp.regex = 'TrigSignatureMoniMT.*HLT_.*|TrigSignatureMoniMT.*-- #[0-9]+ (Events|Features).*' -refcomp.reference = 'TriggerTest/ref_data_v1Dev_build.ref' -refcomp.required = True # Final exit code depends on this step -CheckSteps.add_step_after_type(test.check_steps, CheckSteps.LogMergeStep, refcomp) - import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_build.py new file mode 100755 index 0000000000000000000000000000000000000000..08a9b826af05951ec293b76511e94ed883398e22 --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_build.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# art-description: Trigger RDO->RDO_TRIG athena test of the muon slice in Dev_pp_run3_v1 menu +# art-type: build +# art-include: master/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athena' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'munsw' +ex.threads = 1 +# LS2_v1 soon to be renamed to Dev_pp_run3_v1 +ex.args = '-c "setMenu=\'LS2_v1\';doEmptyMenu=True;doMuonSlice=True;doWriteBS=False;doWriteRDOTrigger=True;setDetDescr=\'ATLAS-R3-2021-01-00-00\'"' + +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_grid.py new file mode 100755 index 0000000000000000000000000000000000000000..8a323d77cd440e3629b6d9db5946a9af57d45cf4 --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_slice_muonNSW_grid.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# art-description: Trigger RDO->RDO_TRIG athena test of the muon slice in Dev_pp_run3_v1 menu +# art-type: grid +# art-include: master/Athena +# art-output: *.txt +# art-output: *.log +# art-output: log.* +# art-output: *.out +# art-output: *.err +# art-output: *.log.tar.gz +# art-output: *.new +# art-output: *.json +# art-output: *.root +# art-output: *.pmon.gz +# art-output: *perfmon* +# art-output: prmon* +# art-output: *.check* + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athena' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'munsw' +ex.threads = 1 +# LS2_v1 soon to be renamed to Dev_pp_run3_v1 +ex.args = '-c "setMenu=\'LS2_v1\';doEmptyMenu=True;doMuonSlice=True;doWriteBS=False;doWriteRDOTrigger=True;setDetDescr=\'ATLAS-R3-2021-01-00-00\'"' + +test = Test.Test() +test.art_type = 'grid' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +import sys +sys.exit(test.run()) diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 0f7290e9661f78897eb45f0e6c9723ad53400cb1..fb25b0aa4566ce45a28ceaf2d9091e76e11c2ebf 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -157,8 +157,8 @@ TriggerHLTListRun3 = [ ('xAOD::TrackParticleContainer#HLT_IDTrack_Muon_FTF', 'BS ESD AODFULL', 'Muon', 'inViews:MUCombViewRoIs'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Muon_FTFAux.', 'BS ESD AODFULL', 'Muon'), - ('xAOD::TrackParticleContainer#HLT_IDTrack_Muon_IDTrig', 'BS ESD AODFULL', 'Muon', 'inViews:MUEFCBViewRoIs'), - ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Muon_IDTrigAux.', 'BS ESD AODFULL', 'Muon'), + ('xAOD::TrackParticleContainer#HLT_IDTrack_Muon_IDTrig', 'BS ESD AODFULL AODSLIM', 'Muon', 'inViews:MUEFCBViewRoIs'), + ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Muon_IDTrigAux.', 'BS ESD AODFULL AODSLIM', 'Muon'), ('xAOD::TrackParticleContainer#HLT_IDTrack_MuonFS_FTF', 'BS ESD AODFULL', 'Muon', 'inViews:MUCBFSViews'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_MuonFS_FTFAux.', 'BS ESD AODFULL', 'Muon'), @@ -180,10 +180,8 @@ TriggerHLTListRun3 = [ # bphys - ('xAOD::TrigBphysContainer#TrigBphysDimu', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), - ('xAOD::TrigBphysAuxContainer#TrigBphysDimuAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), - ('xAOD::TrigBphysContainer#TrigBphysEFDimu', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), - ('xAOD::TrigBphysAuxContainer#TrigBphysEFDimuAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), + ('xAOD::TrigBphysContainer#HLT_DimuEF', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), + ('xAOD::TrigBphysAuxContainer#HLT_DimuEFAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Bphys'), # xAOD muons (msonly (x2: roi+FS), combined (x3: FS+RoI (outside-in, inside-out+outside-in)) ('xAOD::MuonContainer#HLT_Muons_RoI', 'BS ESD AODFULL', 'Muon', 'inViews:MUEFSAViewRoIs'), @@ -304,6 +302,12 @@ TriggerHLTListRun3 = [ ('xAOD::TrackParticleContainer#HLT_IDTrack_FS_FTF', 'BS ESD AODFULL', 'Jet'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_FS_FTFAux.', 'BS ESD AODFULL', 'Jet'), + # custom BeamSpot tracks - we don't want to write these out in general so this + # is commented, if we want to write them out at some point, then these lines + # should be uncommented and they should get written out + # ('xAOD::TrackParticleContainer#HLT_IDTrack_BeamSpot_FTF', 'BS ESD AODFULL', 'ID', 'inViews:beamspotViewRoIs' ), + # ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_BeamSpot_FTFAux.', 'BS ESD AODFULL', 'ID', 'inViews:beamspotViewRoIs' ), + # MET ('xAOD::TrigMissingETContainer#HLT_MET_cell', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), ('xAOD::TrigMissingETAuxContainer#HLT_MET_cellAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), @@ -358,6 +362,9 @@ TriggerHLTListRun3 = [ ('xAOD::TauTrackContainer#HLT_tautrack_Presel', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau', 'inViews:TAUFTFTrackViews'), ('xAOD::TauTrackAuxContainer#HLT_tautrack_PreselAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau'), + # bjet RoI Descriptor used for EventView creation + ('TrigRoiDescriptorCollection#HLT_Roi_Bjet', 'BS ESD AODFULL', 'Bjet'), + # bjet Second Stage Fast tracks ('xAOD::TrackParticleContainer#HLT_IDTrack_Bjet_FTF', 'BS ESD AODFULL', 'Bjet', 'inViews:BTagViews'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Bjet_FTFAux.', 'BS ESD AODFULL', 'Bjet'), diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py index 24807797325acbe613679dc0bd242c1ec8e10133..35af30f752df8d5914b7df0baecf7f022ef598be 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.Logging import logging @@ -222,14 +222,13 @@ class ByteStreamUnpackGetterRun2(Configured): # Configure DataScouting # from PyUtils.MetaReaderPeeker import metadata - - stream_local = metadata['stream'] - - if stream_local.startswith('calibration_DataScouting_') or TriggerFlags.doAlwaysUnpackDSResult(): - if 'calibration' in stream_local and 'DataScouting_' in stream_local: - ds_tag = stream_local[12:27] - ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [ "HLT::HLTResult/"+ds_tag ] - extr.DSResultKeys += [ ds_tag ] + if 'stream' in metadata: + stream_local = metadata['stream'] + if stream_local.startswith('calibration_DataScouting_') or TriggerFlags.doAlwaysUnpackDSResult(): + if 'calibration' in stream_local and 'DataScouting_' in stream_local: + ds_tag = stream_local[12:27] + ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [ "HLT::HLTResult/"+ds_tag ] + extr.DSResultKeys += [ ds_tag ] else: #if data doesn't have HLT info set HLTResult keys as empty strings to avoid warnings @@ -489,43 +488,30 @@ class HLTTriggerResultGetter(Configured): log.info("AOD list is subset of ESD list - good.") - def _addSlimming(stream, thinningSvc, edm): - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimming - from TrigNavTools.TrigNavToolsConfig import navigationSlimming + def _addSlimming(stream, edm): + from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names - # from HLT result drop unrecorded features - # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream) - slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream) - tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', - 'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT', - 'features':edmlist}) - tHLT.ActInPlace=True - slimmerHLT.ThinningTool = tHLT - slimmerHLT.ExtraInputs = [('xAOD::TrigNavigation','StoreGateSvc+TrigNavigation')] - topSequence += slimmerHLT - log.info("Configured slimming of HLT") - print(slimmerHLT.ThinningTool) # noqa: ATL901 + svc = navigationThinningSvc ({'name':'HLTNav_%s'%stream, 'mode':'cleanup', + 'result':'HLTResult_HLT', + 'features':edmlist}) + + from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc + registerTrigNavThinningSvc (stream, svc) + + log.info("Configured slimming of HLT for %s", stream) + print(svc) # noqa: ATL901 del edmlist - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - from AthenaServices.Configurables import ThinningSvc - if TriggerFlags.doNavigationSlimming() and rec.readRDO() and rec.doWriteAOD(): - if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs - svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD']) - _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD! + _addSlimming('StreamAOD', _TriggerESDList ) #Use ESD item list also for AOD! log.info("configured navigation slimming for AOD output") if TriggerFlags.doNavigationSlimming() and rec.readRDO() and rec.doWriteESD(): - if not hasattr(svcMgr, 'ESDThinningSvc'): - svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs - _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList ) - log.info("configured navigation slimming for ESD output") + _addSlimming('StreamESD', _TriggerESDList ) + log.info("configured navigation slimming for ESD output") diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index adf28d4c4f03c71ea0bbb4c4a83b1e19267b8614..75d886bf62c96925b3c623421204c3c0f5918220 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -1,5 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from collections import OrderedDict from builtins import str @@ -8,8 +7,6 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.CFElements import seqAND, seqOR, flatAlgorithmSequences, getSequenceChildren, isSequence, hasProp, getProp from AthenaCommon.Logging import logging __log = logging.getLogger('TriggerConfig') -from AthenaCommon.Constants import DEBUG -__log.setLevel(DEBUG) import six def __isCombo(alg): return hasProp( alg, "MultiplicitiesMap" ) # alg.getType() == 'ComboHypo': @@ -53,7 +50,7 @@ def collectHypos( steps ): def __decisionsFromHypo( hypo ): """ return all chains served by this hypo and the key of produced decision object """ from TrigCompositeUtils.TrigCompositeUtils import isLegId - __log.info("Hypo type is combo {}".format( __isCombo( hypo ) ) ) + __log.debug("Hypo type is combo {}".format( __isCombo( hypo ) ) ) if __isCombo( hypo ): return [key for key in list(hypo.MultiplicitiesMap.keys()) if not isLegId(key)], hypo.HypoOutputDecisions[0] else: # regular hypos @@ -288,7 +285,12 @@ def triggerOutputCfg(flags, decObj, decObjHypoOut, summaryAlg): # For now use old svcMgr interface as this service is not available from acc.getService() from AthenaCommon.AppMgr import ServiceMgr as svcMgr hltEventLoopMgr = svcMgr.HltEventLoopMgr - hltEventLoopMgr.ResultMaker.MakerTools = [conf2toConfigurable(t) for t in acc.popPrivateTools()] + hltEventLoopMgr.ResultMaker.MakerTools = [] + for tool in acc.popPrivateTools(): + if 'StreamTagMaker' in tool.getName(): + hltEventLoopMgr.ResultMaker.StreamTagMaker = conf2toConfigurable(tool) + else: + hltEventLoopMgr.ResultMaker.MakerTools += [ conf2toConfigurable(tool) ] elif offlineWriteBS: __log.info("Configuring offline ByteStream HLT output") acc = triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=True) @@ -358,7 +360,8 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False): from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg HLTResultMTMakerAlg=CompFactory.HLTResultMTMakerAlg hltResultMakerTool = HLTResultMTMakerCfg() - hltResultMakerTool.MakerTools = [bitsmaker, stmaker, serialiser] # TODO: stmaker likely not needed for offline BS writing + hltResultMakerTool.StreamTagMaker = stmaker + hltResultMakerTool.MakerTools = [bitsmaker, serialiser] hltResultMakerAlg = HLTResultMTMakerAlg() hltResultMakerAlg.ResultMaker = hltResultMakerTool acc.addEventAlgo( hltResultMakerAlg ) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index ce120c44cc7bbf65c5b031af4ba5c991d406c199..c744bd8e0061f33612107e0cfd3ccc34a0facf83 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -124,6 +124,9 @@ def createTriggerFlags(): # partition name used to determine online vs offline BS result writing import os flags.addFlag('Trigger.Online.partitionName', os.getenv('TDAQ_PARTITION') or '') + + # shortcut to check if job is running in a partition (i.e. partition name is not empty) + flags.addFlag('Trigger.Online.isPartition', lambda prevFlags: len(prevFlags.Trigger.Online.partitionName)>0) # write BS output file flags.addFlag('Trigger.writeBS', False) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/Trigger_topOptions_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/Trigger_topOptions_standalone.py index d7f0b7992bd43bb80d47d90890be3e2bd2950a06..47c3e1799bfa044c63c5509d55beca08c4dd9045 100755 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/Trigger_topOptions_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/Trigger_topOptions_standalone.py @@ -90,9 +90,6 @@ if globalflags.InputFormat()=='bytestream': svcMgr.ByteStreamInputSvc.FullFileName = athenaCommonFlags.BSRDOInput() theApp.ExtSvc += [ "ByteStreamCnvSvc"] - # Online specific setup of BS converters - include( "TriggerJobOpts/jobOfragment_ReadBS_standalone.py" ) - # ---------------------------------------------------------------- # Detector services not guaranteed to be loaded elsewhere diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py index c3cab9eb37cfabfb44b6f31b91c60fc0959fa3bf..1478eb45848f6df0ba64b2fb74c0582fab9bb515 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py @@ -33,16 +33,9 @@ from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.Files = athenaCommonFlags.FilesInput() # Use new-style config of ByteStream reading and import here into old-style JO -# --- COMMENTED OUT BECAUSE OF ATR-21307 --- -# from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper -# from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg -# CAtoGlobalWrapper(ByteStreamReadCfg,ConfigFlags) - -# --- OLD-STYLE REPLACEMENT OF THE ABOVE BECAUSE OF ATR-21307 --- -from ByteStreamCnvSvc import ReadByteStream # noqa F401 -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.FilesInput() -# --- END OF ATR-21307 WORKAROUND --- +from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper +from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg +CAtoGlobalWrapper(ByteStreamReadCfg,ConfigFlags) # Define the decoding sequence from TrigHLTResultByteStream.TrigHLTResultByteStreamConf import HLTResultMTByteStreamDecoderAlg diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/jobOfragment_ReadBS_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/jobOfragment_ReadBS_standalone.py deleted file mode 100644 index 90cb6a798d2653b5c70aa97a5e2982ee5c578e84..0000000000000000000000000000000000000000 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/jobOfragment_ReadBS_standalone.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.GlobalFlags import globalflags -if TriggerFlags.doCalo(): - from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault - dqstatus = TileDQstatusAlgDefault() - - -# This is only needed in case we do the (obsolete) per-event muon data preparation (bug #84525) -if TriggerFlags.doMuon() and TriggerFlags.doEF() and 'forceMuonDataPrep' in dir(): - include ("MuonCnvExample/MuonReadBS_jobOptions.py") - -if globalflags.DataSource=='data': - svcMgr.ByteStreamCnvSvc.GetDetectorMask=True - from IOVDbSvc.CondDB import conddb - conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/SOR_Params') - -svcMgr.ByteStreamCnvSvc.InitCnvs += [ "EventInfo", - "HLT::HLTResult" ] - -# ------------------------------------------------------------- -# RIO Convertors -# ------------------------------------------------------------- -from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc -bssvc = ByteStreamAddressProviderSvc( "ByteStreamAddressProviderSvc" ) -if TriggerFlags.doEF() or TriggerFlags.doHLT(): - bssvc.TypeNames += [ - "TileCellIDC/TileCellIDC", - "MdtDigitContainer/MDT_DIGITS", - "RpcDigitContainer/RPC_DIGITS", - "TgcDigitContainer/TGC_DIGITS", - "CscDigitContainer/CSC_DIGITS", - "MuCTPI_RIO/MUCTPI_RIO", - "CTP_RIO/CTP_RIO" - ] - -# ------------------------------------------------------------- -# RDO Convertors -# ------------------------------------------------------------- -#include( "ByteStreamCnvSvcBase/BSAddProvSvc_RDO_jobOptions.py" ) -bssvc.TypeNames += [ - "LArRawChannelContainer/LArRawChannels", - "TileRawChannelContainer/TileRawChannelCnt", - "MuCTPI_RDO/MUCTPI_RDO", - "HLT::HLTResult/HLTResult_L2", - "HLT::HLTResult/HLTResult_EF", - "CTP_RDO/CTP_RDO", - "L1TopoRDOCollection/L1TopoRDOCollection" - ] - diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index 33e380d56c22aed8b44a53246c3c596cb4113f73..dac8b4447b46f608a9a9803bdda915e2c4be2b00 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -66,6 +66,8 @@ class opt: # ################################################################################ from TriggerJobOpts.TriggerFlags import TriggerFlags +from AthenaConfiguration.AllConfigFlags import ConfigFlags +from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper, conf2toConfigurable from AthenaCommon.AppMgr import theApp, ServiceMgr as svcMgr from AthenaCommon.Logging import logging log = logging.getLogger('runHLT_standalone.py') @@ -122,6 +124,7 @@ import TriggerJobOpts.Modifiers # Auto-configuration for athena if len(athenaCommonFlags.FilesInput())>0: + ConfigFlags.Input.Files = athenaCommonFlags.FilesInput() import PyUtils.AthFile as athFile af = athFile.fopen(athenaCommonFlags.FilesInput()[0]) globalflags.InputFormat = 'bytestream' if af.fileinfos['file_type']=='bs' else 'pool' @@ -332,11 +335,16 @@ if globalflags.InputFormat.is_pool(): from RecExConfig.ObjKeyStore import objKeyStore from PyUtils.MetaReaderPeeker import convert_itemList objKeyStore.addManyTypesInputFile(convert_itemList(layout='#join')) - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - if ( not objKeyStore.isInInput("xAOD::EventInfo") ) and ( not hasattr(condSeq, "xAODMaker::EventInfoCnvAlg") ): - from xAODEventInfoCnv.xAODEventInfoCnvAlgDefault import xAODEventInfoCnvAlgDefault - xAODEventInfoCnvAlgDefault(sequence=condSeq) + if objKeyStore.isInInput("xAOD::EventInfo"): + topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] + else: + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "xAODMaker::EventInfoCnvAlg"): + from xAODEventInfoCnv.xAODEventInfoCnvAlgDefault import xAODEventInfoCnvAlgDefault + xAODEventInfoCnvAlgDefault(sequence=condSeq) +else: + topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] # ---------------------------------------------------------------- # Detector geometry @@ -350,6 +358,8 @@ from RegionSelector.RegSelSvcDefault import RegSelSvcDefault svcMgr += RegSelSvcDefault() if TriggerFlags.doID(): + from InDetRecExample.InDetJobProperties import InDetFlags + InDetFlags.doPrintConfigurables = log.getEffectiveLevel() <= logging.DEBUG include( "InDetRecExample/InDetRecCabling.py" ) if TriggerFlags.doCalo(): @@ -379,6 +389,8 @@ if TriggerFlags.doID: +isPartition = len(ConfigFlags.Trigger.Online.partitionName) > 0 + # ---------------------------------------------------------------- # Pool input # ---------------------------------------------------------------- @@ -395,18 +407,14 @@ if globalflags.InputFormat.is_pool(): # ---------------------------------------------------------------- # ByteStream input # ---------------------------------------------------------------- -elif globalflags.InputFormat.is_bytestream(): - - # This is only needed running athena (as opposed to athenaHLT) - if not hasattr(svcMgr,"ByteStreamCnvSvc"): - from ByteStreamCnvSvc import ReadByteStream # noqa - # Define the input - svcMgr.ByteStreamInputSvc.FullFileName = athenaCommonFlags.FilesInput() - theApp.ExtSvc += [ "ByteStreamCnvSvc"] - - # Online specific setup of BS converters - include( "TriggerJobOpts/jobOfragment_ReadBS_standalone.py" ) - +elif globalflags.InputFormat.is_bytestream() and not ConfigFlags.Trigger.Online.isPartition: + if hasattr(svcMgr, "MetaDataSvc"): + # Need to set this property to ensure correct merging with MetaDataSvc from AthenaPoolCnvSvc/AthenaPool.py + # May be removed when the merging is fixed (or AthenaPool.py sets this property) + svcMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr" + # Set up ByteStream reading services + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + CAtoGlobalWrapper(ByteStreamReadCfg, ConfigFlags) # --------------------------------------------------------------- # Trigger config @@ -420,7 +428,6 @@ generateL1Menu() createL1PrescalesFileFromMenu() from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc,L1ConfigSvcCfg -from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper, conf2toConfigurable CAtoGlobalWrapper(L1ConfigSvcCfg,None) #svcMgr += getL1ConfigSvc() @@ -540,10 +547,8 @@ if svcMgr.MessageSvc.OutputLevel<INFO: # Use parts of NewJO #------------------------------------------------------------- from AthenaCommon.Configurable import Configurable -from AthenaConfiguration.AllConfigFlags import ConfigFlags # Output flags -isPartition = len(ConfigFlags.Trigger.Online.partitionName) > 0 if opt.doWriteRDOTrigger: if isPartition: log.error('Cannot use doWriteRDOTrigger in athenaHLT or partition') diff --git a/Trigger/TriggerCommon/TriggerMenu/python/jet/jetDefInstantiator.py b/Trigger/TriggerCommon/TriggerMenu/python/jet/jetDefInstantiator.py index 7087823567013ea9176a60159686437fab4cd51b..261885b1f1907da2f15d6d7dd7f5905e7112b215 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/jet/jetDefInstantiator.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/jet/jetDefInstantiator.py @@ -43,8 +43,6 @@ from TrigHLTJetRec.TrigHLTJetRecConfig import (TrigHLTJetDiagnostics_named, # no from TrigHLTJetHypo.TrigHLTJetHypoConfig import TrigHLTJetHypo2 # noqa: F401 -from TrigDetCalib.TrigDetCalibConf import ScoutingStreamWriter # noqa: F401 - from TrigHIRec.TrigHICaloRec import (TrigCaloTowerMaker_hijet, # noqa: F401 TrigHIClusterMaker_hijet, TrigHIEventShapeMaker_hijet, diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py index 8b80a101062ea278df6c8fd270865ae796bcc2b1..aae5f473bd25aa68a3bdae6e3bb685b4a8c7eae9 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py @@ -480,7 +480,7 @@ def setupMenu(): #Beamspot chanis first try ATR-9847 TriggerFlags.BeamspotSlice.signatures = [ - ['beamspot_allTE_trkfast_peb_L13J15', 'L1_3J15', [], ["BeamSpot"], ['RATE:BeamSpot', 'BW:BeamSpot'], -1], + ['beamspot_allTE_trkfast_L13J15', 'L1_3J15', [], ["BeamSpot"], ['RATE:BeamSpot', 'BW:BeamSpot'], -1], ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py index 3eb490f7f876ff37bcaf9889c0d9870731d87a52..80cc51a6731bb68a8eeb9f2d206a30591bad1182 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py @@ -28,7 +28,7 @@ def getBJetSequence(): def bJetStep2Sequence(): prmVtxKey = "HLT_EFHistoPrmVtx" - outputRoIName = "HLT_bTagging_ROIs" + outputRoIName = "HLT_Roi_Bjet" from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm from ViewAlgs.ViewAlgsConf import ViewCreatorCentredOnJetWithPVConstraintROITool @@ -37,7 +37,7 @@ def bJetStep2Sequence(): # newRoITool = ViewCreatorCentredOnJetWithPVConstraintROITool() #newRoITool = CompFactory.ViewCreatorCentredOnJetWithPVConstraintROITool() - newRoITool.RoisWriteHandleKey = outputRoIName + newRoITool.RoisWriteHandleKey = recordable( outputRoIName ) newRoITool.VertexReadHandleKey = prmVtxKey newRoITool.PrmVtxLink = prmVtxKey.replace( "HLT_","" ) # @@ -70,7 +70,6 @@ def bJetStep2Sequence(): # Flavour Tagging from TriggerMenuMT.HLTMenuConfig.Bjet.BjetFlavourTaggingConfiguration import getFlavourTagging -<<<<<<< HEAD acc_flavourTaggingAlgs,bTaggingContainerName = getFlavourTagging( inputJets=InputMakerAlg.InViewJets, inputVertex=prmVtxKey, inputTracks=PTTrackParticles[0] ) inViewReco = InViewReco("bJetBtagSequence", viewMaker= InputMakerAlg) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py index f8947fd1370c5214cab4c499edb05f2ee73b8829..61881bbd07da948b138df3c4e60a312f76394a06 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetTrackingConfiguration.py @@ -8,7 +8,8 @@ def getSecondStageBjetTracking( inputRoI, dataObjects ): # Second stage of Fast tracking (for precision tracking preparation) from TrigInDetConfig.InDetSetup import makeInDetAlgs - viewAlgs, viewVerify = makeInDetAlgs( whichSignature='Jet',separateTrackParticleCreator="_Bjet", rois=inputRoI ) + + viewAlgs, viewVerify = makeInDetAlgs( whichSignature='Jet',separateTrackParticleCreator="Bjet", rois=inputRoI ) viewVerify.DataObjects += dataObjects diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/GenerateBjetChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/GenerateBjetChainDefs.py index edf4d1391845cae97586d84570ca9cd1ce2f32ad..2e573cdc7163d0f40430aaecb17896fb1c8113cf 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/GenerateBjetChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/GenerateBjetChainDefs.py @@ -4,6 +4,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.Bjet.BjetDef import BjetChainConfiguration as BjetChainConfiguration from TriggerMenuMT.HLTMenuConfig.Jet.JetChainConfiguration import JetChainConfiguration +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Bjet.GenerateBjetChainConfigs' ) log.info("Importing %s",__name__) @@ -11,8 +12,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py index 23a25fa3fe65e8ca66711e7d07bc81316962bdcf..c7e74de4f0ee144d3fdaa820cfc75b37025f86d7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py @@ -9,97 +9,72 @@ from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsDef") -from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase, RecoFragmentsPool -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep +from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase from TriggerMenuMT.HLTMenuConfig.Muon.MuonDef import MuonChainConfiguration as MuonChainConfiguration -from TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsSequenceSetup import dimuL2Sequence,dimuEFSequence - +from TriggerMenuMT.HLTMenuConfig.Muon.MuonDef import muCombSequenceCfg, muEFCBSequenceCfg +from TrigBphysHypo.TrigMultiTrkComboHypoConfig import DimuL2ComboHypoCfg, DimuEFComboHypoCfg, TrigMultiTrkComboHypoToolFromDict #-------------------------------------------------------- # fragments generating config will be functions in new JO # I have no idea what the above sentence means - copy/paste from muons... #-------------------------------------------------------- -def dimuL2SequenceCfg(flags): - return dimuL2Sequence() - -def dimuEFSequenceCfg(flags): - return dimuEFSequence() -############################################# -### Class/function to configure muon chains +############################################# +### Class/function to configure muon chains ############################################# class BphysicsChainConfiguration(MuonChainConfiguration): def __init__(self, chainDict): ChainConfigurationBase.__init__(self,chainDict) - + # ---------------------- # Assemble the chain depending on information from chainName # ---------------------- - def assembleBphysChain(self): - chainSteps = [] + def assembleBphysChain(self): + log.debug("Assembling chain for " + self.chainName) - muonStepDictionary = self.getStepDictionary() - bphysStepDictionary = self.getBphysStepDictionary() - - #infrastructure cannot deal with having more than one "key" here - #if we have noL2Comb+extra, this needs to be defined in the muonStepDictionary - mu_key = 'noL2Comb'+self.chainPart['extra']+self.chainPart['isoInfo'] - - bphys_key = self.getBphysKey() - - muon_steps = muonStepDictionary[mu_key] - bphys_steps = bphysStepDictionary[bphys_key] - - for mu_step_level, bphys_step_level in zip(muon_steps, bphys_steps): - for step in mu_step_level: - chainstep = getattr(self, step)() - chainSteps += [chainstep] - for step in bphys_step_level: - chainSteps += [step] - - - myChain = self.buildChain(chainSteps) - return myChain + stepDictionary = self.getBphysStepDictionary() + key = self.getBphysKey() + steps=stepDictionary[key] + + chainSteps = [] + for step_level in steps: + for step in step_level: + chainStep = getattr(self, step)() + chainSteps+=[chainStep] + + chain = self.buildChain(chainSteps) + return chain def getBphysStepDictionary(self): - + stepDictionary = { - "dimu":[[self.getdimuL2()], [self.getdimuEF()]], + 'dimu' : [['getmuFast', 'getDimuComb'], ['getmuEFSA', 'getDimuEFCB']], } - return stepDictionary - + def getBphysKey(self): - + if len(self.dict['topo']) > 1: log.warning("BphysicsChainConfiguration.getBphysKey is not setup for > 1 topo! will use the first one.") the_topo = self.dict['topo'][0] - + topo_dict = { 'bJpsimumu' : 'dimu', 'bUpsimumu' : 'dimu', 'bBmumu' : 'dimu', 'bDimu' : 'dimu' - } - - return topo_dict[the_topo] - - # -------------------- - def getdimuL2(self): - stepName = 'Step2_l2Dimu' - log.debug("Configuring step " + stepName) - bphySeq = RecoFragmentsPool.retrieve( dimuL2SequenceCfg, None) - return ChainStep(stepName, [bphySeq], multiplicity=[1]) - - def getdimuEF(self): - stepName = 'Step5_efDimu' - log.debug("Configuring step " + stepName) - bphySeq = RecoFragmentsPool.retrieve( dimuEFSequenceCfg, None) - return ChainStep(stepName, [bphySeq], multiplicity=[1]) + } + + return topo_dict[the_topo] + + def getDimuComb(self): + return self.getStep(2, 'dimuComb', [muCombSequenceCfg], comboHypoCfg=DimuL2ComboHypoCfg) + def getDimuEFCB(self): + return self.getStep(4, 'dimuEFCB', [muEFCBSequenceCfg], comboHypoCfg=DimuEFComboHypoCfg, comboTools=[TrigMultiTrkComboHypoToolFromDict]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsSequenceSetup.py index d20b32d7a32a0cd040fc5a11b31e0350a974484a..f2f0fc1b7b487784e8781d2a41e43908019e0a7d 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsSequenceSetup.py @@ -1,60 +1 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool -from AthenaConfiguration.AllConfigFlags import ConfigFlags - - -def dimuL2Sequence(name = 'Dimu'): - from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muCombAlgSequence - (l2muCombSequence, l2muCombViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(muCombAlgSequence, ConfigFlags) - - from TrigBphysHypo.TrigMultiTrkHypoConfig import TrigMultiTrkHypoConfig, TrigMultiTrkHypoToolFromDict - config = TrigMultiTrkHypoConfig() - DimuHypo = config.ConfigurationHypo( - trigSequenceName = name, - trigLevel = 'L2', - trackCollection='HLT_IDTrack_Muon_FTF') - - return MenuSequence( - Sequence = l2muCombSequence, - Maker = l2muCombViewsMaker, - Hypo = DimuHypo, - HypoToolGen = TrigMultiTrkHypoToolFromDict) - - -def dimuEFSequence(name = 'Dimu'): - from AthenaCommon import CfgMgr - from AthenaCommon.CFElements import parOR, seqAND - from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool - from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muonNames - - muNames = muonNames().getNames('RoI') - - dimuefRecoSequence = parOR('dimuefViewNode') - - dimuefViewsMaker = EventViewCreatorAlgorithm('IMdimuef') - dimuefViewsMaker.ViewFallThrough = True - dimuefViewsMaker.RoIsLink = 'initialRoI' - dimuefViewsMaker.RoITool = ViewCreatorInitialROITool() - dimuefViewsMaker.InViewRoIs = 'DimuEFRoIs' - dimuefViewsMaker.Views = 'DimuEFViewRoIs' - dimuefViewsMaker.ViewNodeName = dimuefRecoSequence.name() - dimuefViewsMaker.RequireParentView = True - - ViewVerifyEFCB = CfgMgr.AthViews__ViewDataVerifier('dimuefViewDataVerifier') - ViewVerifyEFCB.DataObjects = [('xAOD::MuonContainer', 'StoreGateSvc+'+muNames.EFCBName)] - dimuefRecoSequence += ViewVerifyEFCB - dimuefSequence = seqAND('dimuefSequence', [dimuefViewsMaker, dimuefRecoSequence]) - - from TrigBphysHypo.TrigMultiTrkHypoConfig import TrigMultiTrkHypoConfig, TrigMultiTrkHypoToolFromDict - config = TrigMultiTrkHypoConfig() - DimuHypo = config.ConfigurationHypo( - trigSequenceName = name, - trigLevel = 'EF', - muonCollection = muNames.EFCBName) - - return MenuSequence( - Sequence = dimuefSequence, - Maker = dimuefViewsMaker, - Hypo = DimuHypo, - HypoToolGen = TrigMultiTrkHypoToolFromDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/GenerateBphysicsChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/GenerateBphysicsChainDefs.py index 0dee4950846f7d75d28ccee97c54ccf3ec7c0602..c331d4d905cce6d8238a576c88e9a7a56b284472 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/GenerateBphysicsChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/GenerateBphysicsChainDefs.py @@ -1,39 +1,35 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ########################################################################### # SliceDef file for Bphysics chains ########################################################################### from AthenaCommon.Logging import logging -log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Bphysics.generateChainConfigs' ) -logging.getLogger().info("Importing %s",__name__) +log = logging.getLogger('TriggerMenuMT.HLTMenuConfig.Bphysics.generateChainConfigs') +logging.getLogger().info('Importing %s', __name__) from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict +from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs from TriggerMenuMT.HLTMenuConfig.Bphysics.BphysicsDef import BphysicsChainConfiguration as BphysicsChainConfiguration def generateChainConfigs(chainDict): - if not chainDict["topo"]: - log.error( "No topo given -> not a bphysics chain...") - + if not chainDict['topo']: + log.error('No topo given -> not a bphysics chain...') + listOfChainDicts = splitChainDict(chainDict) - listOfChainDefs=[] + listOfChainDefs=[] for subChainDict in listOfChainDicts: - - my_chain = BphysicsChainConfiguration(subChainDict).assembleBphysChain() + subChain = BphysicsChainConfiguration(subChainDict).assembleBphysChain() + listOfChainDefs += [subChain] - listOfChainDefs += [my_chain] - log.debug('length of chaindefs %s', len(listOfChainDefs) ) - + log.debug('length of chaindefs %s', len(listOfChainDefs)) - if len(listOfChainDefs)>1: - log.warning("Implement case for multi-bphys object chain!!") - theChainDef = listOfChainDefs[0] #needs to be implemented properly + if len(listOfChainDefs) > 1: + chainDef = mergeChainDefs(listOfChainDefs, chainDict) else: - theChainDef = listOfChainDefs[0] - - log.debug("theChainDef %s" , theChainDef) - - return theChainDef + chainDef = listOfChainDefs[0] + log.debug('ChainDef %s', chainDef) + return chainDef diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py index 553ee533e2ec9e805dc07a19857b0d192f4273e5..2154b737f92d7d9d5cdf2005c9244864470ca6da 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py @@ -13,29 +13,34 @@ from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialR #---------------------------------------------------------------- + # fragments generating configuration will be functions in New JO, # so let's make them functions already now #---------------------------------------------------------------- +def trkFS_trkfast_Cfg( flags ): + return allTE_trkfast( signature="FS" ) - def allTE_trkfast_Cfg( flags ): - return allTE_trkfast() + return allTE_trkfast( signature="BeamSpot" ) -def allTE_trkfast(): - inputMakerAlg = EventViewCreatorAlgorithm("IM_beamspot") +def allTE_trkfast( signature="FS" ): + inputMakerAlg = EventViewCreatorAlgorithm("IM_beamspot_"+signature) inputMakerAlg.ViewFallThrough = True inputMakerAlg.RoIsLink = "initialRoI" inputMakerAlg.RoITool = ViewCreatorInitialROITool() - inputMakerAlg.InViewRoIs = "beamspotInputRoIs" - inputMakerAlg.Views = "beamspotViewRoIs" + inputMakerAlg.InViewRoIs = "beamspotViewRoI_"+signature + inputMakerAlg.Views = "beamspotViewRoI_"+signature from TrigInDetConfig.InDetSetup import makeInDetAlgs - viewAlgs, viewVerify = makeInDetAlgs(whichSignature='FS', rois=inputMakerAlg.InViewRoIs) from TrigT2BeamSpot.T2VertexBeamSpotConfig import T2VertexBeamSpot_activeAllTE - T2VertexBeamSpot_activeAllTE.TrackCollections = ["TrigFastTrackFinder_Tracks_FS"] - viewVerify.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+beamspotInputRoIs' ), + viewAlgs, viewVerify = makeInDetAlgs( whichSignature=signature, rois=inputMakerAlg.InViewRoIs ) + + vertexAlg = T2VertexBeamSpot_activeAllTE( "vertex_"+signature ) + vertexAlg.TrackCollections = ["TrigFastTrackFinder_Tracks_"+signature] + + viewVerify.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+beamspotViewRoI_'+signature ), ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] # Make sure the event info is still available at whole-event level @@ -43,19 +48,22 @@ def allTE_trkfast(): topSequence = AlgSequence() topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] - beamspotSequence = seqAND("beamspotSequence",viewAlgs+[T2VertexBeamSpot_activeAllTE()]) + beamspotSequence = seqAND( "beamspotSequence_"+signature, viewAlgs+[vertexAlg] ) inputMakerAlg.ViewNodeName = beamspotSequence.name() + beamspotViewsSequence = seqAND( "beamspotViewsSequence"+signature, [ inputMakerAlg, beamspotSequence ]) + #hypo - beamspotHypoAlg = TrigStreamerHypoAlgMT("BeamspotHypoAlg") + beamspotHypoAlg = TrigStreamerHypoAlgMT("BeamspotHypoAlg_"+signature) beamspotHypoAlg.RuntimeValidation = False #Needed to avoid the ERROR ! Decision has no 'feature' ElementLink beamspotHypoToolGen= StreamerHypoToolMTgenerator - beamspotViewsSequence = seqAND("beamspotViewsSequence", [ inputMakerAlg, beamspotSequence ]) + return MenuSequence( Sequence = beamspotViewsSequence, - Maker = inputMakerAlg, - Hypo = beamspotHypoAlg, - HypoToolGen = beamspotHypoToolGen ) + Maker = inputMakerAlg, + Hypo = beamspotHypoAlg, + HypoToolGen = beamspotHypoToolGen ) + # Class to configure chain #---------------------------------------------------------------- @@ -75,9 +83,9 @@ class BeamspotChainConfiguration(ChainConfigurationBase): # define here the names of the steps and obtain the chainStep configuration # -------------------- stepDictionary = { - "allTE_trkfast":[self.getAllTEStep()] + "allTE_trkfast":[self.getAllTEStep()], #"activeTE_trkfast":[self.activeTE_trkfast()], - #"trkFS_trkfast":[self.trkFS_trkfast()], + "trkFS_trkfast":[self.getTrkFSStep()], } #key = self.chainPart['EFrecoAlg'] @@ -91,7 +99,14 @@ class BeamspotChainConfiguration(ChainConfigurationBase): # -------------------- - # Configuration of costmonitor + # Configuration of costmonitor (costmonitor ?? but isn't this is the actua chain configuration ??) + # -------------------- + def getTrkFSStep(self): + return self.getStep(1,"trkFS_trkfast",[trkFS_trkfast_Cfg]) + + + # -------------------- + # Configuration of costmonitor (costmonitor ?? but isn't this is the actua chain configuration ??) # -------------------- def getAllTEStep(self): return self.getStep(1,"allTE_trkfast",[allTE_trkfast_Cfg]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateBeamspotChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateBeamspotChainDefs.py index 68859d2c7225a5de0c209b06b128ffb0f8ff28e0..78d8905d443885f16f521050ad04a563bc417573 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateBeamspotChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/GenerateBeamspotChainDefs.py @@ -1,10 +1,12 @@ + + # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.BeamspotChainConfiguration import BeamspotChainConfiguration as BeamspotChainConfiguration from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -12,9 +14,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) log.debug("Will generate Config for streamer: ",chainDict['chainName']) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py index a8470c7dddc4a9bd6a4d256de289d036d484688f..b0f1d7e2a281316d128e4dc3916ef91583e6a9df 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py @@ -51,24 +51,19 @@ class ElectronChainConfiguration(ChainConfigurationBase): # -------------------- # define here the names of the steps and obtain the chainStep configuration # -------------------- - etcut1step = [ self.getFastCalo(doRinger=False) ] - etcut_sequence = [ self.getFastCalo(doRinger=False), self.getFastElectron(), self.getPrecisionCaloElectron()] - electron_sequence = [ self.getFastCalo(), self.getFastElectron(), self.getPrecisionCaloElectron(), self.getPrecisionElectron()] - etcut_noringer_sequence = [ self.getFastCalo(doRinger=False), self.getFastElectron(), self.getPrecisionCaloElectron()] - electron_noringer_sequence = [ self.getFastCalo(doRinger=False), self.getFastElectron(), self.getPrecisionCaloElectron(), self.getPrecisionElectron()] stepDictionary = { - 'etcut1step': etcut1step, - 'etcut' : etcut_sequence, - 'lhloose' : electron_sequence, - 'lhvloose' : electron_sequence, - 'lhmedium' : electron_sequence, - 'lhtight' : electron_sequence, - 'etcutnoringer' : etcut_noringer_sequence, - 'lhloosenoringer' : electron_noringer_sequence, - 'lhvloosenoringer' : electron_noringer_sequence, - 'lhmediumnoringer' : electron_noringer_sequence, - 'lhtightnoringer' : electron_noringer_sequence, + 'etcut1step': ['getFastCaloNoRinger'], + 'etcut' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron'], + 'lhloose' : ['getFastCaloRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhvloose' : ['getFastCaloRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhmedium' : ['getFastCaloRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhtight' : ['getFastCaloRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'etcutnoringer' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron'], + 'lhloosenoringer' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhvloosenoringer' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhmediumnoringer' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], + 'lhtightnoringer' : ['getFastCaloNoRinger', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionElectron'], } log.debug('electron chain part = ' + str(self.chainPart)) @@ -83,12 +78,10 @@ class ElectronChainConfiguration(ChainConfigurationBase): else: raise RuntimeError("Chain configuration unknown for electron chain with key: " + key ) - - chainSteps = [] - for step in steps: log.debug('Adding electron trigger step ' + str(step)) - chainSteps+=[step] + chainstep = getattr(self, step)() + chainSteps+=[chainstep] myChain = self.buildChain(chainSteps) @@ -98,13 +91,14 @@ class ElectronChainConfiguration(ChainConfigurationBase): # Configuration of electron steps # -------------------- - def getFastCalo(self, doRinger=True): - if doRinger: - stepName = "FastCaloRinger_electron" - fastCaloCfg = electronFastCaloRingerCfg - else: - stepName = "FastCalo_electron" - fastCaloCfg = electronFastCaloCfg + def getFastCaloRinger(self): + stepName = "FastCaloRinger_electron" + fastCaloRingerCfg = electronFastCaloRingerCfg + return self.getStep(1,stepName,[ fastCaloRingerCfg ]) + + def getFastCaloNoRinger(self): + stepName = "FastCalo_electron" + fastCaloCfg = electronFastCaloCfg return self.getStep(1,stepName,[ fastCaloCfg]) def getFastElectron(self): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py index 1d85c060d838e5e146ab3f6f9fd5d230471f5716..2a673f5d85e01b9585c38c427009d6a8d368bf4d 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py @@ -19,12 +19,12 @@ def fastElectronSequence(ConfigFlags): from TrigInDetConfig.InDetSetup import makeInDetAlgs RoIs = "EMIDRoIs" # contract with the fastCalo - viewAlgs, ViewVerify = makeInDetAlgs(whichSignature = "Electron", separateTrackParticleCreator="_Electron", rois = RoIs) + viewAlgs, viewVerify = makeInDetAlgs( whichSignature = "Electron", separateTrackParticleCreator="Electron", rois = RoIs ) # A simple algorithm to confirm that data has been inherited from parent view # Required to satisfy data dependencies from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import CaloMenuDefs - ViewVerify.DataObjects += [( 'xAOD::TrigEMClusterContainer' , 'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters ), + viewVerify.DataObjects += [( 'xAOD::TrigEMClusterContainer' , 'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+EMIDRoIs' )] TrackParticlesName = "" diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GenerateElectronChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GenerateElectronChainDefs.py index bc972642ac7d9d4657cce72844da677e79bb7028..fb7c09ea72843dbf449ecf0d9baea973fc012e18 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GenerateElectronChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GenerateElectronChainDefs.py @@ -4,7 +4,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import ElectronChainConfiguration as ElectronChainConfiguration from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Egamma.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -12,8 +12,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GeneratePhotonChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GeneratePhotonChainDefs.py index 2670cea6e5f43ec3c778a76a1e95d8f043f6453d..2ddd220f84eefcf1e1777abad2a54423c81135c0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GeneratePhotonChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/GeneratePhotonChainDefs.py @@ -4,7 +4,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.Egamma.PhotonDef import PhotonChainConfiguration as PhotonChainConfiguration from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Egamma.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -12,8 +12,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py index 71124be5ccf1e48d7cef2b76cf746ff9445f13cb..f820e1dff6f44872eeb4a70ea55d6006e370cfcd 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py @@ -36,21 +36,12 @@ def precisionElectronRecoSequence(RoIs): ( 'CaloAffectedRegionInfoVec' , 'ConditionStore+LArAffectedRegionInfo' ), ( 'CaloCellContainer' , 'StoreGateSvc+CaloCells' ), ( 'SCT_FlaggedCondData' , 'StoreGateSvc+SCT_FlaggedCondData_TRIG' ), - ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), - ( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+PixelClusterAmbiguitiesMap' ), # makeInDetPrecisionTracking should get this, but it doesn't - ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' ), # Seems to be necessary, despite load below - ( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' ), - ( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs_EF' ), - ( 'InDet::TRT_DriftCircleContainer' , 'StoreGateSvc+TRT_DriftCircles' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+precisionElectron' )] # Make sure the required objects are still available at whole-event level from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), - ( 'CaloAffectedRegionInfoVec' , 'ConditionStore+LArAffectedRegionInfo' ), - ( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+PixelClusterAmbiguitiesMap' ), - ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] + topSequence.SGInputLoader.Load += [( 'CaloAffectedRegionInfoVec' , 'ConditionStore+LArAffectedRegionInfo' )] # This object must be loaded from SG if it's not loaded in conddb (algs request it but ignore) from IOVDbSvc.CondDB import conddb @@ -66,6 +57,9 @@ def precisionElectronRecoSequence(RoIs): if globalflags.InputFormat.is_bytestream(): ViewVerifyTrk.DataObjects += [( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' ) ] + else: + topSequence.SGInputLoader.Load += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] + ViewVerifyTrk.DataObjects += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] """ Precision Track Related Setup.... """ PTAlgs = [] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/GenerateJetChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/GenerateJetChainDefs.py index 55faeed19aadb04732f2a05ee0c73f5f452a6c19..7be99363ba342893e935dae67347ca4864baeb15 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/GenerateJetChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/GenerateJetChainDefs.py @@ -2,7 +2,7 @@ from TriggerMenuMT.HLTMenuConfig.Jet.JetChainConfiguration import JetChainConfiguration - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Jet.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -10,8 +10,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) # Jet chain is assembled always from the full dictionary (multiple legs are handled internally by the jet reco / hypo) theChainDef = JetChainConfiguration(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py index efe31ef61a6eb148516be9100485eed2d468ec9e..085a0dc22a553240b21dea255500d771a0fe94fa 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py @@ -71,7 +71,7 @@ def jetRecoSequence( dummyFlags, dataSource, RoIs = 'FSJETRoI', **jetRecoDict): rcJetDef.modifiers = rcModList rcConstitPJAlg = getConstitPJGAlg( rcJetDef.inputdef ) - rcConstitPJKey = rcConstitPJAlg.PJGetter.OutputContainer + rcConstitPJKey = rcConstitPJAlg.OutputContainer recoSeq += conf2toConfigurable( rcConstitPJAlg ) rcPJs = [rcConstitPJKey] @@ -144,7 +144,7 @@ def jetRecoSequence( dummyFlags, dataSource, RoIs = 'FSJETRoI', **jetRecoDict): # Add the PseudoJetGetter alg to the sequence constitPJAlg = getConstitPJGAlg( jetDef.inputdef ) - constitPJKey = constitPJAlg.PJGetter.OutputContainer + constitPJKey = constitPJAlg.OutputContainer recoSeq += conf2toConfigurable( constitPJAlg ) # Basic list of PseudoJets is just the constituents # Append ghosts (tracks) if desired diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py index 3af1957034e44d5709fff01e1d49a42ffd598603..6ba1e551e8f5ed1ad6a3f4b3bd39cae2b67493f8 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py @@ -17,7 +17,8 @@ def JetTrackingSequence(dummyFlags,trkopt,RoIs): if trkopt=="ftf": from TrigInDetConfig.InDetSetup import makeInDetAlgsNoView # Guess FS rather than making it jet-specific? - jetTrkSeq += makeInDetAlgsNoView( "JetFS", "_FS", rois=RoIs ) + viewAlgs = makeInDetAlgsNoView( "JetFS", "FS", rois=RoIs ) + jetTrkSeq += viewAlgs tracksname = recordable("HLT_IDTrack_FS_FTF") verticesname = recordable("HLT_EFHistoPrmVtx") @@ -51,19 +52,17 @@ def JetTrackingSequence(dummyFlags,trkopt,RoIs): label = "GhostTrack_{}".format(trkopt) ghosttracksname = "PseudoJet{}".format(label) - pjg = CompFactory.PseudoJetGetter("pjg_{}".format(label), - InputContainer=tracksname, - OutputContainer=ghosttracksname, - Label=label, - SkipNegativeEnergy=True, - GhostScale=1e-40) trackcollectionmap[trkopt]["GhostTracks"] = ghosttracksname trackcollectionmap[trkopt]["GhostTracksLabel"] = label pjgalg = CompFactory.PseudoJetAlgorithm( "pjgalg_"+label, - PJGetter=pjg + InputContainer=tracksname, + OutputContainer=ghosttracksname, + Label=label, + SkipNegativeEnergy=True, + GhostScale=1e-40 ) jetTrkSeq += conf2toConfigurable( pjgalg ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/generateJet.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/generateJet.py index b70f9f7230d60237fa4a50e439acd359da55fd83..778d9b8dc99212cac95e19a6ec80f78e3fade93e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/generateJet.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/generateJet.py @@ -3,6 +3,9 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, ChainStep, Chain, InEventReco, getChainStepName, createStepView from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +import pprint +from AthenaCommon.Logging import logging +log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Jet.generateJet' ) def generateChains( flags, chainDict ): @@ -80,8 +83,7 @@ def generateChains( flags, chainDict ): for part in chainDict['chainParts']: l1Thresholds.append(part['L1threshold']) - import pprint - pprint.pprint(chainDict) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) acc.printConfig() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/GenerateMETChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/GenerateMETChainDefs.py index b9481b5f672b226e0be2d546430367835d5acb64..b849d271f8f9d0e4b14219de4d4f94152b1153d2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/GenerateMETChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/GenerateMETChainDefs.py @@ -4,7 +4,7 @@ from ..Menu.ChainDictTools import splitChainDict from .METChainConfiguration import METChainConfiguration from ..Menu.ChainMerging import mergeChainDefs - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.MET.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -12,8 +12,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py index 7094f7ef2ad686a1b907cab81d92618c3333d0a1..9d11cdaaae36e8aa62cebaedfb2a6b19c76e0e6d 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py @@ -5,7 +5,7 @@ from AthenaCommon.Logging import logging log = logging.getLogger(__name__) from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool - +from DecisionHandling.DecisionHandlingConfig import ComboHypoCfg #---------------------------------------------------------------- # Base class to configure chain @@ -43,13 +43,13 @@ class ChainConfigurationBase(object): mySequence = RecoFragmentsPool.retrieve(mySequenceCfg, None) # the None will be used for flags in future return mySequence - def getStep(self, stepID, stepPartName, sequenceCfgArray, comboTools=[]): + def getStep(self, stepID, stepPartName, sequenceCfgArray, comboHypoCfg=ComboHypoCfg, comboTools=[]): stepName = 'Step%d'%stepID + '_%d'%self.mult + stepPartName log.debug("Configuring step " + stepName) seqArray = [] for sequenceCfg in sequenceCfgArray: seqArray.append( RecoFragmentsPool.retrieve( sequenceCfg, None)) - return ChainStep(stepName, seqArray, [self.mult], [self.dict], comboToolConfs=comboTools) + return ChainStep(stepName, seqArray, [self.mult], [self.dict], comboHypoCfg=comboHypoCfg, comboToolConfs=comboTools) def buildChain(self, chainSteps): myChain = Chain(name = self.chainName, diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py index 13976b6f52a683038530e8955013820d7eb95292..0147b4b9eebab0d15014911c3c9f298d8569d5dd 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py @@ -154,6 +154,7 @@ def makeChainSteps(steps, stepNumber, chainDefList): log.verbose(" steps %s ", steps) stepDicts = [] comboHypoTools = [] + comboHypo = None # this function only makes sense if we are merging steps corresponding to the chains in the chainDefList assert len(chainDefList)==len(steps), "makeChainSteps: Length of chain defs %d does not match length of steps to merge %d" % (len(chainDefList), len(steps)) @@ -179,6 +180,7 @@ def makeChainSteps(steps, stepNumber, chainDefList): log.error("More than one menu sequence found in combined chain!!") + comboHypo = step.comboHypoCfg currentStep = step.name # the step naming for combined chains needs to be revisted!! @@ -195,7 +197,7 @@ def makeChainSteps(steps, stepNumber, chainDefList): stepDicts[-1]['chainName'] = legName(stepDicts[-1]['chainName'], chain_index) comboHypoTools = list(set(comboHypoTools)) - theChainStep = ChainStep(stepName, Sequences=stepSeq, multiplicity=stepMult, chainDicts=stepDicts, comboToolConfs=comboHypoTools) + theChainStep = ChainStep(stepName, Sequences=stepSeq, multiplicity=stepMult, chainDicts=stepDicts, comboHypoCfg=comboHypo, comboToolConfs=comboHypoTools) log.info("Merged step: \n %s", theChainStep) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py index 72387ca1dc292c2d1ec5a8398bf75764f6b5de3d..740b3f98c1aec54dc725a9c7a3ded74ffa98d993 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py @@ -247,7 +247,7 @@ class GenerateMenuMT(object): import traceback traceback.print_exc() - log.info('Available signature(s) for chain generation: %s', self.availableSignatures) + log.debug('Available signature(s) for chain generation: %s', self.availableSignatures) import pprint pp = pprint.PrettyPrinter(indent=4, depth=8) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py index 8b0c390e78f714dc192cf5c880e7755438fa6d47..6f999fc7f8f707da4824fd93b044a2d2dfb542ff 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py @@ -4,7 +4,7 @@ from AthenaCommon.CFElements import seqAND from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import generateDecisionTreeOld from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionTree - +from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT from six import iteritems from AthenaCommon.Logging import logging @@ -63,9 +63,9 @@ def generateMenu( flags ): continue for chain in cfgFlag.get(): - + chainDict = dictFromChainName( chain ) - + counter += 1 chainDict['chainCounter'] = counter @@ -74,8 +74,9 @@ def generateMenu( flags ): # call generating function and pass to CF builder - chain = signatureToGenerator[signature](flags, chainDict) - menuChains.append( chain ) + chainConfig = signatureToGenerator[signature](flags, chainDict) + TriggerConfigHLT.registerChain( chainDict, chainConfig ) + menuChains.append( chainConfig ) log.info('Obtained Menu Chain objects') diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py index 6f5af91dd3a44295d53f2d6acac1baaf93571ad3..50f8ee50da41eafd30125f529ba97ebb31c25e8f 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py @@ -1,14 +1,11 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from collections import defaultdict from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming -from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeSummary -from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFDot import stepCF_DataFlow_to_dot, \ - stepCF_ControlFlow_to_dot, all_DataFlow_to_dot -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence, createStepView, SequenceFilterNode -from AthenaCommon.CFElements import parOR, seqAND, findAlgorithm +from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT +from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import isInputMakerBase, isHypoBase +from AthenaCommon.CFElements import parOR, seqAND, findAllAlgorithms from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) @@ -21,125 +18,173 @@ def printStepsMatrix(matrix): print('---- {}: {}'.format(chainName, namesInCell)) # noqa: ATL901 print('-------------------------') # noqa: ATL901 +def memoize(f): + """ caches call of the helper functions, (copied from the internet) remove when we move to python 3.2 or newer and rplace by functools.lru_cache""" + memo = {} + def helper(*x): + tupledx = tuple(x) + if tupledx not in memo: + memo[tupledx] = f(*x) + return memo[tupledx] + return helper def generateDecisionTree(chains): acc = ComponentAccumulator() mainSequenceName = 'HLTAllSteps' acc.addSequence( seqAND(mainSequenceName) ) - log.debug('Generating decision tree with main sequence: {}'.format(mainSequenceName)) - - chainStepsMatrix = defaultdict(lambda: defaultdict(list)) - - ## Fill chain steps matrix - for index, chain in enumerate(chains): - for stepNumber, chainStep in enumerate(chain.steps): - chainStepsMatrix[stepNumber][chainStep.name].append(chain) - - printStepsMatrix(chainStepsMatrix) - - allCFSequences = [] - - - ## Matrix with steps lists generated. Creating filters for each cell - for nstep in sorted(chainStepsMatrix.keys()): - stepDecisions = [] - - stepName = CFNaming.stepName(nstep) - - stepFilterNodeName = '{}{}'.format(stepName, CFNaming.FILTER_POSTFIX) - filterAcc = ComponentAccumulator() - filterAcc.addSequence( parOR(stepFilterNodeName) ) - - stepRecoNodeName = CFNaming.stepRecoNodeName(mainSequenceName, stepName) - stepRecoNode = parOR(stepRecoNodeName) - recoAcc = ComponentAccumulator() - recoAcc.addSequence(stepRecoNode) - - CFSequences = [] - - chainCounter=0 - for chainName in chainStepsMatrix[nstep]: - chainsInCell = chainStepsMatrix[nstep][chainName] - - if not chainsInCell: - # If cell is empty, there is nothing to do - continue - - firstChain = chainsInCell[0] - if nstep == 0: - filter_input = firstChain.L1decisions - else: - #tmp FP replacement, but it should not work properly - #filter_input = [output for sequence in firstChain.steps[nstep - 1].sequences for output in sequence.outputs] - filter_input = [output for output in allCFSequences[nstep - 1][chainCounter].decisions] - - chainStep = firstChain.steps[nstep] - - # One aggregated filter per chain (one per column in matrix) - filterName = CFNaming.filterName(chainStep.name) - #filter = buildFilter(filterName, filter_input) - - # append input to filter if it exists - filterAlg = findAlgorithm( filterAcc.getSequence(), filterName ) - if filterAlg: - filterAlg.Input += filter_input - else: - filter_output = [ CFNaming.filterOutName(filterName, i) for i in filter_input ] - filterAlg = CompFactory.RoRSeqFilter(filterName, Input=filter_input, Output=filter_output ) - filterAcc.addEventAlgo(filterAlg, sequenceName = stepFilterNodeName) - - stepReco, stepView = createStepView(chainStep.name) - viewWithFilter = seqAND(chainStep.name, [filterAlg, stepView]) - - sfilter = SequenceFilterNode(filterAlg, 'Input', 'Output') - recoAcc.addSequence(viewWithFilter, parentName = stepRecoNodeName) - - stepsAcc = ComponentAccumulator() - - CFSequenceAdded = False - filter_output =[] - for i in filter_input: - filter_output.append( CFNaming.filterOutName(filterName, i)) - - for chain in chainsInCell: - step = chain.steps[nstep] - CFSeq = CFSequence(step, sfilter) - CFSeq.connect(filter_output) - if not CFSequenceAdded: - CFSequences.append(CFSeq) - CFSequenceAdded = True - for seq in step.sequences: - if seq.ca is None: - raise ValueError('ComponentAccumulator missing in sequence {} in chain {}'.format(seq.name, chain.name)) - stepsAcc.merge( seq.ca ) - if step.isCombo: - if step.combo is not None: - stepsAcc.addEventAlgo(step.combo.Alg, sequenceName = stepView.getName()) - sfilter.addChain(chain.name) - - recoAcc.merge(stepsAcc, sequenceName = viewWithFilter.getName()) - chainCounter+=1 - - for sequence in CFSequences: - stepDecisions += sequence.decisions - - - - acc.merge(filterAcc, sequenceName = mainSequenceName) - acc.merge(recoAcc, sequenceName = mainSequenceName) - - summary = makeSummary('TriggerSummary{}'.format(stepName), stepDecisions) - acc.addEventAlgo(summary, sequenceName = mainSequenceName) - - allCFSequences.append(CFSequences) - - stepCF_DataFlow_to_dot(stepRecoNodeName, CFSequences) - stepCF_ControlFlow_to_dot(stepRecoNode) - - acc.printConfig() - - all_DataFlow_to_dot(mainSequenceName, allCFSequences) + @memoize + def getFiltersStepSeq( stepNumber ): + """ + Returns sequence containing all filters for a step + """ + name = 'Step{}_{}'.format(stepNumber, CFNaming.FILTER_POSTFIX) + if stepNumber > 1: + getRecosStepSeq( stepNumber -1 ) # make sure steps sequencers are correctly made: Step1_filter, Step1_recos, Step2_filters, Step2_recos ... + seq = parOR( name ) + acc.addSequence( seq, parentName = mainSequenceName ) + return seq + + @memoize + def getRecosStepSeq( stepNumber ): + """ + """ + getFiltersStepSeq( stepNumber ) # make sure there is filters step before recos + name = 'Step{}{}'.format(stepNumber, CFNaming.RECO_POSTFIX) + seq = parOR( name ) + acc.addSequence( seq, parentName = mainSequenceName ) + return seq + + @memoize + def getSingleMenuSeq( stepNumber, stepName ): + """ + """ + name = "Menu{}{}".format(stepNumber, stepName) + seq = seqAND( name ) + allRecoSeqName = getRecosStepSeq( stepNumber ).name + acc.addSequence(seq, parentName = allRecoSeqName ) + return seq + + + @memoize + def getFilterAlg( stepNumber, stepName ): + """ + Returns, if need be create, filter for a given step + """ + + filtersStep = getFiltersStepSeq( stepNumber ) + singleRecSeq = getSingleMenuSeq( stepNumber, stepName ) + + filterName = CFNaming.filterName( stepName ) + filterAlg = CompFactory.RoRSeqFilter( filterName ) + + acc.addEventAlgo( filterAlg, sequenceName=filtersStep.name ) + acc.addEventAlgo( filterAlg, sequenceName=singleRecSeq.name ) + + log.debug('Creted filter {}'.format(filterName)) + return filterAlg + + @memoize + def findInputMaker( stepCounter, stepName ): + seq = getSingleMenuSeq( stepCounter, stepName ) + algs = findAllAlgorithms( seq ) + for alg in algs: + if isInputMakerBase(alg): + return alg + raise Exception("No input maker in seq "+seq.name) + + @memoize + def findHypoAlg( stepCounter, stepName ): + seq = getSingleMenuSeq( stepCounter, stepName ) + algs = findAllAlgorithms( seq ) + for alg in algs: + if isHypoBase(alg): + return alg + raise Exception("No hypo alg in seq "+seq.name) + + def addAndAssureUniqness( prop, toadd, context="" ): + if toadd not in prop: + log.info("{} value {} not there".format(context, toadd)) + return list( prop ) + [ toadd ] + else: + log.info("{} value {} already there".format(context, toadd)) + return list( prop ) + + def assureUnsetOrTheSame(prop, toadd, context): + """ + Central function setting strnig like proeprties (collection keys). Assures that valid names are not overwritten. + """ + if prop == "" or prop == toadd: + return toadd + if prop != toadd: + raise Exception("{}, when setting property found conflicting values, existing {} and new {}".format(context, prop, toadd)) + + + #create all sequences and filter algs, merge CAs from signatures (decision CF) + for chain in chains: + for stepCounter, step in enumerate( chain.steps, 1 ): + for sequence in step.sequences: + getFilterAlg( stepCounter, step.name ) + recoSeqName = getSingleMenuSeq( stepCounter, step.name ).name + acc.merge( sequence.ca, sequenceName=recoSeqName ) + + # cleanup settings made by Chain & related objects (can be removed in the future) + for chain in chains: + for stepCounter, step in enumerate( chain.steps, 1 ): + filterAlg = getFilterAlg( stepCounter, step.name ) + filterAlg.Input = [] + filterAlg.Output = [] + + imAlg = findInputMaker( stepCounter, step.name ) + imAlg.InputMakerInputDecisions = [] + imAlg.InputMakerOutputDecisions = "" + + hypoAlg = findHypoAlg( stepCounter, step.name ) + hypoAlg.HypoInputDecisions = "" + hypoAlg.HypoOutputDecisions = "" + + # connect all outputs (decision DF) + for chain in chains: + for stepCounter, step in enumerate( chain.steps, 1 ): + for seqCounter, sequence in enumerate( step.sequences ): + + # Filters linking + filterAlg = getFilterAlg( stepCounter, step.name ) + filterAlg.Chains = addAndAssureUniqness( filterAlg.Chains, chain.name, "{} filter alg chains".format( filterAlg.name ) ) + if stepCounter == 1: + filterAlg.Input = addAndAssureUniqness( filterAlg.Input, chain.L1decisions[0], "{} L1 input".format( filterAlg.name ) ) + else: # look into the previous step + hypoOutput = findHypoAlg( stepCounter-1, chain.steps[chain.steps.index( step )-1].name ).HypoOutputDecisions + filterAlg.Input = addAndAssureUniqness( filterAlg.Input, hypoOutput, "{} input".format( filterAlg.name ) ) + + # Input Maker linking + im = findInputMaker( stepCounter, step.name ) + for i in filterAlg.Input: + filterOutputName = CFNaming.filterOutName( filterAlg.name, i ) + filterAlg.Output = addAndAssureUniqness( filterAlg.Output, filterOutputName, "{} output".format( filterAlg.name ) ) + im.InputMakerInputDecisions = addAndAssureUniqness( im.InputMakerInputDecisions, filterOutputName, "{} input".format( im.name ) ) + imOutputName = CFNaming.inputMakerOutName( im.name ) + im.InputMakerOutputDecisions = assureUnsetOrTheSame( im.InputMakerOutputDecisions, imOutputName, "{} IM output".format( im.name ) ) + # Hypo linking + hypoAlg = findHypoAlg( stepCounter, step.name ) + hypoAlg.HypoInputDecisions = assureUnsetOrTheSame( hypoAlg.HypoInputDecisions, im.InputMakerOutputDecisions, + "{} hypo input".format( hypoAlg.name ) ) + hypoOutName = CFNaming.hypoAlgOutName( hypoAlg.name ) + hypoAlg.HypoOutputDecisions = assureUnsetOrTheSame( hypoAlg.HypoOutputDecisions, hypoOutName, + "{} hypo output".format( hypoAlg.name ) ) + + hypoAlg.HypoTools.append( sequence._hypoToolConf.confAndCreate( TriggerConfigHLT.getChainDictFromChainName( chain.name ) ) ) + + for chain in chains: + for stepCounter, step in enumerate( chain.steps, 1 ): + filterAlg = getFilterAlg( stepCounter, step.name ) + log.info("FilterAlg {} Inputs {} Outputs {}".format( filterAlg.name, filterAlg.Input, filterAlg.Output ) ) + + imAlg = findInputMaker( stepCounter, step.name ) + log.info("InputMaker {} Inputs {} Outputs {}".format( imAlg.name, imAlg.InputMakerInputDecisions, imAlg.InputMakerOutputDecisions ) ) + + hypoAlg = findHypoAlg( stepCounter, step.name ) + log.info("HypoAlg {} Inputs {} Outputs {}".format( hypoAlg.name, hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions ) ) return acc @@ -147,6 +192,4 @@ def generateDecisionTree(chains): def createControlFlowNewJO(HLTNode, CFseq_list): """ Creates Control Flow Tree starting from the CFSequences in newJO""" - - return diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 2d74307216f001307b980086963e360e06ac918b..7828ddcdd6724a4e614062b817668759dcdaecc8 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -14,9 +14,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuPrescaleConfig import addSliceChainsTo import TriggerMenuMT.HLTMenuConfig.Menu.MC_pp_run3_v1 as mc_menu import TriggerMenuMT.HLTMenuConfig.Menu.PhysicsP1_pp_run3_v1 as p1_menu -from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import PhysicsStream,SingleMuonGroup,MultiMuonGroup,SingleElectronGroup,MultiElectronGroup,SinglePhotonGroup,MultiPhotonGroup,SingleMETGroup,MultiMETGroup,SingleJetGroup,MultiJetGroup,SingleBjetGroup,SingleTauGroup,MinBiasGroup -#BphysicsGroup (re-add to the preceding line when putting bphys back in) - +from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import PhysicsStream,SingleMuonGroup,MultiMuonGroup,SingleElectronGroup,MultiElectronGroup,SinglePhotonGroup,MultiPhotonGroup,SingleMETGroup,MultiMETGroup,SingleJetGroup,MultiJetGroup,SingleBjetGroup,SingleTauGroup,MinBiasGroup,BphysicsGroup def setupMenu(): @@ -218,13 +216,12 @@ def setupMenu(): ChainProp(name="HLT_tau160_perf_tracktwoMVA_L1TAU100",groups=SingleTauGroup), ] - # TimM temporary disable due to !31039 TriggerFlags.BphysicsSlice.signatures = TriggerFlags.BphysicsSlice.signatures() + [ - #ATR 20603 - # ChainProp(name='HLT_2mu4_bJpsimumu_L12MU4', groups=BphysicsGroup), - # ChainProp(name='HLT_2mu4_bUpsimumu_L12MU4', groups=BphysicsGroup), + #ATR-20603 + ChainProp(name='HLT_2mu4_bJpsimumu_L12MU4', groups=BphysicsGroup), + ChainProp(name='HLT_2mu4_bUpsimumu_L12MU4', groups=BphysicsGroup), #ATR-20839 - # ChainProp(name='HLT_2mu4_bDimu_L12MU4', groups=BphysicsGroup), + ChainProp(name='HLT_2mu4_bDimu_L12MU4', groups=BphysicsGroup), ] TriggerFlags.CombinedSlice.signatures = TriggerFlags.CombinedSlice.signatures() + [ # groups need to be properly assigned here later @@ -236,9 +233,11 @@ def setupMenu(): ChainProp(name='HLT_e7_lhmedium_mu24_L1MU20',l1SeedThresholds=['EM3','MU20'], stream=[PhysicsStream], groups=MultiElectronGroup), # Test photon-muon chain (isolation is there to have different number of steps) ChainProp(name='HLT_g25_medium_mu24_ivarmedium_L1MU20',l1SeedThresholds=['EM15VH','MU20'], stream=[PhysicsStream], groups=MultiElectronGroup), - ] + ] TriggerFlags.HeavyIonSlice.signatures = TriggerFlags.HeavyIonSlice.signatures() + [] - TriggerFlags.BeamspotSlice.signatures = TriggerFlags.BeamspotSlice.signatures() + [] + TriggerFlags.BeamspotSlice.signatures = TriggerFlags.BeamspotSlice.signatures() + [ + ChainProp(name='HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15', l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot', 'BW:BeamSpot']), + ] TriggerFlags.MinBiasSlice.signatures = TriggerFlags.MinBiasSlice.signatures() + [ ChainProp(name='HLT_mb_sptrk_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup), # ChainProp(name='HLT_mb_sp400_trk40_hmt_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index e052d7f34e47dbcb835c101536b09333516b6ea5..74c80a054fb0e8b149158bb495c4df2d98338f10 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -5,6 +5,7 @@ log = logging.getLogger( __name__ ) from collections import MutableSequence from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming from AthenaCommon.CFElements import parOR, seqAND, compName, getProp +from DecisionHandling.DecisionHandlingConfig import ComboHypoCfg from AthenaConfiguration.ComponentFactory import CompFactory RoRSeqFilter=CompFactory.RoRSeqFilter @@ -232,22 +233,22 @@ class InputMakerNode(AlgNode): def __init__(self, Alg): assert isInputMakerBase(Alg), "Error in creating InputMakerNode from Alg " + compName(Alg) AlgNode.__init__(self, Alg, 'InputMakerInputDecisions', 'InputMakerOutputDecisions') - input_maker_output = CFNaming.inputMakerOutName(compName(self.Alg),"out") + input_maker_output = CFNaming.inputMakerOutName(compName(self.Alg)) self.addOutput(input_maker_output) -from DecisionHandling.DecisionHandlingConf import ComboHypo class ComboMaker(AlgNode): - def __init__(self, name, multiplicity): + def __init__(self, name, multiplicity, comboHypoCfg): + self.prop="MultiplicitiesMap" + self.mult=list(multiplicity) + self.comboHypoCfg = comboHypoCfg Alg = RecoFragmentsPool.retrieve( self.create, name ) log.debug("ComboMaker init: Alg %s", name) AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions') - self.prop="MultiplicitiesMap" - self.mult=list(multiplicity) def create (self, name): log.debug("ComboMaker.create %s",name) - return ComboHypo(name) + return self.comboHypoCfg(name) def addChain(self, chainDict): chainName = chainDict['chainName'] @@ -278,8 +279,9 @@ class ComboMaker(AlgNode): return confs = [ HypoToolConf( tool ) for tool in comboToolConfs ] log.debug("ComboMaker.createComboHypoTools for chain %s, Alg %s with %d tools", chainDict["chainName"],self.Alg.getName(), len(comboToolConfs)) - self.Alg.ComboHypoTools = [conf.confAndCreate( chainDict ) for conf in confs] - + for conf in confs: + tools = self.Alg.ComboHypoTools + self.Alg.ComboHypoTools = tools + [ conf.confAndCreate( chainDict ) ] ######################################################### @@ -835,7 +837,7 @@ class StepComponent(object): class ChainStep(object): """Class to describe one step of a chain; if multiplicity is greater than 1, the step is combo/combined. Set one multiplicity value per sequence""" - def __init__(self, name, Sequences=[], multiplicity=[1], chainDicts=[], comboToolConfs=[]): + def __init__(self, name, Sequences=[], multiplicity=[1], chainDicts=[], comboHypoCfg=ComboHypoCfg, comboToolConfs=[]): # sanity check on inputs if len(Sequences) != len(multiplicity): @@ -846,6 +848,7 @@ class ChainStep(object): self.name = name self.sequences=Sequences self.multiplicity = multiplicity + self.comboHypoCfg=comboHypoCfg self.comboToolConfs=comboToolConfs self.isCombo=sum(multiplicity)>1 self.combo=None @@ -854,13 +857,13 @@ class ChainStep(object): self.makeCombo() def addComboHypoTools(self, tools): - self.comboToolConfs=tools + self.comboToolConfs.append(tools) def makeCombo(self): if len(self.sequences)==0: return hashableMult = tuple(self.multiplicity) - self.combo = RecoFragmentsPool.retrieve(createComboAlg, None, name=CFNaming.comboHypoName(self.name), multiplicity=hashableMult) + self.combo = RecoFragmentsPool.retrieve(createComboAlg, None, name=CFNaming.comboHypoName(self.name), multiplicity=hashableMult, comboHypoCfg=self.comboHypoCfg) def createComboHypoTools(self, chainName): if self.isCombo: @@ -881,8 +884,8 @@ class ChainStep(object): return "--- ChainStep %s ---\n + isCombo, multiplicity = %d ChainDict = %s \n + MenuSequences = %s \n + ComboHypo = %s, ComboHypoTools = %s"%(self.name, sum(self.multiplicity), ' '.join(map(str, [dic['chainName'] for dic in self.chainDicts])), ' '.join(map(str, [seq.name for seq in self.sequences]) ), self.combo.Alg.name(), ' '.join(map(str, [tool.__name__ for tool in self.comboToolConfs]))) -def createComboAlg(dummyFlags, name, multiplicity): - return ComboMaker(name, multiplicity) +def createComboAlg(dummyFlags, name, multiplicity, comboHypoCfg): + return ComboMaker(name, multiplicity, comboHypoCfg) # this is fragment for New JO diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py index 097502099f0315f08a90cfeb2d10faa72cda1f92..fc97a087ad76cede98310e610d976a8ffb07c4fa 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py @@ -31,8 +31,8 @@ class CFNaming(object): return CFNaming.simplifyOutName("HLTNav_" + filter_name + "__" + filterIn) @staticmethod - def inputMakerOutName(IMname, filterOut): - return CFNaming.simplifyOutName("HLTNav_" + IMname + "__" + filterOut) + def inputMakerOutName(IMname): + return CFNaming.simplifyOutName("HLTNav_" + IMname) @staticmethod def hypoAlgOutNameOld(HypoName, HypoInput): @@ -45,13 +45,13 @@ class CFNaming(object): name = CFNaming.simplifyOutName("HLTNav_" + HypoName) return name - + @staticmethod def comboHypoName(HypoName): return "ComboHypo_" + HypoName @staticmethod - def comboSequenceCopyName(SequenceName, ncopy, StepName): + def comboSequenceCopyName(SequenceName, ncopy, StepName): if type(SequenceName) is list: sequence = [] for sq in SequenceName: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/PhysicsP1_pp_run3_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/PhysicsP1_pp_run3_v1.py index 21cb69bd0cce09415802f59494a56dcb52e7bb83..a7cf70dbb01dbff391a087e1e3c13dad0ad3b485 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/PhysicsP1_pp_run3_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/PhysicsP1_pp_run3_v1.py @@ -51,7 +51,7 @@ def addP1Signatures(): ] TriggerFlags.HeavyIonSlice.signatures = TriggerFlags.HeavyIonSlice.signatures() + [] TriggerFlags.BeamspotSlice.signatures = TriggerFlags.BeamspotSlice.signatures() + [ - ChainProp(name='HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15', l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot', 'BW:BeamSpot']), + ChainProp(name='HLT_beamspot_trkFS_trkfast_BeamSpotPEB_L1J15', l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot', 'BW:BeamSpot']), #ChainProp(name='HLT_beamspot_activeTE_trkfast_L1J15', l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot', 'BW:BeamSpot']), #ChainProp(name='HLT_beamspot_trkFS_trkfast_L1J15', l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot', 'BW:BeamSpot']), ] @@ -64,6 +64,9 @@ def addP1Signatures(): TriggerFlags.StreamingSlice.signatures = TriggerFlags.StreamingSlice.signatures() + [ ChainProp(name='HLT_noalg_L1RD0_EMPTY', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream, 'BeamSpot'], groups=MinBiasGroup), # FIXME: BeamSpot stream added just for testing, to be removed ChainProp(name='HLT_noalg_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream, 'BeamSpot'], groups=MinBiasGroup), # FIXME: BeamSpot stream added just for testing, to be removed + ChainProp(name='HLT_noalg_idmon_L1RD0_EMPTY', l1SeedThresholds=['FSNOSEED'], stream=['IDMonitoring','express'],groups=['RATE:Monitoring','BW:Detector']), + ChainProp(name='HLT_noalg_idmon_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=['IDMonitoring'],groups=['RATE:Monitoring','BW:Detector']), + ChainProp(name='HLT_noalg_idmon_L1RD0_UNPAIRED_ISO', l1SeedThresholds=['FSNOSEED'], stream=['IDMonitoring'],groups=['RATE:Monitoring','BW:Detector']), # L1 calo streamers ChainProp(name='HLT_noalg_L1EM3', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=EgammaStreamersGroup), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py index 8669608d45660d7be06f9470681037c0c64c822b..3b4f66c1717066b9b4df5bcfd2d0b41be2835daf 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py @@ -89,7 +89,9 @@ def setupMenu(): ChainProp(name='HLT_5j70_0eta240_L14J20', groups=MultiJetGroup), # this chain is supposed to be seeded off L1_4J15 in principle, needs CF fix ChainProp(name='HLT_3j200_L1J100', groups=MultiJetGroup), # FP: workaround tmp for l1SeedThresholds - ChainProp(name='HLT_j80_j60_L1J15', l1SeedThresholds=['FSNOSEED']*2, groups=MultiJetGroup), + ChainProp(name='HLT_j80_L1J15', groups=SingleJetGroup), + ChainProp(name='HLT_2j60_L1J15', groups=MultiJetGroup), + ChainProp(name='HLT_j80_j60_L1J15', l1SeedThresholds=2*['FSNOSEED'], groups=MultiJetGroup), # FP: workaround tmp for l1SeedThresholds ChainProp(name='HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20', l1SeedThresholds=['FSNOSEED']*3, groups=MultiJetGroup), ] @@ -105,11 +107,12 @@ def setupMenu(): #ATR-20049 ChainProp(name="HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100", groups=SingleTauGroup), ] - # TimM temporary disable due to !31039 TriggerFlags.BphysicsSlice.signatures = [ #ATR-20049 - # ChainProp(name='HLT_2mu10_bJpsimumu_L12MU10', groups=BphysicsGroup), - # ChainProp(name='HLT_2mu10_bUpsimumu_L12MU10', groups=BphysicsGroup), + ChainProp(name='HLT_2mu10_bJpsimumu_L12MU10', groups=BphysicsGroup), + ChainProp(name='HLT_mu11_mu6_bJpsimumu_L1MU11_2MU6', groups=BphysicsGroup), + ChainProp(name='HLT_2mu10_bUpsimumu_L12MU10', groups=BphysicsGroup), + ChainProp(name='HLT_mu11_mu6_bUpsimumu_L1MU11_2MU6', groups=BphysicsGroup), ] TriggerFlags.CombinedSlice.signatures = [ ChainProp(name='HLT_e3_etcut1step_mu6fast_L1EM8I_MU10', l1SeedThresholds=['EM8I', 'MU10'], stream=[PhysicsStream], groups=MultiElectronGroup), #L1 item thresholds in wrong order (EM first, then MU) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index c47937b5d36e111827f724ac29fa891b215b5c24..bff457151ad634ce7e7c36b03ceb59bef78f7a22 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -122,7 +122,9 @@ JetChainParts = { 'trkopt' : ['notrk','ftk','ftkrefit','ftf'], 'hypoScenario' : ['simple', 'vbenf', 'vbenfSEP30etSEP34mass35SEP50fbet', - 'dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass'], + 'dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass', + 'HTSEP1000htSEP100etSEP0eta320', + 'HTSEP100htSEP10etSEP0eta320',], 'smc' : ['30smcINF', '35smcINF', '40smcINF', '50smcINF', '60smcINF', 'nosmc'], } diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py index a04c8221bad71a46d13cb1d313040585dab05fab..0b87a9f717ad473d80b3dbc60d7d4895f6c3b1f0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py @@ -33,6 +33,8 @@ _all_streams = [ StreamInfo('IDCosmic','physics',True,True), # EXPRESS STREAM StreamInfo('express', 'express', True, True), + # MONITORING STREAM + StreamInfo('IDMonitoring','monitoring', True, True), # CALIBRATION STREAMS StreamInfo('BeamSpot', 'calibration', True, False), StreamInfo('LArCells', 'calibration', False, False), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py index 2f47f50e54881dcab2bbc4b788500dd04171097e..dc522270a7851c8e5d3cb8c03aa471c56f90a9bf 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py @@ -124,11 +124,6 @@ class MinBiasChainConfig(ChainConfigurationBase): verifier.DataObjects += [( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] - # Make sure required objects are still available at whole-event level - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), - ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] TrkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg TrackCountHypo=TrackCountHypoAlgMT() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py index d2d533dd1a78c5983e9a873cbb09c73080552642..1d49eeb29e5e2fee4d960bb17a0244c9a3435b29 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py @@ -126,11 +126,11 @@ def muCombAlgSequence(ConfigFlags): #Filter algorithm to run muComb only if non-Bphysics muon chains are active from TrigMuonEF.TrigMuonEFConfig import MuonChainFilterAlg + from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming muonChainFilter = MuonChainFilterAlg("FilterBphysChains") bphysChains =getBphysChainNames() muonChainFilter.ChainsToFilter=bphysChains - if hasattr(l2muCombViewsMaker, "InputMakerOutputDecisions"): - muonChainFilter.InputDecisions = [ l2muCombViewsMaker.InputMakerOutputDecisions ] + muonChainFilter.InputDecisions = [ CFNaming.inputMakerOutName(l2muCombViewsMaker.name()) ] muonChainFilter.L2MuCombContainer = sequenceOut muCombFilterSequence = seqAND("l2muCombFilterSequence", [muonChainFilter, muCombRecoSequence]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index c3a51add646f5be60242b9578ec1285ee857c186..3cd860a18b78037c354f2ae7b3d468a7f80ac0f6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -12,6 +12,7 @@ from TrigEDMConfig.TriggerEDMRun3 import recordable from MuonConfig.MuonBytestreamDecodeConfig import MuonCacheNames from MuonConfig.MuonRdoDecodeConfig import MuonPrdCacheNames + TrackParticlesName = recordable("HLT_IDTrack_Muon_FTF") theFTF_name = "FTFTracks_Muons" CBTPname = recordable("HLT_CBCombinedMuon_RoITrackParticles") @@ -228,18 +229,16 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False): from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RPC_RawDataProviderToolMT MuonRpcRawDataProviderTool = Muon__RPC_RawDataProviderToolMT(name = "RPC_RawDataProviderToolMT", RpcContainerCacheKey = MuonCacheNames.RpcCache, - WriteOutRpcSectorLogic = False, # we don't need the RPC sector logic when running the trigger and can't write it out if we want to use the IDC cache for the RDOs + WriteOutRpcSectorLogic = False, + # we don't need the RPC sector logic when running the trigger and + #can't write it out if we want to use the IDC cache for the RDOs Decoder = RPCRodDecoder ) ToolSvc += MuonRpcRawDataProviderTool - from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool - RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name = "RpcRdoToPrepDataTool") - - #from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataToolMT - #RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataToolMT(name = "RpcRdoToPrepDataTool", - # RpcPrdContainerCacheKey = MuonPrdCacheNames.RpcCache, - # RpcCoinContainerCacheKey = MuonPrdCacheNames.RpcCoinCache) - #RpcRdoToRpcPrepDataTool.OutputLevel = DEBUG + from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataToolMT + RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataToolMT(name = "RpcRdoToPrepDataTool", + RpcPrdContainerCacheKey = MuonPrdCacheNames.RpcCache, + RpcCoinDataContainerCacheKey = MuonPrdCacheNames.RpcCoinCache) if athenaCommonFlags.isOnline: RpcRdoToRpcPrepDataTool.ReadKey = "" @@ -336,11 +335,6 @@ def muFastRecoSequence( RoIs ): ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), ( 'DataVector< LVL1::RecMuonRoI >' , 'StoreGateSvc+HLT_RecMURoIs' )] - # Make sure event info still available at whole-event level - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] - # Only load these objects if they aren't available in conddb from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "/CSC/DCS/LAYERSTATE" ): @@ -514,12 +508,9 @@ def muEFSARecoSequence( RoIs, name ): EFMuonViewDataVerifier.DataObjects = [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] efAlgs.append( EFMuonViewDataVerifier ) - # Make sure event info still available at whole-event level + # Only load these objects if they aren't available in conddb from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] - - # Only load these objects if they aren't available in conddb from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "/MDT/DQMF/DEAD_ELEMENT" ): EFMuonViewDataVerifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/MDT/DQMF/DEAD_ELEMENT' )] @@ -647,7 +638,6 @@ def muEFCBRecoSequence( RoIs, name ): # Make sure required objects are still available at whole-event level from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "PixelClustering/PixelClusNNCalib" ): topSequence.SGInputLoader.Load += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), @@ -674,9 +664,6 @@ def muEFCBRecoSequence( RoIs, name ): ( 'xAOD::IParticleContainer' , 'StoreGateSvc+'+TrackParticlesName ), ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] #seems to be necessary, despite the load below - # Make sure required objects are still available at whole-event level - topSequence.SGInputLoader.Load += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] - # This object must be loaded from SG if it's not loaded in conddb (algs request it but ignore) from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "Cond/StatusHT" ): @@ -932,8 +919,8 @@ def efLateMuRoISequence(): topSequence = AlgSequence() topSequence.SGInputLoader.Load += [( 'MuCTPI_RDO' , 'StoreGateSvc+MUCTPI_RDO' )] - from TrigmuRoI.TrigmuRoIConfig import TrigmuRoIMT - roiAlg = TrigmuRoIMT("TrigmuRoIMT") + from TrigmuRoI.TrigmuRoIConfig import TrigmuRoIMTConfig + roiAlg = TrigmuRoIMTConfig("TrigmuRoIMT") sequenceOut = "LateMuRoIs" roiAlg.RoisWriteHandleKey=sequenceOut diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py index 270be78a76db970e9853dd50714f5bdd6d659f37..2c571ee87957ad1b2bb6b035469d0377da5c50cf 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py @@ -3,13 +3,17 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, ChainStep, Chain, getChainStepName, createStepView from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from TrigL2MuonSA.TrigL2MuonSAConfig_newJO import l2MuFastRecoCfg, l2MuFastHypoCfg +from TrigL2MuonSA.TrigL2MuonSAConfig_newJO import l2MuFastAlgCfg, l2MuFastHypoCfg from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMufastHypoToolFromDict from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from AthenaConfiguration.ComponentFactory import CompFactory +import pprint +from AthenaCommon.Logging import logging +log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Muon.generateMuon' ) + def fakeHypoAlgCfg(flags, name="FakeHypoForMuon"): HLTTest__TestHypoAlg=CompFactory.HLTTest.TestHypoAlg return HLTTest__TestHypoAlg( name, Input="" ) @@ -17,14 +21,82 @@ def fakeHypoAlgCfg(flags, name="FakeHypoForMuon"): def generateChains( flags, chainDict ): chainDict = splitChainDict(chainDict)[0] + # Step 1 (L2MuonSA) stepName = getChainStepName('Muon', 1) stepReco, stepView = createStepView(stepName) acc = ComponentAccumulator() acc.addSequence(stepView) - l2muFastReco = l2MuFastRecoCfg(flags) - acc.merge( l2muFastReco, sequenceName=stepReco.getName() ) + # Set EventViews for L2MuonSA step + from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco + reco = InViewReco("L2MuFastReco") + + + + # decoding + # Get RPC BS decoder + from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg + rpcAcc = RpcBytestreamDecodeCfg( flags, forTrigger=True ) + rpcAcc.getEventAlgo("RpcRawDataProvider").RoIs = reco.name+"RoIs" + reco.mergeReco( rpcAcc ) + + # Get RPC BS->RDO convertor + from MuonConfig.MuonRdoDecodeConfig import RpcRDODecodeCfg + rpcAcc = RpcRDODecodeCfg( flags, forTrigger=True ) + rpcAcc.getEventAlgo("RpcRdoToRpcPrepData").RoIs = reco.name+"RoIs" + reco.mergeReco( rpcAcc ) + + # Get TGC BS decoder + from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg + tgcAcc = TgcBytestreamDecodeCfg( flags, forTrigger=True ) + tgcAcc.getEventAlgo("TgcRawDataProvider").RoIs = reco.name+"RoIs" + reco.mergeReco( tgcAcc ) + + # Get TGC BS->RDO convertor + from MuonConfig.MuonRdoDecodeConfig import TgcRDODecodeCfg + tgcAcc = TgcRDODecodeCfg( flags, forTrigger=True ) + tgcAcc.getEventAlgo("TgcRdoToTgcPrepData").RoIs = reco.name+"RoIs" + reco.mergeReco( tgcAcc ) + + # Get MDT BS decoder + from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg + mdtAcc = MdtBytestreamDecodeCfg( flags, forTrigger=True ) + mdtAcc.getEventAlgo("MdtRawDataProvider").RoIs = reco.name+"RoIs" + reco.mergeReco( mdtAcc ) + + # Get MDT BS->RDO convertor + from MuonConfig.MuonRdoDecodeConfig import MdtRDODecodeCfg + mdtAcc = MdtRDODecodeCfg( flags, forTrigger=True ) + mdtAcc.getEventAlgo("MdtRdoToMdtPrepData").RoIs = reco.name+"RoIs" + reco.mergeReco( mdtAcc ) + + # Get CSC BS decoder + from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg + cscAcc = CscBytestreamDecodeCfg( flags, forTrigger=True ) + cscAcc.getEventAlgo("CscRawDataProvider").RoIs = reco.name+"RoIs" + reco.mergeReco( cscAcc ) + + # Get CSC BS->RDO convertor + from MuonConfig.MuonRdoDecodeConfig import CscRDODecodeCfg + cscAcc = CscRDODecodeCfg( flags, forTrigger=True ) + cscAcc.getEventAlgo("CscRdoToCscPrepData").RoIs = reco.name+"RoIs" + reco.mergeReco( cscAcc ) + + # Get CSC cluster builder + from MuonConfig.MuonRdoDecodeConfig import CscClusterBuildCfg + cscAcc = CscClusterBuildCfg( flags, forTrigger=True ) + reco.mergeReco( cscAcc ) + + + + # Get Reco alg of muFast Step in order to set into the view + algAcc, alg = l2MuFastAlgCfg( flags, roisKey=reco.name+"RoIs") + + reco.addRecoAlg( alg ) + reco.merge( algAcc ) + # l2muFastReco = l2MuFastRecoCfg(flags) + acc.merge( reco, sequenceName=stepReco.getName() ) ### Set muon step1 ### l2muFastHypo = l2MuFastHypoCfg( flags, @@ -33,8 +105,8 @@ def generateChains( flags, chainDict ): acc.addEventAlgo(l2muFastHypo, sequenceName=stepView.getName()) - l2muFastSequence = CAMenuSequence( Sequence = l2muFastReco.sequence(), - Maker = l2muFastReco.inputMaker(), + l2muFastSequence = CAMenuSequence( Sequence = reco.sequence(), + Maker = reco.inputMaker(), Hypo = l2muFastHypo, HypoToolGen = TrigMufastHypoToolFromDict, CA = acc ) @@ -63,6 +135,15 @@ def generateChains( flags, chainDict ): from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco recoMS = InViewReco("EFMuMSReco") + recoMS.inputMaker().RequireParentView = True + EFMuonViewDataVerifier = CompFactory.getComp("AthViews::ViewDataVerifier")("EFMuonViewDataVerifier") + EFMuonViewDataVerifier.DataObjects = [( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ), + ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ), + ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ), + ( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' ), + ( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )] + + recoMS.addRecoAlg(EFMuonViewDataVerifier) from MuonConfig.MuonSegmentFindingConfig import MooSegmentFinderAlgCfg segCfg = MooSegmentFinderAlgCfg(muonflags,name="TrigMooSegmentFinder",UseTGCNextBC=False, UseTGCPriorBC=False) @@ -101,8 +182,9 @@ def generateChains( flags, chainDict ): for part in chainDict['chainParts']: l1Thresholds.append(part['L1threshold']) - import pprint - pprint.pprint(chainDict) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) + + chain = Chain( name=chainDict['chainName'], L1Thresholds=l1Thresholds, ChainSteps=[ l2muFastStep, efmuMSStep ] ) return chain diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py index 5fa0223e2345de27eddf1768c2262ec0897113d8..c75dc472186dbed007ac2394ba4945540dfc2ce3 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py @@ -10,6 +10,10 @@ from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict from TrigEDMConfig.TriggerEDMRun3 import recordable +import pprint +from AthenaCommon.Logging import logging +log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Photon.generatePhoton' ) + def generateChains(flags, chainDict): firstStepName = getChainStepName('Photon', 1) @@ -68,9 +72,7 @@ def generateChains(flags, chainDict): for part in chainDict['chainParts']: l1Thresholds.append(part['L1threshold']) - import pprint - pprint.pprint(chainDict) - + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) chain = Chain(chainDict['chainName'], L1Thresholds=l1Thresholds, ChainSteps=[fastCaloStep, l2PhotonStep]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py index 1bc857bdf62d1afa3260d80f62b90ae0dd6d41fc..677a3d8941d4715229a2a43568efce77b1f6c574 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py @@ -3,6 +3,7 @@ # from AthenaCommon.CFElements import parOR, seqAND +from AthenaCommon.GlobalFlags import globalflags from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool, ViewCreatorPreviousROITool from TrigT2CaloCommon.CaloDef import HLTLCTopoRecoSequence from TrigEDMConfig.TriggerEDMRun3 import recordable @@ -147,8 +148,7 @@ def tauCaloSequence(ConfigFlags): # Make sure the required objects are still available at whole-event level from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' ), - ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] + topSequence.SGInputLoader.Load += [( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' )] if not hasattr( topSequence, "CaloBCIDAvgAlg" ): topSequence.SGInputLoader.Load += [( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' )] @@ -180,8 +180,7 @@ def tauCaloMVASequence(ConfigFlags): # Make sure the required objects are still available at whole-event level from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' ), - ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] + topSequence.SGInputLoader.Load += [( 'ILArHVScaleCorr' , 'ConditionStore+LArHVScaleCorrRecomputed' )] if not hasattr( topSequence, "CaloBCIDAvgAlg" ): topSequence.SGInputLoader.Load += [( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' )] @@ -197,6 +196,9 @@ def tauIdTrackSequence( RoIs , name): if ("Iso" in name) or ("TrackTwo" in name) or ("EF" in name): signName = 'TauIso' + from TrigInDetConfig.InDetSetup import makeInDetAlgs + viewAlgs, viewVerify = makeInDetAlgs( whichSignature=signName, separateTrackParticleCreator=signName, rois = RoIs ) + tauViewDataVerifierName = "" if "FTFId" in name: tauViewDataVerifierName = "tauViewDataVerifierIdFTF" @@ -210,40 +212,39 @@ def tauIdTrackSequence( RoIs , name): tauViewDataVerifierName = "tauViewDataVerifierEF" from TrigInDetConfig.InDetSetup import makeInDetAlgs - viewAlgs, ViewVerify = makeInDetAlgs( whichSignature=signName, separateTrackParticleCreator = "_" + signName, rois = RoIs, viewVerifier = tauViewDataVerifierName ) + viewAlgs, viewVerify = makeInDetAlgs( whichSignature=signName, separateTrackParticleCreator=signName, rois = RoIs, viewVerifier = tauViewDataVerifierName ) if "FTFIso" in name: - ViewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnlyMVA' )] + viewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnlyMVA' )] else: - ViewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly')] + viewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly')] - ViewVerify.DataObjects += [( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ), + viewVerify.DataObjects += [( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+' + RoIs ), ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), - ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly' ), - ( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] + ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly' )] # Make sure the required objects are still available at whole-event level from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), - ( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] + from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "PixelClustering/PixelClusNNCalib" ): topSequence.SGInputLoader.Load += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), ( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNNWithTrack' )] - ViewVerify.DataObjects += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), + viewVerify.DataObjects += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), ( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNNWithTrack' )] + if globalflags.InputFormat.is_bytestream(): + viewVerify.DataObjects += [( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ), + ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' ) ] + else: + topSequence.SGInputLoader.Load += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] + viewVerify.DataObjects += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )] + for viewAlg in viewAlgs: tauIdTrackSequence += viewAlg - if "RoIs" in viewAlg.properties(): - viewAlg.RoIs = RoIs - if "roiCollectionName" in viewAlg.properties(): - viewAlg.roiCollectionName = RoIs - if "TrackRoiUpdater" in viewAlg.name(): - viewAlg.RoIInputKey = RoIs if "TrigFastTrackFinder" in viewAlg.name(): TrackCollection = viewAlg.TracksName if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): @@ -305,39 +306,30 @@ def tauCoreTrackSequence( RoIs, name ): tauCoreTrackSequence = seqAND(name) from TrigInDetConfig.InDetSetup import makeInDetAlgs - viewAlgs, ViewVerify = makeInDetAlgs(whichSignature='TauCore',separateTrackParticleCreator="_TauCore",rois = RoIs) + viewAlgs, viewVerify = makeInDetAlgs( whichSignature='TauCore', separateTrackParticleCreator="TauCore", rois = RoIs ) for viewAlg in viewAlgs: if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): TrackCollection = viewAlg.TrackName - ViewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnlyMVA' ), + viewVerify.DataObjects += [( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnlyMVA' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+' + RoIs ), ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] #For some reason not picked up properly - # Make sure the required objects are still available at whole-event level - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence.SGInputLoader.Load += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )] from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( "PixelClustering/PixelClusNNCalib" ): + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() topSequence.SGInputLoader.Load += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), ( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNNWithTrack' )] - ViewVerify.DataObjects += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), + viewVerify.DataObjects += [( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNN' ), ( 'TTrainedNetworkCollection' , 'ConditionStore+PixelClusterNNWithTrack' )] tauTrackRoiUpdaterAlg = _algoTauTrackRoiUpdater(inputRoIs = RoIs, tracks = TrackCollection) viewAlgs.append(tauTrackRoiUpdaterAlg) - for viewAlg in viewAlgs: - tauCoreTrackSequence += viewAlg - if "RoIs" in viewAlg.properties(): - viewAlg.RoIs = RoIs - if "roiCollectionName" in viewAlg.properties(): - viewAlg.roiCollectionName = RoIs - if "TrackRoiUpdater" in viewAlg.name(): - viewAlg.RoIInputKey = RoIs + tauCoreTrackSequence += viewAlgs sequenceOut = TrackCollection diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py index 27e84a98a55c85676f84827ad75cc099157f7638..2e1c1fb48d5552bd8aa106cf50f96a638d526bdb 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py @@ -3,7 +3,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.Test.TestDef import TestChainConfiguration as TestChainConfiguration - +import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Test.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -11,8 +11,7 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - import pprint - pprint.pprint( chainDict ) + log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) listOfChainDicts = splitChainDict(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py index e923d4f52e297ee09dbdd0f24fb84b92b4321ad8..0ea9f302ba9f5e00067560977fa9c975bf8b0d58 100644 --- a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py +++ b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py @@ -9,7 +9,7 @@ from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.GlobalFlags import globalflags # Input file is only needed so that TileCal picks up the correct cabling according to the year -athenaCommonFlags.FilesInput=["/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data18_13TeV.00349335.physics_EnhancedBias.merge.RAW._lb0200._SFO-1._0001.1"] +athenaCommonFlags.FilesInput=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.merge.RAW._lb0151._SFO-1._0001.1"] athenaCommonFlags.BSRDOInput=[] athenaCommonFlags.PoolRDOInput=[] athenaCommonFlags.isOnline = True diff --git a/graphics/EventDisplayFilters/CMakeLists.txt b/graphics/EventDisplayFilters/CMakeLists.txt index 2308f31fb14af7437aedf233165d1434d6f82780..5f659aa19c5f41804447ca53c9c48ad09b5bc97b 100644 --- a/graphics/EventDisplayFilters/CMakeLists.txt +++ b/graphics/EventDisplayFilters/CMakeLists.txt @@ -25,8 +25,4 @@ atlas_add_component( EventDisplayFilters # Install files from the package: atlas_install_headers( EventDisplayFilters ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) - -atlas_add_test( flake8_share - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share - POST_EXEC_SCRIPT nopost.sh ) +atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/graphics/GeometryJiveXML/CMakeLists.txt b/graphics/GeometryJiveXML/CMakeLists.txt index 501437d55bb9a149e6c44d584b6df061aa7f2090..bbb24b8182ed5ea044f9b91c627f4de774401754 100644 --- a/graphics/GeometryJiveXML/CMakeLists.txt +++ b/graphics/GeometryJiveXML/CMakeLists.txt @@ -25,6 +25,7 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( GeoModelCore ) +find_package( CLHEP ) # Component(s) in the package: atlas_add_component( GeometryJiveXML